Skip to content

Commit

Permalink
feat(kiali): traffic graph (janus-idp#1606)
Browse files Browse the repository at this point in the history
  • Loading branch information
leandroberetta committed Jul 30, 2024
1 parent 3b78237 commit 657fef9
Show file tree
Hide file tree
Showing 35 changed files with 2,677 additions and 31 deletions.
13 changes: 12 additions & 1 deletion plugins/kiali/dev/MockProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { KialiHeader } from '../src/pages/Kiali/Header/KialiHeader';
import { OverviewPage } from '../src/pages/Overview/OverviewPage';
import { ServiceDetailsPage } from '../src/pages/ServiceDetails/ServiceDetailsPage';
import { ServiceListPage } from '../src/pages/ServiceList/ServiceListPage';
import TrafficGraphPage from '../src/pages/TrafficGraph/TrafficGraphPage';
import { WorkloadDetailsPage } from '../src/pages/WorkloadDetails/WorkloadDetailsPage';
import { WorkloadListPage } from '../src/pages/WorkloadList/WorkloadListPage';
import { KialiApi, kialiApiRef } from '../src/services/Api';
Expand All @@ -26,6 +27,7 @@ import { CertsInfo } from '../src/types/CertsInfo';
import { DurationInSeconds, TimeInSeconds } from '../src/types/Common';
import { DashboardModel } from '../src/types/Dashboards';
import { GrafanaInfo } from '../src/types/GrafanaInfo';
import { GraphDefinition, GraphElementsQuery } from '../src/types/Graph';
import {
AppHealth,
NamespaceAppHealth,
Expand Down Expand Up @@ -73,6 +75,10 @@ export class MockKialiClient implements KialiApi {
this.entity = undefined;
}

getGraphElements(_params: GraphElementsQuery): Promise<GraphDefinition> {
return kialiData.graph;
}

setEntity(entity?: Entity): void {
this.entity = entity;
}
Expand Down Expand Up @@ -464,7 +470,7 @@ export class MockKialiClient implements KialiApi {

const getSelected = (route: number) => {
const pathname = window.location.pathname.split('/');
const paths = ['workloads', 'applications', 'services', 'istio'];
const paths = ['workloads', 'applications', 'services', 'istio', 'graph'];
if (pathname && paths.includes(pathname[2])) {
switch (pathname[2]) {
case 'workloads':
Expand All @@ -475,6 +481,8 @@ const getSelected = (route: number) => {
return <AppDetailsPage />;
case 'istio':
return <IstioConfigDetailsPage />;
case 'graph':
return <TrafficGraphPage />;
default:
return <OverviewPage />;
}
Expand All @@ -490,6 +498,8 @@ const getSelected = (route: number) => {
return <AppListPage />;
case 4:
return <IstioConfigListPage />;
case 5:
return <TrafficGraphPage />;
default:
return <KialiNoPath />;
}
Expand All @@ -509,6 +519,7 @@ export const MockProvider = (props: Props) => {
{ label: 'Services', route: `/kiali#services` },
{ label: 'Applications', route: `/kiali#applications` },
{ label: 'Istio Config', route: `/kiali#istio` },
{ label: 'Traffic Graph', route: `/kiali#graph` },
];

const content = (
Expand Down
Loading

0 comments on commit 657fef9

Please sign in to comment.