@intentius/behold 0.29.18 → 0.29.19
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/kiosk-approval.js +4 -2
- package/web/kiosk-approval.test.js +2 -0
- package/web/kiosk-vendor.test.js +11 -5
- package/web/kiosk.html +112 -58
- package/web/kiosk.js +258 -73
- package/web/kiosk.test.js +105 -23
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intentius/behold",
|
|
3
|
-
"version": "0.29.
|
|
3
|
+
"version": "0.29.19",
|
|
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/kiosk-approval.js
CHANGED
|
@@ -86,7 +86,7 @@ function lineTime(run, f) {
|
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
/**
|
|
89
|
-
* The panel's model: `{ wave, digest, rows: [{ id, label, state, … }] }`, or
|
|
89
|
+
* The panel's model: `{ wave, digest, run, rows: [{ id, label, state, … }] }`, or
|
|
90
90
|
* null when the step is not one the panel shows or no wave of the cycle
|
|
91
91
|
* held. `state` is `lit`, `going` (begun, not done) or `dim`. Inputs:
|
|
92
92
|
*
|
|
@@ -178,7 +178,9 @@ export function approvalModel({ demo, runs = [], history = null, lifecycle = nul
|
|
|
178
178
|
});
|
|
179
179
|
} else Object.assign(spRow, { state: "dim", text: `Once wave ${wave} applies, this approval is used up for good.` });
|
|
180
180
|
|
|
181
|
-
|
|
181
|
+
// behold#571: the run the hold is in now, for the panel's head: the resume once there is one, else the run that held the wave.
|
|
182
|
+
const run = resume ? resume.id : holdRun ? holdRun.id : null;
|
|
183
|
+
return { wave, digest, run, rows: inferBack([reqRow, apRow, rsRow, spRow], { wave, gateRead, spentLine, resumeRuns }) };
|
|
182
184
|
}
|
|
183
185
|
|
|
184
186
|
/** The words a row lit only because a later one is, by row. Each says it was inferred; none invents a time. */
|
|
@@ -115,6 +115,8 @@ describe("the approval panel (behold#571)", () => {
|
|
|
115
115
|
const m = approvalModel({ demo: demo("applied"), runs: [run(444), resumeless], now: Date.parse("2026-10-15T04:11:00Z") });
|
|
116
116
|
expect(m.rows.map((r) => r.state)).toEqual(["lit", "lit", "lit", "lit"]);
|
|
117
117
|
expect(m.rows[2]).toMatchObject({ inferred: true, runId: 445, at: null });
|
|
118
|
+
// behold#571: the run the hold panel's head names: the run that held the wave, with no resume run copied.
|
|
119
|
+
expect(m.run).toBe(444);
|
|
118
120
|
expect(rowFacts(m.rows[2])).toEqual(["inferred from the rows after it", "run #445"]);
|
|
119
121
|
expect(m.rows[1]).toMatchObject({ inferred: true, text: "terragucci-admin approved this plan." });
|
|
120
122
|
expect(inferBack([{ id: "requested", state: "dim" }, { id: "approved", state: "dim" }], { wave: 2 }).map((r) => r.state)).toEqual(["dim", "dim"]);
|
package/web/kiosk-vendor.test.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { describe, expect, it } from "vitest";
|
|
3
3
|
import { VENDOR_TOOLS } from "../src/terragucci-demo.ts";
|
|
4
4
|
import { logRows } from "./kiosk-runs.js";
|
|
5
|
-
import { NO_GRAPH_WORDS, SCENARIOS,
|
|
5
|
+
import { NO_GRAPH_WORDS, SCENARIOS, readingRows, scenarioHead } from "./kiosk.js";
|
|
6
6
|
import {
|
|
7
7
|
REPLAY_LAST_HOLD_MS,
|
|
8
8
|
RUNS_WITH,
|
|
@@ -145,7 +145,7 @@ describe("the branding table (behold#571)", () => {
|
|
|
145
145
|
it("says on each page who makes the tool and that they don't endorse the demo, naming no other tool or maker", () => {
|
|
146
146
|
for (const tool of VENDOR_TOOLS) {
|
|
147
147
|
const v = VENDORS[tool];
|
|
148
|
-
const words = [v.name, ...creditLines(tool).map((l) => l.map((s) => s.text).join("")), ...Object.values(notRunWords(v)),
|
|
148
|
+
const words = [v.name, ...creditLines(tool).map((l) => l.map((s) => s.text).join("")), ...Object.values(notRunWords(v)), ...readingRows("components", tool).map((r) => r.words), ...readingRows("resources", tool).map((r) => r.words)];
|
|
149
149
|
for (const w of words) expect(namesOther(w, tool), `${tool}: ${w}`).toBe(false);
|
|
150
150
|
// choudoufu and chant are ours: their credits say so instead.
|
|
151
151
|
if (tool !== "choudoufu" && tool !== "chant") expect(v.credit).toMatch(/(does not|don't) endorse this demo\./);
|
|
@@ -153,7 +153,7 @@ describe("the branding table (behold#571)", () => {
|
|
|
153
153
|
expect(VENDORS.choudoufu.credit).toMatch(/AWS and Kubernetes/);
|
|
154
154
|
expect(VENDORS.choudoufu.credit).not.toMatch(/experimental/i);
|
|
155
155
|
});
|
|
156
|
-
it("links each name in the
|
|
156
|
+
it("links each name in the credit, the tool's to its site and OpenTofu's where its scenarios run on it", () => {
|
|
157
157
|
const tf = creditLines("terraform");
|
|
158
158
|
expect(tf.flat().filter((s) => s.url).map((s) => [s.text, s.url])).toEqual([
|
|
159
159
|
["Terraform", VENDORS.terraform.url],
|
|
@@ -228,7 +228,7 @@ describe("a tool's page, drawn (behold#571)", () => {
|
|
|
228
228
|
};
|
|
229
229
|
const text = (n) => (n.children && n.children.length ? n.children.map(text).join("") : n.textContent || "");
|
|
230
230
|
const all = (n) => [n, ...(n.children || []).flatMap(all)];
|
|
231
|
-
it("puts the tool's name before the scenario, the banner over it, and the credit
|
|
231
|
+
it("puts the tool's name before the scenario, the banner over it, and the credit at the lead block's foot, with no count", async () => {
|
|
232
232
|
const { renderKiosk } = await import("./kiosk.js");
|
|
233
233
|
const was = globalThis.document;
|
|
234
234
|
globalThis.document = fakeDocument();
|
|
@@ -253,7 +253,11 @@ describe("a tool's page, drawn (behold#571)", () => {
|
|
|
253
253
|
expect(text(bar2)).toContain("Big Terraform setups");
|
|
254
254
|
// No graph of this repo here: one line in the header says so.
|
|
255
255
|
expect(all(bar).filter((n) => n.className === "k-nograph-note").map(text)).toEqual([NO_GRAPH_WORDS]);
|
|
256
|
-
|
|
256
|
+
// behold#571: no footer: the credit is the lead block's last line.
|
|
257
|
+
const lead = all(bar).find((n) => n.className === "k-left k-lead");
|
|
258
|
+
expect(lead.children[lead.children.length - 1].className).toBe("k-credits");
|
|
259
|
+
expect(all(bar).filter((n) => n.className === "k-credit").map(text)).toEqual([VENDORS.terragrunt.credit]);
|
|
260
|
+
expect(foot.children).toEqual([]);
|
|
257
261
|
} finally {
|
|
258
262
|
globalThis.document = was;
|
|
259
263
|
}
|
|
@@ -283,6 +287,8 @@ describe("a tool's page, drawn (behold#571)", () => {
|
|
|
283
287
|
expect(text(bar)).toContain("This scenario hasn't run yet");
|
|
284
288
|
const brand = all(bar).find((n) => n.className === "k-brand");
|
|
285
289
|
expect(brand.href).toBe(VENDORS.choudoufu.url);
|
|
290
|
+
// The credit shows on every tool page, before its first cycle too.
|
|
291
|
+
expect(all(bar).filter((n) => n.className === "k-credit").map(text)).toEqual([VENDORS.choudoufu.credit]);
|
|
286
292
|
expect(all(brand).some((n) => n.className === "k-brand-logo" && n.src === VENDORS.choudoufu.logo.src)).toBe(true);
|
|
287
293
|
} finally {
|
|
288
294
|
globalThis.document = was;
|
package/web/kiosk.html
CHANGED
|
@@ -26,10 +26,11 @@
|
|
|
26
26
|
/* behold#571: the kiosk's text is the softened ink, its secondary text and state colours the ones held legible on every surface. */
|
|
27
27
|
body { --fg: var(--soft); --muted: var(--muted-ink); --managed: var(--managed-ink); --foreign: var(--foreign-ink); --pending: var(--pending-ink); --degraded: var(--degraded-ink); --runtime: var(--runtime-ink); --zebra-row: color-mix(in srgb, var(--zebra) 3.5%, transparent); }
|
|
28
28
|
/* #569 step 3: one screen. The bar is the narration, the frame is
|
|
29
|
-
behold's own view of the change
|
|
30
|
-
|
|
29
|
+
behold's own view of the change. behold#571: no footer; the plan's
|
|
30
|
+
facts are in the lead block, the legend over the graph. Sizes follow
|
|
31
|
+
the screen's width, so a TV reads it from across a room. */
|
|
31
32
|
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); font: clamp(13px, 0.82vw, 20px)/1.4 var(--font-ui); overflow: hidden; }
|
|
32
|
-
body { display: grid; grid-template-rows: auto minmax(0, 1fr)
|
|
33
|
+
body { display: grid; grid-template-rows: auto minmax(0, 1fr); }
|
|
33
34
|
#k-head { position: relative; }
|
|
34
35
|
/* #569: the pipeline's runs (left), the selected run's jobs, steps and
|
|
35
36
|
log (middle), behold's view of the change (right). */
|
|
@@ -39,8 +40,9 @@
|
|
|
39
40
|
#runs-main { overflow: hidden; display: flex; flex-direction: column; min-height: 0; background: var(--surface-pane-a); border-radius: 6px 6px 0 0; }
|
|
40
41
|
#k-runs-toggle { display: none; }
|
|
41
42
|
.r-run:nth-child(even of .r-run), .r-job:nth-child(even of .r-job), .r-log-line:nth-child(even of .r-log-line) { background: var(--zebra-row); }
|
|
42
|
-
|
|
43
|
-
.r-side-
|
|
43
|
+
/* behold#571: the panes step back from the lead block: quieter heads, lighter rules. */
|
|
44
|
+
.r-side-head { padding: 0.7em 1em 0.4em; }
|
|
45
|
+
.r-side-title { font-weight: 600; font-size: 0.95em; color: var(--muted); }
|
|
44
46
|
.r-side-note { color: var(--muted); font-size: 0.82em; margin-top: 0.15em; }
|
|
45
47
|
.r-runs { list-style: none; margin: 0; padding: 0 0 1em; }
|
|
46
48
|
.r-group { font: 600 0.72em var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding: 0.7em 1em 0.25em; }
|
|
@@ -55,13 +57,13 @@
|
|
|
55
57
|
.r-word.r-idle { color: var(--muted); }
|
|
56
58
|
@media (prefers-reduced-motion: no-preference) { .r-spin { animation: r-spin 1s linear infinite; } }
|
|
57
59
|
@keyframes r-spin { to { transform: rotate(360deg); } }
|
|
58
|
-
.r-head { padding: 0.
|
|
59
|
-
.r-head-title { display: flex; gap: 0.5em; align-items: center; font-weight:
|
|
60
|
+
.r-head { padding: 0.7em 1em 0.5em; border-bottom: 1px solid color-mix(in srgb, var(--rule) 55%, transparent); }
|
|
61
|
+
.r-head-title { display: flex; gap: 0.5em; align-items: center; font-weight: 600; font-size: 1em; }
|
|
60
62
|
.r-head-title .r-icon { margin: 0; }
|
|
61
63
|
.r-head-sub { color: var(--fg); font-size: 0.88em; margin-top: 0.15em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
62
64
|
.r-head-meta { color: var(--muted); font-size: 0.82em; }
|
|
63
65
|
.r-label { font: 600 0.7em var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding: 0.6em 1em 0; }
|
|
64
|
-
.r-jobs { list-style: none; margin: 0; padding: 0.3em 0 0.5em; border-bottom: 1px solid var(--rule); }
|
|
66
|
+
.r-jobs { list-style: none; margin: 0; padding: 0.3em 0 0.5em; border-bottom: 1px solid color-mix(in srgb, var(--rule) 55%, transparent); }
|
|
65
67
|
.r-job { display: flex; gap: 0.5em; align-items: center; padding: 0.22em 1em 0.22em calc(1em + var(--depth, 0) * 0.9em); cursor: pointer; }
|
|
66
68
|
.r-job .r-icon { margin: 0; }
|
|
67
69
|
.r-job.r-selected { background: var(--active); }
|
|
@@ -117,7 +119,7 @@
|
|
|
117
119
|
.r-flash { background: color-mix(in srgb, var(--focus) 30%, transparent) !important; }
|
|
118
120
|
@media (prefers-reduced-motion: no-preference) { .r-flash { transition: background 0.6s; } }
|
|
119
121
|
/* behold#571: folded, whole lines only (fitFeatures); opened, it scrolls inside a bounded box. */
|
|
120
|
-
.r-feats { padding: 0.1em 1em 0.45em; border-bottom: 1px solid var(--rule); }
|
|
122
|
+
.r-feats { padding: 0.1em 1em 0.45em; border-bottom: 1px solid color-mix(in srgb, var(--rule) 55%, transparent); }
|
|
121
123
|
.r-feats-open .r-feats-list { max-height: 12em; overflow-y: auto; scrollbar-width: thin; }
|
|
122
124
|
.r-feats-label { padding: 0.3em 0 0.15em; }
|
|
123
125
|
.r-feats-list { display: flex; flex-wrap: wrap; gap: 0.3em 0.35em; align-items: center; }
|
|
@@ -128,55 +130,77 @@
|
|
|
128
130
|
.r-feats-more { color: var(--pending); border-style: dashed; }
|
|
129
131
|
.r-feat:hover, .r-feat:focus-visible { border-color: var(--focus); background: var(--zebra-row); }
|
|
130
132
|
/*
|
|
131
|
-
* behold#571: the header in fixed boxes. The
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
133
|
+
* behold#571: the header in fixed boxes. The lead block on the left is
|
|
134
|
+
* the page's lead: the title, the two beats (what changes, and the step:
|
|
135
|
+
* what just happened and why), the progress, the rest of the card and
|
|
136
|
+
* the pull request's facts, each in a box whose height holds its text
|
|
137
|
+
* budget at 1440x900 and 1920x1080 (terragucci#1061: the card's fields
|
|
138
|
+
* 120, 220 and 120 characters, the step 200). More scrolls inside the
|
|
139
|
+
* box, with a fade at the edge, so the panes below never move. The hold
|
|
140
|
+
* panel on the right takes the lead's height and never sets it.
|
|
136
141
|
*/
|
|
137
|
-
#bar { position: relative; display: grid; grid-template-columns: minmax(0, 1.
|
|
138
|
-
padding: 0.
|
|
139
|
-
#bar > .k-empty { grid-column: 1 / -1; }
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
142
|
+
#bar { position: relative; display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 0.4em 0.7em; align-items: stretch;
|
|
143
|
+
padding: 0.3em 0.6em 0.3em; background: var(--bg); }
|
|
144
|
+
#bar > .k-empty, #bar > .k-replay, #bar > .k-nograph-note { grid-column: 1 / -1; }
|
|
145
|
+
:root { --k-title-h: 1.82em; --k-beat-h: 3.25em; --k-step-h: 4.45em; --k-progress-h: 1.5em; --k-card-h: 3.3em; --k-facts-h: 1.2em; }
|
|
146
|
+
/* Wide enough that the step's 200 characters, and Watch for with Shows, take two lines each: their boxes are two lines tall. */
|
|
147
|
+
@media (min-width: 1700px) { :root { --k-step-h: 3.05em; --k-card-h: 2.3em; } }
|
|
148
|
+
.k-lead { display: grid; grid-template-rows: var(--k-title-h) var(--k-beat-h) var(--k-step-h) var(--k-progress-h) var(--k-card-h) var(--k-facts-h) auto; gap: 0.16em; min-width: 0;
|
|
149
|
+
padding: 0.25em 0.8em 0.3em; background: var(--surface-pane-b); border-radius: 8px; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--fg) 14%, transparent); }
|
|
150
|
+
.k-box { min-height: 0; overflow-y: auto; scrollbar-width: thin; border-radius: 6px; padding: 0.1em 0.2em; }
|
|
143
151
|
.k-box.k-more-below { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 1.3em), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 1.3em), transparent); }
|
|
144
152
|
.k-box.k-more-above { -webkit-mask-image: linear-gradient(to top, #000 calc(100% - 1.3em), transparent); mask-image: linear-gradient(to top, #000 calc(100% - 1.3em), transparent); }
|
|
145
153
|
.k-box.k-more-above.k-more-below { -webkit-mask-image: linear-gradient(to bottom, transparent, #000 1.3em, #000 calc(100% - 1.3em), transparent); mask-image: linear-gradient(to bottom, transparent, #000 1.3em, #000 calc(100% - 1.3em), transparent); }
|
|
146
|
-
.k-box-empty { background: transparent; }
|
|
147
|
-
.k-box-title {
|
|
148
|
-
|
|
149
|
-
.k-intro { margin: 0; font-size: 1.12em; line-height: 1.4; color: var(--fg); }
|
|
150
|
-
.k-intro-head { display: block; font: 600 0.62em var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 0.15em; }
|
|
151
|
-
.k-kicker { font: 600 0.58em var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-right: 0.9em; vertical-align: 0.2em; white-space: nowrap; }
|
|
154
|
+
.k-box-empty { background: transparent; box-shadow: none; }
|
|
155
|
+
.k-box-title { overflow: hidden; padding: 0; }
|
|
156
|
+
.k-kicker { font: 600 0.5em var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-right: 0.9em; vertical-align: 0.3em; white-space: nowrap; }
|
|
152
157
|
.k-cycle { color: var(--muted); font: 0.78em var(--font-mono); white-space: nowrap; }
|
|
153
|
-
.k-title { margin: 0; font-size: 1.
|
|
154
|
-
/*
|
|
155
|
-
.k-
|
|
156
|
-
.k-
|
|
157
|
-
.k-
|
|
158
|
+
.k-title { margin: 0; font-size: 1.5em; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
159
|
+
/* The two beats: the largest text after the title, each with its label first. */
|
|
160
|
+
.k-beat, .k-intro { margin: 0; font-size: 1.32em; line-height: 1.22; color: var(--fg); }
|
|
161
|
+
.k-step { margin: 0; font-size: 1.16em; line-height: 1.25; color: var(--fg); }
|
|
162
|
+
.k-beat-text { font-weight: 600; }
|
|
163
|
+
.k-box-beat { padding: 0 0.2em; }
|
|
164
|
+
.k-beat-label, .k-step-word, .k-intro-head { font: 700 0.62em var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; margin-right: 0.8em; vertical-align: 0.12em; white-space: nowrap; }
|
|
165
|
+
.k-beat-label, .k-intro-head { color: var(--muted); }
|
|
166
|
+
.k-step-word { color: var(--pending); }
|
|
167
|
+
.k-box-step { border-left: 4px solid var(--pending); border-radius: 0 6px 6px 0; padding: 0.05em 0.2em 0.05em 0.65em; background: color-mix(in srgb, var(--pending) 7%, transparent); }
|
|
168
|
+
.k-box-step:has(.k-step-waiting) { border-left-color: var(--foreign); }
|
|
169
|
+
.k-box-step:has(.k-step-failed), .k-box-step:has(.k-step-stalled) { border-left-color: var(--degraded); }
|
|
170
|
+
.k-box-step:has(.k-step-applied) { border-left-color: var(--managed); }
|
|
171
|
+
.k-box-step:has(.k-step-reset) { border-left-color: var(--neutral); }
|
|
172
|
+
/* The rest of the card, quieter. */
|
|
173
|
+
.k-box-more { padding: 0 0.2em; }
|
|
174
|
+
.k-about { margin: 0; font-size: 0.84em; line-height: 1.3; }
|
|
175
|
+
.k-about-label { font: 600 0.74em var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-right: 0.6em; }
|
|
176
|
+
.k-about-text { margin-right: 1.2em; color: color-mix(in srgb, var(--fg) 82%, var(--muted)); }
|
|
158
177
|
.k-muted { color: var(--muted); margin: 0.25em 0; }
|
|
159
|
-
|
|
160
|
-
.k-
|
|
161
|
-
.k-
|
|
162
|
-
.k-
|
|
163
|
-
.k-
|
|
164
|
-
.k-
|
|
165
|
-
/* The right column takes the left's height and never sets it: its hold box scrolls instead. */
|
|
166
|
-
.k-right { display: grid; grid-template-rows: auto auto minmax(0, 1fr); gap: 0.35em; min-width: 0; min-height: 0; contain: size; }
|
|
167
|
-
.k-where { padding-right: 13em; flex-wrap: nowrap; }
|
|
168
|
-
.k-next .k-cycle { margin-left: auto; }
|
|
169
|
-
.k-where { display: flex; flex-wrap: wrap; gap: 0.35em 1em; align-items: center; }
|
|
170
|
-
.k-strip { list-style: none; display: flex; flex-wrap: wrap; gap: 0.35em; padding: 0; margin: 0; }
|
|
171
|
-
.k-stop { font: 0.82em var(--font-mono); padding: 0.25em 0.7em; border-radius: 999px; border: 1px solid var(--rule); color: var(--muted); }
|
|
178
|
+
/* The progress, with the step: the strip, the driver's next action, the cycle. */
|
|
179
|
+
.k-progress { display: flex; flex-wrap: nowrap; gap: 0.3em 0.9em; align-items: center; min-width: 0; overflow: hidden; }
|
|
180
|
+
.k-progress .k-strip { flex: none; }
|
|
181
|
+
.k-progress .k-next { flex: 1; }
|
|
182
|
+
.k-strip { list-style: none; display: flex; flex-wrap: nowrap; gap: 0.3em; padding: 0; margin: 0; }
|
|
183
|
+
.k-stop { font: 0.78em var(--font-mono); padding: 0.18em 0.6em; border-radius: 999px; border: 1px solid var(--rule); color: var(--muted); white-space: nowrap; }
|
|
172
184
|
.k-done { color: var(--fg); border-color: var(--managed); }
|
|
173
185
|
.k-current { color: var(--bg); background: var(--pending); border-color: var(--pending); font-weight: 600; }
|
|
174
186
|
.k-failed { color: var(--bg); background: var(--degraded); border-color: var(--degraded); font-weight: 600; }
|
|
175
|
-
.k-next { display: flex;
|
|
187
|
+
.k-next { display: flex; gap: 0.3em 0.6em; align-items: baseline; font-size: 0.95em; min-width: 0; white-space: nowrap; }
|
|
176
188
|
.k-next-word { font: 600 0.72em var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
|
|
177
|
-
.k-action { font-family: var(--font-mono); }
|
|
189
|
+
.k-action { font-family: var(--font-mono); overflow: hidden; text-overflow: ellipsis; min-width: 0; }
|
|
178
190
|
.k-when { color: var(--foreign); font-family: var(--font-mono); }
|
|
179
|
-
|
|
191
|
+
/* The pull request's facts, one line; the whole line is its title. */
|
|
192
|
+
.k-box-facts { overflow: hidden; padding: 0 0.2em; }
|
|
193
|
+
.k-facts { margin: 0; font-size: 0.86em; line-height: 1.4; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
194
|
+
.k-credits { margin: 0; color: var(--muted); font-size: 0.78em; line-height: 1.35; }
|
|
195
|
+
/* behold#571: the hold panel, lit in the waiting tone its job row and its wave box carry. */
|
|
196
|
+
.k-right { display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 0.3em; min-width: 0; min-height: 0; contain: size; }
|
|
197
|
+
.k-right > .k-cycle { margin: 0; padding: 0.25em 13em 0 0.3em; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; }
|
|
198
|
+
.k-box-hold { padding: 0.5em 0.9em 0.6em; }
|
|
199
|
+
.k-hold { background: var(--surface-box); border-radius: 8px; }
|
|
200
|
+
.k-hold-head { margin: 0 0 0.3em; font: 700 0.95em var(--font-mono); color: var(--fg); }
|
|
201
|
+
.k-hold-wave { background: color-mix(in srgb, var(--foreign) 7%, var(--surface-box)); box-shadow: inset 4px 0 0 var(--foreign); padding-left: 1.2em; }
|
|
202
|
+
.k-hold-wave .k-hold-head { color: var(--foreign); }
|
|
203
|
+
.k-hold > .k-note { margin-top: 0.2em; }
|
|
180
204
|
/* behold#571: "How this hold ends": four rows that light from the records. */
|
|
181
205
|
.k-ap-head { font: 600 0.7em var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 0 0 0.1em; }
|
|
182
206
|
.k-ap-head .k-ap-plan { text-transform: none; letter-spacing: 0; color: var(--fg); font-weight: 400; }
|
|
@@ -210,13 +234,31 @@
|
|
|
210
234
|
.k-view-on { color: var(--bg); background: var(--pending); }
|
|
211
235
|
.k-view-on:hover { color: var(--bg); }
|
|
212
236
|
.k-view-note { color: var(--muted); font-size: 0.8em; }
|
|
213
|
-
#
|
|
214
|
-
|
|
237
|
+
/* behold#571: "How to read this", the graph pane's static frame: the legend of the view shown, folded to its header on request. */
|
|
238
|
+
#view-pane { position: relative; }
|
|
239
|
+
#views { padding-right: 11em; }
|
|
240
|
+
/* Folded, its header sits in the toggle's row; open, its rows lie over the top of the graph, two to a line. */
|
|
241
|
+
#k-read { font-size: 0.82em; }
|
|
242
|
+
#k-read[hidden] { display: none; }
|
|
243
|
+
.k-read-head { position: absolute; top: 0.55em; right: 1.1em; z-index: 5; font: 600 0.82em var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); background: transparent; border: 0; padding: 0.35em 0; cursor: pointer; }
|
|
244
|
+
.k-read-head::after { content: " ▸"; }
|
|
245
|
+
.k-read-open .k-read-head::after { content: " ▾"; }
|
|
246
|
+
.k-read-head:hover { color: var(--fg); }
|
|
247
|
+
.k-read-rows { position: absolute; top: 2.85em; left: 0.7em; right: 0.7em; z-index: 4; list-style: none; margin: 0; padding: 0.45em 0.9em; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.25em 1.4em;
|
|
248
|
+
background: var(--surface-pane-b); border: 1px solid var(--rule); border-radius: 8px; box-shadow: 0 6px 22px color-mix(in srgb, var(--shadow) 60%, transparent); }
|
|
249
|
+
.k-read-row { display: grid; grid-template-columns: 2.2em minmax(0, 1fr); gap: 0.5em; align-items: center; color: var(--fg); line-height: 1.3; }
|
|
250
|
+
.k-read-mark { display: inline-block; justify-self: center; }
|
|
251
|
+
.k-read-card { width: 1.7em; height: 0.95em; border-radius: 3px; background: var(--panel); box-shadow: inset 3px 0 0 var(--muted); border: 1px solid var(--edge); }
|
|
252
|
+
.k-read-box { width: 1.9em; height: 1.05em; border-radius: 4px; border: 1.5px solid var(--muted); }
|
|
253
|
+
.k-read-solid, .k-read-dashed { width: 2em; height: 0; border-top: 2px solid var(--fg); }
|
|
254
|
+
.k-read-dashed { border-top-style: dashed; }
|
|
255
|
+
.k-read-order { width: 1.9em; height: 1em; background: linear-gradient(var(--muted), var(--muted)) 0 0 / 0.5em 100% no-repeat, linear-gradient(var(--muted), var(--muted)) 0.7em 25% / 0.5em 75% no-repeat, linear-gradient(var(--muted), var(--muted)) 1.4em 50% / 0.5em 50% no-repeat; opacity: 0.8; }
|
|
256
|
+
.k-read-marks { width: 1.5em; height: 0.75em; background: radial-gradient(circle at 25% 50%, var(--foreign) 0 0.3em, transparent 0.32em), radial-gradient(circle at 75% 50%, var(--runtime) 0 0.3em, transparent 0.32em); }
|
|
215
257
|
/* behold#571: a tool's page. Its name (and logo where allowed) before the scenario, the replay's banner, the credit. */
|
|
216
258
|
.k-brand { display: inline-flex; align-items: center; gap: 0.35em; margin-right: 0.8em; color: var(--fg); text-decoration: none; font-weight: 700; vertical-align: 0.05em; }
|
|
217
259
|
.k-brand:hover .k-brand-name { text-decoration: underline; }
|
|
218
260
|
.k-brand-logo { width: 1.25em; height: 1.25em; }
|
|
219
|
-
.k-replay {
|
|
261
|
+
.k-replay { margin: 0; padding: 0.2em 0.7em; padding-right: 16em; border-left: 4px solid var(--neutral); background: var(--surface-box); color: var(--fg); font-size: 0.92em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
220
262
|
/* behold#571: "What is this?" and the theme, at the header's top right, outside the boxes that redraw. */
|
|
221
263
|
#k-tools { position: absolute; top: 0.4em; right: 1em; z-index: 5; display: flex; gap: 0.7em; align-items: center; font-size: 0.8em; }
|
|
222
264
|
.k-what { font: inherit; color: var(--pending); background: transparent; border: 0; padding: 0.1em 0; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
|
|
@@ -231,9 +273,9 @@
|
|
|
231
273
|
.k-menu summary::after { content: " ▾"; }
|
|
232
274
|
.k-menu[open] summary { color: var(--fg); }
|
|
233
275
|
.k-menu-body { position: absolute; right: 0; top: 1.8em; padding: 0.5em; background: var(--surface-pane-b); border: 1px solid var(--rule); border-radius: 8px; }
|
|
234
|
-
.k-credit { color: var(--muted);
|
|
276
|
+
.k-credit { color: var(--muted); }
|
|
235
277
|
.k-credit-link { color: var(--fg); }
|
|
236
|
-
.k-nograph-note {
|
|
278
|
+
.k-nograph-note { margin: 0; color: var(--muted); font-size: 0.88em; }
|
|
237
279
|
/* With no graph to show, the graph pane folds away and the runs and the log take its width. */
|
|
238
280
|
body.k-nograph #stage { grid-template-columns: minmax(15em, 22%) minmax(0, 1fr); }
|
|
239
281
|
body.k-nograph #view-pane { display: none; }
|
|
@@ -241,7 +283,7 @@
|
|
|
241
283
|
body.k-notyet #runs-side, body.k-notyet #runs-main, body.k-notyet #k-runs-toggle { display: none !important; }
|
|
242
284
|
body.k-notyet #stage { grid-template-columns: minmax(0, 1fr); }
|
|
243
285
|
.k-fact { color: var(--fg); }
|
|
244
|
-
@media (max-width: 900px) and (min-width: 601px) { #bar { grid-template-columns: 1fr; } #stage, body.k-nograph #stage { grid-template-columns: 1fr; } }
|
|
286
|
+
@media (max-width: 900px) and (min-width: 601px) { #bar { grid-template-columns: 1fr; } .k-right { contain: none; } .k-box-hold { max-height: 16em; } #stage, body.k-nograph #stage { grid-template-columns: 1fr; } }
|
|
245
287
|
/*
|
|
246
288
|
* behold#571: a phone. One column that scrolls as a page: the header
|
|
247
289
|
* (its boxes as tall as their text), the graph, then the runs and their
|
|
@@ -255,14 +297,27 @@
|
|
|
255
297
|
.k-left, .k-right { display: block; contain: none; }
|
|
256
298
|
.k-left > * + *, .k-right > * + * { margin-top: 0.4em; }
|
|
257
299
|
.k-box { height: auto; max-height: none; overflow: visible; -webkit-mask-image: none !important; mask-image: none !important; }
|
|
258
|
-
.k-
|
|
259
|
-
.k-
|
|
300
|
+
.k-box-empty { display: none; }
|
|
301
|
+
.k-title { white-space: normal; font-size: 1.4em; }
|
|
302
|
+
.k-progress { flex-wrap: wrap; overflow: visible; }
|
|
303
|
+
.k-progress .k-strip { flex: 1 1 100%; }
|
|
304
|
+
#views { flex-wrap: wrap; gap: 0.3em 0.9em; }
|
|
305
|
+
.k-strip { flex-wrap: wrap; }
|
|
306
|
+
.k-next { white-space: normal; flex-wrap: wrap; }
|
|
307
|
+
.k-facts { white-space: normal; }
|
|
308
|
+
.k-right > .k-cycle { padding: 0; }
|
|
309
|
+
#k-read { padding: 0.2em 16px; }
|
|
310
|
+
.k-read-head { position: static; }
|
|
311
|
+
.k-read-rows { position: static; grid-template-columns: 1fr; border-radius: 6px; box-shadow: none; margin-bottom: 0.3em; }
|
|
312
|
+
#views { padding-right: 1em; }
|
|
260
313
|
.k-replay { padding-right: 0.7em; white-space: normal; }
|
|
261
314
|
#k-tools { position: static; justify-content: flex-end; margin: 0; padding: 0.4em 16px 0; }
|
|
262
315
|
#k-what-pop { right: 16px; left: 16px; width: auto; top: 2.2em; }
|
|
263
316
|
.k-ap-row { grid-template-columns: 1.1em 5.6em minmax(0, 1fr); }
|
|
264
317
|
#stage, body.k-nograph #stage { display: flex; flex-direction: column; padding: 0; gap: 0; }
|
|
265
318
|
#view-pane { order: 1; height: 64vh; }
|
|
319
|
+
#view-pane:has(#k-read.k-read-open) { height: auto; }
|
|
320
|
+
#view-pane:has(#k-read.k-read-open) #view { height: 56vh; flex: none; }
|
|
266
321
|
body.k-nograph #view-pane { display: none; }
|
|
267
322
|
#k-runs-toggle { order: 2; display: block; margin: 0.6em 16px; padding: 0.6em 1em; font: 600 1em var(--font-ui); color: var(--fg); background: var(--surface-pane-b); border: 1px solid var(--rule); border-radius: 8px; cursor: pointer; text-align: left; }
|
|
268
323
|
#k-runs-toggle::after { content: " ▸"; }
|
|
@@ -274,7 +329,6 @@
|
|
|
274
329
|
.r-log { margin-left: 0.4em; max-height: 60vh; }
|
|
275
330
|
.r-log-line { grid-template-columns: 2.4em 1fr; gap: 0.5em; }
|
|
276
331
|
.r-ann-note { grid-column: 1 / -1; }
|
|
277
|
-
#foot { padding: 0.5em 16px; }
|
|
278
332
|
}
|
|
279
333
|
</style>
|
|
280
334
|
</head>
|
|
@@ -293,10 +347,10 @@
|
|
|
293
347
|
<button type="button" id="k-runs-toggle" aria-expanded="false">Runs and logs</button>
|
|
294
348
|
<section id="view-pane">
|
|
295
349
|
<div id="views" hidden></div>
|
|
350
|
+
<section id="k-read" aria-label="How to read this" hidden></section>
|
|
296
351
|
<iframe id="view" title="behold's view of the change"></iframe>
|
|
297
352
|
</section>
|
|
298
353
|
</div>
|
|
299
|
-
<footer id="foot"></footer>
|
|
300
354
|
<script type="module">
|
|
301
355
|
import { initTheme, KIOSK_THEME } from "/theme.js";
|
|
302
356
|
import { startKiosk } from "/kiosk.js";
|
|
@@ -305,7 +359,7 @@
|
|
|
305
359
|
// behold#571: /<tool> serves this page with its tool in a meta tag; /kiosk has none.
|
|
306
360
|
startKiosk(
|
|
307
361
|
{
|
|
308
|
-
bar: document.getElementById("bar"), frame: document.getElementById("view"),
|
|
362
|
+
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"),
|
|
309
363
|
tools: { what: document.querySelector(".k-what"), pop: document.getElementById("k-what-pop"), theme: document.getElementById("k-theme"), runsToggle: document.getElementById("k-runs-toggle") },
|
|
310
364
|
},
|
|
311
365
|
{ tool: pageTool(document) },
|
package/web/kiosk.js
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
// Nothing here is all-or-nothing, and nothing says so.
|
|
15
15
|
|
|
16
16
|
import { PICK_HOLD_MS, annMark, mergeRun, startRuns } from "./kiosk-runs.js";
|
|
17
|
-
import { PANEL_STEPS, PANEL_TITLE, approvalModel, cycleRuns,
|
|
17
|
+
import { PANEL_STEPS, PANEL_TITLE, approvalModel, cycleRuns, digestHex, rowFacts } from "./kiosk-approval.js";
|
|
18
18
|
import { getThemeName, mountThemePicker, onThemeChange } from "./theme.js";
|
|
19
19
|
import { cssString, hoverCss, hoverFromMessage, hoverLinks, hoverMessage, isLightBg, rootSegments, rootText } from "./kiosk-roots.js";
|
|
20
20
|
import { creditLines, filterIndex, keepRun, liveEstimate, liveFor, namesOther, notRunRepo, notRunWords, replayAt, replayBanner, replayIndex, rootNoun, rootWord, runAsOf, scrubDemo, servesRepo, vendorOf } from "./kiosk-vendor.js";
|
|
@@ -408,23 +408,88 @@ export function kioskView(demo, { components = false, pick = null, now = Date.no
|
|
|
408
408
|
return { view: demo ? stepView(demo.step) : "components", pinned: false, secs: null };
|
|
409
409
|
}
|
|
410
410
|
|
|
411
|
-
/**
|
|
412
|
-
export
|
|
411
|
+
/** behold#571: the static frame's title, over the legend; collapsed, its one line. */
|
|
412
|
+
export const READ_TITLE = "How to read this";
|
|
413
|
+
|
|
414
|
+
/** behold#571: where a viewer's choice to fold "How to read this" is kept, in their own browser. */
|
|
415
|
+
export const READ_STORE = "behold.kiosk.read";
|
|
416
|
+
|
|
417
|
+
/**
|
|
418
|
+
* behold#571: the legend of the view shown, one row per mark: what a card, a
|
|
419
|
+
* box, a solid arrow and a dashed arrow are, the waves' order, and what the
|
|
420
|
+
* forge and tool marks name. `[{ mark, words }]`, `mark` one of card, box,
|
|
421
|
+
* solid, dashed, order, marks. Short items, two to a line, so the open
|
|
422
|
+
* frame stays a few lines over the graph. Its words follow the view and the
|
|
423
|
+
* tool alone, never the step.
|
|
424
|
+
*/
|
|
425
|
+
export function readingRows(view, tool = null) {
|
|
413
426
|
const root = rootWord(tool);
|
|
414
427
|
const n = rootNoun(tool);
|
|
415
|
-
// A tool whose pipeline writes no reports: behold's own graph of its components, boxed by the wave each applies in.
|
|
416
428
|
if (reportless(vendorOf(tool))) {
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
:
|
|
429
|
+
if (view !== "components") return [{ mark: "box", words: `Box: ${root} with its own state.` }];
|
|
430
|
+
return [
|
|
431
|
+
{ mark: "card", words: `Card: ${root} with its own state.` },
|
|
432
|
+
{ mark: "box", words: "Box: a wave of components that apply together." },
|
|
433
|
+
{ mark: "solid", words: "Arrow: a component reading another's outputs." },
|
|
434
|
+
];
|
|
420
435
|
}
|
|
421
|
-
const
|
|
436
|
+
const arrows = [
|
|
437
|
+
{ mark: "solid", words: "Solid arrow: a read of applied outputs." },
|
|
438
|
+
{ mark: "dashed", words: "Dashed arrow: planned values, before they apply." },
|
|
439
|
+
];
|
|
422
440
|
if (view === "components") {
|
|
423
|
-
return
|
|
441
|
+
return [
|
|
442
|
+
{ mark: "card", words: `Card: ${root} with its own state.` },
|
|
443
|
+
{ mark: "box", words: "Box: a wave, titled with the job that applies it." },
|
|
444
|
+
...arrows,
|
|
445
|
+
{ mark: "order", words: `Waves apply in order, ${n.many} in a wave together.` },
|
|
446
|
+
{ mark: "marks", words: "Marks: the forge and the tools a job runs." },
|
|
447
|
+
];
|
|
424
448
|
}
|
|
425
|
-
return
|
|
449
|
+
return [
|
|
450
|
+
{ mark: "box", words: `Box: ${root} with its own state.` },
|
|
451
|
+
{ mark: "card", words: "Card: one of its resources." },
|
|
452
|
+
...arrows,
|
|
453
|
+
{ mark: "marks", words: "Marks: the tools each job runs, in the jobs pane." },
|
|
454
|
+
];
|
|
426
455
|
}
|
|
427
456
|
|
|
457
|
+
/**
|
|
458
|
+
* behold#571: "How to read this", the graph pane's static frame. A header
|
|
459
|
+
* that folds it, and the legend of the view shown. Drawn again only when the
|
|
460
|
+
* view or the tool changes (the caller keys it), never per step.
|
|
461
|
+
*/
|
|
462
|
+
export function renderReading(host, view, tool, { open = true, onToggle = () => {} } = {}) {
|
|
463
|
+
if (!host) return;
|
|
464
|
+
host.replaceChildren();
|
|
465
|
+
host.hidden = false;
|
|
466
|
+
const head = el("button", "k-read-head", READ_TITLE);
|
|
467
|
+
head.type = "button";
|
|
468
|
+
if (head.setAttribute) head.setAttribute("aria-expanded", String(open));
|
|
469
|
+
if (head.addEventListener) head.addEventListener("click", () => onToggle(!open));
|
|
470
|
+
host.appendChild(head);
|
|
471
|
+
if (host.classList) host.classList.toggle("k-read-open", open);
|
|
472
|
+
if (!open) return;
|
|
473
|
+
const list = el("ul", "k-read-rows");
|
|
474
|
+
for (const r of readingRows(view, tool)) {
|
|
475
|
+
const li = el("li", "k-read-row");
|
|
476
|
+
const mark = el("span", `k-read-mark k-read-${r.mark}`);
|
|
477
|
+
if (mark.setAttribute) mark.setAttribute("aria-hidden", "true");
|
|
478
|
+
li.append(mark, el("span", "k-read-words", r.words));
|
|
479
|
+
list.appendChild(li);
|
|
480
|
+
}
|
|
481
|
+
host.appendChild(list);
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
/** behold#571: the viewer's fold of "How to read this": true open, false folded, null when they never chose. */
|
|
485
|
+
export function readStored(store) {
|
|
486
|
+
try {
|
|
487
|
+
const v = store && store.getItem(READ_STORE);
|
|
488
|
+
return v === "open" ? true : v === "closed" ? false : null;
|
|
489
|
+
} catch {
|
|
490
|
+
return null;
|
|
491
|
+
}
|
|
492
|
+
}
|
|
428
493
|
|
|
429
494
|
/** Whether a tool's pipeline writes no terragucci reports or run view (VENDORS' `reports: false`). */
|
|
430
495
|
export function reportless(vendor) {
|
|
@@ -511,16 +576,61 @@ const elRoots = (tag, cls, text, s) => {
|
|
|
511
576
|
return n;
|
|
512
577
|
};
|
|
513
578
|
|
|
514
|
-
/**
|
|
515
|
-
|
|
579
|
+
/**
|
|
580
|
+
* Draw the header from what the kiosk holds. Pure over its arguments, but for
|
|
581
|
+
* the DOM. behold#571: the lead block on the left (the scenario, its two
|
|
582
|
+
* beats, its progress, the pull request's facts and, on a tool's page, the
|
|
583
|
+
* credit), the hold panel on the right. The page has no footer: the legend is
|
|
584
|
+
* the graph pane's "How to read this". `_foot` is ignored, kept for callers.
|
|
585
|
+
*/
|
|
586
|
+
export function renderKiosk(bar, s, now = new Date(), _foot = null) {
|
|
516
587
|
bar.replaceChildren();
|
|
517
|
-
if (
|
|
518
|
-
drawBar(bar, s, now
|
|
519
|
-
|
|
520
|
-
|
|
588
|
+
if (_foot) _foot.replaceChildren();
|
|
589
|
+
drawBar(bar, s, now);
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
/** behold#571: the card's first beat, as the lead block labels it. */
|
|
593
|
+
export const BEAT_CHANGES = "What changes";
|
|
594
|
+
|
|
595
|
+
/** behold#571: the lead block's line of the pull request's facts: factLines, as one line. */
|
|
596
|
+
export function factsLine(demo, answer, tool = null) {
|
|
597
|
+
return factLines(demo, answer, tool).join(" · ");
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
/**
|
|
601
|
+
* behold#571: the hold panel's head: its wave, its run and its plan, as
|
|
602
|
+
* "Wave 2 · run #3605 · plan 02812a1b". Without a wave, the pull request or
|
|
603
|
+
* the commit the note is about. Null when it knows none of these.
|
|
604
|
+
*/
|
|
605
|
+
export function holdHead({ wave = null, run = null, digest = null, pull = null, commit = null } = {}) {
|
|
606
|
+
const parts = [];
|
|
607
|
+
if (Number.isInteger(wave)) parts.push(`Wave ${wave}`);
|
|
608
|
+
if (Number.isInteger(run)) parts.push(`run #${run}`);
|
|
609
|
+
if (digest && digestHex(digest)) parts.push(`plan ${digestHex(digest).slice(0, 8)}`);
|
|
610
|
+
if (!parts.length && pull !== null && pull !== undefined && pull !== "") parts.push(`Pull request #${pull}`);
|
|
611
|
+
if (!parts.length && commit) parts.push(`Merge ${String(commit).slice(0, 8)}`);
|
|
612
|
+
return parts.length ? parts.join(" · ") : null;
|
|
521
613
|
}
|
|
522
614
|
|
|
523
|
-
|
|
615
|
+
/**
|
|
616
|
+
* behold#571: what the hold panel holds, or null for nothing: how the hold
|
|
617
|
+
* ends (from the records), else the driver's approval, else the run's note.
|
|
618
|
+
* `{ kind, wave, head, … }`; `wave` is the wave it lights, when it has one.
|
|
619
|
+
*/
|
|
620
|
+
export function holdModel(s, demo) {
|
|
621
|
+
const vendor = vendorOf(s.vendor);
|
|
622
|
+
if (s.approval) return { kind: "approval", wave: s.approval.wave, head: holdHead({ wave: s.approval.wave, run: s.approval.run, digest: s.approval.digest }), model: s.approval };
|
|
623
|
+
const appr = pendingApproval(demo, s.progress);
|
|
624
|
+
if (appr) return { kind: "driver", wave: appr.wave, head: holdHead({ wave: appr.wave, digest: appr.digest }), appr };
|
|
625
|
+
if (s.noReports || reportless(vendor || vendorOf(demo.tool))) return null;
|
|
626
|
+
const panel = runPanel(demo, s.answer, s.progress);
|
|
627
|
+
const lines = panel.note ? [{ cls: "k-note", text: panel.note }] : panel.stage === "pull-request" ? unreviewedLines(s.answer).map((u) => ({ cls: "k-note k-unknown", text: u })) : [];
|
|
628
|
+
if (!lines.length) return null;
|
|
629
|
+
const head = holdHead(panel.stage === "pull-request" ? { pull: demo.pull } : { commit: demo.commit });
|
|
630
|
+
return { kind: "note", wave: null, head, lines };
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
function drawBar(bar, s, now) {
|
|
524
634
|
const vendor = vendorOf(s.vendor);
|
|
525
635
|
if (vendor && s.mode === "none") {
|
|
526
636
|
// behold#571: the tool's scenario has no cycle yet: its name, its link, and a calm line.
|
|
@@ -529,6 +639,7 @@ function drawBar(bar, s, now, foot) {
|
|
|
529
639
|
const title = el("h1", "k-title");
|
|
530
640
|
title.append(brandEl(vendor), el("span", "k-title-text", words.title));
|
|
531
641
|
box.append(title, el("p", "k-muted", words.text));
|
|
642
|
+
drawCredit(box, s.vendor);
|
|
532
643
|
bar.appendChild(box);
|
|
533
644
|
return;
|
|
534
645
|
}
|
|
@@ -539,6 +650,7 @@ function drawBar(bar, s, now, foot) {
|
|
|
539
650
|
title.appendChild(el("span", "k-title-text", "Waiting for the demo"));
|
|
540
651
|
box.appendChild(title);
|
|
541
652
|
box.appendChild(el("p", "k-muted", s.demo ? s.demo.error || s.demo.absent : "Reading demo.json…"));
|
|
653
|
+
if (vendor) drawCredit(box, s.vendor);
|
|
542
654
|
bar.appendChild(box);
|
|
543
655
|
return;
|
|
544
656
|
}
|
|
@@ -550,8 +662,8 @@ function drawBar(bar, s, now, foot) {
|
|
|
550
662
|
if (vendor && s.noReports && (s.mode === "live" || s.mode === "replay")) bar.appendChild(el("p", "k-nograph-note", NO_GRAPH_WORDS));
|
|
551
663
|
const intro = introText(demo);
|
|
552
664
|
|
|
553
|
-
// behold#571: the
|
|
554
|
-
const left = el("div", "k-left");
|
|
665
|
+
// behold#571: the lead block, in fixed boxes: the title, the two beats (what changes, and the step), the progress, the rest of the card, the facts.
|
|
666
|
+
const left = el("div", "k-left k-lead");
|
|
555
667
|
const titleBox = box("title", "k-box-title");
|
|
556
668
|
const title = el("h1", "k-title");
|
|
557
669
|
// behold#571: /kiosk names the tool each scenario runs on, as its own page does.
|
|
@@ -561,70 +673,96 @@ function drawBar(bar, s, now, foot) {
|
|
|
561
673
|
if (title.setAttribute) title.setAttribute("title", `${head.kicker} · ${head.title || ""}`);
|
|
562
674
|
titleBox.appendChild(title);
|
|
563
675
|
left.appendChild(titleBox);
|
|
564
|
-
|
|
676
|
+
|
|
677
|
+
// The first beat: what changes; between scenarios, what the demo is about.
|
|
565
678
|
const rows = aboutRows(demo);
|
|
679
|
+
const changes = rows.find((r) => r.label === BEAT_CHANGES);
|
|
680
|
+
const beatBox = box("changes", "k-box-beat");
|
|
566
681
|
if (demo.step === "reset" && intro) {
|
|
567
|
-
// Between scenarios nothing else happens: the card's box says what the demo is about.
|
|
568
682
|
const p = el("p", "k-intro");
|
|
569
683
|
p.append(el("span", "k-intro-head", INTRO_HEAD), intro);
|
|
570
|
-
|
|
571
|
-
} else if (
|
|
572
|
-
const
|
|
573
|
-
|
|
574
|
-
|
|
684
|
+
beatBox.appendChild(p);
|
|
685
|
+
} else if (changes) {
|
|
686
|
+
const p = el("p", "k-beat");
|
|
687
|
+
p.append(el("span", "k-beat-label", changes.label), elRoots("span", "k-beat-text", changes.text, s));
|
|
688
|
+
beatBox.appendChild(p);
|
|
575
689
|
}
|
|
576
|
-
left.appendChild(
|
|
690
|
+
left.appendChild(beatBox);
|
|
691
|
+
|
|
692
|
+
// The second beat: the step, what just happened and why it stands where it does.
|
|
577
693
|
const said = el("p", `k-step k-step-${demo.step}`);
|
|
578
694
|
said.append(el("span", "k-step-word", STEP_WORDS[demo.step] || demo.step), elRoots("span", "k-label", demo.label, s));
|
|
579
|
-
const stepBox = box("step");
|
|
695
|
+
const stepBox = box("step", "k-box-step");
|
|
580
696
|
stepBox.appendChild(said);
|
|
581
697
|
left.appendChild(stepBox);
|
|
582
|
-
bar.appendChild(left);
|
|
583
698
|
|
|
584
|
-
|
|
699
|
+
// The scenario's progress, with the step: the strip, and the driver's next action with its countdown.
|
|
700
|
+
const progress = el("div", "k-progress");
|
|
585
701
|
const strip = el("ol", "k-strip");
|
|
586
702
|
for (const stop of stripStops(demo.step)) strip.appendChild(el("li", `k-stop k-${stop.state}`, stop.words));
|
|
587
|
-
|
|
588
|
-
where.appendChild(strip);
|
|
589
|
-
right.appendChild(where);
|
|
590
|
-
|
|
703
|
+
progress.appendChild(strip);
|
|
591
704
|
const nx = nextWords(demo, now);
|
|
592
705
|
const next = el("div", "k-next");
|
|
593
706
|
next.appendChild(el("span", "k-next-word", "next, by the driver"));
|
|
594
707
|
next.appendChild(elRoots("span", "k-action", nx.action, s));
|
|
595
708
|
next.appendChild(el("span", "k-when", nx.when));
|
|
596
|
-
|
|
597
|
-
|
|
709
|
+
// Short of room the action ends in an ellipsis; the whole line is its title.
|
|
710
|
+
if (next.setAttribute) next.setAttribute("title", `next, by the driver: ${nx.action}`);
|
|
711
|
+
progress.appendChild(next);
|
|
712
|
+
left.appendChild(progress);
|
|
713
|
+
|
|
714
|
+
// The rest of the card, quieter: watch for, and what the scenario shows.
|
|
715
|
+
const moreBox = box("card", "k-box-more");
|
|
716
|
+
const more = demo.step === "reset" && intro ? [] : rows.filter((r) => r !== changes);
|
|
717
|
+
if (more.length) {
|
|
718
|
+
// One quieter paragraph, each field after its label, so two short fields share a line.
|
|
719
|
+
const card = el("p", "k-about");
|
|
720
|
+
for (const r of more) card.append(el("span", "k-about-label", r.label), elRoots("span", "k-about-text", r.text, s), " ");
|
|
721
|
+
moreBox.appendChild(card);
|
|
722
|
+
}
|
|
723
|
+
left.appendChild(moreBox);
|
|
724
|
+
|
|
725
|
+
// The pull request's facts, as one line. behold#571: no line on where the narration was read from.
|
|
726
|
+
const factsBox = box("facts", "k-box-facts");
|
|
727
|
+
const facts = s.noReports ? "" : factsLine(demo, s.answer, nounTool(s));
|
|
728
|
+
if (facts) {
|
|
729
|
+
const p = elRoots("p", "k-facts", facts, s);
|
|
730
|
+
if (p.setAttribute) p.setAttribute("title", facts);
|
|
731
|
+
factsBox.appendChild(p);
|
|
732
|
+
}
|
|
733
|
+
left.appendChild(factsBox);
|
|
734
|
+
// behold#571: a tool's page ends its lead block with who makes the tool, and that they don't endorse the demo.
|
|
735
|
+
if (vendor) drawCredit(left, s.vendor);
|
|
736
|
+
for (const b of [beatBox, moreBox, factsBox]) if (!b.children.length) b.className += " k-box-empty";
|
|
737
|
+
bar.appendChild(left);
|
|
598
738
|
|
|
599
|
-
// behold#571: the hold
|
|
600
|
-
const
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
a
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
739
|
+
// behold#571: the hold panel, headed with its wave and run, lit as its job row and its wave box are.
|
|
740
|
+
const right = el("div", "k-right");
|
|
741
|
+
// The cycle, quiet over the hold panel: how long this run of the scenario has gone.
|
|
742
|
+
right.appendChild(el("p", "k-cycle", cycleWords(demo, now)));
|
|
743
|
+
const holdBox = box("hold", "k-box-hold");
|
|
744
|
+
const hold = holdModel(s, demo);
|
|
745
|
+
if (hold) {
|
|
746
|
+
// A wave held lights in the waiting tone; a run's note stays quiet.
|
|
747
|
+
holdBox.className += hold.wave !== null ? " k-hold k-hold-wave" : " k-hold";
|
|
748
|
+
if (hold.wave !== null && holdBox.dataset) holdBox.dataset.kWave = String(hold.wave);
|
|
749
|
+
if (hold.head) holdBox.appendChild(el("p", "k-hold-head", hold.head));
|
|
750
|
+
if (hold.kind === "approval") holdBox.appendChild(approvalPanel(hold.model, s));
|
|
751
|
+
else if (hold.kind === "driver") {
|
|
752
|
+
const appr = hold.appr;
|
|
753
|
+
const a = el("div", "k-approve");
|
|
754
|
+
a.appendChild(elRoots("p", "k-approve-gloss", approveGloss(appr), s));
|
|
755
|
+
a.appendChild(el("code", "k-command", appr.approve));
|
|
756
|
+
const then = el("p", "k-approve-then");
|
|
757
|
+
then.append(`then comments `, el("code", "k-inline", appr.comment), ` on ${appr.on}, and the waves run again.`);
|
|
758
|
+
a.appendChild(then);
|
|
759
|
+
holdBox.appendChild(a);
|
|
760
|
+
} else for (const l of hold.lines) holdBox.appendChild(elRoots("p", l.cls, l.text, s));
|
|
616
761
|
}
|
|
617
762
|
// behold#571: render what's present: an empty hold keeps its place (nothing moves when one comes) but draws no box.
|
|
618
763
|
if (!holdBox.children.length) holdBox.className += " k-box-empty";
|
|
619
764
|
right.appendChild(holdBox);
|
|
620
765
|
bar.appendChild(right);
|
|
621
|
-
|
|
622
|
-
if (foot) {
|
|
623
|
-
// The legend reads the graph; with no graph shown there is nothing for it to explain.
|
|
624
|
-
if (!s.noReports) foot.appendChild(el("span", "k-legend", legendWords(s.view || "resources", nounTool(s))));
|
|
625
|
-
// behold#571: no line on where the narration was read from: a viewer new to the demo reads the facts.
|
|
626
|
-
if (!s.noReports) for (const f of factLines(demo, s.answer, nounTool(s))) foot.appendChild(elRoots("span", "k-fact", f, s));
|
|
627
|
-
}
|
|
628
766
|
}
|
|
629
767
|
|
|
630
768
|
/** behold#571: the head over the intro, in the card's box between scenarios, and the title of "What is this?". */
|
|
@@ -644,10 +782,8 @@ function box(name, cls = "") {
|
|
|
644
782
|
*/
|
|
645
783
|
export function approvalPanel(model, s = {}) {
|
|
646
784
|
const wrap = el("div", "k-ap");
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
head.append(" · times in UTC");
|
|
650
|
-
wrap.appendChild(head);
|
|
785
|
+
// behold#571: the hold panel's head names the wave, the run and the plan; this one says what the rows are.
|
|
786
|
+
wrap.appendChild(el("p", "k-ap-head", `${PANEL_TITLE} · times in UTC`));
|
|
651
787
|
const list = el("ol", "k-ap-rows");
|
|
652
788
|
for (const r of model.rows) {
|
|
653
789
|
const li = el("li", `k-ap-row k-ap-${r.state}`);
|
|
@@ -693,9 +829,12 @@ function brandEl(vendor) {
|
|
|
693
829
|
return a;
|
|
694
830
|
}
|
|
695
831
|
|
|
696
|
-
/** behold#571: the
|
|
697
|
-
function drawCredit(
|
|
698
|
-
|
|
832
|
+
/** behold#571: the credit on a tool's page, one quiet line at the lead block's foot, its names linked to their official sites. */
|
|
833
|
+
function drawCredit(host, tool) {
|
|
834
|
+
const lines = creditLines(tool);
|
|
835
|
+
if (!lines.length) return;
|
|
836
|
+
const wrap = el("p", "k-credits");
|
|
837
|
+
for (const line of lines) {
|
|
699
838
|
const p = el("span", "k-credit");
|
|
700
839
|
for (const seg of line) {
|
|
701
840
|
if (!seg.url) {
|
|
@@ -708,13 +847,16 @@ function drawCredit(foot, tool) {
|
|
|
708
847
|
a.rel = "noopener";
|
|
709
848
|
p.appendChild(a);
|
|
710
849
|
}
|
|
711
|
-
|
|
850
|
+
wrap.append(p, " ");
|
|
712
851
|
}
|
|
852
|
+
host.appendChild(wrap);
|
|
713
853
|
}
|
|
714
854
|
|
|
715
855
|
/** behold#571: how a hovered root's name and wave's job row light. A background and a shadow: nothing moves. */
|
|
716
856
|
export const HOVER_ROOT_RULE = "background: color-mix(in srgb, var(--focus) 32%, transparent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--focus) 32%, transparent); border-radius: 3px;";
|
|
717
857
|
export const HOVER_JOB_RULE = "background: color-mix(in srgb, var(--focus) 24%, transparent); box-shadow: inset 4px 0 0 var(--focus);";
|
|
858
|
+
/** behold#571: how the held wave's job row lights while the hold panel shows it: the waiting tone its wave box and the panel carry. */
|
|
859
|
+
export const HELD_JOB_RULE = "background: color-mix(in srgb, var(--foreign) 14%, transparent); box-shadow: inset 4px 0 0 var(--foreign);";
|
|
718
860
|
|
|
719
861
|
/** behold#571: how often the approval panel reads the cycle's runs, and the gate ledger (which the server caches 30 s). */
|
|
720
862
|
export const APPROVAL_POLL_MS = 4_000;
|
|
@@ -737,14 +879,14 @@ function fade(b) {
|
|
|
737
879
|
export const DEMO_POLL_MS = 3_000;
|
|
738
880
|
|
|
739
881
|
/**
|
|
740
|
-
* Boot the kiosk: the bar, the frame and the
|
|
882
|
+
* Boot the kiosk: the bar, the frame and the graph pane's legend. Ask demo.json every few
|
|
741
883
|
* seconds, the reports and the run view when the step, cycle or commit moves
|
|
742
884
|
* or the event stream says they did, and redraw every second for the
|
|
743
885
|
* countdown. When the roots the step is about change, move the framed view
|
|
744
886
|
* with a `behold:view` message; the frame takes them only from this origin.
|
|
745
887
|
*/
|
|
746
|
-
export function startKiosk({ bar, frame,
|
|
747
|
-
const s = { demo: null, answer: null, progress: null, components: false, pick: null, view: "resources", roots: [], waves: [], light: false, hover: null, frameHover: null };
|
|
888
|
+
export function startKiosk({ bar, frame, side, main, views, read = null, tools = null }, { fetchJson = defaultFetch, now = () => new Date(), origin = location.origin, tool = null } = {}) {
|
|
889
|
+
const s = { demo: null, answer: null, progress: null, components: false, pick: null, view: "resources", roots: [], waves: [], light: false, hover: null, frameHover: null, held: null };
|
|
748
890
|
// behold#571: on a tool's page, `live` while its scenario runs, `replay` of its latest cycle otherwise, `none` before it has one.
|
|
749
891
|
const vendor = vendorOf(tool);
|
|
750
892
|
s.vendor = vendor ? tool : null;
|
|
@@ -801,6 +943,7 @@ export function startKiosk({ bar, frame, foot, side, main, views, tools = null }
|
|
|
801
943
|
if (!force && key === lastFocus) return;
|
|
802
944
|
lastFocus = key;
|
|
803
945
|
if (frame && frame.contentWindow) frame.contentWindow.postMessage({ type: "behold:view", member: null, focus, run, zoom }, origin);
|
|
946
|
+
tellHover(s.hover);
|
|
804
947
|
};
|
|
805
948
|
const pickView = (view) => {
|
|
806
949
|
s.pick = { view, at: now().getTime() };
|
|
@@ -819,12 +962,16 @@ export function startKiosk({ bar, frame, foot, side, main, views, tools = null }
|
|
|
819
962
|
const b = hoverLinks(s.frameHover, s.waves);
|
|
820
963
|
const links = { roots: [...new Set([...a.roots, ...b.roots])], waves: [...new Set([...a.waves, ...b.waves])] };
|
|
821
964
|
style.textContent = [
|
|
965
|
+
// behold#571: the held wave's job row, lit as the hold panel is; a hover's light comes after it and wins.
|
|
966
|
+
Number.isInteger(s.held) ? `.r-job[data-k-wave="${s.held}"] { ${HELD_JOB_RULE} }` : "",
|
|
822
967
|
hoverCss({ roots: links.roots, waves: [] }, { root: (r) => `.k-root[data-k-root=${cssString(r)}]` }, HOVER_ROOT_RULE),
|
|
823
968
|
hoverCss({ roots: [], waves: links.waves }, { wave: (w) => `.r-job[data-k-wave="${w}"]` }, HOVER_JOB_RULE),
|
|
824
969
|
].join("\n");
|
|
825
970
|
};
|
|
971
|
+
// behold#571: with nothing pointed at, the frame lights the held wave's box, as the hold panel and its job row are lit.
|
|
826
972
|
const tellHover = (h) => {
|
|
827
|
-
|
|
973
|
+
const lit = h || (Number.isInteger(s.held) ? { wave: s.held } : null);
|
|
974
|
+
if (frame && frame.contentWindow) frame.contentWindow.postMessage(hoverMessage(lit), origin);
|
|
828
975
|
};
|
|
829
976
|
const hoverAt = (target) => {
|
|
830
977
|
const t = target && target.closest ? target.closest("[data-k-root],[data-k-wave]") : null;
|
|
@@ -857,6 +1004,35 @@ export function startKiosk({ bar, frame, foot, side, main, views, tools = null }
|
|
|
857
1004
|
});
|
|
858
1005
|
}
|
|
859
1006
|
|
|
1007
|
+
// behold#571: "How to read this", folded until a viewer opens it, then as they last left it.
|
|
1008
|
+
const store = typeof localStorage !== "undefined" ? (() => { try { return localStorage; } catch { return null; } })() : null;
|
|
1009
|
+
let readOpen = readStored(store) === true;
|
|
1010
|
+
let readKey = null;
|
|
1011
|
+
const drawReading = (view, ok, force = false) => {
|
|
1012
|
+
if (!read) return;
|
|
1013
|
+
const t = nounTool(s);
|
|
1014
|
+
const key = `${view}|${t}|${ok}|${readOpen}`;
|
|
1015
|
+
if (!force && key === readKey) return;
|
|
1016
|
+
readKey = key;
|
|
1017
|
+
if (!ok) {
|
|
1018
|
+
read.replaceChildren();
|
|
1019
|
+
read.hidden = true;
|
|
1020
|
+
return;
|
|
1021
|
+
}
|
|
1022
|
+
renderReading(read, view, t, {
|
|
1023
|
+
open: readOpen,
|
|
1024
|
+
onToggle: (open) => {
|
|
1025
|
+
readOpen = open;
|
|
1026
|
+
try {
|
|
1027
|
+
if (store) store.setItem(READ_STORE, open ? "open" : "closed");
|
|
1028
|
+
} catch {
|
|
1029
|
+
/* private mode: the fold lasts this visit */
|
|
1030
|
+
}
|
|
1031
|
+
drawReading(view, ok, true);
|
|
1032
|
+
},
|
|
1033
|
+
});
|
|
1034
|
+
};
|
|
1035
|
+
|
|
860
1036
|
// behold#571: the titles and names demo.json has carried, by scenario, for the runs' subtitles.
|
|
861
1037
|
const titles = {};
|
|
862
1038
|
const names = {};
|
|
@@ -900,14 +1076,23 @@ export function startKiosk({ bar, frame, foot, side, main, views, tools = null }
|
|
|
900
1076
|
s.approval = approvalNow();
|
|
901
1077
|
// behold#571: the header's boxes redraw every second; each keeps where a viewer scrolled it.
|
|
902
1078
|
const scrolled = Object.fromEntries([...bar.querySelectorAll(".k-box")].map((b) => [b.dataset.box, b.scrollTop]));
|
|
903
|
-
renderKiosk(bar, s, shownNow()
|
|
1079
|
+
renderKiosk(bar, s, shownNow());
|
|
904
1080
|
for (const b of bar.querySelectorAll(".k-box")) {
|
|
905
1081
|
if (scrolled[b.dataset.box]) b.scrollTop = scrolled[b.dataset.box];
|
|
906
1082
|
fade(b);
|
|
907
1083
|
b.addEventListener("scroll", () => fade(b), { passive: true });
|
|
908
1084
|
}
|
|
1085
|
+
// behold#571: the wave the hold panel shows, whose job row lights with it.
|
|
1086
|
+
const hold = s.demo && s.demo.demo ? holdModel(s, s.demo.demo) : null;
|
|
1087
|
+
const held = hold && Number.isInteger(hold.wave) ? hold.wave : null;
|
|
1088
|
+
if (held !== s.held) {
|
|
1089
|
+
s.held = held;
|
|
1090
|
+
glow();
|
|
1091
|
+
tellHover(s.hover);
|
|
1092
|
+
}
|
|
909
1093
|
whatText();
|
|
910
1094
|
renderViewToggle(views, shown, { components: s.components && ok, onPick: pickView });
|
|
1095
|
+
drawReading(shown.view, ok);
|
|
911
1096
|
// behold#571: with no graph to show, the graph pane folds away and the runs and the log take its width.
|
|
912
1097
|
if (typeof document !== "undefined" && document.body && document.body.classList) {
|
|
913
1098
|
document.body.classList.toggle("k-nograph", !!vendor && !ok);
|
package/web/kiosk.test.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { INTRO_HEAD, STEP_VIEW, STEP_WORDS, aboutRows, approvalPanel, approveGloss, chantProject, focusRoots, introText, scenarioHead, frameSrc, factLines, kioskView,
|
|
2
|
+
import { BEAT_CHANGES, INTRO_HEAD, READ_STORE, READ_TITLE, STEP_VIEW, STEP_WORDS, aboutRows, approvalPanel, approveGloss, chantProject, factsLine, focusRoots, holdHead, holdModel, introText, readStored, readingRows, renderReading, scenarioHead, frameSrc, factLines, kioskView, matchingPull, pendingApproval, renderKiosk, renderViewToggle, reportless, runPanel, runPin, stepView, viewZoom } from "./kiosk.js";
|
|
3
3
|
import { VENDORS } from "./kiosk-vendor.js";
|
|
4
4
|
import { PICK_HOLD_MS } from "./kiosk-runs.js";
|
|
5
5
|
|
|
@@ -42,6 +42,25 @@ describe("focusRoots (#569)", () => {
|
|
|
42
42
|
});
|
|
43
43
|
});
|
|
44
44
|
|
|
45
|
+
describe("the hold panel (behold#571)", () => {
|
|
46
|
+
it("heads the panel with its wave, its run and its plan, else what its note is about", () => {
|
|
47
|
+
expect(holdHead({ wave: 2, run: 3605, digest: "jcs1-sha256:02812a1b9999" })).toBe("Wave 2 · run #3605 · plan 02812a1b");
|
|
48
|
+
expect(holdHead({ wave: 3 })).toBe("Wave 3");
|
|
49
|
+
expect(holdHead({ pull: 7 })).toBe("Pull request #7");
|
|
50
|
+
expect(holdHead({ commit: "abc12345ffff" })).toBe("Merge abc12345");
|
|
51
|
+
expect(holdHead({})).toBe(null);
|
|
52
|
+
});
|
|
53
|
+
it("holds how the hold ends, else the driver's approval, else the run's note, and nothing past that", () => {
|
|
54
|
+
const model = { wave: 2, digest: "sha256:02812a1b", run: 3605, rows: [] };
|
|
55
|
+
expect(holdModel({ approval: model }, demo("waiting"))).toMatchObject({ kind: "approval", wave: 2, head: "Wave 2 · run #3605 · plan 02812a1b" });
|
|
56
|
+
const p = progress([{ number: 2, state: "waiting", roots: ["app"], reads: [], digest: "jcs1-sha256:0accc105ba06" }]);
|
|
57
|
+
expect(holdModel({ progress: p }, demo("waiting", { next: { action: "approve wave-2", at: null } }))).toMatchObject({ kind: "driver", wave: 2, head: "Wave 2 · plan 0accc105" });
|
|
58
|
+
expect(holdModel({ answer: null, progress: null }, demo("planned", { pull: 989 }))).toEqual({ kind: "note", wave: null, head: "Pull request #989", lines: [{ cls: "k-note", text: "The pipeline is planning pull request #989." }] });
|
|
59
|
+
expect(holdModel({ noReports: true }, demo("planned"))).toBe(null);
|
|
60
|
+
expect(holdModel({ answer, progress: null }, demo("planned"))).toBe(null);
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
|
|
45
64
|
describe("frameSrc (#569)", () => {
|
|
46
65
|
it("frames behold's own view, bare, told its host", () => {
|
|
47
66
|
expect(frameSrc("http://localhost:4700")).toBe("/?embed=1&bare=1&zoom=resources&host=http%3A%2F%2Flocalhost%3A4700");
|
|
@@ -51,6 +70,8 @@ describe("frameSrc (#569)", () => {
|
|
|
51
70
|
describe("factLines (#569)", () => {
|
|
52
71
|
it("says the pull request's totals and blast radius", () => {
|
|
53
72
|
expect(factLines(demo("planned"), answer)).toEqual(["pull request #7 changes across 3 roots: 3 update", "blast radius: app, edge, network", "unchanged: other"]);
|
|
73
|
+
// behold#571: the lead block shows them as one line.
|
|
74
|
+
expect(factsLine(demo("planned"), answer)).toBe("pull request #7 changes across 3 roots: 3 update · blast radius: app, edge, network · unchanged: other");
|
|
54
75
|
expect(factLines(demo("planned"), answer, "terragrunt")[0]).toBe("pull request #7 changes across 3 units: 3 update");
|
|
55
76
|
});
|
|
56
77
|
});
|
|
@@ -128,27 +149,37 @@ describe("the scenario's card under the title (behold#571)", () => {
|
|
|
128
149
|
const bar = document.createElement("header");
|
|
129
150
|
const s = { demo: { source: "fx", read: "2026-10-15T03:00:00Z", demo: demo("failed", { scenario: "failure", about }) }, answer: null, progress: null };
|
|
130
151
|
renderKiosk(bar, s, new Date("2026-10-15T03:01:00Z"));
|
|
131
|
-
const left = find(bar, "k-
|
|
132
|
-
// behold#571: the title, the
|
|
133
|
-
expect(left.children.map((c) => c.className
|
|
134
|
-
expect(left.children.map((c) => c.children.map((x) => x.className.split(" ")[0]))).toEqual([["k-title"], ["k-
|
|
152
|
+
const left = find(bar, "k-lead")[0];
|
|
153
|
+
// behold#571: the lead block: the title, the two beats (what changes, the step), the progress, the rest of the card, the facts; each box fixed.
|
|
154
|
+
expect(left.children.map((c) => c.className)).toEqual(["k-box k-box-title", "k-box k-box-beat", "k-box k-box-step", "k-progress", "k-box k-box-more", "k-box k-box-facts k-box-empty"]);
|
|
155
|
+
expect(left.children.map((c) => c.children.map((x) => x.className.split(" ")[0]))).toEqual([["k-title"], ["k-beat"], ["k-step"], ["k-strip", "k-next"], ["k-about"], []]);
|
|
156
|
+
const beat = find(bar, "k-beat")[0];
|
|
157
|
+
expect(beat.children.map((c) => [c.className, c.textContent])).toEqual([["k-beat-label", BEAT_CHANGES], ["k-beat-text", about.changes]]);
|
|
158
|
+
// The step's progress sits with the step line: the strip's stops, the driver's next action.
|
|
159
|
+
expect(find(bar, "k-stop").map((c) => c.textContent)).toEqual(["pull request", "planned", "merged", "waves", "applied", "reset"]);
|
|
160
|
+
// The rest of the card, one quieter paragraph: each field after its label.
|
|
135
161
|
const card = find(bar, "k-about")[0];
|
|
136
|
-
expect(card.tagName).toBe("
|
|
137
|
-
expect(card.children.map((c) => [c.
|
|
138
|
-
["
|
|
139
|
-
["
|
|
140
|
-
["dt", "Shows"], ["dd", about.shows],
|
|
162
|
+
expect(card.tagName).toBe("p");
|
|
163
|
+
expect(card.children.filter((c) => c.className).map((c) => [c.className, c.textContent])).toEqual([
|
|
164
|
+
["k-about-label", "Watch for"], ["k-about-text", about.watch],
|
|
165
|
+
["k-about-label", "Shows"], ["k-about-text", about.shows],
|
|
141
166
|
]);
|
|
142
167
|
|
|
143
168
|
s.demo.demo = demo("reset", { scenario: "base", about: null });
|
|
144
169
|
renderKiosk(bar, s, new Date("2026-10-15T03:01:00Z"));
|
|
145
170
|
expect(find(bar, "k-about")).toEqual([]);
|
|
171
|
+
expect(find(bar, "k-beat")).toEqual([]);
|
|
172
|
+
// Render what's present: the boxes with nothing in them draw no box.
|
|
173
|
+
expect(find(bar, "k-box-empty").map((c) => c.className)).toEqual(["k-box k-box-beat k-box-empty", "k-box k-box-more k-box-empty", "k-box k-box-facts k-box-empty"]);
|
|
174
|
+
// On the base, the hold panel holds the run's note, quiet, with no wave to light.
|
|
175
|
+
expect(find(bar, "k-box-hold")[0].className).toBe("k-box k-box-hold k-hold");
|
|
146
176
|
|
|
147
177
|
// behold#571: no intro band at a live step; between scenarios the intro takes the card's box.
|
|
148
178
|
const intro = "Terraform keeps what it built in a state file.";
|
|
149
179
|
s.demo.demo = demo("waiting", { scenario: "failure", about, intro });
|
|
150
180
|
renderKiosk(bar, s, new Date("2026-10-15T03:01:00Z"));
|
|
151
181
|
expect(find(bar, "k-intro")).toEqual([]);
|
|
182
|
+
expect(find(bar, "k-beat")).toHaveLength(1);
|
|
152
183
|
s.demo.demo = demo("reset", { scenario: "failure", about, intro });
|
|
153
184
|
renderKiosk(bar, s, new Date("2026-10-15T03:01:00Z"));
|
|
154
185
|
const shown = find(bar, "k-intro");
|
|
@@ -193,8 +224,9 @@ describe("the approval panel's drawing (behold#571)", () => {
|
|
|
193
224
|
],
|
|
194
225
|
};
|
|
195
226
|
const panel = approvalPanel(model, { showLine: (l) => shown.push(l) });
|
|
196
|
-
|
|
197
|
-
expect(
|
|
227
|
+
// behold#571: the wave, the run and the plan head the hold panel; the panel's own head says what its rows are.
|
|
228
|
+
expect(find(panel, "k-ap-head")[0].textContent).toBe("How this hold ends · times in UTC");
|
|
229
|
+
expect(holdHead({ wave: model.wave, run: 3605, digest: model.digest })).toBe("Wave 2 · run #3605 · plan 0accc105");
|
|
198
230
|
expect(find(panel, "k-ap-row").map((r) => r.className)).toEqual(["k-ap-row k-ap-lit", "k-ap-row k-ap-dim", "k-ap-row k-ap-dim", "k-ap-row k-ap-dim"]);
|
|
199
231
|
expect(find(panel, "k-ap-facts")[0].textContent).toBe("04:09:41 · ledger 57869649");
|
|
200
232
|
expect(find(panel, "k-command")[0].textContent).toBe("chant approve tf-apply wave-2");
|
|
@@ -244,21 +276,67 @@ describe("which view the frame shows (#571)", () => {
|
|
|
244
276
|
expect(viewZoom("nonsense")).toBe("resources");
|
|
245
277
|
});
|
|
246
278
|
|
|
247
|
-
it("says how to read the view shown", () => {
|
|
248
|
-
|
|
249
|
-
expect(
|
|
279
|
+
it("says how to read the view shown, a row per mark", () => {
|
|
280
|
+
const words = (v, t) => readingRows(v, t).map((r) => r.words).join(" ");
|
|
281
|
+
expect(readingRows("components").map((r) => r.mark)).toEqual(["card", "box", "solid", "dashed", "order", "marks"]);
|
|
282
|
+
expect(readingRows("resources").map((r) => r.mark)).toEqual(["box", "card", "solid", "dashed", "marks"]);
|
|
283
|
+
expect(readingRows("components")[0].words).toBe("Card: a Terraform root with its own state.");
|
|
284
|
+
expect(readingRows("components")[1].words).toBe("Box: a wave, titled with the job that applies it.");
|
|
285
|
+
expect(readingRows("resources")[0].words).toBe("Box: a Terraform root with its own state.");
|
|
286
|
+
expect(words("components")).toMatch(/Solid arrow: a read of applied outputs\. Dashed arrow: planned values, before they apply\./);
|
|
287
|
+
expect(words("components")).toMatch(/Marks: the forge and the tools a job runs/);
|
|
288
|
+
// Short items, so two to a line keep the open frame a few lines tall.
|
|
289
|
+
for (const v of ["components", "resources"]) for (const r of readingRows(v, "terragrunt")) expect(r.words.length, r.words).toBeLessThanOrEqual(50);
|
|
250
290
|
// behold#571: a Terragrunt scenario names its units.
|
|
251
291
|
for (const v of ["components", "resources"]) {
|
|
252
|
-
const
|
|
253
|
-
expect(
|
|
254
|
-
expect(
|
|
255
|
-
expect(words).not.toMatch(/\broots?\b/);
|
|
292
|
+
const w = words(v, "terragrunt");
|
|
293
|
+
expect(w).toMatch(/a Terragrunt unit with its own state/);
|
|
294
|
+
expect(w).not.toMatch(/\broots?\b/);
|
|
256
295
|
}
|
|
296
|
+
expect(words("components", "terragrunt")).toMatch(/Waves apply in order, units in a wave together/);
|
|
257
297
|
// A tool whose pipeline writes no reports: behold's own components graph, with no jobs or planned values in it.
|
|
258
|
-
expect(
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
298
|
+
expect(readingRows("components", "chant")).toEqual([
|
|
299
|
+
{ mark: "card", words: "Card: a Terraform root with its own state." },
|
|
300
|
+
{ mark: "box", words: "Box: a wave of components that apply together." },
|
|
301
|
+
{ mark: "solid", words: "Arrow: a component reading another's outputs." },
|
|
302
|
+
]);
|
|
303
|
+
expect(readingRows("resources", "chant")).toEqual([{ mark: "box", words: "Box: a Terraform root with its own state." }]);
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
it("draws 'How to read this' as a header that folds the rows, and keeps the viewer's fold", () => {
|
|
307
|
+
const was = globalThis.document;
|
|
308
|
+
globalThis.document = { createElement: (tag) => {
|
|
309
|
+
const n = { tagName: tag, className: "", textContent: "", children: [], attrs: {}, listeners: {} };
|
|
310
|
+
n.appendChild = (c) => (n.children.push(c), c);
|
|
311
|
+
n.append = (...cs) => cs.forEach((c) => n.children.push(c));
|
|
312
|
+
n.replaceChildren = () => (n.children = []);
|
|
313
|
+
n.setAttribute = (k, v) => (n.attrs[k] = v);
|
|
314
|
+
n.addEventListener = (k, f) => (n.listeners[k] = f);
|
|
315
|
+
return n;
|
|
316
|
+
} };
|
|
317
|
+
try {
|
|
318
|
+
const host = document.createElement("section");
|
|
319
|
+
const toggled = [];
|
|
320
|
+
renderReading(host, "components", null, { open: true, onToggle: (o) => toggled.push(o) });
|
|
321
|
+
expect(host.hidden).toBe(false);
|
|
322
|
+
expect(host.children.map((c) => c.className)).toEqual(["k-read-head", "k-read-rows"]);
|
|
323
|
+
expect(host.children[0].textContent).toBe(READ_TITLE);
|
|
324
|
+
expect(host.children[1].children.map((li) => li.children[0].className)).toEqual(["k-read-mark k-read-card", "k-read-mark k-read-box", "k-read-mark k-read-solid", "k-read-mark k-read-dashed", "k-read-mark k-read-order", "k-read-mark k-read-marks"]);
|
|
325
|
+
host.children[0].listeners.click();
|
|
326
|
+
expect(toggled).toEqual([false]);
|
|
327
|
+
// Folded, the header stays as its one line.
|
|
328
|
+
renderReading(host, "components", null, { open: false });
|
|
329
|
+
expect(host.children.map((c) => c.className)).toEqual(["k-read-head"]);
|
|
330
|
+
expect(host.children[0].attrs["aria-expanded"]).toBe("false");
|
|
331
|
+
} finally {
|
|
332
|
+
globalThis.document = was;
|
|
333
|
+
}
|
|
334
|
+
const store = (v) => ({ getItem: (k) => (k === READ_STORE ? v : null) });
|
|
335
|
+
expect(readStored(store("open"))).toBe(true);
|
|
336
|
+
expect(readStored(store("closed"))).toBe(false);
|
|
337
|
+
expect(readStored(store(null))).toBe(null);
|
|
338
|
+
expect(readStored({ getItem: () => { throw new Error("blocked"); } })).toBe(null);
|
|
339
|
+
expect(readStored(null)).toBe(null);
|
|
262
340
|
});
|
|
263
341
|
|
|
264
342
|
it("knows a tool whose pipeline writes no terragucci reports, and a chant project behold draws itself", () => {
|
|
@@ -383,6 +461,10 @@ describe("the kiosk for a viewer new to the demo (behold#571)", () => {
|
|
|
383
461
|
const card = find(bar, "k-approve")[0];
|
|
384
462
|
expect(card.children.map((c) => c.className)).toEqual(["k-approve-gloss", "k-command", "k-approve-then"]);
|
|
385
463
|
expect(card.children[1].textContent).toBe("chant approve tf-apply wave-2 --actor <reviewer> --sign <reviewer key>");
|
|
464
|
+
// behold#571: the hold panel is headed with its wave and plan, and lit as its wave's job row is.
|
|
465
|
+
const hold = find(bar, "k-box-hold")[0];
|
|
466
|
+
expect(hold.className).toBe("k-box k-box-hold k-hold k-hold-wave");
|
|
467
|
+
expect(hold.children[0].textContent).toBe("Wave 2 · plan 0accc105");
|
|
386
468
|
} finally {
|
|
387
469
|
globalThis.document = was;
|
|
388
470
|
}
|