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 roles in role dropdown according to backend #11916

Merged
merged 2 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions changelog/unreleased/bugfix-fix-order-in-roles-drop-down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Bugfix: Fix order in roles drop down

We've fixed an issue where the order of roles in the roles drop down was not correct.
Now the roles are sorted as delegated by the backend.

https://github.com/owncloud/web/pull/11916
https://github.com/owncloud/web/issues/11915
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,14 @@ export default defineComponent({
const availableInternalRoles = inject<Ref<ShareRole[]>>('availableInternalShareRoles')
const availableExternalRoles = inject<Ref<ShareRole[]>>('availableExternalShareRoles')
const availableRoles = computed(() => {
let roles = availableInternalRoles
if (props.isExternal) {
return unref(availableExternalRoles)
roles = availableExternalRoles
}
return unref(availableInternalRoles)

return [...unref(roles)].sort(
(role1, role2) => role1['@libre.graph.weight'] - role2['@libre.graph.weight']
)
})

let initialSelectedRole: ShareRole
Expand Down Expand Up @@ -295,6 +299,7 @@ export default defineComponent({
&:first-child {
margin-top: 0;
}

&:last-child {
margin-bottom: 0;
}
Expand All @@ -312,6 +317,7 @@ export default defineComponent({
}
}
}

&-role-select-btn {
max-width: 100%;
}
Expand Down