@intentius/behold 0.29.47 → 0.29.48
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/dist/cli.js +13 -10
- package/package.json +1 -1
- package/web/app.js +22 -0
- package/web/event-help-modal.js +13 -3
- package/web/kiosk-annotations.js +2 -2
- package/web/kiosk-event-help-ui.js +46 -9
- package/web/kiosk-event-help.js +6 -3
- package/web/kiosk-metrics.js +39 -8
- package/web/kiosk-metrics.test.js +36 -1
- package/web/kiosk-modal-sticky.test.js +27 -3
- package/web/kiosk-result.test.js +36 -0
- package/web/kiosk-runs.js +12 -0
- package/web/kiosk-story-gate.test.js +22 -1
- package/web/kiosk-trace.js +84 -21
- package/web/kiosk-trace.test.js +56 -10
- package/web/kiosk-track.js +58 -8
- package/web/kiosk-track.test.js +46 -1
- package/web/kiosk-watch.js +3 -1
- package/web/kiosk-watch.test.js +2 -0
- package/web/kiosk-wave-list.js +130 -0
- package/web/kiosk-wave-list.test.js +103 -0
- package/web/kiosk.html +78 -10
- package/web/kiosk.js +202 -46
- package/web/kiosk.test.js +112 -2
- package/web/small-stage.test.js +8 -0
package/dist/cli.js
CHANGED
|
@@ -30476,7 +30476,8 @@ var DORA_WINDOW = "7d";
|
|
|
30476
30476
|
var DORA_STEP = "1m";
|
|
30477
30477
|
var newest2 = (selector) => `last_over_time((max by (project) (${selector}))[${DORA_WINDOW}:${DORA_STEP}])`;
|
|
30478
30478
|
var QUERIES = {
|
|
30479
|
-
|
|
30479
|
+
// behold#786: the stage's result stays a label, so a wave that failed says so.
|
|
30480
|
+
waveSeconds: `max by (project, commit, run, wave, result) (last_over_time(terragucci_stage_duration_seconds{stage="tf-apply"}[${RUN_WINDOW}]))`,
|
|
30480
30481
|
rootInit: `max by (project, commit, run, wave, root) (last_over_time(terragucci_root_init_seconds{stage="tf-apply"}[${RUN_WINDOW}]))`,
|
|
30481
30482
|
rootPlan: `max by (project, commit, run, wave, root) (last_over_time(terragucci_root_plan_seconds{stage="tf-apply"}[${RUN_WINDOW}]))`,
|
|
30482
30483
|
rootApply: `max by (project, commit, run, wave, root) (last_over_time(terragucci_root_apply_seconds{stage="tf-apply"}[${RUN_WINDOW}]))`,
|
|
@@ -30550,7 +30551,9 @@ function runOf(a, repo, commit) {
|
|
|
30550
30551
|
const r = s.labels.root;
|
|
30551
30552
|
if (r && roots.has(r) && projectIs(s.labels.project, repo) && (s.labels.commit ?? "") === chosen && (s.labels.run ?? "") === run4) put(r, { lock_wait_seconds: s.value });
|
|
30552
30553
|
}
|
|
30553
|
-
const
|
|
30554
|
+
const walls = of(rows.waveSeconds, wave, run4);
|
|
30555
|
+
const wall = walls.length ? { value: Math.max(...walls.map((s) => s.value)) } : void 0;
|
|
30556
|
+
const result = (walls.find((s) => s.labels.result && s.labels.result !== "waiting") ?? walls.find((s) => s.labels.result))?.labels.result;
|
|
30554
30557
|
const changes = {};
|
|
30555
30558
|
for (const s of of(rows.changes, wave, run4)) if (s.labels.action && s.value > 0) changes[s.labels.action] = s.value;
|
|
30556
30559
|
const held = of(rows.held, wave, run4)[0];
|
|
@@ -30560,6 +30563,7 @@ function runOf(a, repo, commit) {
|
|
|
30560
30563
|
wave,
|
|
30561
30564
|
run: run4 || null,
|
|
30562
30565
|
...wall ? { seconds: wall.value } : {},
|
|
30566
|
+
...result ? { result } : {},
|
|
30563
30567
|
roots: [...roots.values()].sort((x, y) => x.root.localeCompare(y.root)),
|
|
30564
30568
|
...held ? { held_seconds: held.value } : {},
|
|
30565
30569
|
changes,
|
|
@@ -30592,7 +30596,8 @@ function doraFromFile(text3, repo) {
|
|
|
30592
30596
|
deployments_per_week: num4(p.per_week),
|
|
30593
30597
|
lead_time_seconds: num4(p.lead_time?.median_seconds),
|
|
30594
30598
|
change_failure_ratio: num4(p.change_failure?.rate),
|
|
30595
|
-
restore_seconds: num4(p.restore?.median_seconds)
|
|
30599
|
+
restore_seconds: num4(p.restore?.median_seconds),
|
|
30600
|
+
span_seconds: num4(p.span_seconds)
|
|
30596
30601
|
};
|
|
30597
30602
|
const set = Object.fromEntries(Object.entries(d).filter(([, v]) => v !== void 0));
|
|
30598
30603
|
return Object.keys(set).length ? { dora: { from: "dora.json", ...set }, project: p.project } : null;
|
|
@@ -30653,13 +30658,11 @@ function metricsRoute(app, opts) {
|
|
|
30653
30658
|
const run4 = runOf(a, repo, asked);
|
|
30654
30659
|
let d = doraOf(a, repo);
|
|
30655
30660
|
let project = [...a.settled, ...a.waiting, ...a.rootPlan, ...a.deployments].find((s) => projectIs(s.labels.project, repo))?.labels.project ?? null;
|
|
30656
|
-
|
|
30657
|
-
|
|
30658
|
-
|
|
30659
|
-
|
|
30660
|
-
|
|
30661
|
-
}
|
|
30662
|
-
}
|
|
30661
|
+
const f = opts.doraFile ? doraFromFile(await doraText(), repo) : null;
|
|
30662
|
+
if (!d && f) {
|
|
30663
|
+
d = f.dora;
|
|
30664
|
+
project ??= f.project;
|
|
30665
|
+
} else if (d && f && f.dora.span_seconds !== void 0) d = { ...d, span_seconds: f.dora.span_seconds };
|
|
30663
30666
|
const body = { read: (opts.now ? opts.now() : /* @__PURE__ */ new Date()).toISOString(), repo, project, run: run4, dora: d };
|
|
30664
30667
|
return c.json(body, 200, { "cache-control": "no-store" });
|
|
30665
30668
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intentius/behold",
|
|
3
|
-
"version": "0.29.
|
|
3
|
+
"version": "0.29.48",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "behold — a live control plane on chant. See your whole estate (every substrate in one graph), coloured by drift; act through delegated, gated Ops.",
|
package/web/app.js
CHANGED
|
@@ -13,6 +13,7 @@ import { createRefreshQueue } from "./refresh-queue.js";
|
|
|
13
13
|
import { readViewQuery, writeViewQuery, settleView, settlePlace, refusalLine } from "./view-url.js";
|
|
14
14
|
import { quietCardLines, readEmbed, selectMessage, viewFromMessage, wheelPx, wheelZoomsBare } from "./embed.js";
|
|
15
15
|
import { WORDS as POP_WORDS, cardRoot as popCardRoot, placePopover, popReduce, popState, resourcePopover, rootPopover } from "./kiosk-popover.js";
|
|
16
|
+
import { waveListKey, waveListOf } from "./kiosk-wave-list.js";
|
|
16
17
|
import { shiftInto } from "./float-place.js"; // behold#764
|
|
17
18
|
import { cssString, hoverCss, hoverFromMessage, hoverLinks, hoverMessage, isLightBg, rootPaint, rootText } from "./kiosk-roots.js";
|
|
18
19
|
import { gateCards } from "./workspace-gates.js";
|
|
@@ -5004,6 +5005,7 @@ function ensureWorkingStyle() {
|
|
|
5004
5005
|
}
|
|
5005
5006
|
function drawTgComponentMarks(svg, { drawnAnswer, focus, boxOf, make, edgePoints, marks: given = null }) {
|
|
5006
5007
|
const marks = given || tgComponentMarks(drawnAnswer, tgProgress, tgComponentFacets, { runs: tgRuns, pin: view.run || null });
|
|
5008
|
+
kioskTellMarks(marks);
|
|
5007
5009
|
// behold#631: where the marks came from, said in each tooltip.
|
|
5008
5010
|
const cardSource = marks.source || "(from terragucci's reports, not live)";
|
|
5009
5011
|
const boxSource = marks.source || "(the job's status from the pipeline's runs; the wave's from terragucci's reports)";
|
|
@@ -5472,6 +5474,26 @@ function kioskTellPop(pop) {
|
|
|
5472
5474
|
}
|
|
5473
5475
|
}
|
|
5474
5476
|
var kioskPopTold = "null"; // var: kioskPopRender may run before this line is reached
|
|
5477
|
+
/**
|
|
5478
|
+
* behold#776: tell the kiosk the cards' and waves' marks as words (web/kiosk-wave-list.js), with each card's
|
|
5479
|
+
* popover content, so a phone too narrow to read the graph lists them. Posted when they change.
|
|
5480
|
+
*/
|
|
5481
|
+
function kioskTellMarks(marks) {
|
|
5482
|
+
if (!embedOpts.bare || !embedOpts.host || window.parent === window) return;
|
|
5483
|
+
const answer = tgAnswerDrawn();
|
|
5484
|
+
const details = {};
|
|
5485
|
+
if (answer && !answer.error) for (const [id, c] of Object.entries((marks && marks.cards) || {})) if (c && c.root) details[id] = rootPopover(answer, c.root, resourcesByComponent[id]);
|
|
5486
|
+
const list = waveListOf(marks, details);
|
|
5487
|
+
const key = waveListKey(list);
|
|
5488
|
+
if (key === kioskMarksTold) return;
|
|
5489
|
+
kioskMarksTold = key;
|
|
5490
|
+
try {
|
|
5491
|
+
window.parent.postMessage({ type: "behold:marks", list }, embedOpts.host);
|
|
5492
|
+
} catch {
|
|
5493
|
+
/* the parent went away */
|
|
5494
|
+
}
|
|
5495
|
+
}
|
|
5496
|
+
var kioskMarksTold = ""; // var: the marks may draw before this line is reached
|
|
5475
5497
|
/** Wire the frame's pointer once: the popover, and the hover links to the kiosk. Bare frames only. */
|
|
5476
5498
|
// --- behold#571: the kiosk's Watch mode -------------------------------------
|
|
5477
5499
|
// The kiosk sends a `behold:shot` (web/kiosk-shot.js) with each step: the
|
package/web/event-help-modal.js
CHANGED
|
@@ -140,6 +140,12 @@ export const MODAL_STYLE = `
|
|
|
140
140
|
.eh-modal-act.eh-pressed { background: var(--bar, var(--pending)); color: var(--bg); transform: translateY(1px); }
|
|
141
141
|
.eh-mode-live .eh-modal-act:not(.eh-pressed) { cursor: pointer; }
|
|
142
142
|
.eh-modal .k-ap { margin-top: 0.4em; }
|
|
143
|
+
/* behold#774: on a phone a narrated modal is a strip in the page's flow, under the step bar: no sheet, nothing over the graph. */
|
|
144
|
+
.eh-modal-wrap.eh-modal-strip { position: static; inset: auto; z-index: auto; display: block; background: none; padding: 0.3em 16px 0.4em; }
|
|
145
|
+
.eh-modal-strip > .eh-modal { width: auto; max-height: none; padding: 0.5em 2.2em 0.6em 0.8em; border-width: 1px; border-radius: 8px; box-shadow: inset 4px 0 0 var(--bar, var(--focus)); font-size: 0.92em; }
|
|
146
|
+
.eh-modal-strip .eh-modal-title { margin-bottom: 0.25em; font-size: 1.1em; }
|
|
147
|
+
.eh-modal-strip .eh-modal-close { top: 0; right: 0; min-width: 44px; min-height: 44px; }
|
|
148
|
+
.eh-modal-strip .eh-modal-progress { margin-top: 0.4em; }
|
|
143
149
|
.eh-modal-progress { position: relative; height: 6px; margin-top: 0.7em; border-radius: 3px; background: color-mix(in srgb, var(--muted) 30%, transparent); overflow: hidden; }
|
|
144
150
|
.eh-modal-progress-fill { position: absolute; inset: 0 auto 0 0; background: var(--pending); border-radius: 3px; transition: width 0.9s linear; }
|
|
145
151
|
@media (prefers-reduced-motion: reduce) { .eh-modal-progress-fill { transition: none; } }
|
|
@@ -206,8 +212,10 @@ export function modalSpot(win, size, avoid, { prefer = [], bounds = null, margin
|
|
|
206
212
|
* `data`: `{ title, lines: [{ text, lit? }], panel?: Node, command?, at?, from?, action?, replayAt?, verbs?, gate?: { kind, op, gate, approve? } }`.
|
|
207
213
|
* `actions` (live only): `approve()` the app's own approve call, and
|
|
208
214
|
* `watch()` a read that answers an outcome once the ledger has the approval.
|
|
215
|
+
* behold#774: `strip` opens it as a strip in `host`'s flow (a phone's, under
|
|
216
|
+
* the step bar) in place of a box over the page: never placed, no sheet.
|
|
209
217
|
*/
|
|
210
|
-
export function openEventModal(host, { mode, kind, data = {}, actions = {}, doc = typeof document !== "undefined" ? document : null, now = () => Date.now(), reduced = false, onClose = () => {}, setTimer = setInterval, clearTimer = clearInterval } = {}) {
|
|
218
|
+
export function openEventModal(host, { mode, kind, data = {}, actions = {}, doc = typeof document !== "undefined" ? document : null, now = () => Date.now(), reduced = false, strip = false, onClose = () => {}, setTimer = setInterval, clearTimer = clearInterval } = {}) {
|
|
211
219
|
if (!MODAL_MODES.includes(mode)) throw new Error(`event-help modal: no mode ${JSON.stringify(mode)}`);
|
|
212
220
|
modalStyle(doc);
|
|
213
221
|
const st = { mode, kind, data, resolved: false, outcome: null, closed: false, hovered: false, closeAt: null, pressing: false };
|
|
@@ -217,7 +225,7 @@ export function openEventModal(host, { mode, kind, data = {}, actions = {}, doc
|
|
|
217
225
|
if (text !== undefined && text !== null) n.textContent = String(text);
|
|
218
226
|
return n;
|
|
219
227
|
};
|
|
220
|
-
const wrap = el("div", "eh-modal-wrap");
|
|
228
|
+
const wrap = el("div", strip ? "eh-modal-wrap eh-modal-strip" : "eh-modal-wrap");
|
|
221
229
|
const box = el("div", `eh-modal eh-modal-${kind} eh-mode-${mode}`);
|
|
222
230
|
box.setAttribute("role", "dialog");
|
|
223
231
|
box.setAttribute("aria-modal", "false");
|
|
@@ -243,7 +251,7 @@ export function openEventModal(host, { mode, kind, data = {}, actions = {}, doc
|
|
|
243
251
|
};
|
|
244
252
|
if (doc.addEventListener) doc.addEventListener("keydown", onKey);
|
|
245
253
|
wrap.addEventListener("click", (e) => {
|
|
246
|
-
if (e && e.target === wrap) close("viewer");
|
|
254
|
+
if (!strip && e && e.target === wrap) close("viewer");
|
|
247
255
|
});
|
|
248
256
|
// Hovered, it holds: its time to close starts again when the pointer leaves.
|
|
249
257
|
box.addEventListener("pointerenter", () => (st.hovered = true));
|
|
@@ -343,6 +351,8 @@ export function openEventModal(host, { mode, kind, data = {}, actions = {}, doc
|
|
|
343
351
|
}
|
|
344
352
|
// behold#631: a modal that must keep things in view (a failed card and the cards it blocked) moves off them.
|
|
345
353
|
const placeClear = () => {
|
|
354
|
+
// behold#774: a strip is in the page's flow, over nothing.
|
|
355
|
+
if (strip) return;
|
|
346
356
|
// behold#764: what it must never cover, whatever else it keeps off: the card's details popover a viewer has open.
|
|
347
357
|
const keep = typeof data.keepClear === "function" ? data.keepClear() : null;
|
|
348
358
|
if ((typeof data.avoid !== "function" && !keep) || !box.getBoundingClientRect || !doc.defaultView) {
|
package/web/kiosk-annotations.js
CHANGED
|
@@ -291,7 +291,7 @@ export const ANNOTATIONS = [
|
|
|
291
291
|
{
|
|
292
292
|
id: "T33", product: "terragucci", feature: "Reports bucket",
|
|
293
293
|
pattern: String.raw`^wave \d+: report copied to (\S+?)(?:, at (\S+))?$`,
|
|
294
|
-
note: "The wave's report was uploaded to the reports bucket under this prefix, so it outlives the CI job.",
|
|
294
|
+
note: "The wave's report was uploaded to the reports bucket under this prefix (a key there, not a web address), so it outlives the CI job.",
|
|
295
295
|
docs: { product: "terragucci", path: "/guides/keep-reports-in-a-bucket/" },
|
|
296
296
|
source: "terragucci:packages/terragucci/src/apply.ts:1566",
|
|
297
297
|
sample: "wave 1: report copied to demo/forgejo:3000/terragucci-admin/demo/2026/10/e8863ee426177316d84499a5b8401c4b6adfb546/tf-apply-wave-1",
|
|
@@ -299,7 +299,7 @@ export const ANNOTATIONS = [
|
|
|
299
299
|
{
|
|
300
300
|
id: "T34", product: "terragucci", feature: "Run view",
|
|
301
301
|
pattern: String.raw`^wave \d+: run view at (\S+)/run\.html$`,
|
|
302
|
-
note: "Where the page
|
|
302
|
+
note: "Where the page of this whole run, wave by wave, went in the reports bucket: a key there, not a web address. This page draws its waves from it.",
|
|
303
303
|
docs: { product: "terragucci", path: "/concepts/waves-and-approvals/#the-run-view" },
|
|
304
304
|
source: "terragucci:packages/terragucci/src/apply.ts:1483",
|
|
305
305
|
sample: "wave 1: run view at demo/forgejo:3000/terragucci-admin/demo/runs/e8863ee426177316d84499a5b8401c4b6adfb546/run.html",
|
|
@@ -70,7 +70,18 @@ body.k-watch #eh-trail { position: fixed; z-index: 7; left: 5px; right: 5px; pad
|
|
|
70
70
|
@keyframes eh-pulse { 0%, 100% { outline-color: color-mix(in srgb, var(--eh-glow, var(--focus)) 35%, transparent); } 50% { outline-color: var(--eh-glow, var(--focus)); } }
|
|
71
71
|
/* behold#631: a chant kiosk's strip fades in at its left edge, so a chip scrolled past it never reads as a word cut short. */
|
|
72
72
|
#eh-trail.eh-trail-fade { -webkit-mask-image: linear-gradient(to right, transparent 0, #000 72px); mask-image: linear-gradient(to right, transparent 0, #000 72px); }
|
|
73
|
+
/* behold#774: a phone's strip under the step bar: its tips and narrated modals in the page's flow, never over the graph. */
|
|
74
|
+
#eh-strip:empty { display: none; }
|
|
75
|
+
#eh-strip .eh-tip { position: static; transform: none !important; max-width: none; margin: 0.3em 16px; }
|
|
76
|
+
#eh-strip .eh-tip::after { display: none; }
|
|
77
|
+
#eh-strip:has(.eh-modal-wrap) .eh-tip { display: none; }
|
|
73
78
|
@media (max-width: 600px) { #eh-trail { padding: 0.2em 16px; } body.k-watch #eh-trail { position: static; background: transparent; border: 0; } .eh-tip { max-width: 18em; } }
|
|
79
|
+
/* behold#780: a phone's trail wraps, every chip in view, instead of a strip many screens wide that scrolls sideways with no cue. */
|
|
80
|
+
@media (max-width: 600px) {
|
|
81
|
+
#eh-trail { flex-wrap: wrap; row-gap: 0.3em; overflow-x: visible; contain: none; }
|
|
82
|
+
#eh-trail.eh-trail-fade { -webkit-mask-image: none; mask-image: none; }
|
|
83
|
+
#eh-trail .eh-chip { flex: 0 1 auto; max-width: 100%; white-space: normal; text-align: left; }
|
|
84
|
+
}
|
|
74
85
|
`;
|
|
75
86
|
|
|
76
87
|
/**
|
|
@@ -141,8 +152,10 @@ export function toneOf(kind) {
|
|
|
141
152
|
* Start Tips. `get()` answers what the kiosk holds now; `light(subjects)`
|
|
142
153
|
* lights them across the panes as a hover does (null puts them out);
|
|
143
154
|
* `panel(kind)` builds the real panel the modal shows (the approval panel).
|
|
155
|
+
* behold#774: while `narrow()` (a phone), the tips and the narrated modals go
|
|
156
|
+
* in `stripHost` (made after the trail when not given), under the step bar.
|
|
144
157
|
*/
|
|
145
|
-
export function startEventHelp({ doc = document, store = null, session = null, switchHost = null, trailHost, tipsHost, modalHost, get, light = () => {}, panel = () => null, openTrace = () => {}, now = () => Date.now(), shown = now, reduced = () => typeof matchMedia === "function" && matchMedia("(prefers-reduced-motion: reduce)").matches }) {
|
|
158
|
+
export function startEventHelp({ doc = document, store = null, session = null, switchHost = null, trailHost, tipsHost, modalHost, stripHost = null, get, light = () => {}, panel = () => null, openTrace = () => {}, now = () => Date.now(), shown = now, reduced = () => typeof matchMedia === "function" && matchMedia("(prefers-reduced-motion: reduce)").matches, narrow = () => typeof matchMedia === "function" && matchMedia("(max-width: 600px)").matches }) {
|
|
146
159
|
if (doc.head && !doc.getElementById("eh-style")) {
|
|
147
160
|
const style = doc.createElement("style");
|
|
148
161
|
style.id = "eh-style";
|
|
@@ -164,6 +177,21 @@ export function startEventHelp({ doc = document, store = null, session = null, s
|
|
|
164
177
|
if (text !== undefined && text !== null) n.textContent = text;
|
|
165
178
|
return n;
|
|
166
179
|
};
|
|
180
|
+
// behold#774: on a phone a centred modal covered the graph for a minute and more, and a tip the failed card.
|
|
181
|
+
// There they stand in a strip under the step bar (the track, then the trail), in the page's flow.
|
|
182
|
+
let strip = stripHost;
|
|
183
|
+
const stripEl = () => {
|
|
184
|
+
if (!strip && trailHost && trailHost.parentNode && trailHost.parentNode.insertBefore) {
|
|
185
|
+
strip = el("div");
|
|
186
|
+
strip.id = "eh-strip";
|
|
187
|
+
strip.setAttribute("aria-live", "polite");
|
|
188
|
+
trailHost.parentNode.insertBefore(strip, trailHost.nextSibling);
|
|
189
|
+
}
|
|
190
|
+
return strip;
|
|
191
|
+
};
|
|
192
|
+
const onPhone = () => !!narrow() && !!stripEl();
|
|
193
|
+
/** Where a modal opens now: the phone's strip, else over the page. */
|
|
194
|
+
const modalAt = () => (onPhone() ? { host: stripEl(), strip: true } : { host: modalHost, strip: false });
|
|
167
195
|
|
|
168
196
|
// The switch, by the theme picker and "What is this?".
|
|
169
197
|
if (switchHost) {
|
|
@@ -335,11 +363,13 @@ export function startEventHelp({ doc = document, store = null, session = null, s
|
|
|
335
363
|
const w = event.subjects.wave;
|
|
336
364
|
node.addEventListener("click", () => openTrace(w));
|
|
337
365
|
}
|
|
338
|
-
|
|
366
|
+
if (onPhone()) node.dataset.ehStrip = "1";
|
|
367
|
+
(node.dataset.ehStrip ? stripEl() : tipsHost).appendChild(node);
|
|
339
368
|
st.nodes.set(event.id, node);
|
|
340
369
|
}
|
|
341
370
|
node.style.visibility = "";
|
|
342
|
-
|
|
371
|
+
// A tip in the phone's strip stands in its flow, not over its thing.
|
|
372
|
+
if (!node.dataset.ehStrip) place(node, anchors[0].rect, h);
|
|
343
373
|
if (isNew) {
|
|
344
374
|
// The things it is about glow while it is up, and light together across the panes.
|
|
345
375
|
for (const a of anchors) if (a.el) glowOn(a.el, toneOf(event.kind));
|
|
@@ -404,7 +434,11 @@ export function startEventHelp({ doc = document, store = null, session = null, s
|
|
|
404
434
|
chip.dataset.ehTone = toneOf(f.kind);
|
|
405
435
|
// A chip asked for shows its tip again: on a hover while Tips are on, on a click always.
|
|
406
436
|
chip.addEventListener("pointerenter", () => st.on && replay(f));
|
|
407
|
-
chip
|
|
437
|
+
// behold#775: a trace's chip opens the trace too, as its tip does.
|
|
438
|
+
chip.addEventListener("click", () => {
|
|
439
|
+
replay(f);
|
|
440
|
+
if (f.kind === "trace" && Number.isInteger(f.subjects.wave)) openTrace(f.subjects.wave);
|
|
441
|
+
});
|
|
408
442
|
trailHost.appendChild(chip);
|
|
409
443
|
});
|
|
410
444
|
// The newest beat stays in view.
|
|
@@ -459,7 +493,8 @@ export function startEventHelp({ doc = document, store = null, session = null, s
|
|
|
459
493
|
data.bounds = () => graphArea(h);
|
|
460
494
|
}
|
|
461
495
|
// A chant kiosk counts down on the clock its track and caption use, so all three say the same second.
|
|
462
|
-
const
|
|
496
|
+
const at = modalAt();
|
|
497
|
+
const api = openEventModal(at.host, { mode, kind, data, doc, now: event.chant ? now : shown, reduced: reduced(), strip: at.strip, onClose: closedBy(kind, d, event.id) });
|
|
463
498
|
st.modal = { api, event, kind, step: d ? d.step : null, cycle: d ? d.cycle : null, pull: d ? d.pull : null };
|
|
464
499
|
};
|
|
465
500
|
/** behold#631: the "Waiting on…" modal's words: what is waited on, why it matters, and how long it usually takes. */
|
|
@@ -499,7 +534,8 @@ export function startEventHelp({ doc = document, store = null, session = null, s
|
|
|
499
534
|
});
|
|
500
535
|
const openWaiting = (w, h) => {
|
|
501
536
|
const d = h.demo;
|
|
502
|
-
const
|
|
537
|
+
const at = modalAt();
|
|
538
|
+
const api = openEventModal(at.host, { mode: "narrated", kind: "waiting", data: waitingData(w, h), doc, now, reduced: reduced(), strip: at.strip, onClose: closedBy("waiting", d, w.key) });
|
|
503
539
|
st.modal = { api, event: { kind: "waiting", subjects: { roots: [], wave: null } }, kind: "waiting", key: w.key, step: d ? d.step : null, cycle: d ? d.cycle : null, pull: d ? d.pull : null };
|
|
504
540
|
if (st.story) for (const n of st.nodes.values()) n.style.visibility = "hidden";
|
|
505
541
|
};
|
|
@@ -509,7 +545,8 @@ export function startEventHelp({ doc = document, store = null, session = null, s
|
|
|
509
545
|
const data = { title: hl.title, lines: [{ text: hl.body }], closeAfter: HIGHLIGHT_MS, ...offCards(h), keepClear: () => popRect(h) };
|
|
510
546
|
// behold#764: once per cycle, step and title for the visit, a reload included: kept as it opens.
|
|
511
547
|
st.closed.add(dismissKey("highlight", d, hl.id));
|
|
512
|
-
const
|
|
548
|
+
const at = modalAt();
|
|
549
|
+
const api = openEventModal(at.host, { mode: h.replay ? "replay" : "narrated", kind: "highlight", data, doc, now, reduced: reduced(), strip: at.strip, onClose: () => (st.modal = null) });
|
|
513
550
|
st.modal = { api, event: { kind: "highlight", subjects: { roots: [], wave: null } }, kind: "highlight", key: hl.key, step: d ? d.step : null, cycle: d ? d.cycle : null, pull: d ? d.pull : null };
|
|
514
551
|
for (const n of st.nodes.values()) n.style.visibility = "hidden";
|
|
515
552
|
};
|
|
@@ -573,7 +610,7 @@ export function startEventHelp({ doc = document, store = null, session = null, s
|
|
|
573
610
|
drawTrail(h);
|
|
574
611
|
settleModal(h, facts);
|
|
575
612
|
// A modal Inspect opened goes when the viewer turns to Watch on a held small stage, where nothing overlays the graph.
|
|
576
|
-
if (st.modal && modalShownElsewhere(st.modal.event, { watch: !!h.watch, held: !!h.held })) st.modal.api.close();
|
|
613
|
+
if (st.modal && modalShownElsewhere(st.modal.event, { watch: !!h.watch, held: !!h.held, result: !!h.result })) st.modal.api.close();
|
|
577
614
|
// behold#757: a step's highlight is read on every look (Tips off or not, so turning them on mid-step still shows it,
|
|
578
615
|
// and one the driver adds partway through a step shows when it appears); its modal goes with its step, or when the
|
|
579
616
|
// viewer turns to Inspect: it is Watch's.
|
|
@@ -623,7 +660,7 @@ export function startEventHelp({ doc = document, store = null, session = null, s
|
|
|
623
660
|
// behold#631: a chant repo's approval is the card beside the graph; a modal over it would hide it, so its hold opens none.
|
|
624
661
|
// Its result is the Applied card beside the graph; a modal would say it twice, over the cards.
|
|
625
662
|
// On a held small stage in Watch no modal opens: nothing overlays the graph there, and the caption says each step.
|
|
626
|
-
const told = (e) => modalShownElsewhere(e, { watch: !!h.watch, held: !!h.held });
|
|
663
|
+
const told = (e) => modalShownElsewhere(e, { watch: !!h.watch, held: !!h.held, result: !!h.result });
|
|
627
664
|
// behold#764: one the viewer closed stays closed; one due while a details popover is open waits for it to close.
|
|
628
665
|
const closedOne = (e) => st.closed.has(dismissKey(e.kind === "refused" ? "failed" : e.kind, h.demo, e.id));
|
|
629
666
|
st.modals = modalQueue(st.modals, { add: (h.chant ? news.filter((f) => f.kind !== "held" && f.kind !== "applied") : news).filter((e) => !told(e) && !closedOne(e)), now: now(), lastInput: st.lastInput, open: !!st.modal || !!pop });
|
package/web/kiosk-event-help.js
CHANGED
|
@@ -315,11 +315,14 @@ export function tipsQueue(state, { add = [], now = 0, max = TIPS_AT_ONCE, ms = T
|
|
|
315
315
|
* Whether the caption already says what a critical modal would, so the modal
|
|
316
316
|
* stays shut: on a held small stage in Watch (`held`) nothing overlays the
|
|
317
317
|
* graph (web/kiosk-watch.js watchOverlays), and the caption says each step
|
|
318
|
-
* (the applied counts, a held wave's approval, a failure's label).
|
|
318
|
+
* (the applied counts, a held wave's approval, a failure's label).
|
|
319
|
+
* behold#782: in Watch the applied step has its result card (`result`) and
|
|
320
|
+
* the caption's "Applied", so its modal would say it a third time. Any other
|
|
319
321
|
* stage, and Inspect, open them as they always have.
|
|
320
322
|
*/
|
|
321
|
-
export function modalShownElsewhere(event, { watch = false, held = false } = {}) {
|
|
322
|
-
|
|
323
|
+
export function modalShownElsewhere(event, { watch = false, held = false, result = false } = {}) {
|
|
324
|
+
if (!watch || !event) return false;
|
|
325
|
+
return !!held || (event.kind === "applied" && !!result);
|
|
323
326
|
}
|
|
324
327
|
|
|
325
328
|
/** Whether Tips' bubbles show: everywhere but a held small stage in Watch, where nothing overlays the graph; the trail over the caption stays. */
|
package/web/kiosk-metrics.js
CHANGED
|
@@ -64,6 +64,24 @@ export function changeWords(changes) {
|
|
|
64
64
|
return parts.length ? parts.join(", ") : null;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
+
/**
|
|
68
|
+
* behold#786: the span a deploy rate divides by, as terragucci's estate page
|
|
69
|
+
* names it: "24 hours", "3.5 days", "7.4 weeks".
|
|
70
|
+
*/
|
|
71
|
+
export function spanWords(secs) {
|
|
72
|
+
if (typeof secs !== "number" || !Number.isFinite(secs) || secs <= 0) return null;
|
|
73
|
+
const h = secs / 3600;
|
|
74
|
+
if (h < 48) return `${Math.round(h)} ${Math.round(h) === 1 ? "hour" : "hours"}`;
|
|
75
|
+
const d = h / 24;
|
|
76
|
+
if (d < 14) return `${Math.round(d * 10) / 10} days`;
|
|
77
|
+
return `${Math.round((d / 7) * 10) / 10} weeks`;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** behold#786: what the delivery numbers cover, said over them. */
|
|
81
|
+
export function windowNote(span) {
|
|
82
|
+
return `Deploys are the applied waves of the last ${span}, scaled to a week. All four are counted again after each cycle, so they move while you watch.`;
|
|
83
|
+
}
|
|
84
|
+
|
|
67
85
|
/** "14:05", the viewer's clock, from Unix seconds. */
|
|
68
86
|
export function clockWords(unix) {
|
|
69
87
|
if (typeof unix !== "number" || !Number.isFinite(unix)) return null;
|
|
@@ -73,10 +91,13 @@ export function clockWords(unix) {
|
|
|
73
91
|
|
|
74
92
|
/**
|
|
75
93
|
* What the pane shows, from one /api/metrics answer, or null for no pane:
|
|
76
|
-
* `{ count, run: { label, waves: [{ head, rows: [[label, value, root?]] }] } | null, dora: [[label, value]] | null, note? }`.
|
|
94
|
+
* `{ count, run: { label, note?, waves: [{ head, rows: [[label, value, root?]] }] } | null, dora: [[label, value]] | null, note?, window?, windowNote? }`.
|
|
77
95
|
* `note` is the line over the delivery numbers, demo.json's `delivery`, when there are numbers and a line.
|
|
96
|
+
* behold#786: `asked` is the commit the kiosk is on: a run of another commit
|
|
97
|
+
* says it is an earlier one, and that this one has no numbers yet. `window`
|
|
98
|
+
* ("last 24 hours") and `windowNote` say what the delivery numbers cover.
|
|
78
99
|
*/
|
|
79
|
-
export function metricsModel(answer, delivery = null) {
|
|
100
|
+
export function metricsModel(answer, delivery = null, asked = null) {
|
|
80
101
|
if (!answer || answer.error) return null;
|
|
81
102
|
let run = null;
|
|
82
103
|
if (answer.run && Array.isArray(answer.run.waves)) {
|
|
@@ -101,11 +122,16 @@ export function metricsModel(answer, delivery = null) {
|
|
|
101
122
|
const took = secondsWords(w.seconds);
|
|
102
123
|
// behold#571: Watch mode's badge on the wave's box reads the same numbers, short ("1.6 s · held 25 s · 4 created").
|
|
103
124
|
const badge = { seconds: took, held, changed, secondsRaw: typeof w.seconds === "number" ? w.seconds : null, heldRaw: typeof w.held_seconds === "number" ? w.held_seconds : null, changesRaw: w.changes || null };
|
|
104
|
-
|
|
125
|
+
// behold#786: a wave whose job failed says so over its roots' times.
|
|
126
|
+
const failed = w.result === "failed";
|
|
127
|
+
if (rows.length || took) waves.push({ wave: w.wave, head: failed ? `Wave ${w.wave} · failed` : `Wave ${w.wave}`, took: took ? `${took} in all` : null, rows, ...badge, ...(w.result ? { result: w.result } : {}) });
|
|
105
128
|
}
|
|
106
129
|
if (waves.length) {
|
|
107
|
-
const
|
|
108
|
-
|
|
130
|
+
const commit = answer.run.commit ? String(answer.run.commit).slice(0, 8) : null;
|
|
131
|
+
const c = commit ? ` · ${commit}` : "";
|
|
132
|
+
// behold#786: before this commit's waves send their numbers, the newest run that did is another commit's: an earlier one.
|
|
133
|
+
const other = !answer.run.current && commit && typeof asked === "string" && /^[0-9a-f]{7,64}$/.test(asked) && !asked.startsWith(commit) ? asked.slice(0, 8) : null;
|
|
134
|
+
run = { label: `${answer.run.current ? "This run" : other ? "Earlier run" : "Latest run"}${c}`, current: !!answer.run.current, ...(other ? { note: `This run, ${other}, has no numbers yet.` } : {}), waves };
|
|
109
135
|
}
|
|
110
136
|
}
|
|
111
137
|
let dora = null;
|
|
@@ -123,7 +149,8 @@ export function metricsModel(answer, delivery = null) {
|
|
|
123
149
|
const n = run ? run.waves.length : 0;
|
|
124
150
|
const count = [n ? `${n} ${n === 1 ? "wave" : "waves"}` : null, dora ? `${dora.length} delivery` : null].filter(Boolean).join(" · ");
|
|
125
151
|
const note = dora && typeof delivery === "string" && delivery.trim() ? delivery.trim() : null;
|
|
126
|
-
|
|
152
|
+
const span = dora ? spanWords(answer.dora.span_seconds) : null;
|
|
153
|
+
return { count, run, dora, ...(note ? { note } : {}), ...(span ? { window: `last ${span}`, windowNote: windowNote(span) } : {}) };
|
|
127
154
|
}
|
|
128
155
|
|
|
129
156
|
/**
|
|
@@ -140,9 +167,11 @@ export function steadyModel(prev, next, { same = false, failed = false } = {}) {
|
|
|
140
167
|
const run = next.run || prev.run;
|
|
141
168
|
const dora = next.dora || prev.dora;
|
|
142
169
|
const note = next.note || (next.dora ? null : prev.note) || null;
|
|
170
|
+
// The window goes with the numbers it is about.
|
|
171
|
+
const span = next.dora ? next : prev;
|
|
143
172
|
const n = run ? run.waves.length : 0;
|
|
144
173
|
const count = [n ? `${n} ${n === 1 ? "wave" : "waves"}` : null, dora ? `${dora.length} delivery` : null].filter(Boolean).join(" · ");
|
|
145
|
-
return { count, run, dora, ...(note ? { note } : {}) };
|
|
174
|
+
return { count, run, dora, ...(note ? { note } : {}), ...(span.window ? { window: span.window, windowNote: span.windowNote } : {}) };
|
|
146
175
|
}
|
|
147
176
|
|
|
148
177
|
/** The viewer's fold: true open, false folded, null when they never chose. */
|
|
@@ -243,6 +272,7 @@ export function renderMetrics(host, model, { open = true, onToggle = () => {}, d
|
|
|
243
272
|
const body = el(doc, "div", "k-metrics-body");
|
|
244
273
|
if (model.run) {
|
|
245
274
|
body.appendChild(el(doc, "h3", "k-metrics-label", model.run.label));
|
|
275
|
+
if (model.run.note) body.appendChild(el(doc, "p", "k-metrics-note", model.run.note));
|
|
246
276
|
const list = el(doc, "ol", "k-metrics-waves");
|
|
247
277
|
for (const w of model.run.waves) {
|
|
248
278
|
const li = el(doc, "li", "k-metrics-wave");
|
|
@@ -258,6 +288,7 @@ export function renderMetrics(host, model, { open = true, onToggle = () => {}, d
|
|
|
258
288
|
if (model.dora) {
|
|
259
289
|
body.appendChild(el(doc, "h3", "k-metrics-label", "Delivery (DORA)"));
|
|
260
290
|
if (model.note) body.appendChild(el(doc, "p", "k-metrics-note", model.note));
|
|
291
|
+
if (model.windowNote) body.appendChild(el(doc, "p", "k-metrics-note", model.windowNote));
|
|
261
292
|
const box = el(doc, "div", "k-metrics-dora");
|
|
262
293
|
box.appendChild(rowsEl(doc, model.dora));
|
|
263
294
|
body.appendChild(box);
|
|
@@ -320,7 +351,7 @@ export function startMetrics(host, { tool = null, reads = { demo: "/api/terraguc
|
|
|
320
351
|
const d = demo && demo.demo;
|
|
321
352
|
const now = d ? `${d.repo}|${d.cycle}` : latest && latest.cycle ? `${latest.cycle.repo}|${latest.cycle.cycle}` : null;
|
|
322
353
|
const failed = !demo || !!demo.error || !target || !answer || !!answer.error;
|
|
323
|
-
const next = steadyModel(model, target ? metricsModel(answer, d ? d.delivery : null) : null, { same: now !== null && now === cycle, failed });
|
|
354
|
+
const next = steadyModel(model, target ? metricsModel(answer, d ? d.delivery : null, target.commit) : null, { same: now !== null && now === cycle, failed });
|
|
324
355
|
if (now !== null && !failed) cycle = now;
|
|
325
356
|
if (JSON.stringify(next) !== JSON.stringify(model)) {
|
|
326
357
|
model = next;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// behold#571: the kiosk's "Pipeline metrics" pane, as words. No DOM: the
|
|
2
2
|
// model decides what shows, and an answer with nothing in it shows no pane.
|
|
3
3
|
import { describe, expect, it } from "vitest";
|
|
4
|
-
import { changeWords, METRICS_STORE, metricsModel, metricsStored, metricsTarget, metricsUrl, percentWords, perWeekWords, secondsWords, steadyModel, startMetrics } from "./kiosk-metrics.js";
|
|
4
|
+
import { changeWords, METRICS_STORE, metricsModel, metricsStored, metricsTarget, metricsUrl, percentWords, perWeekWords, secondsWords, spanWords, steadyModel, startMetrics, windowNote } from "./kiosk-metrics.js";
|
|
5
5
|
|
|
6
6
|
const C1 = "9f3c2a71d04e5b8c6a1f2e3d4c5b6a7980716253";
|
|
7
7
|
const answer = () => ({
|
|
@@ -57,6 +57,41 @@ describe("kiosk metrics: what the pane shows", () => {
|
|
|
57
57
|
expect(metricsModel(a).run.label).toBe("Latest run");
|
|
58
58
|
});
|
|
59
59
|
|
|
60
|
+
it("names another commit's run as an earlier one while the kiosk's commit has no numbers yet (behold#786)", () => {
|
|
61
|
+
const a = answer();
|
|
62
|
+
a.run.current = false;
|
|
63
|
+
const C2 = "151b3302aaaabbbbccccddddeeeeffff00001111";
|
|
64
|
+
const m = metricsModel(a, null, C2);
|
|
65
|
+
expect(m.run.label).toBe("Earlier run · 9f3c2a71");
|
|
66
|
+
expect(m.run.note).toBe("This run, 151b3302, has no numbers yet.");
|
|
67
|
+
// Asked for the commit it has, or for none: as before.
|
|
68
|
+
expect(metricsModel(a, null, C1).run).toMatchObject({ label: "Latest run · 9f3c2a71" });
|
|
69
|
+
expect(metricsModel(a, null, C1).run.note).toBeUndefined();
|
|
70
|
+
expect(metricsModel(a, null, null).run.label).toBe("Latest run · 9f3c2a71");
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it("says a wave whose job failed, over its roots' times (behold#786)", () => {
|
|
74
|
+
const a = answer();
|
|
75
|
+
a.run.waves[1] = { ...a.run.waves[1], seconds: 13, result: "failed" };
|
|
76
|
+
a.run.waves[0] = { ...a.run.waves[0], result: "applied" };
|
|
77
|
+
const [w1, w2] = metricsModel(a).run.waves;
|
|
78
|
+
expect([w1.head, w1.result]).toEqual(["Wave 1", "applied"]);
|
|
79
|
+
expect([w2.head, w2.took, w2.result]).toEqual(["Wave 2 · failed", "13 s in all", "failed"]);
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it("says what span the delivery numbers cover, when the answer names it (behold#786)", () => {
|
|
83
|
+
expect([3600, 86400, 32 * 3600, 3.5 * 86400, 52 * 86400, 0, undefined].map(spanWords)).toEqual(["1 hour", "24 hours", "32 hours", "3.5 days", "7.4 weeks", null, null]);
|
|
84
|
+
const a = answer();
|
|
85
|
+
a.dora.span_seconds = 86400;
|
|
86
|
+
const m = metricsModel(a);
|
|
87
|
+
expect(m.window).toBe("last 24 hours");
|
|
88
|
+
expect(m.windowNote).toBe(windowNote("24 hours"));
|
|
89
|
+
expect(m.windowNote).toMatch(/^Deploys are the applied waves of the last 24 hours, scaled to a week\./);
|
|
90
|
+
expect(metricsModel(answer()).window).toBeUndefined();
|
|
91
|
+
// The window goes with the numbers: kept through a read that has none.
|
|
92
|
+
expect(steadyModel(m, { ...metricsModel({ ...a, dora: null }) }, { same: true }).window).toBe("last 24 hours");
|
|
93
|
+
});
|
|
94
|
+
|
|
60
95
|
it("a waiting wave says since when, by the viewer's clock", () => {
|
|
61
96
|
const a = answer();
|
|
62
97
|
a.run.waves = [{ wave: 2, run: "4101", roots: [{ root: "app", plan_seconds: 7.9, lock_wait_seconds: 1.5 }], changes: {}, waiting_since: Date.parse("2026-10-16T14:05:00") / 1000 }];
|
|
@@ -79,10 +79,11 @@ describe("Tips: a closed modal stays closed, and none covers the details popover
|
|
|
79
79
|
afterEach(() => vi.useRealTimers());
|
|
80
80
|
const FRAME = { getBoundingClientRect: () => ({ left: 5, top: 77, width: 1356, height: 686, right: 1361, bottom: 763 }) };
|
|
81
81
|
/** One page of the kiosk; `store` is its sessionStorage, which a reload keeps. */
|
|
82
|
-
const page = (store, { pop = null } = {}) => {
|
|
82
|
+
const page = (store, { pop = null, phone = false } = {}) => {
|
|
83
83
|
const doc = fakeDoc();
|
|
84
84
|
const view = { demo: demo("pull-request"), watch: true, waiting: WAIT, frame: FRAME, pop };
|
|
85
|
-
const
|
|
85
|
+
const stripHost = doc.createElement("div");
|
|
86
|
+
const api = startEventHelp({ doc, store: shelf(), session: store, tipsHost: doc.body, modalHost: doc.body, stripHost, narrow: () => phone, now: () => t, get: () => ({ ...view, strip: null, stripReady: true }), reduced: () => true });
|
|
86
87
|
const modal = (kind) => all(doc.body).find((n) => n.className && n.className.split(" ").includes(`eh-modal-${kind}`));
|
|
87
88
|
const step = (ms = 1_000, more = {}) => {
|
|
88
89
|
Object.assign(view, more);
|
|
@@ -94,9 +95,32 @@ describe("Tips: a closed modal stays closed, and none covers the details popover
|
|
|
94
95
|
const x = all(modal(kind)).find((n) => n.className === "eh-modal-close");
|
|
95
96
|
x.handlers.click.forEach((fn) => fn({}));
|
|
96
97
|
};
|
|
97
|
-
return { api, doc, view, modal, step, closeX };
|
|
98
|
+
return { api, doc, view, modal, step, closeX, stripHost };
|
|
98
99
|
};
|
|
99
100
|
|
|
101
|
+
// behold#774: on a phone the Waiting modal dimmed the page and covered the graph for a minute and more.
|
|
102
|
+
it("on a phone, the Waiting modal and a highlight are a strip under the step bar, with no sheet over the page", () => {
|
|
103
|
+
const k = page(session(), { phone: true });
|
|
104
|
+
k.step();
|
|
105
|
+
expect(k.modal("waiting")).toBeUndefined();
|
|
106
|
+
const inStrip = (kind) => all(k.stripHost).find((n) => n.classes && n.classes.has(`eh-modal-${kind}`));
|
|
107
|
+
expect(inStrip("waiting")).toBeDefined();
|
|
108
|
+
expect(k.stripHost.children[0].classes.has("eh-modal-strip")).toBe(true);
|
|
109
|
+
// Its × still closes it for good.
|
|
110
|
+
all(inStrip("waiting")).find((n) => n.className === "eh-modal-close").handlers.click.forEach((fn) => fn({}));
|
|
111
|
+
k.step(1_000);
|
|
112
|
+
expect(inStrip("waiting")).toBeUndefined();
|
|
113
|
+
k.step(1_000, { demo: demo("failed", { highlight: HL }), waiting: null });
|
|
114
|
+
expect(inStrip("highlight")).toBeDefined();
|
|
115
|
+
expect(k.modal("highlight")).toBeUndefined();
|
|
116
|
+
});
|
|
117
|
+
it("off a phone, they open over the page as before", () => {
|
|
118
|
+
const k = page(session());
|
|
119
|
+
k.step();
|
|
120
|
+
expect(k.modal("waiting")).toBeDefined();
|
|
121
|
+
expect(k.stripHost.children).toHaveLength(0);
|
|
122
|
+
});
|
|
123
|
+
|
|
100
124
|
it("the Waiting modal, closed with ×, does not come back on the next looks at the same wait", () => {
|
|
101
125
|
const k = page(session());
|
|
102
126
|
k.step();
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// behold#782: Watch's result card at the applied step, drawn with a DOM just big enough for it.
|
|
2
|
+
import { describe, expect, it } from "vitest";
|
|
3
|
+
|
|
4
|
+
describe("kiosk: the result card says Applied once (behold#782)", () => {
|
|
5
|
+
const fakeDocument = () => {
|
|
6
|
+
const make = (tag) => {
|
|
7
|
+
const n = { tagName: tag, className: "", textContent: "", children: [], dataset: {}, style: {}, hidden: false };
|
|
8
|
+
n.appendChild = (c) => (n.children.push(c), c);
|
|
9
|
+
n.append = (...cs) => cs.forEach((c) => n.children.push(typeof c === "string" ? { tagName: "#text", textContent: c, children: [] } : c));
|
|
10
|
+
n.replaceChildren = () => (n.children = []);
|
|
11
|
+
n.addEventListener = () => {};
|
|
12
|
+
return n;
|
|
13
|
+
};
|
|
14
|
+
return { createElement: make };
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
it("leads with its first count and leaves the step's line to the caption", async () => {
|
|
18
|
+
const { drawResult } = await import("./kiosk.js");
|
|
19
|
+
const was = globalThis.document;
|
|
20
|
+
globalThis.document = fakeDocument();
|
|
21
|
+
try {
|
|
22
|
+
const host = document.createElement("aside");
|
|
23
|
+
const model = { head: "Applied", line: "All fifteen roots are in.", counts: ["3 waves applied", "1 created, 6 updated"], waves: [] };
|
|
24
|
+
drawResult(host, model, { waveTraces: {} });
|
|
25
|
+
expect(host.children.map((c) => [c.className, c.textContent || c.children.map((x) => x.textContent).join(" | ")])).toEqual([
|
|
26
|
+
["k-result-head", "3 waves applied"],
|
|
27
|
+
["k-result-counts", "1 created, 6 updated"],
|
|
28
|
+
]);
|
|
29
|
+
// No count: the head says the step.
|
|
30
|
+
drawResult(host, { ...model, counts: [] }, { waveTraces: {} });
|
|
31
|
+
expect(host.children.map((c) => c.textContent)).toEqual(["Applied"]);
|
|
32
|
+
} finally {
|
|
33
|
+
globalThis.document = was;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
});
|
package/web/kiosk-runs.js
CHANGED
|
@@ -571,6 +571,18 @@ export function renderRun(host, answer, ui, { now = new Date(), pickJob = () =>
|
|
|
571
571
|
}
|
|
572
572
|
if (j.needs && j.needs.length) li.appendChild(el("span", "r-job-needs", `after ${j.needs.join(", ")}`));
|
|
573
573
|
li.appendChild(el("span", "r-dur", j.status === "waiting" ? "held at the gate" : durationWords(j.started_at, j.ended_at, now) || STATUS_WORDS[j.status] || ""));
|
|
574
|
+
// behold#801: a job with a trace says so on its row, one click from it.
|
|
575
|
+
if (trace && trace.has(j.name)) {
|
|
576
|
+
const go = el("button", "r-job-trace", "Trace");
|
|
577
|
+
go.type = "button";
|
|
578
|
+
go.title = `${j.name}: open its trace`;
|
|
579
|
+
go.addEventListener("click", (e) => {
|
|
580
|
+
e.stopPropagation();
|
|
581
|
+
pickJob(j.name);
|
|
582
|
+
pickView("trace");
|
|
583
|
+
});
|
|
584
|
+
li.appendChild(go);
|
|
585
|
+
}
|
|
574
586
|
li.addEventListener("click", () => pickJob(j.name));
|
|
575
587
|
jobsBox.appendChild(li);
|
|
576
588
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { storyGate, whatLine, whatParts, whatTool } from "./kiosk.js";
|
|
2
|
+
import { WHAT_TEXT, WHAT_TEXT_CHANT, introLine, storyGate, whatLine, whatParts, whatTextFor, whatTool } from "./kiosk.js";
|
|
3
3
|
|
|
4
4
|
// behold#741: the #740 kiosk features (track, chapters, wedge, waiting modal,
|
|
5
5
|
// pacing, wave blocks, applied earlier, one tip at a time, the title line)
|
|
@@ -42,3 +42,24 @@ describe("a terragucci story's title line (behold#741)", () => {
|
|
|
42
42
|
expect(whatLine({ scenario: "fan-out" }, "forgejo")).toBe("chant's pull-request pipeline · on Forgejo · fan-out · live demo");
|
|
43
43
|
});
|
|
44
44
|
});
|
|
45
|
+
|
|
46
|
+
// behold#777: a phone names behold and whose pipeline it watches in one line under the title, and "What is this?" agrees.
|
|
47
|
+
describe("the phone's intro line and What is this? (behold#777)", () => {
|
|
48
|
+
it("names behold and terragucci for a terragucci repo, in the popover too", () => {
|
|
49
|
+
const line = introLine({ tg: true });
|
|
50
|
+
expect(line).toMatch(/^behold, a live view of infrastructure/);
|
|
51
|
+
expect(line).toMatch(/terragucci/);
|
|
52
|
+
const pop = whatTextFor({ tg: true });
|
|
53
|
+
expect(pop).toMatch(/^This is behold, a live view of infrastructure/);
|
|
54
|
+
expect(pop).toMatch(/terragucci/);
|
|
55
|
+
});
|
|
56
|
+
it("keeps chant's words for chant's pipeline, and the plain words elsewhere", () => {
|
|
57
|
+
expect(whatTextFor({ chant: true, tg: true })).toBe(WHAT_TEXT_CHANT);
|
|
58
|
+
expect(whatTextFor({})).toBe(WHAT_TEXT);
|
|
59
|
+
expect(introLine({ chant: true })).toMatch(/chant's pull-request pipeline/);
|
|
60
|
+
expect(introLine({})).toMatch(/^behold, a live view of infrastructure/);
|
|
61
|
+
});
|
|
62
|
+
it("says nothing on a tool's page, which may not name the others", () => {
|
|
63
|
+
expect(introLine({ tg: true, vendor: true })).toBeNull();
|
|
64
|
+
});
|
|
65
|
+
});
|