trigger label and add divider

This commit is contained in:
Joel McKinnon 2020-02-12 15:58:17 -08:00
parent 6e5e8f0ce8
commit b6ce9c6ed7
3 changed files with 20 additions and 6 deletions

View File

@ -95,6 +95,7 @@
:criterion="criterion" :criterion="criterion"
:condition="domainObject" :condition="domainObject"
:index="index" :index="index"
:trigger="trigger"
@persist="persist" @persist="persist"
/> />
</ul> </ul>
@ -176,7 +177,7 @@ export default {
domainObject: this.domainObject, domainObject: this.domainObject,
currentCriteria: this.currentCriteria, currentCriteria: this.currentCriteria,
expanded: true, expanded: true,
trigger: 'any', trigger: 'all',
selectedOutputKey: '', selectedOutputKey: '',
stringOutputField: false, stringOutputField: false,
outputOptions: ['false', 'true', 'string'] outputOptions: ['false', 'true', 'string']

View File

@ -1,6 +1,6 @@
<template> <template>
<li class="has-local-controls t-condition"> <li class="has-local-controls t-condition">
<label>{{ index === 0 ? 'when' : 'and when' }}</label> <label>{{ setRowLabel }}</label>
<span class="t-configuration"> <span class="t-configuration">
<span class="controls"> <span class="controls">
<select v-model="selectedTelemetryObject" <select v-model="selectedTelemetryObject"
@ -74,6 +74,10 @@ export default {
condition: { condition: {
type: Object, type: Object,
required: true required: true
},
trigger: {
type: String,
required: true
} }
}, },
data() { data() {
@ -85,12 +89,23 @@ export default {
selectedOperationOption: '', selectedOperationOption: '',
operationValue: '', operationValue: '',
comparisonInputValue: '', comparisonInputValue: '',
isInputOperation: false isInputOperation: false,
rowLabel: ''
}
},
computed: {
setRowLabel: function () {
let operator = this.trigger === 'all' ? 'and ': 'or ';
return (this.index !== 0 ? operator : '') + 'when';
} }
}, },
mounted() { mounted() {
this.initialize(); this.initialize();
}, },
updated() {
this.persist();
},
methods: { methods: {
initialize() { initialize() {
this.selectedTelemetryObject = this.criterion.telemetry; this.selectedTelemetryObject = this.criterion.telemetry;
@ -107,7 +122,6 @@ export default {
this.telemetryMetadata = this.openmct.telemetry.getMetadata(telemetryObject).values(); this.telemetryMetadata = this.openmct.telemetry.getMetadata(telemetryObject).values();
}); });
} }
this.persist();
}, },
updateOperationInput() { updateOperationInput() {
if (this.selectedOperationOption && if (this.selectedOperationOption &&
@ -118,7 +132,6 @@ export default {
this.isInputOperation = false; this.isInputOperation = false;
this.comparisonInputValue = ''; this.comparisonInputValue = '';
} }
this.persist();
}, },
persist() { persist() {
this.criterion.telemetry = this.selectedTelemetryObject; this.criterion.telemetry = this.selectedTelemetryObject;

View File

@ -92,7 +92,7 @@
margin: 0 3px; margin: 0 3px;
} }
.widget-condition-content.expanded ul { .widget-condition-content.expanded ul li {
border-top: solid 1px #ccc; border-top: solid 1px #ccc;
padding: 2px; padding: 2px;
} }