mirror of
https://github.com/nasa/openmct.git
synced 2025-01-21 20:08:06 +00:00
deriving current output from current (blue) condition output and persisting
This commit is contained in:
parent
78b885c508
commit
06a5207c6d
@ -47,8 +47,9 @@
|
||||
<li>
|
||||
<label>Output</label>
|
||||
<span class="controls">
|
||||
<select class="">
|
||||
<select v-model="condition.output">
|
||||
<option value="false">false</option>
|
||||
<option value="true">true</option>
|
||||
</select>
|
||||
</span>
|
||||
</li>
|
||||
@ -82,6 +83,7 @@ export default {
|
||||
mounted() {
|
||||
},
|
||||
updated() {
|
||||
console.log('updated conditionEdit');
|
||||
this.updateCurrentCondition();
|
||||
this.persist()
|
||||
},
|
||||
|
@ -2,7 +2,7 @@
|
||||
<div class="c-object-view u-contents">
|
||||
<div class="c-cs-edit w-condition-set">
|
||||
<div class="c-sw-edit__ui holder">
|
||||
<CurrentOutput :current-output="currentOutput" />
|
||||
<CurrentOutput :condition-collection="domainObject.conditionCollection" />
|
||||
<TestData :is-editing="isEditing" />
|
||||
<ConditionCollection :is-editing="isEditing"
|
||||
:condition-collection="domainObject.conditionCollection"
|
||||
@ -29,33 +29,9 @@ export default {
|
||||
},
|
||||
data() {
|
||||
let conditionCollection = this.domainObject.configuration.conditionCollection;
|
||||
let currentConditionIndex = 0;
|
||||
|
||||
return {
|
||||
currentOutput: conditionCollection[currentConditionIndex].output,
|
||||
conditionCollection,
|
||||
currentConditionIndex
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.currentConditionIndex = this.getCurrentConditionIndex();
|
||||
},
|
||||
methods: {
|
||||
persist(index) {
|
||||
if (index) {
|
||||
this.openmct.objects.mutate(this.domainObject, `configuration.conditionCollection[${index}]`, this.conditionCollection[index]);
|
||||
} else {
|
||||
this.openmct.objects.mutate(this.domainObject, 'configuration.conditionCollection', this.conditionCollection);
|
||||
}
|
||||
},
|
||||
getCurrentConditionIndex() {
|
||||
let currentConditionIndex;
|
||||
this.conditionCollection.forEach((condition, index) => {
|
||||
if (condition.isCurrent) {
|
||||
currentConditionIndex = index;
|
||||
}
|
||||
});
|
||||
return currentConditionIndex;
|
||||
conditionCollection
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -12,7 +12,7 @@
|
||||
class="c-cs__ui_content"
|
||||
>
|
||||
<div>
|
||||
<span class="current-output">{{ currentOutput }}</span>
|
||||
<span class="current-output">{{ conditionCollection[currentConditionIndex].output }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@ -20,21 +20,33 @@
|
||||
|
||||
<script>
|
||||
export default {
|
||||
inject: ['openmct'],
|
||||
inject: ['openmct', 'domainObject'],
|
||||
props: {
|
||||
currentOutput: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
isEditing: Boolean
|
||||
},
|
||||
data() {
|
||||
let conditionCollection = this.domainObject.configuration.conditionCollection;
|
||||
let currentConditionIndex = 0;
|
||||
|
||||
return {
|
||||
expanded: true
|
||||
};
|
||||
expanded: true,
|
||||
conditionCollection,
|
||||
currentConditionIndex
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.currentConditionIndex = this.getCurrentConditionIndex();
|
||||
},
|
||||
methods: {
|
||||
|
||||
getCurrentConditionIndex() {
|
||||
let currentConditionIndex;
|
||||
this.conditionCollection.forEach((condition, index) => {
|
||||
if (condition.isCurrent) {
|
||||
currentConditionIndex = index;
|
||||
}
|
||||
});
|
||||
return currentConditionIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user