Browse Source

fix: refactor

pull/6441/head
sreehari jayaraj 1 year 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'"> <template v-else-if="formStatus === 'project-collaborateSaved'">
<div class="flex flex-col py-1.5"> <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 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"> <div class="flex">
<MdiCheck /> <MdiCheck />
</div> </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 () => { onMounted(async () => {
isLoading.value = true isLoading.value = true
try { try {

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

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

Loading…
Cancel
Save