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

fix(editor): Fix operation change failing in certain conditions #8114

Merged
merged 2 commits into from
Dec 22, 2023

Conversation

MiloradFilipovic
Copy link
Contributor

@MiloradFilipovic MiloradFilipovic commented Dec 21, 2023

Summary

This PR handles the case when there are multiple parameters with the same name but different options and displayOptions. In this case, if one of such fields is set, changing the dependent parameter value so the other should be shown causes an error in case their options are not compatible (this check).

Example:

LDAP node has two options properties with the same name:

  1. attributes with predefined options (add, replace, delete). Shown when Update operation is selected
  2. attributes with a collection of attribute objects. Shows for the Create operation

Setting one of these parameter values and switching operation so the other is shown breaks the app.
This PR checks if there is a value saved for such parameter and removes it before calling getNodeParameters in valueChanged handler.

Related tickets and issues

Fixes ADO-1589

Review / Merge checklist

  • PR title and summary are descriptive. Remember, the title automatically goes into the changelog. Use (no-changelog) otherwise. (conventions)
  • Docs updated or follow-up ticket created.
  • Tests included.

    A bug is not considered fixed, unless a test is added to prevent it from happening again.
    A feature is not complete without tests.

@MiloradFilipovic MiloradFilipovic self-assigned this Dec 21, 2023
@MiloradFilipovic MiloradFilipovic changed the title Ado 1589 fix operation change bug fix(editor): Fix operation change failing in certain conditions Dec 21, 2023
@MiloradFilipovic MiloradFilipovic marked this pull request as draft December 21, 2023 09:05
Copy link

cypress bot commented Dec 21, 2023

Passing run #3456 ↗︎

0 317 5 0 Flakiness 0

Details:

🌳 🖥️ browsers:node18.12.0-chrome107 🤖 MiloradFilipovic 🗃️ e2e/*
Project: n8n Commit: 86aaab86f2
Status: Passed Duration: 06:40 💡
Started: Dec 21, 2023 3:52 PM Ended: Dec 21, 2023 3:59 PM

Review all test suite changes for PR #8114 ↗︎

@n8n-assistant n8n-assistant bot added n8n team Authored by the n8n team ui Enhancement in /editor-ui or /design-system labels Dec 21, 2023
@MiloradFilipovic MiloradFilipovic marked this pull request as ready for review December 21, 2023 09:36
Copy link
Contributor

✅ All Cypress E2E specs passed

@MiloradFilipovic MiloradFilipovic merged commit 711fa2b into master Dec 22, 2023
36 checks passed
@MiloradFilipovic MiloradFilipovic deleted the ADO-1589-fix-operation-change-bug branch December 22, 2023 07:41
MiloradFilipovic added a commit that referenced this pull request Dec 22, 2023
* master:
  fix(editor): Prevent canvas undo/redo when NDV is open (#8118)
  fix(editor): Fix operation change failing in certain conditions (#8114)
  fix(Asana Node): Omit body from GET, HEAD, and DELETE requests (#8057)
  fix(Redis Trigger Node): Activating a workflow with a Redis trigger fails (#8129)
  refactor(Peekalink Node): Stricter typing for Peekalink api call + Tests (no-changelog) (#8125)
  fix(core): Remove circular dependency in WorkflowService and ActiveWorkflowRunner (#8128)
  fix: Show public API upgrade CTA when feature is not enabled (#8109)
  feat(Snowflake Node): Update snowflake-sdk (no-changelog) (#8087)
  fix(core): Handle empty executions table in pruning in migrations (#8121)
  feat(core): Add closeFunction support to Sub-Nodes (#7708)
  refactor(core): Move error execution creation to execution service (no-changelog) (#8006)
  ci: Add lint rule `no-dynamic-import-template` (no-changelog) (#8089)
  feat(core): Remove discontinued crypto-js  (#8104)
  🚀 Release 1.22.0 (#8115)
  fix(core): Prevent axios from force setting a form-urlencoded content-type (#8117)

# Conflicts:
#	cypress/e2e/5-ndv.cy.ts
MiloradFilipovic added a commit that referenced this pull request Dec 22, 2023
* master:
  feat(core): Unify application components shutdown (#8097)
  refactor(core): Upgrade more dependencies to remove axios 0.x (no-changelog) (#8105)
  refactor(core): Move active workflows endpoints to a decorated controller class (no-changelog) (#8101)
  fix(editor): Prevent canvas undo/redo when NDV is open (#8118)
  fix(editor): Fix operation change failing in certain conditions (#8114)
  fix(Asana Node): Omit body from GET, HEAD, and DELETE requests (#8057)
  fix(Redis Trigger Node): Activating a workflow with a Redis trigger fails (#8129)
  refactor(Peekalink Node): Stricter typing for Peekalink api call + Tests (no-changelog) (#8125)
  fix(core): Remove circular dependency in WorkflowService and ActiveWorkflowRunner (#8128)
  fix: Show public API upgrade CTA when feature is not enabled (#8109)
  feat(Snowflake Node): Update snowflake-sdk (no-changelog) (#8087)
  fix(core): Handle empty executions table in pruning in migrations (#8121)
  feat(core): Add closeFunction support to Sub-Nodes (#7708)
  refactor(core): Move error execution creation to execution service (no-changelog) (#8006)
  ci: Add lint rule `no-dynamic-import-template` (no-changelog) (#8089)
  feat(core): Remove discontinued crypto-js  (#8104)
  🚀 Release 1.22.0 (#8115)
  fix(core): Prevent axios from force setting a form-urlencoded content-type (#8117)
  feat(Respond to Webhook Node): Overhaul with improvements like returning all items (#8093)
jamesfdavis added a commit to jamesfdavis/n8n that referenced this pull request Dec 24, 2023
* upstream/master: (32 commits)
  refactor(core): Move `typeorm` operators from `PruningService` to `ExecutionRepository` (no-changelog) (n8n-io#8145)
  refactor(core): Move more `typeorm` operators to repositories (no-changelog) (n8n-io#8143)
  refactor(core): Delete unused code, and fix typings in tests (no-changelog) (n8n-io#8142)
  docs: Improve documentation for the toTitleCase function (no-changelog) (n8n-io#8140)
  refactor(core): Move all base URLs to UrlService (no-changelog) (n8n-io#8141)
  feat(editor): Add template Id to workflow metadata (n8n-io#8088)
  fix(editor): Avoid sanitizing output to search node data (n8n-io#8126)
  fix(editor): Prevent browser zoom when scrolling inside sticky edit mode (n8n-io#8116)
  refactor(core): Move some `typeorm` operators to repositories (no-changelog) (n8n-io#8139)
  feat(editor): Add node execution status indicator to output panel (n8n-io#8124)
  feat(core): Unify application components shutdown (n8n-io#8097)
  refactor(core): Upgrade more dependencies to remove axios 0.x (no-changelog) (n8n-io#8105)
  refactor(core): Move active workflows endpoints to a decorated controller class (no-changelog) (n8n-io#8101)
  fix(editor): Prevent canvas undo/redo when NDV is open (n8n-io#8118)
  fix(editor): Fix operation change failing in certain conditions (n8n-io#8114)
  fix(Asana Node): Omit body from GET, HEAD, and DELETE requests (n8n-io#8057)
  fix(Redis Trigger Node): Activating a workflow with a Redis trigger fails (n8n-io#8129)
  refactor(Peekalink Node): Stricter typing for Peekalink api call + Tests (no-changelog) (n8n-io#8125)
  fix(core): Remove circular dependency in WorkflowService and ActiveWorkflowRunner (n8n-io#8128)
  fix: Show public API upgrade CTA when feature is not enabled (n8n-io#8109)
  ...
ivov pushed a commit that referenced this pull request Dec 27, 2023
## Summary
This PR handles the case when there are multiple parameters with the
same name but different `options` and `displayOptions`. In this case, if
one of such fields is set, changing the dependent parameter value so the
other should be shown causes an error in case their options are not
compatible (this
[check](https://github.com/n8n-io/n8n/blob/7806a65229878a473f5526bad0b94614e8bfa8aa/packages/workflow/src/NodeHelpers.ts#L786)).

#### Example:
LDAP node has two `options` properties with the same name:
1. `attributes` with predefined options (`add`, `replace`, `delete`).
Shown when **Update** operation is selected
2. `attributes` with a collection of `attribute` objects. Shows for the
**Create** operation

Setting one of these parameter values and switching operation so the
other is shown breaks the app.
This PR checks if there is a value saved for such parameter and removes
it before calling `getNodeParameters` in `valueChanged` handler.

## Related tickets and issues
Fixes ADO-1589

## Review / Merge checklist
- [x] PR title and summary are descriptive. **Remember, the title
automatically goes into the changelog. Use `(no-changelog)` otherwise.**
([conventions](https://github.com/n8n-io/n8n/blob/master/.github/pull_request_title_conventions.md))
- [ ] [Docs updated](https://github.com/n8n-io/n8n-docs) or follow-up
ticket created.
- [x] Tests included.
> A bug is not considered fixed, unless a test is added to prevent it
from happening again.
   > A feature is not complete without tests.
ivov pushed a commit that referenced this pull request Dec 27, 2023
## Summary
This PR handles the case when there are multiple parameters with the
same name but different `options` and `displayOptions`. In this case, if
one of such fields is set, changing the dependent parameter value so the
other should be shown causes an error in case their options are not
compatible (this
[check](https://github.com/n8n-io/n8n/blob/7806a65229878a473f5526bad0b94614e8bfa8aa/packages/workflow/src/NodeHelpers.ts#L786)).

#### Example:
LDAP node has two `options` properties with the same name:
1. `attributes` with predefined options (`add`, `replace`, `delete`).
Shown when **Update** operation is selected
2. `attributes` with a collection of `attribute` objects. Shows for the
**Create** operation

Setting one of these parameter values and switching operation so the
other is shown breaks the app.
This PR checks if there is a value saved for such parameter and removes
it before calling `getNodeParameters` in `valueChanged` handler.

## Related tickets and issues
Fixes ADO-1589

## Review / Merge checklist
- [x] PR title and summary are descriptive. **Remember, the title
automatically goes into the changelog. Use `(no-changelog)` otherwise.**
([conventions](https://github.com/n8n-io/n8n/blob/master/.github/pull_request_title_conventions.md))
- [ ] [Docs updated](https://github.com/n8n-io/n8n-docs) or follow-up
ticket created.
- [x] Tests included.
> A bug is not considered fixed, unless a test is added to prevent it
from happening again.
   > A feature is not complete without tests.
@github-actions github-actions bot mentioned this pull request Dec 27, 2023
ivov added a commit that referenced this pull request Dec 27, 2023
##
[1.22.2](https://github.com/n8n-io/n8n/compare/n8n@1.22.1...n8n@1.22.2)
(2023-12-27)


### Bug Fixes

* **Asana Node:** Omit body from GET, HEAD, and DELETE requests
([#8057](#8057))
([094c9d7](094c9d7))
* **core:** Fix issue that pinnedData is not used with Test-Webhooks
([#8123](#8123))
([9c99075](9c99075))
* **editor:** Fix operation change failing in certain conditions
([#8114](#8114))
([aaca64a](aaca64a)),
closes
[/github.com/n8n-io/n8n/blob/7806a65229878a473f5526bad0b94614e8bfa8aa/packages/workflow/src/NodeHelpers.ts#L786](https://github.com//github.com/n8n-io/n8n/blob/7806a65229878a473f5526bad0b94614e8bfa8aa/packages/workflow/src/NodeHelpers.ts/issues/L786)
* **editor:** Prevent browser zoom when scrolling inside sticky edit
mode ([#8116](#8116))
([e5135b1](e5135b1))
* **editor:** Prevent canvas undo/redo when NDV is open
([#8118](#8118))
([43eca24](43eca24))
* **Redis Trigger Node:** Activating a workflow with a Redis trigger
fails ([#8129](#8129))
([babca25](babca25))

Co-authored-by: ivov <ivov@users.noreply.github.com>
@janober
Copy link
Member

janober commented Dec 27, 2023

Got released with n8n@1.22.2

@github-actions github-actions bot mentioned this pull request Jan 3, 2024
ivov added a commit that referenced this pull request Jan 3, 2024
#
[1.23.0](https://github.com/n8n-io/n8n/compare/n8n@1.22.0...n8n@1.23.0)
(2024-01-03)


### Bug Fixes

* **Asana Node:** Omit body from GET, HEAD, and DELETE requests
([#8057](#8057))
([15ffd4f](15ffd4f))
* **core:** Better input validation for the changeRole endpoint
([#8189](#8189))
([cfe9525](cfe9525))
* **core:** Fix issue that pinnedData is not used with Test-Webhooks
([#8123](#8123))
([fa8bd8b](fa8bd8b))
* **core:** Handle empty executions table in pruning in migrations
([#8121](#8121))
([ffaa30d](ffaa30d))
* **core:** Remove circular dependency in WorkflowService and
ActiveWorkflowRunner
([#8128](#8128))
([21788d9](21788d9))
* **core:** Use pinned data only for manual mode
([#8164](#8164))
([ea7e76f](ea7e76f))
* **Discord Node:** Remove unnecessary requirement on parameters
([#8060](#8060))
([ef3a577](ef3a577))
* **editor:** Avoid sanitizing output to search node data
([#8126](#8126))
([c83d9f4](c83d9f4))
* **editor:** Enable explicit undo keyboard shortcut across all code
editors ([#8178](#8178))
([cf7f668](cf7f668))
* **editor:** Fix operation change failing in certain conditions
([#8114](#8114))
([711fa2b](711fa2b))
* **editor:** Fix templates view layout
([#8196](#8196))
([d01e42a](d01e42a))
* **editor:** Fix UI urls when hosted behind a path prefix
([#8198](#8198))
([5c078f1](5c078f1))
* **editor:** Prevent browser zoom when scrolling inside sticky edit
mode ([#8116](#8116))
([e928210](e928210))
* **editor:** Prevent canvas undo/redo when NDV is open
([#8118](#8118))
([39e45d8](39e45d8))
* **editor:** Prevent storing pairedItem data inside of pinData
([#8173](#8173))
([405e267](405e267))
* **GitHub Node:** Fix issue that File->Get did not run once per item
([#8190](#8190))
([11cda41](11cda41))
* **Invoice Ninja Node:** Fix issue with custom invoice numbers not
working with v5 ([#8200](#8200))
([3b6ae2d](3b6ae2d))
* **Microsoft Excel 365 Node:** Ensure arg is string during worksheet
table search ([#8154](#8154))
([8e873ca](8e873ca))
* **Notion Node:** Ensure arg is string during page ID extraction
([#8153](#8153))
([e94b8a6](e94b8a6))
* **Redis Trigger Node:** Activating a workflow with a Redis trigger
fails ([#8129](#8129))
([a169b74](a169b74))
* **Schedule Trigger Node:** Use the correct `moment` import
([#8185](#8185))
([17a4e2e](17a4e2e))
* Show public API upgrade CTA when feature is not enabled
([#8109](#8109))
([e9c7fd7](e9c7fd7))


### Features

* **core:** Add closeFunction support to Sub-Nodes
([#7708](#7708))
([bec0fae](bec0fae))
* **core:** Add user.profile.beforeUpdate hook
([#8144](#8144))
([e126ed7](e126ed7))
* **core:** Improvements/overhaul for nodes working with binary data
([#7651](#7651))
([5e16dd4](5e16dd4))
* **core:** Remove discontinued crypto-js
([#8104](#8104))
([01e9a79](01e9a79))
* **core:** Unify application components shutdown
([#8097](#8097))
([3a881be](3a881be))
* **editor:** Add node execution status indicator to output panel
([#8124](#8124))
([ab74bad](ab74bad))
* **editor:** Add template Id to workflow metadata
([#8088](#8088))
([517b050](517b050))
* **Home Assistant Node:** Use the new Home Assistant logo
([#8150](#8150))
([518a99e](518a99e))
* **Qdrant Vector Store Node:** Qdrant vector store support
([#8080](#8080))
([66460f6](66460f6))
* **Wordpress Node:** Add option to ignore error when using self signed
certificates ([#8199](#8199))
([65c8e12](65c8e12))

Co-authored-by: ivov <ivov@users.noreply.github.com>
ybom77 pushed a commit to ybom77/yiyan8n that referenced this pull request Jan 3, 2024
#
[1.23.0](https://github.com/n8n-io/n8n/compare/n8n@1.22.0...n8n@1.23.0)
(2024-01-03)


### Bug Fixes

* **Asana Node:** Omit body from GET, HEAD, and DELETE requests
([n8n-io#8057](n8n-io#8057))
([15ffd4f](n8n-io@15ffd4f))
* **core:** Better input validation for the changeRole endpoint
([n8n-io#8189](n8n-io#8189))
([cfe9525](n8n-io@cfe9525))
* **core:** Fix issue that pinnedData is not used with Test-Webhooks
([n8n-io#8123](n8n-io#8123))
([fa8bd8b](n8n-io@fa8bd8b))
* **core:** Handle empty executions table in pruning in migrations
([n8n-io#8121](n8n-io#8121))
([ffaa30d](n8n-io@ffaa30d))
* **core:** Remove circular dependency in WorkflowService and
ActiveWorkflowRunner
([n8n-io#8128](n8n-io#8128))
([21788d9](n8n-io@21788d9))
* **core:** Use pinned data only for manual mode
([n8n-io#8164](n8n-io#8164))
([ea7e76f](n8n-io@ea7e76f))
* **Discord Node:** Remove unnecessary requirement on parameters
([n8n-io#8060](n8n-io#8060))
([ef3a577](n8n-io@ef3a577))
* **editor:** Avoid sanitizing output to search node data
([n8n-io#8126](n8n-io#8126))
([c83d9f4](n8n-io@c83d9f4))
* **editor:** Enable explicit undo keyboard shortcut across all code
editors ([n8n-io#8178](n8n-io#8178))
([cf7f668](n8n-io@cf7f668))
* **editor:** Fix operation change failing in certain conditions
([n8n-io#8114](n8n-io#8114))
([711fa2b](n8n-io@711fa2b))
* **editor:** Fix templates view layout
([n8n-io#8196](n8n-io#8196))
([d01e42a](n8n-io@d01e42a))
* **editor:** Fix UI urls when hosted behind a path prefix
([n8n-io#8198](n8n-io#8198))
([5c078f1](n8n-io@5c078f1))
* **editor:** Prevent browser zoom when scrolling inside sticky edit
mode ([n8n-io#8116](n8n-io#8116))
([e928210](n8n-io@e928210))
* **editor:** Prevent canvas undo/redo when NDV is open
([n8n-io#8118](n8n-io#8118))
([39e45d8](n8n-io@39e45d8))
* **editor:** Prevent storing pairedItem data inside of pinData
([n8n-io#8173](n8n-io#8173))
([405e267](n8n-io@405e267))
* **GitHub Node:** Fix issue that File->Get did not run once per item
([n8n-io#8190](n8n-io#8190))
([11cda41](n8n-io@11cda41))
* **Invoice Ninja Node:** Fix issue with custom invoice numbers not
working with v5 ([n8n-io#8200](n8n-io#8200))
([3b6ae2d](n8n-io@3b6ae2d))
* **Microsoft Excel 365 Node:** Ensure arg is string during worksheet
table search ([n8n-io#8154](n8n-io#8154))
([8e873ca](n8n-io@8e873ca))
* **Notion Node:** Ensure arg is string during page ID extraction
([n8n-io#8153](n8n-io#8153))
([e94b8a6](n8n-io@e94b8a6))
* **Redis Trigger Node:** Activating a workflow with a Redis trigger
fails ([n8n-io#8129](n8n-io#8129))
([a169b74](n8n-io@a169b74))
* **Schedule Trigger Node:** Use the correct `moment` import
([n8n-io#8185](n8n-io#8185))
([17a4e2e](n8n-io@17a4e2e))
* Show public API upgrade CTA when feature is not enabled
([n8n-io#8109](n8n-io#8109))
([e9c7fd7](n8n-io@e9c7fd7))


### Features

* **core:** Add closeFunction support to Sub-Nodes
([n8n-io#7708](n8n-io#7708))
([bec0fae](n8n-io@bec0fae))
* **core:** Add user.profile.beforeUpdate hook
([n8n-io#8144](n8n-io#8144))
([e126ed7](n8n-io@e126ed7))
* **core:** Improvements/overhaul for nodes working with binary data
([n8n-io#7651](n8n-io#7651))
([5e16dd4](n8n-io@5e16dd4))
* **core:** Remove discontinued crypto-js
([n8n-io#8104](n8n-io#8104))
([01e9a79](n8n-io@01e9a79))
* **core:** Unify application components shutdown
([n8n-io#8097](n8n-io#8097))
([3a881be](n8n-io@3a881be))
* **editor:** Add node execution status indicator to output panel
([n8n-io#8124](n8n-io#8124))
([ab74bad](n8n-io@ab74bad))
* **editor:** Add template Id to workflow metadata
([n8n-io#8088](n8n-io#8088))
([517b050](n8n-io@517b050))
* **Home Assistant Node:** Use the new Home Assistant logo
([n8n-io#8150](n8n-io#8150))
([518a99e](n8n-io@518a99e))
* **Qdrant Vector Store Node:** Qdrant vector store support
([n8n-io#8080](n8n-io#8080))
([66460f6](n8n-io@66460f6))
* **Wordpress Node:** Add option to ignore error when using self signed
certificates ([n8n-io#8199](n8n-io#8199))
([65c8e12](n8n-io@65c8e12))

Co-authored-by: ivov <ivov@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
n8n team Authored by the n8n team Released ui Enhancement in /editor-ui or /design-system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants