Skip to content

feat(workflow): lock/unlock workflow from context menu and panel#3336

Merged
waleedlatif1 merged 13 commits intostagingfrom
waleedlatif1/lock-workflow
Feb 25, 2026
Merged

feat(workflow): lock/unlock workflow from context menu and panel#3336
waleedlatif1 merged 13 commits intostagingfrom
waleedlatif1/lock-workflow

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

  • Add "Lock workflow" / "Unlock workflow" to canvas right-click menu and panel More menu (admin-only)
  • Show notification when workflow is locked — admins get an "Unlock Workflow" action button, non-admins see "Ask an admin to unlock it"
  • Hide redundant "disabled" badge on blocks when they're already showing "locked"
  • New unlock-workflow notification action type with custom event bridge to workflow.tsx

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 25, 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 25, 2026 11:20pm

Request Review

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 25, 2026

Greptile Summary

Added workflow-level lock/unlock functionality accessible from canvas right-click menu and panel More menu (admin-only). When all blocks are locked, shows an info notification with an "Unlock Workflow" action button for admins or a message to request admin assistance for non-admins. Also fixed redundant badge display by hiding the "disabled" badge when the "locked" badge is already shown.

Key changes:

  • New getWorkflowLockToggleIds utility ensures proper ordering of block IDs for batch lock/unlock operations
  • Memoized hasLockedBlocks, allBlocksLocked, and hasBlocks computed states in workflow.tsx for performance
  • Custom event bridge (unlock-workflow) between notification action and workflow component
  • Admin-only UI controls with proper permission guards and disabled state handling

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • Well-structured implementation with proper permission guards, memoized computations, correct sorting logic in utility functions, and clean event handling. The code follows established patterns and includes proper null/edge case handling.
  • No files require special attention

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/utils/block-protection-utils.ts Added getWorkflowLockToggleIds utility function with correct sorting logic to ensure batchToggleLocked targets the desired state
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/panel.tsx Added workflow lock/unlock toggle to panel More menu with computed states for locked blocks and hasBlocks check
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/workflow.tsx Implemented workflow lock notification system with admin-specific messaging, unlock event listener, and memoized block state computations

Sequence Diagram

sequenceDiagram
    participant User
    participant CanvasMenu
    participant Panel
    participant workflow.tsx
    participant getWorkflowLockToggleIds
    participant batchToggleLocked
    participant Notification
    
    User->>CanvasMenu: Click "Lock/Unlock workflow" (admin)
    CanvasMenu->>workflow.tsx: handleToggleWorkflowLock()
    workflow.tsx->>getWorkflowLockToggleIds: Get sorted block IDs
    getWorkflowLockToggleIds-->>workflow.tsx: Return ordered IDs
    workflow.tsx->>batchToggleLocked: Toggle lock state
    batchToggleLocked-->>workflow.tsx: Update complete
    
    alt All blocks locked
        workflow.tsx->>Notification: Show lock notification
        Notification->>User: Display "Workflow is locked" + action button (admin)
        User->>Notification: Click "Unlock Workflow"
        Notification->>workflow.tsx: Dispatch 'unlock-workflow' event
        workflow.tsx->>getWorkflowLockToggleIds: Get sorted IDs (targetLocked=false)
        getWorkflowLockToggleIds-->>workflow.tsx: Return locked blocks first
        workflow.tsx->>batchToggleLocked: Unlock all blocks
        batchToggleLocked-->>workflow.tsx: Update complete
        workflow.tsx->>Notification: Clear notification
    end
Loading

Last reviewed commit: 1f2306e

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.

6 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@waleedlatif1
Copy link
Collaborator Author

@greptile

@waleedlatif1
Copy link
Collaborator Author

@cursor review

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, no comments

Edit Code Review Agent Settings | Greptile

@waleedlatif1
Copy link
Collaborator Author

@cursor review

@waleedlatif1
Copy link
Collaborator Author

@greptile

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, no comments

Edit Code Review Agent Settings | Greptile

@waleedlatif1
Copy link
Collaborator Author

bugbot run

* feat(google-translate): add Google Translate integration

* fix(google-translate): api key as query param, fix docsLink, rename tool file
#3338)

* feat(google): add missing tools for Gmail, Drive, Sheets, and Calendar

* fix(google-drive): remove dead transformResponse from move tool
* feat(confluence): return page content in get page version tool

* lint
* feat(api): audit log read endpoints for admin and enterprise

* fix(api): address PR review — boolean coercion, cursor validation, detail scope

* ran lint
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.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

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 244e1ee into staging Feb 25, 2026
3 checks passed
@waleedlatif1 waleedlatif1 deleted the waleedlatif1/lock-workflow branch February 25, 2026 23:23
waleedlatif1 added a commit that referenced this pull request Feb 26, 2026
* feat(workflow): lock/unlock workflow from context menu and panel

* lint

* fix(workflow): prevent duplicate lock notifications, no-op guard, fix orphaned JSDoc

* improvement(workflow): memoize hasLockedBlocks to avoid inline recomputation

* feat(google-translate): add Google Translate integration (#3337)

* feat(google-translate): add Google Translate integration

* fix(google-translate): api key as query param, fix docsLink, rename tool file

* feat(google): add missing tools for Gmail, Drive, Sheets, and Calendar (#3338)

* feat(google): add missing tools for Gmail, Drive, Sheets, and Calendar

* fix(google-drive): remove dead transformResponse from move tool

* feat(confluence): return page content in get page version tool (#3344)

* feat(confluence): return page content in get page version tool

* lint

* feat(api): audit log read endpoints for admin and enterprise (#3343)

* feat(api): audit log read endpoints for admin and enterprise

* fix(api): address PR review — boolean coercion, cursor validation, detail scope

* ran lint

* unified list of languages for google translate

* fix(workflow): respect snapshot view for panel lock toggle, remove unused disableAdmin prop

* improvement(canvas-menu): remove lock icon from workflow lock toggle

* feat(audit): record audit log for workflow lock/unlock
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