Skip to content

Commit 8a17ddd

Browse files
authored
Merge pull request #150 from openshift-cherrypick-robot/cherry-pick-149-to-release-0.4
[release-0.4] OU-771: close tp in non-admin perspectives
2 parents 3f33a13 + 86e8073 commit 8a17ddd

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

web/src/components/Popover.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ import { TimesCircleIcon } from '@patternfly/react-icons';
77
import { State } from '../redux-reducers';
88
import { closeTP } from '../redux-actions';
99
import { useTranslation } from 'react-i18next';
10+
import { useActivePerspective } from '@openshift-console/dynamic-plugin-sdk';
1011

1112
export 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
}

0 commit comments

Comments
 (0)