remove criterion working

This commit is contained in:
Joel McKinnon 2020-02-20 12:23:18 -08:00
parent 2a9ccdcffd
commit 7fc825949c
4 changed files with 34 additions and 37 deletions

View File

@ -111,15 +111,27 @@
<ul v-if="telemetry.length"
class="t-widget-condition-config"
>
<Criterion v-for="(criterion, index) in domainObject.configuration.criteria"
:key="index"
:telemetry="telemetry"
:criterion="criterion"
:index="index"
:trigger="trigger"
:is-default="domainObject.configuration.criteria.length === 1"
@persist="persist"
/>
<li v-for="(criterion, index) in domainObject.configuration.criteria"
:key="index"
class="has-local-controls t-condition"
>
<Criterion :telemetry="telemetry"
:criterion="criterion"
:index="index"
: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>
<div class="holder c-c-button-wrapper align-left">
<span class="c-c-label-spacer"></span>
@ -201,7 +213,8 @@ export default {
trigger: 'all',
selectedOutputKey: '',
stringOutputField: false,
outputOptions: ['false', 'true', 'string']
outputOptions: ['false', 'true', 'string'],
criterionIndex: 0
};
},
computed: {
@ -264,6 +277,14 @@ export default {
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() {
let conditionOutput = this.domainObject.configuration.output;
if (conditionOutput) {

View File

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

View File

@ -1,5 +1,5 @@
<template>
<li class="has-local-controls t-condition">
<div>
<label>{{ setRowLabel }}</label>
<span class="t-configuration">
<span class="controls">
@ -46,17 +46,7 @@
>
</span>
</span>
<div class="temp">
<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>
</div>
</template>
<script>
@ -104,7 +94,6 @@ export default {
mounted() {
this.updateMetadataOptions();
this.updateOperationInputVisibility();
console.log('this.isDefault', this.isDefault);
},
methods: {
updateMetadataOptions() {
@ -127,18 +116,6 @@ export default {
updateMetadataSelection() {
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() {
this.$emit('persist', this.criterion);
}

View File

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