|
@@ -6,13 +6,14 @@ import _ from 'lodash';
|
|
|
|
|
|
|
|
export class FolderPickerCtrl {
|
|
export class FolderPickerCtrl {
|
|
|
dashboard: any;
|
|
dashboard: any;
|
|
|
- folders: any[];
|
|
|
|
|
|
|
+ folders: Folder[];
|
|
|
selectedFolder: number;
|
|
selectedFolder: number;
|
|
|
|
|
|
|
|
/** @ngInject */
|
|
/** @ngInject */
|
|
|
constructor(private backendSrv, private $scope, $sce) {
|
|
constructor(private backendSrv, private $scope, $sce) {
|
|
|
this.get(this.dashboard.id);
|
|
this.get(this.dashboard.id);
|
|
|
this.selectedFolder = this.dashboard.meta.parentId;
|
|
this.selectedFolder = this.dashboard.meta.parentId;
|
|
|
|
|
+ this.folders = [{id: 0, title: 'Root', type: 'dash-folder'}];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
get(dashboardId: number) {
|
|
get(dashboardId: number) {
|
|
@@ -21,17 +22,26 @@ export class FolderPickerCtrl {
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
return this.backendSrv.search(params).then(result => {
|
|
return this.backendSrv.search(params).then(result => {
|
|
|
- this.folders = result;
|
|
|
|
|
|
|
+ this.folders.push(...result);
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
folderChanged() {
|
|
folderChanged() {
|
|
|
- if (this.selectedFolder > 0) {
|
|
|
|
|
- this.dashboard.parentId = this.selectedFolder;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ this.dashboard.parentId = this.selectedFolder;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+export interface Folder {
|
|
|
|
|
+ id: number;
|
|
|
|
|
+ title: string;
|
|
|
|
|
+ uri?: string;
|
|
|
|
|
+ type: string;
|
|
|
|
|
+ tags?: string[];
|
|
|
|
|
+ isStarred?: boolean;
|
|
|
|
|
+ parentId?: number;
|
|
|
|
|
+ dashboards?: any;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
export function folderPicker() {
|
|
export function folderPicker() {
|
|
|
return {
|
|
return {
|
|
|
restrict: 'E',
|
|
restrict: 'E',
|