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

Feature/pxweb2 198 add ability to change codelist on variable #336

Conversation

SjurSutterudSagen
Copy link
Contributor

This adds an API call that returns the new values for a chosen codelist
in the VariableBox, and plugs that into the existing code for showing
new codelists. This means the VariableBox and state now can handle
changing codelists and rendering them.

I also formatted some files.

This adds an API call that returns the new values for a chosen codelist
in the VariableBox, and plugs that into the existing code for showing
new codelists. This means the VariableBox and state now can handle
chaning codelists and rendering them. However, the sync to the table is
not yet finished. It now stops showing any new values chosen, and shows
very little.

It also resets the chosen codelists when changing a language, since we
cannot reuse values for codelists between languages.
The task has been divided, and the part of getting and showing the
defaultSelection for the CodeLists have been moved to a different task.
This cleans up the branch and commits the current WIP changes for the
new scope of the task.
This makes a new API-call and changes the values of a variable with a
selected codelist, when the user makes a new codelist selection.

The functinality for resetting to the default selection when switching
languages have not been implemented yet.

This code is missing the fix for the updated API, to get the correct
metadata. So it will still show the incorrect data on first load.
@SjurSutterudSagen
Copy link
Contributor Author

It's best to wait with this one so we can get the API fix merged into it. Will make it much easier to test, when the values are actually correct from the beginning.

Copy link

cloudflare-workers-and-pages bot commented Nov 13, 2024

Deploying pxweb2 with  Cloudflare Pages  Cloudflare Pages

Latest commit: 4f3c2c5
Status: ✅  Deploy successful!
Preview URL: https://f8cf5ec6.pxweb2.pages.dev
Branch Preview URL: https://feature-pxweb2-198-add-abili.pxweb2.pages.dev

View logs

Since the variant of the Select component used in the variablebox is
it's own component, we do not need the same internal state management as
the default Select component. It will only get in the way of how we want
to update that componentent from the VaraiblesProvider state in the
Selection component/page.
Since we need to be able to handle whenever the api call fails when
changing codelists, we need to add the logic for this. This handles that
logic, but does not handle showing anything to the user when it happens.
That is something we need to speak with the designer about how it should
be handled.
@SjurSutterudSagen SjurSutterudSagen marked this pull request as ready for review November 25, 2024 15:07
@SjurSutterudSagen SjurSutterudSagen requested review from a team November 25, 2024 15:07
There was a problem with a race condition when rendering kodelist
values. This adds a check that fixes this, though we may want to look
closer at this later. Now atleast the app does not crash.
Since Virtuoso "heavily" complains if we return null or similar, this
modifies the previous fix to return an empty div. This div is not
rendered, but instead removed by virtuoso before hand.
@github-advanced-security
Copy link

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

Since we need to indicate to the users when we are waiting on the api
response, when they change a codelist. We need some basic functionality
for this while the designer looks into how we want this to function in
the end. This is a temporary fix, which is similar to the table fading.
This adds resetting some states in the variableboxes when you change
codelists in the variable. This fixes some issues with the virtuoso list
and search remembering states into a new codelist.
Copy link

sonarqubecloud bot commented Dec 6, 2024

Copy link
Contributor

@PerIngeVaaje PerIngeVaaje left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK!

@MikaelNordberg MikaelNordberg merged commit 7b883bd into main Dec 12, 2024
12 checks passed
@MikaelNordberg MikaelNordberg deleted the feature/PXWEB2-198-add-ability-to-change-codelist-on-variable branch December 12, 2024 08:46
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.

3 participants