mirror of
https://github.com/nasa/openmct.git
synced 2025-02-22 18:12:57 +00:00
Merge branch 'conditionSet-view' of https://github.com/nasa/openmct into conditionSet-with-classes
This commit is contained in:
commit
31736fa194
@ -5,15 +5,15 @@
|
|||||||
>
|
>
|
||||||
<div class="title-bar">
|
<div class="title-bar">
|
||||||
<span class="condition-name">
|
<span class="condition-name">
|
||||||
{{condition.name}}
|
{{ condition.name }}
|
||||||
</span>
|
</span>
|
||||||
<span class="condition-output">
|
<span class="condition-output">
|
||||||
Output: {{condition.output}}
|
Output: {{ condition.output }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="condition-config">
|
<div class="condition-config">
|
||||||
<span class="condition-description">
|
<span class="condition-description">
|
||||||
{{ condition.description}}
|
{{ condition.description }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -23,7 +23,10 @@
|
|||||||
export default {
|
export default {
|
||||||
inject: ['openmct'],
|
inject: ['openmct'],
|
||||||
props: {
|
props: {
|
||||||
condition: Object
|
condition: {
|
||||||
|
type: Object,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -34,9 +34,7 @@
|
|||||||
class="conditionArea"
|
class="conditionArea"
|
||||||
>
|
>
|
||||||
<div v-if="isEditing">
|
<div v-if="isEditing">
|
||||||
<ConditionEdit :condition="condition"
|
<ConditionEdit :condition="condition" />
|
||||||
@persist="persist"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
<Condition :condition="condition" />
|
<Condition :condition="condition" />
|
||||||
@ -74,31 +72,18 @@ export default {
|
|||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.instantiate = this.openmct.$injector.get('instantiate');
|
this.instantiate = this.openmct.$injector.get('instantiate');
|
||||||
this.conditionCollection = this.domainObject.configuration ? this.domainObject.configuration.conditionCollection : [];
|
this.conditionCollection = this.domainObject.configuration.conditionCollection || this.conditionCollection;
|
||||||
this.addDefaultCondition();
|
if (!this.conditionCollection.length) {this.addCondition(true)}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
added(conditionDO) {
|
added(conditionDO) {
|
||||||
this.conditionCollection.unshift(conditionDO);
|
this.conditionCollection.unshift(conditionDO);
|
||||||
},
|
},
|
||||||
addCondition() {
|
addCondition(isDefault) {
|
||||||
// let conditionObjId = uuid();
|
if (isDefault !== true) {isDefault = false}
|
||||||
// let conditionObj = {
|
|
||||||
// isDefault: false,
|
|
||||||
// composition: [],
|
|
||||||
// name: "Unnamed Condition",
|
|
||||||
// type: "condition",
|
|
||||||
// id: conditionObjId,
|
|
||||||
// location: this.parentKeyString,
|
|
||||||
// identifier: {
|
|
||||||
// namespace: "",
|
|
||||||
// key: conditionObjId
|
|
||||||
// },
|
|
||||||
// output: 'test'
|
|
||||||
// };
|
|
||||||
let conditionObj = {
|
let conditionObj = {
|
||||||
isDefault: true,
|
isDefault: true,
|
||||||
name: 'Unnamed Condition',
|
name: isDefault ? 'Default' : 'Unnamed Condition',
|
||||||
trigger: 'any',
|
trigger: 'any',
|
||||||
criteria: [{
|
criteria: [{
|
||||||
operation: '',
|
operation: '',
|
||||||
@ -116,39 +101,6 @@ export default {
|
|||||||
let conditionDO = new ConditionClass(conditionObj, this.openmct);
|
let conditionDO = new ConditionClass(conditionObj, this.openmct);
|
||||||
|
|
||||||
this.conditionCollection.unshift(conditionDO);
|
this.conditionCollection.unshift(conditionDO);
|
||||||
|
|
||||||
this.$set(this.conditionCollection, 0, conditionDO);
|
|
||||||
|
|
||||||
console.log(conditionDO, this.conditionCollection);
|
|
||||||
|
|
||||||
this.persist();
|
|
||||||
},
|
|
||||||
addDefaultCondition() {
|
|
||||||
this.conditionCollection = [];
|
|
||||||
|
|
||||||
// let conditionObjId = uuid();
|
|
||||||
// this.conditionCollection.push({
|
|
||||||
// description: 'when all fails',
|
|
||||||
// isDefault: true,
|
|
||||||
// composition: [],
|
|
||||||
// name: "Default",
|
|
||||||
// type: "condition",
|
|
||||||
// id: conditionObjId,
|
|
||||||
// location: this.parentKeyString,
|
|
||||||
// identifier: {
|
|
||||||
// namespace: "",
|
|
||||||
// key: conditionObjId
|
|
||||||
// },
|
|
||||||
// output: 'Default test'
|
|
||||||
// });
|
|
||||||
this.conditionCollection.push({
|
|
||||||
isDefault: true,
|
|
||||||
name: 'Default',
|
|
||||||
description: 'when all fails - condition',
|
|
||||||
trigger: '',
|
|
||||||
criteria: [],
|
|
||||||
output: 'Default test'
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
removeCondition(identifier) {
|
removeCondition(identifier) {
|
||||||
let index = _.findIndex(this.conditionCollection, (condition) => this.openmct.objects.makeKeyString(identifier) === condition.identifier.key);
|
let index = _.findIndex(this.conditionCollection, (condition) => this.openmct.objects.makeKeyString(identifier) === condition.identifier.key);
|
||||||
@ -160,13 +112,6 @@ export default {
|
|||||||
reorderPlan.forEach((reorderEvent) => {
|
reorderPlan.forEach((reorderEvent) => {
|
||||||
this.$set(this.conditionCollection, reorderEvent.newIndex, oldConditions[reorderEvent.oldIndex]);
|
this.$set(this.conditionCollection, reorderEvent.newIndex, oldConditions[reorderEvent.oldIndex]);
|
||||||
});
|
});
|
||||||
},
|
|
||||||
persist(index) {
|
|
||||||
if (index) {
|
|
||||||
this.openmct.objects.mutate(this.domainObject, `configuration.conditionCollection[${index}]`, this.conditionCollection[index]);
|
|
||||||
} else {
|
|
||||||
this.openmct.objects.mutate(this.domainObject, 'configuration.conditionCollection', this.conditionCollection);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,10 +65,12 @@
|
|||||||
export default {
|
export default {
|
||||||
inject: ['openmct', 'domainObject'],
|
inject: ['openmct', 'domainObject'],
|
||||||
props: {
|
props: {
|
||||||
condition: Object
|
condition: {
|
||||||
|
type: Object,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
expanded: true,
|
expanded: true,
|
||||||
name: this.condition.name,
|
name: this.condition.name,
|
||||||
@ -76,9 +78,10 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
console.log(`this.condition.name: ${this.condition.name}`);
|
},
|
||||||
// console.log(`currentObjectPath: ${this.currentObjectPath.name}`);
|
updated() {
|
||||||
// console.log(this.domainObject);
|
console.log('updated');
|
||||||
|
this.persist()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
removeCondition(ev) {
|
removeCondition(ev) {
|
||||||
@ -87,7 +90,6 @@ export default {
|
|||||||
const index = Array.from(conditionCollectionDiv.children).indexOf(conditionDiv);
|
const index = Array.from(conditionCollectionDiv.children).indexOf(conditionDiv);
|
||||||
|
|
||||||
this.domainObject.configuration.conditionCollection.splice(index, 1);
|
this.domainObject.configuration.conditionCollection.splice(index, 1);
|
||||||
this.persist()
|
|
||||||
},
|
},
|
||||||
persist(index) {
|
persist(index) {
|
||||||
if (index) {
|
if (index) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user