From 78de1b6672fc2e4885d0cda0d87e7e1a79ac89be Mon Sep 17 00:00:00 2001 From: "mathias.chouet" <mathias.chouet@irstea.fr> Date: Thu, 25 Jul 2019 15:58:14 +0200 Subject: [PATCH] Removed "nodeType" dependency system --- .../calculators/cloisons/cloisons.config.json | 21 ++++------- src/app/calculators/dever/dever.config.json | 18 +++------ .../parallel-structures.config.json | 37 ++++++------------- .../regime-uniforme.config.json | 11 ------ src/app/calculators/remous/remous.config.json | 11 ------ .../section-param/section-param.config.json | 27 ++++---------- src/app/formulaire/fieldset.ts | 27 ++++---------- 7 files changed, 40 insertions(+), 112 deletions(-) diff --git a/src/app/calculators/cloisons/cloisons.config.json b/src/app/calculators/cloisons/cloisons.config.json index 52e618a77..f661cde4f 100644 --- a/src/app/calculators/cloisons/cloisons.config.json +++ b/src/app/calculators/cloisons/cloisons.config.json @@ -64,44 +64,37 @@ { "type": "input", "id": "h1", - "unit": "m", - "nodeType": "StructureRectangle" + "unit": "m" }, { "type": "input", "id": "L", - "unit": "m", - "nodeType": "StructureRectangle" + "unit": "m" }, { "type": "input", "id": "Cd", - "unit": "", - "nodeType": "StructureRectangle" + "unit": "" }, { "type": "input", "id": "S", - "unit": "", - "nodeType": "StructureRectangle" + "unit": "" }, { "type": "input", "id": "alpha2", - "unit": "", - "nodeType": "StructureRectangle" + "unit": "" }, { "type": "input", "id": "BT", - "unit": "", - "nodeType": "StructureRectangle" + "unit": "" }, { "type": "input", "id": "ZT", - "unit": "", - "nodeType": "StructureRectangle" + "unit": "" } ] }, diff --git a/src/app/calculators/dever/dever.config.json b/src/app/calculators/dever/dever.config.json index c3378c6b0..873c35965 100644 --- a/src/app/calculators/dever/dever.config.json +++ b/src/app/calculators/dever/dever.config.json @@ -52,38 +52,32 @@ { "type": "input", "id": "ZDV", - "unit": "m", - "nodeType": "StructureRectangle" + "unit": "m" }, { "type": "input", "id": "L", - "unit": "m", - "nodeType": "StructureRectangle" + "unit": "m" }, { "type": "input", "id": "Cd", - "unit": "", - "nodeType": "StructureRectangle" + "unit": "" }, { "type": "input", "id": "alpha2", - "unit": "°", - "nodeType": "StructureRectangle" + "unit": "°" }, { "type": "input", "id": "BT", - "unit": "m", - "nodeType": "StructureRectangle" + "unit": "m" }, { "type": "input", "id": "ZT", - "unit": "m", - "nodeType": "StructureRectangle" + "unit": "m" } ] }, diff --git a/src/app/calculators/parallel-structures/parallel-structures.config.json b/src/app/calculators/parallel-structures/parallel-structures.config.json index 4a0b8a580..a477054df 100644 --- a/src/app/calculators/parallel-structures/parallel-structures.config.json +++ b/src/app/calculators/parallel-structures/parallel-structures.config.json @@ -45,80 +45,67 @@ { "type": "input", "id": "ZDV", - "unit": "m", - "nodeType": "StructureRectangle" + "unit": "m" }, { "type": "input", "id": "L", - "unit": "m", - "nodeType": "StructureRectangle" + "unit": "m" }, { "type": "input", "id": "W", - "nodeType": "StructureRectangle", "unit": "m" }, { "type": "input", "id": "CdWSL", - "unit": "", - "nodeType": "StructureRectangle" + "unit": "" }, { "type": "input", "id": "CdWR", - "unit": "", - "nodeType": "StructureRectangle" + "unit": "" }, { "type": "input", "id": "CdGR", - "unit": "", - "nodeType": "StructureRectangle" + "unit": "" }, { "type": "input", "id": "CdT", - "unit": "", - "nodeType": "StructureRectangle" + "unit": "" }, { "type": "input", "id": "alpha", - "unit": "", - "nodeType": "StructureRectangle" + "unit": "" }, { "type": "input", "id": "beta", - "unit": "", - "nodeType": "StructureRectangle" + "unit": "" }, { "type": "input", "id": "ZRAM", - "unit": "m", - "nodeType": "StructureRectangle" + "unit": "m" }, { "type": "input", "id": "alpha2", - "unit": "°", - "nodeType": "StructureRectangle" + "unit": "°" }, { "type": "input", "id": "BT", - "unit": "m", - "nodeType": "StructureRectangle" + "unit": "m" }, { "type": "input", "id": "ZT", - "unit": "m", - "nodeType": "StructureRectangle" + "unit": "m" } ] }, diff --git a/src/app/calculators/regime-uniforme/regime-uniforme.config.json b/src/app/calculators/regime-uniforme/regime-uniforme.config.json index ac65a0ea1..14e321955 100644 --- a/src/app/calculators/regime-uniforme/regime-uniforme.config.json +++ b/src/app/calculators/regime-uniforme/regime-uniforme.config.json @@ -12,38 +12,27 @@ { "type": "input", "id": "LargeurFond", - "nodeType": "SectionTrapeze", "unit": "m" }, { "type": "input", "id": "Fruit", - "nodeType": "SectionTrapeze", "unit": "m/m" }, { "type": "input", "id": "LargeurBerge", - "nodeType": "SectionRectangle", "unit": "m" }, { "type": "input", "id": "D", - "nodeType": "SectionCercle", "unit": "m" }, { "type": "input", "id": "k", - "nodeType": "SectionPuissance", "unit": "" - }, - { - "type": "input", - "id": "LargeurBerge", - "nodeType": "SectionPuissance", - "unit": "m" } ] }, diff --git a/src/app/calculators/remous/remous.config.json b/src/app/calculators/remous/remous.config.json index 172802242..18809cd84 100644 --- a/src/app/calculators/remous/remous.config.json +++ b/src/app/calculators/remous/remous.config.json @@ -12,38 +12,27 @@ { "type": "input", "id": "LargeurFond", - "nodeType": "SectionTrapeze", "unit": "m" }, { "type": "input", "id": "Fruit", - "nodeType": "SectionTrapeze", "unit": "m/m" }, { "type": "input", "id": "LargeurBerge", - "nodeType": "SectionRectangle", "unit": "m" }, { "type": "input", "id": "D", - "nodeType": "SectionCercle", "unit": "m" }, { "type": "input", "id": "k", - "nodeType": "SectionPuissance", "unit": "" - }, - { - "type": "input", - "id": "LargeurBerge", - "nodeType": "SectionPuissance", - "unit": "m" } ] }, diff --git a/src/app/calculators/section-param/section-param.config.json b/src/app/calculators/section-param/section-param.config.json index acb801414..d1b1f4a12 100644 --- a/src/app/calculators/section-param/section-param.config.json +++ b/src/app/calculators/section-param/section-param.config.json @@ -11,39 +11,28 @@ }, { "type": "input", - "id": "LargeurFond", - "unit": "m", - "nodeType": "SectionTrapeze" + "id": "LargeurBerge", + "unit": "m" }, { "type": "input", - "id": "Fruit", - "nodeType": "SectionTrapeze", - "unit": "m/m" + "id": "LargeurFond", + "unit": "m" }, { "type": "input", - "id": "LargeurBerge", - "unit": "m", - "nodeType": "SectionRectangle" + "id": "Fruit", + "unit": "m/m" }, { "type": "input", "id": "D", - "unit": "m", - "nodeType": "SectionCercle" + "unit": "m" }, { "type": "input", "id": "k", - "unit": "", - "nodeType": "SectionPuissance" - }, - { - "type": "input", - "id": "LargeurBerge", - "unit": "m", - "nodeType": "SectionPuissance" + "unit": "" } ] }, diff --git a/src/app/formulaire/fieldset.ts b/src/app/formulaire/fieldset.ts index 9f112fb4c..2bd0a9434 100644 --- a/src/app/formulaire/fieldset.ts +++ b/src/app/formulaire/fieldset.ts @@ -116,29 +116,16 @@ export class FieldSet extends FormulaireElement implements Observer { */ private parse_input(json: {}, default_radio_config: string): NgParameter { const input_id: string = json["id"]; - let res: NgParameter; - - // @TODO tabarnak !? - const nt: string = json["nodeType"]; - const nodeType: ComputeNodeType = nt ? ComputeNodeType[nt] : this.getPropValue("nodeType"); - - if (nodeType === this.getPropValue("nodeType")) { // si le nodeType du paramètre est le même que celui du fieldset - let nubParam: ParamDefinition; - try { - nubParam = this.getNubParamFromSymbol(input_id); - } catch (e) { - console.error(`FieldSet::parse_input : cannot find param from symbol ${input_id}`); - } - if (nubParam) { - res = new NgParameter(nubParam, this); - } - } - - if (res) { + let nubParam: ParamDefinition; + try { + nubParam = this.getNubParamFromSymbol(input_id); + res = new NgParameter(nubParam, this); res.parseConfig(json, { "radioConfig": default_radio_config }); + } catch (e) { + // parameter does not exist in Nub, it's normal, simply do not show it (silent fail) + // console.error(`FieldSet::parse_input : cannot find param from symbol ${input_id}`); } - return res; } -- GitLab