début nouvelle config types ES

This commit is contained in:
Jean-Christophe Engel 2025-02-17 08:56:57 +01:00
parent b6de0c59c0
commit b19904b05b
10 changed files with 122 additions and 74 deletions

View file

@ -8,29 +8,41 @@
{{* config par défaut *}}
{{:read file="./defaut.json" assign="config_defaut"}}
{{:assign config_defaut=$config_defaut|json_decode}}
{{*:debug config_defaut=$config_defaut*}}
{{if $module.config.input_nature != null}}
{{*:debug module.config.input_nature=$module.config.input_nature*}}
{{#foreach from=$module.config.input_nature item="elem"}}
{{:assign var="config.input_nature.%s"|args:$elem.label value=$elem.type}}
{{#foreach from=$elem key=label item=value}}
{{:assign var="in.%s"|args:$label value=$value}}
{{/foreach}}
{{:assign var="config.input_nature." from="in"}}
{{/foreach}}
{{else}}
{{* pas de config enregistrée : utiliser la config par défaut *}}
{{#foreach from=$config_defaut.inputs item="elem"}}
{{#foreach from=$elem key=label item=value}}
{{:assign var="config.input_nature.%s"|args:$label value=$value}}
{{:assign var="in.%s"|args:$label value=$value}}
{{/foreach}}
{{:assign var="config.input_nature." from="in"}}
{{/foreach}}
{{/if}}
{{*:debug config.input_nature=$config.input_nature*}}
{{if $module.config.output_nature != null}}
{{*:debug module.config.output_nature=$module.config.output_nature*}}
{{#foreach from=$module.config.output_nature item="elem"}}
{{:assign var="config.output_nature.%s"|args:$elem.label value=$elem.type}}
{{#foreach from=$elem key=label item=value}}
{{:assign var="out.%s"|args:$label value=$value}}
{{/foreach}}
{{:assign var="config.output_nature." from="out"}}
{{/foreach}}
{{else}}
{{* pas de config enregistrée : utiliser la config par défaut *}}
{{#foreach from=$config_defaut.outputs item="elem"}}
{{#foreach from=$elem key=label item=value}}
{{:assign var="config.output_nature.%s"|args:$label value=$value}}
{{:assign var="out.%s"|args:$label value=$value}}
{{/foreach}}
{{:assign var="config.output_nature." from="out"}}
{{/foreach}}
{{/if}}