Skip to content

Commit be8bd6c

Browse files
committed
OU-1004: List perses dashbaords
1 parent 84085f4 commit be8bd6c

15 files changed

+543
-184
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
.devcontainer/dev.env
22
.DS_Store
3+
.vscode
34
web/cypress/screenshots/
45
web/cypress/export-env.sh
56
web/screenshots/

config/perses-dashboards.patch.json

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"exact": false,
99
"path": ["/multicloud/monitoring/v2/dashboards"],
1010
"component": {
11-
"$codeRef": "DashboardsPage"
11+
"$codeRef": "DashboardListPage"
1212
}
1313
}
1414
}
@@ -36,7 +36,7 @@
3636
"properties": {
3737
"exact": false,
3838
"path": ["/monitoring/v2/dashboards"],
39-
"component": { "$codeRef": "DashboardsPage" }
39+
"component": { "$codeRef": "DashboardListPage" }
4040
}
4141
}
4242
},
@@ -64,7 +64,7 @@
6464
"properties": {
6565
"exact": false,
6666
"path": ["/virt-monitoring/v2/dashboards"],
67-
"component": { "$codeRef": "DashboardsPage" }
67+
"component": { "$codeRef": "DashboardListPage" }
6868
}
6969
}
7070
},
@@ -83,5 +83,41 @@
8383
"insertAfter": "dashboards-virt"
8484
}
8585
}
86+
},
87+
{
88+
"op": "add",
89+
"path": "/extensions/1",
90+
"value": {
91+
"type": "console.page/route",
92+
"properties": {
93+
"exact": false,
94+
"path": ["/monitoring/v2/dashboards/view"],
95+
"component": { "$codeRef": "DashboardPage" }
96+
}
97+
}
98+
},
99+
{
100+
"op": "add",
101+
"path": "/extensions/1",
102+
"value": {
103+
"type": "console.page/route",
104+
"properties": {
105+
"exact": false,
106+
"path": ["/virt-monitoring/v2/dashboards/view"],
107+
"component": { "$codeRef": "DashboardPage" }
108+
}
109+
}
110+
},
111+
{
112+
"op": "add",
113+
"path": "/extensions/1",
114+
"value": {
115+
"type": "console.page/route",
116+
"properties": {
117+
"exact": false,
118+
"path": ["/multicloud/monitoring/v2/dashboards/view"],
119+
"component": { "$codeRef": "DashboardPage" }
120+
}
121+
}
86122
}
87123
]

web/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@
153153
"displayName": "OpenShift console monitoring plugin",
154154
"description": "This plugin adds the monitoring UI to the OpenShift web console",
155155
"exposedModules": {
156-
"DashboardsPage": "./components/dashboards/perses/dashboard-page",
156+
"DashboardListPage": "./components/dashboards/perses/dashboard-list-page",
157+
"DashboardPage": "./components/dashboards/perses/dashboard-page",
157158
"LegacyDashboardsPage": "./components/dashboards/legacy/legacy-dashboard-page",
158159
"SilencesPage": "./components/alerting/SilencesPage",
159160
"SilencesDetailsPage": "./components/alerting/SilencesDetailsPage",

web/src/components/dashboards/perses/dashoard-app.tsx renamed to web/src/components/dashboards/perses/dashboard-app.tsx

File renamed without changes.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import React, { ReactNode } from 'react';
2+
import { DashboardEmptyState } from './emptystates/DashboardEmptyState';
3+
import { DashboardSkeleton } from './dashboard-skeleton';
4+
import { CombinedDashboardMetadata } from './hooks/useDashboardsData';
5+
import { ProjectBar } from './project/ProjectBar';
6+
import { PersesWrapper } from './PersesWrapper';
7+
import { Overview } from '@openshift-console/dynamic-plugin-sdk';
8+
9+
export interface DashboardLayoutProps {
10+
activeProject: string | null;
11+
setActiveProject: (project: string | null) => void;
12+
activeProjectDashboardsMetadata: CombinedDashboardMetadata[];
13+
changeBoard: (boardName: string) => void;
14+
dashboardName: string;
15+
children: ReactNode;
16+
}
17+
18+
export const DashboardLayout: React.FC<DashboardLayoutProps> = ({
19+
activeProject,
20+
setActiveProject,
21+
activeProjectDashboardsMetadata,
22+
changeBoard,
23+
dashboardName,
24+
children,
25+
}) => {
26+
return (
27+
<>
28+
<ProjectBar activeProject={activeProject} setActiveProject={setActiveProject} />
29+
<PersesWrapper project={activeProject}>
30+
{activeProjectDashboardsMetadata?.length === 0 ? (
31+
<DashboardEmptyState />
32+
) : (
33+
<DashboardSkeleton
34+
boardItems={activeProjectDashboardsMetadata}
35+
changeBoard={changeBoard}
36+
dashboardName={dashboardName}
37+
activeProject={activeProject}
38+
>
39+
<Overview>{children}</Overview>
40+
</DashboardSkeleton>
41+
)}
42+
</PersesWrapper>
43+
</>
44+
);
45+
};
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
2+
import { type FC } from 'react';
3+
import { QueryParamProvider } from 'use-query-params';
4+
import { ReactRouter5Adapter } from 'use-query-params/adapters/react-router-5';
5+
import { DashboardList } from './dashboard-list';
6+
7+
const queryClient = new QueryClient({
8+
defaultOptions: {
9+
queries: {
10+
refetchOnWindowFocus: false,
11+
retry: 0,
12+
},
13+
},
14+
});
15+
16+
const MonitoringDashboardListPage: FC = () => {
17+
return (
18+
<QueryParamProvider adapter={ReactRouter5Adapter}>
19+
<QueryClientProvider client={queryClient}>
20+
<DashboardList />
21+
</QueryClientProvider>
22+
</QueryParamProvider>
23+
);
24+
};
25+
26+
export default MonitoringDashboardListPage;

0 commit comments

Comments
 (0)