Skip to content
Snippets Groups Projects
Commit 99ccf05b authored by francois.grand's avatar francois.grand
Browse files

#27 : fichier de conf des calculettes : ajout d'un champ calcType renseignant...

 #27 : fichier de conf des calculettes : ajout d'un champ calcType renseignant le CalculatorType et d'un champ nodeType renseignant le ComputeNodeType d'un fieldset
parent 8efe923a
No related branches found
No related tags found
1 merge request!12Resolve "Ajout de la calculette "Ouvrages hydrauliques""
......@@ -28,6 +28,8 @@
{
"id": "fs_struct_cem88d",
"type": "fieldset_template",
"calcType": "Structure",
"nodeType": "StructureRectangle",
"structType": "Cem88d",
"option": "cal",
"fields": [
......@@ -53,6 +55,8 @@
{
"id": "fs_struct_cem88v",
"type": "fieldset_template",
"calcType": "Structure",
"nodeType": "StructureRectangle",
"structType": "Cem88v",
"option": "cal",
"fields": [
......
......@@ -490,9 +490,9 @@ export class FormulaireDefinition extends Observable implements Observer {
return res;
}
private parse_input(node_type: ComputeNodeType, fieldset: {}, field: {}): NgParameter {
private parse_input(calc_type: CalculatorType, node_type: ComputeNodeType, fieldset: {}, field: {}): NgParameter {
let input_id: string = field["id"];
let res: NgParameter = this.paramService.createParameter(this._calcType, node_type, input_id, this._uid);
let res: NgParameter = this.paramService.createParameter(calc_type, node_type, input_id, this._uid);
if (res == undefined)
throw new Error(`pas de paramètre '${input_id}' trouvé dans le noeud ${ComputeNodeType[node_type]} (${node_type}) ou ComputeNodeType.None`);
......@@ -514,6 +514,10 @@ export class FormulaireDefinition extends Observable implements Observer {
private parse_fieldset(json: {}) {
const fs_id: string = json["id"];
const ct: string = json["calcType"];
let calc_type: CalculatorType = ct == undefined ? this._calcType : CalculatorType[ct];
const nt: string = json["nodeType"];
let node_type: ComputeNodeType = nt == undefined ? ComputeNodeType.None : ComputeNodeType[nt];
......@@ -523,8 +527,9 @@ export class FormulaireDefinition extends Observable implements Observer {
const fields = json["fields"];
for (const field_index in fields) {
const field = fields[field_index];
if (field["type"] === "input") {
const param = this.parse_input(node_type, json, field);
const param = this.parse_input(calc_type, node_type, json, field);
res.addField(param);
} else if (field["type"] === "select") {
const param = this.parse_select(node_type, field);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment