Merge branch 'topic-conditionals' of https://github.com/nasa/openmct into condition-trigger

This commit is contained in:
Joshi 2020-02-28 10:49:56 -08:00
commit e526626e09
4 changed files with 44 additions and 13 deletions

View File

@ -114,14 +114,27 @@
<ul v-if="telemetry.length"
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"
:telemetry="telemetry"
class="has-local-controls t-condition"
>
<Criterion :telemetry="telemetry"
:criterion="criterion"
:index="index"
:trigger="domainObject.configuration.trigger"
:is-default="domainObject.configuration.criteria.length === 1"
@persist="persist"
/>
<div class="c-c__criterion-controls">
<span class="is-enabled c-c__duplicate"
@click="cloneCriterion(index)"
></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>
@ -202,7 +215,8 @@ export default {
expanded: true,
selectedOutputKey: '',
stringOutputField: false,
outputOptions: ['false', 'true', 'string']
outputOptions: ['false', 'true', 'string'],
criterionIndex: 0
};
},
computed: {
@ -265,6 +279,16 @@ 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(index) {
const clonedCriterion = {...this.domainObject.configuration.criteria[index]};
this.domainObject.configuration.criteria.splice(index + 1, 0, clonedCriterion);
this.persist()
},
setOutput() {
let conditionOutput = this.domainObject.configuration.output;
if (conditionOutput) {

View File

@ -87,7 +87,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,8 +46,7 @@
>
</span>
</span>
</li>
</div>
</template>
<script>

View File

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