Merge pull request #2802 from nasa/clone-condition-issues

Clone condition, criteria issues
This commit is contained in:
David Tsay 2020-03-30 09:40:00 -07:00 committed by GitHub
commit d00e8b68a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 13 deletions

View File

@ -138,11 +138,11 @@ export default class ConditionManager extends EventEmitter {
} }
cloneCondition(conditionConfiguration, index) { cloneCondition(conditionConfiguration, index) {
this.createAndSaveCondition(index, conditionConfiguration); this.createAndSaveCondition(index, JSON.parse(JSON.stringify(conditionConfiguration)));
} }
createAndSaveCondition(index, conditionConfiguration) { createAndSaveCondition(index, conditionConfiguration) {
let newCondition = this.createCondition(conditionConfiguration); const newCondition = this.createCondition(conditionConfiguration);
if (index !== undefined) { if (index !== undefined) {
this.conditionSetDomainObject.configuration.conditionCollection.splice(index + 1, 0, newCondition); this.conditionSetDomainObject.configuration.conditionCollection.splice(index + 1, 0, newCondition);
} else { } else {

View File

@ -291,12 +291,12 @@ export default {
}, },
removeCriterion(index) { removeCriterion(index) {
this.condition.configuration.criteria.splice(index, 1); this.condition.configuration.criteria.splice(index, 1);
this.persist() this.persist();
}, },
cloneCriterion(index) { cloneCriterion(index) {
const clonedCriterion = {...this.condition.configuration.criteria[index]}; const clonedCriterion = JSON.parse(JSON.stringify(this.condition.configuration.criteria[index]));
this.condition.configuration.criteria.splice(index + 1, 0, clonedCriterion); this.condition.configuration.criteria.splice(index + 1, 0, clonedCriterion);
this.persist() this.persist();
}, },
persist() { persist() {
this.$emit('updateCondition', { this.$emit('updateCondition', {

View File

@ -117,14 +117,6 @@ export default {
inputTypes: INPUT_TYPES inputTypes: INPUT_TYPES
} }
}, },
watch: {
telemetry: {
handler(newTelemetry, oldTelemetry) {
this.checkTelemetry();
},
deep: true
}
},
computed: { computed: {
setRowLabel: function () { setRowLabel: function () {
let operator = this.trigger === 'all' ? 'and ': 'or '; let operator = this.trigger === 'all' ? 'and ': 'or ';
@ -148,6 +140,14 @@ export default {
return type; return type;
} }
}, },
watch: {
telemetry: {
handler(newTelemetry, oldTelemetry) {
this.checkTelemetry();
},
deep: true
}
},
mounted() { mounted() {
this.updateMetadataOptions(); this.updateMetadataOptions();
}, },