Fix errors after converting conditionCollection to persist identifiers only

This commit is contained in:
Joshi 2020-01-17 11:26:46 -08:00
parent e806e5a293
commit 7feb933519
4 changed files with 30 additions and 28 deletions

View File

@ -1,5 +1,6 @@
<template>
<div id="conditionArea"
v-if="condition"
class="c-cs-ui__conditions"
:class="['widget-condition', { 'widget-condition--current': condition.isCurrent }]"
>

View File

@ -1,5 +1,6 @@
<template>
<div class="c-cs-editui__conditions"
v-if="condition"
:class="['widget-condition', { 'widget-condition--current': condition.isCurrent }]"
>
<div class="title-bar">
@ -143,8 +144,6 @@ export default {
return {
condition: this.condition,
expanded: true,
name: this.condition.name,
description: this.condition.description,
conditionCollection,
telemetryObject: this.telemetryObject,
telemetryMetadata: this.telemetryMetadata,
@ -156,7 +155,6 @@ export default {
};
},
mounted() {
this.condition = {};
this.openmct.objects.get(this.conditionIdentifier).then((obj => {
console.log('ConditionEdit obj', obj);
this.condition = obj;

View File

@ -1,11 +1,13 @@
<template>
<div class="c-object-view u-contents">
<div class="c-cs-edit w-condition-set">
<div class="c-sw-edit__ui holder">
<div v-if="currentCondition"
class="c-sw-edit__ui holder"
>
<CurrentOutput :condition-collection="domainObject.conditionCollection" />
<TestData :is-editing="isEditing" />
<ConditionCollection :is-editing="isEditing"
:condition-collection="domainObject.conditionCollection"
:conditionn="currentCondition"
/>
</div>
</div>
@ -28,10 +30,18 @@ export default {
isEditing: Boolean
},
data() {
let conditionCollection = this.domainObject.configuration.conditionCollection;
return {
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;
});
}
}
};

View File

@ -1,6 +1,8 @@
<template>
<section id="current-output">
<div class="c-cs__ui__header">
<div v-if="currentCondition"
class="c-cs__ui__header"
>
<span class="c-cs__ui__header-label">Current Output</span>
<span
class="is-enabled flex-elem"
@ -8,11 +10,11 @@
@click="expanded = !expanded"
></span>
</div>
<div v-if="expanded"
<div v-if="expanded && currentCondition"
class="c-cs__ui_content"
>
<div>
<span class="current-output">{{ conditionCollection[currentConditionIndex].output }}</span>
<span class="current-output">{{ currentCondition.output }}</span>
</div>
</div>
</section>
@ -22,31 +24,22 @@
export default {
inject: ['openmct', 'domainObject'],
props: {
isEditing: Boolean
isEditing: Boolean,
currentCondition: {
default: () => {return null;},
type: Object
}
},
data() {
let conditionCollection = this.domainObject.configuration.conditionCollection;
let currentConditionIndex = 0;
return {
expanded: true,
conditionCollection,
currentConditionIndex
expanded: true
}
},
mounted() {
this.currentConditionIndex = this.getCurrentConditionIndex();
},
methods: {
getCurrentConditionIndex() {
let currentConditionIndex;
this.conditionCollection.forEach((condition, index) => {
if (condition.isCurrent) {
currentConditionIndex = index;
}
});
return currentConditionIndex;
}
}
}
</script>