Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add assignment component with drag and drop to Set node #8283

Merged
merged 39 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
4aece9d
Add assignmentCollection parameter type with drag and drop
elsmr Jan 9, 2024
7439164
Use new assignmentCollection in Set node
elsmr Jan 9, 2024
725d47b
Merge branch 'master' into node-1010-dragndrop-component
elsmr Jan 10, 2024
3dd8305
Fix import of debounce composable
elsmr Jan 10, 2024
487b18d
Fix Set node tests
elsmr Jan 11, 2024
84cc183
Fix review remarks
elsmr Jan 11, 2024
ccd38b3
Fix drag/drop color for right border
elsmr Jan 11, 2024
9277fe0
Make assignment drop area height viewport relative
elsmr Jan 15, 2024
8d6e24f
Add tests for assignment component and Set node 3.3
elsmr Jan 16, 2024
5463eda
Style and copy tweaks.
gandreini Jan 16, 2024
07f43b6
Merge branch 'node-1010-dragndrop-component' of github.com:n8n-io/n8n…
gandreini Jan 16, 2024
b38a6c5
Merge branch 'master' into node-1010-dragndrop-component
elsmr Jan 17, 2024
e469233
Styling tweaks for assignment component
elsmr Jan 17, 2024
075aa83
Rename JSON Output to JSON
elsmr Jan 17, 2024
087b97b
Set Node overhaul
elsmr Jan 17, 2024
1fa7928
Add bulk actions to assignment component
elsmr Jan 17, 2024
0faeab1
Minor copy tweak.
gandreini Jan 18, 2024
4921fa0
Merge branch 'master' into node-1010-dragndrop-component
elsmr Jan 22, 2024
76908b3
Adapt e2e tests to new Edit Fields node
elsmr Jan 22, 2024
958c0af
Review feedback
elsmr Jan 22, 2024
096ca9c
Set node copy update
elsmr Jan 24, 2024
dfda527
Add component tests
elsmr Jan 24, 2024
08d8550
Remove unused import
elsmr Jan 24, 2024
1273bfe
Copy tweaks to "Include Other Input Fields" boolean.
gandreini Jan 25, 2024
7a36a63
Adapt Set node logic to new includeOtherFields parameter
elsmr Jan 25, 2024
f997ce8
Merge branch 'master' into node-1010-dragndrop-component
elsmr Jan 25, 2024
4a9151c
Merge branch 'master' into node-1010-dragndrop-component
elsmr Jan 25, 2024
ea6d36e
Fix fields to include setting in <v3.3
elsmr Jan 25, 2024
e322a3d
Add boolean dropdown to filter and assignment component
elsmr Jan 25, 2024
73d0f6d
Add workflow tests for input fields in Set node v3 and 3.3
elsmr Jan 25, 2024
3ba7eeb
Remove unused method
elsmr Jan 25, 2024
3af1857
Organize imports
elsmr Jan 25, 2024
5a9aed0
Organize imports
elsmr Jan 26, 2024
b6e582c
Merge branch 'master' into node-1010-dragndrop-component
elsmr Jan 30, 2024
a4a06df
Adapt e2e test to renamed parameter
elsmr Jan 30, 2024
38a3275
Merge branch 'master' into node-1010-dragndrop-component
elsmr Jan 31, 2024
f3cac00
Multiline inputs in filter/assignment component
elsmr Jan 31, 2024
6289c93
DragnDrop component styling fixes
elsmr Feb 2, 2024
5dee888
Fix e2e
elsmr Feb 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions cypress/e2e/13-pinning.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,22 +157,24 @@ describe('Data pinning', () => {

workflowPage.actions.executeWorkflow();

cy.request('GET', `${BACKEND_BASE_URL}/webhook-test/b0d79ddb-df2d-49b1-8555-9fa2b482608f`).then((response) => {
expect(response.status).to.eq(200);
});
cy.request('GET', `${BACKEND_BASE_URL}/webhook-test/b0d79ddb-df2d-49b1-8555-9fa2b482608f`).then(
(response) => {
expect(response.status).to.eq(200);
},
);

workflowPage.actions.openNode('End');

ndv.getters.outputTableRow(1).should('exist')
ndv.getters.outputTableRow(1).should('exist');
ndv.getters.outputTableRow(1).should('have.text', 'pin-overwritten');
});
});

function setExpressionOnStringValueInSet(expression: string) {
cy.get('button').contains('Test step').click();
cy.get('.fixed-collection-parameter > :nth-child(2) > .button > span').click();

ndv.getters.nthParam(4).contains('Expression').invoke('show').click();
ndv.getters.assignmentCollectionAdd('assignments').click();
ndv.getters.assignmentValue('assignments').contains('Expression').invoke('show').click();

ndv.getters
.inlineExpressionEditorInput()
Expand Down
8 changes: 4 additions & 4 deletions cypress/e2e/14-data-transformation-expressions.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { WorkflowPage, NDV } from '../pages';
import { getVisibleSelect } from '../utils';

const wf = new WorkflowPage();
const ndv = new NDV();
Expand Down Expand Up @@ -104,8 +105,7 @@ describe('Data transformation expressions', () => {

const addEditFields = () => {
wf.actions.addNodeToCanvas('Edit Fields', true, true);
cy.get('.fixed-collection-parameter > :nth-child(2) > .button > span').click();
ndv.getters.parameterInput('include').click(); // shorten output
cy.get('div').contains('No Input Fields').click();
ndv.getters.nthParam(4).contains('Expression').invoke('show').click();
ndv.getters.parameterInput('keepOnlySetFields').click();
ndv.getters.assignmentCollectionAdd('assignments').click();
ndv.getters.assignmentValue('assignments').contains('Expression').invoke('show').click();
};
17 changes: 9 additions & 8 deletions cypress/e2e/16-webhook-node.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,10 @@ describe('Webhook Trigger node', async () => {

workflowPage.actions.addNodeToCanvas(EDIT_FIELDS_SET_NODE_NAME);
workflowPage.actions.openNode(EDIT_FIELDS_SET_NODE_NAME);
cy.get('.fixed-collection-parameter > :nth-child(2) > .button > span').click();
ndv.getters.nthParam(2).type('data');
ndv.getters.nthParam(4).invoke('val', cowBase64).trigger('blur');
ndv.getters.assignmentCollectionAdd('assignments').click();
ndv.getters.assignmentName('assignments').type('data');
ndv.getters.assignmentType('assignments').click();
ndv.getters.assignmentValue('assignments').paste(cowBase64);

ndv.getters.backToCanvas().click();

Expand Down Expand Up @@ -311,9 +312,9 @@ describe('Webhook Trigger node', async () => {
const addEditFields = () => {
workflowPage.actions.addNodeToCanvas(EDIT_FIELDS_SET_NODE_NAME);
workflowPage.actions.openNode(EDIT_FIELDS_SET_NODE_NAME);
cy.get('.fixed-collection-parameter > :nth-child(2) > .button > span').click();
ndv.getters.nthParam(2).type('MyValue');
ndv.getters.nthParam(3).click();
cy.get('div').contains('Number').click();
ndv.getters.nthParam(4).type('1234');
ndv.getters.assignmentCollectionAdd('assignments').click();
ndv.getters.assignmentName('assignments').type('MyValue');
ndv.getters.assignmentType('assignments').click();
getVisibleSelect().find('li').contains('Number').click();
ndv.getters.assignmentValue('assignments').type('1234');
};
6 changes: 3 additions & 3 deletions cypress/e2e/5-ndv.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ describe('NDV', () => {

ndv.getters.parameterInput('remoteOptions').click();

ndv.getters.parameterInputIssues('remoteOptions').realHover({ scrollBehavior: false});
ndv.getters.parameterInputIssues('remoteOptions').realHover({ scrollBehavior: false });
// Remote options dropdown should not be visible
ndv.getters.parameterInput('remoteOptions').find('.el-select').should('not.exist');
});
Expand Down Expand Up @@ -509,12 +509,12 @@ describe('NDV', () => {

workflowPage.actions.openNode('Edit Fields (old)');
ndv.actions.openSettings();
ndv.getters.nodeVersion().should('have.text', 'Set node version 2 (Latest version: 3.2)');
ndv.getters.nodeVersion().should('have.text', 'Set node version 2 (Latest version: 3.3)');
ndv.actions.close();

workflowPage.actions.openNode('Edit Fields (latest)');
ndv.actions.openSettings();
ndv.getters.nodeVersion().should('have.text', 'Edit Fields (Set) node version 3.2 (Latest)');
ndv.getters.nodeVersion().should('have.text', 'Edit Fields (Set) node version 3.3 (Latest)');
ndv.actions.close();

workflowPage.actions.openNode('Function');
Expand Down
2 changes: 1 addition & 1 deletion cypress/fixtures/Test_workflow_ndv_version.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"id": "93aaadac-55fe-4618-b1eb-f63e61d1446a",
"name": "Edit Fields (latest)",
"type": "n8n-nodes-base.set",
"typeVersion": 3.2,
"typeVersion": 3.3,
"position": [
1720,
780
Expand Down
17 changes: 17 additions & 0 deletions cypress/pages/ndv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,20 @@ export class NDV extends BasePage {
this.getters.filterComponent(paramName).getByTestId('filter-remove-condition').eq(index),
filterConditionAdd: (paramName: string) =>
this.getters.filterComponent(paramName).getByTestId('filter-add-condition'),
assignmentCollection: (paramName: string) =>
cy.getByTestId(`assignment-collection-${paramName}`),
assignmentCollectionAdd: (paramName: string) =>
this.getters.assignmentCollection(paramName).getByTestId('assignment-collection-drop-area'),
assignment: (paramName: string, index = 0) =>
this.getters.assignmentCollection(paramName).getByTestId('assignment').eq(index),
assignmentRemove: (paramName: string, index = 0) =>
this.getters.assignment(paramName, index).getByTestId('assignment-remove'),
assignmentName: (paramName: string, index = 0) =>
this.getters.assignment(paramName, index).getByTestId('assignment-name'),
assignmentValue: (paramName: string, index = 0) =>
this.getters.assignment(paramName, index).getByTestId('assignment-value'),
assignmentType: (paramName: string, index = 0) =>
this.getters.assignment(paramName, index).getByTestId('assignment-type-select'),
searchInput: () => cy.getByTestId('ndv-search'),
pagination: () => cy.getByTestId('ndv-data-pagination'),
nodeVersion: () => cy.getByTestId('node-version'),
Expand Down Expand Up @@ -235,6 +249,9 @@ export class NDV extends BasePage {
removeFilterCondition: (paramName: string, index: number) => {
this.getters.filterConditionRemove(paramName, index).click();
},
removeAssignment: (paramName: string, index: number) => {
this.getters.assignmentRemove(paramName, index).click();
},
setInvalidExpression: ({
fieldName,
invalidExpression,
Expand Down
18 changes: 18 additions & 0 deletions packages/design-system/src/css/_primitives.scss
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@
var(--prim-color-primary-s),
var(--prim-color-primary-l)
);
--prim-color-primary-alpha-010: hsla(
var(--prim-color-primary-h),
var(--prim-color-primary-s),
var(--prim-color-primary-l),
0.1
);
--prim-color-primary-tint-100: hsl(
var(--prim-color-primary-h),
var(--prim-color-primary-s),
Expand Down Expand Up @@ -93,6 +99,12 @@
var(--prim-color-secondary-l),
0.25
);
--prim-color-secondary-alpha-010: hsla(
var(--prim-color-secondary-h),
var(--prim-color-secondary-s),
var(--prim-color-secondary-l),
0.1
);
--prim-color-secondary-tint-100: hsl(
var(--prim-color-secondary-h),
var(--prim-color-secondary-s),
Expand Down Expand Up @@ -140,6 +152,12 @@
var(--prim-color-alt-a-l),
0.25
);
--prim-color-alt-a-alpha-015: hsl(
var(--prim-color-alt-a-h),
var(--prim-color-alt-a-s),
var(--prim-color-alt-a-l),
0.15
);
--prim-color-alt-a-tint-300: hsl(
var(--prim-color-alt-a-h),
var(--prim-color-alt-a-s),
Expand Down
2 changes: 2 additions & 0 deletions packages/design-system/src/css/_tokens.dark.scss
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@
// NDV
--color-run-data-background: var(--prim-gray-800);
--color-ndv-droppable-parameter: var(--prim-color-primary);
--color-ndv-droppable-parameter-background: var(--prim-color-primary-alpha-010);
--color-ndv-droppable-parameter-active-background: var(--prim-color-alt-a-alpha-015);
--color-ndv-back-font: var(--prim-gray-0);
--color-ndv-ouptut-error-font: var(--prim-color-alt-c-tint-150);

Expand Down
2 changes: 2 additions & 0 deletions packages/design-system/src/css/_tokens.scss
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@
// NDV
--color-run-data-background: var(--color-background-base);
--color-ndv-droppable-parameter: var(--color-secondary);
--color-ndv-droppable-parameter-background: var(--prim-color-secondary-alpha-010);
--color-ndv-droppable-parameter-active-background: var(--prim-color-alt-a-alpha-015);
--color-ndv-back-font: var(--prim-gray-0);
--color-ndv-ouptut-error-font: var(--prim-color-alt-c);

Expand Down
4 changes: 2 additions & 2 deletions packages/editor-ui/src/Interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1235,8 +1235,8 @@ export interface NDVState {
isDragging: boolean;
type: string;
data: string;
activeTargetId: string | null;
stickyPosition: null | XYPosition;
dimensions: DOMRect | null;
activeTarget: { id: string; stickyPosition: null | XYPosition } | null;
};
isMappingOnboarded: boolean;
}
Expand Down
Loading
Loading