@pipelex/mthds-ui 0.39.0 → 0.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -6
- package/dist/chunk-6S5TQPTO.js +1349 -0
- package/dist/chunk-6S5TQPTO.js.map +1 -0
- package/dist/chunk-7JZBXBZS.js +258 -0
- package/dist/chunk-7JZBXBZS.js.map +1 -0
- package/dist/{chunk-AGFLCOWW.js → chunk-HPARBH6K.js} +14 -197
- package/dist/chunk-HPARBH6K.js.map +1 -0
- package/dist/chunk-N2F62MW7.js +55 -0
- package/dist/chunk-N2F62MW7.js.map +1 -0
- package/dist/chunk-P6IGZVWE.js +155 -0
- package/dist/chunk-P6IGZVWE.js.map +1 -0
- package/dist/form/react/index.d.ts +1 -1
- package/dist/graph/index.d.ts +19 -3
- package/dist/graph/index.js +20 -12
- package/dist/graph/react/index.d.ts +13 -13
- package/dist/graph/react/index.js +387 -560
- package/dist/graph/react/index.js.map +1 -1
- package/dist/graph/react/viewer/GraphToolbar.css +2 -107
- package/dist/graph/react/viewer/StyleMenu.css +109 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +20 -12
- package/dist/registryJoin-C6Wfkik-.d.ts +441 -0
- package/dist/standalone/graph-standalone.html +176 -171
- package/dist/standalone/graph-viewer.css +75 -70
- package/dist/standalone/graph-viewer.js +101 -101
- package/dist/static-graph/index.d.ts +1 -1
- package/dist/timeline/index.d.ts +344 -83
- package/dist/timeline/index.js +67 -3
- package/dist/timeline/react/RunTimeline.css +141 -0
- package/dist/timeline/react/index.d.ts +57 -6
- package/dist/timeline/react/index.js +929 -120
- package/dist/timeline/react/index.js.map +1 -1
- package/dist/timeline/react/styles/simple/SimpleProgress.css +354 -0
- package/dist/{types-DsrzH6gM.d.ts → types-DLAnYNoi.d.ts} +1 -1
- package/package.json +6 -4
- package/dist/chunk-AGFLCOWW.js.map +0 -1
- package/dist/chunk-ILZJIORT.js +0 -54
- package/dist/chunk-ILZJIORT.js.map +0 -1
- package/dist/chunk-JJG2TO7P.js +0 -473
- package/dist/chunk-JJG2TO7P.js.map +0 -1
- package/dist/progressSnapshot-VZ4PLul9.d.ts +0 -191
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
|
+
StyleMenu,
|
|
3
4
|
useSystemTheme
|
|
4
|
-
} from "../../chunk-
|
|
5
|
+
} from "../../chunk-7JZBXBZS.js";
|
|
6
|
+
import "../../chunk-N2F62MW7.js";
|
|
5
7
|
import {
|
|
6
8
|
INVOCATION_STATUS,
|
|
9
|
+
KEPT_VISIBLE_REASON,
|
|
7
10
|
PROGRESS_MODE,
|
|
11
|
+
RUN_PROGRESS_STATUS,
|
|
12
|
+
SIMPLE_LINE_KIND,
|
|
13
|
+
SIMPLE_LINE_STATE,
|
|
14
|
+
SIMPLE_RUN_NOTE_REASON,
|
|
15
|
+
TIMELINE_ENTRY_KIND,
|
|
16
|
+
TIMELINE_STYLE,
|
|
17
|
+
TIMELINE_STYLES,
|
|
8
18
|
barFollowsClock,
|
|
19
|
+
buildSimpleProgress,
|
|
9
20
|
buildTimelineRows,
|
|
10
21
|
formatClockTime,
|
|
11
22
|
formatDuration,
|
|
@@ -15,10 +26,17 @@ import {
|
|
|
15
26
|
isRunEnded,
|
|
16
27
|
progressStreamKey,
|
|
17
28
|
readingClockMs,
|
|
29
|
+
resolveTimelineStyle,
|
|
30
|
+
resolveTimelineStyleMenu,
|
|
31
|
+
simpleProgressChanges,
|
|
18
32
|
snapshotTimes,
|
|
19
33
|
timelineTicks,
|
|
20
|
-
timelineWindowAt
|
|
21
|
-
|
|
34
|
+
timelineWindowAt,
|
|
35
|
+
timestampMs
|
|
36
|
+
} from "../../chunk-6S5TQPTO.js";
|
|
37
|
+
import {
|
|
38
|
+
outcomeLabel
|
|
39
|
+
} from "../../chunk-P6IGZVWE.js";
|
|
22
40
|
import {
|
|
23
41
|
getPaletteForTheme
|
|
24
42
|
} from "../../chunk-ENRYQOCO.js";
|
|
@@ -32,42 +50,14 @@ import {
|
|
|
32
50
|
|
|
33
51
|
// src/timeline/react/index.ts
|
|
34
52
|
import "./RunTimeline.css";
|
|
53
|
+
import "./styles/simple/SimpleProgress.css";
|
|
54
|
+
import "../../graph/react/viewer/StyleMenu.css";
|
|
35
55
|
|
|
36
56
|
// src/timeline/react/RunTimeline.tsx
|
|
57
|
+
import * as React4 from "react";
|
|
58
|
+
|
|
59
|
+
// src/timeline/react/readingClock.ts
|
|
37
60
|
import * as React from "react";
|
|
38
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
39
|
-
var CLOCK_TICK_MS = 250;
|
|
40
|
-
var TICK_RIGHT_ALIGN_PERCENT = 92;
|
|
41
|
-
var TICK_SPACING_PX = 64;
|
|
42
|
-
var DEFAULT_MAX_TICKS = 6;
|
|
43
|
-
function useTickBudget() {
|
|
44
|
-
const [budget, setBudget] = React.useState(DEFAULT_MAX_TICKS);
|
|
45
|
-
const observer = React.useRef(null);
|
|
46
|
-
const ref = React.useCallback((element) => {
|
|
47
|
-
var _a;
|
|
48
|
-
(_a = observer.current) == null ? void 0 : _a.disconnect();
|
|
49
|
-
observer.current = null;
|
|
50
|
-
if (!element || typeof ResizeObserver === "undefined") return;
|
|
51
|
-
observer.current = new ResizeObserver((entries) => {
|
|
52
|
-
var _a2, _b;
|
|
53
|
-
const width = (_b = (_a2 = entries[0]) == null ? void 0 : _a2.contentRect.width) != null ? _b : 0;
|
|
54
|
-
if (width > 0) setBudget(Math.max(1, Math.floor(width / TICK_SPACING_PX)));
|
|
55
|
-
});
|
|
56
|
-
observer.current.observe(element);
|
|
57
|
-
}, []);
|
|
58
|
-
return [ref, budget];
|
|
59
|
-
}
|
|
60
|
-
var EMPTY_EXPANSION = Object.freeze({});
|
|
61
|
-
var RUN_STATUS_WORD = {
|
|
62
|
-
pending: "Pending",
|
|
63
|
-
running: "Running",
|
|
64
|
-
succeeded: "Succeeded",
|
|
65
|
-
failed: "Failed",
|
|
66
|
-
canceled: "Canceled"
|
|
67
|
-
};
|
|
68
|
-
function wordFor(table, value) {
|
|
69
|
-
return Object.prototype.hasOwnProperty.call(table, value) ? table[value] : value;
|
|
70
|
-
}
|
|
71
61
|
function useHeldSnapshot(snapshot) {
|
|
72
62
|
const [state, setState] = React.useState({ given: snapshot, held: snapshot });
|
|
73
63
|
if (state.given !== snapshot) {
|
|
@@ -77,10 +67,15 @@ function useHeldSnapshot(snapshot) {
|
|
|
77
67
|
}
|
|
78
68
|
return state.held;
|
|
79
69
|
}
|
|
80
|
-
function useReadingClock(held, stream, now, live, followsClock) {
|
|
70
|
+
function useReadingClock(held, stream, { now, live, followsClock: followsClock2, tickMs }) {
|
|
81
71
|
const base = React.useMemo(() => readingClockMs(held, now), [held, now]);
|
|
82
|
-
const ticking = live && now === void 0 && base !== null && !isRunEnded(held.status) &&
|
|
83
|
-
const [clock, setClock] = React.useState({
|
|
72
|
+
const ticking = live && now === void 0 && base !== null && !isRunEnded(held.status) && followsClock2;
|
|
73
|
+
const [clock, setClock] = React.useState({
|
|
74
|
+
stream,
|
|
75
|
+
base,
|
|
76
|
+
ticking,
|
|
77
|
+
ms: base
|
|
78
|
+
});
|
|
84
79
|
let shown = clock;
|
|
85
80
|
if (clock.stream !== stream || clock.base !== base || clock.ticking !== ticking) {
|
|
86
81
|
const floor = ticking && clock.ticking && clock.stream === stream ? clock.ms : null;
|
|
@@ -98,11 +93,597 @@ function useReadingClock(held, stream, now, live, followsClock) {
|
|
|
98
93
|
setClock(
|
|
99
94
|
(state) => state.stream === stream && state.base === base && state.ticking && state.ms !== null ? __spreadProps(__spreadValues({}, state), { ms: state.ms + step }) : state
|
|
100
95
|
);
|
|
101
|
-
},
|
|
96
|
+
}, tickMs);
|
|
102
97
|
return () => window.clearInterval(timer);
|
|
103
|
-
}, [ticking, stream, base]);
|
|
98
|
+
}, [ticking, stream, base, tickMs]);
|
|
104
99
|
return { nowMs: ticking ? shown.ms : base, ticking };
|
|
105
100
|
}
|
|
101
|
+
|
|
102
|
+
// src/timeline/react/streamRecord.ts
|
|
103
|
+
import * as React2 from "react";
|
|
104
|
+
var EMPTY_RECORD = Object.freeze({});
|
|
105
|
+
function emptyRecord() {
|
|
106
|
+
return EMPTY_RECORD;
|
|
107
|
+
}
|
|
108
|
+
function useStreamRecord(stream) {
|
|
109
|
+
const [state, setState] = React2.useState({ stream, values: emptyRecord() });
|
|
110
|
+
if (state.stream !== stream) {
|
|
111
|
+
setState({ stream, values: emptyRecord() });
|
|
112
|
+
}
|
|
113
|
+
const set = React2.useCallback(
|
|
114
|
+
(key, value) => {
|
|
115
|
+
setState((previous) => ({
|
|
116
|
+
stream,
|
|
117
|
+
values: __spreadProps(__spreadValues({}, previous.stream === stream ? previous.values : emptyRecord()), {
|
|
118
|
+
[key]: value
|
|
119
|
+
})
|
|
120
|
+
}));
|
|
121
|
+
},
|
|
122
|
+
[stream]
|
|
123
|
+
);
|
|
124
|
+
return { values: state.stream === stream ? state.values : emptyRecord(), set };
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// src/timeline/react/styles/simple/SimpleProgressView.tsx
|
|
128
|
+
import * as React3 from "react";
|
|
129
|
+
|
|
130
|
+
// src/timeline/react/styles/simple/simpleProgressStrings.ts
|
|
131
|
+
function plural(count, one, many) {
|
|
132
|
+
return count === 1 ? one : many;
|
|
133
|
+
}
|
|
134
|
+
function withElapsed(phrase, elapsed) {
|
|
135
|
+
return elapsed === null ? phrase : `${phrase} \xB7 ${elapsed}`;
|
|
136
|
+
}
|
|
137
|
+
function itemCount(count, item) {
|
|
138
|
+
const noun = item != null ? item : "item";
|
|
139
|
+
return `${count} ${plural(count, noun, `${noun}s`)}`;
|
|
140
|
+
}
|
|
141
|
+
var DEFAULT_SIMPLE_PROGRESS_STRINGS = {
|
|
142
|
+
waiting: "Waiting to start",
|
|
143
|
+
working: (elapsed) => withElapsed("Working on it", elapsed),
|
|
144
|
+
done: (elapsed) => withElapsed("Done", elapsed),
|
|
145
|
+
failed: (where, elapsed) => withElapsed(where === null ? "Failed" : `Failed in ${where}`, elapsed),
|
|
146
|
+
canceled: (elapsed) => withElapsed("Canceled", elapsed),
|
|
147
|
+
nothingRecorded: "No progress was recorded",
|
|
148
|
+
dryRun: "Dry run",
|
|
149
|
+
checklistLabel: "Steps of the run",
|
|
150
|
+
together: "at the same time",
|
|
151
|
+
forEach: (item) => `for each ${item != null ? item : "item"}`,
|
|
152
|
+
outcomeTaken: (key) => `\u2192 ${key === null ? "Default" : outcomeLabel(key)}`,
|
|
153
|
+
branchFor: (key) => key === null ? "otherwise" : `if ${outcomeLabel(key)}`,
|
|
154
|
+
finishedBranches: (count) => `${count} done`,
|
|
155
|
+
now: "Now:",
|
|
156
|
+
batchCounts: (done, total, running, failed, skipped) => {
|
|
157
|
+
let text = `${done} of ${total} done`;
|
|
158
|
+
if (running > 0) text += ` \xB7 ${running} in progress`;
|
|
159
|
+
if (failed > 0) text += ` \xB7 ${failed} failed`;
|
|
160
|
+
if (skipped > 0) text += ` \xB7 ${skipped} skipped`;
|
|
161
|
+
return text;
|
|
162
|
+
},
|
|
163
|
+
tally: (tally) => {
|
|
164
|
+
const parts = [];
|
|
165
|
+
if (tally.done > 0) parts.push(`${tally.done} done`);
|
|
166
|
+
if (tally.running > 0) parts.push(`${tally.running} in progress`);
|
|
167
|
+
if (tally.failed > 0) parts.push(`${tally.failed} failed`);
|
|
168
|
+
if (tally.skipped > 0) parts.push(`${tally.skipped} skipped`);
|
|
169
|
+
if (tally.stopped > 0) parts.push(`${tally.stopped} stopped`);
|
|
170
|
+
return parts.length > 0 ? parts.join(", ") : "not started";
|
|
171
|
+
},
|
|
172
|
+
state: {
|
|
173
|
+
upcoming: "Not started",
|
|
174
|
+
running: "In progress",
|
|
175
|
+
done: "Done",
|
|
176
|
+
failed: "Failed",
|
|
177
|
+
skipped: "Skipped",
|
|
178
|
+
stopped: "Stopped",
|
|
179
|
+
notRun: "Not run"
|
|
180
|
+
},
|
|
181
|
+
tryingAgain: (attempt) => `Trying again (attempt ${attempt})`,
|
|
182
|
+
tryingAgainItems: (count, item) => `Trying again for ${itemCount(count, item)}`,
|
|
183
|
+
havingTrouble: (until) => until === null ? "Having trouble here. Still trying." : `Having trouble here. Still trying; the run fails if this lasts past ${until}.`,
|
|
184
|
+
havingTroubleItems: (count, item, until) => until === null ? `Having trouble with ${itemCount(count, item)}. Still trying.` : `Having trouble with ${itemCount(count, item)}. Still trying; the run fails if this lasts past ${until}.`,
|
|
185
|
+
unreachable: "Progress may be out of date: the run can't be reached right now.",
|
|
186
|
+
runTryingAgain: (attempt) => `The run is trying again (attempt ${attempt}).`,
|
|
187
|
+
runStuck: (until) => until === null ? "The run is having trouble. Still trying." : `The run is having trouble. Still trying; it fails if this lasts past ${until}.`,
|
|
188
|
+
details: "Details",
|
|
189
|
+
announceDone: (title) => `Done: ${title}.`,
|
|
190
|
+
announceFailed: (title) => `Failed: ${title}.`,
|
|
191
|
+
announceNow: (title) => `Now: ${title}.`,
|
|
192
|
+
announceEnd: (headline) => `${headline}.`,
|
|
193
|
+
expand: (title) => `Show the steps of ${title}`,
|
|
194
|
+
collapse: (title) => `Hide the steps of ${title}`,
|
|
195
|
+
duration: (ms) => ms < 1e3 ? "<1s" : formatDuration(ms),
|
|
196
|
+
elapsed: (ms) => ms < 1e3 ? "<1s" : formatDuration(Math.floor(ms / 1e3) * 1e3),
|
|
197
|
+
clockTime: (ms) => new Intl.DateTimeFormat(void 0, {
|
|
198
|
+
hour: "2-digit",
|
|
199
|
+
minute: "2-digit"
|
|
200
|
+
}).format(ms)
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
// src/timeline/react/styles/simple/SimpleProgressView.tsx
|
|
204
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
205
|
+
function StateMark({ state }) {
|
|
206
|
+
let shape = null;
|
|
207
|
+
switch (state) {
|
|
208
|
+
case SIMPLE_LINE_STATE.DONE:
|
|
209
|
+
shape = /* @__PURE__ */ jsx("path", { d: "M3.5 6.2 5.3 8l3.4-3.8", fill: "none", strokeWidth: "1.6" });
|
|
210
|
+
break;
|
|
211
|
+
case SIMPLE_LINE_STATE.FAILED:
|
|
212
|
+
shape = /* @__PURE__ */ jsx("path", { d: "M4 4l4 4M8 4l-4 4", fill: "none", strokeWidth: "1.6" });
|
|
213
|
+
break;
|
|
214
|
+
case SIMPLE_LINE_STATE.SKIPPED:
|
|
215
|
+
shape = /* @__PURE__ */ jsx("path", { d: "M3.8 6h4.4", fill: "none", strokeWidth: "1.4" });
|
|
216
|
+
break;
|
|
217
|
+
case SIMPLE_LINE_STATE.STOPPED:
|
|
218
|
+
shape = /* @__PURE__ */ jsx("rect", { x: "4", y: "4", width: "4", height: "4", rx: "0.5" });
|
|
219
|
+
break;
|
|
220
|
+
case SIMPLE_LINE_STATE.NOT_RUN:
|
|
221
|
+
shape = /* @__PURE__ */ jsx("path", { d: "M3.8 6h4.4", fill: "none", strokeWidth: "1.2" });
|
|
222
|
+
break;
|
|
223
|
+
default:
|
|
224
|
+
shape = null;
|
|
225
|
+
}
|
|
226
|
+
return /* @__PURE__ */ jsxs(
|
|
227
|
+
"svg",
|
|
228
|
+
{
|
|
229
|
+
className: `mthds-simple-progress-mark mthds-simple-progress-mark--${state}`,
|
|
230
|
+
viewBox: "0 0 12 12",
|
|
231
|
+
"aria-hidden": "true",
|
|
232
|
+
focusable: "false",
|
|
233
|
+
children: [
|
|
234
|
+
/* @__PURE__ */ jsx("circle", { className: "mthds-simple-progress-mark-ring", cx: "6", cy: "6", r: "5.2" }),
|
|
235
|
+
state === SIMPLE_LINE_STATE.RUNNING && /* @__PURE__ */ jsx("path", { className: "mthds-simple-progress-mark-arc", d: "M6 0.8a5.2 5.2 0 0 1 5.2 5.2" }),
|
|
236
|
+
shape
|
|
237
|
+
]
|
|
238
|
+
}
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
function Details({ label, children }) {
|
|
242
|
+
return /* @__PURE__ */ jsxs("details", { className: "mthds-simple-progress-details", children: [
|
|
243
|
+
/* @__PURE__ */ jsx("summary", { children: label }),
|
|
244
|
+
/* @__PURE__ */ jsx("div", { className: "mthds-simple-progress-details-body", children })
|
|
245
|
+
] });
|
|
246
|
+
}
|
|
247
|
+
function ProblemDetails({
|
|
248
|
+
problem,
|
|
249
|
+
strings
|
|
250
|
+
}) {
|
|
251
|
+
var _a;
|
|
252
|
+
const nextStep = (_a = problem.next_step) == null ? void 0 : _a.detail;
|
|
253
|
+
return /* @__PURE__ */ jsxs(Details, { label: strings.details, children: [
|
|
254
|
+
/* @__PURE__ */ jsx("p", { children: problem.detail }),
|
|
255
|
+
nextStep && /* @__PURE__ */ jsx("p", { children: nextStep })
|
|
256
|
+
] });
|
|
257
|
+
}
|
|
258
|
+
function untilOf(degradation, strings) {
|
|
259
|
+
const ms = timestampMs(degradation.ends_at);
|
|
260
|
+
return ms === null ? null : strings.clockTime(ms);
|
|
261
|
+
}
|
|
262
|
+
function Note({ tone, children }) {
|
|
263
|
+
return /* @__PURE__ */ jsx("div", { className: `mthds-simple-progress-note mthds-simple-progress-note--${tone}`, children });
|
|
264
|
+
}
|
|
265
|
+
function HealthNotes({
|
|
266
|
+
line,
|
|
267
|
+
item,
|
|
268
|
+
strings
|
|
269
|
+
}) {
|
|
270
|
+
const health = line.health;
|
|
271
|
+
if (!health) return null;
|
|
272
|
+
const notes = [];
|
|
273
|
+
if (health.problem) {
|
|
274
|
+
notes.push(
|
|
275
|
+
/* @__PURE__ */ jsxs(Note, { tone: "error", children: [
|
|
276
|
+
/* @__PURE__ */ jsx("p", { children: health.problem.title }),
|
|
277
|
+
/* @__PURE__ */ jsx(ProblemDetails, { problem: health.problem, strings })
|
|
278
|
+
] }, "problem")
|
|
279
|
+
);
|
|
280
|
+
}
|
|
281
|
+
if (health.retryingItems > 0) {
|
|
282
|
+
notes.push(
|
|
283
|
+
/* @__PURE__ */ jsx(Note, { tone: "warning", children: /* @__PURE__ */ jsx("p", { children: strings.tryingAgainItems(health.retryingItems, item) }) }, "retrying")
|
|
284
|
+
);
|
|
285
|
+
} else if (health.retryAttempt !== null) {
|
|
286
|
+
notes.push(
|
|
287
|
+
/* @__PURE__ */ jsx(Note, { tone: "warning", children: /* @__PURE__ */ jsx("p", { children: strings.tryingAgain(health.retryAttempt) }) }, "retrying")
|
|
288
|
+
);
|
|
289
|
+
}
|
|
290
|
+
if (health.degradation) {
|
|
291
|
+
const until = untilOf(health.degradation, strings);
|
|
292
|
+
notes.push(
|
|
293
|
+
/* @__PURE__ */ jsxs(Note, { tone: "warning", children: [
|
|
294
|
+
/* @__PURE__ */ jsx("p", { children: health.stuckItems > 0 ? strings.havingTroubleItems(health.stuckItems, item, until) : strings.havingTrouble(until) }),
|
|
295
|
+
/* @__PURE__ */ jsx(Details, { label: strings.details, children: /* @__PURE__ */ jsx("p", { children: health.degradation.message }) })
|
|
296
|
+
] }, "stuck")
|
|
297
|
+
);
|
|
298
|
+
}
|
|
299
|
+
return notes.length > 0 ? /* @__PURE__ */ jsx("div", { className: "mthds-simple-progress-notes", children: notes }) : null;
|
|
300
|
+
}
|
|
301
|
+
function BatchCounts({
|
|
302
|
+
line,
|
|
303
|
+
strings
|
|
304
|
+
}) {
|
|
305
|
+
const counts = line.counts;
|
|
306
|
+
if (!counts || counts.total <= 0) return null;
|
|
307
|
+
const share = (count) => `${Math.min(count, counts.total) / counts.total * 100}%`;
|
|
308
|
+
const skipped = Math.min(line.skippedItems, counts.done);
|
|
309
|
+
const finished = counts.done - skipped;
|
|
310
|
+
const text = strings.batchCounts(finished, counts.total, counts.running, counts.failed, skipped);
|
|
311
|
+
const segments = [
|
|
312
|
+
["done", finished],
|
|
313
|
+
["skipped", skipped],
|
|
314
|
+
["failed", counts.failed],
|
|
315
|
+
["running", counts.running]
|
|
316
|
+
];
|
|
317
|
+
return /* @__PURE__ */ jsxs("div", { className: "mthds-simple-progress-batch", children: [
|
|
318
|
+
/* @__PURE__ */ jsx(
|
|
319
|
+
"div",
|
|
320
|
+
{
|
|
321
|
+
className: "mthds-simple-progress-bar",
|
|
322
|
+
role: "progressbar",
|
|
323
|
+
"aria-valuemin": 0,
|
|
324
|
+
"aria-valuemax": counts.total,
|
|
325
|
+
"aria-valuenow": finished,
|
|
326
|
+
"aria-valuetext": text,
|
|
327
|
+
children: segments.map(
|
|
328
|
+
([name, count]) => count > 0 ? /* @__PURE__ */ jsx(
|
|
329
|
+
"span",
|
|
330
|
+
{
|
|
331
|
+
className: `mthds-simple-progress-bar-${name}`,
|
|
332
|
+
style: { width: share(count) }
|
|
333
|
+
},
|
|
334
|
+
name
|
|
335
|
+
) : null
|
|
336
|
+
)
|
|
337
|
+
}
|
|
338
|
+
),
|
|
339
|
+
/* @__PURE__ */ jsx("span", { className: "mthds-simple-progress-counts", "aria-hidden": "true", children: text })
|
|
340
|
+
] });
|
|
341
|
+
}
|
|
342
|
+
var TALLY_ORDER = [
|
|
343
|
+
SIMPLE_LINE_STATE.DONE,
|
|
344
|
+
SIMPLE_LINE_STATE.RUNNING,
|
|
345
|
+
SIMPLE_LINE_STATE.FAILED,
|
|
346
|
+
SIMPLE_LINE_STATE.SKIPPED,
|
|
347
|
+
SIMPLE_LINE_STATE.STOPPED
|
|
348
|
+
];
|
|
349
|
+
function Tally({ line, strings }) {
|
|
350
|
+
const tally = line.tally;
|
|
351
|
+
if (!tally) return null;
|
|
352
|
+
return /* @__PURE__ */ jsxs("span", { className: "mthds-simple-progress-tally", children: [
|
|
353
|
+
TALLY_ORDER.filter((state) => tally[state] > 0).map((state) => /* @__PURE__ */ jsxs("span", { className: "mthds-simple-progress-tally-entry", "aria-hidden": "true", children: [
|
|
354
|
+
/* @__PURE__ */ jsx(StateMark, { state }),
|
|
355
|
+
tally[state]
|
|
356
|
+
] }, state)),
|
|
357
|
+
/* @__PURE__ */ jsx("span", { className: "mthds-run-timeline-sr", children: `, ${strings.tally(tally)}` })
|
|
358
|
+
] });
|
|
359
|
+
}
|
|
360
|
+
function timeText(line, nowMs, strings) {
|
|
361
|
+
if (line.state === SIMPLE_LINE_STATE.SKIPPED || line.state === SIMPLE_LINE_STATE.STOPPED || line.state === SIMPLE_LINE_STATE.NOT_RUN) {
|
|
362
|
+
return strings.state[line.state];
|
|
363
|
+
}
|
|
364
|
+
const invocation = line.invocation;
|
|
365
|
+
if (!invocation || line.kind === SIMPLE_LINE_KIND.NOW) return null;
|
|
366
|
+
const times = invocationTimes(invocation);
|
|
367
|
+
if (times.startedMs === null) return null;
|
|
368
|
+
if (times.endedMs !== null) return strings.duration(times.endedMs - times.startedMs);
|
|
369
|
+
if (line.state === SIMPLE_LINE_STATE.RUNNING && nowMs !== null) {
|
|
370
|
+
return strings.elapsed(nowMs - times.startedMs);
|
|
371
|
+
}
|
|
372
|
+
return null;
|
|
373
|
+
}
|
|
374
|
+
function followsClock(line) {
|
|
375
|
+
return line.state === SIMPLE_LINE_STATE.RUNNING || line.children.some(followsClock);
|
|
376
|
+
}
|
|
377
|
+
function itemOfChild(parent, child) {
|
|
378
|
+
if (child.kind === SIMPLE_LINE_KIND.FOR_EACH) return child.forEachItem;
|
|
379
|
+
return parent.kind === SIMPLE_LINE_KIND.FOR_EACH ? parent.forEachItem : null;
|
|
380
|
+
}
|
|
381
|
+
var LineView = React3.memo(function LineView2({
|
|
382
|
+
line,
|
|
383
|
+
item,
|
|
384
|
+
nowMs,
|
|
385
|
+
onToggle,
|
|
386
|
+
strings
|
|
387
|
+
}) {
|
|
388
|
+
var _a;
|
|
389
|
+
const time = timeText(line, line.state === SIMPLE_LINE_STATE.RUNNING ? nowMs : null, strings);
|
|
390
|
+
const classes = [
|
|
391
|
+
"mthds-simple-progress-line",
|
|
392
|
+
`mthds-simple-progress-line--${line.state}`,
|
|
393
|
+
`mthds-simple-progress-line--${line.kind}`
|
|
394
|
+
].join(" ");
|
|
395
|
+
const title = line.kind === SIMPLE_LINE_KIND.FINISHED ? strings.finishedBranches((_a = line.foldedCount) != null ? _a : 0) : line.title;
|
|
396
|
+
return /* @__PURE__ */ jsxs("li", { className: classes, "data-key": line.key, "data-state": line.state, children: [
|
|
397
|
+
/* @__PURE__ */ jsxs("div", { className: "mthds-simple-progress-row", children: [
|
|
398
|
+
/* @__PURE__ */ jsx(StateMark, { state: line.state }),
|
|
399
|
+
/* @__PURE__ */ jsxs("span", { className: "mthds-simple-progress-title", children: [
|
|
400
|
+
line.kind === SIMPLE_LINE_KIND.NOW && /* @__PURE__ */ jsxs("span", { className: "mthds-simple-progress-now", children: [
|
|
401
|
+
strings.now,
|
|
402
|
+
" "
|
|
403
|
+
] }),
|
|
404
|
+
/* @__PURE__ */ jsx("span", { className: "mthds-simple-progress-name", children: title }),
|
|
405
|
+
line.kind === SIMPLE_LINE_KIND.FOR_EACH && /* @__PURE__ */ jsx("span", { className: "mthds-simple-progress-tag", children: ` \xB7 ${strings.forEach(line.forEachItem)}` }),
|
|
406
|
+
line.kind === SIMPLE_LINE_KIND.TOGETHER && /* @__PURE__ */ jsx("span", { className: "mthds-simple-progress-tag", children: ` \xB7 ${strings.together}` }),
|
|
407
|
+
line.outcome && /* @__PURE__ */ jsx("span", { className: "mthds-simple-progress-outcome", children: line.outcome.resolved ? strings.outcomeTaken(line.outcome.key) : strings.branchFor(line.outcome.key) }),
|
|
408
|
+
/* @__PURE__ */ jsx("span", { className: "mthds-run-timeline-sr", children: `, ${strings.state[line.state]}` })
|
|
409
|
+
] }),
|
|
410
|
+
/* @__PURE__ */ jsx(Tally, { line, strings }),
|
|
411
|
+
time !== null && /* @__PURE__ */ jsx("span", { className: "mthds-simple-progress-time", children: time }),
|
|
412
|
+
line.expandable ? /* @__PURE__ */ jsx(
|
|
413
|
+
"button",
|
|
414
|
+
{
|
|
415
|
+
type: "button",
|
|
416
|
+
className: "mthds-run-timeline-toggle mthds-simple-progress-toggle",
|
|
417
|
+
"aria-expanded": line.expanded,
|
|
418
|
+
"aria-label": line.expanded ? strings.collapse(title) : strings.expand(title),
|
|
419
|
+
onClick: () => onToggle(line.key, !line.expanded),
|
|
420
|
+
children: /* @__PURE__ */ jsx(
|
|
421
|
+
"svg",
|
|
422
|
+
{
|
|
423
|
+
className: "mthds-simple-progress-chevron",
|
|
424
|
+
viewBox: "0 0 12 12",
|
|
425
|
+
width: "12",
|
|
426
|
+
height: "12",
|
|
427
|
+
"aria-hidden": "true",
|
|
428
|
+
children: /* @__PURE__ */ jsx("path", { d: "M4.5 2.5 8 6l-3.5 3.5" })
|
|
429
|
+
}
|
|
430
|
+
)
|
|
431
|
+
}
|
|
432
|
+
) : /* @__PURE__ */ jsx("span", { className: "mthds-simple-progress-toggle-spacer", "aria-hidden": "true" })
|
|
433
|
+
] }),
|
|
434
|
+
/* @__PURE__ */ jsx(BatchCounts, { line, strings }),
|
|
435
|
+
/* @__PURE__ */ jsx(HealthNotes, { line, item, strings }),
|
|
436
|
+
line.expanded && line.children.length > 0 && /* @__PURE__ */ jsx("ol", { className: "mthds-simple-progress-lines mthds-simple-progress-lines--nested", children: line.children.map((child) => /* @__PURE__ */ jsx(
|
|
437
|
+
LineView2,
|
|
438
|
+
{
|
|
439
|
+
line: child,
|
|
440
|
+
item: itemOfChild(line, child),
|
|
441
|
+
nowMs: followsClock(child) ? nowMs : null,
|
|
442
|
+
onToggle,
|
|
443
|
+
strings
|
|
444
|
+
},
|
|
445
|
+
child.key
|
|
446
|
+
)) })
|
|
447
|
+
] });
|
|
448
|
+
});
|
|
449
|
+
function runElapsedMs(progress, times, nowMs) {
|
|
450
|
+
const recorded = times.recorded;
|
|
451
|
+
if (!recorded) return null;
|
|
452
|
+
if (progress.status === RUN_PROGRESS_STATUS.RUNNING && nowMs !== null) {
|
|
453
|
+
return Math.max(0, Math.max(nowMs, recorded.endMs) - recorded.startMs);
|
|
454
|
+
}
|
|
455
|
+
return recorded.endMs - recorded.startMs;
|
|
456
|
+
}
|
|
457
|
+
function findLine(lines, key) {
|
|
458
|
+
for (const line of lines) {
|
|
459
|
+
if (line.key === key) return line;
|
|
460
|
+
}
|
|
461
|
+
return null;
|
|
462
|
+
}
|
|
463
|
+
function headlineOf(progress, elapsedMs, strings) {
|
|
464
|
+
var _a, _b, _c, _d;
|
|
465
|
+
let elapsed = null;
|
|
466
|
+
if (elapsedMs !== null) {
|
|
467
|
+
elapsed = progress.status === RUN_PROGRESS_STATUS.RUNNING ? strings.elapsed(elapsedMs) : strings.duration(elapsedMs);
|
|
468
|
+
}
|
|
469
|
+
const nothing = progress.lines.length === 0;
|
|
470
|
+
switch (progress.status) {
|
|
471
|
+
case RUN_PROGRESS_STATUS.PENDING:
|
|
472
|
+
return strings.waiting;
|
|
473
|
+
case RUN_PROGRESS_STATUS.SUCCEEDED:
|
|
474
|
+
return strings.done(elapsed);
|
|
475
|
+
case RUN_PROGRESS_STATUS.FAILED: {
|
|
476
|
+
if (nothing && elapsedMs === null) return strings.nothingRecorded;
|
|
477
|
+
const key = (_b = (_a = progress.failure) == null ? void 0 : _a.lineKey) != null ? _b : null;
|
|
478
|
+
const where = key === null ? null : (_d = (_c = findLine(progress.lines, key)) == null ? void 0 : _c.title) != null ? _d : null;
|
|
479
|
+
return strings.failed(where, elapsed);
|
|
480
|
+
}
|
|
481
|
+
case RUN_PROGRESS_STATUS.CANCELED:
|
|
482
|
+
if (nothing && elapsedMs === null) return strings.nothingRecorded;
|
|
483
|
+
return strings.canceled(elapsed);
|
|
484
|
+
case RUN_PROGRESS_STATUS.RUNNING:
|
|
485
|
+
return strings.working(elapsed);
|
|
486
|
+
default: {
|
|
487
|
+
const status = progress.status;
|
|
488
|
+
return elapsed === null ? status : `${status} \xB7 ${elapsed}`;
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
function RunNoteView({ note, strings }) {
|
|
493
|
+
const degradation = note.degradation;
|
|
494
|
+
if (note.reason === SIMPLE_RUN_NOTE_REASON.UNREACHABLE) {
|
|
495
|
+
return /* @__PURE__ */ jsx(Note, { tone: "warning", children: /* @__PURE__ */ jsx("p", { role: "status", children: strings.unreachable }) });
|
|
496
|
+
}
|
|
497
|
+
if (note.reason === SIMPLE_RUN_NOTE_REASON.STUCK) {
|
|
498
|
+
return /* @__PURE__ */ jsxs(Note, { tone: "warning", children: [
|
|
499
|
+
/* @__PURE__ */ jsx("p", { role: "status", children: strings.runStuck(untilOf(degradation, strings)) }),
|
|
500
|
+
/* @__PURE__ */ jsx(Details, { label: strings.details, children: /* @__PURE__ */ jsx("p", { children: degradation.message }) })
|
|
501
|
+
] });
|
|
502
|
+
}
|
|
503
|
+
return /* @__PURE__ */ jsx(Note, { tone: "warning", children: /* @__PURE__ */ jsx("p", { role: "status", children: degradation.message }) });
|
|
504
|
+
}
|
|
505
|
+
function useAnnouncement(progress, stream, headline, strings) {
|
|
506
|
+
const [state, setState] = React3.useState({ stream, progress, message: "" });
|
|
507
|
+
if (state.progress === progress) return state.message;
|
|
508
|
+
let message = "";
|
|
509
|
+
if (state.stream === stream) {
|
|
510
|
+
const change = simpleProgressChanges(state.progress, progress);
|
|
511
|
+
const parts = [
|
|
512
|
+
...change.done.map(strings.announceDone),
|
|
513
|
+
...change.failed.map(strings.announceFailed),
|
|
514
|
+
...change.runEnded ? [strings.announceEnd(headline)] : change.started.map(strings.announceNow)
|
|
515
|
+
];
|
|
516
|
+
message = parts.length > 0 ? parts.join(" ") : state.message;
|
|
517
|
+
}
|
|
518
|
+
setState({ stream, progress, message });
|
|
519
|
+
return message;
|
|
520
|
+
}
|
|
521
|
+
function SimpleProgressView({
|
|
522
|
+
held,
|
|
523
|
+
stream,
|
|
524
|
+
times,
|
|
525
|
+
nowMs,
|
|
526
|
+
ticking,
|
|
527
|
+
expanded,
|
|
528
|
+
onToggle: toggle,
|
|
529
|
+
pipeRegistry,
|
|
530
|
+
entryPipeRef,
|
|
531
|
+
wideParallelThreshold,
|
|
532
|
+
containerClassName,
|
|
533
|
+
containerStyle,
|
|
534
|
+
headerEnd,
|
|
535
|
+
strings = DEFAULT_SIMPLE_PROGRESS_STRINGS
|
|
536
|
+
}) {
|
|
537
|
+
const progress = React3.useMemo(
|
|
538
|
+
() => buildSimpleProgress(held, {
|
|
539
|
+
pipeRegistry,
|
|
540
|
+
entryPipeRef,
|
|
541
|
+
expanded,
|
|
542
|
+
wideParallelThreshold
|
|
543
|
+
}),
|
|
544
|
+
[held, pipeRegistry, entryPipeRef, expanded, wideParallelThreshold]
|
|
545
|
+
);
|
|
546
|
+
const headline = headlineOf(progress, runElapsedMs(progress, times, nowMs), strings);
|
|
547
|
+
const failure = progress.failure;
|
|
548
|
+
const announcement = useAnnouncement(progress, stream, headline, strings);
|
|
549
|
+
const classes = [
|
|
550
|
+
containerClassName,
|
|
551
|
+
"mthds-simple-progress",
|
|
552
|
+
ticking && "mthds-run-timeline--self-clocked"
|
|
553
|
+
].filter(Boolean).join(" ");
|
|
554
|
+
return /* @__PURE__ */ jsxs(
|
|
555
|
+
"section",
|
|
556
|
+
{
|
|
557
|
+
className: classes,
|
|
558
|
+
style: containerStyle,
|
|
559
|
+
"aria-label": "Run progress",
|
|
560
|
+
"data-run-status": held.status,
|
|
561
|
+
"data-version": held.version,
|
|
562
|
+
children: [
|
|
563
|
+
/* @__PURE__ */ jsxs("header", { className: "mthds-run-timeline-header", children: [
|
|
564
|
+
/* @__PURE__ */ jsx(
|
|
565
|
+
"p",
|
|
566
|
+
{
|
|
567
|
+
className: `mthds-simple-progress-headline mthds-simple-progress-headline--${held.status}`,
|
|
568
|
+
"data-testid": "run-timeline-status",
|
|
569
|
+
children: headline
|
|
570
|
+
}
|
|
571
|
+
),
|
|
572
|
+
held.mode === PROGRESS_MODE.DRY && /* @__PURE__ */ jsx("span", { className: "mthds-run-timeline-mode", children: strings.dryRun }),
|
|
573
|
+
headerEnd
|
|
574
|
+
] }),
|
|
575
|
+
/* @__PURE__ */ jsx("p", { className: "mthds-run-timeline-sr", "aria-live": "polite", children: announcement }),
|
|
576
|
+
progress.retryAttempt !== null && /* @__PURE__ */ jsx(Note, { tone: "warning", children: /* @__PURE__ */ jsx("p", { children: strings.runTryingAgain(progress.retryAttempt) }) }),
|
|
577
|
+
progress.runNote && /* @__PURE__ */ jsx(RunNoteView, { note: progress.runNote, strings }),
|
|
578
|
+
(failure == null ? void 0 : failure.problem) && !failure.shownOnLine && /* @__PURE__ */ jsxs(Note, { tone: "error", children: [
|
|
579
|
+
/* @__PURE__ */ jsx("p", { children: failure.problem.title }),
|
|
580
|
+
/* @__PURE__ */ jsx(ProblemDetails, { problem: failure.problem, strings })
|
|
581
|
+
] }),
|
|
582
|
+
progress.lines.length > 0 && /* @__PURE__ */ jsx("ol", { className: "mthds-simple-progress-lines", "aria-label": strings.checklistLabel, children: progress.lines.map((line) => /* @__PURE__ */ jsx(
|
|
583
|
+
LineView,
|
|
584
|
+
{
|
|
585
|
+
line,
|
|
586
|
+
item: line.forEachItem,
|
|
587
|
+
nowMs: followsClock(line) ? nowMs : null,
|
|
588
|
+
onToggle: toggle,
|
|
589
|
+
strings
|
|
590
|
+
},
|
|
591
|
+
line.key
|
|
592
|
+
)) })
|
|
593
|
+
]
|
|
594
|
+
}
|
|
595
|
+
);
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
// src/timeline/react/TimelineStyleMenu.tsx
|
|
599
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
600
|
+
var ICON_PROPS = {
|
|
601
|
+
viewBox: "0 0 24 24",
|
|
602
|
+
width: 14,
|
|
603
|
+
height: 14,
|
|
604
|
+
fill: "none",
|
|
605
|
+
stroke: "currentColor",
|
|
606
|
+
strokeWidth: 2,
|
|
607
|
+
strokeLinecap: "round",
|
|
608
|
+
strokeLinejoin: "round"
|
|
609
|
+
};
|
|
610
|
+
var TIMELINE_STYLE_MENU_ENTRIES = {
|
|
611
|
+
// Bars of different lengths on a shared axis.
|
|
612
|
+
[TIMELINE_STYLE.DETAILED]: __spreadProps(__spreadValues({}, TIMELINE_STYLES[TIMELINE_STYLE.DETAILED]), {
|
|
613
|
+
icon: /* @__PURE__ */ jsxs2("svg", __spreadProps(__spreadValues({}, ICON_PROPS), { children: [
|
|
614
|
+
/* @__PURE__ */ jsx2("line", { x1: "3", y1: "3", x2: "3", y2: "21" }),
|
|
615
|
+
/* @__PURE__ */ jsx2("line", { x1: "7", y1: "6", x2: "15", y2: "6" }),
|
|
616
|
+
/* @__PURE__ */ jsx2("line", { x1: "10", y1: "12", x2: "20", y2: "12" }),
|
|
617
|
+
/* @__PURE__ */ jsx2("line", { x1: "7", y1: "18", x2: "13", y2: "18" })
|
|
618
|
+
] }))
|
|
619
|
+
}),
|
|
620
|
+
// A checklist: a check, then lines of words.
|
|
621
|
+
[TIMELINE_STYLE.SIMPLE]: __spreadProps(__spreadValues({}, TIMELINE_STYLES[TIMELINE_STYLE.SIMPLE]), {
|
|
622
|
+
icon: /* @__PURE__ */ jsxs2("svg", __spreadProps(__spreadValues({}, ICON_PROPS), { children: [
|
|
623
|
+
/* @__PURE__ */ jsx2("polyline", { points: "3 6 5 8 8 4" }),
|
|
624
|
+
/* @__PURE__ */ jsx2("line", { x1: "12", y1: "6", x2: "21", y2: "6" }),
|
|
625
|
+
/* @__PURE__ */ jsx2("circle", { cx: "5.5", cy: "12", r: "2" }),
|
|
626
|
+
/* @__PURE__ */ jsx2("line", { x1: "12", y1: "12", x2: "21", y2: "12" }),
|
|
627
|
+
/* @__PURE__ */ jsx2("circle", { cx: "5.5", cy: "18", r: "2" }),
|
|
628
|
+
/* @__PURE__ */ jsx2("line", { x1: "12", y1: "18", x2: "21", y2: "18" })
|
|
629
|
+
] }))
|
|
630
|
+
})
|
|
631
|
+
};
|
|
632
|
+
function timelineStyleMenuLabel(style) {
|
|
633
|
+
return `Timeline style: ${TIMELINE_STYLES[style].name} \u2014 choose how the run is drawn`;
|
|
634
|
+
}
|
|
635
|
+
function TimelineStyleMenu({ value, options, onChange, slotRef }) {
|
|
636
|
+
return /* @__PURE__ */ jsx2("div", { className: "mthds-run-timeline-header-end", ref: slotRef, children: /* @__PURE__ */ jsx2(
|
|
637
|
+
StyleMenu,
|
|
638
|
+
{
|
|
639
|
+
value,
|
|
640
|
+
options,
|
|
641
|
+
onChange,
|
|
642
|
+
placement: "down-end",
|
|
643
|
+
entries: TIMELINE_STYLE_MENU_ENTRIES,
|
|
644
|
+
menuLabel: "Timeline style",
|
|
645
|
+
buttonLabel: timelineStyleMenuLabel,
|
|
646
|
+
buttonClassName: "mthds-run-timeline-style-btn"
|
|
647
|
+
}
|
|
648
|
+
) });
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
// src/timeline/react/RunTimeline.tsx
|
|
652
|
+
import { Fragment, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
653
|
+
var CLOCK_TICK_MS = {
|
|
654
|
+
[TIMELINE_STYLE.DETAILED]: 250,
|
|
655
|
+
[TIMELINE_STYLE.SIMPLE]: 1e3
|
|
656
|
+
};
|
|
657
|
+
var TICK_RIGHT_ALIGN_PERCENT = 92;
|
|
658
|
+
var TICK_SPACING_PX = 64;
|
|
659
|
+
var DEFAULT_MAX_TICKS = 6;
|
|
660
|
+
function useTickBudget() {
|
|
661
|
+
const [budget, setBudget] = React4.useState(DEFAULT_MAX_TICKS);
|
|
662
|
+
const observer = React4.useRef(null);
|
|
663
|
+
const ref = React4.useCallback((element) => {
|
|
664
|
+
var _a;
|
|
665
|
+
(_a = observer.current) == null ? void 0 : _a.disconnect();
|
|
666
|
+
observer.current = null;
|
|
667
|
+
if (!element || typeof ResizeObserver === "undefined") return;
|
|
668
|
+
observer.current = new ResizeObserver((entries) => {
|
|
669
|
+
var _a2, _b;
|
|
670
|
+
const width = (_b = (_a2 = entries[0]) == null ? void 0 : _a2.contentRect.width) != null ? _b : 0;
|
|
671
|
+
if (width > 0) setBudget(Math.max(1, Math.floor(width / TICK_SPACING_PX)));
|
|
672
|
+
});
|
|
673
|
+
observer.current.observe(element);
|
|
674
|
+
}, []);
|
|
675
|
+
return [ref, budget];
|
|
676
|
+
}
|
|
677
|
+
var RUN_STATUS_WORD = {
|
|
678
|
+
pending: "Pending",
|
|
679
|
+
running: "Running",
|
|
680
|
+
succeeded: "Succeeded",
|
|
681
|
+
failed: "Failed",
|
|
682
|
+
canceled: "Canceled"
|
|
683
|
+
};
|
|
684
|
+
function wordFor(table, value) {
|
|
685
|
+
return Object.prototype.hasOwnProperty.call(table, value) ? table[value] : value;
|
|
686
|
+
}
|
|
106
687
|
function batchCountsText(batch) {
|
|
107
688
|
const counts = batch.counts;
|
|
108
689
|
if (!counts) return null;
|
|
@@ -150,16 +731,16 @@ function rowTitle(row, times, bar) {
|
|
|
150
731
|
if (isRetried(invocation)) lines.push(`Tried ${invocation.attempts} times`);
|
|
151
732
|
if (invocation.last_failure) {
|
|
152
733
|
const at = times.failedMs;
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
);
|
|
734
|
+
const { title, detail } = invocation.last_failure.problem;
|
|
735
|
+
lines.push(`Last failure${at === null ? "" : ` at ${formatClockTime(at)}`}: ${title}`);
|
|
736
|
+
lines.push(detail);
|
|
156
737
|
}
|
|
157
738
|
if (invocation.degradation) lines.push(`Not progressing: ${invocation.degradation.message}`);
|
|
158
739
|
return lines.join("\n");
|
|
159
740
|
}
|
|
160
741
|
function BatchStrip({ batch }) {
|
|
161
742
|
if (batch.strip.length === 0) return null;
|
|
162
|
-
return /* @__PURE__ */
|
|
743
|
+
return /* @__PURE__ */ jsx3("span", { className: "mthds-run-timeline-strip", "aria-hidden": "true", children: batch.strip.map((cell) => /* @__PURE__ */ jsx3(
|
|
163
744
|
"span",
|
|
164
745
|
{
|
|
165
746
|
className: `mthds-run-timeline-strip-cell mthds-run-timeline-strip-cell--${cell.status}`,
|
|
@@ -179,7 +760,7 @@ function FailureTick({ atMs, startMs, endMs }) {
|
|
|
179
760
|
if (atMs === null || atMs < startMs || atMs > endMs) return null;
|
|
180
761
|
const span = endMs - startMs;
|
|
181
762
|
const percent = span > 0 ? (atMs - startMs) / span * 100 : 0;
|
|
182
|
-
return /* @__PURE__ */
|
|
763
|
+
return /* @__PURE__ */ jsx3(
|
|
183
764
|
"span",
|
|
184
765
|
{
|
|
185
766
|
className: "mthds-run-timeline-failure-tick",
|
|
@@ -188,7 +769,7 @@ function FailureTick({ atMs, startMs, endMs }) {
|
|
|
188
769
|
}
|
|
189
770
|
);
|
|
190
771
|
}
|
|
191
|
-
var TimelineRowView =
|
|
772
|
+
var TimelineRowView = React4.memo(function TimelineRowView2({
|
|
192
773
|
row,
|
|
193
774
|
times,
|
|
194
775
|
axis,
|
|
@@ -221,7 +802,7 @@ var TimelineRowView = React.memo(function TimelineRowView2({
|
|
|
221
802
|
if (batch) {
|
|
222
803
|
toggleLabel = batch.expanded ? `Collapse the ${batch.total} items of ${invocation.pipe_code}` : `Expand the ${batch.total} items of ${invocation.pipe_code}`;
|
|
223
804
|
}
|
|
224
|
-
return /* @__PURE__ */
|
|
805
|
+
return /* @__PURE__ */ jsxs3(
|
|
225
806
|
"li",
|
|
226
807
|
{
|
|
227
808
|
className: rowClasses,
|
|
@@ -229,13 +810,13 @@ var TimelineRowView = React.memo(function TimelineRowView2({
|
|
|
229
810
|
"data-status": status,
|
|
230
811
|
title: rowTitle(row, times, bar),
|
|
231
812
|
children: [
|
|
232
|
-
/* @__PURE__ */
|
|
813
|
+
/* @__PURE__ */ jsxs3(
|
|
233
814
|
"div",
|
|
234
815
|
{
|
|
235
816
|
className: "mthds-run-timeline-name",
|
|
236
817
|
style: { paddingLeft: `calc(${row.depth} * var(--mthds-run-timeline-indent))` },
|
|
237
818
|
children: [
|
|
238
|
-
batch ? /* @__PURE__ */
|
|
819
|
+
batch ? /* @__PURE__ */ jsx3(
|
|
239
820
|
"button",
|
|
240
821
|
{
|
|
241
822
|
type: "button",
|
|
@@ -243,17 +824,17 @@ var TimelineRowView = React.memo(function TimelineRowView2({
|
|
|
243
824
|
"aria-expanded": batch.expanded,
|
|
244
825
|
"aria-label": toggleLabel,
|
|
245
826
|
onClick: () => onToggleBatch(row.path, !batch.expanded),
|
|
246
|
-
children: /* @__PURE__ */
|
|
827
|
+
children: /* @__PURE__ */ jsx3("span", { "aria-hidden": "true", children: batch.expanded ? "\u25BE" : "\u25B8" })
|
|
247
828
|
}
|
|
248
|
-
) : /* @__PURE__ */
|
|
249
|
-
/* @__PURE__ */
|
|
250
|
-
/* @__PURE__ */
|
|
251
|
-
row.placeLabel && /* @__PURE__ */
|
|
252
|
-
/* @__PURE__ */
|
|
829
|
+
) : /* @__PURE__ */ jsx3("span", { className: "mthds-run-timeline-toggle-spacer", "aria-hidden": "true" }),
|
|
830
|
+
/* @__PURE__ */ jsx3("span", { className: "mthds-run-timeline-dot", "aria-hidden": "true" }),
|
|
831
|
+
/* @__PURE__ */ jsx3("span", { className: "mthds-run-timeline-code", children: invocation.pipe_code }),
|
|
832
|
+
row.placeLabel && /* @__PURE__ */ jsx3("span", { className: "mthds-run-timeline-place", children: row.placeLabel }),
|
|
833
|
+
/* @__PURE__ */ jsx3("span", { className: "mthds-run-timeline-sr", children: `, ${status}` })
|
|
253
834
|
]
|
|
254
835
|
}
|
|
255
836
|
),
|
|
256
|
-
/* @__PURE__ */
|
|
837
|
+
/* @__PURE__ */ jsx3("div", { className: "mthds-run-timeline-track", children: bar && axis && /* @__PURE__ */ jsxs3(
|
|
257
838
|
"span",
|
|
258
839
|
{
|
|
259
840
|
className: barClasses,
|
|
@@ -262,24 +843,132 @@ var TimelineRowView = React.memo(function TimelineRowView2({
|
|
|
262
843
|
width: axisShare(drawnEndMs - drawnStartMs)
|
|
263
844
|
},
|
|
264
845
|
children: [
|
|
265
|
-
batch && /* @__PURE__ */
|
|
266
|
-
/* @__PURE__ */
|
|
846
|
+
batch && /* @__PURE__ */ jsx3(BatchStrip, { batch }),
|
|
847
|
+
/* @__PURE__ */ jsx3(FailureTick, { atMs: times.failedMs, startMs: drawnStartMs, endMs: drawnEndMs })
|
|
267
848
|
]
|
|
268
849
|
}
|
|
269
850
|
) }),
|
|
270
|
-
/* @__PURE__ */
|
|
271
|
-
retried && /* @__PURE__ */
|
|
272
|
-
/* @__PURE__ */
|
|
851
|
+
/* @__PURE__ */ jsxs3("div", { className: "mthds-run-timeline-meta", children: [
|
|
852
|
+
retried && /* @__PURE__ */ jsxs3("span", { className: "mthds-run-timeline-badge mthds-run-timeline-badge--retry", children: [
|
|
853
|
+
/* @__PURE__ */ jsx3("span", { "aria-hidden": "true", children: "\u21BB " }),
|
|
273
854
|
retrying ? `attempt ${invocation.attempts}` : `${invocation.attempts} attempts`
|
|
274
855
|
] }),
|
|
275
|
-
invocation.degradation && /* @__PURE__ */
|
|
276
|
-
batch &&
|
|
277
|
-
/* @__PURE__ */
|
|
856
|
+
invocation.degradation && /* @__PURE__ */ jsx3("span", { className: "mthds-run-timeline-badge mthds-run-timeline-badge--stuck", children: "stuck" }),
|
|
857
|
+
batch && batch.hiddenItemCount > 0 && /* @__PURE__ */ jsx3("span", { className: "mthds-run-timeline-sr", children: `, ${batch.hiddenItemCount} items hidden` }),
|
|
858
|
+
/* @__PURE__ */ jsx3("span", { className: "mthds-run-timeline-detail", children: rowDetailText(row, bar) })
|
|
278
859
|
] })
|
|
279
860
|
]
|
|
280
861
|
}
|
|
281
862
|
);
|
|
282
863
|
});
|
|
864
|
+
var PAGER_KEY_PREFIX = "pager:";
|
|
865
|
+
var TROUBLE_WORD = {
|
|
866
|
+
[KEPT_VISIBLE_REASON.FAILED]: "failed",
|
|
867
|
+
[KEPT_VISIBLE_REASON.DEGRADED]: "stuck"
|
|
868
|
+
};
|
|
869
|
+
function troubleNotShownText(batch) {
|
|
870
|
+
return [KEPT_VISIBLE_REASON.FAILED, KEPT_VISIBLE_REASON.DEGRADED].filter((reason) => batch.troubleNotShown[reason] > 0).map((reason) => `${batch.troubleNotShown[reason]} more ${TROUBLE_WORD[reason]}`).join(" \xB7 ");
|
|
871
|
+
}
|
|
872
|
+
var ItemPagerView = React4.memo(function ItemPagerView2({
|
|
873
|
+
pager,
|
|
874
|
+
onToggleBatch,
|
|
875
|
+
onTurnPage
|
|
876
|
+
}) {
|
|
877
|
+
const { batch, batchPath, pipeCode, depth } = pager;
|
|
878
|
+
const navRef = React4.useRef(null);
|
|
879
|
+
const refocusRef = React4.useRef(false);
|
|
880
|
+
React4.useEffect(() => {
|
|
881
|
+
var _a;
|
|
882
|
+
if (!refocusRef.current) return;
|
|
883
|
+
refocusRef.current = false;
|
|
884
|
+
const nav = navRef.current;
|
|
885
|
+
if (nav && !nav.contains(document.activeElement)) (_a = nav.querySelector("button")) == null ? void 0 : _a.focus();
|
|
886
|
+
});
|
|
887
|
+
const turn = (page2, expand) => {
|
|
888
|
+
refocusRef.current = true;
|
|
889
|
+
onTurnPage(batchPath, page2);
|
|
890
|
+
if (expand) onToggleBatch(batchPath, true);
|
|
891
|
+
};
|
|
892
|
+
const page = batch.page;
|
|
893
|
+
const jump = batch.nextTrouble;
|
|
894
|
+
let content;
|
|
895
|
+
if (batch.expanded && page) {
|
|
896
|
+
const atFirst = page.index === 0;
|
|
897
|
+
const atLast = page.index === page.count - 1;
|
|
898
|
+
content = /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
899
|
+
/* @__PURE__ */ jsxs3(
|
|
900
|
+
"button",
|
|
901
|
+
{
|
|
902
|
+
type: "button",
|
|
903
|
+
className: "mthds-run-timeline-pager-btn",
|
|
904
|
+
"aria-disabled": atFirst,
|
|
905
|
+
onClick: () => !atFirst && turn(page.index - 1, false),
|
|
906
|
+
children: [
|
|
907
|
+
/* @__PURE__ */ jsx3("span", { "aria-hidden": "true", children: "\u2039" }),
|
|
908
|
+
"Previous"
|
|
909
|
+
]
|
|
910
|
+
},
|
|
911
|
+
"previous"
|
|
912
|
+
),
|
|
913
|
+
/* @__PURE__ */ jsx3("span", { className: "mthds-run-timeline-pager-range", "aria-live": "polite", children: `Items ${page.firstItem}\u2013${page.lastItem} of ${page.itemCount}` }, "range"),
|
|
914
|
+
/* @__PURE__ */ jsxs3(
|
|
915
|
+
"button",
|
|
916
|
+
{
|
|
917
|
+
type: "button",
|
|
918
|
+
className: "mthds-run-timeline-pager-btn",
|
|
919
|
+
"aria-disabled": atLast,
|
|
920
|
+
onClick: () => !atLast && turn(page.index + 1, false),
|
|
921
|
+
children: [
|
|
922
|
+
"Next",
|
|
923
|
+
/* @__PURE__ */ jsx3("span", { "aria-hidden": "true", children: "\u203A" })
|
|
924
|
+
]
|
|
925
|
+
},
|
|
926
|
+
"next"
|
|
927
|
+
),
|
|
928
|
+
jump && /* @__PURE__ */ jsx3(
|
|
929
|
+
"button",
|
|
930
|
+
{
|
|
931
|
+
type: "button",
|
|
932
|
+
className: `mthds-run-timeline-pager-btn mthds-run-timeline-pager-jump mthds-run-timeline-pager-jump--${jump.reason}`,
|
|
933
|
+
onClick: () => turn(jump.page, false),
|
|
934
|
+
children: `Next ${TROUBLE_WORD[jump.reason]} \xB7 item ${jump.item}`
|
|
935
|
+
},
|
|
936
|
+
"jump"
|
|
937
|
+
)
|
|
938
|
+
] });
|
|
939
|
+
} else {
|
|
940
|
+
content = /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
941
|
+
/* @__PURE__ */ jsx3("span", { className: "mthds-run-timeline-pager-more", children: troubleNotShownText(batch) }, "more"),
|
|
942
|
+
jump && /* @__PURE__ */ jsx3(
|
|
943
|
+
"button",
|
|
944
|
+
{
|
|
945
|
+
type: "button",
|
|
946
|
+
className: `mthds-run-timeline-pager-btn mthds-run-timeline-pager-jump mthds-run-timeline-pager-jump--${jump.reason}`,
|
|
947
|
+
onClick: () => turn(jump.page, true),
|
|
948
|
+
children: `Expand at item ${jump.item}`
|
|
949
|
+
},
|
|
950
|
+
"expand"
|
|
951
|
+
)
|
|
952
|
+
] });
|
|
953
|
+
}
|
|
954
|
+
return /* @__PURE__ */ jsx3(
|
|
955
|
+
"li",
|
|
956
|
+
{
|
|
957
|
+
className: "mthds-run-timeline-pager",
|
|
958
|
+
"data-pager-for": batchPath,
|
|
959
|
+
style: { paddingLeft: `calc(${depth} * var(--mthds-run-timeline-indent))` },
|
|
960
|
+
children: /* @__PURE__ */ jsx3(
|
|
961
|
+
"nav",
|
|
962
|
+
{
|
|
963
|
+
ref: navRef,
|
|
964
|
+
className: "mthds-run-timeline-pager-nav",
|
|
965
|
+
"aria-label": `Items of ${pipeCode}`,
|
|
966
|
+
children: content
|
|
967
|
+
}
|
|
968
|
+
)
|
|
969
|
+
}
|
|
970
|
+
);
|
|
971
|
+
});
|
|
283
972
|
function RunTimeline({
|
|
284
973
|
snapshot,
|
|
285
974
|
theme = GRAPH_THEME_MODE.SYSTEM,
|
|
@@ -287,66 +976,175 @@ function RunTimeline({
|
|
|
287
976
|
paletteColors,
|
|
288
977
|
now,
|
|
289
978
|
live = true,
|
|
979
|
+
timelineStyle,
|
|
980
|
+
onTimelineStyleChange,
|
|
981
|
+
styleMenu,
|
|
982
|
+
pipeRegistry,
|
|
983
|
+
entryPipeRef,
|
|
290
984
|
wideBatchThreshold,
|
|
985
|
+
batchPageSize,
|
|
986
|
+
wideParallelThreshold,
|
|
291
987
|
className
|
|
292
988
|
}) {
|
|
293
989
|
const held = useHeldSnapshot(snapshot);
|
|
294
990
|
const streamKey = progressStreamKey(held);
|
|
295
991
|
const environmentTheme = useSystemTheme(theme === GRAPH_THEME_MODE.SYSTEM ? systemTheme : theme);
|
|
296
992
|
const resolvedTheme = theme === GRAPH_THEME_MODE.SYSTEM ? environmentTheme : theme;
|
|
297
|
-
const paletteStyle =
|
|
993
|
+
const paletteStyle = React4.useMemo(
|
|
298
994
|
() => __spreadValues(__spreadValues({}, getPaletteForTheme(resolvedTheme)), paletteColors),
|
|
299
995
|
[resolvedTheme, paletteColors]
|
|
300
996
|
);
|
|
301
|
-
const
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
997
|
+
const containerClassName = [
|
|
998
|
+
"mthds-run-timeline",
|
|
999
|
+
`mthds-run-timeline--${resolvedTheme}`,
|
|
1000
|
+
className
|
|
1001
|
+
].filter(Boolean).join(" ");
|
|
1002
|
+
const externalStyle = resolveTimelineStyle(timelineStyle);
|
|
1003
|
+
const [styleState, setStyleState] = React4.useState({
|
|
1004
|
+
external: externalStyle,
|
|
1005
|
+
active: externalStyle
|
|
1006
|
+
});
|
|
1007
|
+
if (styleState.external !== externalStyle) {
|
|
1008
|
+
setStyleState({ external: externalStyle, active: externalStyle });
|
|
1009
|
+
}
|
|
1010
|
+
const activeStyle = styleState.external === externalStyle ? styleState.active : externalStyle;
|
|
1011
|
+
const onTimelineStyleChangeRef = React4.useRef(onTimelineStyleChange);
|
|
1012
|
+
onTimelineStyleChangeRef.current = onTimelineStyleChange;
|
|
1013
|
+
const reportedStyleRef = React4.useRef(activeStyle);
|
|
1014
|
+
React4.useEffect(() => {
|
|
1015
|
+
var _a;
|
|
1016
|
+
if (reportedStyleRef.current !== activeStyle) {
|
|
1017
|
+
reportedStyleRef.current = activeStyle;
|
|
1018
|
+
(_a = onTimelineStyleChangeRef.current) == null ? void 0 : _a.call(onTimelineStyleChangeRef, activeStyle);
|
|
1019
|
+
}
|
|
1020
|
+
}, [activeStyle]);
|
|
1021
|
+
const styleMenuOptions = React4.useMemo(() => resolveTimelineStyleMenu(styleMenu), [styleMenu]);
|
|
1022
|
+
const menuSlotRef = React4.useRef(null);
|
|
1023
|
+
const refocusMenuRef = React4.useRef(false);
|
|
1024
|
+
const chooseStyle = React4.useCallback((style) => {
|
|
1025
|
+
refocusMenuRef.current = true;
|
|
1026
|
+
setStyleState((state) => __spreadProps(__spreadValues({}, state), { active: style }));
|
|
1027
|
+
}, []);
|
|
1028
|
+
React4.useEffect(() => {
|
|
1029
|
+
var _a, _b;
|
|
1030
|
+
if (!refocusMenuRef.current) return;
|
|
1031
|
+
refocusMenuRef.current = false;
|
|
1032
|
+
(_b = (_a = menuSlotRef.current) == null ? void 0 : _a.querySelector("button")) == null ? void 0 : _b.focus();
|
|
1033
|
+
}, [styleState]);
|
|
1034
|
+
const headerEnd = styleMenuOptions.length > 0 ? /* @__PURE__ */ jsx3(
|
|
1035
|
+
TimelineStyleMenu,
|
|
1036
|
+
{
|
|
1037
|
+
value: activeStyle,
|
|
1038
|
+
options: styleMenuOptions,
|
|
1039
|
+
onChange: chooseStyle,
|
|
1040
|
+
slotRef: menuSlotRef
|
|
1041
|
+
}
|
|
1042
|
+
) : null;
|
|
1043
|
+
const times = React4.useMemo(() => snapshotTimes(held), [held]);
|
|
1044
|
+
const followsClock2 = React4.useMemo(
|
|
1045
|
+
() => held.invocations.some(
|
|
1046
|
+
(invocation) => barFollowsClock(invocation, times.invocations.get(invocation.path))
|
|
1047
|
+
),
|
|
1048
|
+
[held, times]
|
|
313
1049
|
);
|
|
314
|
-
const
|
|
315
|
-
|
|
316
|
-
|
|
1050
|
+
const clock = useReadingClock(held, streamKey, {
|
|
1051
|
+
now,
|
|
1052
|
+
live,
|
|
1053
|
+
followsClock: followsClock2,
|
|
1054
|
+
tickMs: CLOCK_TICK_MS[activeStyle]
|
|
1055
|
+
});
|
|
1056
|
+
const detailedExpansion = useStreamRecord(streamKey);
|
|
1057
|
+
const detailedPages = useStreamRecord(streamKey);
|
|
1058
|
+
const simpleExpansion = useStreamRecord(streamKey);
|
|
1059
|
+
const views = {
|
|
1060
|
+
[TIMELINE_STYLE.SIMPLE]: () => /* @__PURE__ */ jsx3(
|
|
1061
|
+
SimpleProgressView,
|
|
1062
|
+
{
|
|
1063
|
+
held,
|
|
1064
|
+
stream: streamKey,
|
|
1065
|
+
times,
|
|
1066
|
+
nowMs: clock.nowMs,
|
|
1067
|
+
ticking: clock.ticking,
|
|
1068
|
+
expanded: simpleExpansion.values,
|
|
1069
|
+
onToggle: simpleExpansion.set,
|
|
1070
|
+
pipeRegistry,
|
|
1071
|
+
entryPipeRef,
|
|
1072
|
+
wideParallelThreshold,
|
|
1073
|
+
containerClassName,
|
|
1074
|
+
containerStyle: paletteStyle,
|
|
1075
|
+
headerEnd
|
|
1076
|
+
}
|
|
1077
|
+
),
|
|
1078
|
+
[TIMELINE_STYLE.DETAILED]: () => /* @__PURE__ */ jsx3(
|
|
1079
|
+
DetailedTimeline,
|
|
1080
|
+
{
|
|
1081
|
+
held,
|
|
1082
|
+
times,
|
|
1083
|
+
nowMs: clock.nowMs,
|
|
1084
|
+
ticking: clock.ticking,
|
|
1085
|
+
expandedBatches: detailedExpansion.values,
|
|
1086
|
+
onToggleBatch: detailedExpansion.set,
|
|
1087
|
+
batchPages: detailedPages.values,
|
|
1088
|
+
onTurnPage: detailedPages.set,
|
|
1089
|
+
wideBatchThreshold,
|
|
1090
|
+
batchPageSize,
|
|
1091
|
+
containerClassName,
|
|
1092
|
+
containerStyle: paletteStyle,
|
|
1093
|
+
headerEnd
|
|
1094
|
+
}
|
|
1095
|
+
)
|
|
1096
|
+
};
|
|
1097
|
+
return views[activeStyle]();
|
|
1098
|
+
}
|
|
1099
|
+
function DetailedTimeline({
|
|
1100
|
+
held,
|
|
1101
|
+
times,
|
|
1102
|
+
nowMs,
|
|
1103
|
+
ticking,
|
|
1104
|
+
expandedBatches,
|
|
1105
|
+
onToggleBatch: toggleBatch,
|
|
1106
|
+
batchPages,
|
|
1107
|
+
onTurnPage: turnPage,
|
|
1108
|
+
wideBatchThreshold,
|
|
1109
|
+
batchPageSize,
|
|
1110
|
+
containerClassName,
|
|
1111
|
+
containerStyle,
|
|
1112
|
+
headerEnd
|
|
1113
|
+
}) {
|
|
1114
|
+
const entries = React4.useMemo(
|
|
1115
|
+
() => buildTimelineRows(held, { expandedBatches, wideBatchThreshold, batchPages, batchPageSize }),
|
|
1116
|
+
[held, expandedBatches, wideBatchThreshold, batchPages, batchPageSize]
|
|
317
1117
|
);
|
|
318
|
-
const
|
|
319
|
-
|
|
320
|
-
() => rows.map((row) => {
|
|
1118
|
+
const drawnEntries = React4.useMemo(
|
|
1119
|
+
() => entries.map((entry) => {
|
|
321
1120
|
var _a;
|
|
322
|
-
|
|
323
|
-
|
|
1121
|
+
if (entry.kind === TIMELINE_ENTRY_KIND.PAGER) return entry;
|
|
1122
|
+
const rowTimes = (_a = times.invocations.get(entry.path)) != null ? _a : invocationTimes(entry.invocation);
|
|
1123
|
+
return {
|
|
1124
|
+
kind: entry.kind,
|
|
1125
|
+
row: entry,
|
|
1126
|
+
times: rowTimes,
|
|
1127
|
+
followsClock: barFollowsClock(entry.invocation, rowTimes)
|
|
1128
|
+
};
|
|
324
1129
|
}),
|
|
325
|
-
[
|
|
1130
|
+
[entries, times]
|
|
326
1131
|
);
|
|
327
|
-
const clockFollowed = drawnRows.some((drawn) => drawn.followsClock);
|
|
328
|
-
const { nowMs, ticking } = useReadingClock(held, streamKey, now, live, clockFollowed);
|
|
329
1132
|
const axis = timelineWindowAt(times, nowMs);
|
|
330
1133
|
const [axisTrackRef, tickBudget] = useTickBudget();
|
|
331
1134
|
const ticks = axis ? timelineTicks(axis, tickBudget) : [];
|
|
332
1135
|
const bodyStyle = axis ? { [AXIS_SPAN_VAR]: cssNumber(axis.endMs - axis.startMs) } : void 0;
|
|
333
|
-
const containerClasses = [
|
|
334
|
-
|
|
335
|
-
`mthds-run-timeline--${resolvedTheme}`,
|
|
336
|
-
ticking && "mthds-run-timeline--self-clocked",
|
|
337
|
-
className
|
|
338
|
-
].filter(Boolean).join(" ");
|
|
339
|
-
return /* @__PURE__ */ jsxs(
|
|
1136
|
+
const containerClasses = [containerClassName, ticking && "mthds-run-timeline--self-clocked"].filter(Boolean).join(" ");
|
|
1137
|
+
return /* @__PURE__ */ jsxs3(
|
|
340
1138
|
"section",
|
|
341
1139
|
{
|
|
342
1140
|
className: containerClasses,
|
|
343
|
-
style:
|
|
1141
|
+
style: containerStyle,
|
|
344
1142
|
"aria-label": "Run progress",
|
|
345
1143
|
"data-run-status": held.status,
|
|
346
1144
|
"data-version": held.version,
|
|
347
1145
|
children: [
|
|
348
|
-
/* @__PURE__ */
|
|
349
|
-
/* @__PURE__ */
|
|
1146
|
+
/* @__PURE__ */ jsxs3("header", { className: "mthds-run-timeline-header", children: [
|
|
1147
|
+
/* @__PURE__ */ jsx3(
|
|
350
1148
|
"span",
|
|
351
1149
|
{
|
|
352
1150
|
className: `mthds-run-timeline-status mthds-run-timeline-status--${held.status}`,
|
|
@@ -354,18 +1152,19 @@ function RunTimeline({
|
|
|
354
1152
|
children: wordFor(RUN_STATUS_WORD, held.status)
|
|
355
1153
|
}
|
|
356
1154
|
),
|
|
357
|
-
held.mode === PROGRESS_MODE.DRY && /* @__PURE__ */
|
|
358
|
-
/* @__PURE__ */
|
|
1155
|
+
held.mode === PROGRESS_MODE.DRY && /* @__PURE__ */ jsx3("span", { className: "mthds-run-timeline-mode", children: "Dry run" }),
|
|
1156
|
+
/* @__PURE__ */ jsx3("p", { className: "mthds-run-timeline-summary", "aria-live": "polite", children: held.summary }),
|
|
1157
|
+
headerEnd
|
|
359
1158
|
] }),
|
|
360
|
-
held.degradation && /* @__PURE__ */
|
|
361
|
-
|
|
1159
|
+
held.degradation && /* @__PURE__ */ jsx3("p", { className: "mthds-run-timeline-degradation", role: "status", children: held.degradation.message }),
|
|
1160
|
+
entries.length === 0 ? (
|
|
362
1161
|
// A run that ended with nothing to draw, failed or canceled before its
|
|
363
1162
|
// first invocation started, is waiting for nothing.
|
|
364
|
-
/* @__PURE__ */
|
|
365
|
-
) : /* @__PURE__ */
|
|
366
|
-
axis && /* @__PURE__ */
|
|
367
|
-
/* @__PURE__ */
|
|
368
|
-
/* @__PURE__ */
|
|
1163
|
+
/* @__PURE__ */ jsx3("p", { className: "mthds-run-timeline-empty", children: isRunEnded(held.status) ? "No progress was recorded." : "Nothing has started yet." })
|
|
1164
|
+
) : /* @__PURE__ */ jsxs3("div", { className: "mthds-run-timeline-body", style: bodyStyle, children: [
|
|
1165
|
+
axis && /* @__PURE__ */ jsxs3("div", { className: "mthds-run-timeline-axis", "aria-hidden": "true", children: [
|
|
1166
|
+
/* @__PURE__ */ jsx3("span", { className: "mthds-run-timeline-axis-spacer" }),
|
|
1167
|
+
/* @__PURE__ */ jsx3("span", { className: "mthds-run-timeline-axis-track", ref: axisTrackRef, children: ticks.map((tick) => /* @__PURE__ */ jsx3(
|
|
369
1168
|
"span",
|
|
370
1169
|
{
|
|
371
1170
|
className: [
|
|
@@ -378,19 +1177,29 @@ function RunTimeline({
|
|
|
378
1177
|
},
|
|
379
1178
|
tick.offsetMs
|
|
380
1179
|
)) }),
|
|
381
|
-
/* @__PURE__ */
|
|
1180
|
+
/* @__PURE__ */ jsx3("span", { className: "mthds-run-timeline-axis-spacer" })
|
|
382
1181
|
] }),
|
|
383
|
-
/* @__PURE__ */
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
1182
|
+
/* @__PURE__ */ jsx3("ol", { className: "mthds-run-timeline-rows", children: drawnEntries.map(
|
|
1183
|
+
(drawn) => drawn.kind === TIMELINE_ENTRY_KIND.PAGER ? /* @__PURE__ */ jsx3(
|
|
1184
|
+
ItemPagerView,
|
|
1185
|
+
{
|
|
1186
|
+
pager: drawn,
|
|
1187
|
+
onToggleBatch: toggleBatch,
|
|
1188
|
+
onTurnPage: turnPage
|
|
1189
|
+
},
|
|
1190
|
+
`${PAGER_KEY_PREFIX}${drawn.batchPath}`
|
|
1191
|
+
) : /* @__PURE__ */ jsx3(
|
|
1192
|
+
TimelineRowView,
|
|
1193
|
+
{
|
|
1194
|
+
row: drawn.row,
|
|
1195
|
+
times: drawn.times,
|
|
1196
|
+
axis: drawn.followsClock ? axis : times.recorded,
|
|
1197
|
+
nowMs: drawn.followsClock ? nowMs : null,
|
|
1198
|
+
onToggleBatch: toggleBatch
|
|
1199
|
+
},
|
|
1200
|
+
drawn.row.path
|
|
1201
|
+
)
|
|
1202
|
+
) })
|
|
394
1203
|
] })
|
|
395
1204
|
]
|
|
396
1205
|
}
|