mirror of
https://github.com/nasa/openmct.git
synced 2025-06-19 15:43:48 +00:00
[Telemetry] include type telemetry metadata
Read telemetry metadata from type and include in telemetry. Allows telemetry service to work with SWG.
This commit is contained in:
@ -257,9 +257,12 @@ define([
|
|||||||
*/
|
*/
|
||||||
TelemetryAPI.prototype.getMetadata = function (domainObject) {
|
TelemetryAPI.prototype.getMetadata = function (domainObject) {
|
||||||
if (!this.metadataCache.has(domainObject)) {
|
if (!this.metadataCache.has(domainObject)) {
|
||||||
|
if (!this.typeService) {
|
||||||
|
this.typeService = this.MCT.$injector.get('typeService');
|
||||||
|
}
|
||||||
this.metadataCache.set(
|
this.metadataCache.set(
|
||||||
domainObject,
|
domainObject,
|
||||||
new TelemetryMetadataManager(domainObject)
|
new TelemetryMetadataManager(domainObject, this.typeService)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return this.metadataCache.get(domainObject);
|
return this.metadataCache.get(domainObject);
|
||||||
|
@ -84,12 +84,16 @@ define([
|
|||||||
* Wraps old format metadata to new format metadata.
|
* Wraps old format metadata to new format metadata.
|
||||||
* Provides methods for interrogating telemetry metadata.
|
* Provides methods for interrogating telemetry metadata.
|
||||||
*/
|
*/
|
||||||
function TelemetryMetadataManager(domainObject) {
|
function TelemetryMetadataManager(domainObject, typeService) {
|
||||||
this.metadata = domainObject.telemetry || {};
|
this.metadata = domainObject.telemetry || {};
|
||||||
|
|
||||||
if (this.metadata.values) {
|
if (this.metadata.values) {
|
||||||
this.valueMetadatas = this.metadata.values;
|
this.valueMetadatas = this.metadata.values;
|
||||||
} else {
|
} else {
|
||||||
|
var typeMetadata = typeService
|
||||||
|
.getType(domainObject.type).typeDef.telemetry;
|
||||||
|
|
||||||
|
_.extend(this.metadata, typeMetadata);
|
||||||
this.valueMetadatas = valueMetadatasFromOldFormat(this.metadata);
|
this.valueMetadatas = valueMetadatasFromOldFormat(this.metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user