diff --git a/src/plugins/condition/components/Condition.vue b/src/plugins/condition/components/Condition.vue
index 31a1f97e2f..b0f62c9e09 100644
--- a/src/plugins/condition/components/Condition.vue
+++ b/src/plugins/condition/components/Condition.vue
@@ -44,7 +44,7 @@
{{ domainObject.configuration.name }}
- {{ getDescription }}
+ {{ getSummary }}
@@ -162,7 +162,7 @@
- {{ getDescription }}
+ {{ getSummary }}
@@ -213,34 +213,41 @@ 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) {
- rule += `${criterion.telemetry.name} value ${this.findDescription(criterion.operation, criterion.input)}`
- if (index === config.criteria.length - 1) {
- conjunction = config.trigger === 'all' ? 'and' : 'or';
- } else {
- conjunction = '';
+ 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';
+ } else {
+ conjunction = '';
+ }
+ summary += ` ${conjunction} ${rule}`
}
- summary += ` ${conjunction} ${rule}`
+
}
});
}
diff --git a/src/plugins/condition/components/Criterion.vue b/src/plugins/condition/components/Criterion.vue
index 95ddc7dcec..569dccb276 100644
--- a/src/plugins/condition/components/Criterion.vue
+++ b/src/plugins/condition/components/Criterion.vue
@@ -51,7 +51,7 @@
>
and
@@ -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() {