Skip to content

Commit

Permalink
show no permission create/upload resource
Browse files Browse the repository at this point in the history
show no permission create/upload resource
  • Loading branch information
bilalesi authored Feb 20, 2024
2 parents 6cf8784 + 0000210 commit a5dc62b
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/shared/components/ResourceEditor/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { WarningOutlined, SaveOutlined } from '@ant-design/icons';
import { AccessControl } from '@bbp/react-nexus';
import { Alert, Button, Switch } from 'antd';
import { Alert, Button, Switch, Tooltip } from 'antd';
import codemirror from 'codemirror';
import React, { useCallback, useEffect, useRef, useState } from 'react';
import { useSelector } from 'react-redux';
Expand All @@ -18,6 +18,7 @@ import { LinterIssue } from './customLinter';
import './ResourceEditor.scss';
import ResourceResolutionCache from './ResourcesLRUCache';
import { useEditorPopover, useEditorTooltip } from './useEditorTooltip';
import HasNoPermission from '../Icons/HasNoPermission';

export interface ResourceEditorProps {
busy?: boolean;
Expand Down Expand Up @@ -221,7 +222,14 @@ const ResourceEditor: React.FC<ResourceEditorProps> = props => {
<AccessControl
path={[`${orgLabel}/${projectLabel}`]}
permissions={['resources/write']}
noAccessComponent={() => <></>}
noAccessComponent={() => (
<Tooltip title="You have no permissions to create/modify the resource">
<Button disabled type="link">
<span style={{ marginRight: 5 }}>Save changes</span>
<HasNoPermission />
</Button>
</Tooltip>
)}
>
{editable && isEditing && (
<Button
Expand Down

0 comments on commit a5dc62b

Please sign in to comment.