Skip to content

Commit b3c4c05

Browse files
authored
Merge pull request #2541 from pyth-network/cprussin/add-permissioned-feeds-column
feat(insights): add permissioned feeds column to the publisher list
2 parents e8d1f79 + b7213cc commit b3c4c05

File tree

4 files changed

+56
-6
lines changed

4 files changed

+56
-6
lines changed

apps/insights/src/components/Explanations/index.tsx

+18
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,24 @@ import { useMemo } from "react";
44
import { Explain } from "../Explain";
55
import { FormattedDate } from "../FormattedDate";
66

7+
export const ExplainPermissioned = ({
8+
scoreTime,
9+
}: {
10+
scoreTime?: Date | undefined;
11+
}) => {
12+
return (
13+
<Explain size="xs" title="Permissioned Feeds">
14+
<p>
15+
This is the number of <b>Price Feeds</b> that a <b>Publisher</b> has
16+
permissions to publish to. The publisher is not necessarily push data
17+
for all the feeds they have access to, and some feeds may not be live
18+
yet.
19+
</p>
20+
{scoreTime && <EvaluationTime scoreTime={scoreTime} />}
21+
</Explain>
22+
);
23+
};
24+
725
export const ExplainAverage = ({
826
scoreTime,
927
}: {

apps/insights/src/components/Publishers/index.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ export const Publishers = async () => {
147147
const toTableRow = ({
148148
key,
149149
rank,
150+
permissionedFeeds,
150151
inactiveFeeds,
151152
activeFeeds,
152153
averageScore,
@@ -155,8 +156,9 @@ const toTableRow = ({
155156
return {
156157
id: key,
157158
ranking: rank,
158-
activeFeeds: activeFeeds,
159-
inactiveFeeds: inactiveFeeds,
159+
permissionedFeeds,
160+
activeFeeds,
161+
inactiveFeeds,
160162
averageScore,
161163
...(knownPublisher && {
162164
name: knownPublisher.name,

apps/insights/src/components/Publishers/publishers-card.tsx

+30-4
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ import styles from "./publishers-card.module.scss";
2424
import { useQueryParamFilterPagination } from "../../hooks/use-query-param-filter-pagination";
2525
import { CLUSTER_NAMES } from "../../services/pyth";
2626
import { EntityList } from "../EntityList";
27-
import { ExplainActive, ExplainInactive } from "../Explanations";
27+
import {
28+
ExplainPermissioned,
29+
ExplainActive,
30+
ExplainInactive,
31+
} from "../Explanations";
2832
import { NoResults } from "../NoResults";
2933
import { PublisherTag } from "../PublisherTag";
3034
import { Ranking } from "../Ranking";
@@ -43,6 +47,7 @@ type Props = {
4347
type Publisher = {
4448
id: string;
4549
ranking: number;
50+
permissionedFeeds: number;
4651
activeFeeds: number;
4752
inactiveFeeds: number;
4853
averageScore: number;
@@ -99,6 +104,7 @@ const ResolvedPublishersCard = ({
99104
(a, b, { column, direction }) => {
100105
switch (column) {
101106
case "ranking":
107+
case "permissionedFeeds":
102108
case "activeFeeds":
103109
case "inactiveFeeds":
104110
case "averageScore": {
@@ -131,6 +137,7 @@ const ResolvedPublishersCard = ({
131137
id,
132138
ranking,
133139
averageScore,
140+
permissionedFeeds,
134141
activeFeeds,
135142
inactiveFeeds,
136143
...publisher
@@ -149,6 +156,7 @@ const ResolvedPublishersCard = ({
149156
})}
150157
/>
151158
),
159+
permissionedFeeds,
152160
activeFeeds: (
153161
<Link
154162
href={`/publishers/${cluster}/${id}/price-feeds?status=Active`}
@@ -224,7 +232,12 @@ type PublishersCardContentsProps = Pick<Props, "className" | "explainAverage"> &
224232
cluster: (typeof CLUSTER_NAMES)[number];
225233
onChangeCluster: (value: (typeof CLUSTER_NAMES)[number]) => void;
226234
rows: (RowConfig<
227-
"ranking" | "name" | "activeFeeds" | "inactiveFeeds" | "averageScore"
235+
| "ranking"
236+
| "name"
237+
| "permissionedFeeds"
238+
| "activeFeeds"
239+
| "inactiveFeeds"
240+
| "averageScore"
228241
> & { textValue: string })[];
229242
}
230243
);
@@ -299,6 +312,7 @@ const PublishersCardContents = ({
299312
headerLoadingSkeleton={<PublisherTag isLoading />}
300313
fields={[
301314
{ id: "averageScore", name: "Average Score" },
315+
{ id: "permissionedFeeds", name: "Permissioned Feeds" },
302316
{ id: "activeFeeds", name: "Active Feeds" },
303317
{ id: "inactiveFeeds", name: "Inactive Feeds" },
304318
]}
@@ -339,11 +353,23 @@ const PublishersCardContents = ({
339353
loadingSkeleton: <PublisherTag isLoading />,
340354
allowsSorting: true,
341355
},
356+
{
357+
id: "permissionedFeeds",
358+
name: (
359+
<>
360+
FEEDS
361+
<ExplainPermissioned />
362+
</>
363+
),
364+
alignment: "center",
365+
width: 30,
366+
allowsSorting: true,
367+
},
342368
{
343369
id: "activeFeeds",
344370
name: (
345371
<>
346-
ACTIVE FEEDS
372+
ACTIVE
347373
<ExplainActive />
348374
</>
349375
),
@@ -355,7 +381,7 @@ const PublishersCardContents = ({
355381
id: "inactiveFeeds",
356382
name: (
357383
<>
358-
INACTIVE FEEDS
384+
INACTIVE
359385
<ExplainInactive />
360386
</>
361387
),

apps/insights/src/services/clickhouse.ts

+4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ export const getPublishers = async (cluster: Cluster) =>
1515
z.strictObject({
1616
key: z.string(),
1717
rank: z.number(),
18+
permissionedFeeds: z
19+
.string()
20+
.transform((value) => Number.parseInt(value, 10)),
1821
activeFeeds: z
1922
.string()
2023
.transform((value) => Number.parseInt(value, 10)),
@@ -50,6 +53,7 @@ export const getPublishers = async (cluster: Cluster) =>
5053
timestamp,
5154
publisher AS key,
5255
rank,
56+
LENGTH(symbols) AS permissionedFeeds,
5357
activeFeeds,
5458
inactiveFeeds,
5559
score_data.averageScore,

0 commit comments

Comments
 (0)