mirror of
https://github.com/nasa/openmct.git
synced 2025-06-03 16:10:54 +00:00
[Timeline] Use indexes instead of UUIDs
This commit is contained in:
parent
87fe407739
commit
463f7ccf65
@ -30,8 +30,9 @@ define([], function () {
|
|||||||
* @constructor
|
* @constructor
|
||||||
* @implements {platform/features/timeline.TimelineCSVColumn}
|
* @implements {platform/features/timeline.TimelineCSVColumn}
|
||||||
*/
|
*/
|
||||||
function CompositionColumn(index) {
|
function CompositionColumn(index, idMap) {
|
||||||
this.index = index;
|
this.index = index;
|
||||||
|
this.idMap = idMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
CompositionColumn.prototype.name = function () {
|
CompositionColumn.prototype.name = function () {
|
||||||
@ -41,7 +42,9 @@ define([], function () {
|
|||||||
CompositionColumn.prototype.value = function (domainObject) {
|
CompositionColumn.prototype.value = function (domainObject) {
|
||||||
var model = domainObject.getModel(),
|
var model = domainObject.getModel(),
|
||||||
composition = model.composition || [];
|
composition = model.composition || [];
|
||||||
return (composition[this.index]) || "";
|
|
||||||
|
return composition.length > this.index ?
|
||||||
|
this.idMap[composition[this.index]] : "";
|
||||||
};
|
};
|
||||||
|
|
||||||
return CompositionColumn;
|
return CompositionColumn;
|
||||||
|
@ -27,15 +27,16 @@ define([], function () {
|
|||||||
* @constructor
|
* @constructor
|
||||||
* @implements {platform/features/timeline.TimelineCSVColumn}
|
* @implements {platform/features/timeline.TimelineCSVColumn}
|
||||||
*/
|
*/
|
||||||
function IdColumn() {
|
function IdColumn(idMap) {
|
||||||
|
this.idMap = idMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
IdColumn.prototype.name = function () {
|
IdColumn.prototype.name = function () {
|
||||||
return "Identifier";
|
return "Index";
|
||||||
};
|
};
|
||||||
|
|
||||||
IdColumn.prototype.value = function (domainObject) {
|
IdColumn.prototype.value = function (domainObject) {
|
||||||
return domainObject.getId();
|
return this.idMap[domainObject.getId()];
|
||||||
};
|
};
|
||||||
|
|
||||||
return IdColumn;
|
return IdColumn;
|
||||||
|
@ -29,8 +29,9 @@ define([], function () {
|
|||||||
* element associated with this column
|
* element associated with this column
|
||||||
* @implements {platform/features/timeline.TimelineCSVColumn}
|
* @implements {platform/features/timeline.TimelineCSVColumn}
|
||||||
*/
|
*/
|
||||||
function ModeColumn(index) {
|
function ModeColumn(index, idMap) {
|
||||||
this.index = index;
|
this.index = index;
|
||||||
|
this.idMap = idMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
ModeColumn.prototype.name = function () {
|
ModeColumn.prototype.name = function () {
|
||||||
@ -39,8 +40,9 @@ define([], function () {
|
|||||||
|
|
||||||
ModeColumn.prototype.value = function (domainObject) {
|
ModeColumn.prototype.value = function (domainObject) {
|
||||||
var model = domainObject.getModel(),
|
var model = domainObject.getModel(),
|
||||||
composition = (model.relationships || {}).modes || [];
|
modes = (model.relationships || {}).modes || [];
|
||||||
return (composition[this.index]) || "";
|
return modes.length > this.index ?
|
||||||
|
this.idMap[modes[this.index]] : "";
|
||||||
};
|
};
|
||||||
|
|
||||||
return ModeColumn;
|
return ModeColumn;
|
||||||
|
@ -74,6 +74,7 @@ define([
|
|||||||
columnNames = {},
|
columnNames = {},
|
||||||
columns = [],
|
columns = [],
|
||||||
foundTimespan = false,
|
foundTimespan = false,
|
||||||
|
idMap,
|
||||||
i;
|
i;
|
||||||
|
|
||||||
function addMetadataProperty(property) {
|
function addMetadataProperty(property) {
|
||||||
@ -92,7 +93,12 @@ define([
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
columns.push(new IdColumn());
|
idMap = domainObjects.reduce(function (map, domainObject, index) {
|
||||||
|
map[domainObject.getId()] = index + 1;
|
||||||
|
return map;
|
||||||
|
}, {});
|
||||||
|
|
||||||
|
columns.push(new IdColumn(idMap));
|
||||||
|
|
||||||
domainObjects.forEach(function (domainObject) {
|
domainObjects.forEach(function (domainObject) {
|
||||||
var model = domainObject.getModel(),
|
var model = domainObject.getModel(),
|
||||||
@ -128,11 +134,11 @@ define([
|
|||||||
});
|
});
|
||||||
|
|
||||||
for (i = 0; i < maxComposition; i += 1) {
|
for (i = 0; i < maxComposition; i += 1) {
|
||||||
columns.push(new CompositionColumn(i));
|
columns.push(new CompositionColumn(i, idMap));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < maxRelationships; i += 1) {
|
for (i = 0; i < maxRelationships; i += 1) {
|
||||||
columns.push(new ModeColumn(i));
|
columns.push(new ModeColumn(i, idMap));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.domainObjects = domainObjects;
|
this.domainObjects = domainObjects;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user