diff --git a/packages/core/components/Buttons/TertiaryButton.tsx b/packages/core/components/Buttons/TertiaryButton.tsx
index 8cda15839..8bc437c27 100644
--- a/packages/core/components/Buttons/TertiaryButton.tsx
+++ b/packages/core/components/Buttons/TertiaryButton.tsx
@@ -16,6 +16,7 @@ interface Props {
menuItems?: IContextualMenuItem[];
onClick?: () => void;
invertColor?: boolean;
+ text?: string;
title: string;
}
@@ -37,6 +38,7 @@ export default function TertiaryButton(props: Props) {
menuDirection={props.menuDirection}
menuItems={props.menuItems}
onClick={props.onClick}
+ text={props.text}
title={props.title}
/>
);
diff --git a/packages/core/components/FileDetails/index.tsx b/packages/core/components/FileDetails/index.tsx
index 3e7086f3a..85ae5a120 100644
--- a/packages/core/components/FileDetails/index.tsx
+++ b/packages/core/components/FileDetails/index.tsx
@@ -105,51 +105,41 @@ export default function FileDetails(props: Props) {
{props.fileDetails && (
<>
- {!props.onClose ? (
-
-
- {/* spacing component */}
-
-
+
+
- ) : (
-
-
Metadata
-
+
+
+
+
+
+ {props.onClose && (
+
+ )}
- )}
-
- {props.fileDetails?.name}
-
+
+
{props.fileDetails?.name}
- {!props.onClose && (
-
-
Metadata
- {hasProvenanceSource && (
-
- dispatch(
- interaction.actions.setOriginForProvenance(
- props.fileDetails
- )
+
+
Metadata
+ {/* To do: un-hide the provenance source button while in graph mode, should redraw graph */}
+ {hasProvenanceSource && !props.onClose && (
+
+ dispatch(
+ interaction.actions.setOriginForProvenance(
+ props.fileDetails
)
- }
- >
- View provenance
-
- )}
-
- )}
+ )
+ }
+ >
+ View provenance
+
+ )}
+
>([]);
const [nodes, setNodes, onNodesChange] = useNodesState([]);
+ const { fitView } = useReactFlow();
// Unfortunately we have to have some notion of state at a high level for control from the components
// and at the dagre level for when the user does a drag action causing this duplication of efforts
React.useEffect(() => {
- setEdges(graph.edges);
- setNodes(graph.nodes);
+ let cancel = false;
+ if (!cancel) {
+ setEdges(graph.edges);
+ setNodes(graph.nodes);
+ }
+ return function cleanup() {
+ cancel = true;
+ };
}, [graph, setEdges, setNodes, refreshKey]);
// The option to open this graph shouldn't even appear when a
@@ -65,16 +83,30 @@ export default function NetworkGraph(props: NetworkGraphProps) {
);
}
+ const onClickReset = () => {
+ graph.resetLayout(); // return to default layout if any
+ fitView(); // reset zoom
+ dispatch(interaction.actions.refreshGraph());
+ };
+
return (
+
+ >
+
+
);
}
+
+// The ReactFlow component can only access state (useReactFlow) if it's the child of a ReactFlowProvider
+// See https://reactflow.dev/learn/troubleshooting/common-errors#001
+export default function WrappedNetworkGraph(props: NetworkGraphProps) {
+ return (
+
+
+
+ );
+}
diff --git a/packages/core/components/RelationshipDiagram/index.tsx b/packages/core/components/RelationshipDiagram/index.tsx
index b059826f1..e1cb0b535 100644
--- a/packages/core/components/RelationshipDiagram/index.tsx
+++ b/packages/core/components/RelationshipDiagram/index.tsx
@@ -30,7 +30,7 @@ export default function RelationshipDiagram({ className, origin }: Props) {
onClick={() => dispatch(interaction.actions.setOriginForProvenance(undefined))}
title="Close provenance relationship diagram"
/>
- Provenance for {origin?.name}
+ Relationship diagram for {origin?.name}
diff --git a/packages/core/entity/Graph/index.ts b/packages/core/entity/Graph/index.ts
index 44952da33..cc5a910f5 100644
--- a/packages/core/entity/Graph/index.ts
+++ b/packages/core/entity/Graph/index.ts
@@ -9,7 +9,7 @@ import FileService, { FmsFileAnnotation } from "../../services/FileService";
const FILE_NODE_WIDTH = 110;
const FILE_NODE_HEIGHT = 125;
const METADATA_NODE_WIDTH = 180;
-const METADATA_NODE_HEIGHT = 45;
+const METADATA_NODE_HEIGHT = 90;
const ROW_SPACING = Math.max(FILE_NODE_HEIGHT, METADATA_NODE_HEIGHT) + 25;
const COLUMN_SPACING = Math.max(FILE_NODE_WIDTH, METADATA_NODE_WIDTH) + 25;
@@ -330,6 +330,13 @@ export default class Graph {
.setDefaultEdgeLabel(() => ({}));
}
+ /**
+ * Reset the layout of the graph to its default (tree view)
+ */
+ public resetLayout() {
+ dagre.layout(this.graph);
+ }
+
/**
* Position nodes within graph according to edge connections and
* height/width of individual nodes
diff --git a/packages/core/styles/global.css b/packages/core/styles/global.css
index 7757e22db..76a503e39 100644
--- a/packages/core/styles/global.css
+++ b/packages/core/styles/global.css
@@ -55,6 +55,7 @@ body {
--secondary-dark: #1c1c1c;
--accent-dark: #3d3d3d;
--medium-grey: #575859;
+ --med-light-grey: #999;
--light-grey: #BFBFBF;
--white: #ffffff;
--red: #c23030;
@@ -70,6 +71,7 @@ body {
--highlight-hover-background-color: var(--bright-aqua);
--highlight-hover-text-color: var(--white);
--border-color: var(--medium-grey);
+ --border-secondary-color: var(--med-light-grey);
--error-background-color: var(--red);
--error-text-color: var(--white);
--aqua-secondary-hover: rgba(13, 187, 206, 0.18);