diff --git a/app/imports/api/creature/computation/EffectAggregator.js b/app/imports/api/creature/computation/EffectAggregator.js index 1525cfb1..03207239 100644 --- a/app/imports/api/creature/computation/EffectAggregator.js +++ b/app/imports/api/creature/computation/EffectAggregator.js @@ -2,13 +2,12 @@ import evaluateCalculation from '/imports/api/creature/computation/evaluateCalcu export default class EffectAggregator{ constructor(stat, memo){ + delete this.baseValueErrors; if (stat.baseValueCalculation){ let {value, errors} = evaluateCalculation(stat.baseValueCalculation, memo); this.statBaseValue = value; if (errors.length){ this.baseValueErrors = errors; - } else { - delete this.baseValueErrors; } this.base = this.statBaseValue; } else { diff --git a/app/imports/api/creature/computation/combineStat.js b/app/imports/api/creature/computation/combineStat.js index f09c8270..5f3292d3 100644 --- a/app/imports/api/creature/computation/combineStat.js +++ b/app/imports/api/creature/computation/combineStat.js @@ -31,6 +31,7 @@ function getAggregatorResult(stat, aggregator){ function combineAttribute(stat, aggregator){ stat.value = getAggregatorResult(stat, aggregator); stat.baseValue = aggregator.statBaseValue; + stat.baseValueErrors = aggregator.baseValueErrors; if (stat.attributeType === 'ability') { stat.modifier = Math.floor((stat.value - 10) / 2); } diff --git a/app/imports/api/creature/computation/computeToggle.js b/app/imports/api/creature/computation/computeToggle.js index cd0642d3..69cbbbb1 100644 --- a/app/imports/api/creature/computation/computeToggle.js +++ b/app/imports/api/creature/computation/computeToggle.js @@ -16,6 +16,7 @@ export default function computeToggle(toggle, memo){ toggle.computationDetails.busyComputing = true; // Do work + delete toggle.errors; if (toggle.enabled){ toggle.toggleResult = true; } else if (toggle.disabled){ @@ -29,8 +30,6 @@ export default function computeToggle(toggle, memo){ toggle.toggleResult = value; if (errors.length){ toggle.errors = errors; - } else { - delete toggle.errors; } } toggle.computationDetails.computed = true; diff --git a/app/imports/api/properties/Attributes.js b/app/imports/api/properties/Attributes.js index 51746446..0b5fcfea 100644 --- a/app/imports/api/properties/Attributes.js +++ b/app/imports/api/properties/Attributes.js @@ -1,4 +1,5 @@ import SimpleSchema from 'simpl-schema'; +import ErrorSchema from '/imports/api/properties/subSchemas/ErrorSchema.js'; import VARIABLE_NAME_REGEX from '/imports/constants/VARIABLE_NAME_REGEX.js'; /* @@ -73,6 +74,13 @@ let ComputedOnlyAttributeSchema = new SimpleSchema({ baseValue: { type: SimpleSchema.oneOf(Number, String, Boolean), optional: true, + }, + baseValueErrors: { + type: Array, + optional: true, + }, + 'baseValueErrors.$': { + type: ErrorSchema, }, // The computed value of the attribute value: { diff --git a/app/imports/api/properties/Toggles.js b/app/imports/api/properties/Toggles.js index 5f588afc..65efad65 100644 --- a/app/imports/api/properties/Toggles.js +++ b/app/imports/api/properties/Toggles.js @@ -1,4 +1,5 @@ import SimpleSchema from 'simpl-schema'; +import ErrorSchema from '/imports/api/properties/subSchemas/ErrorSchema.js'; const ToggleSchema = new SimpleSchema({ name: { @@ -32,8 +33,8 @@ const ComputedOnlyToggleSchema = new SimpleSchema({ type: Array, optional: true, }, - 'errors.$':{ - type: String, + 'errors.$': { + type: ErrorSchema, }, }); diff --git a/app/imports/ui/properties/forms/AttributeForm.vue b/app/imports/ui/properties/forms/AttributeForm.vue index 79e9e2c6..8fe4f719 100644 --- a/app/imports/ui/properties/forms/AttributeForm.vue +++ b/app/imports/ui/properties/forms/AttributeForm.vue @@ -11,6 +11,7 @@ @change="change('baseValueCalculation', ...arguments)" /> +
import FormSection from '/imports/ui/properties/forms/shared/FormSection.vue'; import propertyFormMixin from '/imports/ui/properties/forms/shared/propertyFormMixin.js'; + import CalculationErrorList from '/imports/ui/properties/forms/shared/CalculationErrorList.vue'; export default { components: { FormSection, + CalculationErrorList, }, mixins: [propertyFormMixin], data(){ diff --git a/app/imports/ui/properties/forms/EffectForm.vue b/app/imports/ui/properties/forms/EffectForm.vue index cdf2ec62..c37bd3f1 100644 --- a/app/imports/ui/properties/forms/EffectForm.vue +++ b/app/imports/ui/properties/forms/EffectForm.vue @@ -56,26 +56,7 @@ :hint="!isFinite(model.calculation) && model.result ? model.result + '' : '' " @change="change('calculation', ...arguments)" /> -
- - - {{ error.message }} - - -
+
@@ -83,9 +64,13 @@ import getEffectIcon from '/imports/ui/utility/getEffectIcon.js'; import propertyFormMixin from '/imports/ui/properties/forms/shared/propertyFormMixin.js'; import attributeListMixin from '/imports/ui/properties/forms/shared/lists/attributeListMixin.js'; + import CalculationErrorList from '/imports/ui/properties/forms/shared/CalculationErrorList.vue'; const ICON_SPIN_DURATION = 300; export default { + components: { + CalculationErrorList, + }, mixins: [propertyFormMixin, attributeListMixin], data(){ return { displayedIcon: 'add', @@ -145,24 +130,6 @@ }, }, methods: { - errorIcon(type){ - if (type === 'subsitution'){ - return 'info'; - } else if (type === 'evaluation'){ - return 'warning'; - } else { - return 'error' - } - }, - errorColor(type){ - if (type === 'subsitution'){ - return 'info'; - } else if (type === 'evaluation'){ - return 'warning'; - } else { - return 'error' - } - }, getEffectIcon, } }; diff --git a/app/imports/ui/properties/forms/ToggleForm.vue b/app/imports/ui/properties/forms/ToggleForm.vue index fd7bd63e..aa1b03e3 100644 --- a/app/imports/ui/properties/forms/ToggleForm.vue +++ b/app/imports/ui/properties/forms/ToggleForm.vue @@ -37,13 +37,18 @@ @change="change('condition', ...arguments)" /> + + +