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

Improve user details panel #8331

Merged
merged 8 commits into from
Jan 31, 2023
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Enhancement: Admin settings users section details improvement

We've improved the details panel in the user's section to show the assigned groups and total quota

https://github.com/owncloud/web/pull/8331
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<td v-text="user.onPremisesSamAccountName" />
</tr>
<tr>
<th scope="col" class="oc-pr-s" v-text="$gettext('Display name')" />
<th scope="col" class="oc-pr-s" v-text="$gettext('First and last name')" />
<td v-text="user.displayName" />
</tr>
<tr>
Expand All @@ -34,6 +34,25 @@
<span v-if="user.appRoleAssignments" v-text="roleDisplayName" />
</td>
</tr>
<tr>
<th scope="col" class="oc-pr-s" v-text="$gettext('Quota')" />
<td>
<span v-if="showUserQuota" v-text="quotaDisplayValue" />
<span
v-else
class="oc-text-meta"
v-text="
$gettext('To see an individual quota, the user needs to have logged in once.')
"
/>
</td>
</tr>
<tr>
<th scope="col" class="oc-pr-s" v-text="$gettext('Groups')" />
<td>
<span v-if="user.appRoleAssignments" v-text="groupsDisplayValue" />
</td>
</tr>
</table>
</div>
</div>
Expand All @@ -43,6 +62,8 @@ import { defineComponent } from 'vue'
import UserInfoBox from './UserInfoBox.vue'
import { PropType } from 'vue'
import { User } from 'web-client/src/generated'
import { formatFileSize } from 'web-pkg/src/helpers'
import { useGettext } from 'vue3-gettext'

export default defineComponent({
name: 'DetailsPanel',
Expand All @@ -63,6 +84,14 @@ export default defineComponent({
required: true
}
},
setup() {
const { $gettext, current: currentLanguage } = useGettext()

return {
$gettext,
currentLanguage
}
},
computed: {
noUsers() {
return !this.users.length
Expand All @@ -81,6 +110,20 @@ export default defineComponent({
return this.$gettext(
this.roles.find((role) => role.id === assignedRole.appRoleId)?.displayName || ''
)
},
groupsDisplayValue() {
return this.user.memberOf
.map((group) => group.displayName)
.sort()
.join(', ')
},
showUserQuota() {
return 'total' in (this.user.drive?.quota || {})
},
quotaDisplayValue() {
return this.user.drive.quota.total === 0
? this.$gettext('No restriction')
: formatFileSize(this.user.drive.quota.total, this.currentLanguage)
}
}
})
Expand Down