cornfield 0.50.0 → 0.51.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/explorer/camera-frame.js +82 -0
- package/explorer/camera.js +7 -73
- package/explorer/check-model.js +3 -44
- package/explorer/cloud-model.js +2 -101
- package/explorer/cloud-panel.js +107 -0
- package/explorer/css/review.css +2 -0
- package/explorer/engine/connection.js +4 -1
- package/explorer/engine/map-rect.js +97 -0
- package/explorer/engine/player.js +2 -1
- package/explorer/engine/proposal.js +28 -7
- package/explorer/engine/server-load.js +64 -0
- package/explorer/engine/sheets.js +4 -86
- package/explorer/engine/source-address.js +58 -0
- package/explorer/engine/source.js +16 -45
- package/explorer/engine/theme-sheet.js +23 -1
- package/explorer/engine/topology.js +1 -1
- package/explorer/focus-room.js +1 -7
- package/explorer/focusables.js +1 -1
- package/explorer/forge-panel.js +36 -2630
- package/explorer/index.html +15 -147
- package/explorer/instance-state.js +0 -7
- package/explorer/instance.js +19 -2
- package/explorer/layer-model.js +1 -1
- package/explorer/outage-model.js +6 -76
- package/explorer/outage-scenario.js +83 -0
- package/explorer/page-pieces.js +21 -2
- package/explorer/page.js +3 -3
- package/explorer/panels.js +1 -5
- package/explorer/pieces/layers.js +1 -0
- package/explorer/pieces/node-panel.js +19 -8
- package/explorer/pieces/proposal.js +9 -0
- package/explorer/pieces/review-source.js +84 -0
- package/explorer/pieces/review.js +145 -12
- package/explorer/pieces/scope.js +23 -54
- package/explorer/pieces/status.js +5 -1
- package/explorer/pieces/work-agent.js +211 -0
- package/explorer/pieces/work-common.js +88 -0
- package/explorer/pieces/work-confirm.js +169 -0
- package/explorer/pieces/work-data.js +178 -0
- package/explorer/pieces/work-deploys.js +104 -0
- package/explorer/pieces/work-events.js +285 -0
- package/explorer/pieces/work-issues.js +43 -0
- package/explorer/pieces/work-markup.js +155 -0
- package/explorer/pieces/work-notes.js +177 -0
- package/explorer/pieces/work-paint.js +312 -0
- package/explorer/pieces/work-prs.js +253 -0
- package/explorer/pieces/work-runs.js +387 -0
- package/explorer/pieces/work-specs.js +71 -0
- package/explorer/pieces/work-threads.js +309 -0
- package/explorer/pieces/work.js +285 -0
- package/explorer/proposal-marks.js +220 -0
- package/explorer/proposal-model.js +23 -211
- package/explorer/proposal.js +1 -2
- package/explorer/runs-map.js +108 -103
- package/explorer/runs-view.js +8 -6
- package/explorer/scenario.js +2 -1
- package/explorer/scene.js +2 -2
- package/explorer/selection-model.js +2 -42
- package/explorer/selection-view.js +1 -1
- package/explorer/selection-words.js +52 -0
- package/explorer/strings.js +1 -1
- package/explorer/verdict-paint.js +51 -0
- package/explorer/waiting-model.js +12 -12
- package/explorer/waiting-view.js +6 -6
- package/package.json +1 -1
- package/explorer/feedback.js +0 -15
- package/explorer/waiting-line.js +0 -14
package/explorer/index.html
CHANGED
|
@@ -127,14 +127,15 @@
|
|
|
127
127
|
</div>
|
|
128
128
|
<!--corn-piece:search/field-->
|
|
129
129
|
|
|
130
|
-
<!-- The Work toggle (explorer/
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
130
|
+
<!-- The Work toggle (explorer/pieces/work.js): opens the Work panel; shown only when the config names a forge. It is a piece: page.js mounts it here, and until then this stand-in keeps its place (the piece's markup without ids) -->
|
|
131
|
+
<!--corn-placeholder:work/button-->
|
|
132
|
+
<button type="button" class="hx-work" data-action="toggle-forge" aria-expanded="false" aria-label="Work" data-corn-string-aria-label="issuesAndPrs" title="Issues, pull requests and deploys: a pull request lights the nodes it changes, a deploy the nodes it restarted" hidden data-corn="forge-button" part="forge-button">
|
|
133
|
+
<span data-corn-string="issuesAndPrs">Work</span>
|
|
134
|
+
<span class="hx-forge-lit" data-corn="count" part="count" hidden></span>
|
|
135
|
+
<span class="hx-runner-dot" aria-hidden="true" title="No runner online" hidden></span>
|
|
136
|
+
<span class="hx-waiting-badge" data-corn="waiting-badge" part="waiting-badge" aria-hidden="true" hidden></span>
|
|
137
|
+
</button>
|
|
138
|
+
<!--corn-piece:work/button-->
|
|
138
139
|
|
|
139
140
|
<!-- The one account menu (explorer/account-menu.js): who, Theme, Freeform layout, Review tokens, Proposals, the links, Sign out, and what powers it -->
|
|
140
141
|
<div class="hx-menu-wrap hx-account">
|
|
@@ -185,8 +186,8 @@
|
|
|
185
186
|
<div class="hx-stage" role="main" data-corn="stage">
|
|
186
187
|
<!-- The map: its canvas (focusable, its keys read out with its name), the help for its keys, the announcer the keyboard speaks in and the canvas its labels are drawn on, made here by explorer/pieces/map.js -->
|
|
187
188
|
<!--corn-piece:map/stage-->
|
|
188
|
-
<!-- The nodes agent runs are changing, marked over the map (explorer/runs-map.js): a picture; the Runs view says the same in words -->
|
|
189
|
-
|
|
189
|
+
<!-- The nodes agent runs are changing, marked over the map (explorer/runs-map.js): a picture; the Runs view says the same in words. It is part of the Work piece (explorer/pieces/work.js): page.js mounts it here -->
|
|
190
|
+
<!--corn-piece:work/overlay-->
|
|
190
191
|
|
|
191
192
|
<!-- Below 768px the proposal bar, the scenario player and the node panel stack here as bottom sheets (sheets.js); from 768px the dock is display: contents -->
|
|
192
193
|
<div id="sheet-dock" class="hx-dock" data-corn="dock">
|
|
@@ -196,105 +197,9 @@
|
|
|
196
197
|
<!-- The review column (explorer/pieces/changes.js, spec 0006): what the proposal changes, and the personas and the scenarios that apply to them. Docked left of the map from 768px, the expanded proposal sheet's body on a phone. The decision (explorer/pieces/decision.js, spec 0007) is its foot: the column keeps its place -->
|
|
197
198
|
<!--corn-piece:changes/column-->
|
|
198
199
|
|
|
199
|
-
<!-- The Work panel (
|
|
200
|
+
<!-- The Work panel (explorer/pieces/work.js): Specs, PRs, Issues, Threads, Runs and Deploys, in the order of the loop. A slide-over from the left on desktop, a bottom sheet on a phone; hidden and inert until the config names a forge. It is a piece: page.js mounts it here -->
|
|
200
201
|
<p id="offline-banner" class="hx-offline" data-corn="notice" hidden></p>
|
|
201
|
-
|
|
202
|
-
<div class="hx-forge-body" data-corn="forge-panel">
|
|
203
|
-
<div class="hx-forge-top" data-corn="work-top">
|
|
204
|
-
<div class="hx-forge-head" data-corn="work-head">
|
|
205
|
-
<h2 id="forge-title" class="hx-drawer-title" data-corn="work-title" tabindex="-1">Work</h2>
|
|
206
|
-
<button type="button" class="hx-btn hx-btn--quiet" data-action="refresh-forge" title="Ask the forge again" data-corn-kind="quiet">Refresh</button>
|
|
207
|
-
<button type="button" class="hx-close" data-action="close-forge" aria-label="Close" data-corn-kind="icon">✕</button>
|
|
208
|
-
</div>
|
|
209
|
-
<div class="hx-forge-tabs" role="group" aria-label="Show" data-corn="tabs">
|
|
210
|
-
<button type="button" class="hx-forge-tab" data-forge-kind="specs" aria-pressed="true" title="The proposals: what a change would add, change and remove" data-corn="tab"><span data-corn-string="tabSpecs">Specs</span><span class="hx-forge-count" data-corn="count"></span></button>
|
|
211
|
-
<button type="button" class="hx-forge-tab" data-forge-kind="pulls" aria-pressed="false" title="Pull requests" data-corn="tab"><span data-corn-string="tabPulls">PRs</span><span class="hx-forge-count" data-corn="count"></span></button>
|
|
212
|
-
<button type="button" class="hx-forge-tab" data-forge-kind="issues" aria-pressed="false" data-corn="tab"><span data-corn-string="tabIssues">Issues</span><span class="hx-forge-count" data-corn="count"></span></button>
|
|
213
|
-
<button type="button" class="hx-forge-tab" data-forge-kind="threads" aria-pressed="false" title="Ideas and spec conversations, with the nodes they mention" data-corn="tab"><span data-corn-string="tabThreads">Threads</span><span class="hx-forge-count" data-corn="count"></span></button>
|
|
214
|
-
<button type="button" class="hx-forge-tab" data-forge-kind="work" aria-pressed="false" title="Agent runs, and the work grouped by issue and proposal with agent-made work marked" data-corn="tab"><span data-corn-string="tabRuns">Runs</span><span class="hx-forge-count" data-corn="count"></span></button>
|
|
215
|
-
<button type="button" class="hx-forge-tab" data-forge-kind="deploys" aria-pressed="false" data-corn="tab"><span data-corn-string="tabDeploys">Deploys</span><span class="hx-forge-count" data-corn="count" hidden></span></button>
|
|
216
|
-
</div>
|
|
217
|
-
</div>
|
|
218
|
-
<div id="forge-bar" class="hx-forge-bar">
|
|
219
|
-
<p id="forge-status" class="hx-forge-status hx-faint"></p>
|
|
220
|
-
<button data-corn="filter-chip" type="button" id="forge-filter-chip" class="hx-forge-chip" data-action="toggle-filters" aria-expanded="false" aria-controls="forge-filter-box" hidden>Filter<span class="hx-forge-count" data-corn="count" hidden></span></button>
|
|
221
|
-
</div>
|
|
222
|
-
<!-- The Specs tab's one search field (spec 0010 D5): titles, slugs and summaries, as you type -->
|
|
223
|
-
<div id="forge-specs-search" class="hx-forge-specsearch" data-corn="specs-search" hidden>
|
|
224
|
-
<label class="hx-forge-field hx-forge-field--text" data-corn="field">Find a spec<input data-corn="control" type="search" id="specs-search" class="hx-forge-input" placeholder="Title, name, summary" autocomplete="off" /></label>
|
|
225
|
-
</div>
|
|
226
|
-
<div id="forge-filter-box" class="hx-forge-controls" data-corn="filters" hidden>
|
|
227
|
-
<div id="forge-work-filters" class="hx-forge-work-filters" hidden>
|
|
228
|
-
<label class="hx-forge-toggle" data-corn="check-field"><input data-corn="control" type="checkbox" id="forge-work-agents" /> Agent-made only</label>
|
|
229
|
-
<label class="hx-forge-toggle" data-corn="check-field"><input data-corn="control" type="checkbox" id="forge-work-finished" /> Include merged and closed</label>
|
|
230
|
-
</div>
|
|
231
|
-
<div id="forge-filters" class="hx-forge-filters">
|
|
232
|
-
<label class="hx-forge-field" data-corn="field">State<select data-corn="control" id="forge-state" class="hx-forge-select"></select></label>
|
|
233
|
-
<label class="hx-forge-field" data-corn="field">Label<select data-corn="control" id="forge-label" class="hx-forge-select"></select></label>
|
|
234
|
-
<label class="hx-forge-field" data-corn="field">Author<select data-corn="control" id="forge-author" class="hx-forge-select"></select></label>
|
|
235
|
-
<label class="hx-forge-field hx-forge-field--text" data-corn="field">Search<input data-corn="control" type="search" id="forge-text" class="hx-forge-input" placeholder="Title, number, label" autocomplete="off" /></label>
|
|
236
|
-
</div>
|
|
237
|
-
</div>
|
|
238
|
-
<p id="forge-notice" class="hx-forge-notice" hidden data-corn="notice"></p>
|
|
239
|
-
<p id="forge-act-note" class="hx-forge-notice" hidden data-corn="notice"></p>
|
|
240
|
-
<!-- Release notes (forge-panel.js), reached from the PRs list: the pull requests merged since a tag, grouped by the map; copy them, or have the forge keep them as a draft release -->
|
|
241
|
-
<section id="forge-notes" class="hx-forge-notes" aria-label="Release notes" hidden>
|
|
242
|
-
<button data-corn="back" type="button" class="hx-forge-back" data-action="close-notes"><svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.6" aria-hidden="true"><path d="M10 3L5 8l5 5"/></svg><span class="hx-forge-back-text">All pull requests</span></button>
|
|
243
|
-
<h3 id="notes-title" class="hx-forge-notes-title" data-corn="detail-title" tabindex="-1">Release notes</h3>
|
|
244
|
-
<label class="hx-forge-field" data-corn="field">Since tag<select data-corn="control" id="notes-since" class="hx-forge-select"></select></label>
|
|
245
|
-
<label class="hx-forge-field" data-corn="field">Draft, in Markdown<textarea data-corn="control" id="notes-preview" class="hx-forge-preview" rows="14" readonly spellcheck="false"></textarea></label>
|
|
246
|
-
<div class="hx-forge-actions">
|
|
247
|
-
<button data-corn-kind="secondary" type="button" id="notes-copy" class="hx-btn" data-action="copy-notes">Copy</button>
|
|
248
|
-
<button type="button" id="notes-post" class="hx-btn hx-btn--approve" data-action="post-notes" aria-expanded="false" aria-controls="notes-confirm" data-corn-kind="approve">Post as draft …</button>
|
|
249
|
-
</div>
|
|
250
|
-
<p id="notes-message" class="hx-forge-msg" hidden data-corn="message"></p>
|
|
251
|
-
<div id="notes-confirm" class="hx-forge-confirm" data-corn="confirm-form" role="group" aria-labelledby="notes-confirm-title" hidden>
|
|
252
|
-
<h3 id="notes-confirm-title" class="hx-forge-confirm-title">Post as a draft release</h3>
|
|
253
|
-
<p id="notes-confirm-words"></p>
|
|
254
|
-
<label class="hx-forge-field" data-corn="field">Tag for the draft<input data-corn="control" type="text" id="notes-tag" class="hx-forge-input" autocomplete="off" spellcheck="false" /></label>
|
|
255
|
-
<div class="hx-forge-actions">
|
|
256
|
-
<button type="button" id="notes-confirm-yes" class="hx-btn hx-btn--approve" data-action="confirm-notes" data-corn-kind="approve">Create the draft</button>
|
|
257
|
-
<button type="button" class="hx-btn hx-btn--quiet" data-action="cancel-notes" data-corn-kind="quiet">Cancel</button>
|
|
258
|
-
</div>
|
|
259
|
-
</div>
|
|
260
|
-
</section>
|
|
261
|
-
<!-- Agent runs (forge-panel.js, runs-model.js): shown on the Runs tab; each run's state, what it is about, links, and Stop -->
|
|
262
|
-
<section id="forge-runs" class="hx-forge-runs" aria-labelledby="forge-runs-title" hidden>
|
|
263
|
-
<h3 id="forge-runs-title" class="hx-forge-runs-title">Agent runs</h3>
|
|
264
|
-
<p id="forge-runs-runner" class="hx-forge-meta" hidden></p>
|
|
265
|
-
<p id="forge-runs-status" class="hx-forge-meta hx-faint"></p>
|
|
266
|
-
<p id="forge-runs-note" class="hx-forge-notice" hidden data-corn="notice"></p>
|
|
267
|
-
<p id="forge-runs-trigger" class="hx-forge-notice" hidden data-corn="notice"></p>
|
|
268
|
-
<div id="forge-runs-totals" data-corn="run-totals" role="group" aria-label="Tokens and cost the runners reported" hidden></div>
|
|
269
|
-
<ul id="forge-runs-hand" class="hx-forge-meta" aria-label="Requests written by hand that started nothing" hidden></ul>
|
|
270
|
-
<ul id="forge-runs-list" class="hx-forge-files" aria-label="Runs"></ul>
|
|
271
|
-
</section>
|
|
272
|
-
<section id="forge-detail" class="hx-forge-detail" aria-label="Selected pull request" hidden></section>
|
|
273
|
-
<ul id="forge-list" class="hx-forge-list" aria-label="Results"></ul>
|
|
274
|
-
<!-- The foot of the list: Release notes… on the PRs list, New idea on Specs (and Threads) -->
|
|
275
|
-
<div id="forge-foot" class="hx-forge-foot" data-corn="work-foot">
|
|
276
|
-
<button data-corn-kind="secondary" type="button" id="notes-open" class="hx-btn" data-action="open-notes" hidden>Release notes …</button>
|
|
277
|
-
<!-- New idea (forge-panel.js): opens an issue with the threads label as you, on the forge; the thread itself lives there -->
|
|
278
|
-
<section id="forge-idea" class="hx-forge-notes" aria-label="New idea" data-corn-string-aria-label="newIdea" hidden>
|
|
279
|
-
<div class="hx-forge-actions">
|
|
280
|
-
<button type="button" id="idea-open" class="hx-btn hx-btn--approve" data-action="idea-open" aria-expanded="false" aria-controls="idea-form" data-corn-kind="approve"><span data-corn-string="newIdea">New idea</span> …</button>
|
|
281
|
-
</div>
|
|
282
|
-
<p id="idea-message" class="hx-forge-msg" role="status" hidden data-corn="message"></p>
|
|
283
|
-
<div id="idea-form" data-corn="confirm-form" class="hx-forge-confirm" role="group" aria-labelledby="idea-form-title" hidden>
|
|
284
|
-
<h3 id="idea-form-title" class="hx-forge-confirm-title" data-corn-string="newIdea">New idea</h3>
|
|
285
|
-
<p id="idea-words"></p>
|
|
286
|
-
<label class="hx-forge-field" data-corn="field">Title<input data-corn="control" type="text" id="idea-title" class="hx-forge-input" maxlength="256" autocomplete="off" /></label>
|
|
287
|
-
<label class="hx-forge-field" data-corn="field">What is the idea?<textarea data-corn="control" id="idea-body" class="hx-forge-preview hx-thread-compose" rows="6" maxlength="20000" spellcheck="true"></textarea></label>
|
|
288
|
-
<div class="hx-forge-actions">
|
|
289
|
-
<button type="button" id="idea-send" class="hx-btn hx-btn--approve" data-action="idea-send" data-corn-kind="approve">Open the idea</button>
|
|
290
|
-
<button type="button" class="hx-btn hx-btn--quiet" data-action="idea-cancel" data-corn-kind="quiet">Cancel</button>
|
|
291
|
-
</div>
|
|
292
|
-
</div>
|
|
293
|
-
</section>
|
|
294
|
-
</div>
|
|
295
|
-
<p id="forge-rate" class="hx-forge-rate hx-faint"></p>
|
|
296
|
-
</div>
|
|
297
|
-
</aside>
|
|
202
|
+
<!--corn-piece:work/panel-->
|
|
298
203
|
|
|
299
204
|
<!-- Node panel: a slide-over on desktop, a bottom sheet on mobile. It is a piece (explorer/pieces/node-panel.js): page.js mounts it here -->
|
|
300
205
|
<!--corn-piece:node-panel/drawer-->
|
|
@@ -318,45 +223,8 @@
|
|
|
318
223
|
|
|
319
224
|
</div>
|
|
320
225
|
|
|
321
|
-
<!-- The confirm step of landing a pull request, starting a spec and opening a build issue (
|
|
322
|
-
|
|
323
|
-
<div class="hx-confirm glass" role="dialog" aria-modal="true" aria-labelledby="forge-confirm-title" aria-describedby="forge-confirm-body" data-corn="confirm-dialog">
|
|
324
|
-
<h2 id="forge-confirm-title" class="hx-confirm-title" data-corn="dialog-title"></h2>
|
|
325
|
-
<div id="forge-confirm-body"></div>
|
|
326
|
-
<div class="hx-confirm-actions">
|
|
327
|
-
<button data-corn-kind="secondary" type="button" class="hx-btn" data-action="forge-confirm-cancel">Cancel</button>
|
|
328
|
-
<button type="button" class="hx-btn hx-btn--approve" data-action="forge-confirm-go" data-corn-kind="approve" data-corn-string="landIt">Land it</button>
|
|
329
|
-
</div>
|
|
330
|
-
</div>
|
|
331
|
-
</div>
|
|
332
|
-
|
|
333
|
-
<!-- Start an agent (forge-panel.js): kind, profile, a brief, and a confirm step; a modal dialog over a scrim, the focus stays in it -->
|
|
334
|
-
<div id="agent-start" class="hx-confirm-scrim" hidden data-corn="dialog-scrim">
|
|
335
|
-
<div class="hx-confirm glass" role="dialog" aria-modal="true" aria-labelledby="agent-start-title" aria-describedby="agent-start-words" data-corn="agent-dialog">
|
|
336
|
-
<h2 id="agent-start-title" class="hx-confirm-title" data-corn="dialog-title" data-corn-string="startAgent">Start an agent</h2>
|
|
337
|
-
<p id="agent-start-about" class="hx-forge-meta"></p>
|
|
338
|
-
<p id="agent-start-runner" class="hx-forge-meta" hidden></p>
|
|
339
|
-
<p id="agent-retry-note" class="hx-forge-meta" hidden></p>
|
|
340
|
-
<form id="agent-start-form" class="hx-forge-confirm" data-corn="confirm-form" novalidate>
|
|
341
|
-
<label class="hx-forge-field" data-corn="field">Kind of run<select data-corn="control" id="agent-kind" class="hx-forge-select"></select></label>
|
|
342
|
-
<label id="agent-profile-field" class="hx-forge-field" hidden data-corn="field">Profile<select data-corn="control" id="agent-profile" class="hx-forge-select"></select></label>
|
|
343
|
-
<fieldset id="agent-limits-edit" class="hx-forge-field hx-forge-limits" data-corn="field"><legend>Limits, hints for the runner (one left blank takes the config's, if any)</legend>
|
|
344
|
-
<label class="hx-forge-field" data-corn="field">Minutes<input data-corn="control" type="number" id="agent-limit-minutes" class="hx-forge-input" min="0" step="any" inputmode="decimal" /></label>
|
|
345
|
-
<label class="hx-forge-field" data-corn="field">Turns<input data-corn="control" type="number" id="agent-limit-turns" class="hx-forge-input" min="0" step="1" inputmode="numeric" /></label>
|
|
346
|
-
<label class="hx-forge-field" data-corn="field">Cost<input data-corn="control" type="number" id="agent-limit-cost" class="hx-forge-input" min="0" step="any" inputmode="decimal" /></label>
|
|
347
|
-
<label class="hx-forge-field" data-corn="field">Tokens<input data-corn="control" type="number" id="agent-limit-tokens" class="hx-forge-input" min="0" step="1" inputmode="numeric" /></label>
|
|
348
|
-
</fieldset>
|
|
349
|
-
<label class="hx-forge-field" data-corn="field">Brief for the runner<textarea data-corn="control" id="agent-brief" class="hx-forge-preview" rows="6" maxlength="20000" spellcheck="true"></textarea></label>
|
|
350
|
-
<label id="agent-force-field" class="hx-forge-toggle" data-corn="check-field" hidden><input data-corn="control" type="checkbox" id="agent-force" /> Ask for another run on purpose</label>
|
|
351
|
-
<p id="agent-start-words" class="hx-confirm-note"></p>
|
|
352
|
-
<p id="agent-start-msg" class="hx-forge-msg hx-forge-msg--bad" role="alert" hidden data-corn="message" data-corn-state="failure"></p>
|
|
353
|
-
<div class="hx-confirm-actions">
|
|
354
|
-
<button data-corn-kind="secondary" type="button" class="hx-btn" data-action="agent-start-cancel">Cancel</button>
|
|
355
|
-
<button type="submit" class="hx-btn hx-btn--approve" id="agent-start-go" data-corn-kind="approve" data-corn-string="askRunner">Ask the runner</button>
|
|
356
|
-
</div>
|
|
357
|
-
</form>
|
|
358
|
-
</div>
|
|
359
|
-
</div>
|
|
226
|
+
<!-- The confirm step of landing a pull request, starting a spec and opening a build issue, and Start an agent (explorer/pieces/work.js): modal dialogs over a scrim; the focus stays in them while one is open. Part of the Work piece: page.js mounts them here -->
|
|
227
|
+
<!--corn-piece:work/dialogs-->
|
|
360
228
|
|
|
361
229
|
<!-- Review tokens (review-tokens.js): make one (shown once), list them, revoke; a modal dialog over a scrim, the focus stays in it -->
|
|
362
230
|
<div id="tokens-dialog" class="hx-confirm-scrim" hidden data-corn="dialog-scrim">
|
|
@@ -156,13 +156,6 @@ export function createState() {
|
|
|
156
156
|
*/
|
|
157
157
|
runsMap: null,
|
|
158
158
|
|
|
159
|
-
/**
|
|
160
|
-
* Which threads mention which nodes (forge-panel.js, docs/threads.md), for a node's panel: `{ for(nodeId) -> thread[] | null,
|
|
161
|
-
* ensure(), open(number) }`, or null when threads are off or there is no forge. `for` answers null until the list has been
|
|
162
|
-
* read; `ensure` reads it (once) and repaints the panel's "Threads"; `open` shows a thread in the issues and PRs panel.
|
|
163
|
-
*/
|
|
164
|
-
threadIndex: null,
|
|
165
|
-
|
|
166
159
|
/**
|
|
167
160
|
* Changes whenever anything the scene is built from changes (scene.js). render.js rebuilds the
|
|
168
161
|
* scene only when this moved: never for a camera change or a packet frame.
|
package/explorer/instance.js
CHANGED
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
* handlers of `on(name, ...)`, else `undefined`. A piece that finds no answer does without (the Work panel is not part of every page)
|
|
17
17
|
* inst.setSelection(node, edge, { source, quiet }) the one way the converted pieces change what is selected (explorer/engine/selection.js);
|
|
18
18
|
* returns the change, whose `announce()` says it when `quiet` held it back (the caller touches the scene first)
|
|
19
|
-
* inst.offline() whether the browser has no network; inst.onNetwork(fn(offline)), inst.onWindowFocus(fn), inst.onPageHide(fn), inst.onHide(fn): the few window facts the review needs
|
|
19
|
+
* inst.offline() whether the browser has no network; inst.onNetwork(fn(offline)), inst.onWindowFocus(fn), inst.onPageHide(fn), inst.onPageShow(fn), inst.onResize(fn), inst.onHide(fn): the few window facts the review needs;
|
|
20
|
+
* inst.onPageFocus(fn(event)): a focus anywhere in the page, outside the root too (a modal dialog's trap in a host's page)
|
|
20
21
|
* inst.active() the element that has the focus inside the root's tree (a shadow root's own, not the host)
|
|
21
22
|
* inst.el an element of the instance by id, found inside its root and never by document id
|
|
22
23
|
* inst.listen a listener that `destroy()` removes; inst.own: any other clean-up `destroy()` runs; inst.release(fn): takes one back that its owner ran itself
|
|
@@ -41,12 +42,13 @@
|
|
|
41
42
|
* proposal:draw { open } the bar and the review column draw again; proposal:bar { open }: they have, so what sits on the bar draws again
|
|
42
43
|
* proposal:mark { applied, effective, proposal } before the map is laid out (the what-if editor marks its edits)
|
|
43
44
|
* proposal:message { text, isError, ways } one line in the bar in place of a proposal; proposal:listing: the list the server gave was read
|
|
45
|
+
* proposal:failed { slug, source, status, notFound, message } a proposal asked for by name did not open (once, with the words the bar says)
|
|
44
46
|
* proposal:pull-head sha the open proposal's PR was read; proposal:waiting { run, key }: a run waits on it (the bar's waiting line); proposal:waiting-reset
|
|
45
47
|
* scenario:player { id, index, total, done, playing, checks } | null the scenario player moved, or closed (engine/player.js)
|
|
46
48
|
* changes:paint (none) the review column's lists were drawn again; changes:peek text: its count line, for a phone's peek
|
|
47
49
|
* decision { outcome: 'approved' | 'notes', review, slug, source, open } the server took the review, after it answered (pieces/decision.js);
|
|
48
50
|
* `open`: false when another proposal was opened, or this one closed, while it was sent
|
|
49
|
-
* auth { status: 401 | 403, during: 'facts' | 'review' | 'send' | 'landing' } sign-in is needed: a read or the press was refused
|
|
51
|
+
* auth { status: 401 | 403, during: 'proposal' | 'facts' | 'review' | 'send' | 'landing' } sign-in is needed: a read or the press was refused
|
|
50
52
|
* source { state, … } where a scope's or a map's load from a cornfield server is (engine/source.js lists the states: loading, ready, sign-in,
|
|
51
53
|
* not-allowed, offline, server, address, version); pieces/status.js shows it and pieces/scope.js turns it into `cornAuth` and `cornError`
|
|
52
54
|
* theme { state: 'loading' | 'ready' | 'failed' | 'none' } the server's theme sheet (engine/theme-sheet.js, with `use-theme`; 'none': taken back out): the map reads its tokens again
|
|
@@ -54,6 +56,10 @@
|
|
|
54
56
|
* piece:refused { piece, reason, message, host } a piece that cannot have this instance (a second map in a scope); the scope says it as `cornError`
|
|
55
57
|
* and tells `host` to ask again when the root is free
|
|
56
58
|
* attach:released (none) the piece that had the instance's root (`attach`) gave it back
|
|
59
|
+
* work:waiting { total } what waits on the maintainer changed (specs to decide plus runs that need an answer; pieces/work.js): the page puts the number before its title
|
|
60
|
+
* work:available { on } the Work panel started (a forge in the config and somebody signed in), or ended: the account menu's Proposals entry is only for a cornfield without it
|
|
61
|
+
* runs:map { active } runs are on the map, or none is (pieces/work.js, runs-map.js): the Layers menu shows its legend while there are
|
|
62
|
+
* thread:open { number } a thread listed in the node panel was chosen; thread:start { node }: "Start a thread about this" (pieces/node-panel.js; the Work panel opens the thread, or its New idea form)
|
|
57
63
|
* announce text what a screen reader is told (engine/keyboard.js `announce`, which also writes it in the root's `#map-announcer`, if it has one)
|
|
58
64
|
*
|
|
59
65
|
* What a piece is asked to do (`emit`ted to it):
|
|
@@ -74,6 +80,11 @@
|
|
|
74
80
|
* forge:can-start (none) can a run be started from here? -> boolean; forge:start (emit) { slug, returnTo }: open the Start dialog
|
|
75
81
|
* scenario:clear (none) (emit) a selection ends a playing scenario
|
|
76
82
|
* proposal:effective proposal -> proposal the proposal the map is drawn from (the what-if editor's, with its edits in); proposal:before-close -> false keeps it open
|
|
83
|
+
* proposal:specs-list (none) -> false there is no list of specs to open here (the review in another app): a bad link's ways leave the button out
|
|
84
|
+
* threads:index nodeId -> { threads: thread[] | null, forge: string, start: true } | undefined the Work panel's list of the threads that mention a node, for the node panel's "Threads"; `threads` is null until the list was read; no answer: no Threads section
|
|
85
|
+
* threads:ensure (none) (emit) the node panel was filled: the Work panel reads the threads list once; threads:changed: it was read, or the map changed, so the node panel draws "Threads" again
|
|
86
|
+
* work:on (none) -> boolean whether the Work panel has started (a piece mounted after it asks rather than waits for `work:available`)
|
|
87
|
+
* work:answer { run } (emit) "Answer" on the proposal bar's line: the Work panel opens on Runs at that run, its reply field focused
|
|
77
88
|
* work:open-specs (none) -> true the Work panel's Specs tab opened for a bad link's way on; map:set { nodes, edges } -> true the page laid the map out from these
|
|
78
89
|
* changes:opened-line title -> string, changes:played-line -> string what the review column says of an opening, and how many scenarios were played
|
|
79
90
|
* whatif:edits -> edits[], whatif:form -> { name } | null, whatif:describe -> string[] what the decision asks of the what-if editor
|
|
@@ -288,6 +299,12 @@ export function createInstance({ root: rootOpt = null, base = '', fetch: fetchOp
|
|
|
288
299
|
onWindowFocus: (fn) => (win ? inst.listen(win, 'focus', () => fn()) : () => {}),
|
|
289
300
|
/** Calls `fn()` when the page is going away (a tab closed, a reload). Removed by destroy(). */
|
|
290
301
|
onPageHide: (fn) => (win ? inst.listen(win, 'pagehide', () => fn()) : () => {}),
|
|
302
|
+
/** Calls `fn()` when the window is resized. Removed by destroy(). */
|
|
303
|
+
onResize: (fn) => (win ? inst.listen(win, 'resize', () => fn()) : () => {}),
|
|
304
|
+
/** Calls `fn()` when the page is shown again, or comes back from the back-forward cache. Removed by destroy(). */
|
|
305
|
+
onPageShow: (fn) => (win ? inst.listen(win, 'pageshow', () => fn()) : () => {}),
|
|
306
|
+
/** Calls `fn(event)` for every focus that lands in the page, outside the root as well (which the root's own `focusin` never hears). Removed by destroy(). */
|
|
307
|
+
onPageFocus: (fn) => (doc ? inst.listen(doc, 'focusin', (e) => fn(e)) : () => {}),
|
|
291
308
|
/** Calls `fn()` when the tab is hidden. Removed by destroy(). */
|
|
292
309
|
onHide(fn) {
|
|
293
310
|
if (!doc) return () => {};
|
package/explorer/layer-model.js
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
import { STARTING_LAYERS, kindLetters, layerKeyOf, parentIndex, projectLayerOf } from '../core/layers.js';
|
|
19
|
-
import { touchedIds } from './proposal-
|
|
19
|
+
import { touchedIds } from './proposal-marks.js';
|
|
20
20
|
|
|
21
21
|
/** Asks the ownership line of the map the state holds, only when a layer matches by `parent` */
|
|
22
22
|
const parentFn = (state) => ((state.projectLayers || []).some((l) => l.match && l.match.parent !== undefined) ? (n) => parentIndex(state.edges || []).get(n.id) : undefined);
|
package/explorer/outage-model.js
CHANGED
|
@@ -17,14 +17,14 @@
|
|
|
17
17
|
* - `paintOutage(scene, radius)`: the colours on a built scene: run hits red, deploy amber, renew violet (each
|
|
18
18
|
* `WHEN_STYLES[when].color`), each walked edge in the colour of the hit it made, the down nodes black with
|
|
19
19
|
* their label struck through. It only recolours and brightens: what the radius does not reach stays dimmed.
|
|
20
|
-
* - `outageLayers(radius, nodes)
|
|
21
|
-
*
|
|
22
|
-
*
|
|
20
|
+
* - outage-scenario.js has what the player does with it: `outageLayers(radius, nodes)` (the Layers keys its nodes are drawn on, for the
|
|
21
|
+
* player to turn on) and `outageScenario(node, nodes, edges)` (the cloud panel's Play button: a scenario that takes the node down, one
|
|
22
|
+
* step on it with its `breaks` line, then one step per hit group). A map alone paints a radius and does not carry those.
|
|
23
23
|
*
|
|
24
24
|
* The House view (CLOUD-08) reads the same radius: `hits` and `down` by node id, whatever the view draws.
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
|
-
import { WHEN_STYLES,
|
|
27
|
+
import { WHEN_STYLES, whenOf } from './cloud-model.js';
|
|
28
28
|
|
|
29
29
|
/** The `when`s, strongest first; a hit's rank is its index here */
|
|
30
30
|
const WHENS = Object.keys(WHEN_STYLES);
|
|
@@ -33,7 +33,8 @@ const RANK = Object.fromEntries(WHENS.map((w, i) => [w, i]));
|
|
|
33
33
|
const NEVER_HIT = new Set(['persona', 'room', 'floor']);
|
|
34
34
|
/** The order hits are listed in within a group: outside first, then the house, then the code, then the sites */
|
|
35
35
|
const TYPE_ORDER = ['external', 'machine', 'container', 'service', 'page', 'app'];
|
|
36
|
-
|
|
36
|
+
/** Where a type comes in a list of hits (outage-scenario.js names them in this order too) */
|
|
37
|
+
export const typeRank = (type) => { const i = TYPE_ORDER.indexOf(type); return i < 0 ? TYPE_ORDER.length : i; };
|
|
37
38
|
|
|
38
39
|
/** How a down node and a hit look on the scene (the hit's colour is its `WHEN_STYLES[when].color`) */
|
|
39
40
|
export const OUTAGE_DOWN = { color: '#050608', halo: 'child' };
|
|
@@ -168,74 +169,3 @@ export function paintOutage(scene, radius) {
|
|
|
168
169
|
if (e.packet) e.packet = { ...e.packet, glowColor: color };
|
|
169
170
|
}
|
|
170
171
|
}
|
|
171
|
-
|
|
172
|
-
/** The Layers keys the down nodes and the hits are drawn on (layers.js), each once: what the player turns on */
|
|
173
|
-
export function outageLayers(radius, nodes) {
|
|
174
|
-
if (!radius) return [];
|
|
175
|
-
const byId = new Map(nodes.map((n) => [n.id, n]));
|
|
176
|
-
const keys = new Set();
|
|
177
|
-
for (const id of [...radius.down, ...radius.hits.keys()]) {
|
|
178
|
-
const n = byId.get(id);
|
|
179
|
-
if (n) keys.add(n.type === 'external' ? externalLayer(n) : n.type);
|
|
180
|
-
}
|
|
181
|
-
return [...keys];
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
// ---------------------------------------------------------------------------
|
|
185
|
-
// The generated scenario
|
|
186
|
-
// ---------------------------------------------------------------------------
|
|
187
|
-
/** Up to this many of one kind are named; more are counted */
|
|
188
|
-
const NAME_AT = 3;
|
|
189
|
-
const BROWSER = ' (in the visitor\'s browser)';
|
|
190
|
-
|
|
191
|
-
/** "a, b and c"; parts that hold an "and" of their own are kept apart with a comma ("the apps a and b, and the container c") */
|
|
192
|
-
function andList(words) {
|
|
193
|
-
if (words.length < 2) return words.join('');
|
|
194
|
-
const glue = words.some((w) => w.includes(' and ')) ? ', and ' : ' and ';
|
|
195
|
-
return `${words.slice(0, -1).join(', ')}${glue}${words[words.length - 1]}`;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
/** Hits of one group as words: "the container cloudflared and the machine server-1", "13 containers and 2 apps" */
|
|
199
|
-
function describe(items) {
|
|
200
|
-
const byType = new Map();
|
|
201
|
-
for (const it of items) { if (!byType.has(it.type)) byType.set(it.type, []); byType.get(it.type).push(it); }
|
|
202
|
-
const parts = [...byType].sort(([ta, a], [tb, b]) => b.length - a.length || typeRank(ta) - typeRank(tb) || ta.localeCompare(tb)).map(([type, list]) => {
|
|
203
|
-
const noun = nounOf(type, list.length);
|
|
204
|
-
if (list.length > NAME_AT) {
|
|
205
|
-
const browsers = list.filter((i) => i.browser).length;
|
|
206
|
-
return `${list.length} ${noun}${browsers === list.length ? BROWSER : browsers ? ` (${browsers} in the visitor's browser)` : ''}`;
|
|
207
|
-
}
|
|
208
|
-
return `the ${noun} ${andList(list.map((i) => `${i.label}${i.browser ? BROWSER : ''}`))}`;
|
|
209
|
-
});
|
|
210
|
-
return andList(parts);
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
* The Play button's scenario for one cloud node (spec 0031 section 8): it takes the node down; the first step is
|
|
215
|
-
* on the node with its `breaks` line; then one step per hit group, strongest first, on a call from one of the
|
|
216
|
-
* node's own users when the group has one (else on its first hit), naming the direct users and then what breaks
|
|
217
|
-
* through them. Validates as a proposal scenario on any map that has the node (its steps are the map's own).
|
|
218
|
-
* @returns {{ id: string, title: string, down: string[], steps: object[] }}
|
|
219
|
-
*/
|
|
220
|
-
export function outageScenario(node, nodes, edges) {
|
|
221
|
-
const byId = new Map(nodes.map((n) => [n.id, n]));
|
|
222
|
-
const name = String(node.label || node.id);
|
|
223
|
-
const radius = blastRadius([node.id], nodes, edges);
|
|
224
|
-
const hitAs = (when) => (i) => radius.hits.has(i.id) && radius.hits.get(i.id).when === when; // a user with a stronger path elsewhere is listed there
|
|
225
|
-
const direct = new Map(cloudUsedBy(node, nodes, edges).map((g) => [g.when, g.types.flatMap((t) => t.items).filter(hitAs(g.when)).map((i) => ({ ...i, browser: radius.hits.get(i.id).browser }))]));
|
|
226
|
-
const opening = [`${name} is down.`, node.breaks ? String(node.breaks) : '', radius.groups.length ? '' : 'Nothing on the map uses it.'].filter(Boolean).join(' ');
|
|
227
|
-
const steps = [{ node: node.id, text: opening }];
|
|
228
|
-
for (const group of radius.groups) {
|
|
229
|
-
const own = direct.get(group.when) || [];
|
|
230
|
-
const ownIds = new Set(own.map((i) => i.id));
|
|
231
|
-
const through = group.ids.filter((id) => !ownIds.has(id)).map((id) => {
|
|
232
|
-
const n = byId.get(id);
|
|
233
|
-
return { id, label: String(n.label || id), type: n.type, browser: radius.hits.get(id).browser };
|
|
234
|
-
});
|
|
235
|
-
let text;
|
|
236
|
-
if (own.length) text = `${group.title}: ${describe(own)}.${through.length ? ` Through ${own.length === 1 ? 'it' : 'them'}: ${describe(through)}.` : ''}`;
|
|
237
|
-
else text = `${group.title}, through what uses it: ${describe(through)}.`;
|
|
238
|
-
steps.push(own.length ? { edge: { from: own[0].id, to: node.id, kind: 'calls' }, text } : { node: group.ids[0], text });
|
|
239
|
-
}
|
|
240
|
-
return { id: `outage-${node.id}`, title: `${name} is down`, down: [node.id], steps };
|
|
241
|
-
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module explorer/outage-scenario
|
|
3
|
+
*
|
|
4
|
+
* What the scenario player does with an outage (spec 0031 section 8, CLOUD-07): the Layers keys an outage is drawn on (`outageLayers`) and the
|
|
5
|
+
* Play button's scenario for one cloud node (`outageScenario`), made from outage-model.js's blast radius. Only the player and cornfield's page
|
|
6
|
+
* play one, so a map alone, which paints an outage scenario's radius (scene.js, `outageFor`, `paintOutage`), does not carry this (the
|
|
7
|
+
* components' size budget, spec 0011 D11). Pure: no DOM, no state.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { externalLayer } from './cloud-model.js';
|
|
11
|
+
import { cloudUsedBy, nounOf } from './cloud-panel.js';
|
|
12
|
+
import { blastRadius, typeRank } from './outage-model.js';
|
|
13
|
+
|
|
14
|
+
/** The Layers keys the down nodes and the hits are drawn on (layers.js), each once: what the player turns on */
|
|
15
|
+
export function outageLayers(radius, nodes) {
|
|
16
|
+
if (!radius) return [];
|
|
17
|
+
const byId = new Map(nodes.map((n) => [n.id, n]));
|
|
18
|
+
const keys = new Set();
|
|
19
|
+
for (const id of [...radius.down, ...radius.hits.keys()]) {
|
|
20
|
+
const n = byId.get(id);
|
|
21
|
+
if (n) keys.add(n.type === 'external' ? externalLayer(n) : n.type);
|
|
22
|
+
}
|
|
23
|
+
return [...keys];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// ---------------------------------------------------------------------------
|
|
27
|
+
// The generated scenario
|
|
28
|
+
// ---------------------------------------------------------------------------
|
|
29
|
+
/** Up to this many of one kind are named; more are counted */
|
|
30
|
+
const NAME_AT = 3;
|
|
31
|
+
const BROWSER = ' (in the visitor\'s browser)';
|
|
32
|
+
|
|
33
|
+
/** "a, b and c"; parts that hold an "and" of their own are kept apart with a comma ("the apps a and b, and the container c") */
|
|
34
|
+
function andList(words) {
|
|
35
|
+
if (words.length < 2) return words.join('');
|
|
36
|
+
const glue = words.some((w) => w.includes(' and ')) ? ', and ' : ' and ';
|
|
37
|
+
return `${words.slice(0, -1).join(', ')}${glue}${words[words.length - 1]}`;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Hits of one group as words: "the container cloudflared and the machine server-1", "13 containers and 2 apps" */
|
|
41
|
+
function describe(items) {
|
|
42
|
+
const byType = new Map();
|
|
43
|
+
for (const it of items) { if (!byType.has(it.type)) byType.set(it.type, []); byType.get(it.type).push(it); }
|
|
44
|
+
const parts = [...byType].sort(([ta, a], [tb, b]) => b.length - a.length || typeRank(ta) - typeRank(tb) || ta.localeCompare(tb)).map(([type, list]) => {
|
|
45
|
+
const noun = nounOf(type, list.length);
|
|
46
|
+
if (list.length > NAME_AT) {
|
|
47
|
+
const browsers = list.filter((i) => i.browser).length;
|
|
48
|
+
return `${list.length} ${noun}${browsers === list.length ? BROWSER : browsers ? ` (${browsers} in the visitor's browser)` : ''}`;
|
|
49
|
+
}
|
|
50
|
+
return `the ${noun} ${andList(list.map((i) => `${i.label}${i.browser ? BROWSER : ''}`))}`;
|
|
51
|
+
});
|
|
52
|
+
return andList(parts);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* The Play button's scenario for one cloud node (spec 0031 section 8): it takes the node down; the first step is
|
|
57
|
+
* on the node with its `breaks` line; then one step per hit group, strongest first, on a call from one of the
|
|
58
|
+
* node's own users when the group has one (else on its first hit), naming the direct users and then what breaks
|
|
59
|
+
* through them. Validates as a proposal scenario on any map that has the node (its steps are the map's own).
|
|
60
|
+
* @returns {{ id: string, title: string, down: string[], steps: object[] }}
|
|
61
|
+
*/
|
|
62
|
+
export function outageScenario(node, nodes, edges) {
|
|
63
|
+
const byId = new Map(nodes.map((n) => [n.id, n]));
|
|
64
|
+
const name = String(node.label || node.id);
|
|
65
|
+
const radius = blastRadius([node.id], nodes, edges);
|
|
66
|
+
const hitAs = (when) => (i) => radius.hits.has(i.id) && radius.hits.get(i.id).when === when; // a user with a stronger path elsewhere is listed there
|
|
67
|
+
const direct = new Map(cloudUsedBy(node, nodes, edges).map((g) => [g.when, g.types.flatMap((t) => t.items).filter(hitAs(g.when)).map((i) => ({ ...i, browser: radius.hits.get(i.id).browser }))]));
|
|
68
|
+
const opening = [`${name} is down.`, node.breaks ? String(node.breaks) : '', radius.groups.length ? '' : 'Nothing on the map uses it.'].filter(Boolean).join(' ');
|
|
69
|
+
const steps = [{ node: node.id, text: opening }];
|
|
70
|
+
for (const group of radius.groups) {
|
|
71
|
+
const own = direct.get(group.when) || [];
|
|
72
|
+
const ownIds = new Set(own.map((i) => i.id));
|
|
73
|
+
const through = group.ids.filter((id) => !ownIds.has(id)).map((id) => {
|
|
74
|
+
const n = byId.get(id);
|
|
75
|
+
return { id, label: String(n.label || id), type: n.type, browser: radius.hits.get(id).browser };
|
|
76
|
+
});
|
|
77
|
+
let text;
|
|
78
|
+
if (own.length) text = `${group.title}: ${describe(own)}.${through.length ? ` Through ${own.length === 1 ? 'it' : 'them'}: ${describe(through)}.` : ''}`;
|
|
79
|
+
else text = `${group.title}, through what uses it: ${describe(through)}.`;
|
|
80
|
+
steps.push(own.length ? { edge: { from: own[0].id, to: node.id, kind: 'calls' }, text } : { node: group.ids[0], text });
|
|
81
|
+
}
|
|
82
|
+
return { id: `outage-${node.id}`, title: `${name} is down`, down: [node.id], steps };
|
|
83
|
+
}
|
package/explorer/page-pieces.js
CHANGED
|
@@ -21,9 +21,10 @@ import * as search from './pieces/search.js';
|
|
|
21
21
|
import * as proposal from './pieces/proposal.js';
|
|
22
22
|
import * as changes from './pieces/changes.js';
|
|
23
23
|
import * as decision from './pieces/decision.js';
|
|
24
|
+
import * as work from './pieces/work.js';
|
|
24
25
|
|
|
25
26
|
/** The pieces of the page, in the order they are mounted (the node panel registers its sheet; search and the Layers menu follow the map) */
|
|
26
|
-
const PIECES = { 'node-panel': nodePanel, layers, search, proposal, changes, decision }; // (the decision's place is inside the changes piece's column: it follows it)
|
|
27
|
+
const PIECES = { 'node-panel': nodePanel, layers, search, proposal, changes, decision, work }; // (the decision's place is inside the changes piece's column: it follows it)
|
|
27
28
|
const mounted = new Map(); // name -> { handle, markers: Comment[] }
|
|
28
29
|
const optionsOf = new Map(); // name -> what the page tells a piece besides its places (a checker, a clock)
|
|
29
30
|
|
|
@@ -39,6 +40,23 @@ function markersOf(doc, name) {
|
|
|
39
40
|
return found;
|
|
40
41
|
}
|
|
41
42
|
|
|
43
|
+
/**
|
|
44
|
+
* The Work panel says what waits on the maintainer (`work:waiting`); the browser tab's title is the page's, so the page puts "(3) " before its own
|
|
45
|
+
* title while something waits. A host app keeps its own title and does not listen.
|
|
46
|
+
*/
|
|
47
|
+
let titleOff = null;
|
|
48
|
+
let baseTitle = null;
|
|
49
|
+
function keepTitle(inst) {
|
|
50
|
+
if (titleOff) titleOff();
|
|
51
|
+
titleOff = inst.on('work:waiting', ({ total }) => {
|
|
52
|
+
const doc = inst.doc;
|
|
53
|
+
if (!doc) return;
|
|
54
|
+
if (baseTitle === null) baseTitle = doc.title.replace(/^\(\d+\) /, '');
|
|
55
|
+
doc.title = total > 0 ? `(${total}) ${baseTitle}` : baseTitle;
|
|
56
|
+
if (!(total > 0)) baseTitle = null;
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
42
60
|
/** The places of a piece the page mounts itself (the map: page.js), by slot: `{ stage: Comment }` */
|
|
43
61
|
export function pieceSlots(name) {
|
|
44
62
|
return markersOf(pageInstance().doc, name);
|
|
@@ -58,6 +76,7 @@ export function ensurePagePieces() {
|
|
|
58
76
|
if (!markers.length) continue;
|
|
59
77
|
pageMap(); // the pieces follow the page's map: it is there before they are
|
|
60
78
|
mounted.set(name, { handle: piece.mount(doc.body, inst, { ...(optionsOf.get(name) || {}), slots }), markers });
|
|
79
|
+
if (name === 'work') keepTitle(inst);
|
|
61
80
|
}
|
|
62
81
|
return Object.fromEntries([...mounted].map(([name, { handle }]) => [name, handle]));
|
|
63
82
|
}
|
|
@@ -80,7 +99,7 @@ export function mergePagePieceOptions(name, patch) {
|
|
|
80
99
|
if (have) have.handle.update(patch);
|
|
81
100
|
}
|
|
82
101
|
|
|
83
|
-
/** The page's mounted piece by name ('node-panel', 'layers', 'search', 'proposal', 'changes', 'decision'), or null; `anywhere`: mounted at the end of the body when the page has no place for it */
|
|
102
|
+
/** The page's mounted piece by name ('node-panel', 'layers', 'search', 'proposal', 'changes', 'decision', 'work'), or null; `anywhere`: mounted at the end of the body when the page has no place for it */
|
|
84
103
|
export function pagePiece(name, { anywhere = false } = {}) {
|
|
85
104
|
ensurePagePieces();
|
|
86
105
|
// A caller that needs the piece whether or not the page has a place for it (a test drives the scenario player on a bare stage) has it at the end of the body
|
package/explorer/page.js
CHANGED
|
@@ -25,7 +25,8 @@
|
|
|
25
25
|
* keyboard.js the map by keyboard and the screen reader's announcer; keyboard-model.js its pure half
|
|
26
26
|
* live.js the live layer: the chip, polling, laying a live source's answer over the map; live-model.js its pure half
|
|
27
27
|
* review-tokens.js review tokens for the review API, when somebody is signed in: make one (shown once), list, revoke; review-tokens-model.js its pure half
|
|
28
|
-
*
|
|
28
|
+
* pieces/work.js the Work panel (a piece, with a part per tab in pieces/work-*.js), when the config names a forge: a PR lights the nodes it changes; forge-panel-model.js its pure half;
|
|
29
|
+
* forge-panel.js is the page's way in to it (initForgePanel, the deep links)
|
|
29
30
|
* theme.js light or dark: the system setting and the header toggle; theme-model.js the colours (theme-boot.js before the first paint)
|
|
30
31
|
*/
|
|
31
32
|
|
|
@@ -59,7 +60,6 @@ import { initTheme, setThemeChoice } from './theme.js';
|
|
|
59
60
|
import { initAccountMenu } from './account-menu.js';
|
|
60
61
|
import { watchHeaderFit } from './header-fit.js';
|
|
61
62
|
import { watchHint } from './hint.js';
|
|
62
|
-
import { watchFocusRoom } from './focus-room.js';
|
|
63
63
|
|
|
64
64
|
/** The instance and its map: made by `startPage`, the one of this document */
|
|
65
65
|
let inst;
|
|
@@ -189,7 +189,7 @@ export function startPage() {
|
|
|
189
189
|
syncViewUi();
|
|
190
190
|
// /?proposal=<slug> opens a proposal over the map, /?view=dataflow the data-flow preset: both have a link
|
|
191
191
|
// The config is read and applied by engine/source.js, as a scope does it; a page opened without the server reads as no config
|
|
192
|
-
const configReady = fetchConfig(inst).catch(() => ({})).then((config) => { applyBranding(document, config); watchHeaderFit(document); watchHint(document);
|
|
192
|
+
const configReady = fetchConfig(inst).catch(() => ({})).then((config) => { applyBranding(document, config); watchHeaderFit(document); watchHint(document); applyConfig(inst, config); syncViewUi(); return config; }); // the brand, then the theme's icons for the map; the hint again, in the repo's words
|
|
193
193
|
loadTopology().then(async (ok) => {
|
|
194
194
|
if (!ok) return;
|
|
195
195
|
// The sources the repo's cornfield.config.js names (plugins.js): a live layer, a house, devices, a checker; each optional
|
package/explorer/panels.js
CHANGED
|
@@ -4,12 +4,11 @@
|
|
|
4
4
|
* A bridge (spec 0011 D2 and D3, step 4): the node panel is now a piece (pieces/node-panel.js) and choosing a node is the instance's
|
|
5
5
|
* (engine/selection.js). This file keeps the old names for the modules that are not yet on an instance (forge-panel.js, house.js, proposal.js,
|
|
6
6
|
* review-column.js, page.js), bound to the page's instance, and answers for the unconverted neighbours the piece asks (the live layer's
|
|
7
|
-
* block
|
|
7
|
+
* block). It goes when the last of those callers is converted.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { pageInstance } from './state.js';
|
|
11
11
|
import { liveSection, hydrateLivePhotos } from './live.js';
|
|
12
|
-
import { canStartAgent, openProposalStart } from './forge-panel.js';
|
|
13
12
|
import { selectNode as select, clearSelection } from './engine/selection.js';
|
|
14
13
|
import { diffPillWords as pill, LINES_CAP as CAP, copySpec as copy } from './pieces/node-panel.js';
|
|
15
14
|
import { pagePiece } from './page-pieces.js';
|
|
@@ -20,8 +19,6 @@ export const LINES_CAP = CAP;
|
|
|
20
19
|
const page = pageInstance();
|
|
21
20
|
page.on('live:section', (node) => liveSection(node));
|
|
22
21
|
page.on('live:hydrate', (el) => { hydrateLivePhotos(el); });
|
|
23
|
-
page.on('forge:can-start', () => canStartAgent());
|
|
24
|
-
page.on('forge:start', ({ slug, returnTo }) => { openProposalStart(slug, returnTo); });
|
|
25
22
|
|
|
26
23
|
/** Selects a node: lights what is one edge from it on the map and fills the side panel. `frame`: the camera follows (a search, a list, a link, the keyboard) */
|
|
27
24
|
export async function selectNode(node, { frame = false, source = frame ? 'link' : 'api' } = {}) {
|
|
@@ -36,7 +33,6 @@ export function closeDrawer() {
|
|
|
36
33
|
|
|
37
34
|
/** "Added by Checkout": the pill for a node the open proposal touches; '' for one it leaves alone */
|
|
38
35
|
export const diffPillWords = (node) => pill(node, pageInstance().state.proposal);
|
|
39
|
-
export const repaintThreads = () => { const p = pagePiece('node-panel'); if (p) p.repaintThreads(); };
|
|
40
36
|
export const keepSelectedInView = () => { const p = pagePiece('node-panel'); if (p) p.keepSelectedInView(); };
|
|
41
37
|
export const startRun = () => { const p = pagePiece('node-panel'); if (p) p.startRun(); };
|
|
42
38
|
/** Copies the selected node as JSON (the Copy Spec button); `button` is kept for the old signature */
|
|
@@ -301,6 +301,7 @@ export function mount(root, inst, options = {}) {
|
|
|
301
301
|
scope.on('layers:redraw', renderLayerToggles);
|
|
302
302
|
scope.on('theme', renderLayerToggles); // the dots and the legends are drawn in the theme's colours
|
|
303
303
|
scope.on('view', syncView);
|
|
304
|
+
scope.on('runs:map', ({ active }) => { const legend = own('runs-legend'); if (legend) legend.hidden = !active; }); // runs are on the map (the Work panel): the legend says what each mark is
|
|
304
305
|
// The marks legend is there while a proposal is open (the proposal's bar says so: engine/proposal.js)
|
|
305
306
|
const showLegend = (open) => { const legend = own('proposal-legend'); if (legend) legend.hidden = !open; };
|
|
306
307
|
scope.on('proposal:draw', ({ open }) => showLegend(open));
|