diff --git a/platform/features/timeline/bundle.js b/platform/features/timeline/bundle.js index 8e2a40ed7d..27420fd032 100644 --- a/platform/features/timeline/bundle.js +++ b/platform/features/timeline/bundle.js @@ -93,7 +93,11 @@ define([ "name": "Export Timeline as CSV", "category": "contextual", "implementation": ExportTimelineAsCSVAction, - "depends": [ "exportService", "notificationService" ] + "depends": [ + "exportService", + "notificationService", + "resources[]" + ] } ], "constants": [ diff --git a/platform/features/timeline/src/actions/ExportTimelineAsCSVAction.js b/platform/features/timeline/src/actions/ExportTimelineAsCSVAction.js index 387c0839a0..e50b9369db 100644 --- a/platform/features/timeline/src/actions/ExportTimelineAsCSVAction.js +++ b/platform/features/timeline/src/actions/ExportTimelineAsCSVAction.js @@ -29,14 +29,21 @@ define(["./ExportTimelineAsCSVTask"], function (ExportTimelineAsCSVTask) { * * @param exportService the service used to perform the CSV export * @param notificationService the service used to show notifications + * @param {Array} resources an array of `resources` extensions * @param context the Action's context * @implements {Action} * @constructor * @memberof {platform/features/timeline} */ - function ExportTimelineAsCSVAction(exportService, notificationService, context) { + function ExportTimelineAsCSVAction( + exportService, + notificationService, + resources, + context + ) { this.task = new ExportTimelineAsCSVTask( exportService, + resources, context.domainObject ); this.notificationService = notificationService; @@ -67,4 +74,4 @@ define(["./ExportTimelineAsCSVTask"], function (ExportTimelineAsCSVTask) { }; return ExportTimelineAsCSVAction; -}); \ No newline at end of file +}); diff --git a/platform/features/timeline/src/actions/ExportTimelineAsCSVTask.js b/platform/features/timeline/src/actions/ExportTimelineAsCSVTask.js index 253db5c8b9..5979347d3c 100644 --- a/platform/features/timeline/src/actions/ExportTimelineAsCSVTask.js +++ b/platform/features/timeline/src/actions/ExportTimelineAsCSVTask.js @@ -37,11 +37,13 @@ define([ * @constructor * @memberof {platform/features/timeline} * @param exportService the service used to export as CSV + * @param resources the `resources` extension category * @param {DomainObject} domainObject the timeline being exported */ - function ExportTimelineAsCSVTask(exportService, domainObject) { + function ExportTimelineAsCSVTask(exportService, resources, domainObject) { this.domainObject = domainObject; this.exportService = exportService; + this.resources = resources; } /** @@ -54,7 +56,7 @@ define([ var exportService = this.exportService; function doExport(objects) { - var exporter = new TimelineColumnizer(objects), + var exporter = new TimelineColumnizer(objects, this.resources), options = { headers: exporter.headers() }; return exporter.rows().then(function (rows) { return exportService.exportCSV(rows, options); diff --git a/platform/features/timeline/src/actions/TimelineColumnizer.js b/platform/features/timeline/src/actions/TimelineColumnizer.js index 02d3ad6b69..035496edc6 100644 --- a/platform/features/timeline/src/actions/TimelineColumnizer.js +++ b/platform/features/timeline/src/actions/TimelineColumnizer.js @@ -68,12 +68,11 @@ define([ * @constructor * @memberof {platform/features/timeline} */ - function TimelineColumnizer(domainObjects, resourceMap) { + function TimelineColumnizer(domainObjects, resources) { var maxComposition = 0, maxRelationships = 0, columnNames = {}, columns = [], - costKeys = [], foundTimespan = false, i; @@ -114,10 +113,6 @@ define([ foundTimespan = true; } - if (domainObject.hasCapability('cost')) { - addCostProperties(domainObject.getCapability('cost')); - } - if (metadataProperties) { metadataProperties.forEach(addMetadataProperty); } @@ -128,8 +123,8 @@ define([ columns.push(new TimespanColumn(false)); } - costKeys.forEach(function (key) { - columns.push(new UtilizationColumn(resourceMap[key])); + resources.forEach(function (resource) { + columns.push(new UtilizationColumn(resource)); }); for (i = 0; i < maxComposition; i += 1) {