mirror of https://github.com/grafana/grafana
parent
06a15eec5c
commit
1e865211c9
@ -0,0 +1,24 @@ |
||||
<div class="modal-body"> |
||||
<div class="modal-header"> |
||||
<h2 class="modal-header-title"> |
||||
<span class="p-l-1">Create Folder</span> |
||||
</h2> |
||||
|
||||
<a class="modal-header-close" ng-click="ctrl.dismiss();"> |
||||
<i class="fa fa-remove"></i> |
||||
</a> |
||||
</div> |
||||
|
||||
<div class="modal-content folder-modal"> |
||||
<div class="p-t-2"> |
||||
<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 max-width-14" placeholder="Enter folder name" /> |
||||
</div> |
||||
</div> |
||||
<div class="gf-form-button-row text-center"> |
||||
<a type="submit" class="btn btn-success" ng-click="ctrl.create()">Create</a> |
||||
<a class="btn-text" ng-click="dismiss();">Cancel</a> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
@ -0,0 +1,45 @@ |
||||
///<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 FolderCtrl { |
||||
title: string; |
||||
|
||||
/** @ngInject */ |
||||
constructor(private backendSrv, private $scope, $sce) { |
||||
} |
||||
|
||||
create() { |
||||
if (!this.title || this.title.trim().length === 0) { |
||||
return; |
||||
} |
||||
|
||||
const title = this.title.trim(); |
||||
|
||||
|
||||
return this.backendSrv.saveDashboardFolder(title).then((result) => { |
||||
appEvents.emit('alert-success', ['Dashboard saved', 'Saved as ' + title]); |
||||
|
||||
appEvents.emit('dashboard-saved', result); |
||||
this.dismiss(); |
||||
}); |
||||
} |
||||
|
||||
dismiss() { |
||||
appEvents.emit('hide-modal'); |
||||
} |
||||
} |
||||
|
||||
export function folderModal() { |
||||
return { |
||||
restrict: 'E', |
||||
templateUrl: 'public/app/features/dashboard/folder_modal/folder.html', |
||||
controller: FolderCtrl, |
||||
bindToController: true, |
||||
controllerAs: 'ctrl', |
||||
}; |
||||
} |
||||
|
||||
coreModule.directive('folderModal', folderModal); |
||||
Loading…
Reference in new issue