cornfield 0.31.0 → 0.33.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/README.md +2 -2
- package/core/strings.js +5 -4
- package/explorer/deep-link.js +1 -1
- package/explorer/explorer.css +57 -13
- package/explorer/file-url.js +40 -0
- package/explorer/forge-panel-model.js +1 -1
- package/explorer/forge-panel.js +276 -61
- package/explorer/index.html +44 -34
- package/explorer/main.js +1 -0
- package/explorer/panels.js +13 -9
- package/explorer/proposal-model.js +42 -0
- package/explorer/proposal.js +17 -1
- package/explorer/runs-model.js +15 -0
- package/explorer/state.js +2 -0
- package/package.json +1 -1
- package/server/server.js +1 -1
package/explorer/index.html
CHANGED
|
@@ -155,7 +155,7 @@
|
|
|
155
155
|
<!-- Review tokens (explorer/review-tokens.js): shown only when somebody is signed in to a forge -->
|
|
156
156
|
<button type="button" id="tokens-btn" class="hx-account-item" aria-haspopup="dialog" aria-expanded="false" aria-controls="tokens-dialog" title="Review tokens: let a script or a chat bot approve or send back a proposal as you" hidden data-corn="tokens-button">Review tokens</button>
|
|
157
157
|
|
|
158
|
-
<!-- Proposals: what a change would add, change and remove, drawn on the map (proposal.js).
|
|
158
|
+
<!-- Proposals: what a change would add, change and remove, drawn on the map (proposal.js). Only without the Work panel (no forge, or no sign-in): with it, its Specs tab lists them and forge-panel.js hides this -->
|
|
159
159
|
<div id="proposal-wrap">
|
|
160
160
|
<button type="button" id="proposal-btn" class="hx-account-item" data-action="toggle-proposals-menu" aria-haspopup="true" aria-expanded="false" title="Open a proposal: what a change would add, change and remove" data-corn="proposals-button"><span data-corn-string="proposals">Proposals</span><span class="hx-faint" aria-hidden="true">▾</span></button>
|
|
161
161
|
<div id="proposal-menu" class="hx-menu hx-menu--proposals" hidden data-corn="proposals-menu"></div>
|
|
@@ -230,24 +230,27 @@
|
|
|
230
230
|
</div>
|
|
231
231
|
</section>
|
|
232
232
|
|
|
233
|
-
<!--
|
|
234
|
-
<aside id="forge-panel" class="hx-forge glass" aria-label="
|
|
235
|
-
<div class="hx-forge-body">
|
|
233
|
+
<!-- The Work panel (forge-panel.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. `forge-panel` on the inner box is the old name of the hook, kept for one release (docs/theming.md) -->
|
|
234
|
+
<aside id="forge-panel" class="hx-forge glass" aria-label="Work" inert hidden data-corn="work-panel">
|
|
235
|
+
<div class="hx-forge-body" data-corn="forge-panel">
|
|
236
236
|
<div class="hx-forge-head">
|
|
237
|
-
<h2 id="forge-title" class="hx-drawer-title" tabindex="-1">
|
|
237
|
+
<h2 id="forge-title" class="hx-drawer-title" tabindex="-1">Work</h2>
|
|
238
238
|
<button type="button" class="hx-btn hx-btn--quiet" data-action="refresh-forge" title="Ask the forge again" data-corn-kind="quiet">Refresh</button>
|
|
239
239
|
<button type="button" class="hx-close" data-action="close-forge" aria-label="Close" data-corn-kind="icon">✕</button>
|
|
240
240
|
</div>
|
|
241
|
-
<
|
|
242
|
-
|
|
243
|
-
<
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
241
|
+
<div class="hx-forge-tabs" role="group" aria-label="Show" data-corn="tabs">
|
|
242
|
+
<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" hidden></span></button>
|
|
243
|
+
<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" hidden></span></button>
|
|
244
|
+
<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" hidden></span></button>
|
|
245
|
+
<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" hidden></span></button>
|
|
246
|
+
<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" hidden></span></button>
|
|
247
|
+
<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" hidden></span></button>
|
|
248
|
+
</div>
|
|
249
|
+
<div id="forge-bar" class="hx-forge-bar">
|
|
250
|
+
<p id="forge-status" class="hx-forge-status hx-faint"></p>
|
|
251
|
+
<button 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" hidden></span></button>
|
|
252
|
+
</div>
|
|
253
|
+
<div id="forge-filter-box" class="hx-forge-controls" hidden>
|
|
251
254
|
<div id="forge-work-filters" class="hx-forge-work-filters" hidden>
|
|
252
255
|
<label class="hx-forge-toggle"><input type="checkbox" id="forge-work-agents" /> Agent-made only</label>
|
|
253
256
|
<label class="hx-forge-toggle"><input type="checkbox" id="forge-work-finished" /> Include merged and closed</label>
|
|
@@ -261,25 +264,10 @@
|
|
|
261
264
|
</div>
|
|
262
265
|
<p id="forge-notice" class="hx-forge-notice" hidden data-corn="notice"></p>
|
|
263
266
|
<p id="forge-act-note" class="hx-forge-notice" hidden data-corn="notice"></p>
|
|
264
|
-
<!--
|
|
265
|
-
<section id="forge-idea" class="hx-forge-notes" aria-label="New idea" data-corn-string-aria-label="newIdea" hidden>
|
|
266
|
-
<div class="hx-forge-actions">
|
|
267
|
-
<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>
|
|
268
|
-
</div>
|
|
269
|
-
<p id="idea-message" class="hx-forge-msg" role="status" hidden data-corn="message"></p>
|
|
270
|
-
<div id="idea-form" class="hx-forge-confirm" role="group" aria-labelledby="idea-form-title" hidden>
|
|
271
|
-
<h3 id="idea-form-title" class="hx-forge-confirm-title" data-corn-string="newIdea">New idea</h3>
|
|
272
|
-
<p id="idea-words"></p>
|
|
273
|
-
<label class="hx-forge-field" data-corn="field">Title<input type="text" id="idea-title" class="hx-forge-input" maxlength="256" autocomplete="off" /></label>
|
|
274
|
-
<label class="hx-forge-field" data-corn="field">What is the idea?<textarea id="idea-body" class="hx-forge-preview hx-thread-compose" rows="6" maxlength="20000" spellcheck="true"></textarea></label>
|
|
275
|
-
<div class="hx-forge-actions">
|
|
276
|
-
<button type="button" id="idea-send" class="hx-btn hx-btn--approve" data-action="idea-send" data-corn-kind="approve">Open the idea</button>
|
|
277
|
-
<button type="button" class="hx-btn hx-btn--quiet" data-action="idea-cancel" data-corn-kind="quiet">Cancel</button>
|
|
278
|
-
</div>
|
|
279
|
-
</div>
|
|
280
|
-
</section>
|
|
281
|
-
<!-- Release notes (forge-panel.js): the pull requests merged since a tag, grouped by the map; copy them, or have the forge keep them as a draft release -->
|
|
267
|
+
<!-- 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 -->
|
|
282
268
|
<section id="forge-notes" class="hx-forge-notes" aria-label="Release notes" hidden>
|
|
269
|
+
<button 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>
|
|
270
|
+
<h3 id="notes-title" class="hx-forge-notes-title" tabindex="-1">Release notes</h3>
|
|
283
271
|
<label class="hx-forge-field" data-corn="field">Since tag<select id="notes-since" class="hx-forge-select"></select></label>
|
|
284
272
|
<label class="hx-forge-field" data-corn="field">Draft, in Markdown<textarea id="notes-preview" class="hx-forge-preview" rows="14" readonly spellcheck="false"></textarea></label>
|
|
285
273
|
<div class="hx-forge-actions">
|
|
@@ -297,7 +285,7 @@
|
|
|
297
285
|
</div>
|
|
298
286
|
</div>
|
|
299
287
|
</section>
|
|
300
|
-
<!-- Agent runs (forge-panel.js, runs-model.js): shown on the
|
|
288
|
+
<!-- Agent runs (forge-panel.js, runs-model.js): shown on the Runs tab; each run's state, what it is about, links, and Stop -->
|
|
301
289
|
<section id="forge-runs" class="hx-forge-runs" aria-labelledby="forge-runs-title" hidden>
|
|
302
290
|
<h3 id="forge-runs-title" class="hx-forge-runs-title">Agent runs</h3>
|
|
303
291
|
<p id="forge-runs-status" class="hx-forge-meta hx-faint"></p>
|
|
@@ -310,6 +298,27 @@
|
|
|
310
298
|
</section>
|
|
311
299
|
<section id="forge-detail" class="hx-forge-detail" aria-label="Selected pull request" hidden></section>
|
|
312
300
|
<ul id="forge-list" class="hx-forge-list" aria-label="Results"></ul>
|
|
301
|
+
<!-- The foot of the list: Release notes… on the PRs list, New idea on Specs (and Threads) -->
|
|
302
|
+
<div id="forge-foot" class="hx-forge-foot">
|
|
303
|
+
<button type="button" id="notes-open" class="hx-btn" data-action="open-notes" hidden>Release notes …</button>
|
|
304
|
+
<!-- New idea (forge-panel.js): opens an issue with the threads label as you, on the forge; the thread itself lives there -->
|
|
305
|
+
<section id="forge-idea" class="hx-forge-notes" aria-label="New idea" data-corn-string-aria-label="newIdea" hidden>
|
|
306
|
+
<div class="hx-forge-actions">
|
|
307
|
+
<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>
|
|
308
|
+
</div>
|
|
309
|
+
<p id="idea-message" class="hx-forge-msg" role="status" hidden data-corn="message"></p>
|
|
310
|
+
<div id="idea-form" class="hx-forge-confirm" role="group" aria-labelledby="idea-form-title" hidden>
|
|
311
|
+
<h3 id="idea-form-title" class="hx-forge-confirm-title" data-corn-string="newIdea">New idea</h3>
|
|
312
|
+
<p id="idea-words"></p>
|
|
313
|
+
<label class="hx-forge-field" data-corn="field">Title<input type="text" id="idea-title" class="hx-forge-input" maxlength="256" autocomplete="off" /></label>
|
|
314
|
+
<label class="hx-forge-field" data-corn="field">What is the idea?<textarea id="idea-body" class="hx-forge-preview hx-thread-compose" rows="6" maxlength="20000" spellcheck="true"></textarea></label>
|
|
315
|
+
<div class="hx-forge-actions">
|
|
316
|
+
<button type="button" id="idea-send" class="hx-btn hx-btn--approve" data-action="idea-send" data-corn-kind="approve">Open the idea</button>
|
|
317
|
+
<button type="button" class="hx-btn hx-btn--quiet" data-action="idea-cancel" data-corn-kind="quiet">Cancel</button>
|
|
318
|
+
</div>
|
|
319
|
+
</div>
|
|
320
|
+
</section>
|
|
321
|
+
</div>
|
|
313
322
|
<p id="forge-rate" class="hx-forge-rate hx-faint"></p>
|
|
314
323
|
</div>
|
|
315
324
|
</aside>
|
|
@@ -333,6 +342,7 @@
|
|
|
333
342
|
</div>
|
|
334
343
|
|
|
335
344
|
<div class="hx-drawer-foot">
|
|
345
|
+
<a id="drawer-file-btn" class="hx-open" href="#" target="_blank" rel="noreferrer" hidden>Open file ↗</a>
|
|
336
346
|
<a id="drawer-open-btn" class="hx-open" href="#" target="_blank" rel="noreferrer" hidden>Open route ↗</a>
|
|
337
347
|
<button type="button" id="drawer-run-btn" class="hx-btn hx-foot-btn" data-action="start-run" data-corn-string="startRun" hidden>Start a run</button>
|
|
338
348
|
<button type="button" class="hx-btn hx-btn--quiet hx-foot-btn" data-action="copy-spec" data-corn-string="copySpec">Copy Spec</button>
|
package/explorer/main.js
CHANGED
|
@@ -215,6 +215,7 @@ loadTopology().then(async (ok) => {
|
|
|
215
215
|
if (!ok) return;
|
|
216
216
|
// The sources the repo's cornfield.config.js names (plugins.js): a live layer, a house, devices, a checker; each optional
|
|
217
217
|
const config = await configReady;
|
|
218
|
+
state.forge = config.forge || null;
|
|
218
219
|
const { liveSource, floorRenderer, checker } = await loadSources(config);
|
|
219
220
|
const forgeOn = initForgePanel(config); // issues and PRs: only when the config names a forge (forge-panel.js)
|
|
220
221
|
initReviewTokens(config); // review tokens for the review API: only for somebody signed in (review-tokens.js)
|
package/explorer/panels.js
CHANGED
|
@@ -16,6 +16,7 @@ import { collapseSheet } from './sheets.js';
|
|
|
16
16
|
import { liveSection, hydrateLivePhotos } from './live.js';
|
|
17
17
|
import { cloudPanelHtml } from './cloud-model.js';
|
|
18
18
|
import { t } from './strings.js';
|
|
19
|
+
import { fileUrl } from './file-url.js';
|
|
19
20
|
import { capped, toggleCapped } from './capped.js';
|
|
20
21
|
import { canStartAgent, openProposalStart } from './forge-panel.js';
|
|
21
22
|
|
|
@@ -253,15 +254,18 @@ export async function selectNode(node) {
|
|
|
253
254
|
if (state.threadIndex) state.threadIndex.ensure();
|
|
254
255
|
hydrateLivePhotos($('drawer-live'));
|
|
255
256
|
|
|
256
|
-
// The actions: Open (
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
257
|
+
// The actions: Open file (the node's file on the forge) is the primary one; with an address too, Open route is the quiet one.
|
|
258
|
+
// The proposal's head branch is not known here (the proposals list does not carry it): the file is at the default branch.
|
|
259
|
+
const fileBtn = $('drawer-file-btn');
|
|
260
|
+
const file = node.file && state.forge ? fileUrl(state.forge, node.file, state.forge.baseBranch) : null;
|
|
261
|
+
fileBtn.hidden = !file;
|
|
262
|
+
if (file) fileBtn.href = file; else fileBtn.removeAttribute('href');
|
|
263
|
+
const route = !!(node.url && /^https?:\/\//.test(node.url));
|
|
264
|
+
if (route) openBtn.href = node.url; else openBtn.removeAttribute('href');
|
|
265
|
+
openBtn.hidden = !route;
|
|
266
|
+
openBtn.className = file ? 'hx-btn hx-btn--quiet hx-foot-btn' : 'hx-open';
|
|
267
|
+
openBtn.textContent = `${t('openRoute')} ↗`;
|
|
268
|
+
fileBtn.textContent = `${t('openFile')} ↗`;
|
|
265
269
|
const run = $('drawer-run-btn');
|
|
266
270
|
run.hidden = !(state.proposalSlug && canStartAgent());
|
|
267
271
|
|
|
@@ -192,6 +192,48 @@ export function proposalPanelHtml(item) {
|
|
|
192
192
|
</div>`;
|
|
193
193
|
}
|
|
194
194
|
|
|
195
|
+
// ---------------------------------------------------------------------------
|
|
196
|
+
// A proposal as a row of the Work panel's Specs tab
|
|
197
|
+
// ---------------------------------------------------------------------------
|
|
198
|
+
|
|
199
|
+
/** What a listing entry's state pill says: its spec PR's state, or "Local" for a proposal that is only in a checkout or a worktree */
|
|
200
|
+
export const specState = (entry) => (entry.pull ? (entry.pull.draft ? 'Draft' : 'Open') : 'Local');
|
|
201
|
+
|
|
202
|
+
/** Where a listing entry is, as a line of meta: "PR #11", or the checkout or worktree it is in */
|
|
203
|
+
export function specWhere(entry) {
|
|
204
|
+
if (entry.pull) return `PR #${entry.pull.number}`;
|
|
205
|
+
return entry.source === 'checkout' ? 'in the checkout' : `in worktree ${entry.source}`;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* One row: title, a state pill, a line of what it is for, and the meta (spec number, where it is, +added ~changed −removed, scenarios).
|
|
210
|
+
* A proposal that could not be read is a row that says why and opens nothing. Same `open-proposal` action as the Proposals menu's row.
|
|
211
|
+
* @param {{ slug: string, source: string, title?: string, summary?: string, spec?: string, pull?: {number: number, draft?: boolean}, counts?: {added?: number, changed?: number, removed?: number, scenarios?: number}, errors?: number, error?: string }} entry
|
|
212
|
+
* @param {{ current?: {slug: string, source: string} | null }} [opts] the proposal that is open now
|
|
213
|
+
*/
|
|
214
|
+
export function specRowHtml(entry, { current = null } = {}) {
|
|
215
|
+
const head = `<span class="hx-forge-title">${escHtml(entry.title || entry.slug)}</span>`;
|
|
216
|
+
if (entry.error) {
|
|
217
|
+
return `<li class="hx-forge-item"><div class="hx-forge-row hx-forge-spec" data-corn="row">${head}<span class="hx-forge-sum hx-error-text">${escHtml(entry.error)}</span><span class="hx-forge-meta">${escHtml(specWhere(entry))}</span></div></li>`;
|
|
218
|
+
}
|
|
219
|
+
const state = specState(entry);
|
|
220
|
+
const tone = state === 'Local' ? '' : ` data-corn-state="${state === 'Draft' ? 'draft' : 'open'}"`;
|
|
221
|
+
const c = entry.counts || {};
|
|
222
|
+
const meta = [
|
|
223
|
+
entry.spec ? `<span>spec ${escHtml(entry.spec)}</span>` : '',
|
|
224
|
+
`<span>${escHtml(specWhere(entry))}</span>`,
|
|
225
|
+
c.added ? `<span class="hx-forge-add" title="${c.added} added">+${c.added}</span>` : '',
|
|
226
|
+
c.changed ? `<span class="hx-forge-chg" title="${c.changed} changed">~${c.changed}</span>` : '',
|
|
227
|
+
c.removed ? `<span class="hx-forge-del" title="${c.removed} removed">\u2212${c.removed}</span>` : '',
|
|
228
|
+
c.scenarios ? `<span>${c.scenarios} ${c.scenarios === 1 ? 'scenario' : 'scenarios'}</span>` : '',
|
|
229
|
+
entry.errors ? `<span class="hx-warn">${entry.errors} ${entry.errors === 1 ? 'problem' : 'problems'}</span>` : '',
|
|
230
|
+
].filter(Boolean).join('');
|
|
231
|
+
const mine = !!current && current.slug === entry.slug && current.source === entry.source;
|
|
232
|
+
return `<li class="hx-forge-item"><button type="button" class="hx-forge-row hx-forge-spec" data-action="open-proposal" data-slug="${escHtml(entry.slug)}" data-source="${escHtml(entry.source)}" aria-pressed="${mine}" data-corn="row">`
|
|
233
|
+
+ `<span class="hx-forge-line">${head}<span class="hx-forge-state hx-forge-state--${state === 'Draft' ? 'draft' : state === 'Open' ? 'open' : 'neutral'}" data-corn="state-pill"${tone}>${state}</span></span>`
|
|
234
|
+
+ `${entry.summary ? `<span class="hx-forge-sum">${escHtml(entry.summary)}</span>` : ''}<span class="hx-forge-meta hx-forge-facts">${meta}</span></button></li>`;
|
|
235
|
+
}
|
|
236
|
+
|
|
195
237
|
// ---------------------------------------------------------------------------
|
|
196
238
|
// Where an added node sits
|
|
197
239
|
// ---------------------------------------------------------------------------
|
package/explorer/proposal.js
CHANGED
|
@@ -53,6 +53,17 @@ let listing = null;
|
|
|
53
53
|
let listingProblem = null;
|
|
54
54
|
/** Why the server left the open spec PRs out of the last listing (the forge could not be asked), or null */
|
|
55
55
|
let forgeProblem = null;
|
|
56
|
+
/** When the listing was last read (ms), and who wants to hear of a new one (the Work panel's Specs tab, forge-panel.js) */
|
|
57
|
+
let listingAt = 0;
|
|
58
|
+
const listingWatchers = new Set();
|
|
59
|
+
|
|
60
|
+
/** What the server listed last, for the Work panel's Specs tab: the entries (null before the first answer), why the list could not be read, why the spec PRs are missing, and when */
|
|
61
|
+
export const proposalListing = () => ({ entries: listing, problem: listingProblem, forgeProblem, at: listingAt });
|
|
62
|
+
/** Calls `fn` each time the list is read again; returns the way to stop */
|
|
63
|
+
export function onProposalListing(fn) {
|
|
64
|
+
listingWatchers.add(fn);
|
|
65
|
+
return () => listingWatchers.delete(fn);
|
|
66
|
+
}
|
|
56
67
|
|
|
57
68
|
// ---------------------------------------------------------------------------
|
|
58
69
|
// Loading and closing
|
|
@@ -63,7 +74,9 @@ export async function loadProposalList() {
|
|
|
63
74
|
try {
|
|
64
75
|
const res = await fetch('/proposals', { cache: 'no-store' });
|
|
65
76
|
if (!res.ok) throw new Error(`GET /proposals answered ${res.status}`);
|
|
66
|
-
|
|
77
|
+
const body = await res.json();
|
|
78
|
+
if (!Array.isArray(body)) throw new Error('GET /proposals did not answer with a list');
|
|
79
|
+
listing = body;
|
|
67
80
|
listingProblem = null;
|
|
68
81
|
const said = res.headers.get('X-Proposals-Forge-Error');
|
|
69
82
|
forgeProblem = said ? decodeURIComponent(said) : null;
|
|
@@ -72,7 +85,9 @@ export async function loadProposalList() {
|
|
|
72
85
|
forgeProblem = null;
|
|
73
86
|
listingProblem = err.message || String(err);
|
|
74
87
|
}
|
|
88
|
+
listingAt = Date.now();
|
|
75
89
|
renderMenu();
|
|
90
|
+
for (const fn of listingWatchers) fn();
|
|
76
91
|
return listing;
|
|
77
92
|
}
|
|
78
93
|
|
|
@@ -478,6 +493,7 @@ export function showEdgePanel(edge) {
|
|
|
478
493
|
<div class="hx-fact"><div class="hx-fact-k">To</div><div class="hx-fact-v"><button type="button" class="hx-linkbtn" data-action="select-node" data-id="${escHtml(edge.to)}">${escHtml(nameOf(edge.to))}</button></div></div>
|
|
479
494
|
</div>${proposalPanelHtml(edge)}`;
|
|
480
495
|
$('drawer-open-btn').hidden = true;
|
|
496
|
+
$('drawer-file-btn').hidden = true;
|
|
481
497
|
$('drawer-run-btn').hidden = true;
|
|
482
498
|
$('spec-drawer').classList.add('drawer-open');
|
|
483
499
|
$('drawer-backdrop').hidden = false;
|
package/explorer/runs-model.js
CHANGED
|
@@ -59,6 +59,21 @@ export function runOnThread(runs, number) {
|
|
|
59
59
|
return [...mine.filter((r) => r.open === true).sort(newest), ...mine.filter((r) => r.open !== true).sort(newest)][0];
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
+
/** The run that made a pull request (the one whose pull request it is), an open one before a finished one, then the newest; null when none did */
|
|
63
|
+
export function runOnPull(runs, number) {
|
|
64
|
+
if (!Array.isArray(runs)) return null;
|
|
65
|
+
const mine = runs.filter((r) => r.pull && r.pull.number === number);
|
|
66
|
+
const newest = (a, b) => Date.parse(b.requestedAt || 0) - Date.parse(a.requestedAt || 0);
|
|
67
|
+
return [...mine.filter((r) => r.open === true).sort(newest), ...mine.filter((r) => r.open !== true).sort(newest)][0] || null;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** A pull request's run in one line: who is running it, its state, how long ago it was asked for, and the cost the runner reported ("bucket-bot · Working · asked 12 min ago · cost 0.84") */
|
|
71
|
+
export function pullRunWords(run, nowMs) {
|
|
72
|
+
const who = (run.report && run.report.by) || (run.pull && run.pull.by) || run.requestedBy;
|
|
73
|
+
const when = relativeTime(run.requestedAt, nowMs);
|
|
74
|
+
return [who, statusWords(run), when && `asked ${when}`, run.report && run.report.cost != null && `cost ${run.report.cost}`].filter(Boolean).join(' · ');
|
|
75
|
+
}
|
|
76
|
+
|
|
62
77
|
/** What a thread's row says of its run, in a few words: "Run: Working" (more than one run on it: "Run: Working (+1)") */
|
|
63
78
|
export function threadRunWords(runs, number) {
|
|
64
79
|
const run = runOnThread(runs, number);
|
package/explorer/state.js
CHANGED
|
@@ -36,6 +36,8 @@ export const state = {
|
|
|
36
36
|
|
|
37
37
|
camera: { x: 0, y: 0, zoom: 1 },
|
|
38
38
|
selectedNode: null,
|
|
39
|
+
/** The config's `forge` (`{ type, url, repo, baseBranch? }`), or null: where a node's file is opened (file-url.js) */
|
|
40
|
+
forge: null,
|
|
39
41
|
searchQuery: '',
|
|
40
42
|
|
|
41
43
|
isFreeform: false,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cornfield",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.33.0",
|
|
4
4
|
"description": "A self-hostable dev dashboard with the topology map at its centre: proposals on the map, scenarios, outages and what-if edits, for any repo.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "popcorn245 (https://github.com/popcorn245)",
|
package/server/server.js
CHANGED
|
@@ -269,7 +269,7 @@ export function clientConfig(config, signIn = false) {
|
|
|
269
269
|
brand: clientBrand(config.brand, PKG.homepage),
|
|
270
270
|
// Only the labels the config overrides, as text (core/strings.js); the defaults are in the browser
|
|
271
271
|
strings: clientStrings(config.strings),
|
|
272
|
-
forge: config.forge ? { type: config.forge.type, url: config.forge.url || (config.forge.type === 'github' ? 'https://github.com' : null), repo: config.forge.repo, mergeMethod: config.forge.mergeMethod || 'merge', ...(config.approveLands ? { approveLands: true } : {}) } : null,
|
|
272
|
+
forge: config.forge ? { type: config.forge.type, url: config.forge.url || (config.forge.type === 'github' ? 'https://github.com' : null), repo: config.forge.repo, mergeMethod: config.forge.mergeMethod || 'merge', ...(config.forge.baseBranch ? { baseBranch: config.forge.baseBranch } : {}), ...(config.approveLands ? { approveLands: true } : {}) } : null,
|
|
273
273
|
// Threads (docs/threads.md): the idea label, or false when `threads: false` turns the Threads tab off
|
|
274
274
|
threads: config.threads === false ? false : { label: ideaLabel(config) },
|
|
275
275
|
sources: browserSources(config),
|