File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,9 +7,11 @@ import { TimesCircleIcon } from '@patternfly/react-icons';
77import { State } from '../redux-reducers' ;
88import { closeTP } from '../redux-actions' ;
99import { useTranslation } from 'react-i18next' ;
10+ import { useActivePerspective } from '@openshift-console/dynamic-plugin-sdk' ;
1011
1112export default function Popover ( ) {
1213 const dispatch = useDispatch ( ) ;
14+ const [ activePerspective ] = useActivePerspective ( ) ;
1315 const { t } = useTranslation ( 'plugin__troubleshooting-panel-console-plugin' ) ;
1416
1517 const isOpen = useSelector ( ( state : State ) => state . plugins ?. tp ?. get ( 'isOpen' ) ) ;
@@ -18,6 +20,12 @@ export default function Popover() {
1820 dispatch ( closeTP ( ) ) ;
1921 } , [ dispatch ] ) ;
2022
23+ React . useEffect ( ( ) => {
24+ if ( activePerspective !== 'admin' && isOpen ) {
25+ close ( ) ;
26+ }
27+ } , [ activePerspective , isOpen , close ] ) ;
28+
2129 if ( ! isOpen ) {
2230 return null ;
2331 }
You can’t perform that action at this time.
0 commit comments