|
|
|
@ -1,6 +1,6 @@
|
|
|
|
|
<script lang="ts" setup> |
|
|
|
|
import { OrderedProjectRoles, RoleColors, RoleLabels } from 'nocodb-sdk' |
|
|
|
|
import type { ProjectRoles, WorkspaceUserType } from 'nocodb-sdk' |
|
|
|
|
import type { WorkspaceUserType } from 'nocodb-sdk' |
|
|
|
|
import { OrderedProjectRoles, ProjectRoles, RoleColors, RoleLabels } from 'nocodb-sdk' |
|
|
|
|
import InfiniteLoading from 'v3-infinite-loading' |
|
|
|
|
import { isEeUI, storeToRefs, stringToColour, timeAgo, useGlobal } from '#imports' |
|
|
|
|
|
|
|
|
@ -35,7 +35,7 @@ const loadCollaborators = async () => {
|
|
|
|
|
...user, |
|
|
|
|
projectRoles: user.roles, |
|
|
|
|
// TODO: Remove this hack and make the values consistent with the backend |
|
|
|
|
roles: user.roles ?? (RoleLabels[user.workspace_roles as string] as string)?.toLowerCase(), |
|
|
|
|
roles: user.roles ?? (RoleLabels[user.workspace_roles as string] as string)?.toLowerCase() ?? ProjectRoles.NO_ACCESS, |
|
|
|
|
})), |
|
|
|
|
] |
|
|
|
|
} catch (e: any) { |
|
|
|
@ -74,7 +74,7 @@ onMounted(async () => {
|
|
|
|
|
|
|
|
|
|
const updateCollaborator = async (collab, roles) => { |
|
|
|
|
try { |
|
|
|
|
if (!roles || roles === 'inherit') { |
|
|
|
|
if (!roles || roles === 'inherit' || (roles === ProjectRoles.NO_ACCESS && !isEeUI)) { |
|
|
|
|
await removeProjectUser(activeProjectId.value!, collab) |
|
|
|
|
collab.projectRoles = null |
|
|
|
|
} else if (collab.projectRoles) { |
|
|
|
@ -188,7 +188,6 @@ const accessibleRoles = computed<(typeof ProjectRoles)[keyof typeof ProjectRoles
|
|
|
|
|
:virtual="true" |
|
|
|
|
:placeholder="$t('labels.noAccess')" |
|
|
|
|
:disabled="collab.id === user?.id || (collab.roles && !accessibleRoles.includes(collab.roles))" |
|
|
|
|
:allow-clear="!isEeUI" |
|
|
|
|
@change="(value) => updateCollaborator(collab, value)" |
|
|
|
|
> |
|
|
|
|
<template #suffixIcon> |
|
|
|
|