mirror of
https://github.com/nasa/openmct.git
synced 2024-12-21 06:03:08 +00:00
commit
469e93d916
@ -95,7 +95,7 @@ export default class ConditionClass extends EventEmitter {
|
||||
|
||||
generateCriterion(criterionConfiguration) {
|
||||
return {
|
||||
id: uuid(),
|
||||
id: criterionConfiguration.id || uuid(),
|
||||
telemetry: criterionConfiguration.telemetry || '',
|
||||
telemetryObject: this.conditionManager.telemetryObjects[this.openmct.objects.makeKeyString(criterionConfiguration.telemetry)],
|
||||
operation: criterionConfiguration.operation || '',
|
||||
|
@ -122,6 +122,7 @@ export default class ConditionManager extends EventEmitter {
|
||||
output: 'false',
|
||||
trigger: 'all',
|
||||
criteria: [{
|
||||
id: uuid(),
|
||||
telemetry: '',
|
||||
operation: '',
|
||||
input: [],
|
||||
@ -140,7 +141,9 @@ export default class ConditionManager extends EventEmitter {
|
||||
}
|
||||
|
||||
cloneCondition(conditionConfiguration, index) {
|
||||
this.createAndSaveCondition(index, JSON.parse(JSON.stringify(conditionConfiguration)));
|
||||
let clonedConfig = JSON.parse(JSON.stringify(conditionConfiguration));
|
||||
clonedConfig.configuration.criteria.forEach((criterion) => criterion.id = uuid());
|
||||
this.createAndSaveCondition(index, clonedConfig);
|
||||
}
|
||||
|
||||
createAndSaveCondition(index, conditionConfiguration) {
|
||||
|
@ -41,7 +41,6 @@
|
||||
></span>
|
||||
|
||||
<span class="c-condition__name">{{ condition.configuration.name }}</span>
|
||||
<!-- TODO: description should be derived from criteria -->
|
||||
<span class="c-condition__summary">
|
||||
<template v-if="!canEvaluateCriteria">
|
||||
Define criteria
|
||||
@ -122,7 +121,7 @@
|
||||
|
||||
<template v-if="telemetry.length || condition.configuration.criteria.length">
|
||||
<div v-for="(criterion, index) in condition.configuration.criteria"
|
||||
:key="index"
|
||||
:key="criterion.id"
|
||||
class="c-cdef__criteria"
|
||||
>
|
||||
<Criterion :telemetry="telemetry"
|
||||
@ -183,6 +182,7 @@
|
||||
import Criterion from './Criterion.vue';
|
||||
import ConditionDescription from "./ConditionDescription.vue";
|
||||
import { TRIGGER, TRIGGER_LABEL } from "@/plugins/condition/utils/constants";
|
||||
import uuid from 'uuid';
|
||||
|
||||
export default {
|
||||
inject: ['openmct'],
|
||||
@ -275,6 +275,7 @@ export default {
|
||||
},
|
||||
addCriteria() {
|
||||
const criteriaObject = {
|
||||
id: uuid(),
|
||||
telemetry: '',
|
||||
operation: '',
|
||||
input: '',
|
||||
@ -308,6 +309,7 @@ export default {
|
||||
},
|
||||
cloneCriterion(index) {
|
||||
const clonedCriterion = JSON.parse(JSON.stringify(this.condition.configuration.criteria[index]));
|
||||
clonedCriterion.id = uuid();
|
||||
this.condition.configuration.criteria.splice(index + 1, 0, clonedCriterion);
|
||||
this.persist();
|
||||
},
|
||||
@ -317,7 +319,7 @@ export default {
|
||||
index: this.conditionIndex
|
||||
});
|
||||
},
|
||||
initCap: function (str) {
|
||||
initCap(str) {
|
||||
return str.charAt(0).toUpperCase() + str.slice(1)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user