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