diff --git a/public/app/containers/ManageDashboards/FolderPermissions.tsx b/public/app/containers/ManageDashboards/FolderPermissions.tsx index 7c9e55bcac3..637f811969e 100644 --- a/public/app/containers/ManageDashboards/FolderPermissions.tsx +++ b/public/app/containers/ManageDashboards/FolderPermissions.tsx @@ -53,8 +53,7 @@ export class FolderPermissions extends Component { onClick={this.handleAddPermission} disabled={permissions.isAddPermissionsVisible} > - - Add Permission + Add Permission diff --git a/public/app/core/components/Permissions/DashboardPermissions.tsx b/public/app/core/components/Permissions/DashboardPermissions.tsx index 2636b0d4db4..a1b86e121bf 100644 --- a/public/app/core/components/Permissions/DashboardPermissions.tsx +++ b/public/app/core/components/Permissions/DashboardPermissions.tsx @@ -1,8 +1,11 @@ import React, { Component } from 'react'; +import { observer } from 'mobx-react'; import { store } from 'app/stores/store'; import Permissions from 'app/core/components/Permissions/Permissions'; import Tooltip from 'app/core/components/Tooltip/Tooltip'; import PermissionsInfo from 'app/core/components/Permissions/PermissionsInfo'; +import AddPermissions from 'app/core/components/Permissions/AddPermissions'; +import SlideDown from 'app/core/components/Animations/SlideDown'; export interface IProps { dashboardId: number; @@ -11,26 +14,44 @@ export interface IProps { folderSlug: string; backendSrv: any; } - +@observer class DashboardPermissions extends Component { permissions: any; constructor(props) { super(props); + this.handleAddPermission = this.handleAddPermission.bind(this); this.permissions = store.permissions; } + handleAddPermission() { + this.permissions.toggleAddPermissions(); + } + render() { const { dashboardId, folderTitle, folderSlug, folderId, backendSrv } = this.props; return (
-

Permissions

- - - +
+

Permissions

+ + + +
+ +
+ + + { -// let wrapper; - -// beforeAll(() => { -// backendSrv.get.mockReturnValue( -// Promise.resolve([ -// { id: 2, dashboardId: 1, role: 'Viewer', permission: 1, permissionName: 'View' }, -// { id: 3, dashboardId: 1, role: 'Editor', permission: 1, permissionName: 'Edit' }, -// { -// id: 4, -// dashboardId: 1, -// userId: 2, -// userLogin: 'danlimerick', -// userEmail: 'dan.limerick@gmail.com', -// permission: 4, -// permissionName: 'Admin', -// }, -// ]) -// ); - -// backendSrv.post = jest.fn(); - -// const store = RootStore.create( -// {}, -// { -// backendSrv: backendSrv, -// } -// ); - -// wrapper = shallow(); -// return wrapper.instance().loadStore(1, true); -// }); - -// describe('when permission for a user is added', () => { -// it('should save permission to db', () => { -// const userItem = { -// id: 2, -// login: 'user2', -// }; - -// wrapper -// .instance() -// .userPicked(userItem) -// .then(() => { -// expect(backendSrv.post.mock.calls.length).toBe(1); -// expect(backendSrv.post.mock.calls[0][0]).toBe('/api/dashboards/id/1/acl'); -// }); -// }); -// }); - -// describe('when permission for team is added', () => { -// it('should save permission to db', () => { -// const teamItem = { -// id: 2, -// name: 'ug1', -// }; - -// wrapper -// .instance() -// .teamPicked(teamItem) -// .then(() => { -// expect(backendSrv.post.mock.calls.length).toBe(1); -// expect(backendSrv.post.mock.calls[0][0]).toBe('/api/dashboards/id/1/acl'); -// }); -// }); -// }); -// }); diff --git a/public/sass/components/_gf-form.scss b/public/sass/components/_gf-form.scss index a1e208ee1c2..6603cfa072b 100644 --- a/public/sass/components/_gf-form.scss +++ b/public/sass/components/_gf-form.scss @@ -400,7 +400,7 @@ select.gf-form-input ~ .gf-form-help-icon { .cta-form { position: relative; padding: 1rem; - background-color: $dark-4; + background-color: $empty-list-cta-bg; margin-bottom: 1rem; border-top: 3px solid $green; }