Skip to content

fix(workspace-popover): added duplicate, import, export workspace; added export multiple workflows - #1911

Merged
waleedlatif1 merged 2 commits into
stagingfrom
fix/workspace-popover
Nov 12, 2025
Merged

fix(workspace-popover): added duplicate, import, export workspace; added export multiple workflows#1911
waleedlatif1 merged 2 commits into
stagingfrom
fix/workspace-popover

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • added duplicate, import, export workspace
    • removed gear and added right click popover on workspace actions
  • added export multiple workflows
    • same behavior as delete, exports as zip and can unzip and import as json
  • added the ability to create a new workflow directly inside of a folder
  • fix copilot keyboard nav

Type of Change

  • Bug fix
  • New feature

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercelBot commented Nov 12, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
ProjectDeploymentPreviewCommentsUpdated (UTC)
docsSkippedSkippedNov 12, 2025 4:11am

@waleedlatif1
waleedlatif1 marked this pull request as ready for review November 12, 2025 04:05
@greptile-apps

Copy link
Copy Markdown
Contributor

Greptile Overview

Greptile Summary

This PR adds comprehensive workspace management features including duplicate, import, and export capabilities, along with bulk workflow export and the ability to create workflows directly inside folders.

Key Changes

  • Workspace Duplication: Implemented server-side duplication that recursively copies folder hierarchy and all workflows with their blocks, edges, and subflows
  • Workspace Import/Export: ZIP-based import/export preserves folder structure and workflow metadata, enabling complete workspace backup and migration
  • Bulk Workflow Export: Multiple workflows can be selected and exported as a ZIP file, with single workflows exported as JSON
  • Folder Workflow Creation: Added context menu option to create workflows directly inside folders
  • UI Improvements: Replaced gear icon with right-click context menus for workspace actions, providing more intuitive access to workspace operations
  • Copilot Fix: Removed unused parameters from keyboard navigation hook that were causing navigation issues

Implementation Details

The workspace duplication uses database transactions to ensure data integrity, properly handles folder parent-child relationships, and includes comprehensive permission checks. The import/export functionality preserves the complete workspace structure including workflow states, variables, and folder hierarchy. All new hooks follow established patterns with proper loading states and error handling.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The implementation is well-structured with proper error handling, authentication checks, and database transactions. The code follows established patterns in the codebase and includes comprehensive permission validation. One minor logging issue was identified but does not affect functionality.
  • No files require special attention

Important Files Changed

File Analysis

FilenameScoreOverview
apps/sim/lib/workspaces/duplicate.ts4/5Implements workspace duplication with folder hierarchy and workflow copying; uses correct transaction handling and permission checks
apps/sim/app/api/workspaces/[id]/duplicate/route.ts5/5API endpoint for workspace duplication with proper authentication, validation, and error handling
apps/sim/app/workspace/[workspaceId]/w/hooks/use-export-workspace.ts5/5Exports workspace to ZIP with all workflows, folders, states, and variables; properly handles file download
apps/sim/app/workspace/[workspaceId]/w/hooks/use-import-workspace.ts5/5Imports workspace from ZIP file, recreates folder structure, imports workflows with variables; navigates to new workspace
apps/sim/lib/workflows/import-export.ts5/5Shared utilities for workspace/workflow import/export; creates folder hierarchy in ZIP and extracts workflows
apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components-new/workspace-header/workspace-header.tsx5/5Added right-click context menu for workspace actions (duplicate, export, import) with inline rename support

Sequence Diagram

sequenceDiagram
participant User
participant WorkspaceHeader
participant useDuplicateWorkspace
participant API as /api/workspaces/[id]/duplicate
participant duplicateWorkspace as lib/workspaces/duplicate
participant Database
participant Router
User->>WorkspaceHeader: Right-click workspace
WorkspaceHeader->>WorkspaceHeader: Show context menu
User->>WorkspaceHeader: Click "Duplicate"
WorkspaceHeader->>useDuplicateWorkspace: handleDuplicateWorkspace(name)
useDuplicateWorkspace->>API: POST /api/workspaces/[id]/duplicate
API->>API: Validate session & request
API->>duplicateWorkspace: duplicateWorkspace()
duplicateWorkspace->>Database: Check source workspace permissions
duplicateWorkspace->>Database: Create new workspace
duplicateWorkspace->>Database: Create admin permission
duplicateWorkspace->>Database: Duplicate folder hierarchy
loop For each workflow
duplicateWorkspace->>duplicateWorkspace: duplicateWorkflow()
duplicateWorkspace->>Database: Copy workflow with blocks/edges/subflows
end
duplicateWorkspace-->>API: Return new workspace data
API-->>useDuplicateWorkspace: 201 Created
useDuplicateWorkspace->>Router: Navigate to new workspace
Router-->>User: Show duplicated workspace
Loading

@greptile-appsgreptile-appsBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

23 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Comment threadapps/sim/lib/workspaces/duplicate.ts Outdated
@waleedlatif1
waleedlatif1 merged commit d11ee04 into stagingNov 12, 2025
4 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/workspace-popover branch November 12, 2025 04:12
waleedlatif1 added a commit that referenced this pull request Nov 12, 2025
…ded export multiple workflows (#1911)
* fix(workspace-popover): added duplicate, import, export workspace; added export multiple workflows
* fix copilot keyboard nav
waleedlatif1 added a commit that referenced this pull request Nov 12, 2025
…ded export multiple workflows (#1911)
* fix(workspace-popover): added duplicate, import, export workspace; added export multiple workflows
* fix copilot keyboard nav
@waleedlatif1waleedlatif1 mentioned this pull request Nov 12, 2025
10 tasks
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@waleedlatif1