From 743bb2b8f13c4d4688b600de25444f96ff1b461b Mon Sep 17 00:00:00 2001 From: Chika Date: Mon, 28 Sep 2020 16:41:48 +0300 Subject: [PATCH] effect: validation for configuration --- .../stores/CalculationStore/Effects/reaction.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/client/stores/CalculationStore/Effects/reaction.ts b/src/client/stores/CalculationStore/Effects/reaction.ts index 24152ed..60d49c0 100644 --- a/src/client/stores/CalculationStore/Effects/reaction.ts +++ b/src/client/stores/CalculationStore/Effects/reaction.ts @@ -1471,6 +1471,23 @@ const reactionEffects: IReactionEffect[] = [ }, }), + calculationStore => ({ + expression: () => { + const { configuration } = calculationStore.values; + const { selectConfiguration } = calculationStore.options; + return [configuration, selectConfiguration]; + }, + effect: ([configurationId, selectConfigurationOptions]) => { + if (selectConfigurationOptions.length) { + if (!configurationId) { + calculationStore.setValidation('selectConfiguration', false); + return; + } + } + calculationStore.setValidation('selectConfiguration', true); + }, + }), + calculationStore => ({ expression: () => { const { model, configuration } = calculationStore.values;