Skip to content
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

Add checklist string type #295

Merged
merged 6 commits into from Mar 14, 2024
Merged

Add checklist string type #295

merged 6 commits into from Mar 14, 2024

Conversation

dgiannico19
Copy link
Contributor

@dgiannico19 dgiannico19 commented Mar 12, 2024

Link al ticket

Descripción del requerimiento

  • Se necesita que el componente Checklist, pueda recibir las props NO requeridas translateSectionLabel, translateGroupLabel y translateCheckboxLabel , como bolleano como siempre pero ahora también string
  • Dicho string debe tener 2 niveles, ya que se va a tratar de una traduccion
  • Si viene como string, no debe permitir que el primer nivel sea ni views ni common, ya que no deberían usar esos niveles desde el back

Descripción de la solución

  • Se agregó en el checklist la posibilidad de darle un valor string ademas del booleano en las props mencionadas
  • Se agrego un caso en el edit.yml y expected edit.json en el que hay un componente llamado ChecklistThree que recibe una de las props como string con 2 niveles

Cómo se puede probar?

  • Primero correr npm run test para validar que funciona todo bien
  • Se agrego un unico Checklist disponible para probar
    El caso de tests/mocks/schemas/edit.yml
    El caso tests/mocks/schemas/expected/edit.json

EN ambos casos se utiliza el componente llamado ChecklistThree

En todos los casos, para probar todos los test, ejecutar npm run test
Para probara individualmente los cambios, ejecutamos
yml: node index.js validate -i tests/mocks/schemas/edit.yml
json: node index.js validate -i tests/mocks/schemas/expected/edit.json

Para probarlo podemos cambiar en ambos lugares el valor de los checklist, casos de prueba
Llega string con un solo nivel
json
{ "name": "checklistThree", "component": "CheckList", "componentAttributes": { "optionsSource": { "service": "sac", "namespace": "claim-motive", "method": "list", "resolve": false }, "sectionField": "claimMotiveName", "groupField": "statusName", "labelField": "name", "valueField": "id", "translateSectionLabel": true, "translateGroupLabel": "levelone", "translateCheckboxLabel": false } },
yml
- name: checklistThree component: CheckList componentAttributes: optionsSource: service: sac namespace: claim-motive method: list resolve: false sectionField: claimMotiveName groupField: statusName labelField: name valueField: id translateSectionLabel: true translateGroupLabel: levelone translateCheckboxLabel: false

Llega string con un tres niveles
json
{ "name": "checklistThree", "component": "CheckList", "componentAttributes": { "optionsSource": { "service": "sac", "namespace": "claim-motive", "method": "list", "resolve": false }, "sectionField": "claimMotiveName", "groupField": "statusName", "labelField": "name", "valueField": "id", "translateSectionLabel": true, "translateGroupLabel": "levelone.leveltwo.levelthree", "translateCheckboxLabel": false } },
yml
- name: checklistThree component: CheckList componentAttributes: optionsSource: service: sac namespace: claim-motive method: list resolve: false sectionField: claimMotiveName groupField: statusName labelField: name valueField: id translateSectionLabel: true translateGroupLabel: levelone.leveltwo.levelthree translateCheckboxLabel: false

Llega string con views como primer nivel
json
{ "name": "checklistThree", "component": "CheckList", "componentAttributes": { "optionsSource": { "service": "sac", "namespace": "claim-motive", "method": "list", "resolve": false }, "sectionField": "claimMotiveName", "groupField": "statusName", "labelField": "name", "valueField": "id", "translateSectionLabel": true, "translateGroupLabel": "views.leveltwo", "translateCheckboxLabel": false } },
yml
- name: checklistThree component: CheckList componentAttributes: optionsSource: service: sac namespace: claim-motive method: list resolve: false sectionField: claimMotiveName groupField: statusName labelField: name valueField: id translateSectionLabel: true translateGroupLabel: views.leveltwo translateCheckboxLabel: false

Llega string con un el primer nivel como common
json
{ "name": "checklistThree", "component": "CheckList", "componentAttributes": { "optionsSource": { "service": "sac", "namespace": "claim-motive", "method": "list", "resolve": false }, "sectionField": "claimMotiveName", "groupField": "statusName", "labelField": "name", "valueField": "id", "translateSectionLabel": true, "translateGroupLabel": "common.leveltwo", "translateCheckboxLabel": false } },
yml
- name: checklistThree component: CheckList componentAttributes: optionsSource: service: sac namespace: claim-motive method: list resolve: false sectionField: claimMotiveName groupField: statusName labelField: name valueField: id translateSectionLabel: true translateGroupLabel: common.leveltwo translateCheckboxLabel: false

En todos estos casos debería tirar un error admeas de la posibilidad de ser booleano:
'should match pattern "^(?!views|common)[a-zA-Z]+\.[a-zA-Z]+$"'
ya que no cumple con el requisito de que sean 2 niveles y el primero no sea ni views ni common

Link a la documentación

Datos extra a tener en cuenta

  • El tema de que desde back no pueda recibir views ni common es porque son valores que debe manejar views, si cometen un error desde el back con ellos pueden afectar a todas nuestras traducciones

Changelog

### Added
- New value to Checklist props

@colomfernando colomfernando merged commit ac6ab70 into master Mar 14, 2024
4 checks passed
@colomfernando colomfernando deleted the add-checklist-string-type branch March 14, 2024 12:17
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.

None yet

2 participants