molgenis / molgenis-emx2

MOLGENIS EMX2, the latest version of the MOLGENIS data platform.
GNU Lesser General Public License v3.0
11 stars 16 forks source link

fix: failed to create blanco database after selecting a different template (+ related fixes) #3933

Open svandenhoek opened 4 days ago

svandenhoek commented 4 days ago

What are the main changes you did:

Using http://localhost:8080/apps/molgenis-components/#/component/InputSelect & http://localhost:8080/apps/central/#/ to explain changes.

Old behavior

1) required showed the first element was automatically selected, yet no modelvalue was set and the first element could only be selected by first selecting another option and then selecting the first one again.

https://github.com/molgenis/molgenis-emx2/assets/7658246/f8f52384-8241-4631-8157-2d11a20107f6

2) If no required & v-model=null, modelvalue is not set. However, if selecting another option and the selecting the empty option again, it becomes modelvalue="" instead.

https://github.com/molgenis/molgenis-emx2/assets/7658246/87aaf9bb-8c11-4f06-a043-9d8fcea3ac96

This caused issues in f.e. Database creation with no template:

https://github.com/molgenis/molgenis-emx2/assets/7658246/795c5491-3628-4a94-b7c2-783196cef2d3

Scherm­afbeelding 2024-06-27 om 18 49 52 Scherm­afbeelding 2024-06-27 om 18 50 18

3) There was a duplicate empty value when creating a new Database. Scherm­afbeelding 2024-06-27 om 19 04 04

New behavior

1) If required, an $emit("update:modelValue" is triggered at <select :modelValue= to update it to the first item in options instead (simply returning the new value without an update showed the outdated value still in HTML).

2) If a @change is detected with a $event.target.value =='', $emit("update:modelValue", null) is done instead of using the actual value. This causes the modelvalue attribute to be removed from select, similar to if no value was selected yet.

https://github.com/molgenis/molgenis-emx2/assets/7658246/8c83380d-ac16-4e58-bd4f-2af2a80fd946

3) Removed the null from options when creating a new Database, as a placeholder option is already generated when not using required.

how to test:

todo:

svandenhoek commented 6 hours ago

Changes:

sonarcloud[bot] commented 6 hours ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud