-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Expand file tree
/
Copy pathFeaturesListDisplay.tsx
More file actions
54 lines (48 loc) · 1.17 KB
/
FeaturesListDisplay.tsx
File metadata and controls
54 lines (48 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import { EuiBasicTable } from "@elastic/eui";
import EuiCustomLink from "./EuiCustomLink";
import { feast } from "../protos";
interface FeaturesListProps {
projectName: string;
featureViewName: string;
features: feast.core.IFeatureSpecV2[];
link: boolean;
}
const FeaturesList = ({
projectName,
featureViewName,
features,
link,
}: FeaturesListProps) => {
let columns: { name: string; render?: any; field: any }[] = [
{
name: "Name",
field: "name",
render: (item: string) => (
<EuiCustomLink
to={`/p/${projectName}/feature-view/${featureViewName}/feature/${item}`}
>
{item}
</EuiCustomLink>
),
},
{
name: "Value Type",
field: "valueType",
render: (valueType: feast.types.ValueType.Enum) => {
return feast.types.ValueType.Enum[valueType];
},
},
];
if (!link) {
columns[0].render = undefined;
}
const getRowProps = (item: feast.core.IFeatureSpecV2) => {
return {
"data-test-subj": `row-${item.name}`,
};
};
return (
<EuiBasicTable columns={columns} items={features} rowProps={getRowProps} />
);
};
export default FeaturesList;