addressed review comments and lint errors

This commit is contained in:
Joel McKinnon 2020-03-02 12:30:28 -08:00
parent 3b046db4f8
commit f8b3899bb9
3 changed files with 35 additions and 34 deletions

View File

@ -76,8 +76,8 @@
<li>
<label>Output</label>
<span class="controls">
<select v-model="selectedOutputKey"
@change="checkInputValue"
<select v-model="selectedOutputSelection"
@change="setOutputValue"
>
<option value="">- Select Output -</option>
<option v-for="option in outputOptions"
@ -87,7 +87,7 @@
{{ initCap(option) }}
</option>
</select>
<input v-if="selectedOutputKey === outputOptions[2]"
<input v-if="selectedOutputSelection === outputOptions[2]"
v-model="domainObject.configuration.output"
class="t-condition-name-input"
type="text"
@ -213,8 +213,8 @@ export default {
domainObject: this.domainObject,
currentCriteria: this.currentCriteria,
expanded: true,
selectedOutputKey: '',
stringOutputField: false,
trigger: 'all',
selectedOutputSelection: '',
outputOptions: ['false', 'true', 'string'],
criterionIndex: 0
};
@ -230,7 +230,25 @@ export default {
},
methods: {
initialize() {
this.setOutput();
this.setOutputSelection();
},
setOutputSelection() {
let conditionOutput = this.domainObject.configuration.output;
if (conditionOutput) {
if (conditionOutput !== 'false' && conditionOutput !== 'true') {
this.selectedOutputSelection = 'string';
} else {
this.selectedOutputSelection = conditionOutput;
}
}
},
setOutputValue() {
if (this.selectedOutputSelection === 'string') {
this.domainObject.configuration.output = '';
} else {
this.domainObject.configuration.output = this.selectedOutputSelection;
}
this.persist();
},
addCriteria() {
const criteriaObject = {
@ -270,32 +288,13 @@ export default {
this.domainObject.configuration.criteria.splice(index + 1, 0, clonedCriterion);
this.persist()
},
setOutput() {
let conditionOutput = this.domainObject.configuration.output;
if (conditionOutput) {
if (conditionOutput !== 'false' && conditionOutput !== 'true') {
this.selectedOutputKey = 'string';
} else {
this.selectedOutputKey = conditionOutput;
}
}
},
persist() {
this.openmct.objects.mutate(this.domainObject, 'configuration', this.domainObject.configuration);
},
checkInputValue() {
if (this.selectedOutputKey === 'string') {
this.domainObject.configuration.output = '';
} else {
this.domainObject.configuration.output = this.selectedOutputKey;
}
this.persist();
},
hasTelemetry(identifier) {
// TODO: check parent domainObject.composition.hasTelemetry
return this.currentCriteria && identifier;
},
persist() {
this.openmct.objects.mutate(this.domainObject, 'configuration', this.domainObject.configuration);
},
initCap: function (string) {
return string.charAt(0).toUpperCase() + string.slice(1)
}

View File

@ -29,7 +29,9 @@
</div>
<div class="c-cs__ui_content">
<span v-if="currentConditionOutput"
class="current-output">{{ currentConditionOutput }}
class="current-output"
>
{{ currentConditionOutput }}
</span>
<span v-else>No output selected</span>
</div>

View File

@ -1,9 +1,9 @@
<template>
<div class="c-inspector">
<div class="c-inspector__tabs"
>
<div class="c-inspector__tabs">
<div v-if="showStyles"
class="c-inspector__tabs__holder">
class="c-inspector__tabs__holder"
>
<div v-for="tabbedView in tabbedViews"
:key="tabbedView.key"
class="c-inspector__tabs__header"
@ -22,7 +22,7 @@
<pane class="c-inspector__properties">
<properties />
<location />
<inspector-views/>
<inspector-views />
</pane>
<pane
v-if="isEditing && hasComposition"
@ -36,7 +36,7 @@
<pane v-else
class="c-inspector__styles"
>
<styles-inspector-view/>
<styles-inspector-view />
</pane>
</div>
</div>