-
Notifications
You must be signed in to change notification settings - Fork 3.1k
feat(duplicate): added folder duplication, add duplicate to sidebar context menu #1902
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile OverviewGreptile SummaryThis PR adds comprehensive folder duplication functionality to match existing workflow duplication capabilities. The implementation includes recursive folder structure duplication and workflow duplication within those folders. Key Changes:
Implementation Quality:
Confidence Score: 5/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant User
participant UI as Folder/Workflow Item
participant Hook as useDuplicate Hook
participant Store as Folder/Workflow Store
participant API as Duplicate API
participant Helper as duplicateWorkflow Helper
participant DB as Database
User->>UI: Right-click & select "Duplicate"
UI->>Hook: handleDuplicate()
Hook->>Hook: Check isDuplicating state
Hook->>Store: duplicateFolder/Workflow(id)
alt Folder Duplication
Store->>API: POST /api/folders/{id}/duplicate
API->>DB: Check permissions & get source folder
API->>DB: BEGIN TRANSACTION
API->>DB: Create root folder with new ID
API->>API: duplicateFolderStructure (recursive)
loop For each child folder
API->>DB: Create child folder
API->>API: Recurse for nested children
end
DB-->>API: COMMIT (folder structure complete)
API->>API: duplicateWorkflowsInFolderTree
loop For each folder in mapping
API->>DB: Get workflows in folder
loop For each workflow
API->>Helper: duplicateWorkflow()
Helper->>DB: BEGIN TRANSACTION
Helper->>DB: Create workflow with new ID
Helper->>DB: Copy blocks (remap IDs & parentIds)
Helper->>DB: Copy edges (remap block references)
Helper->>DB: Copy subflows (remap IDs & node refs)
DB-->>Helper: COMMIT
Helper-->>API: Return new workflow ID
end
end
API-->>Store: Return folder stats
else Workflow Duplication
Store->>API: POST /api/workflows/{id}/duplicate
API->>Helper: duplicateWorkflow()
Helper->>DB: Check permissions & get source
Helper->>DB: BEGIN TRANSACTION
Helper->>DB: Create workflow with new ID
Helper->>DB: Copy blocks (remap IDs)
Helper->>DB: Copy edges (remap references)
Helper->>DB: Copy subflows (remap IDs)
DB-->>Helper: COMMIT
Helper-->>API: Return new workflow
API-->>Store: Return workflow metadata
end
Store->>Store: Refresh folders/workflows
Store-->>Hook: Return new ID(s)
Hook->>Store: clearSelection()
alt Single Workflow Duplication
Hook->>UI: Navigate to new workflow
end
Hook-->>UI: Complete
UI-->>User: Show duplicated item
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
11 files reviewed, no comments
Summary
Type of Change
Testing
Tested manually.
Checklist