mirror of
https://github.com/nasa/openmct.git
synced 2025-03-11 23:14:16 +00:00
1. Persist the condition domain object — done
2. Persist the condition identifier only in configuration.conditionCollection array, not the domain object — done 3. WIP - Retrieve the condition domain object and instantiate the condition classes on load
This commit is contained in:
parent
bf1efaf912
commit
7b7c7b528a
@ -98,7 +98,7 @@ export default class ConditionClass extends EventEmitter {
|
|||||||
addCriterion(criterionDefinition) {
|
addCriterion(criterionDefinition) {
|
||||||
let criterionDefinitionWithId = this.generateCriterion(criterionDefinition || null);
|
let criterionDefinitionWithId = this.generateCriterion(criterionDefinition || null);
|
||||||
let criterion = new TelemetryCriterion(criterionDefinitionWithId, this.openmct);
|
let criterion = new TelemetryCriterion(criterionDefinitionWithId, this.openmct);
|
||||||
criterion.on('criterionUpdated', (obj) => this.this.handleCriterionUpdated(obj));
|
criterion.on('criterionUpdated', (obj) => this.handleCriterionUpdated(obj));
|
||||||
if (!this.criteria) {
|
if (!this.criteria) {
|
||||||
this.criteria = [];
|
this.criteria = [];
|
||||||
}
|
}
|
||||||
|
@ -23,16 +23,24 @@
|
|||||||
export default {
|
export default {
|
||||||
inject: ['openmct'],
|
inject: ['openmct'],
|
||||||
props: {
|
props: {
|
||||||
condition: {
|
conditionIdentifier: {
|
||||||
type: Object,
|
type: Object,
|
||||||
required: true
|
required: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
conditionData: {}
|
conditionData: {},
|
||||||
|
condition: this.condition
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
mounted() {
|
||||||
|
this.condition = {};
|
||||||
|
this.openmct.objects.get(this.conditionIdentifier).then((obj => {
|
||||||
|
console.log('ConditionEdit obj', obj);
|
||||||
|
this.condition = obj;
|
||||||
|
}));
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,15 +29,15 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="condition-collection">
|
<div class="condition-collection">
|
||||||
<div v-for="condition in conditionCollection"
|
<div v-for="conditionIdentifier in conditionCollection"
|
||||||
:key="condition.identifier.key"
|
:key="conditionIdentifier.key"
|
||||||
class="conditionArea"
|
class="conditionArea"
|
||||||
>
|
>
|
||||||
<div v-if="isEditing">
|
<div v-if="isEditing">
|
||||||
<ConditionEdit :condition="condition" />
|
<ConditionEdit :conditionIdentifier="conditionIdentifier" />
|
||||||
</div>
|
</div>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
<Condition :condition="condition" />
|
<Condition :conditionIdentifier="conditionIdentifier" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -86,7 +86,10 @@ export default {
|
|||||||
},
|
},
|
||||||
addCondition(event, isDefault) {
|
addCondition(event, isDefault) {
|
||||||
let conditionDO = this.getConditionDomainObject(!!isDefault);
|
let conditionDO = this.getConditionDomainObject(!!isDefault);
|
||||||
this.conditionCollection.unshift(conditionDO);
|
//persist the condition DO so that we can do an openmct.objects.get on it and only persist the identifier in the conditionCollection of conditionSet
|
||||||
|
this.openmct.objects.mutate(conditionDO, 'created', new Date());
|
||||||
|
|
||||||
|
this.conditionCollection.unshift(conditionDO.identifier);
|
||||||
|
|
||||||
let condition = new ConditionClass(conditionDO, this.openmct);
|
let condition = new ConditionClass(conditionDO, this.openmct);
|
||||||
this.conditions.push(condition);
|
this.conditions.push(condition);
|
||||||
@ -96,7 +99,7 @@ export default {
|
|||||||
isDefault: isDefault,
|
isDefault: isDefault,
|
||||||
isCurrent: true,
|
isCurrent: true,
|
||||||
identifier: {
|
identifier: {
|
||||||
namespace: "",
|
namespace: this.domainObject.identifier.namespace,
|
||||||
key: uuid()
|
key: uuid()
|
||||||
},
|
},
|
||||||
name: isDefault ? 'Default' : 'Unnamed Condition',
|
name: isDefault ? 'Default' : 'Unnamed Condition',
|
||||||
@ -112,6 +115,7 @@ export default {
|
|||||||
};
|
};
|
||||||
let conditionDOKeyString = this.openmct.objects.makeKeyString(conditionObj.identifier);
|
let conditionDOKeyString = this.openmct.objects.makeKeyString(conditionObj.identifier);
|
||||||
let newDO = this.instantiate(conditionObj, conditionDOKeyString);
|
let newDO = this.instantiate(conditionObj, conditionDOKeyString);
|
||||||
|
|
||||||
return newDO.useCapability('adapter');
|
return newDO.useCapability('adapter');
|
||||||
},
|
},
|
||||||
updateCondition(updatedCondition) {
|
updateCondition(updatedCondition) {
|
||||||
|
@ -133,7 +133,7 @@ import { OPERATIONS } from '../utils/operations';
|
|||||||
export default {
|
export default {
|
||||||
inject: ['openmct', 'domainObject'],
|
inject: ['openmct', 'domainObject'],
|
||||||
props: {
|
props: {
|
||||||
condition: {
|
conditionIdentifier: {
|
||||||
type: Object,
|
type: Object,
|
||||||
required: true
|
required: true
|
||||||
}
|
}
|
||||||
@ -141,6 +141,7 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
let conditionCollection = this.domainObject.configuration.conditionCollection;
|
let conditionCollection = this.domainObject.configuration.conditionCollection;
|
||||||
return {
|
return {
|
||||||
|
condition: this.condition,
|
||||||
expanded: true,
|
expanded: true,
|
||||||
name: this.condition.name,
|
name: this.condition.name,
|
||||||
description: this.condition.description,
|
description: this.condition.description,
|
||||||
@ -155,11 +156,16 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
this.condition = {};
|
||||||
|
this.openmct.objects.get(this.conditionIdentifier).then((obj => {
|
||||||
|
console.log('ConditionEdit obj', obj);
|
||||||
|
this.condition = obj;
|
||||||
if (this.condition.output !== 'false' && this.condition.output !== 'true') {
|
if (this.condition.output !== 'false' && this.condition.output !== 'true') {
|
||||||
this.$refs.outputSelect.value = 'string';
|
this.$refs.outputSelect.value = 'string';
|
||||||
this.stringOutputField = true;
|
this.stringOutputField = true;
|
||||||
}
|
}
|
||||||
this.updateTelemetry();
|
this.updateTelemetry();
|
||||||
|
}));
|
||||||
},
|
},
|
||||||
updated() {
|
updated() {
|
||||||
this.updateCurrentCondition();
|
this.updateCurrentCondition();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user