dashfolder: fix after backendSrv change

also removes unused create folder modal
This commit is contained in:
Daniel Lee 2017-12-14 09:35:14 +01:00
parent f1b1dbc6dd
commit 34cffc6b92
3 changed files with 1 additions and 67 deletions

View File

@ -20,7 +20,7 @@ export class CreateFolderCtrl {
return this.backendSrv.createDashboardFolder(title).then(result => {
appEvents.emit('alert-success', ['Folder Created', 'OK']);
var folderUrl = `/dashboards/folder/${result.id}/db/${result.slug}`;
var folderUrl = `/dashboards/folder/${result.dashboard.id}/${result.meta.slug}`;
this.$location.url(folderUrl);
});
}

View File

@ -1,24 +0,0 @@
<div class="modal-body">
<div class="modal-header">
<h2 class="modal-header-title">
<i class="gicon gicon-folder-new"></i>
<span class="p-l-1">New Dashboard Folder</span>
</h2>
<a class="modal-header-close" ng-click="ctrl.dismiss();">
<i class="fa fa-remove"></i>
</a>
</div>
<form name="ctrl.saveForm" ng-submit="ctrl.create()" class="modal-content folder-modal" novalidate>
<div class="p-t-2">
<div class="gf-form">
<input type="text" ng-model="ctrl.title" required give-focus="true" class="gf-form-input" placeholder="Enter folder name" />
</div>
</div>
<div class="gf-form-button-row text-center">
<button type="submit" class="btn btn-success" ng-disabled="ctrl.saveForm.$invalid">Create</button>
<a class="btn-text" ng-click="ctrl.dismiss();">Cancel</a>
</div>
</form>
</div>

View File

@ -1,42 +0,0 @@
import coreModule from 'app/core/core_module';
import appEvents from 'app/core/app_events';
export class FolderCtrl {
title: string;
dismiss: any;
/** @ngInject */
constructor(private backendSrv, private $location) {
}
create() {
if (!this.title || this.title.trim().length === 0) {
return;
}
const title = this.title.trim();
return this.backendSrv.createDashboardFolder(title).then(result => {
appEvents.emit('alert-success', ['Folder Created', 'OK']);
this.dismiss();
var folderUrl = '/dashboard/db/' + result.slug;
this.$location.url(folderUrl);
});
}
}
export function folderModal() {
return {
restrict: 'E',
templateUrl: 'public/app/features/dashboard/folder_modal/folder.html',
controller: FolderCtrl,
bindToController: true,
controllerAs: 'ctrl',
scope: {
dismiss: "&"
}
};
}
coreModule.directive('folderModal', folderModal);