mirror of
https://github.com/nasa/openmct.git
synced 2024-12-20 21:53:08 +00:00
[Timeline] Add JSDoc
Add JSDoc to classes implemented Export Timeline as CSV
This commit is contained in:
parent
bd7cb98a4c
commit
9e4e3e9c43
@ -24,6 +24,14 @@
|
|||||||
define([], function () {
|
define([], function () {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A column containing references to other objects contained
|
||||||
|
* in a domain object's composition.
|
||||||
|
* @param {number} index the zero-based index of the composition
|
||||||
|
* element associated with this column
|
||||||
|
* @constructor
|
||||||
|
* @implements {platform/features/timeline.TimelineCSVColumn}
|
||||||
|
*/
|
||||||
function CompositionColumn(index) {
|
function CompositionColumn(index) {
|
||||||
this.index = index;
|
this.index = index;
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,16 @@
|
|||||||
define(["./ExportTimelineAsCSVTask"], function (ExportTimelineAsCSVTask) {
|
define(["./ExportTimelineAsCSVTask"], function (ExportTimelineAsCSVTask) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implements the "Export Timeline as CSV" action.
|
||||||
|
*
|
||||||
|
* @param exportService the service used to perform the CSV export
|
||||||
|
* @param notificationService the service used to show notifications
|
||||||
|
* @param context the Action's context
|
||||||
|
* @implements {Action}
|
||||||
|
* @constructor
|
||||||
|
* @memberof {platform/features/timeline}
|
||||||
|
*/
|
||||||
function ExportTimelineAsCSVAction(exportService, notificationService, context) {
|
function ExportTimelineAsCSVAction(exportService, notificationService, context) {
|
||||||
this.task = new ExportTimelineAsCSVTask(
|
this.task = new ExportTimelineAsCSVTask(
|
||||||
exportService,
|
exportService,
|
||||||
|
@ -31,16 +31,25 @@ define([
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Runs (and coordinates) the preparation and export of CSV data
|
||||||
|
* for the "Export Timeline as CSV" action.
|
||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @memberof {platform/features/timeline}
|
* @memberof {platform/features/timeline}
|
||||||
* @implements {Task}
|
* @param exportService the service used to export as CSV
|
||||||
|
* @param {DomainObject} domainObject the timeline being exported
|
||||||
*/
|
*/
|
||||||
function ExportTimelineAsCSVTask(exportService, domainObject) {
|
function ExportTimelineAsCSVTask(exportService, domainObject) {
|
||||||
this.domainObject = domainObject;
|
this.domainObject = domainObject;
|
||||||
this.exportService = exportService;
|
this.exportService = exportService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run this CSV export task.
|
||||||
|
*
|
||||||
|
* @returns {Promise} a promise that will be resolved when the
|
||||||
|
* export has finished (or rejected if there are problems.)
|
||||||
|
*/
|
||||||
ExportTimelineAsCSVTask.prototype.run = function () {
|
ExportTimelineAsCSVTask.prototype.run = function () {
|
||||||
var exportService = this.exportService;
|
var exportService = this.exportService;
|
||||||
|
|
||||||
|
@ -24,6 +24,11 @@
|
|||||||
define([], function () {
|
define([], function () {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A column showing domain object identifiers.
|
||||||
|
* @constructor
|
||||||
|
* @implements {platform/features/timeline.TimelineCSVColumn}
|
||||||
|
*/
|
||||||
function IdColumn() {
|
function IdColumn() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,6 +24,11 @@
|
|||||||
define([], function () {
|
define([], function () {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A column reflecting properties from domain object metadata.
|
||||||
|
* @constructor
|
||||||
|
* @implements {platform/features/timeline.TimelineCSVColumn}
|
||||||
|
*/
|
||||||
function MetadataColumn(propertyName) {
|
function MetadataColumn(propertyName) {
|
||||||
this.propertyName = propertyName;
|
this.propertyName = propertyName;
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,13 @@
|
|||||||
define([], function () {
|
define([], function () {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A column showing relationships to activity modes.
|
||||||
|
* @constructor
|
||||||
|
* @param {number} index the zero-based index of the composition
|
||||||
|
* element associated with this column
|
||||||
|
* @implements {platform/features/timeline.TimelineCSVColumn}
|
||||||
|
*/
|
||||||
function ModeColumn(index) {
|
function ModeColumn(index) {
|
||||||
this.index = index;
|
this.index = index;
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,38 @@ define([
|
|||||||
) {
|
) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A description of how to populate a given column within a
|
||||||
|
* prepared table of domain object data, for CSV export.
|
||||||
|
* @interface platform/features/timeline.TimelineCSVColumn
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the value that belongs in this column for a given
|
||||||
|
* domain object.
|
||||||
|
* @memberof {platform/features/timeline.TimelineCSVColumn#}
|
||||||
|
* @method value
|
||||||
|
* @param {DomainObject} domainObject the domain object
|
||||||
|
* represented by this row
|
||||||
|
* @returns {string|Promise<string>} the value for this cell
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the name of this column, as belongs in a header.
|
||||||
|
* @memberof {platform/features/timeline.TimelineCSVColumn#}
|
||||||
|
* @method name
|
||||||
|
* @returns {string} the name of this column
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles conversion of a list of domain objects to a table
|
||||||
|
* representation appropriate for CSV export.
|
||||||
|
*
|
||||||
|
* @param {DomainObject[]} domainObjects the objects to include
|
||||||
|
* in the exported data
|
||||||
|
* @constructor
|
||||||
|
* @memberof {platform/features/timeline}
|
||||||
|
*/
|
||||||
function TimelineCSVExporter(domainObjects) {
|
function TimelineCSVExporter(domainObjects) {
|
||||||
var maxComposition = 0,
|
var maxComposition = 0,
|
||||||
maxRelationships = 0,
|
maxRelationships = 0,
|
||||||
@ -90,6 +122,13 @@ define([
|
|||||||
this.columns = columns;
|
this.columns = columns;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a tabular representation of domain object data.
|
||||||
|
* Each row corresponds to a single object; each element
|
||||||
|
* in each row corresponds to a property designated by
|
||||||
|
* the `headers`, correlated by index.
|
||||||
|
* @returns {Promise.<string[][]>} domain object data
|
||||||
|
*/
|
||||||
TimelineCSVExporter.prototype.rows = function () {
|
TimelineCSVExporter.prototype.rows = function () {
|
||||||
var columns = this.columns;
|
var columns = this.columns;
|
||||||
|
|
||||||
@ -102,6 +141,11 @@ define([
|
|||||||
return Promise.all(this.domainObjects.map(toRow));
|
return Promise.all(this.domainObjects.map(toRow));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the column headers associated with this tabular
|
||||||
|
* representation of objects.
|
||||||
|
* @returns {string[]} column headers
|
||||||
|
*/
|
||||||
TimelineCSVExporter.prototype.headers = function () {
|
TimelineCSVExporter.prototype.headers = function () {
|
||||||
return this.columns.map(function (column) {
|
return this.columns.map(function (column) {
|
||||||
return column.name();
|
return column.name();
|
||||||
|
@ -24,10 +24,20 @@
|
|||||||
define([], function () {
|
define([], function () {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds a list of domain objects which should be included
|
||||||
|
* in the CSV export of a given timeline.
|
||||||
|
* @param {DomainObject} domainObject the object being exported
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
function TimelineTraverser(domainObject) {
|
function TimelineTraverser(domainObject) {
|
||||||
this.domainObject = domainObject;
|
this.domainObject = domainObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list of domain objects for CSV export.
|
||||||
|
* @returns {Promise.<DomainObject[]>} a list of domain objects
|
||||||
|
*/
|
||||||
TimelineTraverser.prototype.buildObjectList = function () {
|
TimelineTraverser.prototype.buildObjectList = function () {
|
||||||
var idSet = {},
|
var idSet = {},
|
||||||
objects = [];
|
objects = [];
|
||||||
|
@ -26,6 +26,13 @@ define(['../TimelineFormatter'], function (TimelineFormatter) {
|
|||||||
|
|
||||||
var FORMATTER = new TimelineFormatter();
|
var FORMATTER = new TimelineFormatter();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A column showing start or end times associated with a domain object.
|
||||||
|
* @constructor
|
||||||
|
* @param {boolean} isStart true if this column refers to the object's
|
||||||
|
* start time; false if it refers to the object's end time
|
||||||
|
* @implements {platform/features/timeline.TimelineCSVColumn}
|
||||||
|
*/
|
||||||
function TimespanColumn(isStart) {
|
function TimespanColumn(isStart) {
|
||||||
this.isStart = isStart;
|
this.isStart = isStart;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user