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

Draft: feat: undo/redo for workflow editor #3927

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

perzeuss
Copy link
Contributor

@perzeuss perzeuss commented Apr 27, 2024

Description

This resolves #3911 by introducing zundo to create a zustand store for creating a history over changs in the workflow editor.
The workflow store as well as the reactflow store remain untouched.

UI Elements

Buttons are added to the UI for both Workflow and Chatflow Editor:
grafik

Translations

I provided translations for all currently supported languages. However, apart from EN and DE, I had all translations generated by AI.

Keyboard Shortcuts

Common keyboard shortcuts are also supported.

  • Undo

    • Windows/Linux: Ctrl + Z
    • macOS: Cmd + Z
  • Redo

    • Windows/Linux: Ctrl + Y or Ctrl + Shift + Z
    • macOS: Cmd + Shift + Z or Cmd + Y

Current Limitations

  • InputChange events in Node Panels do not trigger state changes.
  • This is an issue we need to adress since it also affects the sync workflow darft feature
  • Resizing UI elements does not trigger state changes.
  • But I think we can ignore them anyway

Type of Change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update, included: Dify Document
  • We might want to add documentation about the limitations
  • We might want to document this feature incl. keyboard shortcuts

How Has This Been Tested?

I recorded a video of manual testing.
https://github.com/langgenius/dify/assets/11357019/4045181b-3b49-4a10-a15e-5e5c3ca518f3

Suggested Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods
  • optional I have made corresponding changes to the documentation

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Apr 27, 2024
@perzeuss perzeuss changed the title feat: undi/redo for workflow editor feat: undo/redo for workflow editor Apr 27, 2024
@dosubot dosubot bot added ☕️ typescript Pull request that update TypeScript code. 🌊 feat:workflow Workflow related stuff. 💪 enhancement New feature or request 📚 documentation Improvements or additions to documentation labels Apr 27, 2024
@perzeuss
Copy link
Contributor Author

We could update the screenshots to keep the docs updated, but I don't have access to the workflows used to make them: https://docs.dify.ai/features/workflow?

@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels May 12, 2024
@perzeuss perzeuss changed the title feat: undo/redo for workflow editor Draft: feat: undo/redo for workflow editor May 12, 2024
@crazywoola crazywoola marked this pull request as draft May 14, 2024 01:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📚 documentation Improvements or additions to documentation 💪 enhancement New feature or request 🌊 feat:workflow Workflow related stuff. size:XL This PR changes 500-999 lines, ignoring generated files. ☕️ typescript Pull request that update TypeScript code.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Undo / Redo in Workflow Editor
1 participant