-
Notifications
You must be signed in to change notification settings - Fork 23
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
Conversation
This pull request is deployed at test.admin-interface.opencast.org/575/2024-06-04_14-09-11/ . |
Use Run test server using develop.opencast.org as backend:
Specify a different backend like stable.opencast.org:
It may take a few seconds for the interface to spin up. |
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)) |
src/utils/dropDownUtils.ts
Outdated
const hasCustomOrder = unformattedOptions.some((item: any) => | ||
isJson(item.name) && JSON.parse(item.name).order !== undefined); | ||
|
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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.
return hasCustomOrder | ||
? formattedOptions |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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 pull request is deployed at test.admin-interface.opencast.org/575/2024-06-04_16-20-27/ . |
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