Runbook Steps

Remediation steps, run one at a time and only in order. Offering "run" on step four while step two is untried invites exactly the mistake the runbook exists to prevent.

src/components/ui/runbook-steps.tsx

About

From the component's own source, where it was written.

A runbook: remediation steps, each runnable on its own.

Steps run one at a time and only in order — a runbook is a procedure, and offering "run" on step four while step two has not been attempted invites exactly the mistake the runbook exists to prevent. The next actionable step is computed rather than tracked, so it stays correct when a step is skipped.

Destructive steps must be confirmed. confirm is a per-step flag, because the ones that restart a database sit right beside the ones that read a log.

Install

npx astralyx-ui add runbook-steps

Usage

import { RunbookSteps } from '@/components/ui/runbook-steps'

<RunbookSteps steps={steps} onRun={run} onSkip={skip} />

Composer

Change the props and the source below follows.

  1. Confirm the alertDone

    Check the provider status page and current error rate.

  2. Scale checkout replicas to 12Done

    Absorb the retry load while the provider recovers.

    deployment.apps/checkout scaled
  3. 3
    Drain and restart the connection poolDestructive

    Clears sockets stuck in CLOSE_WAIT.

  4. 4
    Re-enable the payment retry budget
Props
tsx
<RunbookSteps steps={steps} onRun={run} onSkip={skip} />

Examples

Runbook

API

Generated from the source, so it cannot fall behind the code. One table per exported component, then hooks, functions and types.

RunbookSteps

Extends Omit<ComponentProps<'div'>, 'title'>.

PropTypeDefaultDescription
stepsRunbookStep[]required{ id, title, description?, status, confirm?, output? }.
onRun(id: string) => void—Only the next unresolved step offers them, and nothing offers them while another step is running.
onSkip(id: string) => void—Only the next unresolved step offers them, and nothing offers them while another step is running.
titleReactNode——
destructiveLabelReactNode'Destructive'Badge on a step that asks before it runs.
confirmNoteReactNode'This cannot be undone. Run it?'—
confirmLabelReactNode'Confirm'—
cancelLabelReactNode'Cancel'—
runLabelReactNode'Run'—
skipLabelReactNode'Skip'—
runningLabelstring'Running'Accessible name for the in-progress spinner.

Types

RunbookStep

FieldTypeDescription
idstring—
titleReactNode—
description?ReactNode—
statusRunbookStatus—
confirm?booleanPer-step, because the step that restarts a database sits right beside the one that reads a log. Swaps the actions for an inline confirmation.
output?ReactNodeResult of a run — a Terminal, usually.
TypeDefinitionDescription
RunbookStatus
'pending' | 'running' | 'done' | 'failed' | 'skipped'
A runbook: remediation steps, each runnable on its own.