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

Allow scrolling in users and groups list #7321

Merged
merged 5 commits into from
Jul 26, 2022
Merged
Show file tree
Hide file tree
Changes from 4 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Bugfix: Missing scroll bar in user management app

We've fixed a bug in the user management app where no scroll bar was displayed in the users or groups list
if it exceeds the screen size.

https://github.com/owncloud/web/pull/7321
https://github.com/owncloud/web/issues/7266
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
:fields="fields"
:data="data"
:highlighted="highlighted"
:sticky="true"
:header-position="headerPosition"
@sort="handleSort"
>
<template #selectHeader>
Expand Down Expand Up @@ -74,6 +76,10 @@ export default {
selectedGroups: {
type: Array,
required: true
},
headerPosition: {
type: Number,
required: true
}
},
setup() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
:fields="fields"
:data="data"
:highlighted="highlighted"
:sticky="true"
:header-position="headerPosition"
@sort="handleSort"
>
<template #selectHeader>
Expand Down Expand Up @@ -83,6 +85,10 @@ export default {
selectedUsers: {
type: Array,
required: true
},
headerPosition: {
type: Number,
required: true
}
},
setup() {
Expand Down
27 changes: 25 additions & 2 deletions packages/web-app-user-management/src/views/Groups.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
<main class="oc-flex oc-height-1-1 app-content oc-width-1-1">
<app-loading-spinner v-if="loadResourcesTask.isRunning" />
<template v-else>
<div class="files-list-wrapper oc-width-expand">
<div class="oc-app-bar oc-p-m">
<div id="groups-wrapper" class="oc-width-expand">
<div id="groups-app-bar" ref="appBar" class="oc-app-bar oc-p-m">
<div class="oc-flex oc-flex-between">
<oc-breadcrumb class="oc-flex oc-flex-middle" :items="breadcrumbs" />
<div>
Expand Down Expand Up @@ -72,6 +72,7 @@
<GroupsList
:groups="groups"
:selected-groups="selectedGroups"
:header-position="listHeaderPosition"
class="oc-mt-m"
@toggleSelectGroup="toggleSelectGroup"
@toggleSelectAllGroups="toggleSelectAllGroups"
Expand Down Expand Up @@ -151,6 +152,7 @@ export default defineComponent({
},
data: function () {
return {
listHeaderPosition: 0,
selectedGroups: [],
createGroupModalOpen: false,
deleteGroupModalOpen: false,
Expand Down Expand Up @@ -228,13 +230,20 @@ export default defineComponent({
this.loadResourcesTask.perform(this)
})

this.calculateListHeaderPosition()

window.addEventListener('resize', this.calculateListHeaderPosition)

this.$on('beforeDestroy', () => {
bus.unsubscribe('app.user-management.list.load', loadResourcesEventToken)
})
},

methods: {
...mapActions(['showMessage']),
calculateListHeaderPosition() {
this.listHeaderPosition = this.$refs.appBar.getBoundingClientRect().height
},
toggleSelectAllGroups() {
if (this.allGroupsSelected) {
return (this.selectedGroups = [])
Expand Down Expand Up @@ -371,6 +380,20 @@ export default defineComponent({
</script>

<style lang="scss">
#groups-app-bar {
background-color: var(--oc-color-background-default);
border-top-right-radius: 15px;
box-sizing: border-box;
z-index: 2;
position: sticky;
padding: 0 var(--oc-space-medium);
top: 0;
}

#groups-wrapper {
overflow-y: auto;
}

.groups-sidebar {
position: relative;
overflow: hidden;
Expand Down
28 changes: 25 additions & 3 deletions packages/web-app-user-management/src/views/Users.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
<main class="oc-flex oc-height-1-1 app-content oc-width-1-1">
<app-loading-spinner v-if="loadResourcesTask.isRunning" />
<template v-else>
<div class="files-list-wrapper oc-width-expand">
<div class="oc-app-bar oc-p-m">
<div id="users-wrapper" class="oc-width-expand">
<div id="users-app-bar" ref="appBar" class="oc-p-m">
<div class="oc-flex oc-flex-between">
<oc-breadcrumb class="oc-flex oc-flex-middle" :items="breadcrumbs" />
<div>
Expand Down Expand Up @@ -72,6 +72,7 @@
<UsersList
:users="users"
:selected-users="selectedUsers"
:header-position="listHeaderPosition"
class="oc-mt-m"
@toggleSelectUser="toggleSelectUser"
@toggleSelectAllUsers="toggleSelectAllUsers"
Expand Down Expand Up @@ -232,6 +233,7 @@ export default defineComponent({
},
data: function () {
return {
listHeaderPosition: 0,
selectedUsers: [],
createUserModalOpen: false,
deleteUserModalOpen: false,
Expand Down Expand Up @@ -315,20 +317,26 @@ export default defineComponent({
this.loadResourcesTask.perform(this)
})

this.calculateListHeaderPosition()

window.addEventListener('resize', this.calculateListHeaderPosition)

this.$on('beforeDestroy', () => {
bus.unsubscribe('app.user-management.list.load', loadResourcesEventToken)
})
},

methods: {
...mapActions(['showMessage']),
calculateListHeaderPosition() {
this.listHeaderPosition = this.$refs.appBar.getBoundingClientRect().height
},
toggleSelectAllUsers() {
if (this.allUsersSelected) {
return (this.selectedUsers = [])
}
this.selectedUsers = [...this.users]
},

toggleSelectUser(toggledUser) {
const isUserSelected = this.selectedUsers.find((user) => user.id === toggledUser.id)

Expand Down Expand Up @@ -529,6 +537,20 @@ export default defineComponent({
})
</script>
<style lang="scss">
#users-app-bar {
background-color: var(--oc-color-background-default);
border-top-right-radius: 15px;
box-sizing: border-box;
z-index: 2;
position: sticky;
padding: 0 var(--oc-space-medium);
top: 0;
}

#users-wrapper {
overflow-y: auto;
}

.users-sidebar {
position: relative;
overflow: hidden;
Expand Down