From f95b80b7e13e6384d7e9639a4f5ea4714ee132c9 Mon Sep 17 00:00:00 2001 From: Peter Holmberg Date: Thu, 1 Nov 2018 14:01:06 +0100 Subject: [PATCH] remove this --- .../datasources/AddDataSourcePermissions.tsx | 123 ------------------ 1 file changed, 123 deletions(-) delete mode 100644 public/app/features/datasources/AddDataSourcePermissions.tsx diff --git a/public/app/features/datasources/AddDataSourcePermissions.tsx b/public/app/features/datasources/AddDataSourcePermissions.tsx deleted file mode 100644 index 2f9b38ef48e..00000000000 --- a/public/app/features/datasources/AddDataSourcePermissions.tsx +++ /dev/null @@ -1,123 +0,0 @@ -import React, { PureComponent } from 'react'; -import { UserPicker } from 'app/core/components/Picker/UserPicker'; -import { Team, TeamPicker } from 'app/core/components/Picker/TeamPicker'; -import DescriptionPicker, { OptionWithDescription } from 'app/core/components/Picker/DescriptionPicker'; -import { dataSourceAclLevels, AclTarget, DataSourcePermissionLevel } from 'app/types/acl'; -import { User } from 'app/types'; - -export interface Props { - onAddPermission: (state) => void; - onCancel: () => void; -} - -interface State { - userId: number; - teamId: number; - type: AclTarget; - permission: DataSourcePermissionLevel; -} - -export class AddDataSourcePermissions extends PureComponent { - cleanState = () => ({ - userId: 0, - teamId: 0, - type: AclTarget.Team, - permission: DataSourcePermissionLevel.Query, - }); - - state = this.cleanState(); - - isValid() { - switch (this.state.type) { - case AclTarget.Team: - return this.state.teamId > 0; - case AclTarget.User: - return this.state.userId > 0; - } - return true; - } - - onTeamSelected = (team: Team) => { - this.setState({ teamId: team ? team.id : 0 }); - }; - - onUserSelected = (user: User) => { - this.setState({ userId: user ? user.id : 0 }); - }; - - onPermissionChanged = (permission: OptionWithDescription) => { - this.setState({ permission: permission.value }); - }; - - onTypeChanged = event => { - const type = event.target.value as AclTarget; - - this.setState({ type: type, userId: 0, teamId: 0 }); - }; - - onSubmit = async event => { - event.preventDefault(); - - await this.props.onAddPermission(this.state); - this.setState(this.cleanState()); - }; - - render() { - const { onCancel } = this.props; - const { type, permission } = this.state; - - const pickerClassName = 'width-20'; - const aclTargets = [{ value: AclTarget.Team, text: 'Team' }, { value: AclTarget.User, text: 'User' }]; - - return ( -
- -
-
Add Permission For
-
-
- -
- {type === AclTarget.User && ( -
- -
- )} - - {type === AclTarget.Team && ( -
- -
- )} -
- -
-
- -
-
-
-
- ); - } -} - -export default AddDataSourcePermissions;