[Tables] Object names should appear in tables (#3466)

* [Tables] Object names should appear in tables #3312

* updated tests to include name header.

* fixed lint issue.

* Removed Name from data.

* renamed 'addColunmName'  to 'addNameColumn'.

Co-authored-by: Andrew Henry <akhenry@gmail.com>
This commit is contained in:
Nikhil
2020-10-30 15:10:31 -07:00
committed by GitHub
parent 5646a252f7
commit 04fb4e8a82
5 changed files with 76 additions and 5 deletions

View File

@ -25,6 +25,7 @@ define([
'lodash',
'./collections/BoundedTableRowCollection',
'./collections/FilteredTableRowCollection',
'./TelemetryTableNameColumn',
'./TelemetryTableRow',
'./TelemetryTableColumn',
'./TelemetryTableUnitColumn',
@ -34,6 +35,7 @@ define([
_,
BoundedTableRowCollection,
FilteredTableRowCollection,
TelemetryTableNameColumn,
TelemetryTableRow,
TelemetryTableColumn,
TelemetryTableUnitColumn,
@ -71,6 +73,24 @@ define([
openmct.time.on('timeSystem', this.refreshData);
}
/**
* @private
*/
addNameColumn(telemetryObject, metadataValues) {
let metadatum = metadataValues.find(m => m.key === 'name');
if (!metadatum) {
metadatum = {
format: 'string',
key: 'name',
name: 'Name'
};
}
const column = new TelemetryTableNameColumn(this.openmct, telemetryObject, metadatum);
this.configuration.addSingleColumnForObject(telemetryObject, column);
}
initialize() {
if (this.domainObject.type === 'table') {
this.filterObserver = this.openmct.objects.observe(this.domainObject, 'configuration.filters', this.updateFilters);
@ -212,7 +232,13 @@ define([
addColumnsForObject(telemetryObject) {
let metadataValues = this.openmct.telemetry.getMetadata(telemetryObject).values();
this.addNameColumn(telemetryObject, metadataValues);
metadataValues.forEach(metadatum => {
if (metadatum.key === 'name') {
return;
}
let column = this.createColumn(metadatum);
this.configuration.addSingleColumnForObject(telemetryObject, column);
// add units column if available