mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
feat: Execution custom data saving and filtering (#5496)
* wip: workflow execution filtering * fix: import type failing to build * fix: remove console.logs * feat: execution metadata migrations * fix(editor): Move global executions filter to its own component * fix(editor): Using the same filter component in workflow level * fix(editor): a small housekeeping * checking workflowId in filter applied * fix(editor): update filter after resolving merge conflicts * fix(editor): unify empy filter status * feat(editor): add datetime picker to filter * feat(editor): add meta fields * fix: fix button override in datepicker panel * feat(editor): add filter metadata * feat(core): add 'startedBefore' execution filter prop * feat(core): add 'tags' execution query filter * Revert "feat(core): add 'tags' execution query filter" This reverts commit a7b968081c91290b0c94df18c6a73d29950222d9. * feat(editor): add translations and tooltip and counting selected filter props * fix(editor): fix label layouts * fix(editor): update custom data docs link * fix(editor): update custom data tooltip position * fix(editor): update tooltip text * refactor: Ignore metadata if not enabled by license * fix(editor): Add paywall states to advanced execution filter * refactor: Save custom data also for worker mode * fix: Remove duplicate migration name from list * fix(editor): Reducing filter complexity and add debounce to text inputs * fix(editor): Remove unused import, add comment * fix(editor): simplify event listener * fix: Prevent error when there are running executions * test(editor): Add advanced execution filter basic unit test * test(editor): Add advanced execution filter state change unit test * fix: Small lint issue * feat: Add indices to speed up queries * feat: add customData limits * refactor: put metadata save in transaction * chore: remove unneed comment * test: add tests for execution metadata * fix(editor): Fixes after merge conflict * fix(editor): Remove unused import * wordings and ui fixes * fix(editor): type fixes * feat: add code node autocompletions for customData * fix: Prevent transaction issues and ambiguous ID in sql clauses * fix(editor): Suppress requesting current executions if metadata is used in filter (#5739) * fix(editor): Suppress requesting current executions if metadata is used in filter * fix(editor): Fix arrows for select in popover * refactor: Improve performance by correcting database indices * fix: Lint issue * test: Fix broken test * fix: Broken test * test: add call data check for saveExecutionMetadata test --------- Co-authored-by: Valya Bullions <valya@n8n.io> Co-authored-by: Alex Grozav <alex@grozav.com> Co-authored-by: Omar Ajoue <krynble@gmail.com> Co-authored-by: Romain Minaud <romain.minaud@gmail.com>
This commit is contained in:
@@ -112,6 +112,12 @@ import { extractValue } from './ExtractValue';
|
||||
import { getClientCredentialsToken } from './OAuth2Helper';
|
||||
import { PLACEHOLDER_EMPTY_EXECUTION_ID } from './Constants';
|
||||
import { binaryToBuffer } from './BinaryDataManager/utils';
|
||||
import {
|
||||
getAllWorkflowExecutionMetadata,
|
||||
getWorkflowExecutionMetadata,
|
||||
setAllWorkflowExecutionMetadata,
|
||||
setWorkflowExecutionMetadata,
|
||||
} from './WorkflowExecutionMetadata';
|
||||
|
||||
axios.defaults.timeout = 300000;
|
||||
// Prevent axios from adding x-form-www-urlencoded headers by default
|
||||
@@ -1616,6 +1622,7 @@ export async function requestWithAuthentication(
|
||||
export function getAdditionalKeys(
|
||||
additionalData: IWorkflowExecuteAdditionalData,
|
||||
mode: WorkflowExecuteMode,
|
||||
runExecutionData: IRunExecutionData | null,
|
||||
): IWorkflowDataProxyAdditionalKeys {
|
||||
const executionId = additionalData.executionId || PLACEHOLDER_EMPTY_EXECUTION_ID;
|
||||
const resumeUrl = `${additionalData.webhookWaitingBaseUrl}/${executionId}`;
|
||||
@@ -1624,6 +1631,22 @@ export function getAdditionalKeys(
|
||||
id: executionId,
|
||||
mode: mode === 'manual' ? 'test' : 'production',
|
||||
resumeUrl,
|
||||
customData: runExecutionData
|
||||
? {
|
||||
set(key: string, value: string): void {
|
||||
setWorkflowExecutionMetadata(runExecutionData, key, value);
|
||||
},
|
||||
setAll(obj: Record<string, string>): void {
|
||||
setAllWorkflowExecutionMetadata(runExecutionData, obj);
|
||||
},
|
||||
get(key: string): string {
|
||||
return getWorkflowExecutionMetadata(runExecutionData, key);
|
||||
},
|
||||
getAll(): Record<string, string> {
|
||||
return getAllWorkflowExecutionMetadata(runExecutionData);
|
||||
},
|
||||
}
|
||||
: undefined,
|
||||
},
|
||||
|
||||
// deprecated
|
||||
@@ -2122,7 +2145,7 @@ export function getExecutePollFunctions(
|
||||
itemIndex,
|
||||
mode,
|
||||
additionalData.timezone,
|
||||
getAdditionalKeys(additionalData, mode),
|
||||
getAdditionalKeys(additionalData, mode, runExecutionData),
|
||||
undefined,
|
||||
fallbackValue,
|
||||
options,
|
||||
@@ -2181,7 +2204,7 @@ export function getExecuteTriggerFunctions(
|
||||
itemIndex,
|
||||
mode,
|
||||
additionalData.timezone,
|
||||
getAdditionalKeys(additionalData, mode),
|
||||
getAdditionalKeys(additionalData, mode, runExecutionData),
|
||||
undefined,
|
||||
fallbackValue,
|
||||
options,
|
||||
@@ -2240,7 +2263,7 @@ export function getExecuteFunctions(
|
||||
connectionInputData,
|
||||
mode,
|
||||
additionalData.timezone,
|
||||
getAdditionalKeys(additionalData, mode),
|
||||
getAdditionalKeys(additionalData, mode, runExecutionData),
|
||||
executeData,
|
||||
);
|
||||
},
|
||||
@@ -2306,7 +2329,7 @@ export function getExecuteFunctions(
|
||||
itemIndex,
|
||||
mode,
|
||||
additionalData.timezone,
|
||||
getAdditionalKeys(additionalData, mode),
|
||||
getAdditionalKeys(additionalData, mode, runExecutionData),
|
||||
executeData,
|
||||
fallbackValue,
|
||||
options,
|
||||
@@ -2323,7 +2346,7 @@ export function getExecuteFunctions(
|
||||
{},
|
||||
mode,
|
||||
additionalData.timezone,
|
||||
getAdditionalKeys(additionalData, mode),
|
||||
getAdditionalKeys(additionalData, mode, runExecutionData),
|
||||
executeData,
|
||||
);
|
||||
return dataProxy.getDataProxy();
|
||||
@@ -2413,7 +2436,7 @@ export function getExecuteSingleFunctions(
|
||||
connectionInputData,
|
||||
mode,
|
||||
additionalData.timezone,
|
||||
getAdditionalKeys(additionalData, mode),
|
||||
getAdditionalKeys(additionalData, mode, runExecutionData),
|
||||
executeData,
|
||||
);
|
||||
},
|
||||
@@ -2484,7 +2507,7 @@ export function getExecuteSingleFunctions(
|
||||
itemIndex,
|
||||
mode,
|
||||
additionalData.timezone,
|
||||
getAdditionalKeys(additionalData, mode),
|
||||
getAdditionalKeys(additionalData, mode, runExecutionData),
|
||||
executeData,
|
||||
fallbackValue,
|
||||
options,
|
||||
@@ -2501,7 +2524,7 @@ export function getExecuteSingleFunctions(
|
||||
{},
|
||||
mode,
|
||||
additionalData.timezone,
|
||||
getAdditionalKeys(additionalData, mode),
|
||||
getAdditionalKeys(additionalData, mode, runExecutionData),
|
||||
executeData,
|
||||
);
|
||||
return dataProxy.getDataProxy();
|
||||
@@ -2594,7 +2617,7 @@ export function getLoadOptionsFunctions(
|
||||
itemIndex,
|
||||
mode,
|
||||
additionalData.timezone,
|
||||
getAdditionalKeys(additionalData, mode),
|
||||
getAdditionalKeys(additionalData, mode, runExecutionData),
|
||||
undefined,
|
||||
fallbackValue,
|
||||
options,
|
||||
@@ -2643,7 +2666,7 @@ export function getExecuteHookFunctions(
|
||||
itemIndex,
|
||||
mode,
|
||||
additionalData.timezone,
|
||||
getAdditionalKeys(additionalData, mode),
|
||||
getAdditionalKeys(additionalData, mode, runExecutionData),
|
||||
undefined,
|
||||
fallbackValue,
|
||||
options,
|
||||
@@ -2657,7 +2680,7 @@ export function getExecuteHookFunctions(
|
||||
additionalData,
|
||||
mode,
|
||||
additionalData.timezone,
|
||||
getAdditionalKeys(additionalData, mode),
|
||||
getAdditionalKeys(additionalData, mode, null),
|
||||
isTest,
|
||||
);
|
||||
},
|
||||
@@ -2720,7 +2743,7 @@ export function getExecuteWebhookFunctions(
|
||||
itemIndex,
|
||||
mode,
|
||||
additionalData.timezone,
|
||||
getAdditionalKeys(additionalData, mode),
|
||||
getAdditionalKeys(additionalData, mode, null),
|
||||
undefined,
|
||||
fallbackValue,
|
||||
options,
|
||||
@@ -2758,7 +2781,7 @@ export function getExecuteWebhookFunctions(
|
||||
additionalData,
|
||||
mode,
|
||||
additionalData.timezone,
|
||||
getAdditionalKeys(additionalData, mode),
|
||||
getAdditionalKeys(additionalData, mode, null),
|
||||
),
|
||||
getWebhookName: () => webhookData.webhookDescription.name,
|
||||
prepareOutputData: NodeHelpers.prepareOutputData,
|
||||
|
||||
Reference in New Issue
Block a user