Description fields should now show calculation errors

This commit is contained in:
Stefan Zermatten
2021-02-12 11:43:13 +02:00
parent b9e0475d07
commit a078ce3d5d
13 changed files with 84 additions and 2 deletions

View File

@@ -1,6 +1,6 @@
<template lang="html">
<div
v-if="errors && errors.length"
v-if="computedErrors.length"
class="error-list"
>
<v-slide-x-transition
@@ -8,7 +8,7 @@
hide-on-leave
>
<v-alert
v-for="error in errors"
v-for="error in computedErrors"
:key="error.message"
:value="true"
:icon="errorIcon(error.type)"
@@ -28,6 +28,25 @@ export default {
type: Array,
default: undefined,
},
calculations: {
type: Array,
default: undefined,
},
},
computed: {
computedErrors(){
if (this.errors) {
return this.errors;
} else if (this.calculations){
let errors = [];
this.calculations.forEach(calc => {
if (calc.errors) errors.push(...calc.errors)
});
return errors;
} else {
return [];
}
},
},
methods: {
errorIcon(type){