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