FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

feat: Add feature view lineage tab and filtering to home page lineage by franciscojavierarceo · Pull Request #5308 · feast-dev/feast · GitHub

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .tsx  (4) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
17 changes: 16 additions & 1 deletion ui/src/components/RegistryVisualization.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -572,12 +572,14 @@ interface RegistryVisualizationProps {
registryData: feast.core.Registry;
relationships: EntityRelation[];
indirectRelationships: EntityRelation[];
filterNode?: { type: FEAST_FCO_TYPES; name: string };
}

const RegistryVisualization: React.FC<RegistryVisualizationProps> = ({
registryData,
relationships,
indirectRelationships,
filterNode,
}) => {
const [nodes, setNodes, onNodesChange] = useNodesState([]);
const [edges, setEdges, onEdgesChange] = useEdgesState([]);
Expand All @@ -592,10 +594,22 @@ const RegistryVisualization: React.FC<RegistryVisualizationProps> = ({
setLoading(true);

// Only include indirect relationships if the toggle is on
const relationshipsToShow = showIndirectRelationships
let relationshipsToShow = showIndirectRelationships
? [...relationships, ...indirectRelationships]
: relationships;

// Filter relationships based on filterNode if provided
if (filterNode) {
relationshipsToShow = relationshipsToShow.filter((rel) => {
return (
(rel.source.type === filterNode.type &&
rel.source.name === filterNode.name) ||
(rel.target.type === filterNode.type &&
rel.target.name === filterNode.name)
);
});
}

// Filter out invalid relationships
const validRelationships = relationshipsToShow.filter((rel) => {
// Add additional validation as needed for your use case
Expand Down Expand Up @@ -625,6 +639,7 @@ const RegistryVisualization: React.FC<RegistryVisualizationProps> = ({
indirectRelationships,
showIndirectRelationships,
showIsolatedNodes,
filterNode,
setNodes,
setEdges,
]);
Expand Down
96 changes: 94 additions & 2 deletions ui/src/components/RegistryVisualizationTab.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -1,12 +1,56 @@
import React, { useContext } from "react";
import { EuiEmptyPrompt, EuiLoadingSpinner, EuiSpacer } from "@elastic/eui";
import React, { useContext, useState } from "react";
import {
EuiEmptyPrompt,
EuiLoadingSpinner,
EuiSpacer,
EuiSelect,
EuiFormRow,
EuiFlexGroup,
EuiFlexItem,
} from "@elastic/eui";
import useLoadRegistry from "../queries/useLoadRegistry";
import RegistryPathContext from "../contexts/RegistryPathContext";
import RegistryVisualization from "./RegistryVisualization";
import { FEAST_FCO_TYPES } from "../parsers/types";

const RegistryVisualizationTab = () => {
const registryUrl = useContext(RegistryPathContext);
const { isLoading, isSuccess, isError, data } = useLoadRegistry(registryUrl);
const [selectedObjectType, setSelectedObjectType] = useState("");
const [selectedObjectName, setSelectedObjectName] = useState("");

const getObjectOptions = (objects: any, type: string) => {
switch (type) {
case "dataSource":
const dataSources = new Set<string>();
objects.featureViews?.forEach((fv: any) => {
if (fv.spec?.batchSource?.name)
dataSources.add(fv.spec.batchSource.name);
});
objects.streamFeatureViews?.forEach((sfv: any) => {
if (sfv.spec?.batchSource?.name)
dataSources.add(sfv.spec.batchSource.name);
if (sfv.spec?.streamSource?.name)
dataSources.add(sfv.spec.streamSource.name);
});
return Array.from(dataSources);
case "entity":
return objects.entities?.map((entity: any) => entity.spec?.name) || [];
case "featureView":
return [
...(objects.featureViews?.map((fv: any) => fv.spec?.name) || []),
...(objects.onDemandFeatureViews?.map(
(odfv: any) => odfv.spec?.name,
) || []),
...(objects.streamFeatureViews?.map((sfv: any) => sfv.spec?.name) ||
[]),
];
case "featureService":
return objects.featureServices?.map((fs: any) => fs.spec?.name) || [];
default:
return [];
}
};

return (
<>
Expand All @@ -31,10 +75,58 @@ const RegistryVisualizationTab = () => {
{isSuccess && data && (
<>
<EuiSpacer size="l" />
<EuiFlexGroup style={{ marginBottom: 16 }}>
<EuiFlexItem grow={false} style={{ width: 200 }}>
<EuiFormRow label="Filter by type">
<EuiSelect
options={[
{ value: "", text: "All" },
{ value: "dataSource", text: "Data Source" },
{ value: "entity", text: "Entity" },
{ value: "featureView", text: "Feature View" },
{ value: "featureService", text: "Feature Service" },
]}
value={selectedObjectType}
onChange={(e) => {
setSelectedObjectType(e.target.value);
setSelectedObjectName(""); // Reset name when type changes
}}
aria-label="Select object type"
/>
</EuiFormRow>
</EuiFlexItem>
<EuiFlexItem grow={false} style={{ width: 300 }}>
<EuiFormRow label="Select object">
<EuiSelect
options={[
{ value: "", text: "All" },
...getObjectOptions(data.objects, selectedObjectType).map(
(name: string) => ({
value: name,
text: name,
}),
),
]}
value={selectedObjectName}
onChange={(e) => setSelectedObjectName(e.target.value)}
aria-label="Select object"
disabled={selectedObjectType === ""}
/>
</EuiFormRow>
</EuiFlexItem>
</EuiFlexGroup>
<RegistryVisualization
registryData={data.objects}
relationships={data.relationships}
indirectRelationships={data.indirectRelationships}
filterNode={
selectedObjectType && selectedObjectName
? {
type: selectedObjectType as FEAST_FCO_TYPES,
name: selectedObjectName,
}
: undefined
}
/>
</>
)}
Expand Down
61 changes: 61 additions & 0 deletions ui/src/pages/feature-views/FeatureViewLineageTab.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import React, { useContext } from "react";
import { useParams } from "react-router-dom";
import { EuiEmptyPrompt, EuiLoadingSpinner } from "@elastic/eui";
import { feast } from "../../protos";
import useLoadRegistry from "../../queries/useLoadRegistry";
import RegistryPathContext from "../../contexts/RegistryPathContext";
import RegistryVisualization from "../../components/RegistryVisualization";
import { FEAST_FCO_TYPES } from "../../parsers/types";

interface FeatureViewLineageTabProps {
data: feast.core.IFeatureView;
}

const FeatureViewLineageTab = ({ data }: FeatureViewLineageTabProps) => {
const registryUrl = useContext(RegistryPathContext);
const {
isLoading,
isSuccess,
isError,
data: registryData,
} = useLoadRegistry(registryUrl);
const { featureViewName } = useParams();

const filterNode = {
type: FEAST_FCO_TYPES.featureView,
name: featureViewName || data.spec?.name || "",
};

return (
<>
{isLoading && (
<div style={{ display: "flex", justifyContent: "center", padding: 25 }}>
<EuiLoadingSpinner size="xl" />
</div>
)}
{isError && (
<EuiEmptyPrompt
iconType="alert"
color="danger"
title={<h2>Error Loading Registry Data</h2>}
body={
<p>
There was an error loading the Registry Data. Please check that{" "}
<code>feature_store.yaml</code> file is available and well-formed.
</p>
}
/>
)}
{isSuccess && registryData && (
<RegistryVisualization
registryData={registryData.objects}
relationships={registryData.relationships}
indirectRelationships={registryData.indirectRelationships}
filterNode={filterNode}
/>
)}
</>
);
};

export default FeatureViewLineageTab;
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { FeatureViewIcon } from "../../graphics/FeatureViewIcon";

import { useMatchExact, useMatchSubpath } from "../../hooks/useMatchSubpath";
import RegularFeatureViewOverviewTab from "./RegularFeatureViewOverviewTab";
import FeatureViewLineageTab from "./FeatureViewLineageTab";

import {
useRegularFeatureViewCustomTabs,
Expand Down Expand Up @@ -33,6 +34,14 @@ const RegularFeatureInstance = ({ data }: RegularFeatureInstanceProps) => {
},
];

tabs.push({
label: "Lineage",
isSelected: useMatchSubpath("lineage"),
onClick: () => {
navigate("lineage");
},
});

let statisticsIsSelected = useMatchSubpath("statistics");
if (enabledFeatureStatistics) {
tabs.push({
Expand Down Expand Up @@ -62,6 +71,10 @@ const RegularFeatureInstance = ({ data }: RegularFeatureInstanceProps) => {
path="/"
element={<RegularFeatureViewOverviewTab data={data} />}
/>
<Route
path="/lineage"
element={<FeatureViewLineageTab data={data} />}
/>
{TabRoutes}
</Routes>
</EuiPageTemplate.Section>
Expand Down

Back | FazBrowse Home | New Git URL