From 3edd209736923bddfe0d9aaea3ff9f35f6f359b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 20 Jun 2017 12:36:07 -0400 Subject: [PATCH 1/7] dashboard acl modal --- public/app/core/components/navbar/navbar.html | 6 +- public/app/core/directives/dash_edit_link.js | 20 +- public/app/core/nav_model_srv.ts | 8 +- public/app/features/dashboard/acl/acl.html | 203 ++++++++++++------ public/app/features/dashboard/acl/acl.ts | 60 +++--- .../features/dashboard/dashnav/dashnav.html | 143 +++++------- .../app/features/dashboard/dashnav/dashnav.ts | 11 - .../dashboard/import/dash_import.html | 1 - 8 files changed, 241 insertions(+), 211 deletions(-) diff --git a/public/app/core/components/navbar/navbar.html b/public/app/core/components/navbar/navbar.html index 085e2eef920..ea8eb21d6d6 100644 --- a/public/app/core/components/navbar/navbar.html +++ b/public/app/core/components/navbar/navbar.html @@ -8,9 +8,9 @@ - - - + + +
diff --git a/public/app/core/directives/dash_edit_link.js b/public/app/core/directives/dash_edit_link.js index a4c1ad53b3c..21e8940200c 100644 --- a/public/app/core/directives/dash_edit_link.js +++ b/public/app/core/directives/dash_edit_link.js @@ -2,8 +2,9 @@ define([ 'jquery', 'angular', '../core_module', + 'lodash', ], -function ($, angular, coreModule) { +function ($, angular, coreModule, _) { 'use strict'; var editViewMap = { @@ -12,7 +13,8 @@ function ($, angular, coreModule) { 'templating': { src: 'public/app/features/templating/partials/editor.html'}, 'history': { html: ''}, 'timepicker': { src: 'public/app/features/dashboard/timepicker/dropdown.html' }, - 'import': { html: '' } + 'import': { html: '', isModal: true }, + 'permissions': { html: '', isModal: true } }; coreModule.default.directive('dashEditorView', function($compile, $location, $rootScope) { @@ -31,8 +33,7 @@ function ($, angular, coreModule) { function showEditorPane(evt, options) { if (options.editview) { - options.src = editViewMap[options.editview].src; - options.html = editViewMap[options.editview].html; + _.defaults(options, editViewMap[options.editview]); } if (lastEditView && lastEditView === options.editview) { @@ -61,19 +62,24 @@ function ($, angular, coreModule) { var urlParams = $location.search(); if (options.editview === urlParams.editview) { delete urlParams.editview; - $location.search(urlParams); + // hack for consistently updating url + setTimeout(function() { + $rootScope.$apply(function() { + $location.search(urlParams); + }); + }); } } }; - if (options.editview === 'import') { + if (options.isModal) { var modalScope = $rootScope.$new(); modalScope.$on("$destroy", function() { editorScope.dismiss(); }); $rootScope.appEvent('show-modal', { - templateHtml: '', + templateHtml: options.html, scope: modalScope, backdrop: 'static' }); diff --git a/public/app/core/nav_model_srv.ts b/public/app/core/nav_model_srv.ts index 058247b7fd8..cdd0ef04350 100644 --- a/public/app/core/nav_model_srv.ts +++ b/public/app/core/nav_model_srv.ts @@ -168,6 +168,12 @@ export class NavModelSrv { clickHandler: () => dashNavCtrl.openEditView('annotations') }); + menu.push({ + title: 'Permissions...', + icon: 'fa fa-fw fa-lock', + clickHandler: () => dashNavCtrl.openEditView('permissions') + }); + if (!dashboard.meta.isHome) { menu.push({ title: 'Version history', @@ -199,7 +205,7 @@ export class NavModelSrv { if (this.contextSrv.isEditor && !dashboard.meta.isFolder) { menu.push({ - title: 'Save As ...', + title: 'Save As...', icon: 'fa fa-fw fa-save', clickHandler: () => dashNavCtrl.saveDashboardAs() }); diff --git a/public/app/features/dashboard/acl/acl.html b/public/app/features/dashboard/acl/acl.html index d31b2ce6999..97018f4e2ad 100644 --- a/public/app/features/dashboard/acl/acl.html +++ b/public/app/features/dashboard/acl/acl.html @@ -1,74 +1,135 @@ -
-
Add New Permission
-
-
-
- Type - -
-
- User - -
-
- User Group - -
-
- Permission - -
-
- -
-
-
+