Skip to content

Implement Update Pause Behavior #2808

@zackcl

Description

@zackcl

User Story

As an experiment manager, I want to update the pause behavior of an already-paused experiment so that I can change how existing enrollments are handled without resuming the experiment.

Description

Implement the ability to display and update the pause behavior for paused experiments. When an experiment is in Paused status, display the current pause behavior (Continue or Assign) with an edit link/button that opens a modal to change the setting.

Note: This does NOT change the experiment status - it only updates the pause behavior setting (internally stored as postExperimentRule field).

Implementation Details

1. Add Pause Behavior Display

Location: experiment-overview-details-section-card.component (overview details area)

  • Display only when experiment.state === EXPERIMENT_STATE.ENROLLMENT_COMPLETE
  • Show text: "Pause Behavior: [Continue/Assign]"
    • Internally uses postExperimentRule field from experiment entity
  • Add edit link/button next to the text (e.g., "Change" link or edit icon)
  • Clicking the link/button opens the Update Pause Behavior modal

2. Create Update Pause Behavior Modal

New component: modals/update-pause-behavior-modal/

Follow the existing modal pattern with:

  • Title: "Update Pause Behavior"
  • Pause Behavior Section:
    • Radio button 1: "Continue"
      • Label: "Students will remain in their current assigned conditions without any changes."
    • Radio button 2: "Assign"
      • Label: "All students will receive a specified condition moving forward."
      • Conditional dropdown: "Condition *" (appears when Assign is selected)
  • Primary button: "Save" (blue)
  • Cancel button: "Cancel"

3. Modal Behavior

  • Pre-populate modal with current pause behavior value from experiment.postExperimentRule
  • If current behavior is "Assign", also pre-select the current condition
  • Conditionally show condition dropdown based on radio selection
  • Validate that condition is selected when "Assign" is chosen

4. Service Updates

  • DialogService: Add openUpdatePauseBehaviorModal(currentBehavior, conditionId?) method
  • ExperimentService: Add updatePauseBehavior(experimentId, behavior, conditionId?) method
  • API: Update experiment's postExperimentRule field (and condition reference if applicable)
  • Note: This updates only the pause behavior, NOT the experiment status

Acceptance Criteria

  • "Pause Behavior" text displays ONLY when experiment status is Paused
  • Current pause behavior is shown correctly (Continue or Assign with condition name if applicable)
  • Edit link/button appears next to the Pause Behavior text (Continue or Assign (conditionName))
  • Clicking edit link/button opens the Update Pause Behavior modal
  • Modal pre-selects current pause behavior (Continue or Assign)
  • If current behavior is "Assign", modal pre-selects the current condition
  • Condition dropdown appears ONLY when "Assign" is selected
  • Condition dropdown is populated with experiment's conditions
  • "Save" button is disabled until valid selection is made (including condition if Assign selected)
  • Clicking "Save" updates the pause behavior without changing experiment status
  • Pause Behavior text updates in UI without page refresh
  • Success notification appears: "Pause behavior updated successfully"
  • Clicking "Cancel" closes modal without changes
  • Error notification appears if update fails

Technical Notes

  • Reuse existing postExperimentRule field from experiment entity (UI-only change)
  • Similar to Pause modal (Story 2) but for updating existing paused experiment
  • Pre-populate form with current values using reactive forms
  • Use *ngIf to conditionally show condition dropdown
  • Use translation keys for all text
  • No backend schema changes needed - just updating existing field

Screenshots

Paused Status with Pause Behavior Display

Image

Update Pause Behavior Modal - Continue Selected

Image

Update Pause Behavior Modal - Assign Selected

Image

Latest Design in Figma

https://www.figma.com/design/4a5EYBzojcVNwjlsBcRya2/UpGrade-UI-Latest-32--Experiment-Status-?node-id=38266-21375&t=Jv71JMRWtRvngRMk-1

Metadata

Metadata

Assignees

Type

No type

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions