-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug #12685 : hide _sps field when having one value #1900
Bug #12685 : hide _sps field when having one value #1900
Conversation
New Issues
|
...d/projects/vitamui-library/src/app/modules/object-viewer/components/list/list.component.html
Outdated
Show resolved
Hide resolved
...d/projects/vitamui-library/src/app/modules/object-viewer/components/list/list.component.html
Outdated
Show resolved
Hide resolved
...d/projects/vitamui-library/src/app/modules/object-viewer/components/list/list.component.html
Outdated
Show resolved
Hide resolved
- after review changes were made to modify the _sps field only
@@ -132,6 +132,16 @@ export class ArchiveUnitEditObjectService { | |||
displayObject.children.forEach((child) => this.hideLabellessDisplayObjects(child)); | |||
} | |||
|
|||
public hideSpsFieldWithOneValue(displayObject: DisplayObject): void { | |||
const hasOneValue = Boolean(displayObject.displayRule.ui.Path === '#originating_agencies' && displayObject.value.length === 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@IsmailHam87 Pourquoi mettre Boolean(...)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
car dans le cas où il y a plusieurs valeurs, celles-ci devrait s'afficher.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ce que je veux dire, c'est qu'on pourrait très bien écrire : const hasOneValue = displayObject.displayRule.ui.Path === '#originating_agencies' && displayObject.value.length === 1;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah d'accord, je peux l'adapter, est ce que c'est mieux côté perf ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Si ça marche, on peut laisser je pense. Mais c'est surtout que j'ai jamais vu cette manière d'écrire le code et que ça ajoute du code pour rien. L'expression étant déjà un booléen, il n'y a pas de raison d'essayer de la convertir en booléen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
c'est vrai j'ai pas fait attention qu'il fait juste le cast, je vais corriger..
displayObject.displayRule = { ...displayObject.displayRule, ui: { ...displayObject.displayRule.ui, display: false } }; | ||
} | ||
|
||
displayObject.children.forEach((child) => this.hideSpsFieldWithOneValue(child)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@IsmailHam87 A-t-on besoin de parcourir toute l'arborescence ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oui car il faut éviter quelques effets de bords sur d'autres champs autre que _sps
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Il me semblait que le _sps était à la racine et qu'il n'était pas nécessaire d'avoir du code récursif. Mais bon, ça devrait marcher, c'est juste qu'on perds peut-être juste du temps à parcourir toute l'arborescence pour rien.
Description
Description des modifications
Type de changement
Indiquer le ou les types de changements
Documentation
Indiquer la documentation mise à jour
Tests
Indiquer comment le code à été testé (manuel, environnement, TU, etc)
Migration
Indiquer si les modifications apportées impliquent une migration sur l'existant et comment la faire
Checklist
Sélectionner les éléments de la checklist
Contributeur
Indiquer qui a développé cette fonctionnalité