@intentius/behold 0.29.32 → 0.29.34
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/package.json +1 -1
- package/web/app.js +93 -2
- package/web/event-help-modal.js +280 -0
- package/web/event-help-modal.test.js +180 -0
- package/web/event-help-store.js +23 -0
- package/web/index.html +4 -1
- package/web/kiosk-event-help-ui.js +397 -0
- package/web/kiosk-event-help.js +255 -0
- package/web/kiosk-event-help.test.js +162 -0
- package/web/kiosk-runs.js +18 -1
- package/web/kiosk-trace.js +72 -13
- package/web/kiosk-trace.test.js +14 -0
- package/web/kiosk-watch.js +43 -3
- package/web/kiosk-watch.test.js +31 -1
- package/web/kiosk-wave-traces.js +104 -0
- package/web/kiosk-wave-traces.test.js +53 -0
- package/web/kiosk.html +33 -0
- package/web/kiosk.js +317 -25
- package/web/kiosk.test.js +18 -0
package/web/kiosk.html
CHANGED
|
@@ -459,6 +459,32 @@
|
|
|
459
459
|
#k-result { width: min(30em, 36vw); padding: 0.9em 1.2em 1em; background: color-mix(in srgb, var(--managed) 8%, var(--surface-box)); border: 2px solid var(--bar-managed); border-radius: 12px;
|
|
460
460
|
box-shadow: 0 10px 34px color-mix(in srgb, var(--shadow) 75%, transparent), 0 0 0 6px color-mix(in srgb, var(--managed) 12%, transparent); }
|
|
461
461
|
#k-result[hidden], #k-callout[hidden], #k-drawer[hidden] { display: none; }
|
|
462
|
+
/* behold#571: a wave's trace, one click from its numbers: its badge, the result card's bars, the drawer. */
|
|
463
|
+
.k-badge.k-badge-trace { pointer-events: auto; cursor: pointer; border-color: color-mix(in srgb, var(--pending) 60%, var(--rule)); }
|
|
464
|
+
.k-badge.k-badge-trace:hover { border-color: var(--pending); background: var(--active); }
|
|
465
|
+
.k-badge-go { margin-left: 0.55em; color: var(--pending); font-weight: 600; }
|
|
466
|
+
.k-badge-go::after, .k-wf-go::after { content: " ›"; }
|
|
467
|
+
#k-drawer.k-trace-only .k-drawer-tail, #k-drawer.k-trace-only .k-drawer-body { display: none; }
|
|
468
|
+
#k-drawer.k-trace-only #k-traces { max-height: 60vh; border-top: 1px solid var(--rule); }
|
|
469
|
+
#k-drawer.k-trace-only #k-traces:empty::before { content: "Reading the trace from Tempo…"; display: block; padding: 0.8em 1em; color: var(--muted); }
|
|
470
|
+
#k-drawer.k-trace-only #k-traces:empty { display: block; }
|
|
471
|
+
.k-wf { margin-top: 0.7em; padding-top: 0.5em; border-top: 1px solid var(--rule); display: grid; gap: 0.25em; }
|
|
472
|
+
.k-wf-row { display: grid; grid-template-columns: 4.2em minmax(6em, 1fr) auto auto; align-items: center; gap: 0.6em; width: 100%; padding: 0.2em 0.3em; border: 0; border-radius: 6px; background: transparent; color: var(--fg); font: inherit; text-align: left; cursor: pointer; }
|
|
473
|
+
.k-wf-row:not(.k-wf-plain):hover, .k-wf-row:focus-visible { background: var(--active); }
|
|
474
|
+
.k-wf-row.k-wf-plain { grid-template-columns: 4.2em minmax(0, 1fr); cursor: default; }
|
|
475
|
+
.k-wf-words { font-size: 0.9em; font-variant-numeric: tabular-nums; }
|
|
476
|
+
.k-wf-wave { font: 600 0.88em var(--font-mono); color: var(--muted); }
|
|
477
|
+
.k-wf-track { position: relative; height: 0.85em; border-radius: 3px; background: color-mix(in srgb, var(--rule) 45%, transparent); overflow: hidden; }
|
|
478
|
+
.k-wf-seg { position: absolute; top: 0; bottom: 0; min-width: 2px; }
|
|
479
|
+
.k-wf-ms { font-size: 0.86em; font-variant-numeric: tabular-nums; white-space: nowrap; }
|
|
480
|
+
.k-wf-go { font-size: 0.82em; font-weight: 600; color: var(--pending); }
|
|
481
|
+
.k-wf-plan, .k-wf-apply { background: var(--runtime); }
|
|
482
|
+
.k-wf-apply { background: color-mix(in srgb, var(--managed) 75%, transparent); }
|
|
483
|
+
.k-wf-held { background: repeating-linear-gradient(135deg, var(--foreign) 0 4px, color-mix(in srgb, var(--foreign) 45%, transparent) 4px 8px); }
|
|
484
|
+
.k-wf-gate, .k-wf-report, .k-wf-upload { background: color-mix(in srgb, var(--muted) 70%, transparent); }
|
|
485
|
+
.k-wf-key { display: flex; flex-wrap: wrap; gap: 0.2em 0.9em; margin: 0.2em 0 0; color: var(--muted); font-size: 0.78em; }
|
|
486
|
+
.k-wf-key span { display: inline-flex; align-items: center; gap: 0.3em; }
|
|
487
|
+
.k-wf-sw { display: inline-block; width: 1.2em; height: 0.55em; border-radius: 2px; }
|
|
462
488
|
.k-result-head { margin: 0 0 0.2em; font: 700 1.5em var(--font-ui); color: var(--managed); }
|
|
463
489
|
.k-result-line { margin: 0 0 0.6em; font-size: 1.12em; line-height: 1.35; color: var(--fg); }
|
|
464
490
|
.k-result-counts { list-style: none; margin: 0 0 0.6em; padding: 0; display: flex; flex-wrap: wrap; gap: 0.35em 0.5em; }
|
|
@@ -467,6 +493,7 @@
|
|
|
467
493
|
.k-result-waves { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0.2em 0.9em; margin: 0; padding-top: 0.5em; border-top: 1px solid var(--rule); }
|
|
468
494
|
.k-result-waves dt { font: 600 0.9em var(--font-mono); color: var(--muted); }
|
|
469
495
|
.k-result-waves dd { margin: 0; font-variant-numeric: tabular-nums; }
|
|
496
|
+
.k-result-waves dd.k-result-soon { color: var(--muted); font-style: italic; }
|
|
470
497
|
@media (max-width: 900px) and (min-width: 601px) { body.k-watch #bar { padding-right: 1em; flex-wrap: wrap; } body.k-watch #k-head { display: flex; flex-direction: column-reverse; } body.k-watch #k-tools { position: static; justify-content: flex-end; padding: 0.4em 1em 0; } }
|
|
471
498
|
.k-w-dora-foot { display: none; }
|
|
472
499
|
/* A phone: a short header, the graph, then the step and the approval under it; the rest stacks below, in the page's flow. */
|
|
@@ -502,6 +529,8 @@
|
|
|
502
529
|
<div id="k-what-pop" role="dialog" aria-label="What is this?" hidden></div>
|
|
503
530
|
</div>
|
|
504
531
|
<header id="bar" aria-live="polite"></header>
|
|
532
|
+
<!-- behold#571: event-help's story trail, the cycle's beats as chips. -->
|
|
533
|
+
<nav id="eh-trail" aria-label="This cycle" hidden></nav>
|
|
505
534
|
</div>
|
|
506
535
|
<div id="stage">
|
|
507
536
|
<nav id="runs-side" aria-label="pipeline runs"></nav>
|
|
@@ -528,6 +557,9 @@
|
|
|
528
557
|
<footer id="k-caption" aria-live="polite"></footer>
|
|
529
558
|
</div>
|
|
530
559
|
</div>
|
|
560
|
+
<!-- behold#571: event-help's tips and its modal, over everything. -->
|
|
561
|
+
<div id="eh-tips" aria-live="polite"></div>
|
|
562
|
+
<div id="eh-modals"></div>
|
|
531
563
|
<script type="module">
|
|
532
564
|
import { initTheme, KIOSK_THEME } from "/theme.js";
|
|
533
565
|
import { startKiosk } from "/kiosk.js";
|
|
@@ -538,6 +570,7 @@
|
|
|
538
570
|
{
|
|
539
571
|
bar: document.getElementById("bar"), frame: document.getElementById("view"), read: document.getElementById("k-read"), side: document.getElementById("runs-side"), main: document.getElementById("runs-main"), views: document.getElementById("views"),
|
|
540
572
|
tools: { what: document.querySelector(".k-what"), pop: document.getElementById("k-what-pop"), theme: document.getElementById("k-theme"), runsToggle: document.getElementById("k-runs-toggle"), mode: document.getElementById("k-mode") },
|
|
573
|
+
eh: { switchHost: document.getElementById("k-tools"), trailHost: document.getElementById("eh-trail"), tipsHost: document.getElementById("eh-tips"), modalHost: document.getElementById("eh-modals") },
|
|
541
574
|
watch: { layer: document.getElementById("k-watch"), caption: document.getElementById("k-caption"), callout: document.getElementById("k-callout"), drawer: document.getElementById("k-drawer"), badges: document.getElementById("k-badges"), result: document.getElementById("k-result") },
|
|
542
575
|
},
|
|
543
576
|
{ tool: pageTool(document) },
|
package/web/kiosk.js
CHANGED
|
@@ -15,9 +15,11 @@
|
|
|
15
15
|
|
|
16
16
|
import { CHANT_PANEL_STEPS, chantApprovalModel } from "./chant-pr-marks.js";
|
|
17
17
|
import { PICK_HOLD_MS, annMark, mergeRun, startRuns, statusIcon } from "./kiosk-runs.js";
|
|
18
|
-
import { MODES, MODE_STORE, badges as waveBadges, badgeTitle, captionModel, doraLine, modeStored, placeBeside, resultModel, shotFor, stepTone, tailLines } from "./kiosk-watch.js";
|
|
18
|
+
import { MODES, MODE_STORE, badges as waveBadges, badgeTitle, behindStep, steadyRun, captionModel, doraLine, modeStored, placeBeside, resultModel, shotFor, stepTone, tailLines } from "./kiosk-watch.js";
|
|
19
19
|
import { shotMessage } from "./kiosk-shot.js";
|
|
20
20
|
import { mountTrace } from "./kiosk-trace.js";
|
|
21
|
+
import { startEventHelp } from "./kiosk-event-help-ui.js";
|
|
22
|
+
import { miniWaterfall, phaseWords, waveTraces } from "./kiosk-wave-traces.js";
|
|
21
23
|
import { PANEL_STEPS, PANEL_TITLE, approvalModel, cycleRuns, digestHex, rowFacts } from "./kiosk-approval.js";
|
|
22
24
|
import { getThemeName, mountThemePicker, onThemeChange } from "./theme.js";
|
|
23
25
|
import { cssString, hoverCss, hoverFromMessage, hoverLinks, hoverMessage, isLightBg, rootSegments, rootText } from "./kiosk-roots.js";
|
|
@@ -118,9 +120,40 @@ export function aboutRows(demo) {
|
|
|
118
120
|
}
|
|
119
121
|
|
|
120
122
|
/** The strip: each stop, and whether it is done, current or ahead. A stalled cycle marks no stop current. */
|
|
121
|
-
export function stripStops(step) {
|
|
122
|
-
const at =
|
|
123
|
-
return
|
|
123
|
+
export function stripStops(step, strip = STRIP) {
|
|
124
|
+
const at = strip.findIndex((s) => s.steps.includes(step));
|
|
125
|
+
return strip.map((s, i) => ({ id: s.id, words: s.words, state: at < 0 ? "ahead" : i < at ? "done" : i === at ? (step === "failed" ? "failed" : "current") : "ahead" }));
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/** behold#571 (#631): the words of the strip's approval stop, a gate before the merge. */
|
|
129
|
+
export const APPROVAL_STOP = { id: "approval", words: "approval" };
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* behold#571 (#631): the strip in a scenario's own order, from the steps its
|
|
133
|
+
* tool's recorded cycle went through (/api/terragucci/cycles/<tool>). A wait
|
|
134
|
+
* for an approval before the merge (chant's pull-request loop gates the plan
|
|
135
|
+
* before it merges) is a stop of its own between "planned" and "merged"; after
|
|
136
|
+
* the merge it is part of the waves, as terragucci's waves are. Null when the
|
|
137
|
+
* steps say nothing, so the default strip stands.
|
|
138
|
+
*/
|
|
139
|
+
export function stripFromSteps(steps) {
|
|
140
|
+
if (!Array.isArray(steps) || !steps.length) return null;
|
|
141
|
+
const words = Object.fromEntries(STRIP.map((x) => [x.id, x.words]));
|
|
142
|
+
const stops = [];
|
|
143
|
+
let merged = false;
|
|
144
|
+
for (const step of steps) {
|
|
145
|
+
if (step === "merged") merged = true;
|
|
146
|
+
const id = ["pull-request", "planned", "merged", "applied", "reset"].includes(step) ? step : (step === "waiting" || step === "approved") && !merged ? APPROVAL_STOP.id : "waves";
|
|
147
|
+
let stop = stops.find((x) => x.id === id);
|
|
148
|
+
if (!stop) {
|
|
149
|
+
stop = { id, words: id === APPROVAL_STOP.id ? APPROVAL_STOP.words : words[id] || id, steps: [] };
|
|
150
|
+
stops.push(stop);
|
|
151
|
+
}
|
|
152
|
+
if (!stop.steps.includes(step)) stop.steps.push(step);
|
|
153
|
+
}
|
|
154
|
+
// A stop the default strip has and these steps never reached (the waves of a run that applied in one go) keeps its place.
|
|
155
|
+
for (const d of STRIP) if (!stops.some((x) => x.id === d.id)) stops.splice(Math.min(stops.length, STRIP.indexOf(d)), 0, { id: d.id, words: d.words, steps: d.steps.filter((st) => !stops.some((x) => x.steps.includes(st))) });
|
|
156
|
+
return stops;
|
|
124
157
|
}
|
|
125
158
|
|
|
126
159
|
/** Seconds from now until `at`, never below 0; null when there is no time. */
|
|
@@ -680,7 +713,7 @@ function drawBar(bar, s, now) {
|
|
|
680
713
|
over.appendChild(el("span", "k-kicker", head.kicker));
|
|
681
714
|
// The scenario's progress: the strip's stops, at the end of the line over the title.
|
|
682
715
|
const strip = el("ol", "k-strip");
|
|
683
|
-
for (const stop of stripStops(demo.step)) strip.appendChild(el("li", `k-stop k-${stop.state}`, stop.words));
|
|
716
|
+
for (const stop of stripStops(demo.step, s.strip || STRIP)) strip.appendChild(el("li", `k-stop k-${stop.state}`, stop.words));
|
|
684
717
|
over.appendChild(strip);
|
|
685
718
|
const title = el("h1", "k-title");
|
|
686
719
|
title.appendChild(el("span", "k-title-text", head.title));
|
|
@@ -809,7 +842,7 @@ function drawWatchHead(bar, s, now) {
|
|
|
809
842
|
place.appendChild(el("span", "k-cycle", cycleWords(demo, now)));
|
|
810
843
|
bar.appendChild(place);
|
|
811
844
|
const strip = el("ol", "k-strip");
|
|
812
|
-
for (const stop of stripStops(demo.step)) strip.appendChild(el("li", `k-stop k-${stop.state}`, stop.words));
|
|
845
|
+
for (const stop of stripStops(demo.step, s.strip || STRIP)) strip.appendChild(el("li", `k-stop k-${stop.state}`, stop.words));
|
|
813
846
|
bar.appendChild(strip);
|
|
814
847
|
if (s.watchHeld) {
|
|
815
848
|
const p = el("span", "k-w-held", heldWords(s.watchHeld.secs));
|
|
@@ -908,12 +941,55 @@ function drawResult(host, model, s) {
|
|
|
908
941
|
const counts = el("ul", "k-result-counts");
|
|
909
942
|
for (const c of model.counts) counts.appendChild(el("li", null, c));
|
|
910
943
|
host.appendChild(counts);
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
944
|
+
// behold#571: a row for every wave, in wave order: its trace as one bar of its phases (a click opens the whole trace),
|
|
945
|
+
// else its numbers, else a quiet line until they land. Never fewer rows than the count says.
|
|
946
|
+
const bars = new Map(miniWaterfall(s.waveTraces || {}).map((r) => [r.wave, r]));
|
|
947
|
+
const order = [...new Set([...model.waves.map((w) => w.wave), ...bars.keys()])].sort((x, y) => x - y);
|
|
948
|
+
if (order.length) {
|
|
949
|
+
const wf = el("div", "k-wf");
|
|
950
|
+
for (const n of order) {
|
|
951
|
+
const r = bars.get(n);
|
|
952
|
+
const w = model.waves.find((x) => x.wave === n);
|
|
953
|
+
if (!r) {
|
|
954
|
+
const row = el("div", "k-wf-row k-wf-plain");
|
|
955
|
+
row.append(el("span", "k-wf-wave", `Wave ${n}`), el("span", w && w.words ? "k-wf-words" : "k-wf-words k-result-soon", w && w.words ? w.words : NUMBERS_SOON));
|
|
956
|
+
wf.appendChild(row);
|
|
957
|
+
continue;
|
|
958
|
+
}
|
|
959
|
+
const row = el("button", "k-wf-row");
|
|
960
|
+
row.type = "button";
|
|
961
|
+
const held = r.bars.find((b) => b.phase === "held");
|
|
962
|
+
row.title = `${TRACE_OPEN_WORDS} · ${r.bars.map(phaseWords).join(" · ")}`;
|
|
963
|
+
const track = el("span", "k-wf-track");
|
|
964
|
+
for (const b of r.bars) {
|
|
965
|
+
const seg = el("i", `k-wf-seg k-wf-${b.phase}`);
|
|
966
|
+
seg.style.left = `${(b.at * 100).toFixed(2)}%`;
|
|
967
|
+
seg.style.width = `${Math.max(0.6, b.width * 100).toFixed(2)}%`;
|
|
968
|
+
seg.title = phaseWords(b);
|
|
969
|
+
track.appendChild(seg);
|
|
970
|
+
}
|
|
971
|
+
row.append(el("span", "k-wf-wave", `Wave ${r.wave}`), track, el("span", "k-wf-ms", held ? phaseWords(held) : r.words), el("span", "k-wf-go", TRACE_LINK_WORDS));
|
|
972
|
+
row.addEventListener("click", () => s.openWave && s.openWave(r.wave, "trace"));
|
|
973
|
+
wf.appendChild(row);
|
|
974
|
+
}
|
|
975
|
+
if (bars.size) {
|
|
976
|
+
const key = el("p", "k-wf-key");
|
|
977
|
+
for (const [cls, words] of PHASE_KEY) {
|
|
978
|
+
const k = el("span");
|
|
979
|
+
k.append(el("i", `k-wf-sw k-wf-${cls}`), words);
|
|
980
|
+
key.appendChild(k);
|
|
981
|
+
}
|
|
982
|
+
wf.appendChild(key);
|
|
983
|
+
}
|
|
984
|
+
host.appendChild(wf);
|
|
915
985
|
}
|
|
916
986
|
}
|
|
987
|
+
/** behold#571: a wave's row on the result card before its numbers land. */
|
|
988
|
+
export const NUMBERS_SOON = "its numbers land in a moment";
|
|
989
|
+
/** behold#571: the words of a trace's links, and the phases' key. */
|
|
990
|
+
export const TRACE_LINK_WORDS = "Trace";
|
|
991
|
+
export const TRACE_OPEN_WORDS = "Open this wave's trace";
|
|
992
|
+
export const PHASE_KEY = [["plan", "plan"], ["held", "held for an approval"], ["apply", "apply"], ["report", "report and upload"]];
|
|
917
993
|
|
|
918
994
|
/** behold#571: the head over the intro, in the card's box between scenarios, and the title of "What is this?". */
|
|
919
995
|
export const INTRO_HEAD = "What this demo is about";
|
|
@@ -1025,6 +1101,15 @@ function fade(b) {
|
|
|
1025
1101
|
b.classList.toggle("k-more-above", b.scrollTop > 1);
|
|
1026
1102
|
}
|
|
1027
1103
|
|
|
1104
|
+
/** behold#571 (#631): how often a tool's recorded step order is read again. */
|
|
1105
|
+
export const STRIP_REREAD_MS = 600_000;
|
|
1106
|
+
|
|
1107
|
+
/** behold#571: how often a run view that is behind the step is read again. */
|
|
1108
|
+
export const FRESH_RUN_MS = 4_000;
|
|
1109
|
+
/** behold#571: how often a cycle's run's traces are read again, and how long after a run ends they still are. */
|
|
1110
|
+
export const TRACE_POLL_MS = 8_000;
|
|
1111
|
+
export const TRACE_SETTLE_MS = 90_000;
|
|
1112
|
+
|
|
1028
1113
|
/** behold#571: the longest a reloaded frame loads out of sight before it swaps in anyway. */
|
|
1029
1114
|
export const FRAME_SWAP_MS = 30_000;
|
|
1030
1115
|
/** behold#571: how long the first frame load waits for demo.json, so it opens on the step's checkout. */
|
|
@@ -1040,7 +1125,7 @@ export const DEMO_POLL_MS = 3_000;
|
|
|
1040
1125
|
* countdown. When the roots the step is about change, move the framed view
|
|
1041
1126
|
* with a `behold:view` message; the frame takes them only from this origin.
|
|
1042
1127
|
*/
|
|
1043
|
-
export function startKiosk({ bar, frame, side, main, views, read = null, tools = null, watch = null }, { fetchJson = defaultFetch, now = () => new Date(), origin = location.origin, tool = null } = {}) {
|
|
1128
|
+
export function startKiosk({ bar, frame, side, main, views, read = null, tools = null, watch = null, eh = null }, { fetchJson = defaultFetch, now = () => new Date(), origin = location.origin, tool = null } = {}) {
|
|
1044
1129
|
const s = { demo: null, answer: null, progress: null, components: false, pick: null, view: "resources", roots: [], waves: [], light: false, hover: null, frameHover: null, held: null };
|
|
1045
1130
|
// behold#571: Watch or Inspect, the viewer's pick kept in their browser; Watch until they pick Inspect.
|
|
1046
1131
|
const shelf = typeof localStorage !== "undefined" ? (() => { try { return localStorage; } catch { return null; } })() : null;
|
|
@@ -1049,6 +1134,14 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
1049
1134
|
s.watchHeld = null;
|
|
1050
1135
|
s.boxes = null;
|
|
1051
1136
|
s.shot = null;
|
|
1137
|
+
// behold#571: event-help, started further down once what it reads is in place.
|
|
1138
|
+
let ehApi = null;
|
|
1139
|
+
// behold#571: the run view as the cycle has seen it (steadyRun), and when a read behind the step last asked again.
|
|
1140
|
+
let runMemo = null;
|
|
1141
|
+
let freshAt = 0;
|
|
1142
|
+
s.steady = null;
|
|
1143
|
+
// behold#571: each wave's trace, from Tempo (web/kiosk-wave-traces.js).
|
|
1144
|
+
s.waveTraces = {};
|
|
1052
1145
|
// behold#571: the frame loading out of sight while the shown one stays up (openFrame), and a message to both.
|
|
1053
1146
|
let buffer = null;
|
|
1054
1147
|
const post = (msg) => {
|
|
@@ -1133,7 +1226,9 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
1133
1226
|
}
|
|
1134
1227
|
const a = hoverLinks(s.hover, s.waves);
|
|
1135
1228
|
const b = hoverLinks(s.frameHover, s.waves);
|
|
1136
|
-
|
|
1229
|
+
// behold#571 event-help: an event's things light as a hover lights them, while its tip is up.
|
|
1230
|
+
const c = hoverLinks(s.hover || s.frameHover ? null : s.ehLit, s.waves);
|
|
1231
|
+
const links = { roots: [...new Set([...a.roots, ...b.roots, ...c.roots])], waves: [...new Set([...a.waves, ...b.waves, ...c.waves])] };
|
|
1137
1232
|
style.textContent = [
|
|
1138
1233
|
// behold#571: the held wave's job row, lit as the hold panel is; a hover's light comes after it and wins.
|
|
1139
1234
|
Number.isInteger(s.held) ? `.r-job[data-k-wave="${s.held}"] { ${HELD_JOB_RULE} }` : "",
|
|
@@ -1143,7 +1238,7 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
1143
1238
|
};
|
|
1144
1239
|
// behold#571: with nothing pointed at, the frame lights the held wave's box, as the hold panel and its job row are lit.
|
|
1145
1240
|
const tellHover = (h) => {
|
|
1146
|
-
const lit = h || (Number.isInteger(s.held) ? { wave: s.held } : null);
|
|
1241
|
+
const lit = h || s.ehLit || (Number.isInteger(s.held) ? { wave: s.held } : null);
|
|
1147
1242
|
post(hoverMessage(lit));
|
|
1148
1243
|
};
|
|
1149
1244
|
const hoverAt = (target) => {
|
|
@@ -1264,6 +1359,14 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
1264
1359
|
tellHover(s.hover);
|
|
1265
1360
|
}
|
|
1266
1361
|
whatText();
|
|
1362
|
+
// behold#571: the run view as the cycle has seen it, for the result card and the trail; a read behind the step asks again.
|
|
1363
|
+
const sr = steadyRun(runMemo, s.progress, s.demo && s.demo.demo);
|
|
1364
|
+
runMemo = sr.memo;
|
|
1365
|
+
s.steady = sr.progress;
|
|
1366
|
+
if (behindStep(s.demo && s.demo.demo, s.progress) && now().getTime() - freshAt > FRESH_RUN_MS) {
|
|
1367
|
+
freshAt = now().getTime();
|
|
1368
|
+
void progress(true);
|
|
1369
|
+
}
|
|
1267
1370
|
// behold#571: Watch's overlays, then the shot they leave room for.
|
|
1268
1371
|
holdTick();
|
|
1269
1372
|
drawWatch(shownNow());
|
|
@@ -1277,6 +1380,7 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
1277
1380
|
}
|
|
1278
1381
|
tellFrame(false);
|
|
1279
1382
|
tellShot(false);
|
|
1383
|
+
if (ehApi) ehApi.tick();
|
|
1280
1384
|
};
|
|
1281
1385
|
|
|
1282
1386
|
// ---------------------------------------------------------------------------
|
|
@@ -1287,6 +1391,9 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
1287
1391
|
let lastShot = null;
|
|
1288
1392
|
let drawerOpen = false;
|
|
1289
1393
|
let drawerHover = false;
|
|
1394
|
+
// behold#571: a wave the viewer opened the drawer on, its trace or its log; null follows the step.
|
|
1395
|
+
let drawerWave = null;
|
|
1396
|
+
let drawerView = null;
|
|
1290
1397
|
const isPhone = () => typeof matchMedia === "function" && matchMedia("(max-width: 600px)").matches;
|
|
1291
1398
|
const runsParent = main ? main.parentNode : null;
|
|
1292
1399
|
const runsNext = main ? main.nextSibling : null;
|
|
@@ -1325,6 +1432,8 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
1325
1432
|
draw();
|
|
1326
1433
|
};
|
|
1327
1434
|
s.followSteps = () => {
|
|
1435
|
+
drawerWave = null;
|
|
1436
|
+
drawerView = null;
|
|
1328
1437
|
watchHoldAt = null;
|
|
1329
1438
|
s.watchHeld = null;
|
|
1330
1439
|
lastShot = null;
|
|
@@ -1337,16 +1446,25 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
1337
1446
|
watchHoldAt = null;
|
|
1338
1447
|
s.watchHeld = null;
|
|
1339
1448
|
lastShot = null;
|
|
1449
|
+
// The steps lead again: a drawer the viewer opened on a wave folds away with the hold.
|
|
1450
|
+
drawerWave = null;
|
|
1451
|
+
drawerView = null;
|
|
1340
1452
|
return;
|
|
1341
1453
|
}
|
|
1342
1454
|
s.watchHeld = { secs: Math.ceil(left / 1000) };
|
|
1343
1455
|
}
|
|
1456
|
+
/** behold#571: the caption's top, or event-help's trail's when it sits over the caption. */
|
|
1457
|
+
const captionTop = (cap) => {
|
|
1458
|
+
const trail = eh && eh.trailHost;
|
|
1459
|
+
const r = trail && !trail.hidden && trail.getBoundingClientRect ? trail.getBoundingClientRect() : null;
|
|
1460
|
+
return r && r.height && r.top < cap.top ? r.top : cap.top;
|
|
1461
|
+
};
|
|
1344
1462
|
/** How much of the frame the overlays cover, in the frame's pixels: the caption below, and the callout, drawer or card beside the shot. */
|
|
1345
1463
|
const shotInsets = (shot) => {
|
|
1346
1464
|
if (!watch || !frame || isPhone() || !frame.getBoundingClientRect) return {};
|
|
1347
1465
|
const f = frame.getBoundingClientRect();
|
|
1348
1466
|
const cap = watch.caption.getBoundingClientRect();
|
|
1349
|
-
const bottom = Math.max(0, f.bottom - cap
|
|
1467
|
+
const bottom = Math.max(0, f.bottom - captionTop(cap)) + 16;
|
|
1350
1468
|
const side = shot.kind === "held" ? watch.callout : shot.kind === "active" ? watch.drawer : shot.kind === "result" ? watch.result : null;
|
|
1351
1469
|
// The result card sits right beside the graph (placeBeside's gap): an inset of its width and that gap centres the two together.
|
|
1352
1470
|
const right = side && !side.hidden && side.offsetWidth ? side.offsetWidth + (shot.kind === "result" ? 18 : 44) : 0;
|
|
@@ -1380,13 +1498,20 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
1380
1498
|
const call = shot.kind === "held" && gate;
|
|
1381
1499
|
watch.callout.hidden = !call;
|
|
1382
1500
|
if (call) drawCallout(watch.callout, s, hold, badgeTitle(nums[hold.wave]));
|
|
1383
|
-
const
|
|
1384
|
-
const
|
|
1501
|
+
const opened = drawerWave !== null;
|
|
1502
|
+
const drawer = shot.kind === "active" || opened;
|
|
1503
|
+
const drawerOn = opened ? drawerWave : shot.waves[0];
|
|
1504
|
+
const open = drawer && (drawerOpen || drawerHover || opened);
|
|
1385
1505
|
watch.drawer.hidden = !drawer;
|
|
1386
1506
|
watch.drawer.classList.toggle("k-open", open);
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
const
|
|
1507
|
+
watch.drawer.classList.toggle("k-trace-only", opened && drawerView === "trace");
|
|
1508
|
+
// A drawer opened on a wave's trace is headed by that wave's job, not the step's.
|
|
1509
|
+
const tr = opened && drawerView === "trace" ? s.waveTraces[drawerOn] : null;
|
|
1510
|
+
const tail = tr ? { job: `Wave ${drawerOn} · ${tr.job}`, status: tr.trace.result === "failed" || tr.trace.result === "refused" ? "failure" : tr.trace.result === "waiting" ? "waiting" : "success", lines: [] } : tailLines(runsApi && runsApi.run ? runsApi.run.doc : null);
|
|
1511
|
+
if (drawer) drawDrawer(watch.drawer, tail, badgeTitle(nums[drawerOn]), open);
|
|
1512
|
+
if (drawer) traceDrawer(d, drawerOn);
|
|
1513
|
+
// A drawer the viewer opened on a wave takes the card's place beside the graph until it folds.
|
|
1514
|
+
const result = shot.kind === "result" && !opened ? resultModel(d, s.metrics, s.steady) : null;
|
|
1390
1515
|
watch.result.hidden = !result;
|
|
1391
1516
|
if (result) drawResult(watch.result, result, s);
|
|
1392
1517
|
// On a phone the delivery numbers stack under the rest, where the header has no room for them.
|
|
@@ -1397,13 +1522,20 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
1397
1522
|
}
|
|
1398
1523
|
foot.textContent = doraLine(s.metrics) || "";
|
|
1399
1524
|
watch.badges.replaceChildren();
|
|
1400
|
-
const skip = call ? hold.wave : drawer ?
|
|
1525
|
+
const skip = call ? hold.wave : drawer ? drawerOn : null;
|
|
1401
1526
|
// At applied the result card lists every wave's numbers, so the boxes carry none.
|
|
1402
1527
|
for (const [n, words] of shot.kind === "result" && result ? [] : Object.entries(nums)) {
|
|
1403
1528
|
if (Number(n) === skip) continue;
|
|
1404
1529
|
const b = el("span", "k-badge", words);
|
|
1405
1530
|
b.dataset.kWave = n;
|
|
1406
1531
|
b.title = `Wave ${n}: ${badgeTitle(words)}`;
|
|
1532
|
+
// behold#571: a wave whose trace Tempo has opens it from its numbers.
|
|
1533
|
+
if (s.waveTraces[n]) {
|
|
1534
|
+
b.classList.add("k-badge-trace");
|
|
1535
|
+
b.title = `${b.title} · ${TRACE_OPEN_WORDS}`;
|
|
1536
|
+
b.appendChild(el("span", "k-badge-go", TRACE_LINK_WORDS));
|
|
1537
|
+
b.addEventListener("click", () => s.openWave(Number(n), "trace"));
|
|
1538
|
+
}
|
|
1407
1539
|
watch.badges.appendChild(b);
|
|
1408
1540
|
}
|
|
1409
1541
|
placeWatch();
|
|
@@ -1418,9 +1550,12 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
1418
1550
|
const host = watch.drawer.querySelector("#k-traces");
|
|
1419
1551
|
const runDoc = runsApi && runsApi.run ? runsApi.run.doc : null;
|
|
1420
1552
|
const w = (s.waves || []).find((x) => x.wave === wave);
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1553
|
+
const tr = s.waveTraces[wave];
|
|
1554
|
+
if (!host || !d || !d.repo || (!tr && (!runDoc || !w))) return;
|
|
1555
|
+
// The wave's own trace when Tempo has it (its run and job: a resumed run applies waves in one job), else its job in the drawer's run.
|
|
1556
|
+
// The wave's own attempt of its job: a resumed run's job applies several waves, and a wave may run twice.
|
|
1557
|
+
const target = tr ? { project: d.repo, run: tr.run, job: tr.job, wave, start: tr.trace.start } : { project: d.repo, run: String(runDoc.id), job: w.job, wave, start: null };
|
|
1558
|
+
const key = `${target.project}|${target.run}|${target.job}|${target.wave}|${target.start}`;
|
|
1424
1559
|
if (trace && trace.key === key) return;
|
|
1425
1560
|
if (trace) trace.api.update(target);
|
|
1426
1561
|
else trace = { api: mountTrace(host, { ...target, fetchJson: fetchServed }) };
|
|
@@ -1436,7 +1571,7 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
1436
1571
|
}
|
|
1437
1572
|
const L = watch.layer.getBoundingClientRect();
|
|
1438
1573
|
const F = frame.getBoundingClientRect();
|
|
1439
|
-
const capTop = watch.caption.getBoundingClientRect()
|
|
1574
|
+
const capTop = captionTop(watch.caption.getBoundingClientRect()) - L.top;
|
|
1440
1575
|
const view = { x: F.left - L.left, y: F.top - L.top, w: F.width, h: capTop - (F.top - L.top) };
|
|
1441
1576
|
const boxOf = (n) => {
|
|
1442
1577
|
const waves = (s.boxes && s.boxes.waves) || {};
|
|
@@ -1466,7 +1601,7 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
1466
1601
|
taken.push({ x: p.x, y: p.y, x2: p.x + size.w, y2: p.y + size.h });
|
|
1467
1602
|
};
|
|
1468
1603
|
put(watch.callout, s.held);
|
|
1469
|
-
put(watch.drawer, s.shot && s.shot.waves[0]);
|
|
1604
|
+
put(watch.drawer, drawerWave !== null ? drawerWave : s.shot && s.shot.waves[0]);
|
|
1470
1605
|
put(watch.result, null); // beside the whole graph
|
|
1471
1606
|
const hits = (r) => taken.some((t) => r.x < t.x2 && r.x2 > t.x && r.y < t.y2 && r.y2 > t.y);
|
|
1472
1607
|
for (const b of watch.badges.children) {
|
|
@@ -1494,6 +1629,7 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
1494
1629
|
if (e.data.type === "behold:viewer") return holdShot();
|
|
1495
1630
|
if (e.data.type !== "behold:boxes") return;
|
|
1496
1631
|
s.boxes = e.data;
|
|
1632
|
+
if (ehApi) ehApi.follow();
|
|
1497
1633
|
if (queued) return;
|
|
1498
1634
|
queued = true;
|
|
1499
1635
|
requestAnimationFrame(() => {
|
|
@@ -1510,6 +1646,13 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
1510
1646
|
const head = watch.drawer && watch.drawer.querySelector(".k-drawer-head");
|
|
1511
1647
|
if (head) {
|
|
1512
1648
|
head.addEventListener("click", () => {
|
|
1649
|
+
// A drawer the viewer opened on a wave folds away; the step's drawer folds to its last lines.
|
|
1650
|
+
if (drawerWave !== null) {
|
|
1651
|
+
drawerWave = null;
|
|
1652
|
+
drawerView = null;
|
|
1653
|
+
drawerOpen = false;
|
|
1654
|
+
return draw();
|
|
1655
|
+
}
|
|
1513
1656
|
drawerOpen = !drawerOpen;
|
|
1514
1657
|
holdShot();
|
|
1515
1658
|
});
|
|
@@ -1526,6 +1669,155 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
1526
1669
|
});
|
|
1527
1670
|
}
|
|
1528
1671
|
}
|
|
1672
|
+
// ---------------------------------------------------------------------------
|
|
1673
|
+
// behold#571: event-help, the "Tips" (web/kiosk-event-help-ui.js).
|
|
1674
|
+
s.ehLit = null;
|
|
1675
|
+
ehApi = eh && typeof document !== "undefined"
|
|
1676
|
+
? startEventHelp({
|
|
1677
|
+
doc: document,
|
|
1678
|
+
store: shelf,
|
|
1679
|
+
switchHost: eh.switchHost,
|
|
1680
|
+
trailHost: eh.trailHost,
|
|
1681
|
+
tipsHost: eh.tipsHost,
|
|
1682
|
+
modalHost: eh.modalHost,
|
|
1683
|
+
now: () => now().getTime(),
|
|
1684
|
+
shown: () => shownNow().getTime(),
|
|
1685
|
+
light: (lit) => {
|
|
1686
|
+
s.ehLit = lit;
|
|
1687
|
+
glow();
|
|
1688
|
+
tellHover(s.hover);
|
|
1689
|
+
},
|
|
1690
|
+
openTrace: (wave) => s.openWave(wave, "trace"),
|
|
1691
|
+
// The modal shows behold's own approval panel, as the kiosk draws it.
|
|
1692
|
+
panel: (kind) => (kind === "held" && s.approval ? approvalPanel(s.approval, s) : null),
|
|
1693
|
+
get: () => {
|
|
1694
|
+
const d = s.demo && s.demo.demo;
|
|
1695
|
+
if (!d) return null;
|
|
1696
|
+
const appr = pendingApproval(d, s.progress);
|
|
1697
|
+
return {
|
|
1698
|
+
demo: d,
|
|
1699
|
+
answer: s.answer,
|
|
1700
|
+
progress: s.steady,
|
|
1701
|
+
runDoc: runsApi && runsApi.run ? runsApi.run.doc : null,
|
|
1702
|
+
// The cycle's runs the approval panel reads, for the failures of runs the pane no longer shows.
|
|
1703
|
+
runDocs: ap.list,
|
|
1704
|
+
approval: s.approval && Array.isArray(s.approval.rows) ? s.approval : null,
|
|
1705
|
+
metrics: s.metrics,
|
|
1706
|
+
waves: s.waves,
|
|
1707
|
+
boxes: s.boxes,
|
|
1708
|
+
frame,
|
|
1709
|
+
watch: s.watchMode,
|
|
1710
|
+
caption: watch ? watch.caption : null,
|
|
1711
|
+
replay: s.mode === "replay",
|
|
1712
|
+
approveLine: appr ? appr.approve : null,
|
|
1713
|
+
label: d.label || "",
|
|
1714
|
+
result: resultModel(d, s.metrics, s.steady),
|
|
1715
|
+
waveTraces: s.waveTraces,
|
|
1716
|
+
strip: s.stripReady() ? s.strip : null,
|
|
1717
|
+
stripReady: s.stripReady(),
|
|
1718
|
+
};
|
|
1719
|
+
},
|
|
1720
|
+
})
|
|
1721
|
+
: null;
|
|
1722
|
+
|
|
1723
|
+
/**
|
|
1724
|
+
* behold#571: open a wave's trace (or its log) from where its numbers are:
|
|
1725
|
+
* its badge, the result card, its box, a tip. In Watch, the drawer on its
|
|
1726
|
+
* box; in Inspect, the job pane on its job.
|
|
1727
|
+
*/
|
|
1728
|
+
s.openWave = (n, view = "trace") => {
|
|
1729
|
+
const tr = s.waveTraces[n];
|
|
1730
|
+
const v = view === "trace" && tr ? "trace" : "log";
|
|
1731
|
+
const w = (s.waves || []).find((x) => x.wave === n);
|
|
1732
|
+
if (!s.watchMode) {
|
|
1733
|
+
if (runsApi && runsApi.showJob && (tr || w)) runsApi.showJob(tr && v === "trace" ? tr.run : runsApi.run && runsApi.run.doc ? runsApi.run.doc.id : null, tr && v === "trace" ? tr.job : w.job, v === "trace" ? "trace" : "steps");
|
|
1734
|
+
return;
|
|
1735
|
+
}
|
|
1736
|
+
drawerWave = n;
|
|
1737
|
+
drawerView = v;
|
|
1738
|
+
drawerOpen = true;
|
|
1739
|
+
if (v === "log" && w && runsApi && runsApi.showJob) runsApi.showJob(runsApi.run && runsApi.run.doc ? runsApi.run.doc.id : null, w.job, "steps");
|
|
1740
|
+
holdShot();
|
|
1741
|
+
};
|
|
1742
|
+
if (typeof window !== "undefined" && window.addEventListener) {
|
|
1743
|
+
window.addEventListener("message", (e) => {
|
|
1744
|
+
if (e.origin !== origin || !frame || e.source !== frame.contentWindow || !e.data || e.data.type !== "behold:wave") return;
|
|
1745
|
+
if (Number.isInteger(e.data.wave)) s.openWave(e.data.wave, "trace");
|
|
1746
|
+
});
|
|
1747
|
+
}
|
|
1748
|
+
// behold#571: the cycle's runs' traces, read while the waves run and for a while after each run ends (Tempo has a job's spans seconds to a minute after it finishes).
|
|
1749
|
+
const traceReads = new Map();
|
|
1750
|
+
let tracesBusy = false;
|
|
1751
|
+
let tracesCycle = null;
|
|
1752
|
+
const readTraces = async () => {
|
|
1753
|
+
const d = s.demo && s.demo.demo;
|
|
1754
|
+
// A new cycle starts with none: the last one's traces are not this one's.
|
|
1755
|
+
if (d && d.cycle !== tracesCycle) {
|
|
1756
|
+
tracesCycle = d.cycle;
|
|
1757
|
+
s.waveTraces = {};
|
|
1758
|
+
drawerWave = null;
|
|
1759
|
+
drawerView = null;
|
|
1760
|
+
}
|
|
1761
|
+
if (tracesBusy || !d || !d.repo || !runsApi || !runsApi.index || !runsApi.index.doc) return;
|
|
1762
|
+
if (!["merged", "applying", "waiting", "approved", "failed", "resumed", "applied"].includes(d.step)) return;
|
|
1763
|
+
tracesBusy = true;
|
|
1764
|
+
try {
|
|
1765
|
+
const t = now().getTime();
|
|
1766
|
+
for (const r of cycleRuns(runsApi.index.doc.runs, d)) {
|
|
1767
|
+
if (r.status === "queued") continue;
|
|
1768
|
+
const key = `${d.cycle}|${r.id}`;
|
|
1769
|
+
const had = traceReads.get(key);
|
|
1770
|
+
const ended = r.ended_at ? Date.parse(r.ended_at) : null;
|
|
1771
|
+
// Done: ended a while ago, and read once since.
|
|
1772
|
+
if (had && ended && t - ended > TRACE_SETTLE_MS && had.at > ended + TRACE_SETTLE_MS) continue;
|
|
1773
|
+
if (had && t - had.at < TRACE_POLL_MS) continue;
|
|
1774
|
+
const a = await fetchServed(`/api/traces?project=${encodeURIComponent(d.repo)}&run=${encodeURIComponent(r.id)}`);
|
|
1775
|
+
traceReads.set(key, { at: t, answer: a && !a.error ? a : had ? had.answer : null });
|
|
1776
|
+
}
|
|
1777
|
+
const mine = [...traceReads].filter(([k]) => k.startsWith(`${d.cycle}|`)).map(([, v]) => v.answer);
|
|
1778
|
+
const next = waveTraces(mine);
|
|
1779
|
+
if (JSON.stringify(Object.keys(next).map((k) => [k, next[k].run, next[k].trace.start])) !== JSON.stringify(Object.keys(s.waveTraces).map((k) => [k, s.waveTraces[k].run, s.waveTraces[k].trace.start]))) {
|
|
1780
|
+
s.waveTraces = next;
|
|
1781
|
+
draw();
|
|
1782
|
+
}
|
|
1783
|
+
} finally {
|
|
1784
|
+
tracesBusy = false;
|
|
1785
|
+
}
|
|
1786
|
+
};
|
|
1787
|
+
setInterval(() => void readTraces(), 2_000);
|
|
1788
|
+
|
|
1789
|
+
// behold#571 (#631): the strip in the running tool's own order, from its recorded cycle's steps; the default until it is read.
|
|
1790
|
+
const strips = new Map();
|
|
1791
|
+
s.strip = null;
|
|
1792
|
+
/** Whether the running tool's step order has been read (or there is none to read), so the story can be told in it. */
|
|
1793
|
+
s.stripReady = () => {
|
|
1794
|
+
const d = s.demo && s.demo.demo;
|
|
1795
|
+
const t = vendor ? tool : d && typeof d.tool === "string" ? d.tool : null;
|
|
1796
|
+
const r = t ? strips.get(t) : null;
|
|
1797
|
+
if (r && r.done) s.strip = r.strip;
|
|
1798
|
+
return !t || !!(r && r.done);
|
|
1799
|
+
};
|
|
1800
|
+
const readStrip = async () => {
|
|
1801
|
+
const d = s.demo && s.demo.demo;
|
|
1802
|
+
const t = vendor ? tool : d && typeof d.tool === "string" ? d.tool : null;
|
|
1803
|
+
if (!t) return;
|
|
1804
|
+
const had = strips.get(t);
|
|
1805
|
+
if (had && now().getTime() - had.at < STRIP_REREAD_MS) {
|
|
1806
|
+
if (s.strip !== had.strip) {
|
|
1807
|
+
s.strip = had.strip;
|
|
1808
|
+
draw();
|
|
1809
|
+
}
|
|
1810
|
+
return;
|
|
1811
|
+
}
|
|
1812
|
+
strips.set(t, { at: now().getTime(), strip: had ? had.strip : null, done: had ? had.done : false });
|
|
1813
|
+
const a = await fetchServed(`/api/terragucci/cycles/${encodeURIComponent(t)}`);
|
|
1814
|
+
const strip = a && a.cycle && Array.isArray(a.cycle.steps) ? stripFromSteps(a.cycle.steps.map((x) => x.step)) : null;
|
|
1815
|
+
strips.set(t, { at: now().getTime(), strip: strip || (had ? had.strip : null), done: true });
|
|
1816
|
+
s.strip = strips.get(t).strip;
|
|
1817
|
+
draw();
|
|
1818
|
+
};
|
|
1819
|
+
setInterval(() => void readStrip(), 2_000);
|
|
1820
|
+
|
|
1529
1821
|
s.setMetrics = (m) => {
|
|
1530
1822
|
s.metrics = m;
|
|
1531
1823
|
draw();
|
package/web/kiosk.test.js
CHANGED
|
@@ -481,3 +481,21 @@ describe("the lead block's step rail (behold#571)", () => {
|
|
|
481
481
|
expect(["waiting", "failed", "stalled", "applied", "applying", "planned", "resumed", "reset"].map(stepTone)).toEqual(["wait", "bad", "bad", "ok", "busy", "busy", "busy", "idle"]);
|
|
482
482
|
});
|
|
483
483
|
});
|
|
484
|
+
|
|
485
|
+
describe("kiosk: the strip in a scenario's own order (behold#571, #631)", async () => {
|
|
486
|
+
const { stripFromSteps, stripStops, STRIP } = await import("./kiosk.js");
|
|
487
|
+
it("puts chant's approval between planned and merged, and lights it while the plan waits", () => {
|
|
488
|
+
const chant = stripFromSteps(["pull-request", "planned", "waiting", "approved", "merged", "applying", "applied", "reset"]);
|
|
489
|
+
expect(chant.map((x) => x.words)).toEqual(["pull request", "planned", "approval", "merged", "waves", "applied", "reset"]);
|
|
490
|
+
expect(stripStops("waiting", chant).find((x) => x.state === "current").words).toBe("approval");
|
|
491
|
+
expect(stripStops("applying", chant).find((x) => x.state === "current").words).toBe("waves");
|
|
492
|
+
});
|
|
493
|
+
it("keeps terragucci's waves, a hold after the merge part of them, and the default strip without steps", () => {
|
|
494
|
+
const tg = stripFromSteps(["pull-request", "planned", "merged", "applying", "failed", "resumed", "waiting", "approved", "resumed", "applied", "reset"]);
|
|
495
|
+
expect(tg.map((x) => x.id)).toEqual(STRIP.map((x) => x.id));
|
|
496
|
+
expect(stripStops("waiting", tg).find((x) => x.state === "current").words).toBe("waves");
|
|
497
|
+
expect(stripFromSteps([])).toBeNull();
|
|
498
|
+
// A run that applied in one go (no wait at all) still shows its waves stop.
|
|
499
|
+
expect(stripFromSteps(["pull-request", "planned", "merged", "applying", "applied", "reset"]).map((x) => x.id)).toEqual(STRIP.map((x) => x.id));
|
|
500
|
+
});
|
|
501
|
+
});
|