From 1ff4d41b7c7abe2f13ac8d298706ade0489243d4 Mon Sep 17 00:00:00 2001 From: Joshi Date: Thu, 30 Jan 2020 11:06:25 -0800 Subject: [PATCH] Addresses review comments - Use camelCase for events (did not change properties as eslint complains) - Reduce repeated property access by assigning to a variable - Use descriptive variable name --- .../condition/components/Condition.vue | 2 +- .../components/ConditionCollection.vue | 24 +++++++++---------- .../condition/components/ConditionEdit.vue | 20 +++++++++------- .../condition/components/ConditionSet.vue | 2 +- 4 files changed, 25 insertions(+), 23 deletions(-) diff --git a/src/plugins/condition/components/Condition.vue b/src/plugins/condition/components/Condition.vue index f518c5f7e3..ec68d729e5 100644 --- a/src/plugins/condition/components/Condition.vue +++ b/src/plugins/condition/components/Condition.vue @@ -55,7 +55,7 @@ export default { }, methods: { handleConditionResult(args) { - this.$emit('condition-result-updated', { + this.$emit('conditionResultUpdated', { id: this.conditionIdentifier, result: args.data.result }) diff --git a/src/plugins/condition/components/ConditionCollection.vue b/src/plugins/condition/components/ConditionCollection.vue index 7b28e0c6c7..1044506d9b 100644 --- a/src/plugins/condition/components/ConditionCollection.vue +++ b/src/plugins/condition/components/ConditionCollection.vue @@ -37,15 +37,15 @@
@@ -112,7 +112,7 @@ export default { break; } } - this.$emit('current-condition-updated', currentConditionIdentifier); + this.$emit('currentConditionUpdated', currentConditionIdentifier); }, addTelemetry(telemetryDomainObject) { this.telemetryObjs.push(telemetryDomainObject); @@ -128,10 +128,10 @@ export default { } }, addCondition(event, isDefault) { - let conditionDO = this.getConditionDomainObject(!!isDefault); - //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.conditionCollection.unshift(conditionDO.identifier); + let conditionDomainObject = this.getConditionDomainObject(!!isDefault); + //persist the condition domain object 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(conditionDomainObject, 'created', new Date()); + this.conditionCollection.unshift(conditionDomainObject.identifier); this.persist(); }, updateCurrentCondition(identifier) { @@ -157,10 +157,10 @@ export default { }, summary: 'summary description' }; - let conditionDOKeyString = this.openmct.objects.makeKeyString(conditionObj.identifier); - let newDO = this.instantiate(conditionObj, conditionDOKeyString); + let conditionDomainObjectKeyString = this.openmct.objects.makeKeyString(conditionObj.identifier); + let newDomainObject = this.instantiate(conditionObj, conditionDomainObjectKeyString); - return newDO.useCapability('adapter'); + return newDomainObject.useCapability('adapter'); }, updateCondition(updatedCondition) { //TODO: this should only happen for reordering diff --git a/src/plugins/condition/components/ConditionEdit.vue b/src/plugins/condition/components/ConditionEdit.vue index a6b821999c..8f4b084c82 100644 --- a/src/plugins/condition/components/ConditionEdit.vue +++ b/src/plugins/condition/components/ConditionEdit.vue @@ -238,19 +238,20 @@ export default { } }, handleConditionResult(args) { - this.$emit('condition-result-updated', { + this.$emit('conditionResultUpdated', { id: this.conditionIdentifier, result: args.data.result }) }, removeCondition(ev) { - this.$emit('remove-condition', this.conditionIdentifier); + this.$emit('removeCondition', this.conditionIdentifier); }, setOutput() { - if (this.condition.definition.output !== 'false' && this.condition.definition.output !== 'true') { + let conditionOutput = this.condition.definition.output; + if (conditionOutput !== 'false' && conditionOutput !== 'true') { this.selectedOutputKey = this.outputOptions[2].key; } else { - if (this.condition.definition.output === 'true') { + if (conditionOutput === 'true') { this.selectedOutputKey = this.outputOptions[1].key; } else { this.selectedOutputKey = this.outputOptions[0].key; @@ -307,10 +308,11 @@ export default { }, updateConditionCriteria() { if (this.condition.definition.criteria.length) { - this.condition.definition.criteria[0].key = this.selectedTelemetryKey; - this.condition.definition.criteria[0].metaDataKey = this.selectedMetaDataKey; - this.condition.definition.criteria[0].operation = this.selectedOperationKey; - this.condition.definition.criteria[0].input = [this.operationValue]; + let criterion = this.condition.definition.criteria[0]; + criterion.key = this.selectedTelemetryKey; + criterion.metaDataKey = this.selectedMetaDataKey; + criterion.operation = this.selectedOperationKey; + criterion.input = [this.operationValue]; } }, persist() { @@ -338,7 +340,7 @@ export default { this.updateTelemetry(); }, updateCurrentCondition() { - this.$emit('update-current-condition', this.conditionIdentifier); + this.$emit('updateCurrentCondition', this.conditionIdentifier); } } } diff --git a/src/plugins/condition/components/ConditionSet.vue b/src/plugins/condition/components/ConditionSet.vue index a09bf2085c..ff72c552a5 100644 --- a/src/plugins/condition/components/ConditionSet.vue +++ b/src/plugins/condition/components/ConditionSet.vue @@ -5,7 +5,7 @@