@@ -3,7 +3,7 @@ import * as React from 'react';
33import { Button , Popover , PopoverPosition } from '@patternfly/react-core' ;
44import { useTranslation } from 'react-i18next' ;
55import { 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' ;
77import { getPrometheusQueryResponse } from '@console/internal/actions/dashboards' ;
88import {
99 withDashboardResources ,
@@ -15,8 +15,7 @@ import { ConsoleSelect } from '@console/internal/components/utils/console-select
1515import { useK8sWatchResource } from '@console/internal/components/utils/k8s-watch-hook' ;
1616import { resourcePathFromModel } from '@console/internal/components/utils/resource-link' ;
1717import { K8sKind , referenceForModel , K8sResourceCommon } from '@console/internal/module/k8s' ;
18- import { getName , getNamespace , useFlag } from '../../..' ;
19- import { FLAGS } from '../../../constants' ;
18+ import { getName , getNamespace } from '../../..' ;
2019import { RedExclamationCircleIcon , YellowExclamationTriangleIcon } from '../../status' ;
2120import 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 }
0 commit comments