Commit 06a15eec by Daniel Lee

WIP: permissions moved to settings tab. Adds folder dropdown to general settings tab

parent 82afe822
...@@ -205,6 +205,7 @@ export class BackendSrv { ...@@ -205,6 +205,7 @@ export class BackendSrv {
return this.post('/api/dashboards/db/', { return this.post('/api/dashboards/db/', {
dashboard: dash, dashboard: dash,
parentId: dash.parentId,
overwrite: options.overwrite === true, overwrite: options.overwrite === true,
message: options.message || '', message: options.message || '',
}); });
......
<div class="modal-body"> <div class="editor-row">
<div class="modal-header">
<h2 class="modal-header-title">
<i class="fa fa-share"></i>
<span class="p-l-1">Dashboard Permissions</span>
</h2>
<a class="modal-header-close" ng-click="ctrl.dismiss();">
<i class="fa fa-remove"></i>
</a>
</div>
<div class="modal-content acl-modal">
<div class="permissionlist"> <div class="permissionlist">
<div class="permissionlist__section"> <div class="permissionlist__section">
<div class="permissionlist__section-header"> <div class="permissionlist__section-header">
...@@ -53,5 +41,4 @@ ...@@ -53,5 +41,4 @@
</div> </div>
</div> </div>
</div> </div>
</div>
</div> </div>
...@@ -6,7 +6,7 @@ import _ from 'lodash'; ...@@ -6,7 +6,7 @@ import _ from 'lodash';
export class AclCtrl { export class AclCtrl {
tabIndex: any; tabIndex: any;
dashboardId: number; dashboard: any;
userPermissions: Permission[]; userPermissions: Permission[];
userGroupPermissions: Permission[]; userGroupPermissions: Permission[];
...@@ -15,7 +15,7 @@ export class AclCtrl { ...@@ -15,7 +15,7 @@ export class AclCtrl {
this.tabIndex = 0; this.tabIndex = 0;
this.userPermissions = []; this.userPermissions = [];
this.userGroupPermissions = []; this.userGroupPermissions = [];
this.get(this.$scope.dashboardId); this.get(this.dashboard.id);
} }
get(dashboardId: number) { get(dashboardId: number) {
...@@ -43,13 +43,14 @@ export class AclCtrl { ...@@ -43,13 +43,14 @@ export class AclCtrl {
} }
} }
export function aclModal() { export function aclSettings() {
return { return {
restrict: 'E', restrict: 'E',
templateUrl: 'public/app/features/dashboard/acl/acl.html', templateUrl: 'public/app/features/dashboard/acl/acl.html',
controller: AclCtrl, controller: AclCtrl,
bindToController: true, bindToController: true,
controllerAs: 'ctrl' controllerAs: 'ctrl',
scope: { dashboard: "=" }
}; };
} }
...@@ -67,4 +68,4 @@ export interface Permission { ...@@ -67,4 +68,4 @@ export interface Permission {
permissions: number[]; permissions: number[];
} }
coreModule.directive('aclModal', aclModal); coreModule.directive('aclSettings', aclSettings);
...@@ -25,4 +25,5 @@ define([ ...@@ -25,4 +25,5 @@ define([
'./row/row_ctrl', './row/row_ctrl',
'./repeat_option/repeat_option', './repeat_option/repeat_option',
'./acl/acl', './acl/acl',
'./folder_picker/picker',
], function () {}); ], function () {});
...@@ -47,14 +47,14 @@ export class DashNavCtrl { ...@@ -47,14 +47,14 @@ export class DashNavCtrl {
appEvents.emit('show-modal', {templateHtml: '<help-modal></help-modal>'}); appEvents.emit('show-modal', {templateHtml: '<help-modal></help-modal>'});
} }
showAclModal() { // $scope.showAclModal = function() {
var modalScope = this.$scope.$new(); // var modalScope = $scope.$new();
modalScope.dashboardId = this.dashboard.id; // modalScope.dashboardId = $scope.dashboard.id;
appEvents.emit('show-modal', { // $scope.appEvent('show-modal', {
templateHtml: '<acl-modal></acl-modal>', // templateHtml: '<acl-modal></acl-modal>',
scope: modalScope // scope: modalScope
}); // });
} // };
starDashboard() { starDashboard() {
if (this.dashboard.meta.isStarred) { if (this.dashboard.meta.isStarred) {
......
<div class="gf-form">
<label class="gf-form-label width-7">Folder</label>
<div class="gf-form-select-wrapper">
<select ng-model="ctrl.selectedFolder" class='gf-form-input' ng-options="f.id as f.title for f in ctrl.folders" ng-change="ctrl.folderChanged()"></select>
</div>
</div>
///<reference path="../../../headers/common.d.ts" />
import coreModule from 'app/core/core_module';
import appEvents from 'app/core/app_events';
import _ from 'lodash';
export class FolderPickerCtrl {
dashboard: any;
folders: any[];
selectedFolder: number;
/** @ngInject */
constructor(private backendSrv, private $scope, $sce) {
this.get(this.dashboard.id);
this.selectedFolder = this.dashboard.meta.parentId;
}
get(dashboardId: number) {
var params = {
type: 'dash-folder',
};
return this.backendSrv.search(params).then(result => {
this.folders = result;
});
}
folderChanged() {
if (this.selectedFolder > 0) {
this.dashboard.parentId = this.selectedFolder;
}
}
}
export function folderPicker() {
return {
restrict: 'E',
templateUrl: 'public/app/features/dashboard/folder_picker/picker.html',
controller: FolderPickerCtrl,
bindToController: true,
controllerAs: 'ctrl',
scope: { dashboard: "=" }
};
}
coreModule.directive('folderPicker', folderPicker);
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
</h2> </h2>
<ul class="gf-tabs"> <ul class="gf-tabs">
<li class="gf-tabs-item" ng-repeat="tab in ::['General', 'Rows', 'Links', 'Time picker', 'Metadata']"> <li class="gf-tabs-item" ng-repeat="tab in ::['General', 'Rows', 'Links', 'Time picker', 'Metadata', 'Permissions']">
<a class="gf-tabs-link" ng-click="editor.index = $index" ng-class="{active: editor.index === $index}"> <a class="gf-tabs-link" ng-click="editor.index = $index" ng-class="{active: editor.index === $index}">
{{::tab}} {{::tab}}
</a> </a>
...@@ -44,6 +44,8 @@ ...@@ -44,6 +44,8 @@
<select ng-model="dashboard.timezone" class='gf-form-input' ng-options="f.value as f.text for f in [{value: '', text: 'Default'}, {value: 'browser', text: 'Local browser time'},{value: 'utc', text: 'UTC'}]" ng-change="timezoneChanged()"></select> <select ng-model="dashboard.timezone" class='gf-form-input' ng-options="f.value as f.text for f in [{value: '', text: 'Default'}, {value: 'browser', text: 'Local browser time'},{value: 'utc', text: 'UTC'}]" ng-change="timezoneChanged()"></select>
</div> </div>
</div> </div>
<folder-picker dashboard="dashboard"></folder-picker>
</div> </div>
<div class="section"> <div class="section">
...@@ -140,4 +142,8 @@ ...@@ -140,4 +142,8 @@
</div> </div>
</div> </div>
</div> </div>
<div ng-if="editor.index == 5">
<acl-settings dashboard="dashboard"></acl-settings>
</div>
</div> </div>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment