mirror of
https://github.com/nasa/openmct.git
synced 2025-01-22 04:18:05 +00:00
[Conditionals] default condition handling (#2827)
* Sisplay default condition output by... default
This commit is contained in:
parent
079201273e
commit
4220a8a68a
@ -86,7 +86,6 @@
|
||||
<select v-model="selectedOutputSelection"
|
||||
@change="setOutputValue"
|
||||
>
|
||||
<option value="">- Select Output -</option>
|
||||
<option v-for="option in outputOptions"
|
||||
:key="option"
|
||||
:value="option"
|
||||
|
@ -110,10 +110,14 @@ export default {
|
||||
conditions: [],
|
||||
telemetryObjs: [],
|
||||
moveIndex: Number,
|
||||
isDragging: false
|
||||
isDragging: false,
|
||||
defaultOutput: undefined
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
defaultOutput(newOutput, oldOutput) {
|
||||
this.$emit('updateDefaultOutput', newOutput);
|
||||
},
|
||||
testData: {
|
||||
handler() {
|
||||
this.updateTestData();
|
||||
@ -141,6 +145,7 @@ export default {
|
||||
this.observeForChanges();
|
||||
this.conditionManager = new ConditionManager(this.domainObject, this.openmct);
|
||||
this.conditionManager.on('conditionSetResultUpdated', this.handleConditionSetResultUpdated);
|
||||
this.updateDefaultCondition();
|
||||
},
|
||||
methods: {
|
||||
handleConditionSetResultUpdated(data) {
|
||||
@ -149,8 +154,14 @@ export default {
|
||||
observeForChanges() {
|
||||
this.stopObservingForChanges = this.openmct.objects.observe(this.domainObject, 'configuration.conditionCollection', (newConditionCollection) => {
|
||||
this.conditionCollection = newConditionCollection;
|
||||
this.updateDefaultCondition();
|
||||
});
|
||||
},
|
||||
updateDefaultCondition() {
|
||||
const defaultCondition = this.domainObject.configuration.conditionCollection
|
||||
.find(conditionConfiguration => conditionConfiguration.isDefault);
|
||||
this.defaultOutput = defaultCondition.configuration.output;
|
||||
},
|
||||
setMoveIndex(index) {
|
||||
this.moveIndex = index;
|
||||
this.isDragging = true;
|
||||
|
@ -30,7 +30,9 @@
|
||||
<template v-if="currentConditionOutput">
|
||||
{{ currentConditionOutput }}
|
||||
</template>
|
||||
<template v-else>No output selected</template>
|
||||
<template v-else>
|
||||
{{ defaultConditionOutput }}
|
||||
</template>
|
||||
</div>
|
||||
</section>
|
||||
<TestData :is-editing="isEditing"
|
||||
@ -42,6 +44,7 @@
|
||||
:is-editing="isEditing"
|
||||
:test-data="testData"
|
||||
@conditionSetResultUpdated="updateCurrentOutput"
|
||||
@updateDefaultOutput="updateDefaultOutput"
|
||||
@telemetryUpdated="updateTelemetry"
|
||||
/>
|
||||
</div>
|
||||
@ -63,6 +66,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
currentConditionOutput: '',
|
||||
defaultConditionOutput: '',
|
||||
telemetryObjs: [],
|
||||
testData: {}
|
||||
}
|
||||
@ -78,6 +82,9 @@ export default {
|
||||
updateCurrentOutput(currentConditionResult) {
|
||||
this.currentConditionOutput = currentConditionResult.output;
|
||||
},
|
||||
updateDefaultOutput(output) {
|
||||
this.currentConditionOutput = output;
|
||||
},
|
||||
updateTelemetry(telemetryObjs) {
|
||||
this.telemetryObjs = telemetryObjs;
|
||||
},
|
||||
|
@ -44,7 +44,7 @@ export default function ConditionPlugin() {
|
||||
id: uuid(),
|
||||
configuration: {
|
||||
name: 'Default',
|
||||
output: 'false',
|
||||
output: 'Default',
|
||||
trigger: 'all',
|
||||
criteria: []
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user