added controls for remove and duplicate criteria

This commit is contained in:
Joel McKinnon 2020-02-20 07:23:38 -08:00
parent 038489256c
commit 2a9ccdcffd
3 changed files with 36 additions and 0 deletions

View File

@ -117,6 +117,7 @@
:criterion="criterion" :criterion="criterion"
:index="index" :index="index"
:trigger="trigger" :trigger="trigger"
:is-default="domainObject.configuration.criteria.length === 1"
@persist="persist" @persist="persist"
/> />
</ul> </ul>

View File

@ -46,6 +46,15 @@
> >
</span> </span>
</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> </li>
</template> </template>
@ -72,6 +81,10 @@ export default {
trigger: { trigger: {
type: String, type: String,
required: true required: true
},
isDefault: {
type: Boolean,
default: false
} }
}, },
data() { data() {
@ -91,6 +104,7 @@ export default {
mounted() { mounted() {
this.updateMetadataOptions(); this.updateMetadataOptions();
this.updateOperationInputVisibility(); this.updateOperationInputVisibility();
console.log('this.isDefault', this.isDefault);
}, },
methods: { methods: {
updateMetadataOptions() { updateMetadataOptions() {
@ -113,6 +127,18 @@ 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

@ -197,3 +197,12 @@
border-radius: 2px; border-radius: 2px;
} }
} }
.temp {
width: 24px;
.c-c__duplicate,
.c-c__trash {
display: inline-block;
}
}