From dd136a5ff443c3b5603fd28a94299bfd4e30c71a Mon Sep 17 00:00:00 2001 From: Joel McKinnon Date: Tue, 21 Jan 2020 13:37:36 -0800 Subject: [PATCH] WIP: set current condition --- .../components/ConditionCollection.vue | 34 ++++++++++-- .../condition/components/ConditionEdit.vue | 55 ++++++++++++------- .../condition/components/ConditionSet.vue | 19 +++++-- .../condition/components/CurrentOutput.vue | 2 +- src/plugins/condition/event | 0 src/plugins/condition/utils/eventbus.js | 2 + 6 files changed, 82 insertions(+), 30 deletions(-) create mode 100644 src/plugins/condition/event create mode 100644 src/plugins/condition/utils/eventbus.js diff --git a/src/plugins/condition/components/ConditionCollection.vue b/src/plugins/condition/components/ConditionCollection.vue index edc2198fe7..5e550e025d 100644 --- a/src/plugins/condition/components/ConditionCollection.vue +++ b/src/plugins/condition/components/ConditionCollection.vue @@ -28,13 +28,17 @@ Add Condition -
+
- +
@@ -65,7 +69,8 @@ export default { expanded: true, parentKeyString: this.openmct.objects.makeKeyString(this.domainObject.identifier), conditionCollection: [], - conditions: [] + conditions: [], + currentConditionIdentifier: this.currentConditionIdentifier || {} }; }, destroyed() { @@ -78,7 +83,10 @@ export default { this.composition.on('add', this.addTelemetry); this.composition.load(); this.conditionCollection = this.domainObject.configuration ? this.domainObject.configuration.conditionCollection : []; - if (!this.conditionCollection.length) {this.addCondition(null, true)} + if (!this.conditionCollection.length) { + this.addCondition(null, true); + } + }, methods: { addTelemetry(telemetryDomainObject) { @@ -89,11 +97,29 @@ export default { //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 this.openmct.objects.mutate(conditionDO, 'created', new Date()); + this.currentConditionIdentifier = conditionDO.identifier; this.conditionCollection.unshift(conditionDO.identifier); let condition = new ConditionClass(conditionDO, this.openmct); 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 = { isDefault: isDefault, diff --git a/src/plugins/condition/components/ConditionEdit.vue b/src/plugins/condition/components/ConditionEdit.vue index 85a796d63e..72c3b6f64b 100644 --- a/src/plugins/condition/components/ConditionEdit.vue +++ b/src/plugins/condition/components/ConditionEdit.vue @@ -1,7 +1,7 @@