Skip to content

Commit

Permalink
Merge branch 'master' into node-1434-bug-loadoptions-continues-to-sho…
Browse files Browse the repository at this point in the history
…w-loading-placeholder-after
  • Loading branch information
elsmr committed Jun 24, 2024
2 parents 42a99f6 + e51de9d commit 256611b
Show file tree
Hide file tree
Showing 39 changed files with 2,856 additions and 1,040 deletions.
23 changes: 11 additions & 12 deletions cypress/e2e/14-mapping.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,16 +174,22 @@ describe('Data mapping', () => {
workflowPage.actions.zoomToFit();
workflowPage.actions.openNode('Set1');

ndv.actions.selectInputNode(SCHEDULE_TRIGGER_NODE_NAME);

ndv.getters.inputDataContainer().find('span').contains('count').realMouseDown();
ndv.actions.executePrevious();
ndv.actions.expandSchemaViewNode(SCHEDULE_TRIGGER_NODE_NAME);

const dataPill = ndv.getters
.inputDataContainer()
.findChildByTestId('run-data-schema-item')
.contains('count')
.should('be.visible');
dataPill.realMouseDown();
ndv.actions.mapToParameter('value');
ndv.getters
.inlineExpressionEditorInput()
.should('have.text', `{{ $('${SCHEDULE_TRIGGER_NODE_NAME}').item.json.input[0].count }}`);

ndv.actions.switchInputMode('Table');
ndv.actions.selectInputNode(SCHEDULE_TRIGGER_NODE_NAME);
ndv.actions.mapDataFromHeader(1, 'value');
ndv.getters
.inlineExpressionEditorInput()
Expand All @@ -194,7 +200,6 @@ describe('Data mapping', () => {

ndv.actions.selectInputNode('Set');

ndv.actions.executePrevious();
ndv.getters.executingLoader().should('not.exist');
ndv.getters.inputDataContainer().should('exist');
ndv.actions.validateExpressionPreview('value', '0 [object Object]');
Expand Down Expand Up @@ -291,14 +296,8 @@ describe('Data mapping', () => {
ndv.actions.executePrevious();
ndv.getters.executingLoader().should('not.exist');
ndv.getters.inputDataContainer().should('exist');
ndv.getters
.inputDataContainer()
.should('exist')
.find('span')
.contains('test_name')
.realMouseDown();
ndv.actions.mapToParameter('value');

ndv.actions.switchInputMode('Table');
ndv.actions.mapDataFromHeader(1, 'value');
ndv.actions.validateExpressionPreview('value', 'test_value');
ndv.actions.selectInputNode(SCHEDULE_TRIGGER_NODE_NAME);
ndv.actions.validateExpressionPreview('value', 'test_value');
Expand Down
6 changes: 3 additions & 3 deletions cypress/e2e/24-ndv-paired-item.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ describe('NDV', () => {
workflowPage.actions.executeWorkflow();
workflowPage.actions.openNode('Set3');

ndv.actions.switchInputMode('Table');
ndv.actions.switchOutputMode('Table');

ndv.getters
.inputRunSelector()
.should('exist')
Expand All @@ -123,9 +126,6 @@ describe('NDV', () => {
.find('input')
.should('include.value', '2 of 2 (6 items)');

ndv.actions.switchInputMode('Table');
ndv.actions.switchOutputMode('Table');

ndv.actions.changeOutputRunSelector('1 of 2 (6 items)');
ndv.getters.inputRunSelector().find('input').should('include.value', '1 of 2 (6 items)');
ndv.getters.outputRunSelector().find('input').should('include.value', '1 of 2 (6 items)');
Expand Down
19 changes: 7 additions & 12 deletions cypress/e2e/32-node-io-filter.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ describe('Node IO Filter', () => {
workflowPage.getters.canvasNodes().first().dblclick();
ndv.actions.close();
workflowPage.getters.canvasNodes().first().dblclick();
cy.wait(500);
ndv.getters.outputDataContainer().should('be.visible');
ndv.getters.outputPanel().findChildByTestId('ndv-search').should('exist');
cy.document().trigger('keyup', { key: '/' });

const searchInput = ndv.getters.searchInput();

searchInput.filter(':focus').should('exist');
searchInput.should('have.focus');
ndv.getters.pagination().find('li').should('have.length', 3);
ndv.getters.outputDataContainer().find('mark').should('not.exist');

Expand All @@ -36,19 +36,18 @@ describe('Node IO Filter', () => {

it('should filter input/output data separately', () => {
workflowPage.getters.canvasNodes().eq(1).dblclick();
cy.wait(500);
ndv.getters.outputDataContainer().should('be.visible');
ndv.getters.inputDataContainer().should('be.visible');
ndv.actions.switchInputMode('Table');
ndv.getters.outputPanel().findChildByTestId('ndv-search').should('exist');
cy.document().trigger('keyup', { key: '/' });

ndv.getters.outputPanel().findChildByTestId('ndv-search').filter(':focus').should('not.exist');
ndv.getters.outputPanel().findChildByTestId('ndv-search').should('not.have.focus');

let focusedInput = ndv.getters
.inputPanel()
.findChildByTestId('ndv-search')
.filter(':focus')
.should('exist');
.should('have.focus');

const getInputPagination = () =>
ndv.getters.inputPanel().findChildByTestId('ndv-data-pagination');
Expand Down Expand Up @@ -82,13 +81,9 @@ describe('Node IO Filter', () => {

ndv.getters.outputDataContainer().trigger('mouseover');
cy.document().trigger('keyup', { key: '/' });
ndv.getters.inputPanel().findChildByTestId('ndv-search').filter(':focus').should('not.exist');
ndv.getters.inputPanel().findChildByTestId('ndv-search').should('not.have.focus');

focusedInput = ndv.getters
.outputPanel()
.findChildByTestId('ndv-search')
.filter(':focus')
.should('exist');
focusedInput = ndv.getters.outputPanel().findChildByTestId('ndv-search').should('have.focus');

getInputPagination().find('li').should('have.length', 3);
getInputCounter().contains('21 items').should('exist');
Expand Down
9 changes: 5 additions & 4 deletions cypress/e2e/5-ndv.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,10 @@ describe('NDV', () => {
cy.createFixtureWorkflow('NDV-test-select-input.json', 'NDV test select input');
workflowPage.actions.zoomToFit();
workflowPage.getters.canvasNodes().last().dblclick();
ndv.actions.switchInputMode('Table');
ndv.getters.inputSelect().click();
ndv.getters.inputOption().last().click();
ndv.getters.inputDataContainer().find('[class*=schema_]').should('exist');
ndv.getters.inputDataContainer().should('be.visible');
ndv.getters.inputDataContainer().should('contain', 'start');
ndv.getters.backToCanvas().click();
ndv.getters.container().should('not.be.visible');
Expand Down Expand Up @@ -252,6 +253,9 @@ describe('NDV', () => {
workflowPage.actions.executeWorkflow();
workflowPage.actions.openNode('Set3');

ndv.actions.switchInputMode('Table');
ndv.actions.switchOutputMode('Table');

ndv.getters
.inputRunSelector()
.should('exist')
Expand All @@ -263,9 +267,6 @@ describe('NDV', () => {
.find('input')
.should('include.value', '2 of 2 (6 items)');

ndv.actions.switchInputMode('Table');
ndv.actions.switchOutputMode('Table');

ndv.actions.changeOutputRunSelector('1 of 2 (6 items)');
ndv.getters.inputRunSelector().find('input').should('include.value', '1 of 2 (6 items)');
ndv.getters.inputTbodyCell(1, 0).should('have.text', '1111');
Expand Down
5 changes: 5 additions & 0 deletions cypress/pages/ndv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ export class NDV extends BasePage {
nodeRunErrorDescription: () => cy.getByTestId('node-error-description'),
fixedCollectionParameter: (paramName: string) =>
cy.getByTestId(`fixed-collection-${paramName}`),
schemaViewNode: () => cy.getByTestId('run-data-schema-node'),
schemaViewNodeName: () => cy.getByTestId('run-data-schema-node-name'),
};

actions = {
Expand Down Expand Up @@ -214,6 +216,9 @@ export class NDV extends BasePage {
this.getters.inputSelect().find('.el-select').click();
this.getters.inputOption().contains(nodeName).click();
},
expandSchemaViewNode: (nodeName: string) => {
this.getters.schemaViewNodeName().contains(nodeName).click();
},
addDefaultPinnedData: () => {
this.actions.editPinnedData();
this.actions.savePinnedData();
Expand Down
10 changes: 3 additions & 7 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,9 @@ Cypress.Commands.add(
},
);

Cypress.Commands.add(
'findChildByTestId',
{ prevSubject: true },
(subject: Cypress.Chainable<JQuery<HTMLElement>>, childTestId) => {
return subject.find(`[data-test-id="${childTestId}"]`);
},
);
Cypress.Commands.addQuery('findChildByTestId', function (testId: string) {
return (subject: Cypress.Chainable) => subject.find(`[data-test-id="${testId}"]`);
});

Cypress.Commands.add('waitForLoad', (waitForIntercepts = true) => {
// These aliases are set-up before each test in cypress/support/e2e.ts
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"semver": "^7.5.4",
"tslib": "^2.6.2",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.4.2",
"typescript": "^5.5.2",
"ws": ">=8.17.1"
},
"patchedDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export class ExternalSecretsManager {
)
).map((i) => (i.status === 'rejected' ? null : i.value));
this.providers = Object.fromEntries(
(providers.filter((p) => p !== null) as SecretsProvider[]).map((s) => [s.name, s]),
providers.filter((p): p is SecretsProvider => p !== null).map((s) => [s.name, s]),
);
this.cachedSettings = settings;
await this.updateSecrets();
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/ExternalSecrets/providers/vault.ts
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ export class VaultProvider extends SecretsProvider {
)
)
.map((i) => (i.status === 'rejected' ? null : i.value))
.filter((v) => v !== null) as Array<[string, IDataObject]>,
.filter((v): v is [string, IDataObject] => v !== null),
);
const name = path.substring(0, path.length - 1);
return [name, data];
Expand All @@ -480,7 +480,7 @@ export class VaultProvider extends SecretsProvider {
return [basePath.substring(0, basePath.length - 1), value[1]];
}),
)
).filter((v) => v !== null) as Array<[string, IDataObject]>,
).filter((v): v is [string, IDataObject] => v !== null),
);
this.cachedSecrets = secrets;
}
Expand Down
24 changes: 8 additions & 16 deletions packages/cli/src/WorkflowExecuteAdditionalData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1047,10 +1047,8 @@ function getWorkflowHooksIntegrated(
const hookFunctions = hookFunctionsSave();
const preExecuteFunctions = hookFunctionsPreExecute();
for (const key of Object.keys(preExecuteFunctions)) {
if (hookFunctions[key] === undefined) {
hookFunctions[key] = [];
}
hookFunctions[key]!.push.apply(hookFunctions[key], preExecuteFunctions[key]);
const hooks = hookFunctions[key] ?? [];
hooks.push.apply(hookFunctions[key], preExecuteFunctions[key]);
}
return new WorkflowHooks(hookFunctions, mode, executionId, workflowData);
}
Expand All @@ -1069,10 +1067,8 @@ export function getWorkflowHooksWorkerExecuter(
const hookFunctions = hookFunctionsSaveWorker();
const preExecuteFunctions = hookFunctionsPreExecute();
for (const key of Object.keys(preExecuteFunctions)) {
if (hookFunctions[key] === undefined) {
hookFunctions[key] = [];
}
hookFunctions[key]!.push.apply(hookFunctions[key], preExecuteFunctions[key]);
const hooks = hookFunctions[key] ?? [];
hooks.push.apply(hookFunctions[key], preExecuteFunctions[key]);
}

return new WorkflowHooks(hookFunctions, mode, executionId, workflowData, optionalParameters);
Expand Down Expand Up @@ -1139,18 +1135,14 @@ export function getWorkflowHooksMain(
const hookFunctions = hookFunctionsSave();
const pushFunctions = hookFunctionsPush();
for (const key of Object.keys(pushFunctions)) {
if (hookFunctions[key] === undefined) {
hookFunctions[key] = [];
}
hookFunctions[key]!.push.apply(hookFunctions[key], pushFunctions[key]);
const hooks = hookFunctions[key] ?? [];
hooks.push.apply(hookFunctions[key], pushFunctions[key]);
}

const preExecuteFunctions = hookFunctionsPreExecute();
for (const key of Object.keys(preExecuteFunctions)) {
if (hookFunctions[key] === undefined) {
hookFunctions[key] = [];
}
hookFunctions[key]!.push.apply(hookFunctions[key], preExecuteFunctions[key]);
const hooks = hookFunctions[key] ?? [];
hooks.push.apply(hookFunctions[key], preExecuteFunctions[key]);
}

if (!hookFunctions.nodeExecuteBefore) hookFunctions.nodeExecuteBefore = [];
Expand Down
6 changes: 4 additions & 2 deletions packages/cli/src/commands/executeBatch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -737,8 +737,10 @@ export class ExecuteBatch extends BaseCommand {
return;
}

if (nodeEdgeCases[nodeName].capResults !== undefined) {
executionDataArray.splice(nodeEdgeCases[nodeName].capResults!);
const capResults = nodeEdgeCases[nodeName].capResults;

if (capResults !== undefined) {
executionDataArray.splice(capResults);
}

if (nodeEdgeCases[nodeName].ignoredProperties !== undefined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,13 +235,14 @@ export class SourceControlExportService {
data: ICredentialDataDecryptedObject,
): ICredentialDataDecryptedObject => {
for (const [key] of Object.entries(data)) {
const value = data[key];
try {
if (data[key] === null) {
if (value === null) {
delete data[key]; // remove invalid null values
} else if (typeof data[key] === 'object') {
data[key] = this.replaceCredentialData(data[key] as ICredentialDataDecryptedObject);
} else if (typeof data[key] === 'string') {
data[key] = stringContainsExpression(data[key] as string) ? data[key] : '';
} else if (typeof value === 'object') {
data[key] = this.replaceCredentialData(value as ICredentialDataDecryptedObject);
} else if (typeof value === 'string') {
data[key] = stringContainsExpression(value) ? data[key] : '';
} else if (typeof data[key] === 'number') {
// TODO: leaving numbers in for now, but maybe we should remove them
continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ export class SourceControlImportService {
}),
);
return remoteWorkflowFilesParsed.filter(
(e) => e !== undefined,
) as SourceControlWorkflowVersionId[];
(e): e is SourceControlWorkflowVersionId => e !== undefined,
);
}

public async getLocalVersionIdsFromDb(): Promise<SourceControlWorkflowVersionId[]> {
Expand Down
6 changes: 4 additions & 2 deletions packages/cli/src/telemetry/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,15 @@ export class Telemetry {
properties.success ? 'success' : 'error'
}`;

if (!this.executionCountsBuffer[workflowId][key]) {
const executionTrackDataKey = this.executionCountsBuffer[workflowId][key];

if (!executionTrackDataKey) {
this.executionCountsBuffer[workflowId][key] = {
count: 1,
first: execTime,
};
} else {
this.executionCountsBuffer[workflowId][key]!.count++;
executionTrackDataKey.count++;
}

if (
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/ActiveWorkflows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export class ActiveWorkflows {
if (triggerResponse !== undefined) {
// If a response was given save it

// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
this.activeWorkflows[workflowId].triggerResponses!.push(triggerResponse);
}
} catch (e) {
Expand All @@ -105,6 +106,7 @@ export class ActiveWorkflows {

for (const pollNode of pollingNodes) {
try {
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
this.activeWorkflows[workflowId].pollResponses!.push(
await this.activatePolling(
pollNode,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/NodeExecuteFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3679,7 +3679,7 @@ export function getExecuteFunctions(
});
}

return inputData[inputName][inputIndex] as INodeExecutionData[];
return inputData[inputName][inputIndex];
},
getInputSourceData: (inputIndex = 0, inputName = 'main') => {
if (executeData?.source === null) {
Expand Down
3 changes: 3 additions & 0 deletions packages/design-system/src/css/_tokens.dark.scss
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,9 @@
--color-mfa-recovery-code-color: var(--color-text-dark);
--color-mfa-lose-access-text-color: var(--color-danger);

// Text highlight
--color-text-highlight-background: var(--prim-color-alt-d-shade-600);

// AI
--node-type-background-l: 20%;
--node-type-supplemental-label-color-h: 235;
Expand Down
3 changes: 3 additions & 0 deletions packages/design-system/src/css/_tokens.scss
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,9 @@
--color-mfa-recovery-code-color: var(--prim-gray-490);
--color-mfa-lose-access-text-color: var(--color-danger);

// Text highlight
--color-text-highlight-background: var(--prim-color-alt-d-shade-150);

// AI
--node-type-background-l: 95%;
--node-type-supplemental-label-color-h: 235;
Expand Down
2 changes: 1 addition & 1 deletion packages/design-system/src/css/reset.scss
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ ins {
}

mark {
background-color: var(--color-warning);
background-color: var(--color-text-highlight-background);
color: var(--color-text-dark);
font-style: italic;
font-weight: bold;
Expand Down
Loading

0 comments on commit 256611b

Please sign in to comment.