mirror of
https://github.com/nasa/openmct.git
synced 2025-02-01 16:58:04 +00:00
using current condition output for current output label
This commit is contained in:
parent
81b8a76f1b
commit
78b885c508
@ -47,6 +47,7 @@ export default class ConditionClass extends EventEmitter {
|
||||
this.name = conditionDefinition.name;
|
||||
this.description = conditionDefinition.description;
|
||||
this.isDefault = conditionDefinition.isDefault;
|
||||
this.isCurrent = conditionDefinition.isCurrent;
|
||||
if (conditionDefinition.criteria) {
|
||||
this.createCriteria(conditionDefinition.criteria, openmct);
|
||||
} else {
|
||||
@ -54,6 +55,7 @@ export default class ConditionClass extends EventEmitter {
|
||||
}
|
||||
this.trigger = conditionDefinition.trigger;
|
||||
this.result = null;
|
||||
this.output = conditionDefinition.output
|
||||
}
|
||||
|
||||
updateTrigger(conditionDefinition) {
|
||||
|
@ -48,7 +48,7 @@
|
||||
<script>
|
||||
import Condition from '../../condition/components/Condition.vue';
|
||||
import ConditionEdit from '../../condition/components/ConditionEdit.vue';
|
||||
import uuid from 'uuid';
|
||||
// import uuid from 'uuid';
|
||||
import ConditionClass from '../Condition';
|
||||
|
||||
export default {
|
||||
@ -80,6 +80,7 @@ export default {
|
||||
if (isDefault !== true) {isDefault = false}
|
||||
let conditionObj = {
|
||||
isDefault: isDefault,
|
||||
isCurrent: true,
|
||||
name: isDefault ? 'Default' : 'Unnamed Condition',
|
||||
trigger: 'any',
|
||||
criteria: isDefault ? [] : [{
|
||||
@ -88,7 +89,8 @@ export default {
|
||||
metaDataKey: 'sin',
|
||||
key: '2662a903-2c3c-4e46-b2fa-2b9e35a79c8c'
|
||||
}],
|
||||
output: 'Default test'
|
||||
output: 'false',
|
||||
summary: 'summary description'
|
||||
};
|
||||
|
||||
let conditionDO = new ConditionClass(conditionObj, this.openmct);
|
||||
|
@ -71,16 +71,18 @@ export default {
|
||||
}
|
||||
},
|
||||
data() {
|
||||
let conditionCollection = this.domainObject.configuration.conditionCollection;
|
||||
return {
|
||||
expanded: true,
|
||||
name: this.condition.name,
|
||||
description: this.condition.description
|
||||
description: this.condition.description,
|
||||
conditionCollection
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
updated() {
|
||||
console.log('updated');
|
||||
this.updateCurrentCondition();
|
||||
this.persist()
|
||||
},
|
||||
methods: {
|
||||
@ -97,6 +99,16 @@ export default {
|
||||
} else {
|
||||
this.openmct.objects.mutate(this.domainObject, 'configuration.conditionCollection', this.domainObject.configuration.conditionCollection);
|
||||
}
|
||||
},
|
||||
updateCurrentCondition() {
|
||||
// TODO: replace based on telemetry
|
||||
if (this.conditionCollection.length > 1) {
|
||||
this.conditionCollection.forEach((condition, index) => {
|
||||
index === 0 ? condition.isCurrent = true : condition.isCurrent = false
|
||||
});
|
||||
} else {
|
||||
this.conditionCollection[0].isCurrent = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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="mockCurrentOutput" />
|
||||
<CurrentOutput :current-output="currentOutput" />
|
||||
<TestData :is-editing="isEditing" />
|
||||
<ConditionCollection :is-editing="isEditing"
|
||||
:condition-collection="domainObject.conditionCollection"
|
||||
@ -28,10 +28,18 @@ export default {
|
||||
isEditing: Boolean
|
||||
},
|
||||
data() {
|
||||
let conditionCollection = this.domainObject.configuration.conditionCollection;
|
||||
let currentConditionIndex = 0;
|
||||
|
||||
return {
|
||||
mockCurrentOutput: 'Data_Present'
|
||||
currentOutput: conditionCollection[currentConditionIndex].output,
|
||||
conditionCollection,
|
||||
currentConditionIndex
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.currentConditionIndex = this.getCurrentConditionIndex();
|
||||
},
|
||||
methods: {
|
||||
persist(index) {
|
||||
if (index) {
|
||||
@ -40,9 +48,14 @@ export default {
|
||||
this.openmct.objects.mutate(this.domainObject, 'configuration.conditionCollection', this.conditionCollection);
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
addCondition() {
|
||||
getCurrentConditionIndex() {
|
||||
let currentConditionIndex;
|
||||
this.conditionCollection.forEach((condition, index) => {
|
||||
if (condition.isCurrent) {
|
||||
currentConditionIndex = index;
|
||||
}
|
||||
});
|
||||
return currentConditionIndex;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user