feat(web): manage independent schedules and restore recorded stage navigation
This commit is contained in:
@@ -7,6 +7,7 @@ import { backChevronIcon, h, kvMono, canCopyLink, canShare, copyArtifactLink, sh
|
||||
import { isExecuting, changeKindTone, describeError } from "../format.js";
|
||||
import { resolveArtifactUrl } from "../serverUrl.js";
|
||||
import { runStateOf, runStatusLabel } from "../runs.js";
|
||||
import { scheduledRunLabel } from "../scheduleOrigin.js";
|
||||
import { PIPELINE_GRAPH_EMPTY, RUN_GRAPH_MISSING, mount as mountGraph } from "../graph.js";
|
||||
import { writeGraphExpanded } from "../graphPrefs.js";
|
||||
import { definitionDocument } from "./stageDefinition.js";
|
||||
@@ -216,7 +217,7 @@ function renderRunDetail(now = Date.now()) {
|
||||
* The Graph tab (R5): the run's own guidance note plus the shared workflow graph
|
||||
* mounted in run mode, or the app's exact missing-graph sentence when the server
|
||||
* sent no stages. The active stage pulses with its elapsed time while the run
|
||||
* executes; clicking a stage opens its authored definition without navigating.
|
||||
* executes; clicking a stage opens the same recorded-visit pane as Timeline.
|
||||
* The mount handle is tracked in `state.runGraph` so a re-render
|
||||
* (or a tab/run change) always unmounts the previous wheel/pointer/resize
|
||||
* listeners and the elapsed timer.
|
||||
@@ -233,9 +234,7 @@ function renderRunGraphTab(d) {
|
||||
state.runGraph = mountGraph(host, d.graph, {
|
||||
runState: runGraphState(d),
|
||||
expanded: state.runGraphExpanded,
|
||||
onStageTap: (key) => rt.views.dialogs.openStageDefinition(
|
||||
runDefinition(d), key, `Run ${d.id} · pipeline ${d.pipeline_id} · v${d.version}`,
|
||||
),
|
||||
onStageTap: (key) => openStagePane(key, latestVisitIndex(d, key)),
|
||||
onExpandedChange: (value) => {
|
||||
state.runGraphExpanded = value;
|
||||
writeGraphExpanded(value);
|
||||
@@ -418,6 +417,8 @@ function renderRunSummaryTab(d, now) {
|
||||
const wrap = h("div", { class: "run-tab-body" });
|
||||
wrap.append(renderRunTitleRow(d));
|
||||
wrap.append(h("div", { class: "run-identity muted", text: runIdentityLine(d) }));
|
||||
const origin = scheduledRunLabel(d);
|
||||
if (origin) wrap.append(h("p", { class: "run-schedule-origin muted", text: origin }));
|
||||
|
||||
const rows = h("div", { class: "kv" });
|
||||
for (const row of summaryRows(d, now)) {
|
||||
@@ -970,9 +971,28 @@ function renderDecisionCard(decision) {
|
||||
return card;
|
||||
}
|
||||
|
||||
/** Cancel/Retry actions, shown exactly per the app's eligibility rules. */
|
||||
/** Run controls plus an independent schedule seeded from the original RunInfo. */
|
||||
function renderRunActions(d) {
|
||||
const buttons = [];
|
||||
if (rt.views?.schedules && Number(d.pipeline_id) > 0 && Number(d.version) > 0) {
|
||||
buttons.push(h("button", {
|
||||
class: "run-action schedule-run",
|
||||
type: "button",
|
||||
text: "Schedule this run",
|
||||
title: "Save this run's prompt and options with an independent timer; does not rerun it now",
|
||||
onclick: async (event) => {
|
||||
const trigger = event.currentTarget;
|
||||
trigger.disabled = true;
|
||||
try {
|
||||
const pipeline = await runDefinition(d);
|
||||
if (state.runDetail?.id === d.id) rt.views.schedules.openScheduleEditor({ pipeline, run: d, trigger });
|
||||
} catch (error) {
|
||||
state.actionError = describeError(error);
|
||||
renderContent();
|
||||
} finally { trigger.disabled = false; }
|
||||
},
|
||||
}));
|
||||
}
|
||||
if (canCancel(d)) {
|
||||
buttons.push(
|
||||
h("button", {
|
||||
|
||||
Reference in New Issue
Block a user