mirror of
https://github.com/nasa/openmct.git
synced 2024-12-30 01:48:51 +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 () {
|
||||
"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) {
|
||||
this.index = index;
|
||||
}
|
||||
|
@ -24,6 +24,16 @@
|
||||
define(["./ExportTimelineAsCSVTask"], function (ExportTimelineAsCSVTask) {
|
||||
'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) {
|
||||
this.task = new ExportTimelineAsCSVTask(
|
||||
exportService,
|
||||
|
@ -31,16 +31,25 @@ define([
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Runs (and coordinates) the preparation and export of CSV data
|
||||
* for the "Export Timeline as CSV" action.
|
||||
*
|
||||
* @constructor
|
||||
* @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) {
|
||||
this.domainObject = domainObject;
|
||||
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 () {
|
||||
var exportService = this.exportService;
|
||||
|
||||
|
@ -24,6 +24,11 @@
|
||||
define([], function () {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* A column showing domain object identifiers.
|
||||
* @constructor
|
||||
* @implements {platform/features/timeline.TimelineCSVColumn}
|
||||
*/
|
||||
function IdColumn() {
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,11 @@
|
||||
define([], function () {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* A column reflecting properties from domain object metadata.
|
||||
* @constructor
|
||||
* @implements {platform/features/timeline.TimelineCSVColumn}
|
||||
*/
|
||||
function MetadataColumn(propertyName) {
|
||||
this.propertyName = propertyName;
|
||||
}
|
||||
|
@ -24,6 +24,13 @@
|
||||
define([], function () {
|
||||
"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) {
|
||||
this.index = index;
|
||||
}
|
||||
|
@ -36,6 +36,38 @@ define([
|
||||
) {
|
||||
'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) {
|
||||
var maxComposition = 0,
|
||||
maxRelationships = 0,
|
||||
@ -90,6 +122,13 @@ define([
|
||||
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 () {
|
||||
var columns = this.columns;
|
||||
|
||||
@ -102,6 +141,11 @@ define([
|
||||
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 () {
|
||||
return this.columns.map(function (column) {
|
||||
return column.name();
|
||||
|
@ -24,10 +24,20 @@
|
||||
define([], function () {
|
||||
"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) {
|
||||
this.domainObject = domainObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of domain objects for CSV export.
|
||||
* @returns {Promise.<DomainObject[]>} a list of domain objects
|
||||
*/
|
||||
TimelineTraverser.prototype.buildObjectList = function () {
|
||||
var idSet = {},
|
||||
objects = [];
|
||||
|
@ -26,6 +26,13 @@ define(['../TimelineFormatter'], function (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) {
|
||||
this.isStart = isStart;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user