Browse Source

refactor: cleanup and corrections

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/9807/head
Pranav C 1 week ago
parent
commit
6b31e00e24
  1. 39
      packages/nc-gui/components/dlg/ReAssign/index.vue
  2. 10
      packages/nc-gui/components/smartsheet/grid/InfiniteTable.vue
  3. 10
      packages/nc-gui/components/smartsheet/grid/Table.vue
  4. 2
      packages/nc-gui/composables/useExtensionHelper.ts
  5. 2
      packages/nocodb/src/meta/migrations/v2/nc_067_personal_view.ts
  6. 2
      tests/playwright/tests/db/usersAccounts/accountUserManagement.spec.ts

39
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()

10
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 () => {

10
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 }) {

2
packages/nc-gui/composables/useExtensionHelper.ts

@ -4,7 +4,7 @@ import type { ExtensionManifest, ExtensionType } from '#imports'
const [useProvideExtensionHelper, useExtensionHelper] = useInjectionState(
(extension: Ref<ExtensionType>, extensionManifest: ComputedRef<ExtensionManifest | undefined>, activeError: Ref<any>) => {
const { $api } = useNuxtApp()
const route = useRoute();
const route = useRoute()
const basesStore = useBases()

2
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');
});

2
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<any>;
const xroleDb = [
const roleDb = [
{ email: `org_creator_@nocodb.com`, role: 'Organization Level Creator', url: '' },
{ email: `org_viewer_@nocodb.com`, role: 'Organization Level Viewer', url: '' },
];

Loading…
Cancel
Save