From 67f3d077fd32086c67b16059383e289a765467c5 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Fri, 10 Jun 2022 12:48:27 +0800 Subject: [PATCH 1/6] enhancement: allow custom limit values --- .../src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts b/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts index df786b6ec3..95fad14015 100644 --- a/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts +++ b/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts @@ -70,9 +70,9 @@ class BaseModelSqlv2 { private _columns = {}; private config: any = { - limitDefault: 25, - limitMin: 1, - limitMax: 1000 + limitDefault: process.env.DB_QUERY_LIMIT_DEFAULT || 25, + limitMin: process.env.DB_QUERY_LIMIT_MIN || 1, + limitMax: process.env.DB_QUERY_LIMIT_MAX || 1000 }; constructor({ From 92d02467a0ad720bd4e3de8ec27dd3705dd161fa Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Fri, 10 Jun 2022 12:50:59 +0800 Subject: [PATCH 2/6] chore: update query limit description --- .../nocodb/src/lib/meta/api/swagger/helpers/templates/params.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nocodb/src/lib/meta/api/swagger/helpers/templates/params.ts b/packages/nocodb/src/lib/meta/api/swagger/helpers/templates/params.ts index 0e010fd81b..f467d4aa58 100644 --- a/packages/nocodb/src/lib/meta/api/swagger/helpers/templates/params.ts +++ b/packages/nocodb/src/lib/meta/api/swagger/helpers/templates/params.ts @@ -59,7 +59,7 @@ export const limitParam = { in: 'query', name: 'limit', description: - 'The `limit` parameter used for pagination, the response collection size depends on limit value and default value is `25`. Maximum value is `1000`.', + 'The `limit` parameter used for pagination, the response collection size depends on limit value with default value `25` and maximum value `1000`, which can be overridden by environment variables `DB_QUERY_LIMIT_DEFAULT` and `DB_QUERY_LIMIT_MAX` respectively.', example: 25 }; export const offsetParam = { From 038b4052977b10eabe6d9dd40365205c4dee6a07 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Fri, 10 Jun 2022 14:04:41 +0800 Subject: [PATCH 3/6] chore: bump to 16.15.0 --- .github/workflows/release-docker.yml | 2 +- .github/workflows/release-npm.yml | 2 +- .github/workflows/update-sdk-path.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release-docker.yml b/.github/workflows/release-docker.yml index 812617b6b3..d862e56678 100644 --- a/.github/workflows/release-docker.yml +++ b/.github/workflows/release-docker.yml @@ -46,7 +46,7 @@ jobs: working-directory: ./packages/nocodb strategy: matrix: - node-version: [16] + node-version: 16.15.0 steps: - name: Get Docker Repository id: get-docker-repository diff --git a/.github/workflows/release-npm.yml b/.github/workflows/release-npm.yml index cc96ddf60c..afb1bb7005 100644 --- a/.github/workflows/release-npm.yml +++ b/.github/workflows/release-npm.yml @@ -37,7 +37,7 @@ jobs: working-directory: ./packages/nocodb strategy: matrix: - node-version: [16] + node-version: 16.15.0 steps: - name: Checkout uses: actions/checkout@v2 diff --git a/.github/workflows/update-sdk-path.yml b/.github/workflows/update-sdk-path.yml index 0e292aed0d..9b3a2b8fb4 100644 --- a/.github/workflows/update-sdk-path.yml +++ b/.github/workflows/update-sdk-path.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: [16] + node-version: 16.15.0 steps: - name: Checkout uses: actions/checkout@v2 From 8a601b6a159b5a967554bd91c6a8004633783313 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Fri, 10 Jun 2022 14:16:58 +0800 Subject: [PATCH 4/6] fix: node version --- .github/workflows/release-docker.yml | 5 +---- .github/workflows/release-npm.yml | 7 ++----- .github/workflows/update-sdk-path.yml | 3 --- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/.github/workflows/release-docker.yml b/.github/workflows/release-docker.yml index d862e56678..bc7ebffff0 100644 --- a/.github/workflows/release-docker.yml +++ b/.github/workflows/release-docker.yml @@ -44,9 +44,6 @@ jobs: runs-on: ubuntu-latest env: working-directory: ./packages/nocodb - strategy: - matrix: - node-version: 16.15.0 steps: - name: Get Docker Repository id: get-docker-repository @@ -77,7 +74,7 @@ jobs: - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v2 with: - node-version: ${{ matrix.node-version }} + node-version: 16.15.0 - name: upgrade packages for nightly build or pr build if: ${{ github.event.inputs.targetEnv == 'DEV' || inputs.targetEnv == 'DEV' }} diff --git a/.github/workflows/release-npm.yml b/.github/workflows/release-npm.yml index afb1bb7005..f80cf156d9 100644 --- a/.github/workflows/release-npm.yml +++ b/.github/workflows/release-npm.yml @@ -35,20 +35,17 @@ jobs: runs-on: ubuntu-latest env: working-directory: ./packages/nocodb - strategy: - matrix: - node-version: 16.15.0 steps: - name: Checkout uses: actions/checkout@v2 with: fetch-depth: 0 ref: ${{ github.ref }} - - name: NPM Setup and Publish with ${{ matrix.node-version }} + - name: NPM Setup and Publish with 16.15.0 # Setup .npmrc file to publish to npm uses: actions/setup-node@v2 with: - node-version: ${{ matrix.node-version }} + node-version: 16.15.0 registry-url: 'https://registry.npmjs.org' - run: | targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} targetVersion=${{ github.event.inputs.tag || inputs.tag }} node scripts/bumpNocodbSdkVersion.js && diff --git a/.github/workflows/update-sdk-path.yml b/.github/workflows/update-sdk-path.yml index 9b3a2b8fb4..d6360f914d 100644 --- a/.github/workflows/update-sdk-path.yml +++ b/.github/workflows/update-sdk-path.yml @@ -8,9 +8,6 @@ on: jobs: release: runs-on: ubuntu-latest - strategy: - matrix: - node-version: 16.15.0 steps: - name: Checkout uses: actions/checkout@v2 From f7d39de8259781e9c2f9b7a5a98749645a336a59 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Fri, 10 Jun 2022 14:42:04 +0530 Subject: [PATCH 5/6] fix: handle invalid limit numbers Signed-off-by: Pranav C --- .../src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts b/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts index 95fad14015..547d112cf9 100644 --- a/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts +++ b/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts @@ -70,9 +70,9 @@ class BaseModelSqlv2 { private _columns = {}; private config: any = { - limitDefault: process.env.DB_QUERY_LIMIT_DEFAULT || 25, - limitMin: process.env.DB_QUERY_LIMIT_MIN || 1, - limitMax: process.env.DB_QUERY_LIMIT_MAX || 1000 + limitDefault: Math.max(+process.env.DB_QUERY_LIMIT_DEFAULT || 25, 1), + limitMin: Math.max(+process.env.DB_QUERY_LIMIT_MIN || 1, 1), + limitMax: Math.max(+process.env.DB_QUERY_LIMIT_MAX || 1000, 1) }; constructor({ @@ -1370,6 +1370,7 @@ class BaseModelSqlv2 { get isPg() { return this.clientType === 'pg'; } + get isMySQL() { return this.clientType === 'mysql2' || this.clientType === 'mysql'; } From 3ea08789a66fcdd87b76775765f058c515636b21 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Fri, 10 Jun 2022 15:47:39 +0530 Subject: [PATCH 6/6] docs: update default value of pagination max limit value Signed-off-by: Pranav C --- packages/noco-docs/content/en/getting-started/installation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/noco-docs/content/en/getting-started/installation.md b/packages/noco-docs/content/en/getting-started/installation.md index 24f71a5538..9fd3b52f7f 100644 --- a/packages/noco-docs/content/en/getting-started/installation.md +++ b/packages/noco-docs/content/en/getting-started/installation.md @@ -180,7 +180,7 @@ It is mandatory to configure `NC_DB` environment variables for production usecas | NC_AUTH_JWT_SECRET | Yes | JWT secret used for auth and storing other secrets | A Random secret will be generated | | | PORT | No | For setting app running port | `8080` | | | DB_QUERY_LIMIT_DEFAULT | No | Default pagination limit | 25 | | -| DB_QUERY_LIMIT_MAX | No | Maximum allowed pagination limit | 100 | | +| DB_QUERY_LIMIT_MAX | No | Maximum allowed pagination limit | 1000 | | | DB_QUERY_LIMIT_MIN | No | Minimum allowed pagination limit | 1 | | | NC_TOOL_DIR | No | App directory to keep metadata and app related files | Defaults to current working directory. In docker maps to `/usr/app/data/` for mounting volume. | | | NC_PUBLIC_URL | Yes | Used for sending Email invitations | Best guess from http request params | |