From 7fe1ac5fe74cb54f3f6417285bd42ad005bb4480 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 19 Oct 2017 12:52:26 +0200 Subject: [PATCH] fix: fixed save to file button in export modal, fixes #9586 (cherry picked from commit 1e61eae9f47b32c0fed98f4308b5186706be0439) --- public/app/features/dashboard/export/export_modal.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/public/app/features/dashboard/export/export_modal.ts b/public/app/features/dashboard/export/export_modal.ts index 6b877ffd239..826086ebdf0 100644 --- a/public/app/features/dashboard/export/export_modal.ts +++ b/public/app/features/dashboard/export/export_modal.ts @@ -1,8 +1,7 @@ -/// - 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: '&'}, }; }