mirror of
https://github.com/nasa/openmct.git
synced 2025-02-24 10:45:02 +00:00
Addresses comments
This commit is contained in:
parent
76e7fec1a0
commit
83c648cc26
@ -124,7 +124,7 @@ export default class ConditionManager extends EventEmitter {
|
|||||||
this.persistConditions();
|
this.persistConditions();
|
||||||
}
|
}
|
||||||
|
|
||||||
removeCondition(conditionConfiguration, index) {
|
removeCondition(index) {
|
||||||
let condition = this.conditionClassCollection[index];
|
let condition = this.conditionClassCollection[index];
|
||||||
condition.destroyCriteria();
|
condition.destroyCriteria();
|
||||||
condition.off('conditionResultUpdated', this.handleConditionResult.bind(this));
|
condition.off('conditionResultUpdated', this.handleConditionResult.bind(this));
|
||||||
|
@ -28,8 +28,8 @@
|
|||||||
<div class="c-condition__header">
|
<div class="c-condition__header">
|
||||||
<span class="c-condition__drag-grippy c-grippy c-grippy--vertical-drag"
|
<span class="c-condition__drag-grippy c-grippy c-grippy--vertical-drag"
|
||||||
title="Drag to reorder conditions"
|
title="Drag to reorder conditions"
|
||||||
:class="[{ 'is-enabled': !domainObject.isDefault }, { 'hide-nice': domainObject.isDefault }]"
|
:class="[{ 'is-enabled': !condition.isDefault }, { 'hide-nice': condition.isDefault }]"
|
||||||
:draggable="!domainObject.isDefault"
|
:draggable="!condition.isDefault"
|
||||||
@dragstart="dragStart"
|
@dragstart="dragStart"
|
||||||
@dragstop="dragStop"
|
@dragstop="dragStop"
|
||||||
@dragover.stop
|
@dragover.stop
|
||||||
@ -40,20 +40,20 @@
|
|||||||
@click="expanded = !expanded"
|
@click="expanded = !expanded"
|
||||||
></span>
|
></span>
|
||||||
|
|
||||||
<span class="c-condition__name">{{ domainObject.configuration.name }}</span>
|
<span class="c-condition__name">{{ condition.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">
|
||||||
Description/summary goes here {{ domainObject.configuration.description }}
|
Description/summary goes here {{ condition.configuration.description }}
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<div class="c-condition__buttons">
|
<div class="c-condition__buttons">
|
||||||
<button v-if="!domainObject.isDefault"
|
<button v-if="!condition.isDefault"
|
||||||
class="c-click-icon c-condition__duplicate-button icon-duplicate"
|
class="c-click-icon c-condition__duplicate-button icon-duplicate"
|
||||||
title="Duplicate this condition"
|
title="Duplicate this condition"
|
||||||
@click="cloneCondition"
|
@click="cloneCondition"
|
||||||
></button>
|
></button>
|
||||||
|
|
||||||
<button v-if="!domainObject.isDefault"
|
<button v-if="!condition.isDefault"
|
||||||
class="c-click-icon c-condition__delete-button icon-trash"
|
class="c-click-icon c-condition__delete-button icon-trash"
|
||||||
title="Delete this condition"
|
title="Delete this condition"
|
||||||
@click="removeCondition"
|
@click="removeCondition"
|
||||||
@ -66,7 +66,7 @@
|
|||||||
<span class="c-cdef__separator c-row-separator"></span>
|
<span class="c-cdef__separator c-row-separator"></span>
|
||||||
<span class="c-cdef__label">Condition Name</span>
|
<span class="c-cdef__label">Condition Name</span>
|
||||||
<span class="c-cdef__controls">
|
<span class="c-cdef__controls">
|
||||||
<input v-model="domainObject.configuration.name"
|
<input v-model="condition.configuration.name"
|
||||||
class="t-condition-input__name"
|
class="t-condition-input__name"
|
||||||
type="text"
|
type="text"
|
||||||
@blur="persist"
|
@blur="persist"
|
||||||
@ -87,20 +87,20 @@
|
|||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
<input v-if="selectedOutputSelection === outputOptions[2]"
|
<input v-if="selectedOutputSelection === outputOptions[2]"
|
||||||
v-model="domainObject.configuration.output"
|
v-model="condition.configuration.output"
|
||||||
class="t-condition-name-input"
|
class="t-condition-name-input"
|
||||||
type="text"
|
type="text"
|
||||||
@blur="persist"
|
@blur="persist"
|
||||||
>
|
>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<div v-if="!domainObject.isDefault"
|
<div v-if="!condition.isDefault"
|
||||||
class="c-cdef__match-and-criteria"
|
class="c-cdef__match-and-criteria"
|
||||||
>
|
>
|
||||||
<span class="c-cdef__separator c-row-separator"></span>
|
<span class="c-cdef__separator c-row-separator"></span>
|
||||||
<span class="c-cdef__label">Match</span>
|
<span class="c-cdef__label">Match</span>
|
||||||
<span class="c-cdef__controls">
|
<span class="c-cdef__controls">
|
||||||
<select v-model="domainObject.configuration.trigger"
|
<select v-model="condition.configuration.trigger"
|
||||||
@change="persist"
|
@change="persist"
|
||||||
>
|
>
|
||||||
<option value="all">when all criteria are met</option>
|
<option value="all">when all criteria are met</option>
|
||||||
@ -109,15 +109,15 @@
|
|||||||
</span>
|
</span>
|
||||||
|
|
||||||
<template v-if="telemetry.length">
|
<template v-if="telemetry.length">
|
||||||
<div v-for="(criterion, index) in domainObject.configuration.criteria"
|
<div v-for="(criterion, index) in condition.configuration.criteria"
|
||||||
:key="index"
|
:key="index"
|
||||||
class="c-cdef__criteria"
|
class="c-cdef__criteria"
|
||||||
>
|
>
|
||||||
<Criterion :telemetry="telemetry"
|
<Criterion :telemetry="telemetry"
|
||||||
:criterion="criterion"
|
:criterion="criterion"
|
||||||
:index="index"
|
:index="index"
|
||||||
:trigger="domainObject.configuration.trigger"
|
:trigger="condition.configuration.trigger"
|
||||||
:is-default="domainObject.configuration.criteria.length === 1"
|
:is-default="condition.configuration.criteria.length === 1"
|
||||||
@persist="persist"
|
@persist="persist"
|
||||||
/>
|
/>
|
||||||
<div class="c-cdef__criteria__buttons">
|
<div class="c-cdef__criteria__buttons">
|
||||||
@ -125,7 +125,7 @@
|
|||||||
title="Duplicate this criteria"
|
title="Duplicate this criteria"
|
||||||
@click="cloneCriterion(index)"
|
@click="cloneCriterion(index)"
|
||||||
></button>
|
></button>
|
||||||
<button v-if="!(domainObject.configuration.criteria.length === 1)"
|
<button v-if="!(condition.configuration.criteria.length === 1)"
|
||||||
class="c-click-icon c-cdef__criteria-duplicate-button icon-trash"
|
class="c-click-icon c-cdef__criteria-duplicate-button icon-trash"
|
||||||
title="Delete this criteria"
|
title="Delete this criteria"
|
||||||
@click="removeCriterion(index)"
|
@click="removeCriterion(index)"
|
||||||
@ -153,14 +153,14 @@
|
|||||||
<!-- Browse view -->
|
<!-- Browse view -->
|
||||||
<div class="c-condition__header">
|
<div class="c-condition__header">
|
||||||
<span class="c-condition__name">
|
<span class="c-condition__name">
|
||||||
{{ domainObject.configuration.name }}
|
{{ condition.configuration.name }}
|
||||||
</span>
|
</span>
|
||||||
<span class="c-condition__output">
|
<span class="c-condition__output">
|
||||||
Output: {{ domainObject.configuration.output }}
|
Output: {{ condition.configuration.output }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="c-condition__summary">
|
<div class="c-condition__summary">
|
||||||
Description/summary goes here {{ domainObject.configuration.description }}
|
Description/summary goes here {{ condition.configuration.description }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -194,9 +194,6 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
domainObject: {
|
|
||||||
configuration: {}
|
|
||||||
},
|
|
||||||
currentCriteria: this.currentCriteria,
|
currentCriteria: this.currentCriteria,
|
||||||
expanded: true,
|
expanded: true,
|
||||||
trigger: 'all',
|
trigger: 'all',
|
||||||
@ -209,15 +206,11 @@ export default {
|
|||||||
this.destroy();
|
this.destroy();
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.domainObject = this.condition;
|
|
||||||
this.initialize();
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
initialize() {
|
|
||||||
this.setOutputSelection();
|
this.setOutputSelection();
|
||||||
},
|
},
|
||||||
|
methods: {
|
||||||
setOutputSelection() {
|
setOutputSelection() {
|
||||||
let conditionOutput = this.domainObject.configuration.output;
|
let conditionOutput = this.condition.configuration.output;
|
||||||
if (conditionOutput) {
|
if (conditionOutput) {
|
||||||
if (conditionOutput !== 'false' && conditionOutput !== 'true') {
|
if (conditionOutput !== 'false' && conditionOutput !== 'true') {
|
||||||
this.selectedOutputSelection = 'string';
|
this.selectedOutputSelection = 'string';
|
||||||
@ -228,9 +221,9 @@ export default {
|
|||||||
},
|
},
|
||||||
setOutputValue() {
|
setOutputValue() {
|
||||||
if (this.selectedOutputSelection === 'string') {
|
if (this.selectedOutputSelection === 'string') {
|
||||||
this.domainObject.configuration.output = '';
|
this.condition.configuration.output = '';
|
||||||
} else {
|
} else {
|
||||||
this.domainObject.configuration.output = this.selectedOutputSelection;
|
this.condition.configuration.output = this.selectedOutputSelection;
|
||||||
}
|
}
|
||||||
this.persist();
|
this.persist();
|
||||||
},
|
},
|
||||||
@ -241,7 +234,7 @@ export default {
|
|||||||
input: '',
|
input: '',
|
||||||
metadata: ''
|
metadata: ''
|
||||||
};
|
};
|
||||||
this.domainObject.configuration.criteria.push(criteriaObject);
|
this.condition.configuration.criteria.push(criteriaObject);
|
||||||
},
|
},
|
||||||
dragStart(e) {
|
dragStart(e) {
|
||||||
e.dataTransfer.setData('dragging', e.target); // required for FF to initiate drag
|
e.dataTransfer.setData('dragging', e.target); // required for FF to initiate drag
|
||||||
@ -255,10 +248,7 @@ export default {
|
|||||||
destroy() {
|
destroy() {
|
||||||
},
|
},
|
||||||
removeCondition(ev) {
|
removeCondition(ev) {
|
||||||
this.$emit('removeCondition', {
|
this.$emit('removeCondition', this.conditionIndex);
|
||||||
condition: this.condition,
|
|
||||||
index: this.conditionIndex
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
cloneCondition(ev) {
|
cloneCondition(ev) {
|
||||||
this.$emit('cloneCondition', {
|
this.$emit('cloneCondition', {
|
||||||
@ -267,26 +257,26 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
removeCriterion(index) {
|
removeCriterion(index) {
|
||||||
this.domainObject.configuration.criteria.splice(index, 1);
|
this.condition.configuration.criteria.splice(index, 1);
|
||||||
this.persist()
|
this.persist()
|
||||||
},
|
},
|
||||||
cloneCriterion(index) {
|
cloneCriterion(index) {
|
||||||
const clonedCriterion = {...this.domainObject.configuration.criteria[index]};
|
const clonedCriterion = {...this.condition.configuration.criteria[index]};
|
||||||
this.domainObject.configuration.criteria.splice(index + 1, 0, clonedCriterion);
|
this.condition.configuration.criteria.splice(index + 1, 0, clonedCriterion);
|
||||||
this.persist()
|
this.persist()
|
||||||
},
|
},
|
||||||
hasTelemetry(identifier) {
|
hasTelemetry(identifier) {
|
||||||
// TODO: check parent domainObject.composition.hasTelemetry
|
// TODO: check parent condition.composition.hasTelemetry
|
||||||
return this.currentCriteria && identifier;
|
return this.currentCriteria && identifier;
|
||||||
},
|
},
|
||||||
persist() {
|
persist() {
|
||||||
this.$emit('updateCondition', {
|
this.$emit('updateCondition', {
|
||||||
condition: this.domainObject,
|
condition: this.condition,
|
||||||
index: this.conditionIndex
|
index: this.conditionIndex
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
initCap: function (value) {
|
initCap: function (str) {
|
||||||
return value.charAt(0).toUpperCase() + value.slice(1)
|
return str.charAt(0).toUpperCase() + str.slice(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -193,8 +193,8 @@ export default {
|
|||||||
updateCondition(data) {
|
updateCondition(data) {
|
||||||
this.conditionManager.updateCondition(data.condition, data.index);
|
this.conditionManager.updateCondition(data.condition, data.index);
|
||||||
},
|
},
|
||||||
removeCondition(data) {
|
removeCondition(index) {
|
||||||
this.conditionManager.removeCondition(data.condition, data.index);
|
this.conditionManager.removeCondition(index);
|
||||||
},
|
},
|
||||||
reorder(reorderPlan) {
|
reorder(reorderPlan) {
|
||||||
this.conditionManager.reorderConditions(reorderPlan);
|
this.conditionManager.reorderConditions(reorderPlan);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user