diff --git a/src/components/BasicNodeViewer/BasicNodeViewer.tsx b/src/components/BasicNodeViewer/BasicNodeViewer.tsx index d461b0f69..07eb9fcac 100644 --- a/src/components/BasicNodeViewer/BasicNodeViewer.tsx +++ b/src/components/BasicNodeViewer/BasicNodeViewer.tsx @@ -3,6 +3,7 @@ import React from 'react'; import {ArrowUpRightFromSquare} from '@gravity-ui/icons'; import {Icon} from '@gravity-ui/uikit'; +import {selectIsUserAllowedToMakeChanges} from '../../store/reducers/authentication/authentication'; import type {PreparedNode} from '../../store/reducers/node/types'; import type {AdditionalNodesProps} from '../../types/additionalProps'; import {cn} from '../../utils/cn'; @@ -10,6 +11,7 @@ import { createDeveloperUIInternalPageHref, createDeveloperUILinkWithNodeId, } from '../../utils/developerUI/developerUI'; +import {useTypedSelector} from '../../utils/hooks'; import {EntityStatus} from '../EntityStatus/EntityStatus'; import {Tags} from '../Tags'; @@ -24,6 +26,8 @@ interface BasicNodeViewerProps { } export const BasicNodeViewer = ({node, additionalNodesProps, className}: BasicNodeViewerProps) => { + const isUserAllowedToMakeChanges = useTypedSelector(selectIsUserAllowedToMakeChanges); + let developerUIInternalHref: string | undefined; if (additionalNodesProps?.getNodeRef) { @@ -42,7 +46,7 @@ export const BasicNodeViewer = ({node, additionalNodesProps, className}: BasicNo
Node
- {developerUIInternalHref && ( + {developerUIInternalHref && isUserAllowedToMakeChanges ? ( - )} + ) : null}
diff --git a/src/containers/Header/Header.tsx b/src/containers/Header/Header.tsx index aa0b22ee7..6dcf63c7a 100644 --- a/src/containers/Header/Header.tsx +++ b/src/containers/Header/Header.tsx @@ -4,6 +4,7 @@ import {Breadcrumbs} from '@gravity-ui/uikit'; import {InternalLink} from '../../components/InternalLink'; import {LinkWithIcon} from '../../components/LinkWithIcon/LinkWithIcon'; +import {selectIsUserAllowedToMakeChanges} from '../../store/reducers/authentication/authentication'; import {useClusterBaseInfo} from '../../store/reducers/cluster/cluster'; import {cn} from '../../utils/cn'; import {DEVELOPER_UI_TITLE} from '../../utils/constants'; @@ -23,6 +24,7 @@ interface HeaderProps { function Header({mainPage}: HeaderProps) { const {page, pageBreadcrumbsOptions} = useTypedSelector((state) => state.header); + const isUserAllowedToMakeChanges = useTypedSelector(selectIsUserAllowedToMakeChanges); const clusterInfo = useClusterBaseInfo(); @@ -78,10 +80,12 @@ function Header({mainPage}: HeaderProps) { }} /> - + {isUserAllowedToMakeChanges ? ( + + ) : null} ); };