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