From c4f1c4ad1f356dd1274a1f5e5691284102d20413 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Mon, 7 Mar 2016 16:09:23 -0800 Subject: [PATCH] [Timeline] Show progress notification during export --- platform/features/timeline/bundle.js | 2 +- .../src/actions/ExportTimelineAsCSVAction.js | 20 +++++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/platform/features/timeline/bundle.js b/platform/features/timeline/bundle.js index 3da27cd925..f298cb887e 100644 --- a/platform/features/timeline/bundle.js +++ b/platform/features/timeline/bundle.js @@ -93,7 +93,7 @@ define([ "name": "Export Timeline as CSV", "category": "contextual", "implementation": ExportTimelineAsCSVAction, - "depends": [ "exportService" ] + "depends": [ "exportService", "notificationService" ] } ], "constants": [ diff --git a/platform/features/timeline/src/actions/ExportTimelineAsCSVAction.js b/platform/features/timeline/src/actions/ExportTimelineAsCSVAction.js index 099261256f..37c1fddbf0 100644 --- a/platform/features/timeline/src/actions/ExportTimelineAsCSVAction.js +++ b/platform/features/timeline/src/actions/ExportTimelineAsCSVAction.js @@ -24,17 +24,29 @@ define(["./ExportTimelineAsCSVTask"], function (ExportTimelineAsCSVTask) { 'use strict'; - function ExportTimelineAsCSVAction(exportService, context) { + function ExportTimelineAsCSVAction(exportService, notificationService, context) { this.task = new ExportTimelineAsCSVTask( exportService, context.domainObject ); - //this.taskService = taskService; + this.notificationService = notificationService; } ExportTimelineAsCSVAction.prototype.perform = function () { - return this.task.run(); - //return this.taskService.run(this.task); + var notificationService = this.notificationService, + notification = notificationService.notify({ + title: "Exporting CSV", + unknownProgress: true + }); + + return this.task.run() + .then(function () { + notification.dismiss(); + }) + .catch(function () { + notification.dismiss(); + notificationService.error("Error exporting CSV"); + }); }; ExportTimelineAsCSVAction.appliesTo = function (context) {