resolve merge

This commit is contained in:
Joel McKinnon 2020-01-29 16:23:13 -08:00
parent 8886a94a01
commit 04a5c8f69f
2 changed files with 24 additions and 36 deletions

View File

@ -78,30 +78,24 @@
<li class="has-local-controls t-condition">
<label>Match when</label>
<span class="controls">
<select>
<select v-model="trigger">
<option value="all">all criteria are met</option>
<option value="any">any criteria are met</option>
</select>
</span>
</li>
</ul>
<<<<<<< HEAD
<ul v-if="telemetry.length"
class="t-widget-condition-config">
<li v-for="(criteria, index) in condition.definition.criteria"
=======
<ul class="t-widget-rule-config"
v-if="telemetry.length">
<li v-for="criteria in condition.definition.criteria"
>>>>>>> f25eebdf3f51d50f1fd180e4350fb0566f02e39f
:key="criteria.key.key"
class="has-local-controls t-condition"
>
<label>{{ index === 0 ? 'when' : 'and when' }}</label>
<span class="t-configuration">
<span class="controls">
<select v-model="selectedTelemetryKey[criteria.key.key]"
@change="updateTelemetryMetaData"
<select v-model="selectedTelemetryKey"
@change="telemetryChange"
>
<option value="">- Select Telemetry -</option>
<option v-for="telemetryOption in telemetry"
@ -125,7 +119,7 @@
</span>
<span class="controls">
<select v-model="selectedOperationKey"
@change="setInputValueVisibility"
@change="operationKeyChange"
>
<option value="">- Select Comparison -</option>
<option v-for="option in operations"
@ -195,6 +189,7 @@ export default {
telemetryObject: this.telemetryObject,
telemetryMetadata: this.telemetryMetadata,
operations: OPERATIONS,
trigger: 'all',
selectedMetaDataKey: {},
selectedTelemetryKey: {},
selectedOperationKey: '',
@ -232,8 +227,8 @@ export default {
},
updated() {
//validate telemetry exists, update criteria as needed
this.validate();
this.persist();
// this.validate();
// this.persist();
},
methods: {
addCriteria() {
@ -253,15 +248,6 @@ export default {
this.$emit('set-move-index', Number(e.target.getAttribute('data-condition-index')));
},
initialize() {
this.condition.definition.criteria.push({
operation: '',
input: '',
metaDataKey: '',
key: {
namespace: '',
key: uuid()
}
});
if(this.condition.definition.criteria.length) {
this.setCurrentCriterion(0);
}
@ -272,6 +258,7 @@ export default {
this.conditionClass.on('conditionResultUpdated', this.handleConditionResult.bind(this));
},
setCurrentCriterion(index) {
console.log('setCurrentCriterion', 'index', index);
this.currentCriteria = this.condition.definition.criteria[index];
},
destroy() {
@ -336,12 +323,13 @@ export default {
}
},
updateTelemetry() {
console.log('update telemetry - this.currentCriteria.key', this.currentCriteria.key);
if (this.hasTelemetry()) {
this.openmct.objects.get(this.currentCriteria.key).then((obj) => {
this.openmct.objects.get(this.condition.definition.criteria[0].key).then((obj) => {
this.telemetryObject = obj;
this.telemetryMetadata = this.openmct.telemetry.getMetadata(this.telemetryObject).values();
this.selectedMetaDataKey = this.getTelemetryMetadataKey();
this.selectedTelemetryKey[this.currentCriteria.key] = this.getTelemetryKey();
this.selectedTelemetryKey = this.getTelemetryKey();
});
} else {
this.telemetryObject = null;
@ -349,33 +337,33 @@ export default {
},
getTelemetryMetadataKey() {
let index = -1;
if (this.currentCriteria.metaDataKey) {
if (this.condition.definition.criteria[0].metaDataKey) {
index = _.findIndex(this.telemetryMetadata, (metadata) => {
return metadata.key === this.currentCriteria.metaDataKey;
return metadata.key === this.condition.definition.criteria[0].metaDataKey;
});
}
return this.telemetryMetadata.length && index > -1 ? this.telemetryMetadata[index].key : '';
},
getTelemetryKey() {
let index = -1;
if (this.currentCriteria.key) {
if (this.condition.definition.criteria[0].key) {
index = _.findIndex(this.telemetry, (obj) => {
let key = this.openmct.objects.makeKeyString(obj.identifier);
let conditionKey = this.openmct.objects.makeKeyString(this.currentCriteria.key);
let conditionKey = this.openmct.objects.makeKeyString(this.condition.definition.criteria[0].key);
return key === conditionKey;
});
}
return this.telemetry.length && index > -1 ? this.telemetry[index].identifier : '';
},
hasTelemetry() {
return this.currentCriteria && this.currentCriteria.key;
return this.condition.definition.criteria.length && this.condition.definition.criteria[0].key;
},
updateConditionCriteria() {
if (this.currentCriteria) {
this.currentCriteria.key = this.selectedTelemetryKey;
this.currentCriteria.metaDataKey = this.selectedMetaDataKey;
this.currentCriteria.operation = this.selectedOperationKey;
this.currentCriteria.input = [this.operationValue];
if (this.condition.definition.criteria.length) {
this.condition.definition.criteria[0].key = this.selectedTelemetryKey;
this.condition.definition.criteria[0].metaDataKey = this.selectedMetaDataKey;
this.condition.definition.criteria[0].operation = this.selectedOperationKey;
this.condition.definition.criteria[0].input = [this.operationValue];
}
},
persist() {
@ -389,7 +377,7 @@ export default {
this.condition.definition.output = this.selectedOutputKey;
}
},
setInputValueVisibility(ev) {
operationKeyChange(ev) {
if (this.selectedOperationKey !== 'isUndefined' && this.selectedOperationKey !== 'isDefined') {
this.comparisonValueField = true;
} else {
@ -397,7 +385,7 @@ export default {
}
//find the criterion being updated and set the operation property
},
updateTelemetryMetaData() {
telemetryChange() {
this.selectedMetaDataKey = '';
this.updateConditionCriteria();
this.updateTelemetry();

View File

@ -28,7 +28,7 @@
.c-c-button--menu[class*="--minor"],
.c-c-button--menu[class*='is-active'] {
border: solid 1px #666;
background-color: #eee;
background-color: #fff;
padding: 0.1em 0.4em;
margin: 0.4em;
font-weight: normal;