debian-mirror-gitlab/app/assets/javascripts/admin/users/components/users_table.vue

86 lines
1.8 KiB
Vue
Raw Normal View History

2021-02-22 17:27:13 +05:30
<script>
import { GlTable } from '@gitlab/ui';
import { __ } from '~/locale';
2021-03-11 19:13:27 +05:30
import UserActions from './user_actions.vue';
2021-03-08 18:12:59 +05:30
import UserAvatar from './user_avatar.vue';
2021-03-11 19:13:27 +05:30
import UserDate from './user_date.vue';
2021-02-22 17:27:13 +05:30
const DEFAULT_TH_CLASSES =
'gl-bg-transparent! gl-border-b-solid! gl-border-b-gray-100! gl-p-5! gl-border-b-1!';
2021-03-08 18:12:59 +05:30
const thWidthClass = (width) => `gl-w-${width}p ${DEFAULT_TH_CLASSES}`;
2021-02-22 17:27:13 +05:30
export default {
components: {
GlTable,
2021-03-08 18:12:59 +05:30
UserAvatar,
2021-03-11 19:13:27 +05:30
UserActions,
UserDate,
2021-02-22 17:27:13 +05:30
},
props: {
users: {
type: Array,
required: true,
},
paths: {
type: Object,
required: true,
},
},
fields: [
{
key: 'name',
label: __('Name'),
thClass: thWidthClass(40),
},
{
key: 'projectsCount',
label: __('Projects'),
thClass: thWidthClass(10),
},
{
key: 'createdAt',
label: __('Created on'),
thClass: thWidthClass(15),
},
{
key: 'lastActivityOn',
label: __('Last activity'),
thClass: thWidthClass(15),
},
{
key: 'settings',
label: '',
thClass: thWidthClass(20),
},
],
};
</script>
<template>
<div>
<gl-table
:items="users"
:fields="$options.fields"
:empty-text="s__('AdminUsers|No users found')"
show-empty
stacked="md"
2021-03-08 18:12:59 +05:30
>
<template #cell(name)="{ item: user }">
2021-03-11 19:13:27 +05:30
<user-avatar :user="user" :admin-user-path="paths.adminUser" />
</template>
<template #cell(createdAt)="{ item: { createdAt } }">
<user-date :date="createdAt" />
</template>
<template #cell(lastActivityOn)="{ item: { lastActivityOn } }">
<user-date :date="lastActivityOn" show-never />
</template>
<template #cell(settings)="{ item: user }">
<user-actions :user="user" :paths="paths" />
2021-03-08 18:12:59 +05:30
</template>
</gl-table>
2021-02-22 17:27:13 +05:30
</div>
</template>