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(editor): Prevent saving of workflow when canvas is loading #6497

Merged
merged 12 commits into from
Jun 27, 2023

Conversation

OlegIvaniv
Copy link
Contributor

@OlegIvaniv OlegIvaniv commented Jun 21, 2023

Some of our users have encountered an issue where saving an empty workflow through a keyboard shortcut could override an existing workflow. To address this problem, within the saveCurrentWorkflow function, we implemented a check to determine if the canvas is loading in which case we prevent saving.
We need to include genericHelpers mixin in workflowHelpers to get the loadingService. This caused an issue due to genericHelpers isReadOnly property. It was clashing with some other component's isReadOnly when imported together in workflowHelpers to fix this, I had to rename isReadOnly to isReadOnlyRoute.
I also added pruning of activated workflows before pruning the DB. This seemed to have fixed the SQLITE error that we sometimes see in our e2e specs.
Github issue / Community forum post (link here to close automatically):

Signed-off-by: Oleg Ivaniv <me@olegivaniv.com>
@github-actions
Copy link
Contributor

github-actions bot commented Jun 21, 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.

Files matching **/*.vue:

  • Used composition API for all new components.
  • Added component or unit tests to cover functionality.

Files matching packages/editor-ui/**/*.vue:

  • Added E2E if adding new features.
  • Used design system tokens (colors, spacings...) where possible.

Files matching packages/editor-ui/src/mixins/**:

  • Avoided adding new mixins (use composables instead). Only removed code from here.

Files matching packages/editor-ui/src/views/NodeView.vue:

  • Avoided adding code here. Only refactored to make it smaller.

Files matching cypress/e2e/**:

  • Avoided chaining commands more than two or three times (to avoid flakiness because only last one will be retried).
  • Spoofed endpoints that are not critical for the test (to avoid flakiness).
  • Picked most efficient path to start the test (for example skipped account setup and starting at /workflow/new for a canvas test).
  • Avoided adding waits on time (use request intercepts instead).
  • Ensured each spec does not depend on any another spec to pass.

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

@n8n-assistant n8n-assistant bot added n8n team Authored by the n8n team ui Enhancement in /editor-ui or /design-system labels Jun 21, 2023
mutdmour
mutdmour previously approved these changes Jun 21, 2023
@github-actions
Copy link
Contributor

⚠️ Some Cypress E2E specs are failing, please fix them before merging

@cypress
Copy link

cypress bot commented Jun 21, 2023

3 flaky tests on run #1339 ↗︎

0 228 0 0 Flakiness 3

Details:

🌳 help-218_prevent_saving_of_pristine_workflow 🖥️ browsers:node18.12.0-chrome1...
Project: n8n Commit: 85a10f1960
Status: Passed Duration: 06:54 💡
Started: Jun 27, 2023 10:52 AM Ended: Jun 27, 2023 10:59 AM
Flakiness  18-user-management.cy.ts • 1 flaky test

View Output Video

Test Artifacts
User Management > should delete user and transfer their data Output Screenshots Video
Flakiness  24-ndv-paired-item.cy.ts • 1 flaky test

View Output Video

Test Artifacts
NDV > resolves expression with default item when input node is not parent, while still pairing items Output Screenshots Video
Flakiness  15-scheduler-node.cy.ts • 1 flaky test

View Output Video

Test Artifacts
Schedule Trigger node > should execute once per second when activated Output Screenshots Video

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings.

Signed-off-by: Oleg Ivaniv <me@olegivaniv.com>
@OlegIvaniv OlegIvaniv force-pushed the help-218_prevent_saving_of_pristine_workflow branch from 90b93f8 to 27066dd Compare June 22, 2023 13:38
Signed-off-by: Oleg Ivaniv <me@olegivaniv.com>
Signed-off-by: Oleg Ivaniv <me@olegivaniv.com>
@OlegIvaniv OlegIvaniv changed the title feat(editor): Prevent saving of pristine workflow feat(editor): Prevent saving of workflow when canvas is loading Jun 26, 2023
@codecov
Copy link

codecov bot commented Jun 27, 2023

Codecov Report

Patch coverage: 42.10% and project coverage change: +0.12 🎉

Comparison is base (f0ab023) 28.65% compared to head (85a10f1) 28.77%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6497      +/-   ##
==========================================
+ Coverage   28.65%   28.77%   +0.12%     
==========================================
  Files        3000     3032      +32     
  Lines      186310   187007     +697     
  Branches    20601    20695      +94     
==========================================
+ Hits        53390    53817     +427     
- Misses     132110   132353     +243     
- Partials      810      837      +27     
Impacted Files Coverage Δ
packages/cli/src/api/e2e.api.ts 0.00% <0.00%> (ø)
...es/editor-ui/src/components/RunDataJsonActions.vue 52.54% <0.00%> (ø)
packages/editor-ui/src/mixins/workflowHelpers.ts 14.25% <33.33%> (+0.02%) ⬆️
packages/editor-ui/src/views/NodeView.vue 13.47% <40.00%> (ø)
packages/editor-ui/src/mixins/genericHelpers.ts 60.00% <50.00%> (ø)
packages/editor-ui/src/components/RunData.vue 70.08% <83.33%> (+0.03%) ⬆️
...ckages/editor-ui/src/components/ExpressionEdit.vue 63.71% <100.00%> (ø)
...kages/editor-ui/src/components/NodeCredentials.vue 38.76% <100.00%> (ø)

... and 44 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@github-actions
Copy link
Contributor

✅ All Cypress E2E specs passed

@OlegIvaniv OlegIvaniv merged commit f89ef83 into master Jun 27, 2023
@OlegIvaniv OlegIvaniv deleted the help-218_prevent_saving_of_pristine_workflow branch June 27, 2023 11:05
netroy added a commit to netroy/n8n that referenced this pull request Jun 27, 2023
# [1.0.0](https://github.com/netroy/n8n/compare/n8n@0.234.0...n8n@1.0.0)
(2023-06-27)


### Bug Fixes

* **core:** Add empty credential value marker to show empty pw field
([n8n-io#6532](https://github.com/netroy/n8n/issues/6532))
([9294e2d](9294e2d))
* **core:** All migrations should run in a transaction
([n8n-io#6519](https://github.com/netroy/n8n/issues/6519))
([e152cfe](e152cfe))
* **core:** Rename to credential_stubs and variable_stubs.json
([n8n-io#6528](https://github.com/netroy/n8n/issues/6528))
([b06462f](b06462f))
* **Edit Image Node:** Fix transparent operation
([n8n-io#6513](https://github.com/netroy/n8n/issues/6513))
([4a4bcbc](4a4bcbc))
* **editor:** Add default author name and email to source control
settings ([n8n-io#6543](https://github.com/netroy/n8n/issues/6543))
([e1a02c7](e1a02c7))
* **editor:** Change default branchColor and remove label
([n8n-io#6541](https://github.com/netroy/n8n/issues/6541))
([186271e](186271e))
* **Google Drive Node:** URL parsing
([n8n-io#6527](https://github.com/netroy/n8n/issues/6527))
([d9ed0b3](d9ed0b3))
* **Google Sheets Node:** Incorrect read of 0 and false
([n8n-io#6525](https://github.com/netroy/n8n/issues/6525))
([806d134](806d134))
* **Merge Node:** Enrich input 2 fix
([n8n-io#6526](https://github.com/netroy/n8n/issues/6526))
([c82c7f1](c82c7f1))
* **Notion Node:** Version fix
([n8n-io#6531](https://github.com/netroy/n8n/issues/6531))
([38dc784](38dc784))


### Features

* Add missing input panels to some trigger nodes
([n8n-io#6518](https://github.com/netroy/n8n/issues/6518))
([fdf8a42](fdf8a42))
* **editor:** Prevent saving of workflow when canvas is loading
([n8n-io#6497](https://github.com/netroy/n8n/issues/6497))
([f89ef83](f89ef83))
* **editor:** SQL editor overhaul
([n8n-io#6282](https://github.com/netroy/n8n/issues/6282))
([beedfb6](beedfb6))
* **Google Drive Node:** Overhaul
([n8n-io#5941](https://github.com/netroy/n8n/issues/5941))
([d70a1cb](d70a1cb))
* **HTTP Request Node:** Notice about dev console
([n8n-io#6516](https://github.com/netroy/n8n/issues/6516))
([d431117](d431117))
* **Matrix Node:** Allow setting filename if the binary data has none
([n8n-io#6536](https://github.com/netroy/n8n/issues/6536))
([8b76e98](8b76e98))

Co-authored-by: netroy <netroy@users.noreply.github.com>
@github-actions github-actions bot mentioned this pull request Jun 28, 2023
@github-actions github-actions bot mentioned this pull request Jul 5, 2023
@janober
Copy link
Member

janober commented Jul 5, 2023

Got released with n8n@0.235.0

@github-actions github-actions bot mentioned this pull request Jul 26, 2023
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.

4 participants