mirror of
https://github.com/nasa/openmct.git
synced 2025-05-22 18:23:59 +00:00
passed definition prop instead of just name
This commit is contained in:
parent
01b1d66bea
commit
3c5047df5e
@ -176,11 +176,11 @@ export default {
|
|||||||
event: always null,
|
event: always null,
|
||||||
idDefault (boolean): true if conditionList is empty
|
idDefault (boolean): true if conditionList is empty
|
||||||
isClone (boolean): true if duplicating a condition
|
isClone (boolean): true if duplicating a condition
|
||||||
name (string): name of condition being duplicated
|
definition (string): definition property of condition being duplicated with new name
|
||||||
index (number): index of condition being duplicated
|
index (number): index of condition being duplicated
|
||||||
*/
|
*/
|
||||||
addCondition(event, isDefault, isClone, name, index) {
|
addCondition(event, isDefault, isClone, definition, index) {
|
||||||
let conditionDO = this.getConditionDomainObject(!!isDefault, isClone, name, index);
|
let conditionDO = this.getConditionDomainObject(!!isDefault, isClone, definition);
|
||||||
//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
|
//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.openmct.objects.mutate(conditionDO, 'created', new Date());
|
||||||
if (!isClone) {
|
if (!isClone) {
|
||||||
@ -193,11 +193,17 @@ export default {
|
|||||||
updateCurrentCondition(identifier) {
|
updateCurrentCondition(identifier) {
|
||||||
this.currentConditionIdentifier = identifier;
|
this.currentConditionIdentifier = identifier;
|
||||||
},
|
},
|
||||||
getConditionDomainObject(isDefault, isClone, name) {
|
getConditionDomainObject(isDefault, isClone, definition) {
|
||||||
if (isClone) {
|
const definitionTemplate = {
|
||||||
name = 'Copy of ' + name;
|
name: isDefault ? 'Default' : 'Unnamed Condition',
|
||||||
} else {
|
output: 'false',
|
||||||
name = isDefault ? 'Default' : 'Unnamed Condition';
|
trigger: 'any',
|
||||||
|
criteria: isDefault ? [] : [{
|
||||||
|
operation: '',
|
||||||
|
input: '',
|
||||||
|
metaDataKey: this.openmct.telemetry.getMetadata(this.telemetryObjs[0]).values()[0].key,
|
||||||
|
key: this.telemetryObjs.length ? this.openmct.objects.makeKeyString(this.telemetryObjs[0].identifier) : null
|
||||||
|
}]
|
||||||
}
|
}
|
||||||
let conditionObj = {
|
let conditionObj = {
|
||||||
isDefault: isDefault,
|
isDefault: isDefault,
|
||||||
@ -205,17 +211,7 @@ export default {
|
|||||||
namespace: this.domainObject.identifier.namespace,
|
namespace: this.domainObject.identifier.namespace,
|
||||||
key: uuid()
|
key: uuid()
|
||||||
},
|
},
|
||||||
definition: {
|
definition: isClone ? definition: definitionTemplate,
|
||||||
name: name,
|
|
||||||
output: 'false',
|
|
||||||
trigger: 'any',
|
|
||||||
criteria: isDefault ? [] : [{
|
|
||||||
operation: '',
|
|
||||||
input: '',
|
|
||||||
metaDataKey: this.openmct.telemetry.getMetadata(this.telemetryObjs[0]).values()[0].key,
|
|
||||||
key: this.telemetryObjs.length ? this.openmct.objects.makeKeyString(this.telemetryObjs[0].identifier) : null
|
|
||||||
}]
|
|
||||||
},
|
|
||||||
summary: 'summary description'
|
summary: 'summary description'
|
||||||
};
|
};
|
||||||
let conditionDOKeyString = this.openmct.objects.makeKeyString(conditionObj.identifier);
|
let conditionDOKeyString = this.openmct.objects.makeKeyString(conditionObj.identifier);
|
||||||
@ -242,7 +238,8 @@ export default {
|
|||||||
},
|
},
|
||||||
cloneCondition(condition) {
|
cloneCondition(condition) {
|
||||||
this.openmct.objects.get(condition.identifier).then((obj) => {
|
this.openmct.objects.get(condition.identifier).then((obj) => {
|
||||||
this.addCondition(null, false, true, obj.definition.name, condition.index);
|
obj.definition.name = 'Copy of ' + obj.definition.name;
|
||||||
|
this.addCondition(null, false, true, obj.definition, condition.index);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
persist() {
|
persist() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user