mirror of
https://github.com/nasa/openmct.git
synced 2025-05-11 13:03:03 +00:00
moving hasNumericTelemetry to an api method
This commit is contained in:
parent
e1969585f9
commit
128f4827df
@ -284,6 +284,27 @@ export default class TelemetryAPI {
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hasNumericTelemetry(domainObject) {
|
||||||
|
if (!Object.prototype.hasOwnProperty.call(domainObject, 'telemetry')) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
let metadata = this.openmct.telemetry.getMetadata(domainObject);
|
||||||
|
|
||||||
|
return metadata.values().length > 0 && this.#hasDomainAndNumericRange(metadata);
|
||||||
|
}
|
||||||
|
|
||||||
|
#hasDomainAndNumericRange(metadata) {
|
||||||
|
const rangeValues = metadata.valuesForHints(['range']);
|
||||||
|
const domains = metadata.valuesForHints(['domain']);
|
||||||
|
|
||||||
|
return (
|
||||||
|
domains.length > 0 &&
|
||||||
|
rangeValues.length > 0 &&
|
||||||
|
!rangeValues.every((value) => value.format === 'string')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates a numeric hash value for an options object. The hash is consistent
|
* Generates a numeric hash value for an options object. The hash is consistent
|
||||||
* for equivalent option objects regardless of property order.
|
* for equivalent option objects regardless of property order.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user