OpenFn/lightning

Enable/Disable Workflows with a Toggle

Closed this issue · 0 comments

Description

This feature introduces an intuitive toggle for enabling and disabling workflows, addressing the frustration caused by the hidden "disable trigger" button. By making this functionality more accessible, we aim to enhance user experience and streamline workflow management.

When the toggle is used:

  • All triggers in the workflow should be updated to match the workflow state (enabled or disabled).
  • A single audit event should be logged to capture the state change.

Problem

The current "disable trigger" button is difficult to find, which hinders users from efficiently disabling or enabling workflows as needed.

Solution

A toggle will be added to both the workflow overview page and the workflow canvas to allow users to enable or disable workflows easily. When a workflow is toggled:

  • All triggers in the workflow will be updated to match the workflow state.
  • Users should clearly see when a workflow is disabled.
  • Existing functionality allowing users to make and save changes to disabled workflows will remain unchanged.
  • Users will still be able to manually run disabled workflows via the inspector.
  • New workflows will be disabled by default, requiring users to enable them manually when ready.
  • Each toggle action (enable/disable) will generate a single audit event for proper tracking.

Audit Logging

The audit trail for enabling or disabling workflows will be integrated into the save_workflow/1 function. This ensures:

  • Event Type: enabled or disabled.
  • Subject: The workflow being toggled.
  • Actor: The user performing the action.

The implementation will:

  • Detect state changes by inspecting the changeset for updates to the enabled field of triggers.
  • Log a single audit event, regardless of the number of triggers, to capture details such as the workflow ID, the new state, and the actor.
  • Ensure existing behavior, such as capturing snapshots and publishing Kafka events, remains unaffected.

Acceptance Criteria

  • A toggle is implemented and accessible on both the workflow overview page and the workflow canvas.
  • When the toggle is used:
    • All triggers in the workflow are updated to match the workflow state.
    • A single audit event is logged, including details about the state change and the user who performed it.
  • Disabled workflows are visually distinct from enabled ones.
  • New workflows are disabled by default and require manual enabling.