remove criterion working

This commit is contained in:
Joel McKinnon 2020-02-20 12:23:18 -08:00
parent fa6dd84945
commit 386fc75047
4 changed files with 34 additions and 37 deletions

View File

@ -90,15 +90,27 @@
<ul v-if="telemetry.length" <ul v-if="telemetry.length"
class="t-widget-condition-config" class="t-widget-condition-config"
> >
<Criterion v-for="(criterion, index) in domainObject.configuration.criteria" <li v-for="(criterion, index) in domainObject.configuration.criteria"
:key="index" :key="index"
:telemetry="telemetry" class="has-local-controls t-condition"
:criterion="criterion" >
:index="index" <Criterion :telemetry="telemetry"
:trigger="trigger" :criterion="criterion"
:is-default="domainObject.configuration.criteria.length === 1" :index="index"
@persist="persist" :trigger="trigger"
/> :is-default="domainObject.configuration.criteria.length === 1"
@persist="persist"
/>
<div class="temp">
<span class="is-enabled c-c__duplicate"
@click="cloneCriterion"
></span>
<span v-if="!(domainObject.configuration.criteria.length === 1)"
class="is-enabled c-c__trash"
@click="removeCriterion(index)"
></span>
</div>
</li>
</ul> </ul>
<div class="holder c-c-button-wrapper align-left"> <div class="holder c-c-button-wrapper align-left">
<span class="c-c-label-spacer"></span> <span class="c-c-label-spacer"></span>
@ -180,7 +192,8 @@ export default {
trigger: 'all', trigger: 'all',
selectedOutputKey: '', selectedOutputKey: '',
stringOutputField: false, stringOutputField: false,
outputOptions: ['false', 'true', 'string'] outputOptions: ['false', 'true', 'string'],
criterionIndex: 0
}; };
}, },
computed: { computed: {
@ -241,6 +254,14 @@ export default {
index: Number(ev.target.closest('.widget-condition').getAttribute('data-condition-index')) index: Number(ev.target.closest('.widget-condition').getAttribute('data-condition-index'))
}); });
}, },
removeCriterion(index) {
this.domainObject.configuration.criteria.splice(index, 1);
this.persist()
},
cloneCriterion(ev) {
// console.log('cloneCriterion')
},
setOutput() { setOutput() {
let conditionOutput = this.domainObject.configuration.output; let conditionOutput = this.domainObject.configuration.output;
if (conditionOutput) { if (conditionOutput) {

View File

@ -83,7 +83,6 @@
import Condition from '../../condition/components/Condition.vue'; import Condition from '../../condition/components/Condition.vue';
import uuid from 'uuid'; import uuid from 'uuid';
export default { export default {
inject: ['openmct', 'domainObject'], inject: ['openmct', 'domainObject'],
components: { components: {

View File

@ -1,5 +1,5 @@
<template> <template>
<li class="has-local-controls t-condition"> <div>
<label>{{ setRowLabel }}</label> <label>{{ setRowLabel }}</label>
<span class="t-configuration"> <span class="t-configuration">
<span class="controls"> <span class="controls">
@ -46,17 +46,7 @@
> >
</span> </span>
</span> </span>
<div class="temp"> </div>
<span class="is-enabled c-c__duplicate"
@click="cloneCriterion"
></span>
<span v-if="!isDefault"
class="is-enabled c-c__trash"
@click="removeCriterion"
></span>
</div>
</li>
</template> </template>
<script> <script>
@ -104,7 +94,6 @@ export default {
mounted() { mounted() {
this.updateMetadataOptions(); this.updateMetadataOptions();
this.updateOperationInputVisibility(); this.updateOperationInputVisibility();
console.log('this.isDefault', this.isDefault);
}, },
methods: { methods: {
updateMetadataOptions() { updateMetadataOptions() {
@ -127,18 +116,6 @@ export default {
updateMetadataSelection() { updateMetadataSelection() {
this.updateOperationInputVisibility(); this.updateOperationInputVisibility();
}, },
removeCriterion(ev) {
console.log('removeCriterion', this.index);
// this.$emit('removeCondition', this.conditionIdentifier);
},
cloneCriterion(ev) {
console.log('cloneCriterion')
// this.$emit('cloneCondition', {
// identifier: this.conditionIdentifier,
// index: Number(ev.target.closest('.widget-condition').getAttribute('data-condition-index'))
// });
},
persist() { persist() {
this.$emit('persist', this.criterion); this.$emit('persist', this.criterion);
} }

View File

@ -199,7 +199,7 @@
} }
.temp { .temp {
width: 24px; width: 28px;
.c-c__duplicate, .c-c__duplicate,
.c-c__trash { .c-c__trash {