Skip to content

feat(sidebar): add lock/unlock to workflow registry context menu#3350

Merged
waleedlatif1 merged 6 commits intostagingfrom
waleedlatif1/workflow-lock-context-menu
Feb 26, 2026
Merged

feat(sidebar): add lock/unlock to workflow registry context menu#3350
waleedlatif1 merged 6 commits intostagingfrom
waleedlatif1/workflow-lock-context-menu

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

  • Add lock/unlock option to workflow right-click menu in sidebar
  • Only shows for the active workflow (blocks must be loaded)
  • Routes through collaborative workflow hook via custom event for proper socket sync and undo/redo
  • Gated behind admin permissions, hidden for multi-select and mixed selection

Type of Change

  • 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
Copy link

vercel bot commented Feb 26, 2026

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Feb 26, 2026 7:33am

Request Review

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 26, 2026

Greptile Summary

This PR adds lock/unlock functionality to the workflow right-click menu in the sidebar. The implementation correctly routes through the collaborativeBatchToggleLocked hook for proper socket sync and undo/redo support. The lock option is appropriately gated behind admin permissions and only shows for the active workflow when it's the sole selection (not in multi-select or mixed selection scenarios).

  • Uses the existing getWorkflowLockToggleIds utility to determine which blocks need toggling
  • Dispatches a custom toggle-workflow-lock event from the sidebar that's handled by the workflow component
  • Properly checks for empty workflow and no-op scenarios before dispatching events
  • Event listener is correctly registered and cleaned up in useEffect

Note: This PR includes documentation changes for Google BigQuery, Google Books, Google Tasks, and Table tools that appear unrelated to the workflow lock/unlock feature. Verify these were intentionally included.

Confidence Score: 5/5

  • This PR is safe to merge with no issues found
  • The lock/unlock implementation is well-architected, using the existing getWorkflowLockToggleIds utility for correct block ordering, properly routing through collaborativeBatchToggleLocked for socket sync and undo/redo support, and correctly gating the feature behind admin permissions. Previous review feedback has been addressed. Event handling includes proper cleanup. The unrelated documentation changes are low-risk content additions.
  • No files require special attention

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/workflow.tsx Adds event listener for toggle-workflow-lock that routes to collaborativeBatchToggleLocked for socket sync and undo/redo support
apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workflow-list/components/context-menu/context-menu.tsx Adds lock/unlock menu item with props for onToggleLock, showLock, disableLock, and isLocked
apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workflow-list/components/workflow-item/workflow-item.tsx Implements lock toggle logic using getWorkflowLockToggleIds utility, dispatches custom event, shows only for active workflow with admin permissions

Sequence Diagram

sequenceDiagram
    participant User
    participant WorkflowItem as Sidebar (workflow-item)
    participant ContextMenu as Context Menu
    participant Window as Custom Event
    participant Workflow as Workflow Component
    participant Hook as collaborativeBatchToggleLocked
    participant Store as Workflow Store
    participant Socket as Socket Queue
    participant UndoRedo as Undo/Redo

    User->>WorkflowItem: Right-click active workflow
    WorkflowItem->>ContextMenu: Open menu (showLock=true)
    ContextMenu->>User: Display Lock/Unlock option
    User->>ContextMenu: Click Lock/Unlock
    ContextMenu->>WorkflowItem: Trigger handleToggleLock()
    WorkflowItem->>WorkflowItem: Get blocks, call getWorkflowLockToggleIds()
    WorkflowItem->>Window: Dispatch 'toggle-workflow-lock' event
    Window->>Workflow: Event listener receives event
    Workflow->>Hook: Call collaborativeBatchToggleLocked(blockIds)
    Hook->>Socket: Add operation to sync queue
    Hook->>Store: Call batchToggleLocked(blockIds)
    Hook->>UndoRedo: Record operation
    Store->>WorkflowItem: Update triggers re-render
    WorkflowItem->>ContextMenu: Update isLocked state
Loading

Last reviewed commit: 7db6f64

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

7 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

@waleedlatif1
Copy link
Collaborator Author

@greptile

@waleedlatif1
Copy link
Collaborator Author

@cursor review

@waleedlatif1
Copy link
Collaborator Author

@cursor review

@waleedlatif1
Copy link
Collaborator Author

@greptile

Replaces manual pivot-sorting logic with the existing utility function,
which handles block ordering and no-op guards consistently.
@waleedlatif1
Copy link
Collaborator Author

@cursor review

@waleedlatif1
Copy link
Collaborator Author

@greptile

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

@waleedlatif1 waleedlatif1 merged commit 5ae0115 into staging Feb 26, 2026
12 checks passed
@waleedlatif1 waleedlatif1 deleted the waleedlatif1/workflow-lock-context-menu branch February 26, 2026 07:40
Sign up for free to 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