mirror of
https://github.com/nasa/openmct.git
synced 2025-01-31 08:25:31 +00:00
Mct3528 (#3682)
* MCT-3528: Add Condition Manager changes its been smoke tested * Fix bounds getter and amend unit test * Change fdescribe back to describe * [Object API] add object provider search (#3610) * add search method to object api * use object api search * do not index objects that have a provided search capability * provide indexed search for objects without a search provider * Upgrades to eslint-plugin-vue 7.5.0 (#3685) * Preparing for sprint 1.6.2 (#3663) * [NonEditable Folder Plugin] Default Install, Browse Bar Update, StyleGuide Use (#3676) * default noneditable folder plugin, change styleguide folders to uneditable folder types, browse bar object name no longer input box if not createable * moved plugin to mct.js instead of index.html Co-authored-by: Deep Tailor <deep.j.tailor@nasa.gov> * Fixes [Flexible Layout] bug with composition (#3680) * fix delete and composition load * remove unused remove action * remove star listener and use computed property Co-authored-by: Deep Tailor <deep.j.tailor@nasa.com> * Notebook saved link (#2998) * https://github.com/nasa/openmct/issues/2859 * create and store link to default notebook in storage and pass it to notification. * [Notebook] Add link to notebook inside 'Saved to Notebook' notification #2860 * Added custom autoDismissTimeout for into notifications. * Backwards compatibility fix for old notebook model without link in metadata. * lint fixes * added JS Doc description for API changes + changed property names to appropriate function. * fixed bug due to merging. * fixed url update loop Co-authored-by: Andrew Henry <akhenry@gmail.com> Co-authored-by: David Tsay <3614296+davetsay@users.noreply.github.com> Co-authored-by: Shefali Joshi <simplyrender@gmail.com> Co-authored-by: Jamie V <jamie.j.vigliotta@nasa.gov> Co-authored-by: Deep Tailor <deep.j.tailor@nasa.gov> Co-authored-by: Deep Tailor <deep.j.tailor@nasa.com> Co-authored-by: Nikhil <nikhil.k.mandlik@nasa.gov> Co-authored-by: Andrew Henry <akhenry@gmail.com>
This commit is contained in:
parent
1499286bee
commit
4047c888be
@ -34,6 +34,9 @@ export default class ConditionManager extends EventEmitter {
|
||||
this.composition = this.openmct.composition.get(conditionSetDomainObject);
|
||||
this.composition.on('add', this.subscribeToTelemetry, this);
|
||||
this.composition.on('remove', this.unsubscribeFromTelemetry, this);
|
||||
|
||||
this.shouldEvaluateNewTelemetry = this.shouldEvaluateNewTelemetry.bind(this);
|
||||
|
||||
this.compositionLoad = this.composition.load();
|
||||
this.subscriptions = {};
|
||||
this.telemetryObjects = {};
|
||||
@ -337,6 +340,10 @@ export default class ConditionManager extends EventEmitter {
|
||||
return false;
|
||||
}
|
||||
|
||||
shouldEvaluateNewTelemetry(currentTimestamp) {
|
||||
return this.openmct.time.bounds().end >= currentTimestamp;
|
||||
}
|
||||
|
||||
telemetryReceived(endpoint, datum) {
|
||||
if (!this.isTelemetryUsed(endpoint)) {
|
||||
return;
|
||||
@ -345,10 +352,12 @@ export default class ConditionManager extends EventEmitter {
|
||||
const normalizedDatum = this.createNormalizedDatum(datum, endpoint);
|
||||
const timeSystemKey = this.openmct.time.timeSystem().key;
|
||||
let timestamp = {};
|
||||
timestamp[timeSystemKey] = normalizedDatum[timeSystemKey];
|
||||
|
||||
this.updateConditionResults(normalizedDatum);
|
||||
this.updateCurrentCondition(timestamp);
|
||||
const currentTimestamp = normalizedDatum[timeSystemKey];
|
||||
timestamp[timeSystemKey] = currentTimestamp;
|
||||
if (this.shouldEvaluateNewTelemetry(currentTimestamp)) {
|
||||
this.updateConditionResults(normalizedDatum);
|
||||
this.updateCurrentCondition(timestamp);
|
||||
}
|
||||
}
|
||||
|
||||
updateConditionResults(normalizedDatum) {
|
||||
|
@ -543,7 +543,6 @@ describe('the plugin', function () {
|
||||
});
|
||||
|
||||
it('should evaluate as stale when telemetry is not received in the allotted time', (done) => {
|
||||
|
||||
let conditionMgr = new ConditionManager(conditionSetDomainObject, openmct);
|
||||
conditionMgr.on('conditionSetResultUpdated', mockListener);
|
||||
conditionMgr.telemetryObjects = {
|
||||
@ -565,7 +564,7 @@ describe('the plugin', function () {
|
||||
});
|
||||
|
||||
it('should not evaluate as stale when telemetry is received in the allotted time', (done) => {
|
||||
const date = Date.now();
|
||||
const date = 1;
|
||||
conditionSetDomainObject.configuration.conditionCollection[0].configuration.criteria[0].input = ["0.4"];
|
||||
let conditionMgr = new ConditionManager(conditionSetDomainObject, openmct);
|
||||
conditionMgr.on('conditionSetResultUpdated', mockListener);
|
||||
|
Loading…
x
Reference in New Issue
Block a user