Browse Source

Merge pull request #2318 from nocodb/fix/limit

enhancement: make query limit configurable
pull/2257/head
Pranav C 2 years ago committed by GitHub
parent
commit
7aa4fe5ed4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      .github/workflows/release-docker.yml
  2. 7
      .github/workflows/release-npm.yml
  3. 3
      .github/workflows/update-sdk-path.yml
  4. 2
      packages/noco-docs/content/en/getting-started/installation.md
  5. 7
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts
  6. 2
      packages/nocodb/src/lib/meta/api/swagger/helpers/templates/params.ts

5
.github/workflows/release-docker.yml

@ -44,9 +44,6 @@ jobs:
runs-on: ubuntu-latest
env:
working-directory: ./packages/nocodb
strategy:
matrix:
node-version: [16]
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' }}

7
.github/workflows/release-npm.yml

@ -35,20 +35,17 @@ jobs:
runs-on: ubuntu-latest
env:
working-directory: ./packages/nocodb
strategy:
matrix:
node-version: [16]
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 &&

3
.github/workflows/update-sdk-path.yml

@ -8,9 +8,6 @@ on:
jobs:
release:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16]
steps:
- name: Checkout
uses: actions/checkout@v2

2
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 | |

7
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: 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';
}

2
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 = {

Loading…
Cancel
Save