@giamme/forge 0.15.0 → 0.17.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/CHANGELOG.md +48 -0
- package/VERSION +1 -1
- package/docs/artifacts.md +1 -1
- package/docs/commands.md +14 -3
- package/docs/dataset.md +8 -0
- package/docs/forge-ui.md +14 -0
- package/docs/memory.md +22 -0
- package/docs/reviews.md +22 -1
- package/forge +11 -0
- package/package.json +1 -1
- package/references/dataset.md +129 -7
- package/references/decision-models.md +15 -2
- package/references/decompose.md +95 -13
- package/references/harnesses.md +4 -1
- package/references/planning.md +3 -2
- package/references/solo.md +5 -1
- package/references/ui.md +10 -1
- package/scripts/forge-artifact.sh +53 -0
- package/scripts/forge-contract.py +107 -9
- package/scripts/forge-control.py +0 -2
- package/scripts/forge-dispatch.sh +28 -12
- package/scripts/forge-fail-first.py +3 -1
- package/scripts/forge-guard.py +247 -8
- package/scripts/forge-issues.py +16 -3
- package/scripts/forge-ledger.py +3 -1
- package/scripts/forge-lib-adopt.sh +266 -0
- package/scripts/forge-lib-attribute.sh +10 -2
- package/scripts/forge-lib-plans.sh +16 -4
- package/scripts/forge-lib-review.sh +8 -2
- package/scripts/forge-lib-task.sh +19 -5
- package/scripts/forge-memory.sh +41 -4
- package/scripts/forge-metrics.sh +29 -0
- package/scripts/forge-parallel.sh +99 -14
- package/scripts/forge-plan-check.py +25 -2
- package/scripts/forge-planner.py +20 -6
- package/scripts/forge-route.py +16 -2
- package/scripts/forge-runs-rm.py +23 -7
- package/scripts/forge-runtime.py +25 -2
- package/scripts/forge-schedule.py +5 -2
- package/scripts/forge-shadow.py +30 -9
- package/scripts/forge-solo.sh +6 -0
- package/scripts/forge-sweep.py +25 -10
- package/scripts/forge_dataset/cli.py +99 -0
- package/scripts/forge_dataset/export.py +1 -0
- package/scripts/forge_dataset/facts.py +278 -0
- package/scripts/forge_dataset/harvest.py +27 -3
- package/scripts/forge_dataset/history.py +126 -0
- package/scripts/forge_dataset/outcomes.py +206 -58
- package/scripts/forge_dataset/pairs.py +174 -0
- package/scripts/forge_dataset/risk.py +108 -0
- package/scripts/forge_dataset/tiers.py +427 -0
- package/scripts/forge_dataset/worktrees.py +95 -0
- package/scripts/forge_decide/cli.py +23 -2
- package/scripts/forge_decide/labels.py +30 -6
- package/scripts/forge_decide/replay.py +10 -4
- package/scripts/forge_memory_list.py +153 -0
- package/scripts/forge_worktrees.py +88 -0
- package/ui/README.md +31 -0
- package/ui/docs/api.md +92 -6
- package/ui/forge_ui/__init__.py +14 -1
- package/ui/forge_ui/__main__.py +1 -1
- package/ui/forge_ui/control.py +77 -0
- package/ui/forge_ui/export.py +9 -2
- package/ui/forge_ui/findings.py +11 -2
- package/ui/forge_ui/projects.py +571 -0
- package/ui/forge_ui/reader.py +96 -9
- package/ui/forge_ui/server.py +8 -0
- package/ui/forge_ui/static/app.js +105 -22
- package/ui/forge_ui/static/cloudui.js +6 -2
- package/ui/forge_ui/static/convo.js +1 -1
- package/ui/forge_ui/static/diffview.js +9 -5
- package/ui/forge_ui/static/files.js +1 -1
- package/ui/forge_ui/static/index.html +5 -1
- package/ui/forge_ui/static/panel.js +69 -2
- package/ui/forge_ui/static/projectsview.js +372 -0
- package/ui/forge_ui/static/settings.js +136 -4
- package/ui/forge_ui/static/style.css +94 -3
- package/ui/forge_ui/static/uikit.js +94 -1
- package/ui/forge_ui/static/worktreesview.js +250 -0
- package/ui/forge_ui/worktrees.py +570 -0
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
/* forge-ui Worktrees screen (#125): every worktree forge created, in any repository, with its state and the command
|
|
2
|
+
that removes it safely (window.ForgeWorktrees, and a CommonJS module under node:test). Route #/worktrees, optionally
|
|
3
|
+
narrowed to one repository (#/worktrees/repo/<root>) or one run (#/worktrees/runs/<key>).
|
|
4
|
+
The commands come from the server, are only ever copied, and never include --force: the page runs nothing, so it
|
|
5
|
+
works with --read-only too. Paths, branches and commit subjects enter the page as text.
|
|
6
|
+
The pure helpers (filters, totals, sizes) are tested in ui/tests/js/worktreesview.test.js.
|
|
7
|
+
ctx = { filter?: {repo, run}, runHref(key), tablePrefs?(id), saveTablePrefs?(id, prefs) }. */
|
|
8
|
+
(function (root, factory) {
|
|
9
|
+
'use strict';
|
|
10
|
+
const api = factory(root);
|
|
11
|
+
if (typeof module === 'object' && module.exports) module.exports = api;
|
|
12
|
+
else root.ForgeWorktrees = api;
|
|
13
|
+
})(typeof self !== 'undefined' ? self : this, function (root) {
|
|
14
|
+
'use strict';
|
|
15
|
+
|
|
16
|
+
const list = v => Array.isArray(v) ? v : [];
|
|
17
|
+
const POLL_MS = 60000, SIZE_POLL_MS = 3000;
|
|
18
|
+
const STATUSES = ['in_use', 'dirty', 'locked', 'needed', 'failed', 'finished', 'missing', 'foreign', 'unknown', 'removed'];
|
|
19
|
+
const LABEL = { in_use: 'in use', dirty: 'uncommitted changes', locked: 'locked', needed: 'needed by the run', failed: 'failed task',
|
|
20
|
+
finished: 'finished', missing: 'missing on disk', foreign: "not forge's", unknown: 'unknown to git', removed: 'removed' };
|
|
21
|
+
const LAMP = { in_use: 'st-running', dirty: 'fnd-amber', locked: 'fnd-amber', needed: 'st-pending', failed: 'st-fail', finished: 'st-merged',
|
|
22
|
+
missing: 'st-unknown', foreign: 'lamp-off', unknown: 'st-unknown', removed: 'lamp-off' };
|
|
23
|
+
const KINDS = ['task', 'integration', 'candidate', 'attribute'];
|
|
24
|
+
|
|
25
|
+
/* ---------- pure ---------- */
|
|
26
|
+
// filter = { repo: '' | root, run: '' | key, status: 'all' | 'disk' (everything not removed) | one of STATUSES, kind: 'all' | KINDS | 'none' }
|
|
27
|
+
function filterRows(rows, filter) {
|
|
28
|
+
const f = filter || {}, status = f.status || 'all', kind = f.kind || 'all';
|
|
29
|
+
return list(rows).filter(r => (!f.repo || r.repo === f.repo) && (!f.run || r.run === f.run)
|
|
30
|
+
&& (status === 'all' || (status === 'disk' ? r.status !== 'removed' : r.status === status))
|
|
31
|
+
&& (kind === 'all' || (kind === 'none' ? !r.kind : r.kind === kind)));
|
|
32
|
+
}
|
|
33
|
+
// {count, onDisk, bytes, pending} of the rows shown: bytes counts only the sizes known so far
|
|
34
|
+
function totals(rows) {
|
|
35
|
+
let onDisk = 0, bytes = 0, pending = 0;
|
|
36
|
+
for (const r of list(rows)) {
|
|
37
|
+
if (r.status === 'removed' || r.status === 'missing') continue;
|
|
38
|
+
onDisk += 1;
|
|
39
|
+
if (Number.isFinite(r.size)) bytes += r.size; else pending += 1;
|
|
40
|
+
}
|
|
41
|
+
return { count: list(rows).length, onDisk, bytes, pending };
|
|
42
|
+
}
|
|
43
|
+
function humanBytes(n) {
|
|
44
|
+
if (!Number.isFinite(n) || n < 0) return '—';
|
|
45
|
+
const units = ['B', 'KB', 'MB', 'GB', 'TB'];
|
|
46
|
+
let i = 0, v = n;
|
|
47
|
+
while (v >= 1024 && i < units.length - 1) { v /= 1024; i += 1; }
|
|
48
|
+
return (i === 0 ? String(v) : v.toFixed(v < 10 ? 1 : 0)) + ' ' + units[i];
|
|
49
|
+
}
|
|
50
|
+
// the part of a worktree path from `.forge-worktrees` on: the folder above it is the repository's, shown beside it
|
|
51
|
+
const shortPath = p => { const s = String(p || ''), i = s.lastIndexOf('/.forge-worktrees/'); return i >= 0 ? s.slice(i + 1) : s || '—'; };
|
|
52
|
+
const repoName = p => typeof p === 'string' && p ? p.replace(/\/+$/, '').split('/').pop() : '—';
|
|
53
|
+
const label = status => LABEL[status] || status || '—';
|
|
54
|
+
|
|
55
|
+
/* ---------- DOM ---------- */
|
|
56
|
+
function render(host, ctx) {
|
|
57
|
+
const UI = root.ForgeUI;
|
|
58
|
+
const el = (tag, text, cls) => UI.el(tag, text, cls);
|
|
59
|
+
const start = ctx.filter || {};
|
|
60
|
+
const s = { data: null, error: null, filter: { repo: start.repo || '', run: start.run || '', status: 'all', kind: 'all' }, timer: null, seq: 0, loading: false };
|
|
61
|
+
|
|
62
|
+
const head = el('div', undefined, 'wt-head');
|
|
63
|
+
const refreshKey = el('button', 'Read again'); refreshKey.type = 'button';
|
|
64
|
+
refreshKey.title = 'Run git status and the other reads again now, instead of waiting for the next read';
|
|
65
|
+
refreshKey.addEventListener('click', () => load(true));
|
|
66
|
+
const stamp = el('span', '', 'muted wt-stamp');
|
|
67
|
+
head.append(el('h1', 'Worktrees', 'module-title'), refreshKey, stamp);
|
|
68
|
+
const lede = el('p', 'Every worktree forge created, in any repository it knows, with what state it is in and the command that removes it safely. Commands are only copied: this page runs nothing.', 'muted wt-lede');
|
|
69
|
+
const notes = el('div', undefined, 'wt-notes muted');
|
|
70
|
+
const sums = el('p', undefined, 'wt-totals'); sums.setAttribute('role', 'status');
|
|
71
|
+
const filters = el('div', undefined, 'wt-filters');
|
|
72
|
+
const fields = {};
|
|
73
|
+
const field = (name, text) => {
|
|
74
|
+
const l = el('label', undefined, 'fnd-field'), sel = el('select');
|
|
75
|
+
sel.dataset.filter = name;
|
|
76
|
+
sel.addEventListener('change', () => { s.filter[name] = sel.value; draw(); });
|
|
77
|
+
l.append(el('span', text, 'plate'), sel);
|
|
78
|
+
fields[name] = sel; filters.append(l);
|
|
79
|
+
};
|
|
80
|
+
field('repo', 'Repository'); field('status', 'Status'); field('kind', 'Kind');
|
|
81
|
+
const runNote = el('p', undefined, 'wt-run-note'); runNote.hidden = true;
|
|
82
|
+
const tableHost = el('div', undefined, 'wt-table');
|
|
83
|
+
const groups = el('section', undefined, 'wt-runs');
|
|
84
|
+
host.replaceChildren(head, lede, notes, sums, filters, runNote, tableHost, groups);
|
|
85
|
+
|
|
86
|
+
function options(sel, items, value) {
|
|
87
|
+
const want = items.map(([v, t]) => v + '\u0000' + t).join('\u0001');
|
|
88
|
+
if (sel.dataset.items !== want) {
|
|
89
|
+
sel.replaceChildren(...items.map(([v, t]) => { const o = el('option', t); o.value = v; return o; }));
|
|
90
|
+
sel.dataset.items = want;
|
|
91
|
+
}
|
|
92
|
+
sel.value = items.some(([v]) => v === value) ? value : items[0][0];
|
|
93
|
+
}
|
|
94
|
+
function syncFilters() {
|
|
95
|
+
const rows = list(s.data && s.data.rows);
|
|
96
|
+
const repos = Array.from(new Set(rows.map(r => r.repo).filter(Boolean).concat(s.filter.repo ? [s.filter.repo] : []))).sort();
|
|
97
|
+
options(fields.repo, [['', 'all']].concat(repos.map(r => [r, repoName(r)])), s.filter.repo);
|
|
98
|
+
const counts = (s.data && s.data.totals && s.data.totals.by_status) || {};
|
|
99
|
+
options(fields.status, [['all', 'all'], ['disk', 'on disk']].concat(STATUSES.map(x => [x, `${label(x)} (${counts[x] || 0})`])), s.filter.status);
|
|
100
|
+
options(fields.kind, [['all', 'all']].concat(KINDS.map(k => [k, k]), [['none', 'none']]), s.filter.kind);
|
|
101
|
+
if (s.filter.run) {
|
|
102
|
+
const group = list(s.data && s.data.runs).find(g => g.key === s.filter.run);
|
|
103
|
+
runNote.replaceChildren(el('span', 'Only the worktrees of run '), el('strong', group ? group.run_id : s.filter.run, 'mono'), el('span', '. '));
|
|
104
|
+
const all = el('a', 'Show every run'); all.href = '#/worktrees';
|
|
105
|
+
runNote.append(all);
|
|
106
|
+
runNote.hidden = false;
|
|
107
|
+
} else runNote.hidden = true;
|
|
108
|
+
}
|
|
109
|
+
function copyButton(command) {
|
|
110
|
+
const b = el('button', 'Copy', 'wt-copy'); b.type = 'button';
|
|
111
|
+
b.setAttribute('aria-label', 'Copy: ' + command);
|
|
112
|
+
b.addEventListener('click', async () => {
|
|
113
|
+
try { await navigator.clipboard.writeText(command); b.textContent = 'Copied'; }
|
|
114
|
+
catch (_) { b.textContent = 'Copy failed: select it'; }
|
|
115
|
+
setTimeout(() => { b.textContent = 'Copy'; }, 2500);
|
|
116
|
+
});
|
|
117
|
+
return b;
|
|
118
|
+
}
|
|
119
|
+
function commandBox(c) {
|
|
120
|
+
const box = el('div', undefined, 'wt-cmd');
|
|
121
|
+
const code = el('code', c.command, 'mono'); code.tabIndex = 0; code.title = c.label;
|
|
122
|
+
box.append(code, copyButton(c.command));
|
|
123
|
+
return box;
|
|
124
|
+
}
|
|
125
|
+
const when = t => Number.isFinite(t) ? new Date(t * 1000).toLocaleString() : '—';
|
|
126
|
+
const statusCell = r => {
|
|
127
|
+
const box = el('span', undefined, 'fnd-status wt-status wt-' + r.status);
|
|
128
|
+
box.append(el('i', undefined, 'lamp ' + (LAMP[r.status] || 'lamp-off')), el('span', label(r.status)));
|
|
129
|
+
if (r.derived) box.append(el('span', 'derived', 'chip wt-derived'));
|
|
130
|
+
if (r.note) box.title = r.note;
|
|
131
|
+
return box;
|
|
132
|
+
};
|
|
133
|
+
const commandCell = r => {
|
|
134
|
+
const box = el('div', undefined, 'wt-cmds');
|
|
135
|
+
for (const c of list(r.commands)) box.append(commandBox(c));
|
|
136
|
+
if (r.note) box.append(el('p', r.note, 'muted wt-note'));
|
|
137
|
+
return box;
|
|
138
|
+
};
|
|
139
|
+
const runCell = r => {
|
|
140
|
+
if (!r.run_id) return '—';
|
|
141
|
+
if (!r.run) return el('span', r.run_id, 'mono');
|
|
142
|
+
const a = el('a', r.run_id, 'mono'); a.href = ctx.runHref ? ctx.runHref(r.run) : '#/runs/' + encodeURIComponent(r.run);
|
|
143
|
+
return a;
|
|
144
|
+
};
|
|
145
|
+
const commitCell = r => {
|
|
146
|
+
if (!r.commit) return r.head ? el('span', String(r.head).slice(0, 12), 'mono') : '—';
|
|
147
|
+
const box = el('span', undefined, 'wt-commit');
|
|
148
|
+
box.title = `${r.commit.sha}\n${when(r.commit.time)}`;
|
|
149
|
+
box.append(el('span', String(r.commit.sha).slice(0, 7), 'mono'), el('span', ' ' + r.commit.subject));
|
|
150
|
+
return box;
|
|
151
|
+
};
|
|
152
|
+
const pathCell = r => { const n = el('span', shortPath(r.path), 'mono'); n.title = r.path; return n; };
|
|
153
|
+
const columns = [
|
|
154
|
+
{ id: 'status', label: 'Status', value: r => STATUSES.indexOf(r.status), cell: statusCell },
|
|
155
|
+
{ id: 'run', label: 'Run', value: r => r.run_id, cell: runCell },
|
|
156
|
+
{ id: 'task', label: 'Task', value: r => r.task, mono: true, cell: r => r.task || (r.kind && r.kind !== 'task' ? r.kind : '—') },
|
|
157
|
+
{ id: 'command', label: 'Command', sortable: false, cls: 'wt-command-col', cell: commandCell },
|
|
158
|
+
{ id: 'repo', label: 'Repository', value: r => repoName(r.repo), cell: r => { const n = el('span', repoName(r.repo)); if (r.repo) n.title = r.repo; return n; } },
|
|
159
|
+
{ id: 'branch', label: 'Branch', value: r => r.branch, mono: true, cell: r => r.branch || 'detached' },
|
|
160
|
+
{ id: 'merged', label: 'Merged', title: 'whether the branch is merged into the repository\'s checked-out branch', value: r => r.merged === null || r.merged === undefined ? null : r.merged ? 1 : 0,
|
|
161
|
+
cell: r => r.merged === true ? 'yes' : r.merged === false ? 'no' : '—' },
|
|
162
|
+
{ id: 'commit', label: 'Last commit', value: r => r.commit ? r.commit.time : null, cell: commitCell },
|
|
163
|
+
{ id: 'size', label: 'Size', value: r => r.size, cell: r => r.status === 'removed' || r.status === 'missing' ? '—' : Number.isFinite(r.size) ? humanBytes(r.size) : 'measuring…' },
|
|
164
|
+
{ id: 'removed', label: 'Removed', value: r => r.removed, cell: r => r.status !== 'removed' ? '—' : Number.isFinite(r.removed) ? when(r.removed) : 'date unknown' },
|
|
165
|
+
{ id: 'created', label: 'Created', value: r => r.created, cell: r => when(r.created), hidden: true },
|
|
166
|
+
{ id: 'path', label: 'Path', value: r => r.path, cell: pathCell, hidden: true },
|
|
167
|
+
{ id: 'kind', label: 'Kind', value: r => r.kind, cell: r => r.kind || '—', hidden: true },
|
|
168
|
+
];
|
|
169
|
+
function drawNotes() {
|
|
170
|
+
const d = s.data, out = [];
|
|
171
|
+
if (s.error) out.push(el('p', `Could not read the worktrees (${s.error}).`, 'warn'));
|
|
172
|
+
if (d) {
|
|
173
|
+
for (const n of list(d.notes)) out.push(el('p', String(n)));
|
|
174
|
+
if (d.dataset && d.dataset.enabled) {
|
|
175
|
+
out.push(el('p', Number.isFinite(d.dataset.since)
|
|
176
|
+
? `forge has recorded every worktree it adds or removes since ${when(d.dataset.since)}; removed ones from before then are derived from run dirs and the dataset, without dates.`
|
|
177
|
+
: 'forge records the worktrees it adds and removes from this release on; removed ones until then are derived from run dirs and the dataset, without dates.'));
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
notes.replaceChildren(...out);
|
|
181
|
+
}
|
|
182
|
+
function drawTotals(rows) {
|
|
183
|
+
const t = totals(rows);
|
|
184
|
+
sums.replaceChildren(el('strong', `${t.onDisk} on disk`), el('span', ` · ${humanBytes(t.bytes)}${t.pending ? ` so far, ${t.pending} still being measured` : ''} · ${t.count - t.onDisk} removed or missing · ${t.count} listed`));
|
|
185
|
+
}
|
|
186
|
+
function drawGroups() {
|
|
187
|
+
const items = list(s.data && s.data.runs).filter(g => g.command && (!s.filter.run || g.key === s.filter.run) && (!s.filter.repo || g.repo === s.filter.repo));
|
|
188
|
+
if (!items.length) { groups.replaceChildren(); return; }
|
|
189
|
+
const d = el('details', undefined, 'wt-groups'); d.dataset.keep = 'wt-groups';
|
|
190
|
+
d.append(el('summary', `Whole runs (${items.length})`));
|
|
191
|
+
d.append(el('p', 'forge runs rm removes a run\'s clean worktrees and its branches, and deletes the run directory as well, after archiving it into the dataset. This is a dry run: it changes nothing and says what a real one would do.', 'muted'));
|
|
192
|
+
for (const g of items) {
|
|
193
|
+
const row = el('div', undefined, 'wt-group');
|
|
194
|
+
const a = el('a', g.run_id, 'mono'); a.href = ctx.runHref ? ctx.runHref(g.key) : '#/runs/' + encodeURIComponent(g.key);
|
|
195
|
+
row.append(a, commandBox({ label: 'dry run of deleting the run directory and its worktrees', command: g.command }));
|
|
196
|
+
d.append(row);
|
|
197
|
+
}
|
|
198
|
+
groups.replaceChildren(d);
|
|
199
|
+
}
|
|
200
|
+
function drawNow() {
|
|
201
|
+
syncFilters(); drawNotes();
|
|
202
|
+
const d = s.data;
|
|
203
|
+
if (!d) { tableHost.replaceChildren(el('p', s.error ? '' : 'Reading every repository\'s worktrees… the first read runs git status in each, so it can take a few seconds.', 'muted')); sums.replaceChildren(); return; }
|
|
204
|
+
const rows = filterRows(d.rows, s.filter);
|
|
205
|
+
drawTotals(rows);
|
|
206
|
+
UI.keepOpen(groups, drawGroups);
|
|
207
|
+
if (!rows.length) { tableHost.replaceChildren(el('p', list(d.rows).length ? `No worktrees match these filters (${list(d.rows).length} hidden).` : 'forge has no worktrees on record.', 'muted')); return; }
|
|
208
|
+
const id = 'worktrees';
|
|
209
|
+
tableHost.replaceChildren();
|
|
210
|
+
root.ForgeTable.render(tableHost, { id, label: 'Worktrees', columns, rows, className: 'wt-grid', rowClass: r => 'wt-row-' + r.status,
|
|
211
|
+
// a cell cut short by its width says the whole of itself on hover
|
|
212
|
+
onRow: (_row, tr) => { for (const td of tr.children) if (!td.classList.contains('wt-command-col') && !td.title) td.title = td.textContent; },
|
|
213
|
+
prefs: ctx.tablePrefs ? ctx.tablePrefs(id) : null, savePrefs: p => ctx.saveTablePrefs && ctx.saveTablePrefs(id, p) });
|
|
214
|
+
}
|
|
215
|
+
// A redraw never pulls a command out from under someone selecting or copying it (#115).
|
|
216
|
+
const draw = () => { if (UI.guard) UI.guard(host, drawNow); else drawNow(); };
|
|
217
|
+
|
|
218
|
+
async function load(refresh) {
|
|
219
|
+
if (s.loading && !refresh) return;
|
|
220
|
+
const mine = ++s.seq;
|
|
221
|
+
s.loading = true; refreshKey.disabled = true;
|
|
222
|
+
if (refresh) stamp.textContent = 'reading…';
|
|
223
|
+
const res = await UI.get('/api/worktrees' + (refresh ? '?refresh=1' : ''));
|
|
224
|
+
if (mine !== s.seq) return;
|
|
225
|
+
s.loading = false; refreshKey.disabled = false;
|
|
226
|
+
if (res.ok) { s.data = res.data; s.error = null; stamp.textContent = 'read ' + when(res.data.computed); }
|
|
227
|
+
else { s.error = res.detail || res.error || 'no answer'; stamp.textContent = ''; }
|
|
228
|
+
draw();
|
|
229
|
+
schedule();
|
|
230
|
+
}
|
|
231
|
+
function schedule() {
|
|
232
|
+
clearTimeout(s.timer);
|
|
233
|
+
if (!host.isConnected) return; // the screen was left: no more reads
|
|
234
|
+
const pending = s.data && s.data.sizes_pending > 0;
|
|
235
|
+
s.timer = setTimeout(() => { if (host.isConnected && document.visibilityState === 'visible') load(false); else schedule(); }, pending ? SIZE_POLL_MS : POLL_MS);
|
|
236
|
+
}
|
|
237
|
+
drawNow();
|
|
238
|
+
load(false);
|
|
239
|
+
return {
|
|
240
|
+
setFilter(f) {
|
|
241
|
+
const repo = (f && f.repo) || '', run = (f && f.run) || '';
|
|
242
|
+
if (repo === s.filter.repo && run === s.filter.run) return; // the page's own refresh: nothing changed here
|
|
243
|
+
s.filter.repo = repo; s.filter.run = run; draw();
|
|
244
|
+
},
|
|
245
|
+
reload: () => load(true),
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
return { render, filterRows, totals, humanBytes, repoName, shortPath, label, STATUSES, LABEL };
|
|
250
|
+
});
|