diff --git a/CHANGELOG.md b/CHANGELOG.md
index 96146d696c4b..424ac4c787f6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -29,6 +29,8 @@ Main (unreleased)
- Introduce the `remotecfg` service that enables loading configuration from a
remote endpoint. (@tpaschalis)
+
+- Flow UI: Display graph for components defined in module. (@hainenber)
### Enhancements
diff --git a/web/ui/src/Router.tsx b/web/ui/src/Router.tsx
index 8b9c0fcb61d0..0d2ebf3221d6 100644
--- a/web/ui/src/Router.tsx
+++ b/web/ui/src/Router.tsx
@@ -1,10 +1,9 @@
-import React from 'react';
import { BrowserRouter, Route, Routes } from 'react-router-dom';
import Navbar from './features/layout/Navbar';
import PageClusteringPeers from './pages/Clustering';
import ComponentDetailPage from './pages/ComponentDetailPage';
-import Graph from './pages/Graph';
+import { Graph, ModuleGraph } from './pages/Graph';
import PageComponentList from './pages/PageComponentList';
interface Props {
@@ -20,6 +19,7 @@ const Router = ({ basePath }: Props) => {
} />
} />
} />
+ } />
} />
diff --git a/web/ui/src/features/component/ComponentView.tsx b/web/ui/src/features/component/ComponentView.tsx
index bf97e187fea5..02aaa4890ac8 100644
--- a/web/ui/src/features/component/ComponentView.tsx
+++ b/web/ui/src/features/component/ComponentView.tsx
@@ -79,6 +79,13 @@ export const ComponentView: FC = (props) => {
)}
+ {props.component.localID.startsWith('module') && (
+
+
+ Graph
+
+
+ )}
diff --git a/web/ui/src/hooks/componentInfo.tsx b/web/ui/src/hooks/componentInfo.tsx
index 4dc2015a9a3e..a1c38a582fb8 100644
--- a/web/ui/src/hooks/componentInfo.tsx
+++ b/web/ui/src/hooks/componentInfo.tsx
@@ -33,3 +33,5 @@ export const useComponentInfo = (
return [components, setComponents];
};
+
+export default useComponentInfo;
\ No newline at end of file
diff --git a/web/ui/src/pages/ComponentDetailPage.tsx b/web/ui/src/pages/ComponentDetailPage.tsx
index a0f52a9ebd55..1aa325c25072 100644
--- a/web/ui/src/pages/ComponentDetailPage.tsx
+++ b/web/ui/src/pages/ComponentDetailPage.tsx
@@ -34,9 +34,9 @@ const ComponentDetailPage: FC = () => {
cache: 'no-cache',
credentials: 'same-origin',
});
- const moduleCompoents = (await moduleComponentsResp.json()) as ComponentInfo[];
+ const moduleComponents = (await moduleComponentsResp.json()) as ComponentInfo[];
- data.moduleInfo = (data.moduleInfo || []).concat(moduleCompoents);
+ data.moduleInfo = (data.moduleInfo || []).concat(moduleComponents);
}
setComponent(data);
diff --git a/web/ui/src/pages/Graph.tsx b/web/ui/src/pages/Graph.tsx
index 617fa0bb64c7..ddea37a0d4ae 100644
--- a/web/ui/src/pages/Graph.tsx
+++ b/web/ui/src/pages/Graph.tsx
@@ -1,10 +1,12 @@
+import { useParams } from 'react-router-dom';
import { faDiagramProject } from '@fortawesome/free-solid-svg-icons';
import { ComponentGraph } from '../features/graph/ComponentGraph';
import Page from '../features/layout/Page';
import { useComponentInfo } from '../hooks/componentInfo';
+import { parseID } from '../utils/id';
-function Graph() {
+export function Graph() {
const [components] = useComponentInfo('');
return (
@@ -14,4 +16,15 @@ function Graph() {
);
}
-export default Graph;
+export function ModuleGraph() {
+ const { '*': id } = useParams();
+
+ const { localID } = parseID(id || '');
+ const [components] = useComponentInfo(localID);
+
+ return (
+
+ {components.length > 0 && }
+
+ );
+}