mirror of
https://github.com/nasa/openmct.git
synced 2025-05-13 14:03:21 +00:00
added input types and fixed bug for isDefined, isUndefined comparisons
This commit is contained in:
parent
63feaef988
commit
b75b7a958a
@ -44,7 +44,7 @@
|
||||
<span class="c-condition__name">{{ domainObject.configuration.name }}</span>
|
||||
<!-- TODO: description should be derived from criteria -->
|
||||
<span class="c-condition__summary">
|
||||
{{ getDescription }}
|
||||
{{ getSummary }}
|
||||
</span>
|
||||
|
||||
<div class="c-condition__buttons">
|
||||
@ -162,7 +162,7 @@
|
||||
</span>
|
||||
</div>
|
||||
<div class="c-condition__summary">
|
||||
{{ getDescription }}
|
||||
{{ getSummary }}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@ -213,27 +213,32 @@ export default {
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
getDescription: function () {
|
||||
getSummary: function () {
|
||||
let config = this.domainObject.configuration;
|
||||
|
||||
if (!config.criteria.length) {
|
||||
return 'When all else fails';
|
||||
} else {
|
||||
let rule = '';
|
||||
let summary = '';
|
||||
let summary = 'No criteria specified';
|
||||
if (config.criteria.length === 1 && config.criteria[0].telemetry) {
|
||||
if (config.criteria[0].operation && config.criteria[0].input.length) {
|
||||
rule += `${config.criteria[0].telemetry.name} value ${this.findDescription(config.criteria[0].operation, config.criteria[0].input)}`
|
||||
summary = `When ${rule}`;
|
||||
} else {
|
||||
summary = 'No criteria specified'
|
||||
if (config.criteria[0].operation) {
|
||||
if (config.criteria[0].input.length ||
|
||||
(config.criteria[0].operation === 'isDefined' ||
|
||||
config.criteria[0].operation === 'isUndefined')) {
|
||||
rule += `When ${config.criteria[0].telemetry.name} value ${this.findDescription(config.criteria[0].operation, config.criteria[0].input)}`
|
||||
summary = rule;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
let conjunction = '';
|
||||
summary = 'When ';
|
||||
summary = config.criteria.length === 1 ? 'No criteria specified' : 'When ';
|
||||
config.criteria.forEach((criterion, index) => {
|
||||
rule = '';
|
||||
if (criterion.operation && criterion.input.length) {
|
||||
if (criterion.operation) {
|
||||
if (criterion.input.length ||
|
||||
(criterion.operation === 'isDefined' ||
|
||||
criterion.operation === 'isUndefined')) {
|
||||
rule += `${criterion.telemetry.name} value ${this.findDescription(criterion.operation, criterion.input)}`
|
||||
if (index === config.criteria.length - 1) {
|
||||
conjunction = config.trigger === 'all' ? 'and' : 'or';
|
||||
@ -242,6 +247,8 @@ export default {
|
||||
}
|
||||
summary += ` ${conjunction} ${rule}`
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@
|
||||
>
|
||||
<input v-model="criterion.input[inputIndex]"
|
||||
class="c-cdef__control__input"
|
||||
type="text"
|
||||
:type="setInputType"
|
||||
@blur="persist"
|
||||
>
|
||||
<span v-if="inputIndex < inputCount-1">and</span>
|
||||
@ -102,6 +102,19 @@ export default {
|
||||
},
|
||||
filteredOps: function () {
|
||||
return [...this.operations.filter(op => op.appliesTo.indexOf(this.operationFormat) !== -1)];
|
||||
},
|
||||
setInputType: function () {
|
||||
let type = '';
|
||||
for (let i = 0; i < this.filteredOps.length; i++) {
|
||||
if (this.criterion.operation === this.filteredOps[i].name) {
|
||||
if (this.filteredOps[i].appliesTo.length === 1) {
|
||||
type = this.filteredOps[i].appliesTo[0];
|
||||
} else {
|
||||
type = 'string'
|
||||
}
|
||||
}
|
||||
}
|
||||
return type;
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user