From c4022025d34b1829827144ef4c3641c7d7d1f5e2 Mon Sep 17 00:00:00 2001
From: Mathias Chouet <mathias.chouet@irstea.fr>
Date: Thu, 25 Jun 2020 16:14:12 +0200
Subject: [PATCH] PreBarrage: restore select mechanisms on Cloison form

---
 src/app/calculators/prebarrage/config.json       |  6 +++---
 src/app/formulaire/definition/form-pb-cloison.ts | 14 +-------------
 2 files changed, 4 insertions(+), 16 deletions(-)

diff --git a/src/app/calculators/prebarrage/config.json b/src/app/calculators/prebarrage/config.json
index 547346740..7aa71a6d9 100644
--- a/src/app/calculators/prebarrage/config.json
+++ b/src/app/calculators/prebarrage/config.json
@@ -45,7 +45,7 @@
         "type": "subform",
         "config": [
             {
-                "id": "fs_wall_device",
+                "id": "fs_ouvrage",
                 "type": "fieldset_template",
                 "calcType": "Structure",
                 "defaultStructType": "SeuilRectangulaire",
@@ -105,14 +105,14 @@
                 "id": "struct_container",
                 "type": "template_container",
                 "templates": [
-                    "fs_wall_device"
+                    "fs_ouvrage"
                 ]
             },
             {
                 "type": "options",
                 "upstreamBasinSelectId": "select_upstream_basin",
                 "downstreamBasinSelectId": "select_downstream_basin",
-                "selectIds": [ ]
+                "selectIds": [ "select_structure", "select_loidebit" ]
             }
         ]
     },
diff --git a/src/app/formulaire/definition/form-pb-cloison.ts b/src/app/formulaire/definition/form-pb-cloison.ts
index cf9801ef6..db7272f52 100644
--- a/src/app/formulaire/definition/form-pb-cloison.ts
+++ b/src/app/formulaire/definition/form-pb-cloison.ts
@@ -36,19 +36,7 @@ export class FormulairePbCloison extends FormulaireParallelStructure {
     // interface Observer
 
     public update(sender: IObservable, data: any) {
-        // copied from FormDefinition, to avoid calling super.update()
-        if (sender instanceof Nub) {
-            switch (data.action) {
-                case "resultUpdated":
-                    // forward Nub results update notification to FormCompute objects
-                    this.reaffectResultComponents();
-                    break;
-            }
-        }
-        // copied from FormFixedVar, to avoid calling super.update()
-        if (data.action === "propertyChange") {
-            this.reset();
-        }
+        super.update(sender, data);
 
         if (sender instanceof SelectFieldNub) {
             const nub = this._currentNub as PbCloison;
-- 
GitLab