Line

ui/client/features/plan/hooks/usePlanNote

Cockpit client (features), v0.9. Source: ui/client/features/plan/hooks/usePlanNote.tsx.

Functions#

usePlanNote()#

usePlanNote(state, dispatch): object

Defined in: ui/client/features/plan/hooks/usePlanNote.tsx:31

The Plan screen's durable note. Text autosaves as it is typed; step edits save the plan with it, and the server marks the plan "out of date" when the text changes after. Run reads the saved note (flush) and the server marks it ran. A note that already ran is read-only history: editing it (or running it again) starts a copy. A failed save or a stale write waits for a person (Retry, Keep mine, Load theirs); the text is never lost.

Nothing here calls a model.

Parameters#

state

ScreenState

dispatch

Dispatch<ScreenAction>

Returns#

flush

flush: () => Promise<string | null>

Before Run: save now and hand back the id of the note to run from. A note that already ran is copied first.

Returns

Promise<string | null>

keepMine

keepMine: () => void

Returns

void

keepPlan

keepPlan: () => void

"Keep this plan": save the plan on screen against the newer text, which clears "Plan out of date".

Returns

void

loadTheirs

loadTheirs: () => void

Returns

void

resync

resync: (id) => Promise<void>

After Run: the server marked the note ran; take its copy so the screen shows it.

Parameters
id

string

Returns

Promise<void>

retry

retry: () => void

Returns

void