Compare commits

...

6 Commits

3 changed files with 28 additions and 155 deletions

View File

@ -75,8 +75,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"
@ -86,7 +86,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"
@ -212,8 +212,8 @@ export default {
domainObject: this.domainObject,
currentCriteria: this.currentCriteria,
expanded: true,
selectedOutputKey: '',
stringOutputField: false,
trigger: 'all',
selectedOutputSelection: '',
outputOptions: ['false', 'true', 'string'],
criterionIndex: 0
};
@ -229,7 +229,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 = {
@ -265,32 +283,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

@ -1,126 +0,0 @@
<template>
<div class="c-inspector">
<div class="c-inspector__tabs"
>
<div v-if="showStyles"
class="c-inspector__tabs__holder">
<div v-for="tabbedView in tabbedViews"
:key="tabbedView.key"
class="c-inspector__tabs__header"
@click="updateCurrentTab(tabbedView)"
>
<span class="c-inspector__tabs__label c-tab"
:class="{'is-current': isCurrent(tabbedView)}"
>{{ tabbedView.name }}</span>
</div>
</div>
<div class="c-inspector__tabs__contents">
<multipane v-if="currentTabbedView.key === '__properties'"
class="c-inspector"
type="vertical"
>
<pane class="c-inspector__properties">
<properties />
<location />
<inspector-views/>
</pane>
<pane
v-if="isEditing && hasComposition"
class="c-inspector__elements"
handle="before"
label="Elements"
>
<elements />
</pane>
</multipane>
<pane v-else
class="c-inspector__styles"
>
<styles-inspector-view/>
</pane>
</div>
</div>
</div>
</template>
<script>
import multipane from '../layout/multipane.vue';
import pane from '../layout/pane.vue';
import Elements from './Elements.vue';
import Location from './Location.vue';
import Properties from './Properties.vue';
import InspectorViews from './InspectorViews.vue';
import _ from "lodash";
import StylesInspectorView from "./StylesInspectorView.vue";
export default {
inject: ['openmct'],
components: {
StylesInspectorView,
// StylesInspectorView,
multipane,
pane,
Elements,
Properties,
Location,
InspectorViews
},
props: {
'isEditing': Boolean
},
data() {
return {
hasComposition: false,
showStyles: false,
tabbedViews: [{
key: '__properties',
name: 'Properties'
},{
key: '__styles',
name: 'Styles'
}],
currentTabbedView: {}
}
},
mounted() {
this.excludeObjectTypes = ['folder', 'webPage', 'conditionSet'];
this.openmct.selection.on('change', this.updateInspectorViews);
},
destroyed() {
this.openmct.selection.off('change', this.updateInspectorViews);
},
methods: {
updateInspectorViews(selection) {
this.refreshComposition(selection);
if (this.openmct.types.get('conditionSet')) {
this.refreshTabs(selection);
}
},
refreshComposition(selection) {
if (selection.length > 0 && selection[0].length > 0) {
let parentObject = selection[0][0].context.item;
this.hasComposition = !!(parentObject && this.openmct.composition.get(parentObject));
}
},
refreshTabs(selection) {
if (selection.length > 0 && selection[0].length > 0) {
//layout items are not domain objects but should allow conditional styles
this.showStyles = selection[0][0].context.layoutItem;
let object = selection[0][0].context.item;
if (object) {
let type = this.openmct.types.get(object.type);
this.showStyles = (this.excludeObjectTypes.indexOf(object.type) < 0) && type.definition.creatable;
}
this.updateCurrentTab(this.tabbedViews[0]);
}
},
updateCurrentTab(view) {
this.currentTabbedView = view;
},
isCurrent(view) {
return _.isEqual(this.currentTabbedView, view)
}
}
}
</script>

View File

@ -82,7 +82,7 @@
</template>
<script>
import Inspector from '../inspector/Inspector.vue';
import Inspector from '../inspector/InspectorViews.vue';
import MctTree from './mct-tree.vue';
import ObjectView from '../components/ObjectView.vue';
import MctTemplate from '../legacy/mct-template.vue';