mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-16 17:46:45 +00:00
feat(Data Table Node): Add returnAll for get all rows (no-changelog) (#19454)
This commit is contained in:
@@ -5,6 +5,7 @@ import type {
|
|||||||
INodeProperties,
|
INodeProperties,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
|
import { ROWS_LIMIT_DEFAULT } from '../../common/constants';
|
||||||
import { executeSelectMany, getSelectFields } from '../../common/selectMany';
|
import { executeSelectMany, getSelectFields } from '../../common/selectMany';
|
||||||
import { getDataTableProxyExecute } from '../../common/utils';
|
import { getDataTableProxyExecute } from '../../common/utils';
|
||||||
|
|
||||||
@@ -19,15 +20,29 @@ const displayOptions: IDisplayOptions = {
|
|||||||
|
|
||||||
export const description: INodeProperties[] = [
|
export const description: INodeProperties[] = [
|
||||||
...getSelectFields(displayOptions),
|
...getSelectFields(displayOptions),
|
||||||
|
{
|
||||||
|
displayName: 'Return All',
|
||||||
|
name: 'returnAll',
|
||||||
|
type: 'boolean',
|
||||||
|
displayOptions,
|
||||||
|
default: false,
|
||||||
|
description: 'Whether to return all results or only up to a given limit',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Limit',
|
displayName: 'Limit',
|
||||||
name: 'limit',
|
name: 'limit',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
|
displayOptions: {
|
||||||
|
...displayOptions,
|
||||||
|
show: {
|
||||||
|
...displayOptions.show,
|
||||||
|
returnAll: [false],
|
||||||
|
},
|
||||||
|
},
|
||||||
typeOptions: {
|
typeOptions: {
|
||||||
minValue: 1,
|
minValue: 1,
|
||||||
},
|
},
|
||||||
displayOptions,
|
default: ROWS_LIMIT_DEFAULT,
|
||||||
default: null,
|
|
||||||
description: 'Max number of results to return',
|
description: 'Max number of results to return',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ import type { DataStoreColumnJsType } from 'n8n-workflow';
|
|||||||
export const ANY_CONDITION = 'anyCondition';
|
export const ANY_CONDITION = 'anyCondition';
|
||||||
export const ALL_CONDITIONS = 'allConditions';
|
export const ALL_CONDITIONS = 'allConditions';
|
||||||
|
|
||||||
|
export const ROWS_LIMIT_DEFAULT = 50;
|
||||||
|
|
||||||
export type FilterType = typeof ANY_CONDITION | typeof ALL_CONDITIONS;
|
export type FilterType = typeof ANY_CONDITION | typeof ALL_CONDITIONS;
|
||||||
|
|
||||||
export type FieldEntry =
|
export type FieldEntry =
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import type {
|
|||||||
INodeProperties,
|
INodeProperties,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
import { ALL_CONDITIONS, ANY_CONDITION, type FilterType } from './constants';
|
import { ALL_CONDITIONS, ANY_CONDITION, ROWS_LIMIT_DEFAULT, type FilterType } from './constants';
|
||||||
import { DATA_TABLE_ID_FIELD } from './fields';
|
import { DATA_TABLE_ID_FIELD } from './fields';
|
||||||
import { buildGetManyFilter, isFieldArray, isMatchType } from './utils';
|
import { buildGetManyFilter, isFieldArray, isMatchType } from './utils';
|
||||||
|
|
||||||
@@ -125,7 +125,8 @@ export async function executeSelectMany(
|
|||||||
const PAGE_SIZE = 1000;
|
const PAGE_SIZE = 1000;
|
||||||
const result: Array<{ json: DataStoreRowReturn }> = [];
|
const result: Array<{ json: DataStoreRowReturn }> = [];
|
||||||
|
|
||||||
const limit = ctx.getNodeParameter('limit', index, 0);
|
const returnAll = ctx.getNodeParameter('returnAll', index, false);
|
||||||
|
const limit = !returnAll ? ctx.getNodeParameter('limit', index, ROWS_LIMIT_DEFAULT) : 0;
|
||||||
|
|
||||||
let expectedTotal: number | undefined;
|
let expectedTotal: number | undefined;
|
||||||
let skip = 0;
|
let skip = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user