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.tsxAbout
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.
- Confirm the alertDone
Check the provider status page and current error rate.
- Scale checkout replicas to 12Done
Absorb the retry load while the provider recovers.
deployment.apps/checkout scaled - 3Drain and restart the connection poolDestructive
Clears sockets stuck in CLOSE_WAIT.
- 4Re-enable the payment retry budget
<RunbookSteps steps={steps} onRun={run} onSkip={skip} />Examples
Runbook
<RunbookSteps steps={steps} onRun={run} onSkip={skip} />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'>.
| Prop | Type | Default | Description |
|---|---|---|---|
| steps | RunbookStep[] | 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. |
| title | ReactNode | — | — |
| destructiveLabel | ReactNode | 'Destructive' | Badge on a step that asks before it runs. |
| confirmNote | ReactNode | 'This cannot be undone. Run it?' | — |
| confirmLabel | ReactNode | 'Confirm' | — |
| cancelLabel | ReactNode | 'Cancel' | — |
| runLabel | ReactNode | 'Run' | — |
| skipLabel | ReactNode | 'Skip' | — |
| runningLabel | string | 'Running' | Accessible name for the in-progress spinner. |
Types
RunbookStep
| Field | Type | Description |
|---|---|---|
| id | string | — |
| title | ReactNode | — |
| description? | ReactNode | — |
| status | RunbookStatus | — |
| confirm? | boolean | Per-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? | ReactNode | Result of a run — a Terminal, usually. |
| Type | Definition | Description |
|---|---|---|
RunbookStatus | 'pending' | 'running' | 'done' | 'failed' | 'skipped' | A runbook: remediation steps, each runnable on its own. |