mirror of
https://github.com/nasa/openmct.git
synced 2024-12-21 14:07:50 +00:00
renders current output section
This commit is contained in:
parent
dd136a5ff4
commit
621c1dc11e
@ -1,8 +1,8 @@
|
||||
<template>
|
||||
<div id="conditionArea"
|
||||
v-if="condition"
|
||||
<div v-if="condition"
|
||||
id="conditionArea"
|
||||
class="c-cs-ui__conditions"
|
||||
:class="['widget-condition', { 'widget-condition--current': condition.isCurrent }]"
|
||||
:class="['widget-condition', { 'widget-condition--current': isCurrent && (isCurrent.key === conditionIdentifier.key) }]"
|
||||
>
|
||||
<div class="title-bar">
|
||||
<span class="condition-name">
|
||||
@ -27,6 +27,10 @@ export default {
|
||||
conditionIdentifier: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
isCurrent: {
|
||||
type: Object,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
@ -38,7 +42,6 @@ export default {
|
||||
mounted() {
|
||||
this.condition = {};
|
||||
this.openmct.objects.get(this.conditionIdentifier).then((obj => {
|
||||
console.log('ConditionEdit obj', obj);
|
||||
this.condition = obj;
|
||||
}));
|
||||
},
|
||||
|
@ -28,20 +28,21 @@
|
||||
<span class="c-cs-button__label">Add Condition</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="condition-collection"
|
||||
>
|
||||
<div class="condition-collection">
|
||||
<div v-for="conditionIdentifier in conditionCollection"
|
||||
:key="conditionIdentifier.key"
|
||||
class="conditionArea"
|
||||
>
|
||||
<div v-if="isEditing">
|
||||
<ConditionEdit :conditionIdentifier="conditionIdentifier"
|
||||
@update-current-condition="updateCurrentCondition"
|
||||
<ConditionEdit :condition-identifier="conditionIdentifier"
|
||||
:is-current="currentConditionIdentifier"
|
||||
@update-current-condition="updateCurrentCondition"
|
||||
/>
|
||||
</div>
|
||||
<div v-else>
|
||||
<Condition :conditionIdentifier="conditionIdentifier" />
|
||||
<Condition :condition-identifier="conditionIdentifier"
|
||||
:is-current="currentConditionIdentifier"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -86,7 +87,7 @@ export default {
|
||||
if (!this.conditionCollection.length) {
|
||||
this.addCondition(null, true);
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
methods: {
|
||||
addTelemetry(telemetryDomainObject) {
|
||||
@ -104,21 +105,7 @@ export default {
|
||||
this.conditions.push(condition);
|
||||
},
|
||||
updateCurrentCondition(identifier) {
|
||||
console.log('updateCurrentCondition from ConditionCollection', identifier);
|
||||
this.currentConditionIdentifier = identifier;
|
||||
// this.openmct.objects.get(identifier).then((obj) => {
|
||||
// if (this.conditionCollection.length > 1) {
|
||||
// console.log(this.conditionCollection.length)
|
||||
// this.conditionCollection.forEach((condition, index) => {
|
||||
// index === 0 ? condition.isCurrent = true : condition.isCurrent = false
|
||||
// console.log('conditionEdit', condition)
|
||||
// });
|
||||
// } else {
|
||||
// this.conditionCollection[0].isCurrent = true;
|
||||
// }
|
||||
// });
|
||||
// this.conditionCollection = collection;
|
||||
// this.$set(this.conditionCollection, , post)
|
||||
},
|
||||
getConditionDomainObject(isDefault) {
|
||||
let conditionObj = {
|
||||
|
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="c-cs-editui__conditions"
|
||||
v-if="condition"
|
||||
<div v-if="condition"
|
||||
class="c-cs-editui__conditions"
|
||||
:class="['widget-condition', { 'widget-condition--current': isCurrent && (isCurrent.key === conditionIdentifier.key) }]"
|
||||
>
|
||||
<div class="title-bar">
|
||||
@ -49,7 +49,8 @@
|
||||
<label>Output</label>
|
||||
<span class="controls">
|
||||
<select ref="outputSelect"
|
||||
@change="getOutputBinary">
|
||||
@change="getOutputBinary"
|
||||
>
|
||||
<option value="false">False</option>
|
||||
<option value="true">True</option>
|
||||
<option value="string">String</option>
|
||||
@ -131,7 +132,6 @@
|
||||
|
||||
<script>
|
||||
import { OPERATIONS } from '../utils/operations';
|
||||
// import { EventBus } from '../utils/eventbus.js';
|
||||
|
||||
export default {
|
||||
inject: ['openmct', 'domainObject'],
|
||||
@ -160,7 +160,6 @@ export default {
|
||||
},
|
||||
mounted() {
|
||||
this.openmct.objects.get(this.conditionIdentifier).then((obj => {
|
||||
// console.log('ConditionEdit obj', obj);
|
||||
this.condition = obj;
|
||||
if (this.condition.output !== 'false' && this.condition.output !== 'true') {
|
||||
this.$refs.outputSelect.value = 'string';
|
||||
@ -171,7 +170,6 @@ export default {
|
||||
this.updateCurrentCondition();
|
||||
},
|
||||
updated() {
|
||||
console.log('updated');
|
||||
if (this.isCurrent && this.isCurrent.key === this.condition.key) {
|
||||
this.updateCurrentCondition();
|
||||
}
|
||||
@ -192,7 +190,6 @@ export default {
|
||||
this.telemetryObject = obj;
|
||||
this.telemetryMetadata = this.openmct.telemetry.getMetadata(this.telemetryObject).values();
|
||||
this.selectedMetaDataKey = this.telemetryMetadata[0].key;
|
||||
// console.log('ConditionEdit', this.telemetryObject, this.telemetryMetadata);
|
||||
});
|
||||
} else {
|
||||
this.telemetryObject = null;
|
||||
@ -205,29 +202,7 @@ export default {
|
||||
this.openmct.objects.mutate(this.domainObject, 'isCurrent', this.condition.isCurrent);
|
||||
},
|
||||
updateCurrentCondition() {
|
||||
// console.log('updateCurrentCondition called')
|
||||
//mutate / persist the condition domainObject
|
||||
//persist the condition DO so that we can do an openmct.objects.get on it and only persist the identifier in the conditionCollection of conditionSet
|
||||
// console.log('before mutate output',this.condition.output)
|
||||
// this.openmct.objects.mutate(this.condition, "output", this.condition.output);
|
||||
// console.log('after mutate output',this.condition.output)
|
||||
//
|
||||
// // TODO: replace based on telemetry
|
||||
// if (this.conditionCollection.length > 1) {
|
||||
// console.log(this.conditionCollection.length)
|
||||
// this.conditionCollection.forEach((condition, index) => {
|
||||
// index === 0 ? condition.isCurrent = true : condition.isCurrent = false
|
||||
// console.log('conditionEdit', condition)
|
||||
// });
|
||||
// } else {
|
||||
// this.conditionCollection[0].isCurrent = true;
|
||||
// }
|
||||
//console.log('this.conditionCollection', this.conditionCollection);
|
||||
// console.log('this.conditionIdentifier', this.conditionIdentifier);
|
||||
this.$emit('update-current-condition', this.conditionIdentifier);
|
||||
// this.openmct.objects.mutate(this.condition, "isCurrent", this.condition.isCurrent);
|
||||
// console.log('this.conditionCollection', this.conditionCollection);
|
||||
// console.log(this.conditionCollection);
|
||||
},
|
||||
getOutputBinary(ev) {
|
||||
if (ev.target.value !== 'string') {
|
||||
@ -242,7 +217,6 @@ export default {
|
||||
this.condition.output = ev.target.value;
|
||||
},
|
||||
getOperationKey(ev) {
|
||||
// console.log(ev.target.value)
|
||||
if (ev.target.value !== 'isUndefined' && ev.target.value !== 'isDefined') {
|
||||
this.comparisonValueField = true;
|
||||
} else {
|
||||
|
@ -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 :condition="currentCondition"/>
|
||||
<CurrentOutput :condition="currentCondition" />
|
||||
<TestData :is-editing="isEditing" />
|
||||
<ConditionCollection :is-editing="isEditing"
|
||||
@update-current-condition="updateCurrentcondition"
|
||||
@ -30,23 +30,26 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// conditionCollection: this.conditionCollection,
|
||||
conditionCollection: this.conditionCollection,
|
||||
currentCondition: this.currentCondition
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
let conditionCollection = this.domainObject.configuration.conditionCollection;
|
||||
this.currentConditionIdentifier = conditionCollection.length ? this.domainObject.configuration.conditionCollection[0] : null;
|
||||
if (this.currentConditionIdentifier) {
|
||||
this.openmct.objects.get(this.currentConditionIdentifier).then((obj) => {
|
||||
this.currentCondition = obj;
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
methods: {
|
||||
updateCurrentcondition(identifier) {
|
||||
this.currentConditionIdentifier = identifier;
|
||||
console.log('identifier', identifier)
|
||||
this.openmct.objects.get(this.currentConditionIdentifier).then((obj) => {
|
||||
this.currentCondition = obj;
|
||||
console.log(`this.currentCondition`, this.currentCondition);
|
||||
});
|
||||
// console.log('updateCurrentCondition from ConditionCollection', name);
|
||||
// this.conditionCollection = collection;
|
||||
// this.$set(this.conditionCollection, , post)
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -36,7 +36,6 @@ export default {
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
console.log('this.condition', this.condition);
|
||||
},
|
||||
methods: {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user