Explorar el Código

dashboards: fix updating folder so that correct url is returned

Marcus Efraimsson hace 8 años
padre
commit
8fc648ac43

+ 11 - 0
public/app/core/services/backend_srv.ts

@@ -257,6 +257,17 @@ export class BackendSrv {
     });
     });
   }
   }
 
 
+  updateDashboardFolder(dash, options) {
+    options = options || {};
+
+    return this.post('/api/dashboards/db/', {
+      dashboard: dash,
+      isFolder: true,
+      overwrite: options.overwrite === true,
+      message: options.message || '',
+    });
+  }
+
   deleteDashboard(uid) {
   deleteDashboard(uid) {
     let deferred = this.$q.defer();
     let deferred = this.$q.defer();
 
 

+ 2 - 2
public/app/features/dashboard/folder_settings_ctrl.ts

@@ -37,7 +37,7 @@ export class FolderSettingsCtrl {
     this.dashboard.title = this.title.trim();
     this.dashboard.title = this.title.trim();
 
 
     return this.backendSrv
     return this.backendSrv
-      .saveDashboard(this.dashboard, { overwrite: false })
+      .updateDashboardFolder(this.dashboard, { overwrite: false })
       .then(result => {
       .then(result => {
         if (result.url !== this.$location.path()) {
         if (result.url !== this.$location.path()) {
           this.$location.url(result.url + '/settings');
           this.$location.url(result.url + '/settings');
@@ -84,7 +84,7 @@ export class FolderSettingsCtrl {
         yesText: 'Save & Overwrite',
         yesText: 'Save & Overwrite',
         icon: 'fa-warning',
         icon: 'fa-warning',
         onConfirm: () => {
         onConfirm: () => {
-          this.backendSrv.saveDashboard(this.dashboard, { overwrite: true });
+          this.backendSrv.updateDashboardFolder(this.dashboard, { overwrite: true });
         },
         },
       });
       });
     }
     }