Skip to content

Commit 569b5f4

Browse files
Merge pull request #15578 from PeterYurkovich/ou-949
OU-949: change dev-monitoring links to monitoring with ns param
2 parents 057ffde + 807e2da commit 569b5f4

File tree

19 files changed

+34
-1388
lines changed

19 files changed

+34
-1388
lines changed

frontend/packages/console-shared/src/components/dashboard/utilization-card/TopConsumerPopover.tsx

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as React from 'react';
33
import { Button, Popover, PopoverPosition } from '@patternfly/react-core';
44
import { useTranslation } from 'react-i18next';
55
import { Link } from 'react-router-dom-v5-compat';
6-
import { useActivePerspective, LIMIT_STATE, Humanize } from '@console/dynamic-plugin-sdk';
6+
import { LIMIT_STATE, Humanize } from '@console/dynamic-plugin-sdk';
77
import { getPrometheusQueryResponse } from '@console/internal/actions/dashboards';
88
import {
99
withDashboardResources,
@@ -15,8 +15,7 @@ import { ConsoleSelect } from '@console/internal/components/utils/console-select
1515
import { useK8sWatchResource } from '@console/internal/components/utils/k8s-watch-hook';
1616
import { resourcePathFromModel } from '@console/internal/components/utils/resource-link';
1717
import { K8sKind, referenceForModel, K8sResourceCommon } from '@console/internal/module/k8s';
18-
import { getName, getNamespace, useFlag } from '../../..';
19-
import { FLAGS } from '../../../constants';
18+
import { getName, getNamespace } from '../../..';
2019
import { RedExclamationCircleIcon, YellowExclamationTriangleIcon } from '../../status';
2120
import Status from '../status-card/StatusPopup';
2221

@@ -131,9 +130,6 @@ export const PopoverBody = withDashboardResources<DashboardItemProps & PopoverBo
131130
}) => {
132131
const { t } = useTranslation();
133132
const [currentConsumer, setCurrentConsumer] = React.useState(consumers[0]);
134-
const [activePerspective, setActivePerspective] = useActivePerspective();
135-
const canAccessMonitoring =
136-
useFlag(FLAGS.CAN_GET_NS) && !!window.SERVER_FLAGS.prometheusBaseURL;
137133
const { query, model, metric, fieldSelector } = currentConsumer;
138134
const k8sResource = React.useMemo(
139135
() => (isOpen ? getResourceToWatch(model, namespace, fieldSelector) : null),
@@ -176,8 +172,11 @@ export const PopoverBody = withDashboardResources<DashboardItemProps & PopoverBo
176172
const monitoringParams = React.useMemo(() => {
177173
const params = new URLSearchParams();
178174
params.set('query0', currentConsumer.query);
175+
if (namespace) {
176+
params.set('namespace', namespace);
177+
}
179178
return params;
180-
}, [currentConsumer.query]);
179+
}, [currentConsumer.query, namespace]);
181180

182181
const dropdownItems = React.useMemo(
183182
() =>
@@ -195,10 +194,7 @@ export const PopoverBody = withDashboardResources<DashboardItemProps & PopoverBo
195194
[consumers],
196195
);
197196

198-
const monitoringURL =
199-
canAccessMonitoring && activePerspective === 'admin'
200-
? `/monitoring/query-browser?${monitoringParams.toString()}`
201-
: `/dev-monitoring/ns/${namespace}/metrics?${monitoringParams.toString()}`;
197+
const monitoringURL = `/monitoring/query-browser?${monitoringParams.toString()}`;
202198

203199
let body: React.ReactNode;
204200
if (error || consumersLoadError) {
@@ -235,16 +231,7 @@ export const PopoverBody = withDashboardResources<DashboardItemProps & PopoverBo
235231
);
236232
})}
237233
</ul>
238-
<Link
239-
to={monitoringURL}
240-
onClick={() => {
241-
if (monitoringURL.startsWith('/dev-monitoring') && activePerspective !== 'dev') {
242-
setActivePerspective('dev');
243-
}
244-
}}
245-
>
246-
{t('console-shared~View more')}
247-
</Link>
234+
<Link to={monitoringURL}>{t('console-shared~View more')}</Link>
248235
</>
249236
);
250237
}

frontend/packages/dev-console/integration-tests/features/monitoring/changing-context-monitoring-dashboard.feature

Lines changed: 0 additions & 36 deletions
This file was deleted.

frontend/packages/dev-console/integration-tests/features/monitoring/dashboard-display.feature

Lines changed: 0 additions & 169 deletions
This file was deleted.

0 commit comments

Comments
 (0)