mirror of
https://github.com/nasa/openmct.git
synced 2025-01-02 03:16:41 +00:00
Handles remove telemetry from condition set - this resets criterion properties (#2791)
Handles remove condition from a condition set that's being used in a conditional style. Fixes a small bug with stye rule manager request lad results
This commit is contained in:
parent
4172fdf1d5
commit
53440c31d5
@ -77,8 +77,10 @@ export default class ConditionSetTelemetryProvider {
|
|||||||
* can be called manually for views that only request but do not subscribe to data
|
* can be called manually for views that only request but do not subscribe to data
|
||||||
*/
|
*/
|
||||||
destroyConditionManager(id) {
|
destroyConditionManager(id) {
|
||||||
this.conditionManagerPool[id].off('conditionSetResultUpdated');
|
if (this.conditionManagerPool[id]) {
|
||||||
this.conditionManagerPool[id].destroy();
|
this.conditionManagerPool[id].off('conditionSetResultUpdated');
|
||||||
delete this.conditionManagerPool[id];
|
this.conditionManagerPool[id].destroy();
|
||||||
|
delete this.conditionManagerPool[id];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,11 @@ export default class StyleRuleManager extends EventEmitter {
|
|||||||
}
|
}
|
||||||
this.openmct.objects.get(this.conditionSetIdentifier).then((conditionSetDomainObject) => {
|
this.openmct.objects.get(this.conditionSetIdentifier).then((conditionSetDomainObject) => {
|
||||||
this.openmct.telemetry.request(conditionSetDomainObject)
|
this.openmct.telemetry.request(conditionSetDomainObject)
|
||||||
.then(output => this.handleConditionSetResultUpdated(output));
|
.then(output => {
|
||||||
|
if (output && output.length) {
|
||||||
|
this.handleConditionSetResultUpdated(output[0]);
|
||||||
|
}
|
||||||
|
});
|
||||||
this.stopProvidingTelemetry = this.openmct.telemetry.subscribe(conditionSetDomainObject, output => this.handleConditionSetResultUpdated(output));
|
this.stopProvidingTelemetry = this.openmct.telemetry.subscribe(conditionSetDomainObject, output => this.handleConditionSetResultUpdated(output));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -60,7 +64,7 @@ export default class StyleRuleManager extends EventEmitter {
|
|||||||
this.destroy();
|
this.destroy();
|
||||||
} else {
|
} else {
|
||||||
let isNewConditionSet = !this.conditionSetIdentifier ||
|
let isNewConditionSet = !this.conditionSetIdentifier ||
|
||||||
this.openmct.objects.areIdsEqual(this.conditionSetIdentifier, styleConfiguration.conditionSetIdentifier);
|
!this.openmct.objects.areIdsEqual(this.conditionSetIdentifier, styleConfiguration.conditionSetIdentifier);
|
||||||
this.initialize(styleConfiguration);
|
this.initialize(styleConfiguration);
|
||||||
//Only resubscribe if the conditionSet has changed.
|
//Only resubscribe if the conditionSet has changed.
|
||||||
if (isNewConditionSet) {
|
if (isNewConditionSet) {
|
||||||
|
@ -119,7 +119,7 @@
|
|||||||
</select>
|
</select>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<template v-if="telemetry.length">
|
<template v-if="telemetry.length || condition.configuration.criteria.length">
|
||||||
<div v-for="(criterion, index) in condition.configuration.criteria"
|
<div v-for="(criterion, index) in condition.configuration.criteria"
|
||||||
:key="index"
|
:key="index"
|
||||||
class="c-cdef__criteria"
|
class="c-cdef__criteria"
|
||||||
|
@ -118,6 +118,14 @@ export default {
|
|||||||
inputTypes: INPUT_TYPES
|
inputTypes: INPUT_TYPES
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
telemetry: {
|
||||||
|
handler(newTelemetry, oldTelemetry) {
|
||||||
|
this.checkTelemetry();
|
||||||
|
},
|
||||||
|
deep: true
|
||||||
|
}
|
||||||
|
},
|
||||||
computed: {
|
computed: {
|
||||||
setRowLabel: function () {
|
setRowLabel: function () {
|
||||||
let operator = this.trigger === 'all' ? 'and ': 'or ';
|
let operator = this.trigger === 'all' ? 'and ': 'or ';
|
||||||
@ -145,6 +153,17 @@ export default {
|
|||||||
this.updateMetadataOptions();
|
this.updateMetadataOptions();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
checkTelemetry() {
|
||||||
|
if(this.criterion.telemetry &&
|
||||||
|
!this.telemetry.find((telemetryObj) => this.openmct.objects.areIdsEqual(this.criterion.telemetry, telemetryObj.identifier))) {
|
||||||
|
//telemetry being used was removed. So reset this criterion.
|
||||||
|
this.criterion.telemetry = '';
|
||||||
|
this.criterion.metadata = '';
|
||||||
|
this.criterion.input = [];
|
||||||
|
this.criterion.operation = '';
|
||||||
|
this.persist();
|
||||||
|
}
|
||||||
|
},
|
||||||
getOperationFormat() {
|
getOperationFormat() {
|
||||||
this.enumerations = [];
|
this.enumerations = [];
|
||||||
this.telemetryMetadata.valueMetadatas.forEach((value, index) => {
|
this.telemetryMetadata.valueMetadatas.forEach((value, index) => {
|
||||||
|
@ -262,18 +262,22 @@ export default {
|
|||||||
if (!this.conditions) {
|
if (!this.conditions) {
|
||||||
this.conditions = {};
|
this.conditions = {};
|
||||||
}
|
}
|
||||||
|
let conditionalStyles = [];
|
||||||
this.conditionSetDomainObject.configuration.conditionCollection.forEach((conditionConfiguration, index) => {
|
this.conditionSetDomainObject.configuration.conditionCollection.forEach((conditionConfiguration, index) => {
|
||||||
this.conditions[conditionConfiguration.id] = conditionConfiguration;
|
this.conditions[conditionConfiguration.id] = conditionConfiguration;
|
||||||
let foundStyle = this.findStyleByConditionId(conditionConfiguration.id);
|
let foundStyle = this.findStyleByConditionId(conditionConfiguration.id);
|
||||||
if (foundStyle) {
|
if (foundStyle) {
|
||||||
foundStyle.style = Object.assign((this.canHide ? { isStyleInvisible: '' } : {}), this.initialStyles, foundStyle.style);
|
foundStyle.style = Object.assign((this.canHide ? { isStyleInvisible: '' } : {}), this.initialStyles, foundStyle.style);
|
||||||
|
conditionalStyles.push(foundStyle);
|
||||||
} else {
|
} else {
|
||||||
this.conditionalStyles.splice(index, 0, {
|
conditionalStyles.splice(index, 0, {
|
||||||
conditionId: conditionConfiguration.id,
|
conditionId: conditionConfiguration.id,
|
||||||
style: Object.assign((this.canHide ? { isStyleInvisible: '' } : {}), this.initialStyles)
|
style: Object.assign((this.canHide ? { isStyleInvisible: '' } : {}), this.initialStyles)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
//we're doing this so that we remove styles for any conditions that have been removed from the condition set
|
||||||
|
this.conditionalStyles = conditionalStyles;
|
||||||
this.conditionsLoaded = true;
|
this.conditionsLoaded = true;
|
||||||
this.persist(this.getDomainObjectConditionalStyle());
|
this.persist(this.getDomainObjectConditionalStyle());
|
||||||
},
|
},
|
||||||
|
@ -120,7 +120,10 @@ export default class TelemetryCriterion extends EventEmitter {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (!this.isValid()) {
|
if (!this.isValid()) {
|
||||||
return this.formatData({});
|
return {
|
||||||
|
id: this.id,
|
||||||
|
data: this.formatData({})
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.telemetryAPI.request(
|
return this.telemetryAPI.request(
|
||||||
|
Loading…
Reference in New Issue
Block a user