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} ); }; diff --git a/src/containers/Node/NodeStructure/Pdisk.tsx b/src/containers/Node/NodeStructure/Pdisk.tsx index 89517c1b4..b21ea3506 100644 --- a/src/containers/Node/NodeStructure/Pdisk.tsx +++ b/src/containers/Node/NodeStructure/Pdisk.tsx @@ -10,6 +10,7 @@ import {PDiskInfo} from '../../../components/PDiskInfo/PDiskInfo'; import {ProgressViewer} from '../../../components/ProgressViewer/ProgressViewer'; import {StatusIcon} from '../../../components/StatusIcon/StatusIcon'; import {VDiskInfo} from '../../../components/VDiskInfo/VDiskInfo'; +import {selectIsUserAllowedToMakeChanges} from '../../../store/reducers/authentication/authentication'; import type { PreparedStructurePDisk, PreparedStructureVDisk, @@ -22,6 +23,7 @@ import {cn} from '../../../utils/cn'; import {DEFAULT_TABLE_SETTINGS} from '../../../utils/constants'; import {formatStorageValuesToGb} from '../../../utils/dataFormatters/dataFormatters'; import {createVDiskDeveloperUILink} from '../../../utils/developerUI/developerUI'; +import {useTypedSelector} from '../../../utils/hooks'; import i18n from '../i18n'; import {PDiskTitleBadge} from './PDiskTitleBadge'; @@ -56,10 +58,12 @@ function getColumns({ pDiskId, selectedVdiskId, nodeId, + withDeveloperUILink, }: { pDiskId: number | undefined; selectedVdiskId?: string; nodeId?: string | number; + withDeveloperUILink?: boolean; }) { const columns: Column[] = [ { @@ -85,7 +89,7 @@ function getColumns({ return (
{vDiskSlotId} - {vdiskInternalViewerLink && ( + {vdiskInternalViewerLink && withDeveloperUILink ? ( - )} + ) : null}
); }, @@ -167,6 +171,8 @@ export function PDisk({ nodeId, unfolded: unfoldedFromProps, }: PDiskProps) { + const isUserAllowedToMakeChanges = useTypedSelector(selectIsUserAllowedToMakeChanges); + const [unfolded, setUnfolded] = React.useState(unfoldedFromProps ?? false); const {TotalSize = 0, AvailableSize = 0, Device, PDiskId, Type, vDisks} = data; @@ -186,7 +192,12 @@ export function PDisk({ { return row.id === selectedVdiskId ? b('selected-vdisk') : '';