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

"Upload codelist" functionality in component config #13677

Closed
2 tasks done
nkylstad opened this issue Oct 1, 2024 · 3 comments · Fixed by #13763
Closed
2 tasks done

"Upload codelist" functionality in component config #13677

nkylstad opened this issue Oct 1, 2024 · 3 comments · Fixed by #13763
Labels
backend frontend status/ready-for-specification Status: Used for issues that are ready for functional decription og detailed design. team/studio-domain1

Comments

@nkylstad
Copy link
Member

nkylstad commented Oct 1, 2024

Description

WHY:

As a user, I want to be able to upload an existing (static) codelist to my app when I need to use it in a component.

In scope

Only adding the "Upload codelist" button in the "Add codelists" tab, allowing user to select a JSON codelist file to upload.

Out of scope

  • "Select from library" or any other UI changes shown in the sketches.
  • Adding metadata like codelist name and description

Sketches

Screenshot 2024-10-01 at 23 40 55

Tasks

  • Implement "upload codelist" button
  • Remove texts explaining how to manually upload codelist via Gitea

Additional information

We have a similar button to upload datamodel, can we re-use (and possibly make a Studio-component)?

Acceptance criteria

  • It is possible to upload a codelist from codelist tab when configuring options for a component
  • When the codelist is uploaded it is also selected as option property for the component
  • The uploaded codelist is available to select for other options components
@nkylstad nkylstad added status/ready-for-specification Status: Used for issues that are ready for functional decription og detailed design. team/studio-domain1 labels Oct 1, 2024
@wrt95 wrt95 added the frontend label Oct 2, 2024
@wrt95
Copy link
Contributor

wrt95 commented Oct 7, 2024

Find out if we need validation on frontend or backend or both

@Konrad-Simso
Copy link
Contributor

I've noticed that the PR does not fulfill all acceptance criteria.

  • The uploaded file is not selected automatically.
  • There is no real validation other than JsonSerializer. If it fails the api sends a error code of 500 to the frontend, which is not ideal.

@ErlingHauan
Copy link
Contributor

Testing

Nice work 👏
Tested with various valid and invalid code lists, and it works as expected.

One comment:
When uploading an invalid file, this is the error message:
Image

The backend responds with 400 and the message:

The JSON value could not be converted to System.Collections.Generic.List`1[Altinn.Studio.Designer.Models.Option]

Could we act on this message and display a more specific message in the toast? Maybe something like:

Filen du lastet opp har ikke gyldig format.

@Konrad-Simso Konrad-Simso self-assigned this Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend frontend status/ready-for-specification Status: Used for issues that are ready for functional decription og detailed design. team/studio-domain1
Projects
Status: ✅ Done
Development

Successfully merging a pull request may close this issue.

5 participants