@intentius/behold 0.30.2 → 0.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +791 -16
- package/README.md +78 -23
- package/THIRD_PARTY.md +6 -5
- package/demos.json +14 -9
- package/dist/cli.js +51926 -20221
- package/example-carve/README.md +19 -23
- package/example-carve/app/package.json +1 -1
- package/example-carve/app/src/carved.ts +3 -3
- package/example-carve/carve-report.json +1 -1
- package/example-carve/{legacy-tf → tf-root}/terraform.tfstate +1 -1
- package/example-choudoufu-estate/README.md +7 -0
- package/example-choudoufu-estate/chant.workspace.json +1 -1
- package/example-choudoufu-estate/scripts/choudoufu-down.sh +2 -1
- package/example-choudoufu-estate/scripts/choudoufu-up.sh +10 -3
- package/example-terraform-estate/README.md +32 -5
- package/example-terraform-estate/chant.workspace.json +1 -1
- package/example-terraform-estate/recorded/adoption/platform.json +72 -0
- package/example-terraform-estate/recorded/adoption/prod.json +224 -0
- package/example-three-cloud/README.md +111 -18
- package/example-three-cloud/aws/Pulumi.yaml +15 -0
- package/example-three-cloud/aws/index.ts +174 -0
- package/example-three-cloud/aws/package-lock.json +2725 -0
- package/example-three-cloud/aws/package.json +14 -0
- package/example-three-cloud/aws/tsconfig.json +17 -0
- package/example-three-cloud/azure/main.tf +48 -0
- package/example-three-cloud/azure/site.tf +104 -0
- package/example-three-cloud/chant.config.json +9 -0
- package/example-three-cloud/chant.workspace.json +30 -4
- package/example-three-cloud/dns/chant.config.ts +26 -1
- package/example-three-cloud/dns/src/records.component.ts +32 -6
- package/example-three-cloud/package-lock.json +48 -27
- package/example-three-cloud/package.json +8 -6
- package/example-three-cloud/scripts/emulators-up.sh +28 -1
- package/example-three-cloud/scripts/front-door.ts +679 -86
- package/package.json +26 -8
- package/schemas/graph/v1/graph.schema.json +140 -0
- package/web/adopt-pulumi.js +114 -0
- package/web/adopt-pulumi.test.js +28 -0
- package/web/adopt.js +203 -0
- package/web/adopt.test.js +27 -0
- package/web/app.js +367 -14
- package/web/boot-motion.js +6 -0
- package/web/carve-steps.js +1 -1
- package/web/carve-steps.test.js +2 -2
- package/web/change-set-overlay.js +12 -5
- package/web/change-set-overlay.test.js +22 -0
- package/web/cut-around.d.ts +30 -0
- package/web/cut-around.js +138 -0
- package/web/drift-stream.js +241 -0
- package/web/drift-stream.test.js +146 -0
- package/web/edge-weight.d.ts +8 -2
- package/web/edge-weight.js +38 -4
- package/web/edge-weight.test.js +55 -1
- package/web/graph-query.js +180 -0
- package/web/graph-query.test.js +49 -0
- package/web/graph.html +107 -0
- package/web/index-diff.js +109 -0
- package/web/index-diff.test.js +39 -0
- package/web/index.html +45 -20
- package/web/kiosk-ask-tips.js +15 -5
- package/web/kiosk-ask-tips.test.js +14 -1
- package/web/kiosk-estate-scene.js +72 -8
- package/web/kiosk-light-frame.js +1 -0
- package/web/kiosk-light.js +41 -3
- package/web/kiosk-member-kind.test.js +140 -0
- package/web/kiosk-popover.js +4 -1
- package/web/kiosk-side.js +296 -0
- package/web/kiosk-side.test.js +249 -0
- package/web/kiosk-watch.js +12 -0
- package/web/kiosk-watch.test.js +15 -1
- package/web/kiosk.html +47 -1
- package/web/kiosk.js +106 -7
- package/web/member-kind.js +31 -0
- package/web/neighbourhood.js +105 -0
- package/web/neighbourhood.test.js +131 -0
- package/web/outside-refs.js +515 -0
- package/web/outside-refs.test.js +249 -0
- package/web/template-apps.js +245 -0
- package/web/template-apps.test.js +252 -0
- package/web/templates.js +285 -0
- package/web/templates.test.js +155 -0
- package/web/terragucci-lifecycle.js +112 -62
- package/web/terragucci-lifecycle.test.js +29 -1
- package/web/terragucci-timeline.js +39 -2
- package/web/terragucci-timeline.test.js +42 -1
- package/web/theme-paint.js +14 -0
- package/example-three-cloud/aws/chant.config.ts +0 -8
- package/example-three-cloud/aws/site.component.ts +0 -13
- package/example-three-cloud/aws/src/site.ts +0 -27
- package/example-three-cloud/azure/chant.config.ts +0 -1
- package/example-three-cloud/azure/src/site.component.ts +0 -13
- package/example-three-cloud/azure/src/site.ts +0 -18
- /package/example-carve/{legacy-tf → tf-root}/cdn.tf +0 -0
- /package/example-carve/{legacy-tf → tf-root}/compute.tf +0 -0
- /package/example-carve/{legacy-tf → tf-root}/floci-override.tf.disabled +0 -0
- /package/example-carve/{legacy-tf → tf-root}/modules/cdn/main.tf +0 -0
- /package/example-carve/{legacy-tf → tf-root}/naming.tf +0 -0
- /package/example-carve/{legacy-tf → tf-root}/network.tf +0 -0
- /package/example-carve/{legacy-tf → tf-root}/observability.tf +0 -0
- /package/example-carve/{legacy-tf → tf-root}/outputs.tf +0 -0
- /package/example-carve/{legacy-tf → tf-root}/storage.tf +0 -0
- /package/example-carve/{legacy-tf → tf-root}/versions.tf +0 -0
package/web/index.html
CHANGED
|
@@ -9,20 +9,7 @@
|
|
|
9
9
|
applyTheme() keeps what it last painted under behold.theme.paint; this
|
|
10
10
|
applies that record when it belongs to the stored theme. A blocked or
|
|
11
11
|
empty store leaves the default as it is. -->
|
|
12
|
-
<script>
|
|
13
|
-
// The kiosk's frame (?bare=1) paints nothing until its theme is applied, so the kiosk's own ground shows through:
|
|
14
|
-
// the stylesheet's default --bg is white, and a first load with no stored paint flashed it over a dark pane.
|
|
15
|
-
try { if (/[?&]bare=1(&|$)/.test(location.search)) document.documentElement.style.setProperty("--bg", "transparent"); } catch (e) { /* the default paints */ }
|
|
16
|
-
try {
|
|
17
|
-
var beholdTheme = localStorage.getItem("behold.theme");
|
|
18
|
-
var beholdPaint = beholdTheme && JSON.parse(localStorage.getItem("behold.theme.paint") || "null");
|
|
19
|
-
if (beholdPaint && beholdPaint.name === beholdTheme && beholdPaint.vars) {
|
|
20
|
-
var beholdRoot = document.documentElement;
|
|
21
|
-
for (var k in beholdPaint.vars) if (k.slice(0, 2) === "--") beholdRoot.style.setProperty(k, beholdPaint.vars[k]);
|
|
22
|
-
if (beholdPaint.scheme) beholdRoot.style.setProperty("color-scheme", beholdPaint.scheme);
|
|
23
|
-
}
|
|
24
|
-
} catch (e) { /* private mode or a bad record: the default paints */ }
|
|
25
|
-
</script>
|
|
12
|
+
<script src="./theme-paint.js"></script>
|
|
26
13
|
<title>behold</title>
|
|
27
14
|
<!-- #393: "nothing in the browser console" includes the 404 every page
|
|
28
15
|
load has always fetched for itself. behold ships no icon file and its
|
|
@@ -180,6 +167,12 @@
|
|
|
180
167
|
/* behold#878: an edge weighed by how it was found (web/edge-weight.js). */
|
|
181
168
|
:is(#graph, .edge-swatch) g[data-edge-weight="wired"] .pin-edge-line { stroke-width: 2.4px; }
|
|
182
169
|
:is(#graph, .edge-swatch) g[data-edge-weight="inferred"] .pin-edge-line { stroke-dasharray: 1.5 4; stroke-linecap: round; }
|
|
170
|
+
/* behold#1080: chant's catalog (src/catalog-draw.ts): joined by rule, to a placeholder card, one of several. */
|
|
171
|
+
:is(#graph, .edge-swatch) g[data-edge-weight="joined"] .pin-edge-line { stroke-width: 2.2px; }
|
|
172
|
+
:is(#graph, .edge-swatch) g[data-edge-weight="dangling"] .pin-edge-line { stroke-dasharray: 6 4; }
|
|
173
|
+
:is(#graph, .edge-swatch) g[data-edge-weight="ambiguous"] .pin-edge-line { stroke-width: 2.4px; stroke-dasharray: 0.5 5; stroke-linecap: round; }
|
|
174
|
+
#graph g[data-node-dangling="true"] > rect:first-of-type { stroke-dasharray: 6 4; }
|
|
175
|
+
#graph g[data-legend="catalog"] { display: none; }
|
|
183
176
|
:is(#graph, .edge-swatch) g[data-edge-weight="plumbing"] .pin-edge-line { stroke-width: 1px; stroke-dasharray: 4 3; stroke: var(--muted); }
|
|
184
177
|
#graph g[data-edge-weight="hidden"] { display: none; }
|
|
185
178
|
#graph-legend .gl-edge { flex: none; overflow: visible; width: 22px; height: 10px; }
|
|
@@ -342,6 +335,39 @@
|
|
|
342
335
|
#tab-trunk a { color: inherit; }
|
|
343
336
|
#tab-trunk .lane-change-set { color: var(--pending); }
|
|
344
337
|
/* behold#685: a plan run locally, beside CI's, in the runs pane's run view (web/kiosk-runs.js renderRun; kiosk.html's rules, scoped). */
|
|
338
|
+
#panel-body #tab-adopt.active { display: flex; flex-direction: column; gap: var(--s1); font-size: var(--t-caption); }
|
|
339
|
+
#tab-adopt h3 { margin: var(--s3) 0 0; font-size: var(--t-caption); overflow-wrap: anywhere; }
|
|
340
|
+
#tab-adopt .tg-legend { color: var(--muted); overflow-wrap: anywhere; }
|
|
341
|
+
#tab-adopt .tg-refusal { color: var(--degraded); font-weight: 600; overflow-wrap: anywhere; }
|
|
342
|
+
#tab-adopt .ad-card { border-top: 1px solid var(--rule); padding-top: var(--s2); display: flex; flex-direction: column; gap: var(--s1); }
|
|
343
|
+
#tab-adopt .ad-label { font-weight: 600; margin-top: var(--s2); }
|
|
344
|
+
#tab-adopt .ad-list { margin: 0; padding-left: 1.2em; }
|
|
345
|
+
#tab-adopt .ad-row { display: flex; gap: var(--s2); flex-wrap: wrap; }
|
|
346
|
+
#tab-adopt .ad-cmd { font-family: var(--font-mono); overflow-wrap: anywhere; cursor: copy; }
|
|
347
|
+
#tab-adopt .ad-recorded { font-style: italic; }
|
|
348
|
+
#tab-adopt .ad-out { font: 0.95em/1.45 var(--font-mono); white-space: pre-wrap; max-height: 12em; overflow-y: auto; }
|
|
349
|
+
#tab-adopt .ad-table { border-collapse: collapse; width: 100%; }
|
|
350
|
+
#tab-adopt .ad-table td, #tab-adopt .ad-table th { text-align: left; padding: 2px var(--s2) 2px 0; vertical-align: top; border-top: 1px solid var(--rule); }
|
|
351
|
+
#tab-adopt .ad-addr { font-family: var(--font-mono); overflow-wrap: anywhere; }
|
|
352
|
+
#tab-adopt .ad-claimed .ad-status { color: var(--managed); } #tab-adopt .ad-left-out .ad-status { color: var(--foreign); } #tab-adopt .ad-unknown .ad-status { color: var(--degraded); }
|
|
353
|
+
#tab-adopt .ad-refused { color: var(--degraded); }
|
|
354
|
+
/* behold#1035: the Templates tab (web/templates.js), drawn like Adopt. */
|
|
355
|
+
#panel-body #tab-templates.active { display: flex; flex-direction: column; gap: var(--s1); font-size: var(--t-caption); }
|
|
356
|
+
#tab-templates h3 { margin: var(--s3) 0 0; font-size: var(--t-caption); overflow-wrap: anywhere; }
|
|
357
|
+
#tab-templates .tg-legend { color: var(--muted); overflow-wrap: anywhere; }
|
|
358
|
+
#tab-templates .tg-refusal { color: var(--degraded); font-weight: 600; overflow-wrap: anywhere; }
|
|
359
|
+
#tab-templates .ad-card { border-top: 1px solid var(--rule); padding-top: var(--s2); display: flex; flex-direction: column; gap: var(--s1); }
|
|
360
|
+
#tab-templates .ad-label { font-weight: 600; margin-top: var(--s2); }
|
|
361
|
+
#tab-templates .ad-row { display: flex; gap: var(--s2); flex-wrap: wrap; margin-top: var(--s2); }
|
|
362
|
+
#tab-templates .tp-form { display: flex; flex-direction: column; gap: 2px; }
|
|
363
|
+
#tab-templates .tp-form input[type="text"], #tab-templates .tp-form input[type="number"], #tab-templates .tp-form textarea { font: inherit; max-width: 100%; }
|
|
364
|
+
#tab-templates .tp-form textarea { min-height: 4em; font-family: var(--font-mono); }
|
|
365
|
+
#tab-templates .tp-request { align-self: flex-start; }
|
|
366
|
+
#tab-templates .tp-all { align-self: flex-start; }
|
|
367
|
+
/* behold#1036: an app's part of the inspect pane (web/template-apps.js). */
|
|
368
|
+
#inspect-body .tpl-app .tpl-app-fact { margin: 2px 0; overflow-wrap: anywhere; }
|
|
369
|
+
#inspect-body .tpl-app .tpl-app-buttons { display: flex; gap: var(--s2); flex-wrap: wrap; margin-top: var(--s2); }
|
|
370
|
+
#inspect-body .tpl-app .tpl-app-result { overflow-wrap: anywhere; }
|
|
345
371
|
#panel-body #tab-local-runs.active { display: flex; flex-direction: column; gap: var(--s1); font-size: var(--t-caption); }
|
|
346
372
|
#tab-local-runs h3 { margin: var(--s3) 0 0; font-size: var(--t-caption); }
|
|
347
373
|
#tab-local-runs .tg-legend { color: var(--muted); overflow-wrap: anywhere; }
|
|
@@ -985,6 +1011,10 @@
|
|
|
985
1011
|
filled — the fill is the status channel and this card has no status yet,
|
|
986
1012
|
so colouring it would claim an observation behold has not made. */
|
|
987
1013
|
#graph [data-pending-read] { opacity: 0.55; }
|
|
1014
|
+
/* behold#998: a card a started drift read has not reported yet. Not a
|
|
1015
|
+
status, so the fill is left as it was; the stream's record paints it. */
|
|
1016
|
+
#graph [data-drift-reading] { opacity: 0.6; }
|
|
1017
|
+
#graph [data-drift-reading] rect { stroke-dasharray: 3 3; }
|
|
988
1018
|
#graph [data-pending-read] rect { stroke-dasharray: 4 3; }
|
|
989
1019
|
@media (prefers-reduced-motion: no-preference) {
|
|
990
1020
|
#graph [data-pending-read] { animation: pending-breathe calc(var(--beat) * 2) ease-in-out infinite; }
|
|
@@ -1167,11 +1197,6 @@
|
|
|
1167
1197
|
<div id="palette"><div class="box"><input id="pal-input" placeholder="type a command, or an address… (Esc to close)" autocomplete="off"><div id="pal-list"></div></div></div>
|
|
1168
1198
|
<script type="module" src="./app.js"></script>
|
|
1169
1199
|
<!-- behold#725: the shared beat paused in a hidden tab, and the shared tooltip for the graph's badges. -->
|
|
1170
|
-
<script type="module">
|
|
1171
|
-
import { installMotion } from "./motion.js";
|
|
1172
|
-
import { installTooltips } from "./tooltip.js";
|
|
1173
|
-
installMotion();
|
|
1174
|
-
installTooltips(document);
|
|
1175
|
-
</script>
|
|
1200
|
+
<script type="module" src="./boot-motion.js"></script>
|
|
1176
1201
|
</body>
|
|
1177
1202
|
</html>
|
package/web/kiosk-ask-tips.js
CHANGED
|
@@ -284,6 +284,17 @@ export function dockCorner(area, w, h, lit = []) {
|
|
|
284
284
|
return null;
|
|
285
285
|
}
|
|
286
286
|
|
|
287
|
+
/**
|
|
288
|
+
* The room a tip may dock in, in page pixels: the shown graph frame (`frame`), less what the prompt pane (`ask`) covers
|
|
289
|
+
* under it and what the side pane (`side`: web/kiosk-side.js, open or folded to its tab) covers at its right. Either
|
|
290
|
+
* may be null (not shown).
|
|
291
|
+
*/
|
|
292
|
+
export function tipArea(frame, ask = null, side = null) {
|
|
293
|
+
const bottom = ask ? Math.min(frame.bottom, ask.top) : frame.bottom;
|
|
294
|
+
const right = side && side.left < frame.right && side.right > frame.left && side.top < bottom && side.bottom > frame.top ? Math.max(frame.left, side.left) : frame.right;
|
|
295
|
+
return { left: frame.left, top: frame.top, width: Math.max(0, right - frame.left), height: Math.max(0, bottom - frame.top) };
|
|
296
|
+
}
|
|
297
|
+
|
|
287
298
|
const STYLE_ID = "k-ask-tips-style";
|
|
288
299
|
const STYLE = `
|
|
289
300
|
#k-ask-tips { position: fixed; left: 0; top: 0; width: 0; height: 0; z-index: 50; pointer-events: none; overflow: hidden; }
|
|
@@ -331,14 +342,13 @@ export function mountAskTips({ win = window, doc = document, askHost, reduced =
|
|
|
331
342
|
const f = doc.getElementById("view");
|
|
332
343
|
return f && f.getClientRects().length > 0 ? f : null;
|
|
333
344
|
};
|
|
334
|
-
/** The graph's room above the prompt, in page pixels. */
|
|
345
|
+
/** The graph's room above the prompt and left of the side pane, in page pixels. */
|
|
335
346
|
const area = () => {
|
|
336
347
|
const f = shownFrame();
|
|
337
348
|
if (!f) return null;
|
|
338
|
-
const
|
|
339
|
-
const
|
|
340
|
-
|
|
341
|
-
return { left: r.left, top: r.top, width: r.width, height: Math.max(0, bottom - r.top), frame: f };
|
|
349
|
+
const side = [doc.getElementById("k-side"), doc.getElementById("k-side-tab")].find((n) => n && n.getClientRects().length > 0);
|
|
350
|
+
const room = tipArea(f.getBoundingClientRect(), askHost.hidden ? null : askHost.getBoundingClientRect(), side ? side.getBoundingClientRect() : null);
|
|
351
|
+
return { ...room, frame: f };
|
|
342
352
|
};
|
|
343
353
|
const litRects = (a) => {
|
|
344
354
|
if (!a || !a.frame || lit.source !== a.frame.contentWindow) return [];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { ATMOS_TIP, CHANT_TIPS, DEFAULT_TIPS, EDGE, LINK_RESUME_MS, PLAIN_FREE_TIP, TERRAGRUNT_TIP, TIP_FADE_MS, TIP_MIN_MS, TIP_QUIET_MS, TIP_WAIT_MS, actTip, actTips, createTipSequencer, dockCorner, holdMs, safeLink, shouldDismiss } from "./kiosk-ask-tips.js";
|
|
2
|
+
import { ATMOS_TIP, CHANT_TIPS, DEFAULT_TIPS, EDGE, LINK_RESUME_MS, PLAIN_FREE_TIP, TERRAGRUNT_TIP, TIP_FADE_MS, TIP_MIN_MS, TIP_QUIET_MS, TIP_WAIT_MS, actTip, actTips, createTipSequencer, dockCorner, holdMs, safeLink, shouldDismiss, tipArea } from "./kiosk-ask-tips.js";
|
|
3
3
|
|
|
4
4
|
function rig(opts = {}) {
|
|
5
5
|
const log = [];
|
|
@@ -357,3 +357,16 @@ describe("tip cards: a wait about to end", () => {
|
|
|
357
357
|
expect(shows(log)).toHaveLength(1);
|
|
358
358
|
});
|
|
359
359
|
});
|
|
360
|
+
|
|
361
|
+
describe("the room a tip docks in", () => {
|
|
362
|
+
const frame = { left: 5, top: 80, right: 1035, bottom: 900 };
|
|
363
|
+
it("is the graph frame above the prompt pane", () => {
|
|
364
|
+
expect(tipArea(frame, { top: 640 }, null)).toEqual({ left: 5, top: 80, width: 1030, height: 560 });
|
|
365
|
+
expect(tipArea(frame, null, null)).toEqual({ left: 5, top: 80, width: 1030, height: 820 });
|
|
366
|
+
});
|
|
367
|
+
it("ends where the side pane starts, open or folded to its tab", () => {
|
|
368
|
+
expect(tipArea(frame, { top: 640 }, { left: 1000, right: 1395, top: 80, bottom: 630 })).toEqual({ left: 5, top: 80, width: 995, height: 560 });
|
|
369
|
+
// A side pane beside the frame (the frame already narrowed for it) leaves the frame's room as it is.
|
|
370
|
+
expect(tipArea(frame, { top: 640 }, { left: 1045, right: 1395, top: 80, bottom: 630 }).width).toBe(1030);
|
|
371
|
+
});
|
|
372
|
+
});
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
import { askLayout, orderRoots } from "./kiosk-ask-layout.js";
|
|
13
13
|
import { applyOf, cardLines, cardTitle } from "./kiosk-light.js";
|
|
14
|
+
import { HOLE_WORDS, KIND_TAGS, memberKinds } from "./member-kind.js";
|
|
14
15
|
|
|
15
16
|
/** What hangs under a card for each unknown value it carries (web/kiosk-light-frame.js drawSlots). */
|
|
16
17
|
export const SLOT_ROW = 26;
|
|
@@ -63,30 +64,46 @@ export function askDeltas({ roots, nodes, boxes, extras = {}, edges = [], open }
|
|
|
63
64
|
/**
|
|
64
65
|
* A composed choudoufu run's scene: each estate's box and cards from `answer.estateScene`, laid out for `open`, and
|
|
65
66
|
* an edge for each reach the blast radius names. Null when the answer holds no scene.
|
|
67
|
+
*
|
|
68
|
+
* behold#1008: a composed chant run says what each member is (`answer.chant.members`, web/member-kind.js). Each root
|
|
69
|
+
* then carries `kind` (hole, previewed or plain), and a hole with nothing previewed keeps its box with one empty slot
|
|
70
|
+
* (`hole`: where its cards would be, and why there are none).
|
|
66
71
|
*/
|
|
67
72
|
export function sceneModel(answer, plan, progress, open) {
|
|
68
|
-
const
|
|
73
|
+
const kinds = memberKinds(answer);
|
|
74
|
+
// Kinds come from answer.chant alone: without it (a composed choudoufu run) a root's `hole` flag is ignored and
|
|
75
|
+
// nothing is marked, so the run draws as it did before behold#1008.
|
|
76
|
+
const isHole = (r) => kinds.size > 0 && (r.hole === true || (kinds.get(r.path) || {}).kind === "hole");
|
|
77
|
+
const scene = answer && answer.estateScene && Array.isArray(answer.estateScene.roots) ? answer.estateScene.roots.filter((r) => (r.resources && r.resources.length) || (r.path && r.name && isHole(r))) : [];
|
|
69
78
|
if (!scene.length) return null;
|
|
70
79
|
const extras = slotCounts(plan);
|
|
71
80
|
const ordered = upstreamFirst(scene, plan.edges);
|
|
81
|
+
const holeSlot = (r) => `${r.member}/${r.name}/~hole`;
|
|
82
|
+
const resourcesOf = (r) => r.resources || [];
|
|
72
83
|
const input = ordered.map((r) => ({
|
|
73
84
|
id: r.path,
|
|
74
|
-
cards: r.
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
85
|
+
cards: resourcesOf(r).length
|
|
86
|
+
? r.resources.map((res) => {
|
|
87
|
+
const id = `${r.member}/${r.name}/${res.address}`;
|
|
88
|
+
return { id, w: CARD_W, h: CARD_H + (extras[id] ? extras[id] * SLOT_ROW + 10 : 0) };
|
|
89
|
+
})
|
|
90
|
+
: [{ id: holeSlot(r), w: CARD_W, h: CARD_H }],
|
|
78
91
|
}));
|
|
79
92
|
const layout = askLayout(input, open);
|
|
80
93
|
const roots = ordered.map((r) => {
|
|
81
94
|
const box = layout.boxes[r.path];
|
|
82
95
|
const outcome = applyOf(r.path, progress);
|
|
83
96
|
const done = outcome ? outcome.apply === "applied" || outcome.apply === "no-changes" : null;
|
|
97
|
+
const known = kinds.get(r.path);
|
|
98
|
+
const kind = isHole(r) ? "hole" : known ? known.kind : null;
|
|
84
99
|
return {
|
|
85
100
|
path: r.path,
|
|
86
101
|
name: r.name,
|
|
87
102
|
member: r.member,
|
|
88
103
|
...box,
|
|
89
|
-
|
|
104
|
+
...(kind ? { kind } : {}),
|
|
105
|
+
...(!resourcesOf(r).length ? { hole: { ...layout.cards[holeSlot(r)], words: HOLE_WORDS, reasons: known ? known.reasons : [] } } : {}),
|
|
106
|
+
cards: resourcesOf(r).map((res) => {
|
|
90
107
|
const id = `${r.member}/${r.name}/${res.address}`;
|
|
91
108
|
const at = layout.cards[id];
|
|
92
109
|
const { name, type } = cardTitle(res.address);
|
|
@@ -112,6 +129,25 @@ export function sceneModel(answer, plan, progress, open) {
|
|
|
112
129
|
return { roots, edges, width: layout.width, height: layout.height, cols: layout.cols };
|
|
113
130
|
}
|
|
114
131
|
|
|
132
|
+
/** The words in a box whose plan is not written yet. */
|
|
133
|
+
export const WAITING_WORDS = "waiting for the plan";
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* The scene while the plan is not there to draw (a pull request being planned, the reset between acts): each
|
|
137
|
+
* estate the reports name, upstream on top, with one empty slot where its cards will be. Without it the pane holds
|
|
138
|
+
* dark until the plan job writes the plan, or keeps the last act's cards under the next act's title. Null when the
|
|
139
|
+
* reports name no estate.
|
|
140
|
+
*/
|
|
141
|
+
export function waitingModel(answer, plan, open) {
|
|
142
|
+
const scene = answer && answer.estateScene && Array.isArray(answer.estateScene.roots) ? answer.estateScene.roots.filter((r) => r && r.path && r.name) : [];
|
|
143
|
+
if (!scene.length) return null;
|
|
144
|
+
const ordered = upstreamFirst(scene, (plan && plan.edges) || []);
|
|
145
|
+
const slotOf = (r) => `${r.member}/${r.name}/~waiting`;
|
|
146
|
+
const layout = askLayout(ordered.map((r) => ({ id: r.path, cards: [{ id: slotOf(r), w: CARD_W, h: CARD_H }] })), open);
|
|
147
|
+
const roots = ordered.map((r) => ({ path: r.path, name: r.name, member: r.member, ...layout.boxes[r.path], cards: [], waiting: { ...layout.cards[slotOf(r)], words: WAITING_WORDS } }));
|
|
148
|
+
return { roots, edges: [], width: layout.width, height: layout.height, cols: layout.cols, waiting: true };
|
|
149
|
+
}
|
|
150
|
+
|
|
115
151
|
/** A curve from one card's edge to the other's, on the sides that face. */
|
|
116
152
|
export function edgePath(a, b) {
|
|
117
153
|
if (b.y >= a.y + a.h) {
|
|
@@ -175,10 +211,38 @@ export function drawScene(svg, model) {
|
|
|
175
211
|
scene.appendChild(g);
|
|
176
212
|
}
|
|
177
213
|
for (const r of model.roots) {
|
|
178
|
-
|
|
179
|
-
g
|
|
214
|
+
// behold#1008: a hole's box is dashed in the degraded tone; a hole's and a previewed member's carry a tag saying so.
|
|
215
|
+
const g = make("g", { "data-layout-box": `box:${r.name}`, ...(r.kind ? { "data-member-kind": r.kind } : {}) });
|
|
216
|
+
const hole = r.kind === "hole";
|
|
217
|
+
g.appendChild(make("rect", { "data-group-id": r.name, x: r.x, y: r.y, width: r.w, height: r.h, rx: 16, fill: "var(--panel, var(--bg))", "fill-opacity": 0.6, stroke: hole ? "var(--frame-degraded, var(--degraded))" : "var(--frame-neutral, var(--neutral))", "stroke-width": hole ? 2 : 1.5, ...(hole ? { "stroke-dasharray": "10 6" } : {}) }));
|
|
180
218
|
g.appendChild(make("text", { x: r.x + 18, y: r.y + 26, "font-size": 20, "font-weight": 700, "letter-spacing": ".5", fill: "var(--muted)" }, r.name));
|
|
219
|
+
const tag = r.kind && KIND_TAGS[r.kind];
|
|
220
|
+
if (tag) {
|
|
221
|
+
const color = hole ? "var(--frame-degraded, var(--degraded))" : "var(--frame-pending, var(--pending))";
|
|
222
|
+
const w = tag.length * 8.5 + 20;
|
|
223
|
+
const mark = make("g", { "data-kl-kind-mark": r.kind });
|
|
224
|
+
mark.appendChild(make("rect", { x: r.x + r.w - w - 14, y: r.y + 9, width: w, height: 24, rx: 12, fill: "none", stroke: color, "stroke-width": 1.5 }));
|
|
225
|
+
mark.appendChild(make("text", { x: r.x + r.w - w / 2 - 14, y: r.y + 26, "text-anchor": "middle", "font-size": 14, "font-weight": 600, fill: color }, tag));
|
|
226
|
+
g.appendChild(mark);
|
|
227
|
+
}
|
|
181
228
|
scene.appendChild(g);
|
|
229
|
+
if (r.hole) {
|
|
230
|
+
// Where the hole's cards would be: no data-node-id, as the waiting slot has none.
|
|
231
|
+
const h = r.hole;
|
|
232
|
+
const slot = make("g", { "data-kl-hole": r.name });
|
|
233
|
+
slot.appendChild(make("rect", { x: h.x, y: h.y, width: h.w, height: h.h, rx: 12, fill: "none", stroke: "var(--frame-degraded, var(--degraded))", "stroke-width": 1.5, "stroke-dasharray": "6 5" }));
|
|
234
|
+
slot.appendChild(make("text", { x: h.x + h.w / 2, y: h.y + h.h / 2 + 5, "text-anchor": "middle", "font-size": 15, fill: "var(--muted)" }, h.words));
|
|
235
|
+
if (h.reasons && h.reasons.length) slot.appendChild(make("title", {}, h.reasons.join("\n")));
|
|
236
|
+
scene.appendChild(slot);
|
|
237
|
+
}
|
|
238
|
+
if (r.waiting) {
|
|
239
|
+
// No data-node-id: the lighting and the reads look for cards, and this is where they will be, not one of them.
|
|
240
|
+
const w = r.waiting;
|
|
241
|
+
const slot = make("g", { "data-kl-waiting": r.name });
|
|
242
|
+
slot.appendChild(make("rect", { x: w.x, y: w.y, width: w.w, height: w.h, rx: 12, fill: "none", stroke: "var(--frame-neutral, var(--neutral))", "stroke-width": 1.5, "stroke-dasharray": "6 5" }));
|
|
243
|
+
slot.appendChild(make("text", { x: w.x + w.w / 2, y: w.y + w.h / 2 + 5, "text-anchor": "middle", "font-size": 15, fill: "var(--muted)" }, w.words));
|
|
244
|
+
scene.appendChild(slot);
|
|
245
|
+
}
|
|
182
246
|
for (const c of r.cards) {
|
|
183
247
|
const card = make("g", { "data-node-id": c.id, "data-kl-synth": "1" });
|
|
184
248
|
const edge = c.applied ? "var(--frame-managed, var(--managed))" : "var(--frame-pending, var(--pending))";
|
package/web/kiosk-light-frame.js
CHANGED
|
@@ -114,6 +114,7 @@ function drawStates(layer, answer, progress, h) {
|
|
|
114
114
|
const g = make("g", { "data-kl-state": r.path, "data-kl-look": m.look || "none", "pointer-events": "none" });
|
|
115
115
|
if (host) g.setAttribute("data-kl-layer", "1");
|
|
116
116
|
const words = stateWords(m);
|
|
117
|
+
if (!words) continue; // an estate with nothing decided yet: its box's title already names it
|
|
117
118
|
const w = Math.max(120, words.length * 7.4 + 20);
|
|
118
119
|
const x = box.x + 14;
|
|
119
120
|
const rect = make("rect", { x, y: y - 17, width: w, height: 22, rx: 4, fill: "var(--panel, var(--bg))", stroke: "var(--frame-neutral, var(--neutral))", "stroke-width": 1.5 });
|
package/web/kiosk-light.js
CHANGED
|
@@ -134,6 +134,13 @@ export function planOf(answer, progress = null) {
|
|
|
134
134
|
}
|
|
135
135
|
for (const [root, ups] of Object.entries(pr.upstreams || {})) for (const u of ups || []) edge(u, root);
|
|
136
136
|
for (const res of (pr.blast && pr.blast.resources) || []) out.reaches.set(lightKey(res.root, res.address), res.reaches || []);
|
|
137
|
+
} else if (answer.estateScene && Array.isArray(answer.estateScene.reads)) {
|
|
138
|
+
// behold#1012: a composed run drawn from its tf-apply report alone carries the reads on its scene. Root to root:
|
|
139
|
+
// the report maps no output to the resource that produced it, so they stay box-to-box.
|
|
140
|
+
for (const r of answer.estateScene.reads) {
|
|
141
|
+
edge(r.upstream, r.root);
|
|
142
|
+
out.reads.push(r);
|
|
143
|
+
}
|
|
137
144
|
}
|
|
138
145
|
if (progress && Array.isArray(progress.reads)) for (const r of progress.reads) for (const u of r.reads || []) edge(u, r.root);
|
|
139
146
|
// A composed run's members come in the order it applies them. When no read names an order, each reads the one before.
|
|
@@ -239,6 +246,29 @@ export function applyOf(root, progress) {
|
|
|
239
246
|
return null;
|
|
240
247
|
}
|
|
241
248
|
|
|
249
|
+
/**
|
|
250
|
+
* The run view, or in its place what the apply reports of its commit say. A pipeline that writes reports and no run
|
|
251
|
+
* view (choudoufu's Terragrunt and Atmos examples, whose workflows write chant-report's tf-plan and tf-apply only)
|
|
252
|
+
* leaves the read of the act's merge commit `present: false`, and its cards would say "known after apply" past the
|
|
253
|
+
* apply. Each root whose apply report is of that commit is then one apply's part, applied or failed as the report says,
|
|
254
|
+
* and the view is marked `reported`. A run view that is there, or a report of another commit, changes nothing.
|
|
255
|
+
*/
|
|
256
|
+
export function reportedRunView(progress, answer) {
|
|
257
|
+
if (!progress || progress.error || !progress.run || progress.run.present !== false) return progress;
|
|
258
|
+
const commit = typeof progress.run.commit === "string" ? progress.run.commit : "";
|
|
259
|
+
if (commit.length < 7 || !answer || answer.error || !Array.isArray(answer.roots)) return progress;
|
|
260
|
+
const same = (c) => typeof c === "string" && c.length >= 7 && (c.startsWith(commit) || commit.startsWith(c));
|
|
261
|
+
const states = [];
|
|
262
|
+
for (const r of answer.roots) {
|
|
263
|
+
const a = r && r.apply;
|
|
264
|
+
if (!a || a.approval === "waiting" || !a.run || !same(a.run.commit)) continue;
|
|
265
|
+
if (a.status === "failed") states.push({ number: 1, state: "failed", roots: [r.path], reported: true });
|
|
266
|
+
else if (a.applied) states.push({ number: 1, state: "applied", roots: [r.path], changed: a.changes > 0 ? [r.path] : [], reported: true });
|
|
267
|
+
}
|
|
268
|
+
if (!states.length) return progress;
|
|
269
|
+
return { ...progress, run: { ...progress.run, present: true, reported: true }, states: [...(Array.isArray(progress.states) ? progress.states : []), ...states] };
|
|
270
|
+
}
|
|
271
|
+
|
|
242
272
|
/**
|
|
243
273
|
* The words on a root's badge in ask mode: no wave (a viewer has no use for one), and the step's own word. Follows the
|
|
244
274
|
* run view's outcome for the root when it has one, so the badge and the state label under the box agree.
|
|
@@ -264,19 +294,27 @@ const LOOK_OF = { applied: "applied", "no-changes": "applied", partial: "partial
|
|
|
264
294
|
export function stateMarks(answer, progress) {
|
|
265
295
|
const roots = answer && Array.isArray(answer.roots) ? rootsOf(answer).map((r) => r.path) : progress && Array.isArray(progress.reads) ? progress.reads.map((r) => r.root) : [];
|
|
266
296
|
// behold#940: an estate of choudoufu's has no state file: it holds records, one per resource, written as each applies.
|
|
267
|
-
|
|
297
|
+
// The reports' binaries say so too, and still do when a pin holds the scene back (a pull request being planned):
|
|
298
|
+
// the scene alone would call the same estates state files for that while.
|
|
299
|
+
const scene = !!(answer && answer.estateScene && Array.isArray(answer.estateScene.roots) && answer.estateScene.roots.length);
|
|
300
|
+
const binaries = (answer && answer.binaries) || {};
|
|
268
301
|
const out = {};
|
|
269
302
|
for (const root of roots) {
|
|
270
303
|
const a = applyOf(root, progress);
|
|
304
|
+
const estate = scene || binaries[root] === "choudoufu";
|
|
271
305
|
const file = estate ? { file: lastSegment(root), from: "estate", estate: true } : stateFile(root, progress);
|
|
272
306
|
out[root] = { ...file, written: !!a && a.state === "written", look: a && a.apply ? LOOK_OF[a.apply] || null : null, covered: !!(a && a.covered) };
|
|
273
307
|
}
|
|
274
308
|
return out;
|
|
275
309
|
}
|
|
276
310
|
|
|
277
|
-
/**
|
|
311
|
+
/**
|
|
312
|
+
* The words of a state's label: its file, its look, and that it was written. An estate has no file to name, and its
|
|
313
|
+
* name is already its box's title: its label says only the look and the records written, and is empty (no label is
|
|
314
|
+
* drawn) until there is one of them to say. A label of the name alone read as a second copy of the box.
|
|
315
|
+
*/
|
|
278
316
|
export function stateWords(m) {
|
|
279
|
-
return [m.estate ?
|
|
317
|
+
return [m.estate ? null : `state ${m.file}`, m.look ? LOOK_WORDS[m.look] : null, m.written ? (m.estate ? "records written" : "written") : null, m.covered ? COVERED_WORDS : null].filter(Boolean).join(" \u00b7 ");
|
|
280
318
|
}
|
|
281
319
|
|
|
282
320
|
// ---------------------------------------------------------------------------
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
|
4
|
+
import { composedReportOf, composedView } from "../src/chant-compose.ts";
|
|
5
|
+
import { drawScene, sceneModel } from "./kiosk-estate-scene.js";
|
|
6
|
+
import { readingRows } from "./kiosk.js";
|
|
7
|
+
import { planOf } from "./kiosk-light.js";
|
|
8
|
+
import { HOLE_WORDS, KIND_ROWS, KIND_TAGS, memberKinds } from "./member-kind.js";
|
|
9
|
+
|
|
10
|
+
// behold#1008: a composed chant run draws a hole member's box and a previewed member's box differently, and the
|
|
11
|
+
// kiosk's "How to read this" says what each mark means. The run is behold#969's create plan
|
|
12
|
+
// (src/__fixtures__/chant-compose/create-plan.json): network creates subnetB, app reads its id unknown (previewed),
|
|
13
|
+
// edge reads app's known values (plain). As src/chant-compose.test.ts does, edge is made a hole.
|
|
14
|
+
const FIX = join(import.meta.dirname, "..", "src", "__fixtures__", "chant-compose");
|
|
15
|
+
const plan = () => JSON.parse(readFileSync(join(FIX, "create-plan.json"), "utf8"));
|
|
16
|
+
const REASON = "no preview: CloudFormation refused the stand-in";
|
|
17
|
+
const OPEN = { width: 1900, height: 740 };
|
|
18
|
+
|
|
19
|
+
function withHole(entriesToo) {
|
|
20
|
+
const doc = plan();
|
|
21
|
+
doc.changeSet.members.find((m) => m.member === "edge").holes = [{ address: "allowlist", reason: REASON }];
|
|
22
|
+
if (!entriesToo) doc.changeSet.entries = doc.changeSet.entries.filter((e) => e.member !== "edge");
|
|
23
|
+
return composedView(composedReportOf(doc), undefined);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// A stand-in for the svg drawScene writes into: elements with attributes, children and text, enough to walk.
|
|
27
|
+
function fakeNode(tag) {
|
|
28
|
+
const n = {
|
|
29
|
+
tagName: tag,
|
|
30
|
+
attrs: {},
|
|
31
|
+
children: [],
|
|
32
|
+
parent: null,
|
|
33
|
+
textContent: "",
|
|
34
|
+
setAttribute: (k, v) => void (n.attrs[k] = v),
|
|
35
|
+
getAttribute: (k) => (k in n.attrs ? n.attrs[k] : null),
|
|
36
|
+
hasAttribute: (k) => k in n.attrs,
|
|
37
|
+
appendChild: (c) => {
|
|
38
|
+
if (c.parent) c.remove();
|
|
39
|
+
c.parent = n;
|
|
40
|
+
n.children.push(c);
|
|
41
|
+
return c;
|
|
42
|
+
},
|
|
43
|
+
remove: () => {
|
|
44
|
+
if (!n.parent) return;
|
|
45
|
+
n.parent.children = n.parent.children.filter((x) => x !== n);
|
|
46
|
+
n.parent = null;
|
|
47
|
+
},
|
|
48
|
+
querySelectorAll: (sel) => {
|
|
49
|
+
const m = /^:scope > \[([\w-]+)\]$/.exec(sel);
|
|
50
|
+
return m ? n.children.filter((c) => c.hasAttribute(m[1])) : [];
|
|
51
|
+
},
|
|
52
|
+
querySelector: (sel) => n.querySelectorAll(sel)[0] || null,
|
|
53
|
+
};
|
|
54
|
+
return n;
|
|
55
|
+
}
|
|
56
|
+
const walk = (n) => [n, ...n.children.flatMap(walk)];
|
|
57
|
+
const drawn = (model) => {
|
|
58
|
+
const svg = fakeNode("svg");
|
|
59
|
+
drawScene(svg, model);
|
|
60
|
+
return walk(svg);
|
|
61
|
+
};
|
|
62
|
+
const withAttr = (nodes, k, v) => nodes.filter((n) => n.attrs[k] === v);
|
|
63
|
+
|
|
64
|
+
let was;
|
|
65
|
+
beforeEach(() => {
|
|
66
|
+
was = globalThis.document;
|
|
67
|
+
globalThis.document = { createElementNS: (_ns, tag) => fakeNode(tag) };
|
|
68
|
+
});
|
|
69
|
+
afterEach(() => {
|
|
70
|
+
globalThis.document = was;
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
describe("a hole member and a previewed member, drawn apart (behold#1008)", () => {
|
|
74
|
+
it("reads each member's kind from the composed answer", () => {
|
|
75
|
+
const v = withHole(true);
|
|
76
|
+
expect([...memberKinds(v.answer)].map(([m, k]) => [m, k.kind])).toEqual([["app", "previewed"], ["edge", "hole"], ["network", "plain"]]);
|
|
77
|
+
expect(memberKinds(v.answer).get("edge").reasons).toEqual([REASON]);
|
|
78
|
+
expect(memberKinds(null).size).toBe(0);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
it("puts one hole mark on edge's box and the previewed mark on app's, and none on network's", () => {
|
|
82
|
+
const v = withHole(true);
|
|
83
|
+
const nodes = drawn(sceneModel(v.answer, planOf(v.answer), null, OPEN));
|
|
84
|
+
const boxes = nodes.filter((n) => n.hasAttribute("data-layout-box"));
|
|
85
|
+
expect(boxes.map((b) => [b.attrs["data-layout-box"], b.attrs["data-member-kind"]])).toEqual([
|
|
86
|
+
["box:network", "plain"],
|
|
87
|
+
["box:app", "previewed"],
|
|
88
|
+
["box:edge", "hole"],
|
|
89
|
+
]);
|
|
90
|
+
const holes = withAttr(nodes, "data-kl-kind-mark", "hole");
|
|
91
|
+
const previewed = withAttr(nodes, "data-kl-kind-mark", "previewed");
|
|
92
|
+
expect(holes).toHaveLength(1);
|
|
93
|
+
expect(previewed).toHaveLength(1);
|
|
94
|
+
expect(holes[0].parent.attrs["data-layout-box"]).toBe("box:edge");
|
|
95
|
+
expect(previewed[0].parent.attrs["data-layout-box"]).toBe("box:app");
|
|
96
|
+
expect(walk(holes[0]).some((n) => n.textContent === KIND_TAGS.hole)).toBe(true);
|
|
97
|
+
expect(walk(previewed[0]).some((n) => n.textContent === KIND_TAGS.previewed)).toBe(true);
|
|
98
|
+
// The hole's box is dashed; the others are not.
|
|
99
|
+
const outline = (name) => nodes.find((n) => n.attrs["data-group-id"] === name);
|
|
100
|
+
expect(outline("edge").attrs["stroke-dasharray"]).toBeTruthy();
|
|
101
|
+
expect(outline("app").attrs["stroke-dasharray"]).toBeUndefined();
|
|
102
|
+
expect(outline("network").attrs["stroke-dasharray"]).toBeUndefined();
|
|
103
|
+
// Every member's cards are still there: network's subnet, app's interface, edge's allowlist.
|
|
104
|
+
expect(nodes.filter((n) => n.hasAttribute("data-node-id")).map((n) => n.attrs["data-node-id"])).toEqual(["chant/network/subnetB", "chant/app/workerInterface", "chant/edge/allowlist"]);
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
it("keeps a hole's box when nothing was previewed in it, with an empty slot saying so and why", () => {
|
|
108
|
+
const v = withHole(false);
|
|
109
|
+
const m = sceneModel(v.answer, planOf(v.answer), null, OPEN);
|
|
110
|
+
expect(m.roots.map((r) => [r.path, r.kind, r.cards.length])).toEqual([["network", "plain", 1], ["app", "previewed", 1], ["edge", "hole", 0]]);
|
|
111
|
+
const edge = m.roots[2];
|
|
112
|
+
expect(edge.hole).toMatchObject({ words: HOLE_WORDS, reasons: [REASON] });
|
|
113
|
+
expect(edge.hole.y).toBeGreaterThanOrEqual(edge.y);
|
|
114
|
+
expect(edge.hole.y + edge.hole.h).toBeLessThanOrEqual(edge.y + edge.h);
|
|
115
|
+
const nodes = drawn(m);
|
|
116
|
+
const slot = nodes.filter((n) => n.attrs["data-kl-hole"] === "edge");
|
|
117
|
+
expect(slot).toHaveLength(1);
|
|
118
|
+
expect(walk(slot[0]).map((n) => n.textContent)).toContain(HOLE_WORDS);
|
|
119
|
+
expect(walk(slot[0]).map((n) => n.textContent)).toContain(REASON);
|
|
120
|
+
expect(withAttr(nodes, "data-kl-kind-mark", "hole")).toHaveLength(1);
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
it("draws no mark on a run with no kinds (a composed choudoufu run)", () => {
|
|
124
|
+
const v = withHole(true);
|
|
125
|
+
const answer = { ...v.answer, chant: undefined };
|
|
126
|
+
const nodes = drawn(sceneModel(answer, planOf(answer), null, OPEN));
|
|
127
|
+
expect(nodes.filter((n) => n.hasAttribute("data-member-kind"))).toEqual([]);
|
|
128
|
+
expect(nodes.filter((n) => n.hasAttribute("data-kl-kind-mark"))).toEqual([]);
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
it("says in the legend what the hole mark and the previewed mark mean, on chant's composed page alone", () => {
|
|
132
|
+
const rows = readingRows("resources", "chant-compose");
|
|
133
|
+
expect(rows.filter((r) => r.mark === "hole")).toEqual([KIND_ROWS[0]]);
|
|
134
|
+
expect(rows.filter((r) => r.mark === "previewed")).toEqual([KIND_ROWS[1]]);
|
|
135
|
+
expect(KIND_ROWS[0].words).toMatch(/^Dashed box: a stack no preview could be made of\.$/);
|
|
136
|
+
expect(KIND_ROWS[1].words).toMatch(/^Tag previewed: some values known after apply\.$/);
|
|
137
|
+
for (const r of KIND_ROWS) expect(r.words.length, r.words).toBeLessThanOrEqual(50);
|
|
138
|
+
for (const tool of [null, "chant", "terragrunt", "choudoufu-compose"]) for (const view of ["components", "resources"]) expect(readingRows(view, tool).some((r) => r.mark === "hole" || r.mark === "previewed")).toBe(false);
|
|
139
|
+
});
|
|
140
|
+
});
|
package/web/kiosk-popover.js
CHANGED
|
@@ -59,8 +59,11 @@ export function valueWords(v, max = 40) {
|
|
|
59
59
|
return s.length > max ? `${s.slice(0, max - 3)}...` : s;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
/** The instance part of an address beyond its block (`[0]`, `["a"]`), or "".
|
|
62
|
+
/** The instance part of an address beyond its block (`[0]`, `["a"]`), or "". An address
|
|
63
|
+
* under an expanded module call (`module.app[0].aws_eip.pool[1]`, chant#4486) gives "",
|
|
64
|
+
* so the line shows the whole address: `[1]` alone would not say which module instance. */
|
|
63
65
|
function instanceKey(address) {
|
|
66
|
+
if (/\]\./.test(address || "")) return "";
|
|
64
67
|
const m = /(\[[^\]]*\])$/.exec(address || "");
|
|
65
68
|
return m ? m[1] : "";
|
|
66
69
|
}
|