diff --git a/public/app/core/components/PermissionList/AddPermission.tsx b/public/app/core/components/PermissionList/AddPermission.tsx index fc062ce63e4..a754bec1a18 100644 --- a/public/app/core/components/PermissionList/AddPermission.tsx +++ b/public/app/core/components/PermissionList/AddPermission.tsx @@ -4,20 +4,27 @@ import { TeamPicker, Team } from 'app/core/components/Picker/TeamPicker'; import DescriptionPicker, { OptionWithDescription } from 'app/core/components/Picker/DescriptionPicker'; import { User } from 'app/types'; import { - dashboardPermissionLevels, - dashboardAclTargets, AclTarget, PermissionLevel, NewDashboardAclItem, OrgRole, + DashboardPermissionInfo, + AclTargetInfo, } from 'app/types/acl'; export interface Props { onAddPermission: (item: NewDashboardAclItem) => void; onCancel: () => void; + showPermissionLevels?: boolean; + dashboardPermissionLevels?: DashboardPermissionInfo[]; + dashboardAclTargets: AclTargetInfo[]; } class AddPermissions extends Component { + static defaultProps = { + showPermissionLevels: true, + }; + constructor(props) { super(props); this.state = this.getCleanState(); @@ -78,7 +85,7 @@ class AddPermissions extends Component { } render() { - const { onCancel } = this.props; + const { onCancel, showPermissionLevels, dashboardPermissionLevels, dashboardAclTargets } = this.props; const newItem = this.state; const pickerClassName = 'width-20'; const isValid = this.isValid(); @@ -125,15 +132,17 @@ class AddPermissions extends Component { ) : null} -
- -
+ {showPermissionLevels && ( +
+ +
+ )}
- + { +interface State { + isAdding: boolean; +} + +export class DataSourcePermissions extends PureComponent { + state = { + isAdding: false, + }; + + onOpenAddPermissions = () => { + this.setState({ + isAdding: true, + }); + }; + + onAddPermission = () => {}; + + onCancelAddPermission = () => { + this.setState({ + isAdding: false, + }); + }; + render() { + const { isAdding } = this.state; + + const dashboardAclTargets: AclTargetInfo[] = [ + { value: AclTarget.Team, text: 'Team' }, + { value: AclTarget.User, text: 'User' }, + ]; + return (
-

Permissions

+
+

Permissions

+
+ +
+ + +
); } diff --git a/public/app/features/folders/FolderPermissions.tsx b/public/app/features/folders/FolderPermissions.tsx index 176e270038b..9237e0bbee7 100644 --- a/public/app/features/folders/FolderPermissions.tsx +++ b/public/app/features/folders/FolderPermissions.tsx @@ -6,7 +6,13 @@ import Tooltip from 'app/core/components/Tooltip/Tooltip'; import SlideDown from 'app/core/components/Animations/SlideDown'; import { getNavModel } from 'app/core/selectors/navModel'; import { NavModel, StoreState, FolderState } from 'app/types'; -import { DashboardAcl, PermissionLevel, NewDashboardAclItem } from 'app/types/acl'; +import { + dashboardAclTargets, + dashboardPermissionLevels, + DashboardAcl, + PermissionLevel, + NewDashboardAclItem, +} from 'app/types/acl'; import { getFolderByUid, getFolderPermissions, @@ -93,7 +99,12 @@ export class FolderPermissions extends PureComponent {
- +