mirror of
https://github.com/nasa/openmct.git
synced 2024-12-22 06:27:48 +00:00
add default condition only when none present
This commit is contained in:
parent
ea6f8c9a50
commit
c8abc45e25
@ -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 {
|
||||||
|
@ -39,7 +39,9 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
<Condition :condition="condition" />
|
<Condition :condition="condition"
|
||||||
|
@persist="persist"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -74,9 +76,7 @@ export default {
|
|||||||
mounted() {
|
mounted() {
|
||||||
this.instantiate = this.openmct.$injector.get('instantiate');
|
this.instantiate = this.openmct.$injector.get('instantiate');
|
||||||
this.conditionCollection = this.domainObject.configuration.conditionCollection || this.conditionCollection;
|
this.conditionCollection = this.domainObject.configuration.conditionCollection || this.conditionCollection;
|
||||||
this.addDefaultCondition();
|
if (!this.conditionCollection.length) {this.addDefaultCondition()}
|
||||||
console.log(this.conditionCollection);
|
|
||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
added(conditionDO) {
|
added(conditionDO) {
|
||||||
@ -105,10 +105,6 @@ export default {
|
|||||||
|
|
||||||
this.conditionCollection.unshift(conditionDO);
|
this.conditionCollection.unshift(conditionDO);
|
||||||
|
|
||||||
this.$set(this.conditionCollection, 0, conditionDO);
|
|
||||||
|
|
||||||
console.log(this.conditionCollection);
|
|
||||||
|
|
||||||
this.persist();
|
this.persist();
|
||||||
},
|
},
|
||||||
addDefaultCondition() {
|
addDefaultCondition() {
|
||||||
@ -116,7 +112,7 @@ export default {
|
|||||||
|
|
||||||
let conditionObjId = uuid();
|
let conditionObjId = uuid();
|
||||||
this.conditionCollection.push({
|
this.conditionCollection.push({
|
||||||
description: 'when all fails',
|
description: 'When all else fails',
|
||||||
isDefault: true,
|
isDefault: true,
|
||||||
composition: [],
|
composition: [],
|
||||||
name: "Default",
|
name: "Default",
|
||||||
|
@ -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,6 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
console.log(`this.condition.name: ${this.condition.name}`);
|
|
||||||
// console.log(`currentObjectPath: ${this.currentObjectPath.name}`);
|
|
||||||
// console.log(this.domainObject);
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
removeCondition(ev) {
|
removeCondition(ev) {
|
||||||
|
Loading…
Reference in New Issue
Block a user