Skip to content

Feat/chain input new form#64

Open
andriacap wants to merge 10 commits intodev-suivi-eolienfrom
feat/chain-input-new-form
Open

Feat/chain input new form#64
andriacap wants to merge 10 commits intodev-suivi-eolienfrom
feat/chain-input-new-form

Conversation

@andriacap
Copy link

@andriacap andriacap commented May 2, 2023

  • chainInput Icon is shown according to "chained" property in config.json
  • resetForm with "keep" property from form is working when chainInput is selected
  • Test chainInput when config is loaded from backend (for site component)

Currently the chainInput Icon is "True" when "chained" is present in config.json

TODO : in other PR , "resolvedProperty" is not working currently cause of the way is set in backend . (See TODO in this PR)

Closes #53

- ChainInput from config json
- Create route from backend to get Properties from config json
- ResolvedProperties (WIP)

Reviewed-by:andriac
[Refs_ticket]: #40
- Solve problem to "keep" value when we are using chainInput
- resetObject is adapt to new Form

Reviewed-by: andriac
[Refs_ticket]: #53
-"keep" property in specific config from types_site works with
chainInput

Reviewed-by: andriac
[Refs_ticket]: #53
Copy link

@mvergez mvergez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quelques changements et remarques :)

methods=["GET"])
def get_config_sites(module_code, object_type, id):
obj = get_config_object(module_code, object_type, id)
return obj['properties']
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Plutôt obj.get('properties', {}) ? Ou on veut que ça plante si l'obj n'a pas de properties ? Ou alors properties est initialisé à {}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

En l'écrivant je n'avais pas pensé au retour d'erreur possible. Effectivement ça peut être une possibilité de renvoyer une erreur , c'est plus un choix d'expérience utilisateur. Est ce que si l'utilisateur renseigne mal ses fichiers de config json , on renvoie une erreur où est ce qu'on veut que ça passe avec des properties vide .

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oui je suis d'accord... A voir si cette route n'est pas appelée autre part où il n'y aurait pas obj['properties']. Je ne crois pas mais à vérifier quand même

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cette route est appelée uniquement dans le component monitorin-form.component-.ts pour charger la config , du coup on laisse le obj[properties] ?
Le cas où "properties" est vide était un cas qui pouvait déjà arrivrer avant. Si une erreur survient elle surviendra pas à ce niveau là du code . Elle surviendra avant dans le fichier qui était déjà présent avant serializer.py :

https://github.com/NaturalSolutions/gn_module_monitoring/blob/d73b7ae9f2a9686cad11671e21cef3b7a6811777/backend/gn_module_monitoring/monitoring/serializer.py#L150-L156

'chain_show'
);
if (chainShow) {
this.chainShow.push(chainShow.map((key) => this.obj.resolvedProperties[key]));
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparemment, dans le problème remonté dans le sites_group cela viendrait de là...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quand tu dis le problème remonté dans le "sites_group" , tu parles de quel problème ? Merci

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pardon, je crois qu'il y avait un problème d'enchaînement des saisies dans les groupes de sites

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Je viens de tester et j'arrive bien à enchainer les saisies de groupe de site avec le commentaire qui reste (car j'ai rajouté 'comment' à 'keep' dans le fichier sites_group.json). Tu arriverais à te souvenir à quel niveau il y aurait le problème ?

}

const schema = this.schema(obj.moduleCode, obj.objectType);
for (const attribut_name of Object.keys(schema)) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Le foreach est mieux je crois en javascript

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

J'ai lu un peu de documentation à ce sujet et en fait en terme de performance c'est pas forcément le cas par contre il est dit que ça rend le code plus concis. A voir !

Source :

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Formulaire] Gérer l'enchaînement des saisies

2 participants