added uuid to addCriteria, cloneCriteria, changed key of v-for to criteria.id

This commit is contained in:
Joel McKinnon 2020-04-01 14:56:32 -07:00
parent 169cc6617a
commit c33314a4bf

View File

@ -121,7 +121,7 @@
<template v-if="telemetry.length || condition.configuration.criteria.length">
<div v-for="(criterion, index) in condition.configuration.criteria"
:key="criterion.telemetry.key"
:key="criterion.id"
class="c-cdef__criteria"
>
<Criterion :telemetry="telemetry"
@ -182,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'],
@ -274,6 +275,7 @@ export default {
},
addCriteria() {
const criteriaObject = {
id: uuid(),
telemetry: '',
operation: '',
input: '',
@ -307,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();
},