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): Use display option's @Version specifier #7351

Merged

Conversation

tomi
Copy link
Contributor

@tomi tomi commented Oct 5, 2023

Nodes can have properties that have a displayOption which specifies a version
for which node versions that property applies to. We should take this into
account when forming the action types for a Node in the NodeList.

For example Notion node has 2 version which have different Page operations:

[
  {
    displayName: 'Operation',
    name: 'operation',
    type: 'options',
    noDataExpression: true,
    displayOptions: {
      show: {
        '@version': [1],
        resource: ['page'],
      },
    },
    options: [
      {
        name: 'Create',
        value: 'create',
        description: 'Create a page',
        action: 'Create a page',
      },
      {
        name: 'Get',
        value: 'get',
        description: 'Get a page',
        action: 'Get a page',
      },
      {
        name: 'Search',
        value: 'search',
        description: 'Text search of pages',
        action: 'Search a page',
      },
    ],
    default: 'create',
  },
  {
    displayName: 'Operation',
    name: 'operation',
    type: 'options',
    noDataExpression: true,
    displayOptions: {
      show: {
        '@version': [2],
        resource: ['page'],
      },
    },
    options: [
      {
        name: 'Archive',
        value: 'archive',
        description: 'Archive a page',
        action: 'Archive a page',
      },
      {
        name: 'Create',
        value: 'create',
        description: 'Create a page',
        action: 'Create a page',
      },
      {
        name: 'Search',
        value: 'search',
        description: 'Text search of pages',
        action: 'Search a page',
      },
    ],
    default: 'create',
  },
]

Before:

image

After:

image

Nodes can have properties that have a displayOption which specifies a version
for which node versions that property applies to. We should take this into
account when forming the action types for a Node in the NodeList.
@tomi tomi requested a review from OlegIvaniv October 5, 2023 07:34
@github-actions
Copy link
Contributor

github-actions bot commented Oct 5, 2023

Great PR! Please pay attention to the following items before merging:

Files matching packages/**:

  • If fixing bug, added test to cover scenario.
  • If addressing forum or Github issue, added link to description.

Files matching packages/**/*.ts:

  • Added unit tests to cover new or updated functionality.

Make sure to check off this list before asking for review.

@tomi tomi changed the title Fix(editor): Use display option's @Version specifier fix(editor): Use display option's @Version specifier Oct 5, 2023
@codecov
Copy link

codecov bot commented Oct 5, 2023

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (4bc9164) 33.33% compared to head (503ba9d) 33.41%.
Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7351      +/-   ##
==========================================
+ Coverage   33.33%   33.41%   +0.08%     
==========================================
  Files        3378     3378              
  Lines      205919   205934      +15     
  Branches    22176    22215      +39     
==========================================
+ Hits        68644    68822     +178     
+ Misses     136160   135996     -164     
- Partials     1115     1116       +1     
Files Coverage Δ
packages/workflow/src/Interfaces.ts 77.77% <ø> (ø)
...de/NodeCreator/composables/useActionsGeneration.ts 59.60% <90.47%> (+59.60%) ⬆️

... and 6 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@n8n-assistant n8n-assistant bot added core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team ui Enhancement in /editor-ui or /design-system labels Oct 5, 2023
Copy link
Contributor

@OlegIvaniv OlegIvaniv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks for adding the tests!

import type { INodeProperties, INodeTypeDescription } from 'n8n-workflow';
import { useActionsGenerator } from '../composables/useActionsGeneration';

describe('useActionsGenerator', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LOVE IT 👏

@cypress
Copy link

cypress bot commented Oct 5, 2023

1 flaky test on run #2382 ↗︎

0 242 3 0 Flakiness 1

Details:

🌳 ado-884-not-every-operations-show-up-in-the-sidebar-node-search 🖥️ browsers:...
Project: n8n Commit: 503ba9d47e
Status: Passed Duration: 08:34 💡
Started: Oct 5, 2023 12:28 PM Ended: Oct 5, 2023 12:37 PM
Flakiness  cypress/e2e/5-ndv.cy.ts • 1 flaky test

View Output Video

Test Artifacts
NDV > should not retrieve remote options when required params throw errors Output Screenshots Video

Review all test suite changes for PR #7351 ↗︎

@github-actions
Copy link
Contributor

github-actions bot commented Oct 5, 2023

✅ All Cypress E2E specs passed

@tomi tomi merged commit afbf0c3 into master Oct 5, 2023
54 of 56 checks passed
@tomi tomi deleted the ado-884-not-every-operations-show-up-in-the-sidebar-node-search branch October 5, 2023 12:57
netroy pushed a commit that referenced this pull request Oct 9, 2023
Nodes can have properties that have a displayOption which specifies a
version
for which node versions that property applies to. We should take this
into
account when forming the action types for a Node in the NodeList.

For example Notion node has 2 version which have different Page
operations.
@github-actions github-actions bot mentioned this pull request Oct 9, 2023
netroy added a commit that referenced this pull request Oct 9, 2023
## [1.9.2](https://github.com/n8n-io/n8n/compare/n8n@1.9.1...n8n@1.9.2)
(2023-10-09)


### Bug Fixes

* **core:** Add an option to enable postgres ssl with default certs
([#6889](#6889))
([0de6d7d](0de6d7d))
* **editor:** Fix disappearing NDV header in code nodes
([#7290](#7290))
([7d87392](7d87392))
* **editor:** Remove excess margin below run data editor
([#7372](#7372))
([8c38984](8c38984))
* **editor:** Use display option's @Version specifier
([#7351](#7351))
([73a98cb](73a98cb))
* **Google BigQuery Node:** Location default to jobReference
([#7354](#7354))
([489a12d](489a12d))
* **Google Drive Trigger Node:** Add Shared Drives support
([#7369](#7369))
([138d26c](138d26c))
* **Google Sheets Node:** Fix "Maximum call stack size exceeded" error
on too many rows ([#7384](#7384))
([200fb54](200fb54))
* **HTML Node:** Update property fields to not use expressions on drag
([#7379](#7379))
([4517001](4517001))

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

janober commented Oct 10, 2023

Got released with n8n@1.9.3

@github-actions github-actions bot mentioned this pull request Oct 11, 2023
netroy added a commit that referenced this pull request Oct 11, 2023
# [1.11.0](https://github.com/n8n-io/n8n/compare/n8n@1.10.0...n8n@1.11.0)
(2023-10-11)


### Bug Fixes

* **core:** Add an option to enable postgres ssl with default certs
([#6889](#6889))
([789e1e7](789e1e7))
* **core:** Fix error on missing paired item data
([#7399](#7399))
([47e8953](47e8953))
* **core:** Missing pairing info
([#7326](#7326))
([e2c3c7a](e2c3c7a))
* **core:** Prevent object deletion request on no prefix match
([#7366](#7366))
([63e11e4](63e11e4))
* **editor:** Fix completions for `.json` on quoted node name in Code
node ([#7382](#7382))
([86e7ec7](86e7ec7))
* **editor:** Implement canvas zoom UX improvements
([#7376](#7376))
([7e06b31](7e06b31))
* **editor:** Make workflow history button available only for dev builds
([#7392](#7392))
([7ed466d](7ed466d))
* **editor:** Remove excess margin below run data editor
([#7372](#7372))
([3fa2764](3fa2764))
* **editor:** Sanitize HTML binary-data before rendering in the UI
([#7400](#7400))
([2b075bf](2b075bf))
* **editor:** Use display option's @Version specifier
([#7351](#7351))
([afbf0c3](afbf0c3))
* **Google BigQuery Node:** Location default to jobReference
([#7354](#7354))
([97bb703](97bb703))
* **Google Drive Trigger Node:** Add Shared Drives support
([#7369](#7369))
([3e7a4d3](3e7a4d3))
* **Google Sheets Node:** Fix "Maximum call stack size exceeded" error
on too many rows ([#7384](#7384))
([732b15a](732b15a))
* **HTML Node:** Update property fields to not use expressions on drag
([#7379](#7379))
([77643e5](77643e5))
* **Notion Node:** Handle empty values correctly for Notion selects +
multi selects ([#7383](#7383))
([fbcd1d4](fbcd1d4))
* **Set Node:** Increase search priority
([#7358](#7358))
([e5ad1e7](e5ad1e7))
* **Webhook Node:** Backward compatible form-data parsing for non-array
files ([#7385](#7385))
([6479eb1](6479eb1))


### Features

* **core:** Add Job Summary to Worker response
([#7360](#7360))
([b8608ce](b8608ce))
* **core:** Integrate object store as binary data manager
([#7253](#7253))
([1a661e6](1a661e6))
* **core:** Switch binary filesystem mode to nested path structure
([#7307](#7307))
([0847623](0847623))
* **editor:** Make PDF and Audio binary-data viewable in the UI
([#7367](#7367))
([8187be1](8187be1))
* **editor:** Support autologin for upgrade path
([#7316](#7316))
([1dfa052](1dfa052))
* **Execute Workflow Node:** Run once for each item mode
([#7289](#7289))
([c8c14ca](c8c14ca))
* **Item Lists Node:** Split merge binary data
([#7297](#7297))
([965db8f](965db8f))
* **Loop Over Items (Split in Batches) Node:** Automatically add a loop
+ rename ([#7228](#7228))
([7b773cc](7b773cc))
* **Notion Node:** Fetch child blocks recursively
([#7304](#7304))
([193181a](193181a))

Co-authored-by: netroy <netroy@users.noreply.github.com>
elsmr pushed a commit that referenced this pull request Oct 19, 2023
# [1.11.0](https://github.com/n8n-io/n8n/compare/n8n@1.10.0...n8n@1.11.0)
(2023-10-11)


### Bug Fixes

* **core:** Add an option to enable postgres ssl with default certs
([#6889](#6889))
([789e1e7](789e1e7))
* **core:** Fix error on missing paired item data
([#7399](#7399))
([47e8953](47e8953))
* **core:** Missing pairing info
([#7326](#7326))
([e2c3c7a](e2c3c7a))
* **core:** Prevent object deletion request on no prefix match
([#7366](#7366))
([63e11e4](63e11e4))
* **editor:** Fix completions for `.json` on quoted node name in Code
node ([#7382](#7382))
([86e7ec7](86e7ec7))
* **editor:** Implement canvas zoom UX improvements
([#7376](#7376))
([7e06b31](7e06b31))
* **editor:** Make workflow history button available only for dev builds
([#7392](#7392))
([7ed466d](7ed466d))
* **editor:** Remove excess margin below run data editor
([#7372](#7372))
([3fa2764](3fa2764))
* **editor:** Sanitize HTML binary-data before rendering in the UI
([#7400](#7400))
([2b075bf](2b075bf))
* **editor:** Use display option's @Version specifier
([#7351](#7351))
([afbf0c3](afbf0c3))
* **Google BigQuery Node:** Location default to jobReference
([#7354](#7354))
([97bb703](97bb703))
* **Google Drive Trigger Node:** Add Shared Drives support
([#7369](#7369))
([3e7a4d3](3e7a4d3))
* **Google Sheets Node:** Fix "Maximum call stack size exceeded" error
on too many rows ([#7384](#7384))
([732b15a](732b15a))
* **HTML Node:** Update property fields to not use expressions on drag
([#7379](#7379))
([77643e5](77643e5))
* **Notion Node:** Handle empty values correctly for Notion selects +
multi selects ([#7383](#7383))
([fbcd1d4](fbcd1d4))
* **Set Node:** Increase search priority
([#7358](#7358))
([e5ad1e7](e5ad1e7))
* **Webhook Node:** Backward compatible form-data parsing for non-array
files ([#7385](#7385))
([6479eb1](6479eb1))


### Features

* **core:** Add Job Summary to Worker response
([#7360](#7360))
([b8608ce](b8608ce))
* **core:** Integrate object store as binary data manager
([#7253](#7253))
([1a661e6](1a661e6))
* **core:** Switch binary filesystem mode to nested path structure
([#7307](#7307))
([0847623](0847623))
* **editor:** Make PDF and Audio binary-data viewable in the UI
([#7367](#7367))
([8187be1](8187be1))
* **editor:** Support autologin for upgrade path
([#7316](#7316))
([1dfa052](1dfa052))
* **Execute Workflow Node:** Run once for each item mode
([#7289](#7289))
([c8c14ca](c8c14ca))
* **Item Lists Node:** Split merge binary data
([#7297](#7297))
([965db8f](965db8f))
* **Loop Over Items (Split in Batches) Node:** Automatically add a loop
+ rename ([#7228](#7228))
([7b773cc](7b773cc))
* **Notion Node:** Fetch child blocks recursively
([#7304](#7304))
([193181a](193181a))

Co-authored-by: netroy <netroy@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Enhancement outside /nodes-base and /editor-ui 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.

3 participants