Altinn / altinn-studio

Next generation open source Altinn platform and applications.
https://docs.altinn.studio
BSD 3-Clause "New" or "Revised" License
115 stars 70 forks source link

Make it possible to switch types with StudioCodeListEditor #13977

Open ErlingHauan opened 1 week ago

ErlingHauan commented 1 week ago

A code list's value should support strings, numbers and booleans. Per now we only support strings in the frontend.

When a code list with numbers or booleans is changed in the editor, the editor will likely change the value to a string.

We need to update the code list editor with the following acceptance criterias:

Given that the code lists will eventually be used in a data model, a single, consistent type should be set for all the values in the list.

Annikenkbrathen commented 6 days ago

After a discussion with @ErlingHauan , we agreed to explore how we can implement the selection in the table. Design is looking into whether it can be placed next to the header for values, and whether a Switch or the selection itself can function within the table. The alternative is to have it outside the table, but in the modal, so that it is clear it belongs to the value in the table.

The values the user can choose to set are numbers, text, and boolean. The value must be the same across all fields in the same code list

Annikenkbrathen commented 5 days ago

Could this work @ErlingHauan. I just used a combox in the header and tried to make it as simple as possible.

Image

I was also thinking about something. For example, if we switch from text to numbers here, we need to be able to validate the fields that are set and ask the user to change the fields from text to numbers.

ErlingHauan commented 5 days ago

Absolutely 🙌

The editor already has some validation for duplicate values. We can implement something similar for types.

Image

Annikenkbrathen commented 1 day ago

@ErlingHauan can we close this issue?

ErlingHauan commented 23 hours ago

Moving it back to Todo, since it's ready for dev 😊