|
|
@ -18,14 +18,12 @@ let users = $ref<UserType[]>([]) |
|
|
|
|
|
|
|
|
|
|
|
let currentPage = $ref(1) |
|
|
|
let currentPage = $ref(1) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const currentLimit = $ref(10) |
|
|
|
const currentLimit = $ref(10) |
|
|
|
|
|
|
|
|
|
|
|
const showUserModal = ref(false) |
|
|
|
const showUserModal = ref(false) |
|
|
|
|
|
|
|
|
|
|
|
const searchText = ref<string>('') |
|
|
|
const searchText = ref<string>('') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const pagination = reactive({ |
|
|
|
const pagination = reactive({ |
|
|
|
total: 0, |
|
|
|
total: 0, |
|
|
|
pageSize: 10, |
|
|
|
pageSize: 10, |
|
|
@ -118,85 +116,84 @@ const copyPasswordResetUrl = async (user: User) => { |
|
|
|
message.error(await extractSdkResponseErrorMsg(e)) |
|
|
|
message.error(await extractSdkResponseErrorMsg(e)) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
</script> |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
<template> |
|
|
|
<template> |
|
|
|
<div> |
|
|
|
<div> |
|
|
|
<div class="text-xl ">User Management</div> |
|
|
|
<div class="text-xl">User Management</div> |
|
|
|
<a-divider class="!my-3" /> |
|
|
|
<a-divider class="!my-3" /> |
|
|
|
<div class="max-w-[900px] mx-auto p-4"> |
|
|
|
<div class="max-w-[900px] mx-auto p-4"> |
|
|
|
<div class="py-2 flex gap-4 items-center"> |
|
|
|
<div class="py-2 flex gap-4 items-center"> |
|
|
|
<a-input-search |
|
|
|
<a-input-search |
|
|
|
v-model:value="searchText" |
|
|
|
v-model:value="searchText" |
|
|
|
size="small" |
|
|
|
|
|
|
|
class="max-w-[300px]" |
|
|
|
|
|
|
|
placeholder="Filter by email" |
|
|
|
|
|
|
|
@blur="loadUsers" |
|
|
|
|
|
|
|
@keydown.enter="loadUsers" |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
</a-input-search> |
|
|
|
|
|
|
|
<div class="flex-grow"></div> |
|
|
|
|
|
|
|
<MdiReload class="cursor-pointer" @click="loadUsers" /> |
|
|
|
|
|
|
|
<a-button size="small" @click="showUserModal = true"> |
|
|
|
|
|
|
|
<div class="flex items-center gap-1"> |
|
|
|
|
|
|
|
<MdiAdd /> |
|
|
|
|
|
|
|
Invite new user |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</a-button> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
<a-table |
|
|
|
|
|
|
|
:row-key="(record) => record.id" |
|
|
|
|
|
|
|
:data-source="users" |
|
|
|
|
|
|
|
:pagination="{ position: ['bottomCenter'] }" |
|
|
|
|
|
|
|
:loading="isLoading" |
|
|
|
|
|
|
|
size="small" |
|
|
|
size="small" |
|
|
|
@change="loadUsers($event.current)" |
|
|
|
class="max-w-[300px]" |
|
|
|
|
|
|
|
placeholder="Filter by email" |
|
|
|
|
|
|
|
@blur="loadUsers" |
|
|
|
|
|
|
|
@keydown.enter="loadUsers" |
|
|
|
> |
|
|
|
> |
|
|
|
<template #emptyText> |
|
|
|
</a-input-search> |
|
|
|
<a-empty :image="Empty.PRESENTED_IMAGE_SIMPLE" :description="$t('labels.noData')" /> |
|
|
|
<div class="flex-grow"></div> |
|
|
|
|
|
|
|
<MdiReload class="cursor-pointer" @click="loadUsers" /> |
|
|
|
|
|
|
|
<a-button size="small" @click="showUserModal = true"> |
|
|
|
|
|
|
|
<div class="flex items-center gap-1"> |
|
|
|
|
|
|
|
<MdiAdd /> |
|
|
|
|
|
|
|
Invite new user |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</a-button> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
<a-table |
|
|
|
|
|
|
|
:row-key="(record) => record.id" |
|
|
|
|
|
|
|
:data-source="users" |
|
|
|
|
|
|
|
:pagination="{ position: ['bottomCenter'] }" |
|
|
|
|
|
|
|
:loading="isLoading" |
|
|
|
|
|
|
|
size="small" |
|
|
|
|
|
|
|
@change="loadUsers($event.current)" |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
<template #emptyText> |
|
|
|
|
|
|
|
<a-empty :image="Empty.PRESENTED_IMAGE_SIMPLE" :description="$t('labels.noData')" /> |
|
|
|
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- Email --> |
|
|
|
|
|
|
|
<a-table-column key="email" :title="$t('labels.email')" data-index="email"> |
|
|
|
|
|
|
|
<template #default="{ text }"> |
|
|
|
|
|
|
|
<div> |
|
|
|
|
|
|
|
{{ text }} |
|
|
|
|
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
|
|
|
|
</a-table-column> |
|
|
|
|
|
|
|
|
|
|
|
<!-- Email --> |
|
|
|
<!-- Role --> |
|
|
|
<a-table-column key="email" :title="$t('labels.email')" data-index="email"> |
|
|
|
<a-table-column key="roles" :title="$t('objects.role')" data-index="roles"> |
|
|
|
<template #default="{ text }"> |
|
|
|
<template #default="{ record }"> |
|
|
|
<div> |
|
|
|
<div> |
|
|
|
{{ text }} |
|
|
|
<div v-if="record.roles.includes('super')" class="font-weight-bold">Super Admin</div> |
|
|
|
</div> |
|
|
|
<a-select |
|
|
|
</template> |
|
|
|
v-else |
|
|
|
</a-table-column> |
|
|
|
v-model:value="record.roles" |
|
|
|
|
|
|
|
class="w-[220px]" |
|
|
|
<!-- Role --> |
|
|
|
:dropdown-match-select-width="false" |
|
|
|
<a-table-column key="roles" :title="$t('objects.role')" data-index="roles"> |
|
|
|
@change="updateRole(record.id, record.roles)" |
|
|
|
<template #default="{ record }"> |
|
|
|
> |
|
|
|
<div> |
|
|
|
<a-select-option :value="Role.OrgLevelCreator" :label="$t(`objects.roleType.orgLevelCreator`)"> |
|
|
|
<div v-if="record.roles.includes('super')" class="font-weight-bold">Super Admin</div> |
|
|
|
<div>{{ $t(`objects.roleType.orgLevelCreator`) }}</div> |
|
|
|
<a-select |
|
|
|
<span class="text-gray-500 text-xs whitespace-normal" |
|
|
|
v-else |
|
|
|
|
|
|
|
v-model:value="record.roles" |
|
|
|
|
|
|
|
class="w-[220px]" |
|
|
|
|
|
|
|
:dropdown-match-select-width="false" |
|
|
|
|
|
|
|
@change="updateRole(record.id, record.roles)" |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
<a-select-option :value="Role.OrgLevelCreator" :label="$t(`objects.roleType.orgLevelCreator`)"> |
|
|
|
|
|
|
|
<div>{{ $t(`objects.roleType.orgLevelCreator`) }}</div> |
|
|
|
|
|
|
|
<span class="text-gray-500 text-xs whitespace-normal" |
|
|
|
|
|
|
|
>Creator can create new projects and access any invited project.</span |
|
|
|
>Creator can create new projects and access any invited project.</span |
|
|
|
> |
|
|
|
> |
|
|
|
</a-select-option> |
|
|
|
</a-select-option> |
|
|
|
|
|
|
|
|
|
|
|
<a-select-option :value="Role.OrgLevelViewer" :label="$t(`objects.roleType.orgLevelViewer`)"> |
|
|
|
<a-select-option :value="Role.OrgLevelViewer" :label="$t(`objects.roleType.orgLevelViewer`)"> |
|
|
|
<div>{{ $t(`objects.roleType.orgLevelViewer`) }}</div> |
|
|
|
<div>{{ $t(`objects.roleType.orgLevelViewer`) }}</div> |
|
|
|
<span class="text-gray-500 text-xs whitespace-normal" |
|
|
|
<span class="text-gray-500 text-xs whitespace-normal" |
|
|
|
>Viewer is not allowed to create new projects but they can access any invited project.</span |
|
|
|
>Viewer is not allowed to create new projects but they can access any invited project.</span |
|
|
|
> |
|
|
|
> |
|
|
|
</a-select-option> |
|
|
|
</a-select-option> |
|
|
|
</a-select> |
|
|
|
</a-select> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
</a-table-column> |
|
|
|
</a-table-column> |
|
|
|
|
|
|
|
|
|
|
|
<!-- <!– Projects –> |
|
|
|
<!-- <!– Projects –> |
|
|
|
<a-table-column key="projectsCount" :title="$t('objects.projects')" data-index="projectsCount"> |
|
|
|
<a-table-column key="projectsCount" :title="$t('objects.projects')" data-index="projectsCount"> |
|
|
|
<template #default="{ text }"> |
|
|
|
<template #default="{ text }"> |
|
|
|
<div> |
|
|
|
<div> |
|
|
@ -205,58 +202,56 @@ const copyPasswordResetUrl = async (user: User) => { |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
</a-table-column> --> |
|
|
|
</a-table-column> --> |
|
|
|
|
|
|
|
|
|
|
|
<!-- Actions --> |
|
|
|
<!-- Actions --> |
|
|
|
|
|
|
|
|
|
|
|
<a-table-column key="id" :title="$t('labels.actions')" data-index="id"> |
|
|
|
<a-table-column key="id" :title="$t('labels.actions')" data-index="id"> |
|
|
|
<template #default="{ text, record }"> |
|
|
|
<template #default="{ text, record }"> |
|
|
|
<div v-if="!record.roles.includes('super')" class="flex items-center gap-2"> |
|
|
|
<div v-if="!record.roles.includes('super')" class="flex items-center gap-2"> |
|
|
|
<MdiDeleteOutline class="nc-action-btn cursor-pointer" @click="deleteUser(text)" /> |
|
|
|
<MdiDeleteOutline class="nc-action-btn cursor-pointer" @click="deleteUser(text)" /> |
|
|
|
|
|
|
|
|
|
|
|
<a-dropdown :trigger="['click']" class="flex" placement="bottomRight" |
|
|
|
<a-dropdown :trigger="['click']" class="flex" placement="bottomRight" overlay-class-name="nc-dropdown-user-mgmt"> |
|
|
|
overlay-class-name="nc-dropdown-user-mgmt"> |
|
|
|
<div class="flex flex-row items-center"> |
|
|
|
<div class="flex flex-row items-center"> |
|
|
|
<a-button type="text" class="!px-0"> |
|
|
|
<a-button type="text" class="!px-0"> |
|
|
|
<div class="flex flex-row items-center h-[1.2rem]"> |
|
|
|
<div class="flex flex-row items-center h-[1.2rem]"> |
|
|
|
<IcBaselineMoreVert /> |
|
|
|
<IcBaselineMoreVert /> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</a-button> |
|
|
|
</a-button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<template #overlay> |
|
|
|
<template #overlay> |
|
|
|
<a-menu> |
|
|
|
<a-menu> |
|
|
|
<template v-if="record.invite_token"> |
|
|
|
<template v-if="record.invite_token"> |
|
|
|
<a-menu-item> |
|
|
|
<a-menu-item> |
|
|
|
<!-- Resend invite Email --> |
|
|
|
<!-- Resend invite Email --> |
|
|
|
<div class="flex flex-row items-center py-3" @click="resendInvite(record)"> |
|
|
|
<div class="flex flex-row items-center py-3" @click="resendInvite(record)"> |
|
|
|
<MdiEmailArrowRightOutline class="flex h-[1rem] text-gray-500" /> |
|
|
|
<MdiEmailArrowRightOutline class="flex h-[1rem] text-gray-500" /> |
|
|
|
<div class="text-xs pl-2">{{ $t('activity.resendInvite') }}</div> |
|
|
|
<div class="text-xs pl-2">{{ $t('activity.resendInvite') }}</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</a-menu-item> |
|
|
|
</a-menu-item> |
|
|
|
<a-menu-item> |
|
|
|
<a-menu-item> |
|
|
|
<div class="flex flex-row items-center py-3" @click="copyInviteUrl(record)"> |
|
|
|
<div class="flex flex-row items-center py-3" @click="copyInviteUrl(record)"> |
|
|
|
|
|
|
|
<MdiContentCopy class="flex h-[1rem] text-gray-500" /> |
|
|
|
|
|
|
|
<div class="text-xs pl-2">{{ $t('activity.copyInviteURL') }}</div> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</a-menu-item> |
|
|
|
|
|
|
|
</template> |
|
|
|
|
|
|
|
<a-menu-item v-else> |
|
|
|
|
|
|
|
<div class="flex flex-row items-center py-3" @click="copyPasswordResetUrl(record)"> |
|
|
|
|
|
|
|
<MdiContentCopy class="flex h-[1rem] text-gray-500" /> |
|
|
|
<MdiContentCopy class="flex h-[1rem] text-gray-500" /> |
|
|
|
<div class="text-xs pl-2">{{ $t('activity.copyPasswordResetURL') }}</div> |
|
|
|
<div class="text-xs pl-2">{{ $t('activity.copyInviteURL') }}</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</a-menu-item> |
|
|
|
</a-menu-item> |
|
|
|
</a-menu> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
<a-menu-item v-else> |
|
|
|
</a-dropdown> |
|
|
|
<div class="flex flex-row items-center py-3" @click="copyPasswordResetUrl(record)"> |
|
|
|
</div> |
|
|
|
<MdiContentCopy class="flex h-[1rem] text-gray-500" /> |
|
|
|
<span v-else></span> |
|
|
|
<div class="text-xs pl-2">{{ $t('activity.copyPasswordResetURL') }}</div> |
|
|
|
</template> |
|
|
|
</div> |
|
|
|
</a-table-column> |
|
|
|
</a-menu-item> |
|
|
|
</a-table> |
|
|
|
</a-menu> |
|
|
|
|
|
|
|
</template> |
|
|
|
<LazyAdminUsersModal :show="showUserModal" @closed="showUserModal = false" @reload="loadUsers" /> |
|
|
|
</a-dropdown> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<span v-else></span> |
|
|
|
|
|
|
|
</template> |
|
|
|
|
|
|
|
</a-table-column> |
|
|
|
|
|
|
|
</a-table> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<LazyAdminUsersModal :show="showUserModal" @closed="showUserModal = false" @reload="loadUsers" /> |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
|