[Timeline] Show progress notification during export

This commit is contained in:
Victor Woeltjen 2016-03-07 16:09:23 -08:00
parent 14b8e02f27
commit c4f1c4ad1f
2 changed files with 17 additions and 5 deletions

View File

@ -93,7 +93,7 @@ define([
"name": "Export Timeline as CSV", "name": "Export Timeline as CSV",
"category": "contextual", "category": "contextual",
"implementation": ExportTimelineAsCSVAction, "implementation": ExportTimelineAsCSVAction,
"depends": [ "exportService" ] "depends": [ "exportService", "notificationService" ]
} }
], ],
"constants": [ "constants": [

View File

@ -24,17 +24,29 @@
define(["./ExportTimelineAsCSVTask"], function (ExportTimelineAsCSVTask) { define(["./ExportTimelineAsCSVTask"], function (ExportTimelineAsCSVTask) {
'use strict'; 'use strict';
function ExportTimelineAsCSVAction(exportService, context) { function ExportTimelineAsCSVAction(exportService, notificationService, context) {
this.task = new ExportTimelineAsCSVTask( this.task = new ExportTimelineAsCSVTask(
exportService, exportService,
context.domainObject context.domainObject
); );
//this.taskService = taskService; this.notificationService = notificationService;
} }
ExportTimelineAsCSVAction.prototype.perform = function () { ExportTimelineAsCSVAction.prototype.perform = function () {
return this.task.run(); var notificationService = this.notificationService,
//return this.taskService.run(this.task); 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) { ExportTimelineAsCSVAction.appliesTo = function (context) {