Skip to content

Commit dbd22be

Browse files
committed
feat: re enable dev console views
Signed-off-by: Gabriel Bernal <gbernal@redhat.com>
1 parent 4b2ccc0 commit dbd22be

File tree

10 files changed

+142
-170
lines changed

10 files changed

+142
-170
lines changed

web/console-extensions.json

Lines changed: 48 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,7 @@
77
"href": "/monitoring/alerts",
88
"perspective": "admin",
99
"section": "observe",
10-
"startsWith": [
11-
"monitoring/alertrules",
12-
"monitoring/silences",
13-
"monitoring/incidents"
14-
]
10+
"startsWith": ["monitoring/alertrules", "monitoring/silences", "monitoring/incidents"]
1511
}
1612
},
1713
{
@@ -20,10 +16,7 @@
2016
"data-quickstart-id": "qs-nav-monitoring"
2117
},
2218
"id": "observe-virt-perspective",
23-
"insertBefore": [
24-
"compute-virt-perspective",
25-
"usermanagement-virt-perspective"
26-
],
19+
"insertBefore": ["compute-virt-perspective", "usermanagement-virt-perspective"],
2720
"name": "%console-app~Observe%",
2821
"perspective": "virtualization-perspective"
2922
},
@@ -163,10 +156,7 @@
163156
"type": "console.page/route",
164157
"properties": {
165158
"exact": false,
166-
"path": [
167-
"/monitoring/targets",
168-
"/monitoring/targets/:scrapeUrl"
169-
],
159+
"path": ["/monitoring/targets", "/monitoring/targets/:scrapeUrl"],
170160
"component": {
171161
"$codeRef": "TargetsPage.MpCmoTargetsPage"
172162
}
@@ -176,9 +166,7 @@
176166
"type": "console.page/route",
177167
"properties": {
178168
"exact": false,
179-
"path": [
180-
"/monitoring/query-browser"
181-
],
169+
"path": ["/monitoring/query-browser"],
182170
"component": {
183171
"$codeRef": "MetricsPage.MpCmoMetricsPage"
184172
}
@@ -188,9 +176,7 @@
188176
"type": "console.page/route",
189177
"properties": {
190178
"exact": false,
191-
"path": [
192-
"/monitoring/graph"
193-
],
179+
"path": ["/monitoring/graph"],
194180
"component": {
195181
"$codeRef": "PrometheusRedirectPage"
196182
}
@@ -200,10 +186,7 @@
200186
"type": "console.page/route",
201187
"properties": {
202188
"exact": false,
203-
"path": [
204-
"/monitoring/dashboards",
205-
"/monitoring/dashboards/:dashboardName"
206-
],
189+
"path": ["/monitoring/dashboards", "/monitoring/dashboards/:dashboardName"],
207190
"component": {
208191
"$codeRef": "LegacyDashboardsPage.MpCmoLegacyDashboardsPage"
209192
}
@@ -213,9 +196,7 @@
213196
"type": "console.page/route",
214197
"properties": {
215198
"exact": false,
216-
"path": [
217-
"/monitoring/alertrules/:id"
218-
],
199+
"path": ["/monitoring/alertrules/:id"],
219200
"component": {
220201
"$codeRef": "AlertRulesDetailsPage.MpCmoAlertRulesDetailsPage"
221202
}
@@ -225,9 +206,7 @@
225206
"type": "console.page/route",
226207
"properties": {
227208
"exact": false,
228-
"path": [
229-
"/monitoring/alerts/:ruleID"
230-
],
209+
"path": ["/monitoring/alerts/:ruleID"],
231210
"component": {
232211
"$codeRef": "AlertsDetailsPage.MpCmoAlertsDetailsPage"
233212
}
@@ -237,9 +216,7 @@
237216
"type": "console.page/route",
238217
"properties": {
239218
"exact": false,
240-
"path": [
241-
"/virt-monitoring"
242-
],
219+
"path": ["/virt-monitoring"],
243220
"component": {
244221
"$codeRef": "AlertingPage.MpCmoAlertingPage"
245222
}
@@ -279,10 +256,7 @@
279256
"type": "console.page/route",
280257
"properties": {
281258
"exact": false,
282-
"path": [
283-
"/virt-monitoring/targets",
284-
"/virt-monitoring/targets/:scrapeUrl"
285-
],
259+
"path": ["/virt-monitoring/targets", "/virt-monitoring/targets/:scrapeUrl"],
286260
"component": {
287261
"$codeRef": "TargetsPage.MpCmoTargetsPage"
288262
}
@@ -292,9 +266,7 @@
292266
"type": "console.page/route",
293267
"properties": {
294268
"exact": false,
295-
"path": [
296-
"/virt-monitoring/query-browser"
297-
],
269+
"path": ["/virt-monitoring/query-browser"],
298270
"component": {
299271
"$codeRef": "MetricsPage.MpCmoMetricsPage"
300272
}
@@ -304,9 +276,7 @@
304276
"type": "console.page/route",
305277
"properties": {
306278
"exact": false,
307-
"path": [
308-
"/virt-monitoring/graph"
309-
],
279+
"path": ["/virt-monitoring/graph"],
310280
"component": {
311281
"$codeRef": "PrometheusRedirectPage"
312282
}
@@ -316,10 +286,7 @@
316286
"type": "console.page/route",
317287
"properties": {
318288
"exact": false,
319-
"path": [
320-
"/virt-monitoring/dashboards",
321-
"/virt-monitoring/dashboards/:dashboardName"
322-
],
289+
"path": ["/virt-monitoring/dashboards", "/virt-monitoring/dashboards/:dashboardName"],
323290
"component": {
324291
"$codeRef": "LegacyDashboardsPage.MpCmoLegacyDashboardsPage"
325292
}
@@ -329,9 +296,7 @@
329296
"type": "console.page/route",
330297
"properties": {
331298
"exact": false,
332-
"path": [
333-
"/virt-monitoring/alertrules/:id"
334-
],
299+
"path": ["/virt-monitoring/alertrules/:id"],
335300
"component": {
336301
"$codeRef": "AlertRulesDetailsPage.MpCmoAlertRulesDetailsPage"
337302
}
@@ -341,9 +306,7 @@
341306
"type": "console.page/route",
342307
"properties": {
343308
"exact": false,
344-
"path": [
345-
"/virt-monitoring/alerts/:ruleID"
346-
],
309+
"path": ["/virt-monitoring/alerts/:ruleID"],
347310
"component": {
348311
"$codeRef": "AlertsDetailsPage.MpCmoAlertsDetailsPage"
349312
}
@@ -355,7 +318,7 @@
355318
"exact": false,
356319
"path": "/dev-monitoring/ns/:ns/alerts/:ruleID",
357320
"component": {
358-
"$codeRef": "DevRedirects.AlertRedirect"
321+
"$codeRef": "AlertsDetailsPage.MpCmoAlertsDetailsPage"
359322
}
360323
}
361324
},
@@ -365,7 +328,7 @@
365328
"exact": false,
366329
"path": "/dev-monitoring/ns/:ns/rules/:id",
367330
"component": {
368-
"$codeRef": "DevRedirects.RulesRedirect"
331+
"$codeRef": "AlertRulesDetailsPage.MpCmoAlertRulesDetailsPage"
369332
}
370333
}
371334
},
@@ -375,7 +338,7 @@
375338
"exact": false,
376339
"path": "/dev-monitoring/ns/:ns/silences/:id",
377340
"component": {
378-
"$codeRef": "DevRedirects.SilenceRedirect"
341+
"$codeRef": "SilencesDetailsPage.MpCmoSilencesDetailsPage"
379342
}
380343
}
381344
},
@@ -385,7 +348,7 @@
385348
"exact": false,
386349
"path": "/dev-monitoring/ns/:ns/silences/:id/edit",
387350
"component": {
388-
"$codeRef": "DevRedirects.SilenceEditRedirect"
351+
"$codeRef": "SilenceEditPage.MpCmoSilenceEditPage"
389352
}
390353
}
391354
},
@@ -395,18 +358,41 @@
395358
"exact": false,
396359
"path": "/dev-monitoring/ns/:ns/silences/~new",
397360
"component": {
398-
"$codeRef": "DevRedirects.SilenceNewRedirect"
361+
"$codeRef": "SilenceCreatePage.MpCmoCreateSilencePage"
399362
}
400363
}
401364
},
402365
{
403-
"type": "console.page/route",
366+
"type": "console.tab",
404367
"properties": {
405-
"exact": false,
406-
"path": "/dev-monitoring/ns/:ns/metrics",
368+
"contextId": "dev-console-observe",
369+
"name": "%plugin__monitoring-plugin~Silences%",
370+
"href": "silences",
371+
"component": {
372+
"$codeRef": "SilencesPage.MpCmoSilencesPage"
373+
}
374+
}
375+
},
376+
{
377+
"type": "console.tab",
378+
"properties": {
379+
"contextId": "dev-console-observe",
380+
"name": "%plugin__monitoring-plugin~Metrics%",
381+
"href": "metrics",
382+
"component": {
383+
"$codeRef": "MetricsPage.MpCmoDevMetricsPage"
384+
}
385+
}
386+
},
387+
{
388+
"type": "console.tab",
389+
"properties": {
390+
"contextId": "dev-console-observe",
391+
"name": "%plugin__monitoring-plugin~Alerts%",
392+
"href": "alerts",
407393
"component": {
408-
"$codeRef": "DevRedirects.MetricsRedirect"
394+
"$codeRef": "AlertsPage.MpCmoAlertsPage"
409395
}
410396
}
411397
}
412-
]
398+
]

web/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,6 @@
182182
"IncidentsPage": "./components/Incidents/IncidentsPage",
183183
"TargetsPage": "./components/targets-page",
184184
"PrometheusRedirectPage": "./components/redirects/prometheus-redirect-page",
185-
"DevRedirects": "./components/redirects/dev-redirects",
186185
"MonitoringContext": "./contexts/MonitoringContext"
187186
},
188187
"dependencies": {

web/src/components/MetricsPage.tsx

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1324,6 +1324,7 @@ const MetricsPage_: FC = () => {
13241324
const { t } = useTranslation(process.env.I18N_NAMESPACE);
13251325
const [units, setUnits] = useQueryParam(QueryParams.Units, StringParam);
13261326
const { setNamespace } = useQueryNamespace();
1327+
const { displayNamespaceSelector } = useMonitoring();
13271328

13281329
const dispatch = useDispatch();
13291330

@@ -1402,14 +1403,18 @@ const MetricsPage_: FC = () => {
14021403

14031404
return (
14041405
<>
1405-
<DocumentTitle>{t('Metrics')}</DocumentTitle>
1406-
<NamespaceBar
1407-
onNamespaceChange={(namespace) => {
1408-
dispatch(queryBrowserDeleteAllQueries());
1409-
setNamespace(namespace);
1410-
}}
1411-
/>
1412-
<ListPageHeader title={t('Metrics')}>
1406+
{displayNamespaceSelector && (
1407+
<>
1408+
<DocumentTitle>{t('Metrics')}</DocumentTitle>
1409+
<NamespaceBar
1410+
onNamespaceChange={(namespace) => {
1411+
dispatch(queryBrowserDeleteAllQueries());
1412+
setNamespace(namespace);
1413+
}}
1414+
/>
1415+
</>
1416+
)}
1417+
<ListPageHeader title={displayNamespaceSelector ? t('Metrics') : ' '}>
14131418
<Split hasGutter>
14141419
<SplitItem data-test={DataTestIDs.MetricGraphUnitsDropDown}>
14151420
<Tooltip content={<>{t('This dropdown only formats results.')}</>}>
@@ -1470,6 +1475,20 @@ export const MpCmoMetricsPage: React.FC = () => {
14701475
);
14711476
};
14721477

1478+
export const MpCmoDevMetricsPage: React.FC = () => {
1479+
return (
1480+
<MonitoringProvider
1481+
monitoringContext={{
1482+
plugin: 'monitoring-plugin',
1483+
prometheus: 'cmo',
1484+
displayNamespaceSelector: false,
1485+
}}
1486+
>
1487+
<MetricsPage />
1488+
</MonitoringProvider>
1489+
);
1490+
};
1491+
14731492
type QueryTableProps = {
14741493
index: number;
14751494
namespace?: string;

web/src/components/alerting/AlertingPage.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ const namespacedPages = [
5858
const AlertingPage: FC = () => {
5959
const { t } = useTranslation(process.env.I18N_NAMESPACE);
6060
const dispatch = useDispatch();
61-
const { useAlertsTenancy, accessCheckLoading } = useMonitoring();
62-
6361
const [perspective] = useActivePerspective();
6462
const { setNamespace } = useQueryNamespace();
6563

@@ -97,7 +95,7 @@ const AlertingPage: FC = () => {
9795

9896
return (
9997
<>
100-
{namespacedPages.includes(pathname) && !accessCheckLoading && useAlertsTenancy && (
98+
{namespacedPages.includes(pathname) && (
10199
<NamespaceBar
102100
onNamespaceChange={(namespace) => {
103101
dispatch(alertingClearSelectorData(prometheus, namespace));

0 commit comments

Comments
 (0)