Browse Source

fix: refactor

pull/6441/head
sreehari jayaraj 12 months ago
parent
commit
1d1929f23a
  1. 2
      packages/nc-gui/components/dlg/share-and-collaborate/View.vue
  2. 5
      packages/nc-gui/components/project/AccessSettings.vue
  3. 12
      packages/nc-gui/components/workspace/InviteSection.vue

2
packages/nc-gui/components/dlg/share-and-collaborate/View.vue

@ -101,7 +101,7 @@ watch(showShareModal, (val) => {
<template v-else-if="formStatus === 'project-collaborateSaved'">
<div class="flex flex-col py-1.5">
<div class="flex flex-row w-full px-5 justify-between items-center py-0.5">
<div class="flex text-base" :style="{ fontWeight: 500 }">Members added</div>
<div class="flex text-base font-medium">Members added</div>
<div class="flex">
<MdiCheck />
</div>

5
packages/nc-gui/components/project/AccessSettings.vue

@ -135,11 +135,6 @@ watchDebounced(
},
)
const userProjectRole = computed<(typeof ProjectRoles)[keyof typeof ProjectRoles]>(() => {
const projectUser = collaborators.value?.find((collab) => collab.id === user.value?.id)
return projectUser?.projectRoles
})
onMounted(async () => {
isLoading.value = true
try {

12
packages/nc-gui/components/workspace/InviteSection.vue

@ -2,6 +2,7 @@
import { onKeyStroke } from '@vueuse/core'
import { OrderedWorkspaceRoles, WorkspaceUserRoles } from 'nocodb-sdk'
import { extractSdkResponseErrorMsg, useWorkspace } from '#imports'
import { validateEmail } from '~/utils/validation'
const inviteData = reactive({
email: '',
@ -17,11 +18,6 @@ const emailValidation = reactive({
message: '',
})
const validateEmail = (email: string): boolean => {
const regEx = /^[^\s@]+@[^\s@]+\.[^\s@]+$/
return regEx.test(email)
}
const workspaceStore = useWorkspace()
const { inviteCollaborator: _inviteCollaborator } = workspaceStore
@ -45,7 +41,7 @@ const insertOrUpdateString = (str: string) => {
}
const emailInputValidation = (input: string): boolean => {
if (input.length < 1) {
if (!input.length) {
emailValidation.isError = true
emailValidation.message = 'Email Should Not Be Empty'
return false
@ -60,7 +56,7 @@ const emailInputValidation = (input: string): boolean => {
watch(inviteData, (newVal) => {
const isNewEmail = newVal.email.charAt(newVal.email.length - 1) === ',' || newVal.email.charAt(newVal.email.length - 1) === ' '
if (isNewEmail && newVal.email.trim().length > 1) {
if (isNewEmail && !newVal.email.trim().length) {
const emailToAdd = newVal.email.split(',')[0].trim() || newVal.email.split(' ')[0].trim()
if (!validateEmail(emailToAdd)) {
emailValidation.isError = true
@ -79,7 +75,7 @@ watch(inviteData, (newVal) => {
emailBadges.value.push(emailToAdd)
inviteData.email = ''
}
if (newVal.email.length < 1 && emailValidation.isError) {
if (!newVal.email.length && emailValidation.isError) {
emailValidation.isError = false
}
})

Loading…
Cancel
Save