Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove extra navigation icon and add control for search button #501

Merged
merged 4 commits into from
Jul 26, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ui/src/components/featureList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ const FeatureList: React.FC = () => {
onPressEnter={onClickSearch}
/>
<Button
disabled={!project}
onClick={onClickSearch}
type="primary"
style={{ marginLeft: "5px" }}
Expand Down
9 changes: 5 additions & 4 deletions ui/src/components/graph/graph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import ReactFlow, {
} from "react-flow-renderer";
import { useSearchParams } from "react-router-dom";
import LineageNode from "./graphNode";
import { findNodeInElement, getLayoutedElements } from "./utils";
import { findNodeInElement, getLayoutedElements, isFeature } from "./utils";

const nodeTypes = {
"custom-node": LineageNode,
Expand Down Expand Up @@ -108,7 +108,7 @@ const Graph: React.FC<Props> = ({ data, nodeId }) => {
},
data: {
...element.data,
active: element.id === node.id,
active: element.id === node.id && isFeature(element.data?.subtitle)
},
});
}
Expand Down Expand Up @@ -164,8 +164,8 @@ const Graph: React.FC<Props> = ({ data, nodeId }) => {
snapGrid={[15, 15]}
zoomOnScroll={false}
onLoad={onLoad}
onPaneClick={onPaneClick}
onElementClick={(_: ReactMouseEvent, element: Node | Edge): void => {
onPaneClick={onPaneClick}
onElementClick={(_: ReactMouseEvent, element: Node | Edge): void => {
if (isNode(element)) {
resetHighlight();
highlightPath(element, false);
Expand All @@ -175,6 +175,7 @@ const Graph: React.FC<Props> = ({ data, nodeId }) => {
});
}
}}

onNodeDragStop={onNodeDragStop}
connectionLineType={ConnectionLineType.SmoothStep}
nodeTypes={nodeTypes}
Expand Down
10 changes: 2 additions & 8 deletions ui/src/components/graph/graphNodeDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { fetchFeature } from "../../api";
import { Feature } from "../../models/model";
import { LoadingOutlined } from "@ant-design/icons";
import { Card, Spin, Typography } from "antd";
import { isFeature } from "./utils";

const { Title } = Typography;

Expand All @@ -20,13 +21,6 @@ const GraphNodeDetails: React.FC = () => {
const [feature, setFeature] = useState<Feature>();
const [loading, setLoading] = useState<boolean>(false);

const isFeature = (featureType: string) => {
return (
featureType === "feathr_anchor_feature_v1" ||
featureType === "feathr_derived_feature_v1"
);
};

useEffect(() => {
const fetchFeatureData = async () => {
setFeature(undefined);
Expand All @@ -47,7 +41,7 @@ const GraphNodeDetails: React.FC = () => {
<Spin indicator={<LoadingOutlined style={{ fontSize: 24 }} spin />} />
) : (
<div style={{ margin: "2%" }}>
{!feature && <p>Click on node to show metadata and metric details</p>}
{!feature && <p>Click on feature node to show metadata and metric details</p>}
{feature?.attributes.transformation && (
<Card>
<Title level={4}>Transformation</Title>
Expand Down
17 changes: 16 additions & 1 deletion ui/src/components/graph/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,22 @@ const generateEdge = ({ obj, from, to }: GenerateEdgeProps): Edge => {
};
};

export { generateEdge, generateNode, getLayoutedElements, getElements };
const enum NodeTypes {
enya-yx marked this conversation as resolved.
Show resolved Hide resolved
AllNodes = "all_nodes",
Source = "feathr_source_v1",
Anchor = "feathr_anchor_v1",
AnchorFeature = "feathr_anchor_feature_v1",
DerivedFeature = "feathr_derived_feature_v1"
};

const isFeature = (featureType: string) => {
return (
featureType === NodeTypes.AnchorFeature ||
featureType === NodeTypes.DerivedFeature
);
};

export { generateEdge, generateNode, getLayoutedElements, getElements, NodeTypes, isFeature };

export const findNodeInElement = (
nodeId: string | null,
Expand Down