Commit 7f0440fd by Torkel Ödegaard

minor tweaks

parent a48ba7b1
......@@ -92,7 +92,7 @@ func setIndexViewData(c *middleware.Context) (*dtos.IndexViewData, error) {
Text: "Create",
Id: "create",
Icon: "fa fa-fw fa-plus",
Url: "#",
Url: setting.AppSubUrl + "dashboard/new",
Children: []*dtos.NavLink{
{Text: "Dashboard", Icon: "gicon gicon-dashboard-new", Url: setting.AppSubUrl + "/dashboard/new"},
{Text: "Folder", SubTitle: "Create a new folder to organize your dashboards", Id: "folder", Icon: "gicon gicon-folder-new", Url: setting.AppSubUrl + "/dashboards/folder/new"},
......
......@@ -238,63 +238,12 @@ export class BackendSrv {
schemaVersion: 16,
title: name,
editable: true,
hideControls: true,
panels: [
{
id: 1,
folderId: 0,
headings: false,
limit: 1000,
links: [],
query: '',
recent: false,
search: true,
starred: false,
tags: [],
title: 'Dashboards in this folder',
type: 'dashlist',
gridPos: {
x: 0,
y: 0,
w: 8,
h: 10
}
},
{
id: 2,
onlyAlertsOnDashboard: true,
title: 'Alerts in this folder',
type: 'alertlist',
gridPos: {
x: 4,
y: 0,
w: 8,
h: 10
}
},
{
id: 3,
title: 'Permissions for this folder',
type: 'permissionlist',
folderId: 0,
gridPos: {
x: 8,
y: 0,
w: 8,
h: 10
}
}
]
panels: []
};
return this.post('/api/dashboards/db/', {dashboard: dash, isFolder: true, overwrite: false})
.then(res => {
return this.getDashboard('db', res.slug);
})
.then(res => {
res.dashboard.panels[0].folderId = res.dashboard.id;
res.dashboard.panels[2].folderId = res.dashboard.id;
return this.saveDashboard(res.dashboard, {overwrite: false});
});
}
}
......
<page-header model="ctrl.navModel"></page-header>
<div class="page-container page-body">
<h1>Coming soon! Permissions will be added in Grafana 5.0 beta.</h1>
</div>
\ No newline at end of file
<h2 class="page-sub-heading">
Coming soon! Permissions will be added in Grafana 5.0 beta.
</h2>
</div>
<page-header model="ctrl.navModel"></page-header>
<div class="page-container page-body">
<h2 class="page-sub-heading">Folder Settings</h2>
<div class="section gf-form-group">
<h1 class="section-heading">Folder Settings</h1>
<form name="folderSettingsForm" ng-submit="ctrl.save()">
<div class="gf-form">
<label class="gf-form-label width-7">Name</label>
<input type="text" class="gf-form-input width-30" ng-model='ctrl.dashboard.title'></input>
</div>
<div class="gf-form-button-row">
<button type="submit" class="btn btn-success" ng-disabled="!ctrl.canSave">
<i class="fa fa-trash"></i>
Save
</button>
<button class="btn btn-danger" ng-click="ctrl.delete($event)" ng-disabled="!ctrl.canSave">
<i class="fa fa-trash"></i>
Delete
</button>
</div>
</form>
</div>
<div class="section gf-form-group">
<form name="folderSettingsForm" ng-submit="ctrl.save()">
<div class="gf-form">
<label class="gf-form-label width-7">Name</label>
<input type="text" class="gf-form-input width-30" ng-model='ctrl.dashboard.title'></input>
</div>
<div class="gf-form-button-row">
<button type="submit" class="btn btn-success" ng-disabled="!ctrl.canSave">
<i class="fa fa-trash"></i>
Save
</button>
<button class="btn btn-danger" ng-click="ctrl.delete($event)" ng-disabled="!ctrl.canSave">
<i class="fa fa-trash"></i>
Delete
</button>
</div>
</form>
</div>
</div>
<div>
<div class="section gf-form-group">
<h5 class="section-heading">Options</h5>
<div class="gf-form">
<folder-picker initial-folder-id="ctrl.panel.folderId"
on-change="ctrl.onFolderChange($folder)"
label-class="width-6">
</folder-picker>
</div>
</div>
</div>
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 20.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="100px" height="100px" viewBox="0 0 100 100" enable-background="new 0 0 100 100" xml:space="preserve">
<g>
<path fill="#1F1F1F" d="M18.2,4.2c-1.5,0-2.9,0.6-3.9,1.6l-0.5,0.5l-0.5-0.5c-1-1.1-2.4-1.6-3.9-1.6S6.6,4.8,5.5,5.8
c-1,1-1.6,2.4-1.6,3.9s0.6,2.9,1.6,3.9l8.3,8.3l8.3-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.7,3.3H33.4c-1,0-1.8,0.8-1.8,1.8v15.8c0,1,0.8,1.8,1.8,1.8h61.4c1,0,1.8-0.8,1.8-1.8V5.1
C96.6,4.1,95.7,3.3,94.7,3.3z"/>
<path fill="#898989" d="M94.7,27.8H33.4c-1,0-1.8,0.8-1.8,1.8v15.8c0,1,0.8,1.8,1.8,1.8h61.4c1,0,1.8-0.8,1.8-1.8V29.6
C96.6,28.6,95.7,27.8,94.7,27.8z"/>
<path fill="#898989" d="M94.7,52.3H33.4c-1,0-1.8,0.8-1.8,1.8v15.8c0,1,0.8,1.8,1.8,1.8h61.4c1,0,1.8-0.8,1.8-1.8V54.1
C96.6,53.1,95.7,52.3,94.7,52.3z"/>
<path fill="#898989" d="M94.7,76.8H33.4c-1,0-1.8,0.8-1.8,1.8v15.8c0,1,0.8,1.8,1.8,1.8h61.4c1,0,1.8-0.8,1.8-1.8V78.6
C96.6,77.6,95.7,76.8,94.7,76.8z"/>
<path fill="#04A64D" d="M18.2,3.4c-1.6,0-3.2,0.6-4.4,1.7C12.6,4,11.1,3.4,9.4,3.4c-1.7,0-3.3,0.7-4.5,1.9C3.7,6.5,3,8.1,3,9.8
s0.7,3.3,1.9,4.5l8.9,8.9l8.9-8.9c1.2-1.2,1.9-2.8,1.9-4.5s-0.7-3.3-1.9-4.5C21.5,4.1,19.9,3.4,18.2,3.4z M22.1,13.7L13.8,22
l-8.3-8.3c-1-1-1.6-2.4-1.6-3.9s0.6-2.9,1.6-3.9c1-1,2.4-1.6,3.9-1.6s2.9,0.6,3.9,1.6l0.5,0.5l0.5-0.5c1-1,2.4-1.6,3.9-1.6
c1.5,0,2.9,0.6,3.9,1.6c1,1,1.6,2.4,1.6,3.9S23.2,12.7,22.1,13.7z"/>
<path fill="#04A64D" d="M18.2,5.9c-1,0-2,0.4-2.8,1.1L15,7.5l-0.6,0.6l-0.6,0.6l-0.6-0.6l-0.6-0.6L12.2,7c-0.7-0.7-1.7-1.1-2.8-1.1
c-1,0-2,0.4-2.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7.2-7.2c0.7-0.7,1.1-1.7,1.1-2.8c0-1-0.4-2-1.1-2.8
c-0.7-0.7-1.7-1.1-2.8-1.1c-0.8,0-1.5,0.2-2.1,0.6l0.7-2.1c0.5-0.1,0.9-0.2,1.4-0.2c1.5,0,2.9,0.6,3.9,1.6c1,1,1.6,2.4,1.6,3.9
C23.8,60,23.2,61.4,22.1,62.4z"/>
</g>
</svg>
<section class="card-section card-list-layout-list">
<ol class="card-list">
<li class="card-item-wrapper" ng-repeat="permission in ctrl.userPermissions">
<div class="card-item card-item--alert">
<div class="card-item-header">
<div class="card-item-sub-name">{{permission.permissionName}}</div>
</div>
<div class="card-item-body">
<div class="card-item-details">
<div class="card-item-notice">{{permission.userLogin}}</div>
</div>
</div>
</div>
</div>
</li>
<li class="card-item-wrapper" ng-repeat="permission in ctrl.teamPermissions">
<div class="card-item card-item--alert">
<div class="card-item-header">
<div class="card-item-sub-name">{{permission.permissionName}}</div>
</div>
<div class="card-item-body">
<div class="card-item-details">
<div class="card-item-notice">{{permission.team}}</div>
</div>
</div>
</div>
</div>
</li>
</ol>
</section>
///<reference path="../../../headers/common.d.ts" />
import _ from 'lodash';
import {PanelCtrl} from 'app/plugins/sdk';
class PermissionListCtrl extends PanelCtrl {
static templateUrl = 'module.html';
userPermissions: any[];
teamPermissions: any[];
roles: any[];
panelDefaults = {
folderId: 0
};
/** @ngInject */
constructor($scope, $injector, private backendSrv) {
super($scope, $injector);
_.defaults(this.panel, this.panelDefaults);
this.events.on('refresh', this.onRefresh.bind(this));
this.events.on('init-edit-mode', this.onInitEditMode.bind(this));
this.getPermissions();
}
onInitEditMode() {
this.editorTabIndex = 1;
this.addEditorTab('Options', 'public/app/plugins/panel/permissionlist/editor.html');
}
onRefresh() {
var promises = [];
promises.push(this.getPermissions());
return Promise.all(promises)
.then(this.renderingCompleted.bind(this));
}
onFolderChange(folder: any) {
this.panel.folderId = folder.id;
this.refresh();
}
getPermissions() {
return this.backendSrv.get(`/api/dashboards/id/${this.panel.folderId}/acl`)
.then(result => {
this.userPermissions = _.filter(result, p => { return p.userId > 0;});
this.teamPermissions = _.filter(result, p => { return p.teamId > 0;});
// this.roles = this.setRoles(result);
});
}
}
export {PermissionListCtrl, PermissionListCtrl as PanelCtrl};
{
"type": "panel",
"name": "Permission List",
"id": "permissionlist",
"info": {
"author": {
"name": "Grafana Project",
"url": "https://grafana.com"
},
"logos": {
"small": "img/icn-singlestat-panel.svg",
"large": "img/icn-singlestat-panel.svg"
}
}
}
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