mirror of
https://github.com/nocodb/nocodb.git
synced 2026-02-02 02:26:57 +00:00
Merge pull request #12043 from nocodb/develop
This commit is contained in:
@@ -331,7 +331,7 @@ function applyConfigFix(fix: any) {
|
||||
|
||||
const testConnectionError = ref()
|
||||
|
||||
const testConnection = async (retry = 0, initialConfig = null) => {
|
||||
const testConnection = async (retry = 0, initialConfig = null, initialError = null) => {
|
||||
try {
|
||||
await validate()
|
||||
} catch (e) {
|
||||
@@ -373,7 +373,7 @@ const testConnection = async (retry = 0, initialConfig = null) => {
|
||||
} catch (e: any) {
|
||||
// take a copy of the current config
|
||||
const config = initialConfig || JSON.parse(JSON.stringify(formState.value.dataSource))
|
||||
await handleConnectionError(e, retry, config)
|
||||
await handleConnectionError(e, retry, config, initialError || e)
|
||||
} finally {
|
||||
testingConnection.value = false
|
||||
}
|
||||
@@ -381,26 +381,22 @@ const testConnection = async (retry = 0, initialConfig = null) => {
|
||||
|
||||
const MAX_CONNECTION_RETRIES = 3
|
||||
|
||||
async function handleConnectionError(e: any, retry: number, initialConfig: any): Promise<void> {
|
||||
if (retry >= MAX_CONNECTION_RETRIES) {
|
||||
testSuccess.value = false
|
||||
testConnectionError.value = await extractSdkResponseErrorMsg(e)
|
||||
// reset the connection config to initial state
|
||||
formState.value.dataSource = initialConfig
|
||||
return
|
||||
}
|
||||
|
||||
const fix = generateConfigFix(e)
|
||||
|
||||
if (fix) {
|
||||
applyConfigFix(fix)
|
||||
// Retry the connection after applying the fix
|
||||
return testConnection(retry + 1, initialConfig)
|
||||
async function handleConnectionError(e: any, retry: number, initialConfig: any, initialError: any): Promise<void> {
|
||||
if (retry < MAX_CONNECTION_RETRIES) {
|
||||
const fix = generateConfigFix(e)
|
||||
if (fix) {
|
||||
applyConfigFix(fix)
|
||||
// Retry the connection after applying the fix
|
||||
return testConnection(retry + 1, initialConfig, initialError)
|
||||
}
|
||||
}
|
||||
|
||||
// If no fix is available, or fix did not resolve the issue
|
||||
// then reset to initial state
|
||||
formState.value.dataSource = initialConfig || formState.value.dataSource
|
||||
testSuccess.value = false
|
||||
testConnectionError.value = await extractSdkResponseErrorMsg(e)
|
||||
// extract error message from initial call
|
||||
testConnectionError.value = await extractSdkResponseErrorMsg(initialError || e)
|
||||
}
|
||||
|
||||
const handleImportURL = async () => {
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
"marked": "^4.3.0",
|
||||
"monaco-editor": "^0.52.2",
|
||||
"monaco-sql-languages": "^0.11.0",
|
||||
"nocodb-sdk": "0.264.3",
|
||||
"nocodb-sdk": "workspace:^",
|
||||
"papaparse": "^5.5.2",
|
||||
"parse-github-url": "^1.0.3",
|
||||
"pdfobject": "^2.3.0",
|
||||
|
||||
@@ -124,7 +124,7 @@
|
||||
"mysql2": "^3.14.1",
|
||||
"nanoid": "^3.3.8",
|
||||
"nc-lib-gui": "0.264.3",
|
||||
"nocodb-sdk": "0.264.3",
|
||||
"nocodb-sdk": "workspace:^",
|
||||
"nodemailer": "^6.10.0",
|
||||
"object-hash": "^3.0.0",
|
||||
"object-sizeof": "^2.6.5",
|
||||
|
||||
@@ -18,14 +18,19 @@ import { MetaApiLimiterGuard } from '~/guards/meta-api-limiter.guard';
|
||||
import { TenantContext } from '~/decorators/tenant-context.decorator';
|
||||
import { NcContext, NcRequest } from '~/interface/config';
|
||||
import { BasesV3Service } from '~/services/v3/bases-v3.service';
|
||||
import { isEE } from '~/utils';
|
||||
|
||||
// decide scope based on whether it's EE or CE
|
||||
const BASE_SCOPE = isEE ? 'workspace' : 'org';
|
||||
|
||||
@UseGuards(MetaApiLimiterGuard, GlobalGuard)
|
||||
@Controller()
|
||||
export class BasesV3Controller {
|
||||
constructor(protected readonly baseV3Service: BasesV3Service) {}
|
||||
|
||||
@Acl('baseList', {
|
||||
scope: 'org',
|
||||
// decide permission name based on whether it's EE or CE
|
||||
@Acl(isEE ? 'workspaceBaseList' : 'baseList', {
|
||||
scope: BASE_SCOPE,
|
||||
})
|
||||
@Get('/api/v3/meta/workspaces/:workspaceId/bases')
|
||||
async list(
|
||||
@@ -91,7 +96,7 @@ export class BasesV3Controller {
|
||||
}
|
||||
|
||||
@Acl('baseCreate', {
|
||||
scope: 'org',
|
||||
scope: BASE_SCOPE,
|
||||
})
|
||||
@HttpCode(200)
|
||||
@Post('/api/v3/meta/workspaces/:workspaceId/bases')
|
||||
|
||||
@@ -5584,7 +5584,7 @@ class BaseModelSqlv2 implements IBaseModelSqlV2 {
|
||||
|
||||
if (d[col.id]?.length) {
|
||||
d[col.id] = d[col.id].filter(
|
||||
(attr) => attr.id && !attr.id?.startsWith('temp_'),
|
||||
(attr) => !attr.id?.startsWith('temp_'),
|
||||
);
|
||||
for (let i = 0; i < d[col.id].length; i++) {
|
||||
if (typeof d[col.id][i] === 'string') {
|
||||
|
||||
@@ -62,9 +62,7 @@ export default function () {
|
||||
if (isEE) {
|
||||
expect(result.body.error).to.eq('FORBIDDEN');
|
||||
expect(
|
||||
result.body.message.startsWith(
|
||||
'Forbidden - You do not have permission to perform the action "baseCreate" ',
|
||||
),
|
||||
result.body.message.startsWith('Forbidden - Unauthorized access'),
|
||||
).to.eq(true);
|
||||
} else {
|
||||
expect(result.body.error).to.eq('PERMISSION_DENIED');
|
||||
|
||||
22
pnpm-lock.yaml
generated
22
pnpm-lock.yaml
generated
@@ -227,8 +227,8 @@ importers:
|
||||
specifier: ^0.11.0
|
||||
version: 0.11.0(antlr4ng-cli@1.0.7)
|
||||
nocodb-sdk:
|
||||
specifier: 0.264.3
|
||||
version: 0.264.3(debug@4.4.1)
|
||||
specifier: workspace:^
|
||||
version: link:../nocodb-sdk
|
||||
papaparse:
|
||||
specifier: ^5.5.2
|
||||
version: 5.5.3
|
||||
@@ -835,8 +835,8 @@ importers:
|
||||
specifier: 0.264.3
|
||||
version: 0.264.3
|
||||
nocodb-sdk:
|
||||
specifier: 0.264.3
|
||||
version: 0.264.3(debug@4.4.1)
|
||||
specifier: workspace:^
|
||||
version: link:../nocodb-sdk
|
||||
nodemailer:
|
||||
specifier: ^6.10.0
|
||||
version: 6.10.1
|
||||
@@ -11097,10 +11097,6 @@ packages:
|
||||
resolution: {integrity: sha512-67n1OfusL/ON57fwFJ6ZurSJa/msYVQmqlz9rCel2HJYj4Zeb8v9TcmRdEW+PV2i9Fm2358umSvzZukhw/E8DA==}
|
||||
engines: {node: '>=18.20.0 <20 || >=20.12.1'}
|
||||
|
||||
nocodb-sdk@0.264.3:
|
||||
resolution: {integrity: sha512-lk0r6f3GCvH3pUJByRjNylT2qHBiVbS25mj5THUlod+glLgjPGm/X1+XTyLGWklLHb7f/PocGI74F82gfndhnw==}
|
||||
engines: {node: '>=18'}
|
||||
|
||||
node-abi@3.75.0:
|
||||
resolution: {integrity: sha512-OhYaY5sDsIka7H7AtijtI9jwGYLyl29eQn/W623DiN/MIv5sUqc4g7BIDThX+gb7di9f6xK02nkp8sdfFWZLTg==}
|
||||
engines: {node: '>=10'}
|
||||
@@ -27276,16 +27272,6 @@ snapshots:
|
||||
json-stringify-safe: 5.0.1
|
||||
propagate: 2.0.1
|
||||
|
||||
nocodb-sdk@0.264.3(debug@4.4.1):
|
||||
dependencies:
|
||||
axios: 1.9.0(debug@4.4.1)
|
||||
chevrotain: 10.5.0
|
||||
dayjs: 1.11.13
|
||||
jsep: 1.4.0
|
||||
validator: 13.15.15
|
||||
transitivePeerDependencies:
|
||||
- debug
|
||||
|
||||
node-abi@3.75.0:
|
||||
dependencies:
|
||||
semver: 7.7.2
|
||||
|
||||
Reference in New Issue
Block a user