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

Sort specific lists in dropdown menu alphabetically #575

Merged
merged 1 commit into from
Jun 7, 2024

Conversation

owi92
Copy link
Contributor

@owi92 owi92 commented Jun 4, 2024

This adds a function to check whether the options for a dropdown menu are custom ordered. If they are not, the resulting list is ordered alphabetically. Otherwise the ordering is left as is (this would be the case for the "license" field for example).

Closes #567

Copy link
Contributor

github-actions bot commented Jun 4, 2024

This pull request is deployed at test.admin-interface.opencast.org/575/2024-06-04_14-09-11/ .
It might take a few minutes for it to become available.

Copy link
Contributor

github-actions bot commented Jun 4, 2024

Use docker or podman to test this pull request locally.

Run test server using develop.opencast.org as backend:

podman run --rm -it -p 127.0.0.1:3000:3000 ghcr.io/opencast/opencast-admin-interface:pr-575

Specify a different backend like stable.opencast.org:

podman run --rm -it -p 127.0.0.1:3000:3000 -e PROXY_TARGET=https://stable.opencast.org ghcr.io/opencast/opencast-admin-interface:pr-575

It may take a few seconds for the interface to spin up.
It will then be available at http://127.0.0.1:3000.
For more options you can pass on to the proxy, take a look at the README.md.

@owi92 owi92 added the type:usability Improves the UX label Jun 4, 2024
@ziegenberg ziegenberg self-requested a review June 4, 2024 14:14
@snoesberger
Copy link
Contributor

I can confirm that the sorting is working. I tested it for the event language and series drop down field in the modify pop-up. The licence field isn't sorted, because this is handled by the opencast config (see comment #567 (comment))

Comment on lines 55 to 57
const hasCustomOrder = unformattedOptions.some((item: any) =>
isJson(item.name) && JSON.parse(item.name).order !== undefined);

Copy link
Member

Choose a reason for hiding this comment

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

If I understand this correctly, this will only indicate if any of the items has a field order.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that is correct. I suppose this could check instead if all items have that field - or are you saying that checking for that simply isn't enough to imply custom ordering? If that is the case, I'm honestly not sure how else to do it.

Comment on lines +123 to +130
return hasCustomOrder
? formattedOptions
Copy link
Member

Choose a reason for hiding this comment

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

If any item has a field order, this will not use the order field for sorting, but stop sorting this at all. Or am I mistaken.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, good point. I didn't touch this because I somehow thought they would already be ordered as configured, but now that you mention it I checked, and that does not seem to be the case.

@ziegenberg ziegenberg removed their request for review June 4, 2024 15:18
This adds a function to check whether the options for a
dropdown menu are custom ordered. If they are not, the
resulting list is ordered alphabetically. Otherwise the
ordering is left as is.
Copy link
Contributor

github-actions bot commented Jun 4, 2024

This pull request is deployed at test.admin-interface.opencast.org/575/2024-06-04_16-20-27/ .
It might take a few minutes for it to become available.

@owi92 owi92 requested a review from lkiesow June 6, 2024 09:43
@lkiesow lkiesow self-assigned this Jun 7, 2024
@lkiesow lkiesow merged commit 93efe8a into opencast:main Jun 7, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:usability Improves the UX
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sort list in drop down fields
3 participants