Skip to content

Add Delete button to JobInspector #3702

@theroinaochieng

Description

@theroinaochieng

Note: This issue was originally titled "Enhance JobInspector with missing LiveView features" but has been refocused to specifically implement Delete functionality. Edit and Run buttons are handled in separate issues (#3708, #3709).

User story

As a workflow developer, I want to delete a job from the inspector panel, so that I can remove jobs I no longer need from my workflow.

Details

Current Implementation (LiveView):

  • Delete button in job panel footer (lib/lightning_web/live/workflow_live/edit.ex:587-614)
  • Danger theme styling (red button)
  • Complex disable conditions checking:
    • Workflow not deleted (!is_nil(@workflow.deleted_at))
    • User permissions (@can_edit_workflow)
    • No child edges dependent on job (@has_child_edges)
    • Not first job in workflow (@is_first_job)
    • Viewing latest snapshot (@snapshot_version_tag == "latest")
    • User has presence edit priority (@has_presence_edit_priority)
  • Tooltip message via job_deletion_tooltip_message() helper (edit.ex:3547-3562)
  • Confirmation dialog: "Are you sure you want to delete this step?"
  • Triggers phx-click="delete_node" event (handler at edit.ex:1721-1763)

Target Implementation (React):

Delete Validation Logic Needed:

  1. Check if job has dependent child edges (need to calculate from workflow state)
  2. Check if job is first job in workflow (has trigger as parent)
  3. Check user has can_edit_workflow permission (available in SessionContext)
  4. Show appropriate tooltip message when button disabled
  5. Show confirmation dialog before delete
  6. Call removeJobAndClearSelection from workflow store

Implementation notes

In Scope:

  • Footer section structure in JobInspector
  • Button component with danger theme styling
  • Delete button with full functionality
  • Permission checking via can_edit_workflow
  • Validation logic (has_child_edges, is_first_job)
  • Confirmation dialog (browser confirm or custom modal)
  • Tooltip for disabled state explanations
  • Integration with workflow store's removeJobAndClearSelection action

Out of Scope:

Component Infrastructure Needed:

  • Button component with danger theme
  • Tooltip component for disabled state messages
  • Confirmation dialog pattern (modal or browser confirm)

Store Integration:

  • Use existing removeJobAndClearSelection action from WorkflowStore
  • Calculate dependent edges from workflow state
  • Use can_edit_workflow from SessionContextStore

Release notes

Add delete functionality to job inspector panel.

User acceptance criteria

  • Footer section appears in JobInspector
  • Delete button visible with danger styling
  • Button disabled when job has dependent edges
  • Button disabled when job is first in workflow (has trigger parent)
  • Button disabled when user lacks edit permission
  • Tooltip shows appropriate message when disabled
  • Confirmation dialog appears before delete
  • Delete removes job and clears selection
  • Visual parity with LiveView delete button

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions