Browse Source

fix: fixed save to file button in export modal, fixes #9586

Torkel Ödegaard 8 years ago
parent
commit
1e61eae9f4
1 changed files with 5 additions and 7 deletions
  1. 5 7
      public/app/features/dashboard/export/export_modal.ts

+ 5 - 7
public/app/features/dashboard/export/export_modal.ts

@@ -1,8 +1,7 @@
-///<reference path="../../../headers/common.d.ts" />
-
 import angular from 'angular';
-import coreModule from 'app/core/core_module';
+import {saveAs} from 'file-saver';
 
+import coreModule from 'app/core/core_module';
 import {DashboardExporter} from './exporter';
 
 export class DashExportCtrl {
@@ -22,9 +21,8 @@ export class DashExportCtrl {
   }
 
   save() {
-    var blob = new Blob([angular.toJson(this.dash, true)], { type: "application/json;charset=utf-8" });
-    var wnd: any = window;
-    wnd.saveAs(blob, this.dash.title + '-' + new Date().getTime() + '.json');
+    var blob = new Blob([angular.toJson(this.dash, true)], {type: 'application/json;charset=utf-8'});
+    saveAs(blob, this.dash.title + '-' + new Date().getTime() + '.json');
   }
 
   saveJson() {
@@ -44,7 +42,7 @@ export function dashExportDirective() {
     controller: DashExportCtrl,
     bindToController: true,
     controllerAs: 'ctrl',
-    scope: {dismiss: "&"}
+    scope: {dismiss: '&'},
   };
 }