@popcorn245/cornfield 0.54.0 → 0.56.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/core/contrast.js +28 -0
- package/core/schema.js +24 -0
- package/explorer/css/page.css +0 -8
- package/explorer/css/work.css +3 -26
- package/explorer/deep-link.js +11 -24
- package/explorer/engine/layers.js +5 -2
- package/explorer/engine/map-style.js +8 -1
- package/explorer/engine/render.js +2 -1
- package/explorer/forge-panel-model.js +2 -36
- package/explorer/forge-panel.js +3 -7
- package/explorer/index.html +5 -11
- package/explorer/instance-state.js +0 -6
- package/explorer/instance.js +9 -5
- package/explorer/layer-model.js +1 -0
- package/explorer/page.js +8 -5
- package/explorer/pieces/layers.js +1 -1
- package/explorer/pieces/node-panel.js +26 -4
- package/explorer/pieces/search.js +9 -3
- package/explorer/pieces/work-agent.js +3 -2
- package/explorer/pieces/work-common.js +14 -15
- package/explorer/pieces/work-confirm.js +11 -10
- package/explorer/pieces/work-data.js +24 -31
- package/explorer/pieces/work-deploys.js +42 -41
- package/explorer/pieces/work-issues.js +32 -29
- package/explorer/pieces/work-list.js +406 -0
- package/explorer/pieces/work-markup.js +9 -15
- package/explorer/pieces/work-notes.js +0 -1
- package/explorer/pieces/work-paint.js +57 -67
- package/explorer/pieces/work-prs.js +25 -66
- package/explorer/pieces/work-runs.js +47 -57
- package/explorer/pieces/work-specs.js +19 -2
- package/explorer/pieces/work-threads.js +29 -49
- package/explorer/pieces/work.js +28 -28
- package/explorer/proposal-model.js +5 -5
- package/explorer/runs-view.js +10 -18
- package/explorer/scene.js +17 -10
- package/explorer/search-match.js +3 -2
- package/explorer/tokens.css +11 -0
- package/explorer/view.js +8 -1
- package/explorer/waiting-view.js +3 -3
- package/explorer/work-model.js +722 -0
- package/explorer/work-view.css +50 -0
- package/explorer/work-view.js +570 -0
- package/package.json +1 -1
- package/explorer/pieces/work-events.js +0 -285
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module explorer/pieces/work-runs
|
|
3
3
|
*
|
|
4
|
-
* The Runs tab: the groups
|
|
4
|
+
* The Runs tab: the groups and the runs' rows; a run in the node panel (its card: Stop, answer, Start again, the timeline); the poll, and the runs on the map. Part of the Work piece (pieces/work.js): `install(ctx)` makes this part's functions for one mount, and hands the ones other parts call
|
|
5
5
|
* to `ctx.fn`; nothing is shared between two mounts.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { withParts } from '../engine/piece.js';
|
|
9
9
|
import { WORK_URL, groupWork, filterGroups, groupWords, workStatus, markWords } from '../agents-model.js';
|
|
10
10
|
import { runsUrl, stopUrl, answerUrl, answerBody, answerWordsFor, runsStatus, runnerState, runnerWords, triggerNotice, totalsLines, handLines, stopWords, changeWords } from '../runs-model.js';
|
|
11
|
-
import {
|
|
11
|
+
import { runHtml, runRowsHtml, totalsHtml, loadingRowsHtml, loadingLinesHtml } from '../runs-view.js';
|
|
12
12
|
import { waiting } from '../waiting-model.js';
|
|
13
13
|
import { escapeHtml as escHtml } from '../../core/text.js';
|
|
14
14
|
import { safeUrl, RUNS_POLL_MS } from './work-common.js';
|
|
@@ -20,7 +20,7 @@ export function install(ctx) {
|
|
|
20
20
|
const groupsShown = () => (ui.work ? filterGroups(ui.work.grouped.groups, ui.workFilters) : []);
|
|
21
21
|
|
|
22
22
|
/** Loads the Agents tab: everything it groups, in one answer */
|
|
23
|
-
async function loadWork(refresh, token) {
|
|
23
|
+
async function loadWork(refresh, token, quiet = false) {
|
|
24
24
|
ui.loading = true;
|
|
25
25
|
ui.error = '';
|
|
26
26
|
fn.paint();
|
|
@@ -30,10 +30,10 @@ export function install(ctx) {
|
|
|
30
30
|
if (res.ok) {
|
|
31
31
|
const b = res.body;
|
|
32
32
|
ui.work = { grouped: groupWork(b), problem: b.specsProblem || '', at: b.at, rate: b.rate || '', stale: b.stale || '' };
|
|
33
|
-
announce(`${workStatus(groupsShown(), '', m.now())}${ui.work.stale ? '. This is an older answer' : ''}`);
|
|
33
|
+
if (!quiet) announce(`${workStatus(groupsShown(), '', m.now())}${ui.work.stale ? '. This is an older answer' : ''}`);
|
|
34
34
|
} else {
|
|
35
35
|
ui.error = fn.failWords(res, 'the work');
|
|
36
|
-
announce(ui.error);
|
|
36
|
+
if (!quiet) announce(ui.error);
|
|
37
37
|
}
|
|
38
38
|
fn.paint();
|
|
39
39
|
}
|
|
@@ -48,7 +48,6 @@ export function install(ctx) {
|
|
|
48
48
|
// The map shows the open runs' nodes; a run lit on the map follows its nodes; what changed is said, once the first answer is in
|
|
49
49
|
setRunsOnMap(ui.runs.data.runs);
|
|
50
50
|
syncRunsPoll();
|
|
51
|
-
if (ui.runSel) relightRun();
|
|
52
51
|
const said = say ? changeWords(before, ui.runs.data.runs) : [];
|
|
53
52
|
// A runner appearing or going quiet is said once, when the state changes (the line itself is plain text, not a live region). The state last
|
|
54
53
|
// shown is kept, not worked out again from the last listing: a runner that goes quiet is the same listing judged later
|
|
@@ -102,9 +101,7 @@ export function install(ctx) {
|
|
|
102
101
|
function groupsHtml(groups) {
|
|
103
102
|
return groups.map((g, i) => {
|
|
104
103
|
const link = g.issue && safeUrl(g.issue.url) ? ` <a data-corn="text-link" class="hx-link hx-forge-gout" href="${escHtml(g.issue.url)}" target="_blank" rel="noreferrer" aria-label="Open issue ${g.number} on ${escHtml(fn.forgeName())} (new tab)">↗</a>` : '';
|
|
105
|
-
|
|
106
|
-
const start = startRef ? ` <button data-corn-kind="secondary" type="button" class="hx-btn hx-forge-act" data-forge-agent="${escHtml(startRef)}" aria-label="${escHtml(t('startAgent'))} on ${escHtml(g.kind === 'issue' ? `issue ${g.number}` : `proposal ${g.slug}`)}">${escHtml(t('startAgent'))} …</button>` : '';
|
|
107
|
-
return `<li class="hx-forge-group"><h3 class="hx-forge-gtitle" id="forge-group-${i}">${escHtml(g.title)}${link}</h3>${start}<p class="hx-forge-meta">${escHtml(groupWords(g))}</p><ul class="hx-forge-list" aria-labelledby="forge-group-${i}">${g.entries.map(workHtml).join('')}</ul></li>`;
|
|
104
|
+
return `<li class="hx-forge-group"><h3 class="hx-forge-gtitle" id="forge-group-${i}">${escHtml(g.title)}${link}</h3><p class="hx-forge-meta">${escHtml(groupWords(g))}</p><ul class="hx-forge-list" aria-labelledby="forge-group-${i}">${g.entries.map(workHtml).join('')}</ul></li>`;
|
|
108
105
|
}).join('');
|
|
109
106
|
}
|
|
110
107
|
|
|
@@ -112,7 +109,7 @@ export function install(ctx) {
|
|
|
112
109
|
function paintRuns() {
|
|
113
110
|
const box = $('forge-runs');
|
|
114
111
|
if (!box) return;
|
|
115
|
-
box.hidden = ui.kind !== 'work'
|
|
112
|
+
box.hidden = ui.kind !== 'work';
|
|
116
113
|
if (box.hidden) return;
|
|
117
114
|
const data = ui.runs && ui.runs.data;
|
|
118
115
|
$('forge-runs-status').textContent = data ? runsStatus(data) : ui.loading ? 'Loading the runs …' : '';
|
|
@@ -146,7 +143,25 @@ export function install(ctx) {
|
|
|
146
143
|
const list = $('forge-runs-list');
|
|
147
144
|
list.setAttribute('aria-busy', String(!data && !!ui.loading));
|
|
148
145
|
if (!data) { list.innerHTML = ui.loading ? loadingRowsHtml(3) : ''; return; }
|
|
149
|
-
patchList(list, data.runs.length ?
|
|
146
|
+
patchList(list, data.runs.length ? runRowsHtml({ ...viewContext(), shown: ui.runShown }, data.runs) : '<li class="hx-forge-empty hx-faint" data-corn="empty">No agent has been asked for yet. Start one from an issue or a proposal: select it on the map, then Start an agent.</li>');
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/** The run in the node panel: its card (state, what it changes, Stop, the answer field, Start again, the timeline). Drawn with `patchList`, so a reply being typed stays. */
|
|
150
|
+
function paintRunCard() {
|
|
151
|
+
const box = $('forge-detail');
|
|
152
|
+
if (!box) return;
|
|
153
|
+
let list = box.querySelector('#forge-run-card');
|
|
154
|
+
if (!list) {
|
|
155
|
+
list = inst.doc.createElement('ul');
|
|
156
|
+
list.id = 'forge-run-card';
|
|
157
|
+
list.className = 'hx-forge-files';
|
|
158
|
+
list.setAttribute('aria-label', 'Run');
|
|
159
|
+
box.replaceChildren(list);
|
|
160
|
+
}
|
|
161
|
+
const run = runById(ui.runShown);
|
|
162
|
+
const data = ui.runs && ui.runs.data;
|
|
163
|
+
if (run) patchList(list, runHtml(viewContext(), run, data.runs));
|
|
164
|
+
else patchList(list, `<li class="hx-forge-empty hx-faint" data-corn="empty">${escHtml(ui.runs && ui.runs.error ? ui.runs.error : data ? 'This run is not in what the runners reported.' : 'Reading the run …')}</li>`);
|
|
150
165
|
}
|
|
151
166
|
|
|
152
167
|
/**
|
|
@@ -251,37 +266,29 @@ export function install(ctx) {
|
|
|
251
266
|
const base = f && safeUrl(f.url) ? f.url.replace(/\/+$/, '') : null;
|
|
252
267
|
return {
|
|
253
268
|
esc: escHtml, t, safeUrl, forgeName: fn.forgeName(), forgeType: f ? f.type : 'github', repoUrl: base && f.repo ? `${base}/${f.repo}` : null,
|
|
254
|
-
now: m.now(), nodes: state.nodes,
|
|
269
|
+
now: m.now(), nodes: state.nodes, timelines: ui.runTimelines, replies: ui.runReplies, busy: !!ui.busy,
|
|
255
270
|
results: { get: (id) => resultOf(id) },
|
|
256
271
|
};
|
|
257
272
|
}
|
|
258
273
|
|
|
259
274
|
const runById = (id) => ((ui.runs && ui.runs.data && ui.runs.data.runs) || []).find((r) => r.runId === id) || null;
|
|
260
275
|
|
|
261
|
-
/**
|
|
262
|
-
function
|
|
263
|
-
|
|
264
|
-
fn.relight();
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
/** Lights the nodes of a run on the map, like a pull request; the same button lets go of it */
|
|
268
|
-
function selectRun(id) {
|
|
269
|
-
const run = runById(id);
|
|
270
|
-
if (!run) return;
|
|
271
|
-
if (ui.runSel === id) {
|
|
272
|
-
ui.runSel = null;
|
|
273
|
-
fn.relight();
|
|
274
|
-
announce(`Run ${id} no longer lit on the map`);
|
|
275
|
-
return;
|
|
276
|
-
}
|
|
277
|
-
const had = ui.runSel;
|
|
276
|
+
/** Shows a run in the node panel: the runs are read once if they have not been (the graph holds the run's state, not its answer field or its brief) */
|
|
277
|
+
async function showRun(id) {
|
|
278
|
+
ui.runShown = id;
|
|
278
279
|
m.pullToken++;
|
|
279
280
|
fn.dropThread();
|
|
281
|
+
ui.runShown = id; // dropThread forgets the one it replaced
|
|
280
282
|
Object.assign(ui, { selected: null, detail: null, detailError: '', lit: null, landing: null, note: null, deploy: null, deployItem: null, litDeploy: null });
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
283
|
+
fn.paint();
|
|
284
|
+
if (!(ui.runs && ui.runs.data)) await loadRuns(false, { say: false });
|
|
285
|
+
if (ui.runShown !== id) return;
|
|
286
|
+
const run = runById(id);
|
|
287
|
+
// A run asked for a moment ago may not be in what was read before: ask once more, past the cache
|
|
288
|
+
if (!run && ui.runs && ui.runs.data) await loadRuns(true, { say: false });
|
|
289
|
+
if (ui.runShown !== id) return;
|
|
290
|
+
fn.paint();
|
|
291
|
+
fn.sayDetail(runById(id) ? `Run ${id}` : ui.runs && ui.runs.data ? `There is no run ${id} in what the runners reported.` : (ui.runs && ui.runs.error) || 'The runs could not be read.');
|
|
285
292
|
}
|
|
286
293
|
|
|
287
294
|
/** Opens or closes the timeline of a run (it stays open when the list is drawn again) */
|
|
@@ -292,8 +299,7 @@ export function install(ctx) {
|
|
|
292
299
|
|
|
293
300
|
/** Gives the focus to the first of `selectors` that is there and not disabled, inside the card of a run (else the card itself) */
|
|
294
301
|
function focusInRun(runId, selectors) {
|
|
295
|
-
const
|
|
296
|
-
const card = panel && [...panel.querySelectorAll('[data-run]')].find((c) => c.dataset.run === runId);
|
|
302
|
+
const card = [...root.querySelectorAll('#forge-run-card [data-run]')].find((c) => c.dataset.run === runId);
|
|
297
303
|
if (!card) return;
|
|
298
304
|
const to = selectors.map((sel) => card.querySelector(sel)).find((el) => el && !el.disabled) || card;
|
|
299
305
|
if (to !== inst.active()) to.focus();
|
|
@@ -355,33 +361,17 @@ export function install(ctx) {
|
|
|
355
361
|
focusInRun(runId, [back, `[data-run-timeline="${runId}"]`]);
|
|
356
362
|
}
|
|
357
363
|
|
|
358
|
-
/** Answer, on the proposal bar's line:
|
|
364
|
+
/** Answer, on the proposal bar's line: the run is shown in the node panel with its reply field focused */
|
|
359
365
|
async function answerFromBar(id) {
|
|
360
|
-
if (!(await
|
|
361
|
-
const field = $('forge-
|
|
366
|
+
if (!(await fn.showRef('run', id))) return;
|
|
367
|
+
const field = $('forge-detail') && $('forge-detail').querySelector(`[data-run-reply="${id}"]`);
|
|
362
368
|
if (field) field.focus();
|
|
363
369
|
}
|
|
364
370
|
|
|
365
|
-
/** Takes the person to another run
|
|
371
|
+
/** Takes the person to another run (a collision names it, a timeline entry does): its node */
|
|
366
372
|
function goToRun(runId) {
|
|
367
|
-
fn.
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
/** `?run=<runId>`: the Agents tab with that run lit and in view. A run that is not there is said, never a blank panel. */
|
|
371
|
-
async function openRunLink(id) {
|
|
372
|
-
if (!ui.config) return false;
|
|
373
|
-
await fn.openTab('work');
|
|
374
|
-
if (!(ui.runs && ui.runs.data)) await loadRuns(false, { say: false });
|
|
375
|
-
let run = runById(id);
|
|
376
|
-
// A run asked for a moment ago may not be in what was read before: ask once more, past the cache
|
|
377
|
-
if (!run && ui.runs && ui.runs.data) { await loadRuns(true, { say: false }); run = runById(id); }
|
|
378
|
-
if (!run) return fn.linkMissing(ui.runs && ui.runs.data ? `There is no run ${id}.` : (ui.runs && ui.runs.error) || 'The runs could not be read.');
|
|
379
|
-
if (ui.runSel !== id) selectRun(id);
|
|
380
|
-
fn.paint();
|
|
381
|
-
fn.bringIntoView($('forge-runs-list').querySelector(`[data-run="${id}"]`));
|
|
382
|
-
announce(`Run ${id}, in the Runs view`);
|
|
383
|
-
return true;
|
|
373
|
+
fn.showRef('run', runId);
|
|
384
374
|
}
|
|
385
375
|
|
|
386
|
-
Object.assign(fn, { groupsShown, loadWork, loadRuns, syncRunsPoll, onPageHide, onPageShow, workHtml: (...a) => withParts(workHtml(...a)), groupsHtml: (...a) => withParts(groupsHtml(...a)), paintRuns, patchList, graftAround, runnerAway, askRunnerWords, paintRunner, viewContext, runById,
|
|
376
|
+
Object.assign(fn, { groupsShown, loadWork, loadRuns, syncRunsPoll, onPageHide, onPageShow, workHtml: (...a) => withParts(workHtml(...a)), groupsHtml: (...a) => withParts(groupsHtml(...a)), paintRuns, paintRunCard, patchList, graftAround, runnerAway, askRunnerWords, paintRunner, viewContext, runById, showRun, toggleTimeline, focusInRun, discardReply, stopRun, answerRun, answerFromBar, goToRun });
|
|
387
377
|
}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module explorer/pieces/work-specs
|
|
3
3
|
*
|
|
4
|
-
* The Specs tab: the proposals the server finds, merged into one row each,
|
|
4
|
+
* The Specs tab: the proposals the server finds, merged into one row each, the number of those that wait on a decision, and a proposal's actions in the node panel. Part of the Work piece (pieces/work.js): `install(ctx)` makes this part's functions for one mount, and hands the ones other parts call
|
|
5
5
|
* to `ctx.fn`; nothing is shared between two mounts.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { mergeSpecs } from '../proposal-model.js';
|
|
9
9
|
import { waiting, specGroups } from '../waiting-model.js';
|
|
10
10
|
import { plural, SPECS_POLL_MS } from './work-common.js';
|
|
11
|
+
import { escapeHtml as escHtml } from '../../core/text.js';
|
|
11
12
|
|
|
12
13
|
export function install(ctx) {
|
|
13
14
|
const { inst, ui, m, fn, $ } = ctx;
|
|
@@ -67,5 +68,21 @@ export function install(ctx) {
|
|
|
67
68
|
}, SPECS_POLL_MS);
|
|
68
69
|
}
|
|
69
70
|
|
|
70
|
-
|
|
71
|
+
/** The entry of the proposals list a node of the graph is: the open spec PR when it has a number, else the copy that is only a file in a checkout (where Review opens it from) */
|
|
72
|
+
function specEntry(item) {
|
|
73
|
+
const list = specsList();
|
|
74
|
+
const items = list ? list.items : [];
|
|
75
|
+
return items.find((e) => e.slug === item.slug && (item.number ? e.pull && e.pull.number === item.number : !e.pull)) || items.find((e) => e.slug === item.slug) || null;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** A proposal's actions in the node panel: Review (opens it over the map; Approve and Send back are the review's), and Start an agent on it when the config lets a run start */
|
|
79
|
+
function proposalActionsHtml(item) {
|
|
80
|
+
const entry = specEntry(item);
|
|
81
|
+
const source = (entry && entry.source) || item.source || '';
|
|
82
|
+
const review = `<button type="button" class="hx-btn hx-btn--approve hx-forge-act" data-corn-kind="approve" data-work-action="review" data-slug="${escHtml(item.slug)}" data-source="${escHtml(source)}">Review …</button>`;
|
|
83
|
+
const agent = fn.canStartAgent() ? `<button data-corn-kind="secondary" type="button" class="hx-btn hx-forge-act" data-forge-agent="proposal:${escHtml(item.slug)}" aria-label="${escHtml(t('startAgent'))} on proposal ${escHtml(item.slug)}">${escHtml(t('startAgent'))} …</button>` : '';
|
|
84
|
+
return `<div class="hx-forge-cta">${review}${agent}</div>`;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
Object.assign(fn, { specsList, waitingNow, loadSpecs, specsShownWords, readSpecsQuiet, syncSpecsPoll, specEntry, proposalActionsHtml });
|
|
71
88
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module explorer/pieces/work-threads
|
|
3
3
|
*
|
|
4
|
-
* The Threads tab: the list, a thread's messages, and the New idea form. Part of the Work piece (pieces/work.js): `install(ctx)` makes this part's functions for one mount, and hands the ones other parts call
|
|
4
|
+
* The Threads tab: the list, a thread's messages in the node panel, and the New idea form. Part of the Work piece (pieces/work.js): `install(ctx)` makes this part's functions for one mount, and hands the ones other parts call
|
|
5
5
|
* to `ctx.fn`; nothing is shared between two mounts.
|
|
6
6
|
*/
|
|
7
7
|
|
|
@@ -12,15 +12,15 @@ import { defaultFilters, threadsUrl, threadUrl, IDEAS_URL, threadKindWords, thre
|
|
|
12
12
|
import { cornStateAttr } from '../corn-state.js';
|
|
13
13
|
import { relativeTime } from '../review-model.js';
|
|
14
14
|
import { escapeHtml as escHtml } from '../../core/text.js';
|
|
15
|
-
import { plural, safeUrl,
|
|
15
|
+
import { plural, safeUrl, threadOf, MENTIONABLE } from './work-common.js';
|
|
16
16
|
|
|
17
17
|
export function install(ctx) {
|
|
18
18
|
const { inst, ui, m, fn, state, root, $ } = ctx;
|
|
19
|
-
const { announce,
|
|
19
|
+
const { announce, repaintThreads } = ctx.h;
|
|
20
20
|
|
|
21
21
|
/** Forgets the selected thread without painting: another thing is being selected */
|
|
22
22
|
function dropThread() {
|
|
23
|
-
ui.
|
|
23
|
+
ui.runShown = null;
|
|
24
24
|
m.threadToken++;
|
|
25
25
|
ui.thread = null;
|
|
26
26
|
ui.threadDetail = null;
|
|
@@ -31,7 +31,7 @@ export function install(ctx) {
|
|
|
31
31
|
async function selectThread(n) {
|
|
32
32
|
const token = ++m.threadToken;
|
|
33
33
|
m.pullToken++;
|
|
34
|
-
ui.
|
|
34
|
+
ui.runShown = null;
|
|
35
35
|
ui.selected = null;
|
|
36
36
|
ui.detail = null;
|
|
37
37
|
ui.detailError = '';
|
|
@@ -44,11 +44,8 @@ export function install(ctx) {
|
|
|
44
44
|
ui.threadDetail = null;
|
|
45
45
|
ui.threadError = '';
|
|
46
46
|
ui.litThread = null;
|
|
47
|
-
state.forgeLit = null;
|
|
48
|
-
touchScene();
|
|
49
|
-
render();
|
|
50
47
|
fn.paint();
|
|
51
|
-
const res = await fn.request(threadUrl(n), false);
|
|
48
|
+
const res = fn.preloaded('thread', n) || await fn.request(threadUrl(n), false);
|
|
52
49
|
if (token !== m.threadToken) return;
|
|
53
50
|
// An answer without a thread in it is a failure too: nothing to show or light
|
|
54
51
|
const thread = threadOf(res);
|
|
@@ -59,40 +56,26 @@ export function install(ctx) {
|
|
|
59
56
|
return;
|
|
60
57
|
}
|
|
61
58
|
ui.threadDetail = { thread, at: res.body.at, rate: res.body.rate || '', stale: res.body.stale || '' };
|
|
62
|
-
fn.
|
|
63
|
-
|
|
64
|
-
announce(threadSelectionWords());
|
|
59
|
+
fn.figure();
|
|
60
|
+
fn.sayDetail(threadSelectionWords());
|
|
65
61
|
}
|
|
66
62
|
|
|
67
|
-
/** Lets go of the
|
|
63
|
+
/** Lets go of the thread in the node panel (another node was chosen, or the panel closed) */
|
|
68
64
|
function clearThread() {
|
|
69
|
-
const had = ui.thread;
|
|
70
65
|
dropThread();
|
|
71
|
-
state.forgeLit = null;
|
|
72
|
-
touchScene();
|
|
73
|
-
render();
|
|
74
|
-
fn.paint();
|
|
75
|
-
if (had !== null) announce(`Thread ${had} cleared`);
|
|
76
66
|
}
|
|
77
67
|
|
|
78
68
|
/** What a screen reader hears when a thread is selected */
|
|
79
69
|
function threadSelectionWords() {
|
|
80
70
|
const { thread } = ui.threadDetail;
|
|
81
|
-
const
|
|
71
|
+
const on = ui.litThread ? ui.litThread.nodes.length : 0;
|
|
82
72
|
const off = ui.litThread ? ui.litThread.unresolved.length : 0;
|
|
83
|
-
return `Thread ${thread.number}, ${thread.title}: ${plural(thread.messages.length, 'message')}, ${
|
|
73
|
+
return `Thread ${thread.number}, ${thread.title}: ${plural(thread.messages.length, 'message')}, ${on ? `${plural(on, 'node')} on the map` : 'no node mentioned'}${off ? `, ${off} named that ${off === 1 ? 'is' : 'are'} not on the map` : ''}. Read-only: reply on ${fn.forgeName()}.`;
|
|
84
74
|
}
|
|
85
75
|
|
|
86
|
-
/** Shows a thread from the map (a node's "Mentioned in"): the panel
|
|
76
|
+
/** Shows a thread from the map (a node's "Mentioned in"): the thread's node is selected, or, for one the Work view does not draw, the node panel shows it by the same path as a row of the list */
|
|
87
77
|
function openThread(n) {
|
|
88
|
-
|
|
89
|
-
ui.kind = 'threads';
|
|
90
|
-
ui.actNote = null;
|
|
91
|
-
ui.filters = defaultFilters('threads');
|
|
92
|
-
}
|
|
93
|
-
fn.openForge();
|
|
94
|
-
fn.paintFilters();
|
|
95
|
-
selectThread(n);
|
|
78
|
+
return fn.showRef('thread', String(n));
|
|
96
79
|
}
|
|
97
80
|
|
|
98
81
|
/** The threads list for the node panel's "Mentioned in", read once (quietly) when a node is first selected, and when the Threads tab loads it */
|
|
@@ -139,7 +122,7 @@ export function install(ctx) {
|
|
|
139
122
|
ui.actNote = null;
|
|
140
123
|
ui.filters = defaultFilters('threads');
|
|
141
124
|
}
|
|
142
|
-
fn.openForge();
|
|
125
|
+
fn.openForge({ tab: 'threads' });
|
|
143
126
|
fn.paintFilters();
|
|
144
127
|
ui.idea.open = true;
|
|
145
128
|
ui.idea.message = '';
|
|
@@ -192,7 +175,7 @@ export function install(ctx) {
|
|
|
192
175
|
}
|
|
193
176
|
|
|
194
177
|
/**
|
|
195
|
-
* After an idea is opened: the list read again, the new thread
|
|
178
|
+
* After an idea is opened: the list read again, the new thread shown in the node panel (from the list's form), the focus back on what opened
|
|
196
179
|
* the form, and all of it said once. The idea is on the forge whatever happens here, so a failure is said, never thrown.
|
|
197
180
|
*/
|
|
198
181
|
async function afterIdea(res) {
|
|
@@ -208,8 +191,8 @@ export function install(ctx) {
|
|
|
208
191
|
await fn.loadList(true, true);
|
|
209
192
|
if (ui.open) fn.primeCounts();
|
|
210
193
|
ensureThreadsList();
|
|
211
|
-
//
|
|
212
|
-
if (Number.isInteger(n)) await
|
|
194
|
+
// An idea opened from the form of the list is shown in the node panel, with what it mentions; one opened from a node's panel leaves that panel as it is: its "Mentioned in" lists the new thread
|
|
195
|
+
if (Number.isInteger(n) && !about) await fn.showRef('thread', String(n));
|
|
213
196
|
} catch (err) {
|
|
214
197
|
trouble = ` The list could not be read again (${err instanceof Error ? err.message : err}); Refresh asks for it.`;
|
|
215
198
|
}
|
|
@@ -217,7 +200,7 @@ export function install(ctx) {
|
|
|
217
200
|
try { focusIdeaOpener(); } catch { /* the page moved on */ }
|
|
218
201
|
ui.idea.opener = '';
|
|
219
202
|
ui.idea.node = null;
|
|
220
|
-
const shown = ui.thread === n && ui.threadDetail && ui.threadDetail.thread ? ` ${threadSelectionWords()}` : ui.thread === n && ui.threadError ? ` ${ui.threadError}` : '';
|
|
203
|
+
const shown = ui.thread === n && ui.threadDetail && ui.threadDetail.thread ? ` ${threadSelectionWords()}` : ui.thread === n && ui.threadError ? ` ${ui.threadError}` : !about && ui.actNote && !ui.actNote.ok ? ` ${ui.actNote.text}` : '';
|
|
221
204
|
// Opened from a node: say that its "Mentioned in" lists the new thread
|
|
222
205
|
const listed = about && (threadsFor(about.id) || []).some((t) => t.number === n);
|
|
223
206
|
announce(`${ui.idea.message}${shown}${listed ? ` It is listed under Threads for ${about.label}.` : ''}${trouble}`);
|
|
@@ -228,7 +211,7 @@ export function install(ctx) {
|
|
|
228
211
|
const bar = $('forge-idea');
|
|
229
212
|
if (!bar) return;
|
|
230
213
|
// An idea is a thread: with threads off (`threads: false`) there is no New idea, on Specs either
|
|
231
|
-
bar.hidden = (ui.kind !== 'threads' && ui.kind !== 'specs') ||
|
|
214
|
+
bar.hidden = (ui.kind !== 'threads' && ui.kind !== 'specs') || !ui.config || ui.config.threads === false;
|
|
232
215
|
$('idea-open').setAttribute('aria-expanded', String(ui.idea.open));
|
|
233
216
|
$('idea-form').hidden = !ui.idea.open;
|
|
234
217
|
$('idea-send').textContent = ui.idea.busy ? 'Opening …' : 'Open the idea';
|
|
@@ -263,20 +246,19 @@ export function install(ctx) {
|
|
|
263
246
|
const runs = ui.runs && ui.runs.data ? ui.runs.data.runs : null;
|
|
264
247
|
const run = runOnThread(runs, t.number);
|
|
265
248
|
const runWord = run ? `${runPillHtml({ esc: escHtml }, run, threadRunWords(runs, t.number), ` data-thread-run="${escHtml(run.runId)}"`)} ` : '';
|
|
266
|
-
return `<li class="hx-forge-item"><button type="button" class="hx-forge-row" data-
|
|
249
|
+
return `<li class="hx-forge-item"><button type="button" class="hx-forge-row" data-work-ref="thread:${t.number}" aria-pressed="${fn.isShown(`thread:${t.number}`)}" data-corn="row">
|
|
267
250
|
<span class="hx-forge-title">${escHtml(t.title)}</span>
|
|
268
251
|
<span class="hx-forge-meta"><span class="hx-forge-state hx-forge-state--${escHtml(t.state)}" data-corn="state-pill"${cornStateAttr(t.state)}>${escHtml(t.state === 'open' ? 'Open' : 'Closed')}</span> ${runWord}<span class="hx-forge-label" data-corn="tag">${escHtml(threadKindWords(t))}</span> ${escHtml(threadMeta(t, m.now()))}</span>${note ? `<span class="hx-forge-meta">${escHtml(note)}</span>` : ''}</button>${out}</li>`;
|
|
269
252
|
}
|
|
270
253
|
|
|
271
|
-
/** The
|
|
254
|
+
/** The thread in the node panel: read-only, its messages as written, a way to reply on the forge, and the nodes its text names */
|
|
272
255
|
function threadDetailHtml() {
|
|
273
|
-
|
|
274
|
-
if (ui.
|
|
275
|
-
if (!ui.threadDetail) return `${head(`Thread ${ui.thread}`)}<p class="hx-faint">Loading its messages …</p>`;
|
|
256
|
+
if (ui.threadError) return `<p class="hx-forge-notice" data-corn="notice">${escHtml(ui.threadError)}</p>`;
|
|
257
|
+
if (!ui.threadDetail) return '<p class="hx-faint">Loading its messages …</p>';
|
|
276
258
|
const { thread: t, stale } = ui.threadDetail;
|
|
277
259
|
const lit = ui.litThread;
|
|
278
260
|
const url = safeUrl(t.url);
|
|
279
|
-
const reply = url ? `<a data-corn="
|
|
261
|
+
const reply = url ? `<a data-corn="open-link" data-corn-kind="primary" class="hx-btn hx-btn--primary hx-forge-open" href="${escHtml(url)}" target="_blank" rel="noreferrer">Reply on ${escHtml(fn.forgeName())} ↗</a>` : '';
|
|
280
262
|
const named = [
|
|
281
263
|
...(t.proposals || []).map((p) => `Proposal <code class="hx-code">${escHtml(p.slug)}</code> in pull request #${p.pull}`),
|
|
282
264
|
...(t.kind === 'proposal' ? [`Spec pull request for <code class="hx-code">${escHtml((t.slugs || []).join(', '))}</code>`] : []),
|
|
@@ -290,17 +272,15 @@ export function install(ctx) {
|
|
|
290
272
|
: '';
|
|
291
273
|
return `<li class="hx-thread-msg" data-corn="thread-message"><p class="hx-forge-meta"><strong class="hx-strong">${escHtml(msg.author ? msg.author.login : 'someone')}</strong>${msg.opening ? ' opened this' : ''} · ${escHtml(relativeTime(msg.createdAt, m.now()))}${link}</p><p class="hx-thread-body">${escHtml(msg.body.trim() === '' ? '(no text)' : msg.body)}${msg.cut ? '\n… (cut here; the rest is on the forge)' : ''}</p>${chips}</li>`;
|
|
292
274
|
}).join('');
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
<p class="hx-forge-why hx-faint">Read-only here: a thread is a conversation on ${escHtml(fn.forgeName())}, so you reply there. ${reply}</p>
|
|
275
|
+
return `<p class="hx-forge-meta">${escHtml(threadKindWords(t))} · ${escHtml(threadMeta({ ...t, comments: t.messages.length - (t.kind === 'idea' ? 1 : 0) + (t.hidden || 0) }, m.now()))}</p>
|
|
276
|
+
<p class="hx-forge-why hx-faint">Read-only here: a thread is a conversation on ${escHtml(fn.forgeName())}, so you reply there.</p>
|
|
277
|
+
${reply ? `<div class="hx-forge-cta">${reply}</div>` : ''}
|
|
297
278
|
${named.length ? `<p class="hx-forge-meta">${named.join(' · ')}</p>` : ''}
|
|
298
279
|
${stale ? `<p class="hx-forge-notice" data-corn="notice">${escHtml(`This is an older answer. ${stale}`)}</p>` : ''}
|
|
299
|
-
<
|
|
300
|
-
${key}
|
|
280
|
+
<h3 class="hx-forge-sub">${escHtml(`Mentions: ${plural(lit.nodes.length, 'node')} on the map`)}</h3>
|
|
301
281
|
${lit.nodes.length ? `<span class="hx-forge-nodes hx-thread-nodes">${lit.nodes.map(fn.nodeButton).join('')}</span>` : '<p class="hx-faint">No message mentions a node. Write [[node-id]] or [[repo/path]] in a message to point at the map.</p>'}
|
|
302
282
|
${lit.unresolved.length ? `<p class="hx-forge-notice" data-corn="notice">${escHtml(lit.unresolved.join(', '))} ${lit.unresolved.length === 1 ? 'is' : 'are'} mentioned but not on the map, so ${lit.unresolved.length === 1 ? 'it stays' : 'they stay'} text.</p>` : ''}
|
|
303
|
-
<
|
|
283
|
+
<h3 class="hx-forge-sub">${escHtml(plural(t.messages.length, 'message'))}</h3>
|
|
304
284
|
${t.hidden ? `<p class="hx-forge-why hx-faint">${escHtml(plural(t.hidden, 'earlier message'))} not shown; they are on ${escHtml(fn.forgeName())}.</p>` : ''}
|
|
305
285
|
<ol class="hx-thread-msgs" aria-label="Messages">${msgs}</ol>`;
|
|
306
286
|
}
|
package/explorer/pieces/work.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module explorer/pieces/work
|
|
3
3
|
*
|
|
4
|
-
* The Work
|
|
5
|
-
*
|
|
6
|
-
* step and Start an agent) and the layer over the map that marks the nodes an open
|
|
7
|
-
* parts' (work-*.js, one module each); this file makes them for one mount, wires
|
|
4
|
+
* The Work piece on the instance (spec 0011 D2 and D3; CF-07, CF-42, spec 0001 section 4, spec 0010, spec 0012 D5 and D6): the Work list with its tabs (Specs, PRs, Issues,
|
|
5
|
+
* Threads, Runs, Deploys, and Release notes one level down on PRs; the List toggle of the Work view opens it), the actions of a piece of work in the node panel (Land it,
|
|
6
|
+
* Re-run, Start an agent, a run's answer field ...), the two dialogs those open (the confirm step and Start an agent) and the layer over the map that marks the nodes an open
|
|
7
|
+
* run is changing. What the list shows, asks and does is the parts' (work-*.js, one module each; the list's own is work-list.js); this file makes them for one mount, wires
|
|
8
|
+
* them to the instance, and ends them.
|
|
8
9
|
*
|
|
9
10
|
* mount(root, inst, { slots, config, clock }) -> { update, destroy, elements, ... }
|
|
10
11
|
* slots where cornfield's page leaves the places (`<!--corn-piece:work/button-->`, `work/panel`, `work/overlay`, `work/dialogs`); a host
|
|
@@ -26,9 +27,10 @@
|
|
|
26
27
|
* POST /api/agent-runs/<id>/stop {} POST /api/agent-runs/<id>/answer {action: 'continue'|'stop'|'reply', text?}
|
|
27
28
|
* (and GET /proposals, which the engine reads for the Specs tab: engine/proposal.js)
|
|
28
29
|
*
|
|
29
|
-
* Events and asks (instance.js lists them): hears `
|
|
30
|
-
* `
|
|
31
|
-
* `work:
|
|
30
|
+
* Events and asks (instance.js lists them): hears `forge:can-start` (ask) and `forge:start`, `thread:open`, `thread:start`, `threads:ensure`, `threads:index` (ask),
|
|
31
|
+
* `proposal:bar`, `decision`, `work:answer`, `work:open-specs` (ask, answers true), `work:on` (ask), `node:painted` and `node:close` (the node panel shows a piece of work, or lets it go), `scene`; asks
|
|
32
|
+
* `work:pick {kind, key}` (the Work view selects that node: true); says `work:waiting {total}`, `work:available {on}`,
|
|
33
|
+
* `work:list {open}`, `proposal:waiting`, `proposal:waiting-reset`, `runs:map {active}`, `threads:changed`, `announce`.
|
|
32
34
|
*/
|
|
33
35
|
|
|
34
36
|
import { place, scopeOf } from '../engine/piece.js';
|
|
@@ -39,7 +41,6 @@ import { t } from '../engine/strings.js';
|
|
|
39
41
|
import { isPhone, registerSheet, unregisterSheet, expandSheet, collapseSheet, showSheet, refreshStubs } from '../engine/sheets.js';
|
|
40
42
|
import { sayResult, clearResult, resultOf, showResultIn } from '../engine/feedback.js';
|
|
41
43
|
import { selectNode } from '../engine/selection.js';
|
|
42
|
-
import { toggleLayer } from '../engine/layers.js';
|
|
43
44
|
import { notSentWords } from '../engine/connection.js';
|
|
44
45
|
import * as P from '../engine/proposal.js';
|
|
45
46
|
import { isNodeVisible } from '../scene.js';
|
|
@@ -57,7 +58,7 @@ import { install as installNotes } from './work-notes.js';
|
|
|
57
58
|
import { install as installConfirm } from './work-confirm.js';
|
|
58
59
|
import { install as installAgent } from './work-agent.js';
|
|
59
60
|
import { install as installPaint } from './work-paint.js';
|
|
60
|
-
import { install as
|
|
61
|
+
import { install as installList } from './work-list.js';
|
|
61
62
|
|
|
62
63
|
export { markup, RUNS_POLL_MS, SPECS_POLL_MS };
|
|
63
64
|
|
|
@@ -71,7 +72,6 @@ export function mount(root, inst, options = {}) {
|
|
|
71
72
|
const mk = markup();
|
|
72
73
|
const slots = options.slots || {};
|
|
73
74
|
const made = [
|
|
74
|
-
...place(inst, root, mk.button, slots, 'button'),
|
|
75
75
|
...place(inst, root, mk.panel, slots, 'panel'),
|
|
76
76
|
...place(inst, root, mk.overlay, slots, 'overlay'),
|
|
77
77
|
...place(inst, root, mk.dialogs, slots, 'dialogs'),
|
|
@@ -103,13 +103,10 @@ export function mount(root, inst, options = {}) {
|
|
|
103
103
|
collapseSheet: (id) => collapseSheet(inst, id),
|
|
104
104
|
showSheet: (id) => showSheet(inst, id),
|
|
105
105
|
refreshStubs: () => refreshStubs(inst),
|
|
106
|
-
render: () => { if (inst.map) inst.map.render(); },
|
|
107
|
-
touchScene: () => inst.touchScene(),
|
|
108
106
|
nodeById: (id) => inst.state.nodes.find((n) => n.id === id),
|
|
109
107
|
isNodeVisible: (node) => (inst.map ? inst.map.isNodeVisible(node) : isNodeVisible(inst.state, node)),
|
|
110
108
|
selectNode: (node, opts) => selectNode(inst, node, opts),
|
|
111
109
|
repaintThreads: () => inst.emit('threads:changed'),
|
|
112
|
-
toggleLayer: (key) => toggleLayer(inst, key),
|
|
113
110
|
sayResult: (key, text, ok) => sayResult(inst, key, text, ok),
|
|
114
111
|
clearResult: (key) => clearResult(inst, key),
|
|
115
112
|
resultOf: (key) => resultOf(inst, key),
|
|
@@ -138,7 +135,7 @@ export function mount(root, inst, options = {}) {
|
|
|
138
135
|
};
|
|
139
136
|
const ctx = { inst, ui: freshUi(), m, fn: {}, state: inst.state, root: inst.root || root, $: (id) => inst.el(id), scope, h, dead: false };
|
|
140
137
|
const { ui, fn } = ctx;
|
|
141
|
-
for (const install of [installData, installSpecs, installPrs, installIssues, installThreads, installRuns, installDeploys, installNotes, installConfirm, installAgent, installPaint,
|
|
138
|
+
for (const install of [installData, installSpecs, installPrs, installIssues, installThreads, installRuns, installDeploys, installNotes, installConfirm, installAgent, installPaint, installList]) install(ctx);
|
|
142
139
|
|
|
143
140
|
// -- the panel starts once the config says there is a forge and somebody is signed in ---------------------------------------------------
|
|
144
141
|
let on = false;
|
|
@@ -152,7 +149,7 @@ export function mount(root, inst, options = {}) {
|
|
|
152
149
|
ui.config = config;
|
|
153
150
|
const first = !on;
|
|
154
151
|
on = true;
|
|
155
|
-
for (const toggle of ctx.root.querySelectorAll('[data-action="toggle-forge"]')) toggle.hidden = false;
|
|
152
|
+
for (const toggle of ctx.root.querySelectorAll('[data-action="toggle-forge"]')) toggle.hidden = false; // the Work view's List toggle, if it is there already (it asks `work:on` when it is made)
|
|
156
153
|
panel.hidden = false;
|
|
157
154
|
inst.emit('work:available', { on: true });
|
|
158
155
|
// `threads: false` in the config turns the tab off; a server that does not say has threads
|
|
@@ -160,9 +157,9 @@ export function mount(root, inst, options = {}) {
|
|
|
160
157
|
const tab = panel.querySelector('[data-forge-kind="threads"]');
|
|
161
158
|
if (tab) tab.hidden = !threadsOn;
|
|
162
159
|
ui.threadsOn = threadsOn;
|
|
163
|
-
// On a phone
|
|
160
|
+
// On a phone the list is a sheet: it opens as a peek and displaces the node panel (and the reverse); folded to a stub it says its title and what waits on you (spec 0010 D7)
|
|
164
161
|
registerSheet(inst, 'forge', panel, {
|
|
165
|
-
stub: () => { const n = fn.waitingNow().total; return { title:
|
|
162
|
+
stub: () => { const n = fn.waitingNow().total; return { title: 'Work list', badge: n ? String(n) : '', label: workButtonName('Work list', n, h.t) }; },
|
|
166
163
|
away: () => fn.closeForge({ restoreFocus: false }),
|
|
167
164
|
});
|
|
168
165
|
fn.paintFilters();
|
|
@@ -181,14 +178,18 @@ export function mount(root, inst, options = {}) {
|
|
|
181
178
|
scope.on('decision', ({ open }) => { if (open !== false) fn.readSpecsQuiet(); });
|
|
182
179
|
scope.on('proposal:bar', ({ open }) => fn.paintBarLine(open));
|
|
183
180
|
scope.on('work:answer', ({ run }) => { fn.answerFromBar(run); });
|
|
184
|
-
// A bad link's way on, and the node panel's "Start a run"
|
|
181
|
+
// A bad link's way on (the proposal bar asks), and the node panel's "Start a run"
|
|
185
182
|
scope.on('work:open-specs', () => { fn.openForge({ tab: 'specs' }); return true; });
|
|
186
183
|
scope.on('forge:can-start', () => fn.canStartAgent());
|
|
187
184
|
scope.on('forge:start', ({ slug, returnTo }) => { fn.openProposalStart(slug, returnTo); });
|
|
188
185
|
// A node's panel lists the threads that mention it; a click there shows one in this panel
|
|
189
186
|
scope.on('threads:index', (nodeId) => (ui.config && ui.threadsOn ? { threads: fn.threadsFor(nodeId), forge: fn.forgeName(), start: true } : undefined));
|
|
190
187
|
scope.on('threads:ensure', () => { if (ui.config && ui.threadsOn) fn.ensureThreadsList(); });
|
|
191
|
-
scope.on('thread:open', ({ number }) => { if (ui.threadsOn) fn.openThread(number); });
|
|
188
|
+
scope.on('thread:open', ({ number }) => { if (ui.threadsOn) fn.openThread(number).catch(() => {}); });
|
|
189
|
+
// The node panel shows a piece of work (the Work view's node, or one the lists read): its actions are drawn into it; anything else, or closed, lets go of it
|
|
190
|
+
scope.on('node:painted', ({ node }) => { m.shown = node && node.work && node.item ? fn.showDetail(node) : (fn.dropDetail(), Promise.resolve()); });
|
|
191
|
+
scope.on('node:close', () => fn.dropDetail());
|
|
192
|
+
scope.on('node:back', () => fn.rowBack()); // the node panel closing gives the focus back to the row that chose it
|
|
192
193
|
scope.on('thread:start', ({ node }) => { if (ui.threadsOn && node) fn.startThread(node); });
|
|
193
194
|
// The map or the proposal changed the nodes: the lights follow them. The header's Proposals menu reads the same list: the Specs tab and its count follow
|
|
194
195
|
scope.on('scene', fn.onNodesChange);
|
|
@@ -196,13 +197,18 @@ export function mount(root, inst, options = {}) {
|
|
|
196
197
|
scope.own(inst.onNetwork((offline) => { if (!offline) fn.readOnline(); })); // ends with the piece, not only with the instance
|
|
197
198
|
scope.own(inst.onPageHide(() => fn.onPageHide()));
|
|
198
199
|
scope.own(inst.onPageShow(() => fn.onPageShow()));
|
|
199
|
-
// Any `data-action="toggle-forge"` opens and closes the
|
|
200
|
+
// Any `data-action="toggle-forge"` (the Work view's List toggle) opens and closes the list
|
|
200
201
|
scope.listen(ctx.root, 'click', (e) => {
|
|
201
202
|
const el = e.target.closest && e.target.closest('[data-action="toggle-forge"]');
|
|
202
203
|
if (!el) return;
|
|
203
204
|
m.openerEl = el;
|
|
204
205
|
fn.toggleForge();
|
|
205
206
|
});
|
|
207
|
+
// What is in the node panel's actions is the page's, not the list's: its clicks, a reply being typed and Enter in it are heard on the root
|
|
208
|
+
const inDetail = (e) => e.target.closest && e.target.closest('[data-corn="work-detail"]');
|
|
209
|
+
scope.listen(ctx.root, 'click', (e) => { if (inDetail(e)) fn.onDetailClick(e); });
|
|
210
|
+
scope.listen(ctx.root, 'input', (e) => { if (inDetail(e)) fn.onDetailInput(e); });
|
|
211
|
+
scope.listen(ctx.root, 'keydown', (e) => { if (inDetail(e)) fn.onDetailKey(e); });
|
|
206
212
|
// A control tabbed to inside the strip of tabs is brought fully into view, ring and all (focus-room.js)
|
|
207
213
|
scope.listen(ctx.root, 'focusin', (e) => { revealInStrip(e.target); });
|
|
208
214
|
const tabs = panel.querySelector('.hx-forge-tabs');
|
|
@@ -248,8 +254,6 @@ export function mount(root, inst, options = {}) {
|
|
|
248
254
|
ctx.dead = true;
|
|
249
255
|
if (ui.confirm) fn.closeConfirm({ restoreFocus: false });
|
|
250
256
|
if (ui.agent) fn.closeAgent({ restoreFocus: false });
|
|
251
|
-
// What this panel lit and said goes with it
|
|
252
|
-
if (inst.state.forgeLit) inst.state.forgeLit = null;
|
|
253
257
|
runsMap.destroy();
|
|
254
258
|
inst.emit('proposal:waiting-reset');
|
|
255
259
|
inst.emit('work:waiting', { total: 0 });
|
|
@@ -271,13 +275,9 @@ export function mount(root, inst, options = {}) {
|
|
|
271
275
|
closeForge: (opts) => fn.closeForge(opts),
|
|
272
276
|
toggleForge: () => fn.toggleForge(),
|
|
273
277
|
refreshForge: (opts) => fn.refreshForge(opts),
|
|
274
|
-
clearPull: () => fn.clearPull(),
|
|
275
|
-
clearDeploy: () => fn.clearDeploy(),
|
|
276
|
-
clearThread: () => fn.clearThread(),
|
|
277
|
-
selectDeploy: (id) => fn.selectDeploy(id),
|
|
278
|
-
openRunLink: (id) => fn.openRunLink(id),
|
|
279
|
-
openIssueLink: (n) => fn.openIssueLink(n),
|
|
280
278
|
openProposalStart: (slug, opener) => fn.openProposalStart(slug, opener),
|
|
279
|
+
/** A piece of work, by what a row of the list names (`pull`, `issue`, `thread`, `run`, `deploy`, `proposal` and its number, id or slug): selected in the Work view, or shown in the node panel alone when the graph does not hold it */
|
|
280
|
+
showRef: (kind, key) => fn.showRef(kind, key),
|
|
281
281
|
canStartAgent: () => fn.canStartAgent(),
|
|
282
282
|
/** For tests: force reduced motion on or off for the runs' marks (null: follow the viewer's setting) */
|
|
283
283
|
setReducedMotion: (v) => runsMap.setReducedMotion(v),
|