Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show no permission create/upload resource #1496

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>
)}
bilalesi marked this conversation as resolved.
Show resolved Hide resolved
>
{editable && isEditing && (
<Button
Expand Down
Loading