From 6b31e00e2405d23d2540f800268bf1cd51bbec4d Mon Sep 17 00:00:00 2001 From: Pranav C Date: Tue, 12 Nov 2024 18:31:56 +0530 Subject: [PATCH] refactor: cleanup and corrections Signed-off-by: Pranav C --- .../nc-gui/components/dlg/ReAssign/index.vue | 39 ------------------- .../smartsheet/grid/InfiniteTable.vue | 10 ++--- .../components/smartsheet/grid/Table.vue | 10 ++--- .../nc-gui/composables/useExtensionHelper.ts | 2 +- .../migrations/v2/nc_067_personal_view.ts | 2 +- .../accountUserManagement.spec.ts | 2 +- 6 files changed, 13 insertions(+), 52 deletions(-) diff --git a/packages/nc-gui/components/dlg/ReAssign/index.vue b/packages/nc-gui/components/dlg/ReAssign/index.vue index 017382fe48..d32d047ad7 100644 --- a/packages/nc-gui/components/dlg/ReAssign/index.vue +++ b/packages/nc-gui/components/dlg/ReAssign/index.vue @@ -18,51 +18,12 @@ interface Emits { const vModel = useVModel(props, 'modelValue', emits) -const { t } = useI18n() - -const useForm = Form.useForm -const validators = computed(() => { - return { - emails: [ - { - validator: (rule: any, value: string, callback: (errMsg?: string) => void) => { - if (!value || value.length === 0) { - callback(t('msg.error.signUpRules.emailRequired')) - return - } - const invalidEmails = (value || '').split(/\s*,\s*/).filter((e: string) => !validateEmail(e)) - if (invalidEmails.length > 0) { - callback( - `${ - invalidEmails.length > 1 ? t('msg.error.signUpRules.invalidEmails') : t('msg.error.signUpRules.invalidEmail') - } ${invalidEmails.join(', ')} `, - ) - } else { - callback() - } - }, - }, - ], - } -}) - -const invitationUsersData = ref({}) - -const { validateInfos } = useForm(invitationUsersData, validators) - onMounted(async () => { if (!users.value) { await loadUsers() } }) -watch( - () => validateInfos.emails.validateStatus, - () => { - invitationValid.value = validateInfos.emails.validateStatus === 'success' && invitationUsersData.emails?.length !== 0 - }, -) - const basesStore = useBases() const viewsStore = useViewsStore() diff --git a/packages/nc-gui/components/smartsheet/grid/InfiniteTable.vue b/packages/nc-gui/components/smartsheet/grid/InfiniteTable.vue index 4d18dcc863..5772b68a4e 100644 --- a/packages/nc-gui/components/smartsheet/grid/InfiniteTable.vue +++ b/packages/nc-gui/components/smartsheet/grid/InfiniteTable.vue @@ -1400,14 +1400,14 @@ eventBus.on(async (event, payload) => { }) watch(activeCell, (activeCell) => { - const row = activeCell.row !== null ? cachedRows.value.get(activeCell.row)?.row : undefined; - const col = (row && activeCell.col !== null) ? fields.value[activeCell.col] : undefined; - const val = (row && col) ? row[col.title as string] : undefined; + const row = activeCell.row !== null ? cachedRows.value.get(activeCell.row)?.row : undefined + const col = row && activeCell.col !== null ? fields.value[activeCell.col] : undefined + const val = row && col ? row[col.title as string] : undefined const rowId = extractPkFromRow(row!, meta.value?.columns as ColumnType[]) - const viewId = view.value?.id; + const viewId = view.value?.id - eventBus.emit(SmartsheetStoreEvents.CELL_SELECTED, { rowId, colId: col?.id, val, viewId }); + eventBus.emit(SmartsheetStoreEvents.CELL_SELECTED, { rowId, colId: col?.id, val, viewId }) }) const reloadViewDataHookHandler = async () => { diff --git a/packages/nc-gui/components/smartsheet/grid/Table.vue b/packages/nc-gui/components/smartsheet/grid/Table.vue index 106e47985d..79638c4cd5 100644 --- a/packages/nc-gui/components/smartsheet/grid/Table.vue +++ b/packages/nc-gui/components/smartsheet/grid/Table.vue @@ -1395,14 +1395,14 @@ eventBus.on(async (event, payload) => { }) watch(activeCell, (activeCell) => { - const row = activeCell.row !== null ? dataRef.value[activeCell.row].row : undefined; - const col = (row && activeCell.col !== null) ? fields.value[activeCell.col] : undefined; - const val = (row && col) ? row[col.title as string] : undefined; + const row = activeCell.row !== null ? dataRef.value[activeCell.row].row : undefined + const col = row && activeCell.col !== null ? fields.value[activeCell.col] : undefined + const val = row && col ? row[col.title as string] : undefined const rowId = extractPkFromRow(row!, meta.value?.columns as ColumnType[]) - const viewId = view.value?.id; + const viewId = view.value?.id - eventBus.emit(SmartsheetStoreEvents.CELL_SELECTED, { rowId, colId: col?.id, val, viewId }); + eventBus.emit(SmartsheetStoreEvents.CELL_SELECTED, { rowId, colId: col?.id, val, viewId }) }) async function reloadViewDataHandler(params: void | { shouldShowLoading?: boolean | undefined; offset?: number | undefined }) { diff --git a/packages/nc-gui/composables/useExtensionHelper.ts b/packages/nc-gui/composables/useExtensionHelper.ts index 6facc6817c..eadf4638a3 100644 --- a/packages/nc-gui/composables/useExtensionHelper.ts +++ b/packages/nc-gui/composables/useExtensionHelper.ts @@ -4,7 +4,7 @@ import type { ExtensionManifest, ExtensionType } from '#imports' const [useProvideExtensionHelper, useExtensionHelper] = useInjectionState( (extension: Ref, extensionManifest: ComputedRef, activeError: Ref) => { const { $api } = useNuxtApp() - const route = useRoute(); + const route = useRoute() const basesStore = useBases() diff --git a/packages/nocodb/src/meta/migrations/v2/nc_067_personal_view.ts b/packages/nocodb/src/meta/migrations/v2/nc_067_personal_view.ts index 8780fc63b0..326630e526 100644 --- a/packages/nocodb/src/meta/migrations/v2/nc_067_personal_view.ts +++ b/packages/nocodb/src/meta/migrations/v2/nc_067_personal_view.ts @@ -9,7 +9,7 @@ const up = async (knex: Knex) => { }; const down = async (knex: Knex) => { - await knex.schema.alterTable(MetaTable.SOURCES, (table) => { + await knex.schema.alterTable(MetaTable.VIEWS, (table) => { table.dropColumn('created_by'); table.dropColumn('owned_by'); }); diff --git a/tests/playwright/tests/db/usersAccounts/accountUserManagement.spec.ts b/tests/playwright/tests/db/usersAccounts/accountUserManagement.spec.ts index 1c716c39aa..3b6faee147 100644 --- a/tests/playwright/tests/db/usersAccounts/accountUserManagement.spec.ts +++ b/tests/playwright/tests/db/usersAccounts/accountUserManagement.spec.ts @@ -10,7 +10,7 @@ import { LoginPage } from '../../../pages/LoginPage'; import { isEE } from '../../../setup/db'; let api: Api; -const xroleDb = [ +const roleDb = [ { email: `org_creator_@nocodb.com`, role: 'Organization Level Creator', url: '' }, { email: `org_viewer_@nocodb.com`, role: 'Organization Level Viewer', url: '' }, ];