mirror of
https://github.com/nasa/openmct.git
synced 2025-06-13 12:48:14 +00:00
[Timeline] Rename TimelineCSVExporter
...to TimelineColumnizer, clarifying its role/responsibilities in the context of the CSV export task; https://github.com/nasa/openmctweb/pull/728#discussion_r56031331
This commit is contained in:
@ -26,8 +26,8 @@
|
|||||||
*/
|
*/
|
||||||
define([
|
define([
|
||||||
"./TimelineTraverser",
|
"./TimelineTraverser",
|
||||||
"./TimelineCSVExporter"
|
"./TimelineColumnizer"
|
||||||
], function (TimelineTraverser, TimelineCSVExporter) {
|
], function (TimelineTraverser, TimelineColumnizer) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -54,7 +54,7 @@ define([
|
|||||||
var exportService = this.exportService;
|
var exportService = this.exportService;
|
||||||
|
|
||||||
function doExport(objects) {
|
function doExport(objects) {
|
||||||
var exporter = new TimelineCSVExporter(objects),
|
var exporter = new TimelineColumnizer(objects),
|
||||||
options = { headers: exporter.headers() };
|
options = { headers: exporter.headers() };
|
||||||
return exporter.rows().then(function (rows) {
|
return exporter.rows().then(function (rows) {
|
||||||
return exportService.exportCSV(rows, options);
|
return exportService.exportCSV(rows, options);
|
||||||
|
@ -68,7 +68,7 @@ define([
|
|||||||
* @constructor
|
* @constructor
|
||||||
* @memberof {platform/features/timeline}
|
* @memberof {platform/features/timeline}
|
||||||
*/
|
*/
|
||||||
function TimelineCSVExporter(domainObjects) {
|
function TimelineColumnizer(domainObjects) {
|
||||||
var maxComposition = 0,
|
var maxComposition = 0,
|
||||||
maxRelationships = 0,
|
maxRelationships = 0,
|
||||||
columnNames = {},
|
columnNames = {},
|
||||||
@ -134,7 +134,7 @@ define([
|
|||||||
* the `headers`, correlated by index.
|
* the `headers`, correlated by index.
|
||||||
* @returns {Promise.<string[][]>} domain object data
|
* @returns {Promise.<string[][]>} domain object data
|
||||||
*/
|
*/
|
||||||
TimelineCSVExporter.prototype.rows = function () {
|
TimelineColumnizer.prototype.rows = function () {
|
||||||
var columns = this.columns;
|
var columns = this.columns;
|
||||||
|
|
||||||
function toRow(domainObject) {
|
function toRow(domainObject) {
|
||||||
@ -151,11 +151,11 @@ define([
|
|||||||
* representation of objects.
|
* representation of objects.
|
||||||
* @returns {string[]} column headers
|
* @returns {string[]} column headers
|
||||||
*/
|
*/
|
||||||
TimelineCSVExporter.prototype.headers = function () {
|
TimelineColumnizer.prototype.headers = function () {
|
||||||
return this.columns.map(function (column) {
|
return this.columns.map(function (column) {
|
||||||
return column.name();
|
return column.name();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return TimelineCSVExporter;
|
return TimelineColumnizer;
|
||||||
});
|
});
|
@ -22,9 +22,9 @@
|
|||||||
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,window,afterEach*/
|
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,window,afterEach*/
|
||||||
|
|
||||||
define(
|
define(
|
||||||
['../../src/actions/TimelineCSVExporter'],
|
['../../src/actions/TimelineColumnizer'],
|
||||||
function (TimelineCSVExporter) {
|
function (TimelineColumnizer) {
|
||||||
describe("TimelineCSVExporter", function () {
|
describe("TimelineColumnizer", function () {
|
||||||
var mockDomainObjects,
|
var mockDomainObjects,
|
||||||
testMetadata,
|
testMetadata,
|
||||||
exporter;
|
exporter;
|
||||||
@ -76,7 +76,7 @@ define(
|
|||||||
return c === 'metadata' && testMetadata;
|
return c === 'metadata' && testMetadata;
|
||||||
});
|
});
|
||||||
|
|
||||||
exporter = new TimelineCSVExporter(mockDomainObjects);
|
exporter = new TimelineColumnizer(mockDomainObjects);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("rows", function () {
|
describe("rows", function () {
|
||||||
@ -126,4 +126,4 @@ define(
|
|||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
Reference in New Issue
Block a user