web: run-level actions — human decision, cancel, retry and rename (R11–R14)
Add the run-level operator actions to the browser run detail, matching the Android client's wording and wire frames: - R11 human decision: pure model in src/actions.js (pendingDecision, lastWaitingStep, waitingPrompt/waitingOptions, humanOptions, decisionTargetLabel, DecisionDraft) plus the decision card and sheet; decide_run sends run_id, the chosen option and trimmed feedback. - R12 cancel: a Cancel run action offered only while executing; the Android confirm copy; cancel_run then a silent get_run refresh. - R13 retry: offered only for a loaded, non-executing failed run; resume is the default (no retry_mode, like Android) with a browser-only Restart from start secondary that sends retry_mode:"restart". - R14 rename: an inline set_run_title field; refreshes the run and its list row. - One shared Action failed dialog for all of the above. Add the protocol constants and typed builders, a hand-written dark-palette section for the card/sheet/dialogs, focused unit tests for the helpers and request shapes, and ui-smoke captures for the new states. Update PARITY.md: R11 stays partial (no live waiting run), R12–R14 done with the stated shown-not-executed and Android-divergence notes. Also harden openRunDetail() in the UI smoke: the tabstrip already exists from the previously opened run, so wait for the target run's identity line before asserting on its actions (review finding).
This commit is contained in:
@@ -72,4 +72,64 @@ export class PipelinesRepository {
|
||||
}
|
||||
return response.run_detail;
|
||||
}
|
||||
|
||||
/**
|
||||
* Answers a run's waiting human stage with the chosen `option` and optional
|
||||
* `feedback` (mirrors PipelinesRepository.decideRun). The stage is sent only
|
||||
* when non-blank and the feedback is trimmed, exactly like the Android client;
|
||||
* a refused decision rejects with the server's own reason (a ProtocolError).
|
||||
*/
|
||||
async decideRun(id, { stage, option, feedback } = {}) {
|
||||
const request = { type: Protocol.DECIDE_RUN, run_id: id, option };
|
||||
if (stage != null && String(stage).trim() !== "") request.stage = stage;
|
||||
const trimmedFeedback = String(feedback ?? "").trim();
|
||||
if (trimmedFeedback !== "") request.feedback = trimmedFeedback;
|
||||
const response = await this.#client.call(request);
|
||||
if (!response.run_detail) {
|
||||
throw new ProtocolError("The server returned no run detail.");
|
||||
}
|
||||
return response.run_detail;
|
||||
}
|
||||
|
||||
/** Cancels a run; mirrors PipelinesRepository.cancelRun (exactly run_id). */
|
||||
async cancelRun(id) {
|
||||
const response = await this.#client.call({ type: Protocol.CANCEL_RUN, run_id: id });
|
||||
if (!response.run_detail) {
|
||||
throw new ProtocolError("The server returned no run detail.");
|
||||
}
|
||||
return response.run_detail;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retries a terminal failed run. `request_key` is always sent (the retry is
|
||||
* its own idempotent run); `retry_mode` is sent only for an explicit
|
||||
* `restart`, so the server's default (resume) applies exactly as the Android
|
||||
* client's mode-less call.
|
||||
*/
|
||||
async retryRun(id, { mode = null, requestKey } = {}) {
|
||||
const request = {
|
||||
type: Protocol.RETRY_RUN,
|
||||
run_id: id,
|
||||
request_key: requestKey ?? "",
|
||||
};
|
||||
if (mode === "restart") request.retry_mode = "restart";
|
||||
const response = await this.#client.call(request);
|
||||
if (!response.run_detail) {
|
||||
throw new ProtocolError("The server returned no run detail.");
|
||||
}
|
||||
return response.run_detail;
|
||||
}
|
||||
|
||||
/** Renames a run's stored title; mirrors the set_run_title wire command. */
|
||||
async setRunTitle(id, title) {
|
||||
const response = await this.#client.call({
|
||||
type: Protocol.SET_RUN_TITLE,
|
||||
run_id: id,
|
||||
title,
|
||||
});
|
||||
if (!response.run_detail) {
|
||||
throw new ProtocolError("The server returned no run detail.");
|
||||
}
|
||||
return response.run_detail;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user