mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
ux: nav changes
This commit is contained in:
parent
12270022e3
commit
5360303ad4
@ -90,9 +90,9 @@ func setIndexViewData(c *middleware.Context) (*dtos.IndexViewData, error) {
|
|||||||
Icon: "fa fa-fw fa-plus",
|
Icon: "fa fa-fw fa-plus",
|
||||||
Url: setting.AppSubUrl + "/",
|
Url: setting.AppSubUrl + "/",
|
||||||
Children: []*dtos.NavLink{
|
Children: []*dtos.NavLink{
|
||||||
{Text: "Dashboard", Icon: "icon-gf icon-gf-dashboard", Url: setting.AppSubUrl + "/dashboard/new"},
|
{Text: "Dashboard", Icon: "fa fa-fw fa-plus", Url: setting.AppSubUrl + "/dashboard/new"},
|
||||||
{Text: "Folder", Icon: "fa fa-fw fa-folder", Url: setting.AppSubUrl + "/dashboard/new"},
|
{Text: "Folder", Icon: "fa fa-fw fa-plus", Url: setting.AppSubUrl + "/dashboard/new/?editview=new-folder"},
|
||||||
{Text: "Import", Icon: "fa fa-fw fa-download", Url: setting.AppSubUrl + "/dashboard/new/?editview=import"},
|
{Text: "Import", Icon: "fa fa-fw fa-plus", Url: setting.AppSubUrl + "/dashboard/new/?editview=import"},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -158,13 +158,6 @@ export class SearchCtrl {
|
|||||||
this.search();
|
this.search();
|
||||||
}
|
}
|
||||||
|
|
||||||
showNewFolderModal() {
|
|
||||||
appEvents.emit('show-modal', {
|
|
||||||
templateHtml: '<folder-modal></folder-modal>',
|
|
||||||
modalClass: 'modal--narrow'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
search() {
|
search() {
|
||||||
this.showImport = false;
|
this.showImport = false;
|
||||||
this.selectedIndex = 0;
|
this.selectedIndex = 0;
|
||||||
|
@ -14,7 +14,12 @@ function ($, angular, coreModule, _) {
|
|||||||
'history': { html: '<gf-dashboard-history dashboard="dashboard"></gf-dashboard-history>'},
|
'history': { html: '<gf-dashboard-history dashboard="dashboard"></gf-dashboard-history>'},
|
||||||
'timepicker': { src: 'public/app/features/dashboard/timepicker/dropdown.html' },
|
'timepicker': { src: 'public/app/features/dashboard/timepicker/dropdown.html' },
|
||||||
'import': { html: '<dash-import dismiss="dismiss()"></dash-import>', isModal: true },
|
'import': { html: '<dash-import dismiss="dismiss()"></dash-import>', isModal: true },
|
||||||
'permissions': { html: '<dash-acl-modal dismiss="dismiss()"></dash-acl-modal>', isModal: true }
|
'permissions': { html: '<dash-acl-modal dismiss="dismiss()"></dash-acl-modal>', isModal: true },
|
||||||
|
'new-folder': {
|
||||||
|
isModal: true,
|
||||||
|
html: '<folder-modal dismiss="dismiss()"></folder-modal>',
|
||||||
|
modalClass: 'modal--narrow'
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
coreModule.default.directive('dashEditorView', function($compile, $location, $rootScope) {
|
coreModule.default.directive('dashEditorView', function($compile, $location, $rootScope) {
|
||||||
@ -87,7 +92,8 @@ function ($, angular, coreModule, _) {
|
|||||||
$rootScope.appEvent('show-modal', {
|
$rootScope.appEvent('show-modal', {
|
||||||
templateHtml: options.html,
|
templateHtml: options.html,
|
||||||
scope: modalScope,
|
scope: modalScope,
|
||||||
backdrop: 'static'
|
backdrop: 'static',
|
||||||
|
modalClass: options.modalClass,
|
||||||
});
|
});
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h2 class="modal-header-title">
|
<h2 class="modal-header-title">
|
||||||
<span class="p-l-1">Create Folder</span>
|
<i class="fa fa-folder"></i>
|
||||||
|
<span class="p-l-1">New Dashboard Folder</span>
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
<a class="modal-header-close" ng-click="ctrl.dismiss();">
|
<a class="modal-header-close" ng-click="ctrl.dismiss();">
|
||||||
@ -12,13 +13,12 @@
|
|||||||
<form name="ctrl.saveForm" ng-submit="ctrl.create()" class="modal-content folder-modal" novalidate>
|
<form name="ctrl.saveForm" ng-submit="ctrl.create()" class="modal-content folder-modal" novalidate>
|
||||||
<div class="p-t-2">
|
<div class="p-t-2">
|
||||||
<div class="gf-form">
|
<div class="gf-form">
|
||||||
<span class="gf-form-label width-10">Folder Name</span>
|
<input type="text" ng-model="ctrl.title" required give-focus="true" class="gf-form-input" placeholder="Enter folder name" />
|
||||||
<input type="text" ng-model="ctrl.title" required give-focus="true" class="gf-form-input max-width-14" placeholder="Enter folder name" />
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="gf-form-button-row text-center">
|
<div class="gf-form-button-row text-center">
|
||||||
<button type="submit" class="btn btn-success">Create</button>
|
<button type="submit" class="btn btn-success" ng-disabled="ctrl.saveForm.$invalid">Create</button>
|
||||||
<a class="btn-text" ng-click="dismiss();">Cancel</a>
|
<a class="btn-text" ng-click="ctrl.dismiss();">Cancel</a>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
@ -6,9 +6,10 @@ import _ from 'lodash';
|
|||||||
|
|
||||||
export class FolderCtrl {
|
export class FolderCtrl {
|
||||||
title: string;
|
title: string;
|
||||||
|
dismiss: any;
|
||||||
|
|
||||||
/** @ngInject */
|
/** @ngInject */
|
||||||
constructor(private backendSrv, private $scope, $sce) {
|
constructor(private backendSrv, private $scope, private $location) {
|
||||||
}
|
}
|
||||||
|
|
||||||
create() {
|
create() {
|
||||||
@ -18,17 +19,13 @@ export class FolderCtrl {
|
|||||||
|
|
||||||
const title = this.title.trim();
|
const title = this.title.trim();
|
||||||
|
|
||||||
|
return this.backendSrv.createDashboardFolder(title).then(result => {
|
||||||
return this.backendSrv.createDashboardFolder(title).then((result) => {
|
appEvents.emit('alert-success', ['Folder Created', 'OK']);
|
||||||
appEvents.emit('alert-success', ['Dashboard saved', 'Saved as ' + title]);
|
|
||||||
|
|
||||||
appEvents.emit('dashboard-saved', result);
|
|
||||||
this.dismiss();
|
this.dismiss();
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
dismiss() {
|
var folderUrl = '/dashboard/db/' + result.slug;
|
||||||
appEvents.emit('hide-modal');
|
this.$location.url(folderUrl);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,6 +36,9 @@ export function folderModal() {
|
|||||||
controller: FolderCtrl,
|
controller: FolderCtrl,
|
||||||
bindToController: true,
|
bindToController: true,
|
||||||
controllerAs: 'ctrl',
|
controllerAs: 'ctrl',
|
||||||
|
scope: {
|
||||||
|
dismiss: "&"
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@
|
|||||||
|
|
||||||
i {
|
i {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin-right: 10px;
|
margin-right: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
|
Loading…
Reference in New Issue
Block a user