From 43db52fd702e156025141e4d2e7a61871f5751df Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Tue, 8 Mar 2016 10:04:09 -0800 Subject: [PATCH] [Timeline] Simplify interface ...such that responsibility for knowing exportService interface is more localized. --- .../timeline/src/actions/ExportTimelineAsCSVTask.js | 5 +++-- .../timeline/src/actions/TimelineCSVExporter.js | 10 ++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/platform/features/timeline/src/actions/ExportTimelineAsCSVTask.js b/platform/features/timeline/src/actions/ExportTimelineAsCSVTask.js index 8a0b60ca94..790b165fd7 100644 --- a/platform/features/timeline/src/actions/ExportTimelineAsCSVTask.js +++ b/platform/features/timeline/src/actions/ExportTimelineAsCSVTask.js @@ -45,9 +45,10 @@ define([ var exportService = this.exportService; function doExport(objects) { - var exporter = new TimelineCSVExporter(objects); + var exporter = new TimelineCSVExporter(objects), + options = { headers: exporter.headers() }; return exporter.rows().then(function (rows) { - return exportService.exportCSV(rows, exporter.options()); + return exportService.exportCSV(rows, options); }); } diff --git a/platform/features/timeline/src/actions/TimelineCSVExporter.js b/platform/features/timeline/src/actions/TimelineCSVExporter.js index bc73d6f782..3ebe37db1c 100644 --- a/platform/features/timeline/src/actions/TimelineCSVExporter.js +++ b/platform/features/timeline/src/actions/TimelineCSVExporter.js @@ -93,12 +93,10 @@ define([ return Promise.all(this.domainObjects.map(toRow)); }; - TimelineCSVExporter.prototype.options = function () { - return { - headers: this.columns.map(function (column) { - return column.name(); - }) - }; + TimelineCSVExporter.prototype.headers = function () { + return this.columns.map(function (column) { + return column.name(); + }); }; return TimelineCSVExporter;