mirror of
https://github.com/nasa/openmct.git
synced 2025-04-07 19:34:25 +00:00
Update condition sets in fixed timespan mode if the datum's timestamp is valid (#3852)
This commit is contained in:
parent
3ca133c782
commit
dacec48aec
@ -272,11 +272,11 @@ export default class Condition extends EventEmitter {
|
||||
}
|
||||
}
|
||||
|
||||
requestLADConditionResult() {
|
||||
requestLADConditionResult(options) {
|
||||
let latestTimestamp;
|
||||
let criteriaResults = {};
|
||||
const criteriaRequests = this.criteria
|
||||
.map(criterion => criterion.requestLAD(this.conditionManager.telemetryObjects));
|
||||
.map(criterion => criterion.requestLAD(this.conditionManager.telemetryObjects, options));
|
||||
|
||||
return Promise.all(criteriaRequests)
|
||||
.then(results => {
|
||||
|
@ -282,7 +282,7 @@ export default class ConditionManager extends EventEmitter {
|
||||
return currentCondition;
|
||||
}
|
||||
|
||||
requestLADConditionSetOutput() {
|
||||
requestLADConditionSetOutput(options) {
|
||||
if (!this.conditions.length) {
|
||||
return Promise.resolve([]);
|
||||
}
|
||||
@ -291,7 +291,7 @@ export default class ConditionManager extends EventEmitter {
|
||||
let latestTimestamp;
|
||||
let conditionResults = {};
|
||||
const conditionRequests = this.conditions
|
||||
.map(condition => condition.requestLADConditionResult());
|
||||
.map(condition => condition.requestLADConditionResult(options));
|
||||
|
||||
return Promise.all(conditionRequests)
|
||||
.then((results) => {
|
||||
|
@ -40,10 +40,10 @@ export default class ConditionSetTelemetryProvider {
|
||||
return domainObject.type === 'conditionSet';
|
||||
}
|
||||
|
||||
request(domainObject) {
|
||||
request(domainObject, options) {
|
||||
let conditionManager = this.getConditionManager(domainObject);
|
||||
|
||||
return conditionManager.requestLADConditionSetOutput()
|
||||
return conditionManager.requestLADConditionSetOutput(options)
|
||||
.then(latestOutput => {
|
||||
return latestOutput;
|
||||
});
|
||||
@ -52,7 +52,9 @@ export default class ConditionSetTelemetryProvider {
|
||||
subscribe(domainObject, callback) {
|
||||
let conditionManager = this.getConditionManager(domainObject);
|
||||
|
||||
conditionManager.on('conditionSetResultUpdated', callback);
|
||||
conditionManager.on('conditionSetResultUpdated', (data) => {
|
||||
callback(data);
|
||||
});
|
||||
|
||||
return this.destroyConditionManager.bind(this, this.openmct.objects.makeKeyString(domainObject.identifier));
|
||||
}
|
||||
|
@ -35,6 +35,7 @@ export default class StyleRuleManager extends EventEmitter {
|
||||
if (styleConfiguration) {
|
||||
this.initialize(styleConfiguration);
|
||||
if (styleConfiguration.conditionSetIdentifier) {
|
||||
this.openmct.time.on("bounds", this.refreshData.bind(this));
|
||||
this.subscribeToConditionSet();
|
||||
} else {
|
||||
this.applyStaticStyle();
|
||||
@ -83,6 +84,25 @@ export default class StyleRuleManager extends EventEmitter {
|
||||
});
|
||||
}
|
||||
|
||||
refreshData(bounds, isTick) {
|
||||
if (!isTick) {
|
||||
let options = {
|
||||
start: bounds.start,
|
||||
end: bounds.end,
|
||||
size: 1,
|
||||
strategy: 'latest'
|
||||
};
|
||||
this.openmct.objects.get(this.conditionSetIdentifier).then((conditionSetDomainObject) => {
|
||||
this.openmct.telemetry.request(conditionSetDomainObject, options)
|
||||
.then(output => {
|
||||
if (output && output.length) {
|
||||
this.handleConditionSetResultUpdated(output[0]);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
updateObjectStyleConfig(styleConfiguration) {
|
||||
if (!styleConfiguration || !styleConfiguration.conditionSetIdentifier) {
|
||||
this.initialize(styleConfiguration || {});
|
||||
@ -160,10 +180,14 @@ export default class StyleRuleManager extends EventEmitter {
|
||||
|
||||
destroy() {
|
||||
if (this.stopProvidingTelemetry) {
|
||||
|
||||
this.stopProvidingTelemetry();
|
||||
delete this.stopProvidingTelemetry;
|
||||
}
|
||||
|
||||
this.openmct.time.off("bounds", this.refreshData);
|
||||
this.openmct.editor.off('isEditing', this.toggleSubscription);
|
||||
|
||||
this.conditionSetIdentifier = undefined;
|
||||
}
|
||||
|
||||
|
@ -147,12 +147,16 @@ export default class AllTelemetryCriterion extends TelemetryCriterion {
|
||||
this.result = evaluateResults(Object.values(this.telemetryDataCache), this.telemetry);
|
||||
}
|
||||
|
||||
requestLAD(telemetryObjects) {
|
||||
const options = {
|
||||
requestLAD(telemetryObjects, requestOptions) {
|
||||
let options = {
|
||||
strategy: 'latest',
|
||||
size: 1
|
||||
};
|
||||
|
||||
if (requestOptions !== undefined) {
|
||||
options = Object.assign(options, requestOptions);
|
||||
}
|
||||
|
||||
if (!this.isValid()) {
|
||||
return this.formatData({}, telemetryObjects);
|
||||
}
|
||||
|
@ -137,12 +137,16 @@ export default class TelemetryCriterion extends EventEmitter {
|
||||
}
|
||||
}
|
||||
|
||||
requestLAD() {
|
||||
const options = {
|
||||
requestLAD(telemetryObjects, requestOptions) {
|
||||
let options = {
|
||||
strategy: 'latest',
|
||||
size: 1
|
||||
};
|
||||
|
||||
if (requestOptions !== undefined) {
|
||||
options = Object.assign(options, requestOptions);
|
||||
}
|
||||
|
||||
if (!this.isValid()) {
|
||||
return {
|
||||
id: this.id,
|
||||
|
@ -269,7 +269,12 @@ export default {
|
||||
},
|
||||
subscribeToObject() {
|
||||
this.subscription = this.openmct.telemetry.subscribe(this.domainObject, function (datum) {
|
||||
if (this.openmct.time.clock() !== undefined) {
|
||||
const key = this.openmct.time.timeSystem().key;
|
||||
const datumTimeStamp = datum[key];
|
||||
if (this.openmct.time.clock() !== undefined
|
||||
|| (datumTimeStamp
|
||||
&& (this.openmct.time.bounds().end >= datumTimeStamp))
|
||||
) {
|
||||
this.updateView(datum);
|
||||
}
|
||||
}.bind(this));
|
||||
|
Loading…
x
Reference in New Issue
Block a user