|
|
@ -9,6 +9,7 @@ import { |
|
|
|
projectRoleTagColors, |
|
|
|
projectRoleTagColors, |
|
|
|
projectRoles, |
|
|
|
projectRoles, |
|
|
|
ref, |
|
|
|
ref, |
|
|
|
|
|
|
|
useActiveKeyupListener, |
|
|
|
useCopy, |
|
|
|
useCopy, |
|
|
|
useDashboard, |
|
|
|
useDashboard, |
|
|
|
useI18n, |
|
|
|
useI18n, |
|
|
@ -44,7 +45,7 @@ const { copy } = useCopy() |
|
|
|
|
|
|
|
|
|
|
|
const { dashboardUrl } = $(useDashboard()) |
|
|
|
const { dashboardUrl } = $(useDashboard()) |
|
|
|
|
|
|
|
|
|
|
|
const usersData = $ref<Users>({ emails: undefined, role: ProjectRole.Viewer, invitationToken: undefined }) |
|
|
|
let usersData = $ref<Users>({ emails: undefined, role: ProjectRole.Viewer, invitationToken: undefined }) |
|
|
|
|
|
|
|
|
|
|
|
const formRef = ref() |
|
|
|
const formRef = ref() |
|
|
|
|
|
|
|
|
|
|
@ -80,6 +81,11 @@ onMounted(() => { |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const close = () => { |
|
|
|
|
|
|
|
emit('closed') |
|
|
|
|
|
|
|
usersData = { role: ProjectRole.Viewer } |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const saveUser = async () => { |
|
|
|
const saveUser = async () => { |
|
|
|
$e('a:user:invite', { role: usersData.role }) |
|
|
|
$e('a:user:invite', { role: usersData.role }) |
|
|
|
|
|
|
|
|
|
|
@ -95,7 +101,7 @@ const saveUser = async () => { |
|
|
|
project_id: project.value.id, |
|
|
|
project_id: project.value.id, |
|
|
|
projectName: project.value.title, |
|
|
|
projectName: project.value.title, |
|
|
|
}) |
|
|
|
}) |
|
|
|
emit('closed') |
|
|
|
close() |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
const res = await $api.auth.projectUserAdd(project.value.id, { |
|
|
|
const res = await $api.auth.projectUserAdd(project.value.id, { |
|
|
|
roles: usersData.role, |
|
|
|
roles: usersData.role, |
|
|
@ -135,9 +141,28 @@ const clickInviteMore = () => { |
|
|
|
usersData.emails = undefined |
|
|
|
usersData.emails = undefined |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const emailField = (inputEl: typeof Input) => { |
|
|
|
const emailField = ref<typeof Input>() |
|
|
|
inputEl?.$el?.focus() |
|
|
|
|
|
|
|
|
|
|
|
useActiveKeyupListener( |
|
|
|
|
|
|
|
computed(() => show), |
|
|
|
|
|
|
|
(e: KeyboardEvent) => { |
|
|
|
|
|
|
|
if (e.key === 'Escape') { |
|
|
|
|
|
|
|
close() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ immediate: true }, |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
watch( |
|
|
|
|
|
|
|
() => show, |
|
|
|
|
|
|
|
async (val) => { |
|
|
|
|
|
|
|
if (val) { |
|
|
|
|
|
|
|
await nextTick() |
|
|
|
|
|
|
|
emailField.value?.$el?.focus() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ immediate: true }, |
|
|
|
|
|
|
|
) |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
<template> |
|
|
|
<template> |
|
|
@ -149,7 +174,7 @@ const emailField = (inputEl: typeof Input) => { |
|
|
|
:closable="false" |
|
|
|
:closable="false" |
|
|
|
width="max(50vw, 44rem)" |
|
|
|
width="max(50vw, 44rem)" |
|
|
|
wrap-class-name="nc-modal-invite-user-and-share-base" |
|
|
|
wrap-class-name="nc-modal-invite-user-and-share-base" |
|
|
|
@cancel="emit('closed')" |
|
|
|
@cancel="close" |
|
|
|
> |
|
|
|
> |
|
|
|
<div class="flex flex-col" data-testid="invite-user-and-share-base-modal"> |
|
|
|
<div class="flex flex-col" data-testid="invite-user-and-share-base-modal"> |
|
|
|
<div class="flex flex-row justify-between items-center pb-1.5 mb-2 border-b-1 w-full"> |
|
|
|
<div class="flex flex-row justify-between items-center pb-1.5 mb-2 border-b-1 w-full"> |
|
|
@ -159,7 +184,7 @@ const emailField = (inputEl: typeof Input) => { |
|
|
|
type="text" |
|
|
|
type="text" |
|
|
|
class="!rounded-md mr-1 -mt-1.5" |
|
|
|
class="!rounded-md mr-1 -mt-1.5" |
|
|
|
data-testid="invite-user-and-share-base-modal-close-btn" |
|
|
|
data-testid="invite-user-and-share-base-modal-close-btn" |
|
|
|
@click="emit('closed')" |
|
|
|
@click="close" |
|
|
|
> |
|
|
|
> |
|
|
|
<template #icon> |
|
|
|
<template #icon> |
|
|
|
<MaterialSymbolsCloseRounded class="flex mx-auto" /> |
|
|
|
<MaterialSymbolsCloseRounded class="flex mx-auto" /> |
|
|
@ -233,7 +258,7 @@ const emailField = (inputEl: typeof Input) => { |
|
|
|
<div class="ml-1 mb-1 text-xs text-gray-500">{{ $t('datatype.Email') }}:</div> |
|
|
|
<div class="ml-1 mb-1 text-xs text-gray-500">{{ $t('datatype.Email') }}:</div> |
|
|
|
|
|
|
|
|
|
|
|
<a-input |
|
|
|
<a-input |
|
|
|
:ref="emailField" |
|
|
|
ref="emailField" |
|
|
|
v-model:value="usersData.emails" |
|
|
|
v-model:value="usersData.emails" |
|
|
|
validate-trigger="onBlur" |
|
|
|
validate-trigger="onBlur" |
|
|
|
:placeholder="$t('labels.email')" |
|
|
|
:placeholder="$t('labels.email')" |
|
|
|