@d86e/hive-panel 1.0.22 → 1.0.24
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/SPEC.md +7 -1
- package/package.json +1 -1
- package/public/panel.css +38 -0
- package/public/panel.js +984 -81
- package/src/cache.js +269 -0
- package/src/data.js +73 -0
- package/src/event-store.js +68 -0
- package/src/server.js +77 -6
package/public/panel.js
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
const LANE_ORDER = Object.freeze(["pending", "claimed", "done", "failed"]);
|
|
9
9
|
const MAX_EVENTS = 80;
|
|
10
10
|
const DEFAULT_SNAPSHOT_URL = "/api/snapshot";
|
|
11
|
+
const DEFAULT_STATUS_URL = "/api/status";
|
|
11
12
|
const DEFAULT_ACTIONS_URL = "/api/actions";
|
|
12
13
|
const DEFAULT_SUPERVISOR_URL = "/api/hive-runner";
|
|
13
14
|
const DEFAULT_TASKS_URL = "/api/tasks";
|
|
@@ -2154,6 +2155,38 @@ dialog.hive-dialog .hive-dialog-body { flex: 1 1 auto; min-height: 0; overflow:
|
|
|
2154
2155
|
.hive-event.is-expanded .hive-event-sentence { flex-basis: 100%; white-space: normal; }
|
|
2155
2156
|
.hive-event.is-expanded .hive-event-raw { flex-basis: 100%; }
|
|
2156
2157
|
.hive-limits-source { color: var(--hive-fg-faint); font-size: 11px; line-height: 1.4; overflow-wrap: anywhere; }
|
|
2158
|
+
/* First-paint list skeletons: real chrome, grey rows only inside lists. */
|
|
2159
|
+
.hive-lane-initial { display: flex; flex-direction: column; gap: 6px; padding: 0; }
|
|
2160
|
+
.hive-lane-initial.is-hidden { display: none; }
|
|
2161
|
+
.hive-lane-initial-row { height: 26px; border-radius: var(--hive-radius-sm); background: var(--hive-line-2); opacity: 0.65; }
|
|
2162
|
+
.hive-events-initial { display: flex; flex-direction: column; gap: 6px; padding: 4px 0; }
|
|
2163
|
+
.hive-events-initial-row { height: 28px; border-radius: var(--hive-radius-sm); background: var(--hive-line-2); opacity: 0.65; }
|
|
2164
|
+
.hive-events-retry { margin: 6px 0 0; }
|
|
2165
|
+
.hive-lane-head .hive-count { min-width: 0; margin-left: 4px; padding: 0; border-radius: 0; background: none; color: var(--hive-fg-faint); font-family: var(--hive-font, inherit); font-size: 10px; font-weight: 500; line-height: 1.4; }
|
|
2166
|
+
.hive-card-check { flex: 0 0 auto; width: 14px; height: 14px; margin: 0 2px 0 0; accent-color: var(--hive-accent); }
|
|
2167
|
+
.hive-lane { position: relative; }
|
|
2168
|
+
.hive-menu { position: absolute; z-index: 30; top: 34px; right: 8px; display: flex; flex-direction: column; min-width: 150px; padding: 4px; border: 1px solid var(--hive-line-2); border-radius: var(--hive-radius-md); background: var(--hive-bg-layer-2); box-shadow: var(--dsw-elevation-panel, 0 8px 22px rgba(0, 0, 0, 0.18)); }
|
|
2169
|
+
.hive-menu.is-hidden { display: none; }
|
|
2170
|
+
.hive-menu-item { padding: 6px 9px; border: 0; border-radius: var(--hive-radius-sm); background: transparent; color: var(--hive-fg-soft); font: inherit; font-size: 11px; text-align: left; cursor: pointer; }
|
|
2171
|
+
.hive-menu-item:hover { background: var(--hive-hover); color: var(--hive-fg); }
|
|
2172
|
+
.hive-menu-item.is-danger { color: var(--hive-danger); }
|
|
2173
|
+
.hive-lane-menu-button { padding: 0 5px; font-size: 14px; line-height: 1.2; }
|
|
2174
|
+
.hive-events-head { position: relative; }
|
|
2175
|
+
.hive-event-check { flex: 0 0 auto; width: 13px; height: 13px; margin: 0 2px 0 0; accent-color: var(--hive-accent); }
|
|
2176
|
+
.hive-event.is-selected { background: var(--hive-selected); }
|
|
2177
|
+
.hive-events-menu { right: 8px; top: 30px; }
|
|
2178
|
+
.hive-events-menu-button { padding: 0 5px; font-size: 14px; line-height: 1.2; }
|
|
2179
|
+
.hive-event-prune { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px 10px; border-bottom: 1px solid var(--hive-line-2); background: var(--hive-bg-layer-1); }
|
|
2180
|
+
.hive-event-prune.is-hidden { display: none; }
|
|
2181
|
+
.hive-event-prune-label { display: inline-flex; align-items: center; gap: 5px; color: var(--hive-fg-soft); font-size: 10px; }
|
|
2182
|
+
.hive-event-prune-input { width: auto; min-width: 160px; padding: 2px 5px; font-size: 10px; }
|
|
2183
|
+
.hive-event-prune-count { color: var(--hive-fg-faint); font-size: 10px; }
|
|
2184
|
+
.hive-event-prune-confirm { padding: 2px 7px; font-size: 10px; }
|
|
2185
|
+
.hive-card-check, .hive-event-check { position: relative; z-index: 2; pointer-events: auto; cursor: pointer; }
|
|
2186
|
+
.hive-menu-selection { padding: 4px 9px 5px; border-bottom: 1px solid var(--hive-line-2); color: var(--hive-fg-faint); font-size: 10px; letter-spacing: 0; }
|
|
2187
|
+
.hive-events-page-error { display: flex; align-items: center; gap: 6px; padding: 6px 2px; color: var(--hive-danger); font-size: 10px; }
|
|
2188
|
+
.hive-events-page-error-reason { color: var(--hive-fg-faint); }
|
|
2189
|
+
.hive-events-page-retry { padding: 1px 6px; font-size: 10px; }
|
|
2157
2190
|
`;
|
|
2158
2191
|
|
|
2159
2192
|
const LANE_LABEL_KEYS = Object.freeze({
|
|
@@ -2185,11 +2218,29 @@ export const messages = Object.freeze({
|
|
|
2185
2218
|
"pane.board": "Task board",
|
|
2186
2219
|
"pane.events": "events",
|
|
2187
2220
|
"board.filtersAria": "Filter by state",
|
|
2221
|
+
"board.more": "More actions",
|
|
2222
|
+
"board.selectTask": "Select task",
|
|
2223
|
+
"board.selectAll": "Select all",
|
|
2224
|
+
"board.clearSelection": "Clear selection",
|
|
2225
|
+
"board.deleteSelected": "Delete selected",
|
|
2226
|
+
"board.deleteConfirm": "Delete {count} selected tasks? This cannot be undone.",
|
|
2227
|
+
"board.claimedNoDelete": "In-progress tasks cannot be deleted; abort or wait for them to finish.",
|
|
2228
|
+
"batch.skippedClaimed": "{count} in-progress tasks skipped",
|
|
2229
|
+
"events.selectAll": "Select all",
|
|
2230
|
+
"events.clearSelection": "Clear selection",
|
|
2231
|
+
"events.selectionCount": "Selected {count}",
|
|
2232
|
+
"events.deleteSelected": "Delete selected events",
|
|
2233
|
+
"events.deleteConfirm": "Delete {count} selected events? This cannot be undone.",
|
|
2234
|
+
"events.pruneBefore": "Delete events before",
|
|
2235
|
+
"events.pruneCount": "Will delete {count} events before {time}",
|
|
2236
|
+
"events.pruneConfirm": "Delete {count} events before {time}? This cannot be undone.",
|
|
2237
|
+
"batch.running": "Applying...",
|
|
2238
|
+
"batch.summary": "Succeeded {ok}, failed {fail}",
|
|
2239
|
+
"batch.failed": "Batch failed",
|
|
2240
|
+
"batch.unavailable": "API unavailable ({status})",
|
|
2188
2241
|
"board.loadMore": "Load more",
|
|
2189
|
-
"board.latest": "Back to latest",
|
|
2190
2242
|
"board.recycled": "Recycled {count} older tasks",
|
|
2191
2243
|
"board.reloadLatest": "Reload latest",
|
|
2192
|
-
"board.latestAria": "Scroll back to the newest tasks",
|
|
2193
2244
|
"board.loading": "Loading…",
|
|
2194
2245
|
"board.loadFailed": "Could not load more",
|
|
2195
2246
|
"board.retry": "Retry",
|
|
@@ -2228,6 +2279,8 @@ export const messages = Object.freeze({
|
|
|
2228
2279
|
"loading.slow": "Loading · waited {seconds}s",
|
|
2229
2280
|
"loading.failed": "Could not load",
|
|
2230
2281
|
"loading.retry": "Retry",
|
|
2282
|
+
"loading.tasks": "Loading…",
|
|
2283
|
+
"loading.events": "Loading…",
|
|
2231
2284
|
"loading.retryAria": "Retry loading the board",
|
|
2232
2285
|
"loading.aria": "Loading the board",
|
|
2233
2286
|
"agents.openAria": "Open agent",
|
|
@@ -2296,8 +2349,12 @@ export const messages = Object.freeze({
|
|
|
2296
2349
|
"events.loaded": "Loaded {loaded} / {total}",
|
|
2297
2350
|
"events.filterAria": "Filter events by kind",
|
|
2298
2351
|
"events.filterAll": "All kinds",
|
|
2352
|
+
"events.filterOther": "Other",
|
|
2353
|
+
"events.actor.legacy": "Agent",
|
|
2299
2354
|
"events.recycled": "Recycled {count} older events",
|
|
2300
2355
|
"events.loadFailed": "Could not load events",
|
|
2356
|
+
"events.pageFailed": "Older events failed to load",
|
|
2357
|
+
"events.retry": "Retry",
|
|
2301
2358
|
"events.details": "Details",
|
|
2302
2359
|
"events.field.time": "Time",
|
|
2303
2360
|
"events.field.actor": "Who",
|
|
@@ -2539,11 +2596,29 @@ export const messages = Object.freeze({
|
|
|
2539
2596
|
"pane.board": "任务看板",
|
|
2540
2597
|
"pane.events": "事件",
|
|
2541
2598
|
"board.filtersAria": "按状态筛选",
|
|
2599
|
+
"board.more": "更多操作",
|
|
2600
|
+
"board.selectTask": "选择任务",
|
|
2601
|
+
"board.selectAll": "全选",
|
|
2602
|
+
"board.clearSelection": "清除选择",
|
|
2603
|
+
"board.deleteSelected": "删除所选",
|
|
2604
|
+
"board.deleteConfirm": "删除所选的 {count} 个任务?不可撤销。",
|
|
2605
|
+
"board.claimedNoDelete": "进行中的任务不能删除,请先中止或等它完成",
|
|
2606
|
+
"batch.skippedClaimed": "{count} 条进行中被跳过",
|
|
2607
|
+
"events.selectAll": "全选",
|
|
2608
|
+
"events.clearSelection": "清除选择",
|
|
2609
|
+
"events.selectionCount": "已选 {count}",
|
|
2610
|
+
"events.deleteSelected": "删除所选事件",
|
|
2611
|
+
"events.deleteConfirm": "删除所选的 {count} 条事件?不可撤销。",
|
|
2612
|
+
"events.pruneBefore": "删除此时间之前的事件",
|
|
2613
|
+
"events.pruneCount": "将删除 {time} 之前的 {count} 条事件",
|
|
2614
|
+
"events.pruneConfirm": "删除 {time} 之前的 {count} 条事件?不可撤销。",
|
|
2615
|
+
"batch.running": "处理中…",
|
|
2616
|
+
"batch.summary": "成功 {ok},失败 {fail}",
|
|
2617
|
+
"batch.failed": "批量操作失败",
|
|
2618
|
+
"batch.unavailable": "接口不可用({status})",
|
|
2542
2619
|
"board.loadMore": "加载更多",
|
|
2543
|
-
"board.latest": "回到最新",
|
|
2544
2620
|
"board.recycled": "已回收更早的 {count} 条",
|
|
2545
2621
|
"board.reloadLatest": "重新加载",
|
|
2546
|
-
"board.latestAria": "滚动回最新任务",
|
|
2547
2622
|
"board.loading": "加载中…",
|
|
2548
2623
|
"board.loadFailed": "加载失败",
|
|
2549
2624
|
"board.retry": "重试",
|
|
@@ -2582,6 +2657,8 @@ export const messages = Object.freeze({
|
|
|
2582
2657
|
"loading.slow": "正在读取 · 已等 {seconds}s",
|
|
2583
2658
|
"loading.failed": "读取失败",
|
|
2584
2659
|
"loading.retry": "重试",
|
|
2660
|
+
"loading.tasks": "加载中…",
|
|
2661
|
+
"loading.events": "加载中…",
|
|
2585
2662
|
"loading.retryAria": "重试读取看板",
|
|
2586
2663
|
"loading.aria": "正在读取看板",
|
|
2587
2664
|
"agents.openAria": "打开智能体",
|
|
@@ -2650,8 +2727,12 @@ export const messages = Object.freeze({
|
|
|
2650
2727
|
"events.loaded": "已加载 {loaded} / {total}",
|
|
2651
2728
|
"events.filterAria": "按事件类型筛选",
|
|
2652
2729
|
"events.filterAll": "全部事件",
|
|
2730
|
+
"events.filterOther": "其它",
|
|
2731
|
+
"events.actor.legacy": "智能体",
|
|
2653
2732
|
"events.recycled": "已回收更早的 {count} 条",
|
|
2654
2733
|
"events.loadFailed": "事件加载失败",
|
|
2734
|
+
"events.pageFailed": "更早的事件加载失败",
|
|
2735
|
+
"events.retry": "重试",
|
|
2655
2736
|
"events.details": "详情",
|
|
2656
2737
|
"events.field.time": "时间",
|
|
2657
2738
|
"events.field.actor": "谁",
|
|
@@ -4010,11 +4091,13 @@ export function mount(root, options = {}) {
|
|
|
4010
4091
|
const opts = isRecord(options) ? options : {};
|
|
4011
4092
|
const view = doc.defaultView || globalThis;
|
|
4012
4093
|
const snapshotUrl = asString(opts.snapshotUrl) || DEFAULT_SNAPSHOT_URL;
|
|
4094
|
+
const statusUrl = asString(opts.statusUrl) || DEFAULT_STATUS_URL;
|
|
4013
4095
|
const supervisorUrl = asString(opts.supervisorUrl) || DEFAULT_SUPERVISOR_URL;
|
|
4014
4096
|
const actionsUrl = (asString(opts.actionsUrl) || DEFAULT_ACTIONS_URL).replace(/\/+$/, "");
|
|
4015
4097
|
const tasksUrl = asString(opts.tasksUrl) || DEFAULT_TASKS_URL;
|
|
4016
4098
|
const taskUrl = asString(opts.taskUrl) || DEFAULT_TASK_URL;
|
|
4017
4099
|
const eventsUrl = asString(opts.eventsUrl) || DEFAULT_EVENTS_URL;
|
|
4100
|
+
const batchUrl = asString(opts.batchUrl) || "/api/action";
|
|
4018
4101
|
|
|
4019
4102
|
const requestedInterval = Number(opts.intervalMs);
|
|
4020
4103
|
const intervalMs =
|
|
@@ -4097,6 +4180,14 @@ export function mount(root, options = {}) {
|
|
|
4097
4180
|
let loadingActive = false;
|
|
4098
4181
|
let loadingTicks = 0;
|
|
4099
4182
|
let loadingTimer = null;
|
|
4183
|
+
let statusData = null;
|
|
4184
|
+
let initialDataLoaded = false;
|
|
4185
|
+
let initialDataPromise = null;
|
|
4186
|
+
const taskSlices = { pending: [], claimed: [], done: [], failed: [] };
|
|
4187
|
+
const taskSlicePages = {};
|
|
4188
|
+
const selectedTasks = new Set();
|
|
4189
|
+
const selectedEvents = new Set();
|
|
4190
|
+
let batchBusy = false;
|
|
4100
4191
|
let loadingPanelError = "";
|
|
4101
4192
|
let drawerNode = null;
|
|
4102
4193
|
let drawerState = null;
|
|
@@ -4138,6 +4229,10 @@ export function mount(root, options = {}) {
|
|
|
4138
4229
|
signature: "",
|
|
4139
4230
|
expanded: new Set(),
|
|
4140
4231
|
rowNodes: new Map(),
|
|
4232
|
+
kindCounts: new Map(),
|
|
4233
|
+
pageError: "",
|
|
4234
|
+
noMore: false,
|
|
4235
|
+
pageFailureCount: 0,
|
|
4141
4236
|
};
|
|
4142
4237
|
let initBusy = false;
|
|
4143
4238
|
let initOutput = null;
|
|
@@ -4341,15 +4436,7 @@ export function mount(root, options = {}) {
|
|
|
4341
4436
|
stage.appendChild(stageChips);
|
|
4342
4437
|
stage.appendChild(filterEmpty);
|
|
4343
4438
|
stage.appendChild(lanesNode);
|
|
4344
|
-
const skeletonNode = element(doc, "div", "hive-skeleton");
|
|
4345
|
-
for (const lane of LANE_ORDER) {
|
|
4346
|
-
const laneNode = element(doc, "section", "hive-skeleton-lane");
|
|
4347
|
-
laneNode.appendChild(element(doc, "div", "hive-skeleton-head", laneLabel(lane)));
|
|
4348
|
-
for (let row = 0; row < 3; row += 1) {
|
|
4349
|
-
laneNode.appendChild(element(doc, "div", "hive-skeleton-row", ""));
|
|
4350
|
-
}
|
|
4351
|
-
skeletonNode.appendChild(laneNode);
|
|
4352
|
-
}
|
|
4439
|
+
const skeletonNode = element(doc, "div", "hive-skeleton is-hidden");
|
|
4353
4440
|
const loadingPanel = element(doc, "div", "hive-loading is-hidden");
|
|
4354
4441
|
setAttr(loadingPanel, "role", "status");
|
|
4355
4442
|
setAttr(loadingPanel, "aria-live", "polite");
|
|
@@ -4381,8 +4468,122 @@ export function mount(root, options = {}) {
|
|
|
4381
4468
|
eventsHead.appendChild(eventsCount);
|
|
4382
4469
|
eventsHead.appendChild(eventsFilter);
|
|
4383
4470
|
eventsHead.appendChild(eventsRecycle);
|
|
4471
|
+
const eventsMoreButton = element(doc, "button", "hive-btn hive-btn-ghost hive-events-menu-button", "…");
|
|
4472
|
+
setAttr(eventsMoreButton, "type", "button");
|
|
4473
|
+
setAttr(eventsMoreButton, "title", translate("board.more"));
|
|
4474
|
+
setAttr(eventsMoreButton, "aria-label", translate("board.more"));
|
|
4475
|
+
setAttr(eventsMoreButton, "aria-expanded", "false");
|
|
4476
|
+
eventsHead.appendChild(eventsMoreButton);
|
|
4477
|
+
const eventsMenu = element(doc, "div", "hive-menu hive-events-menu is-hidden");
|
|
4478
|
+
const eventsPrune = element(doc, "div", "hive-event-prune is-hidden");
|
|
4479
|
+
const pruneLabel = element(doc, "label", "hive-event-prune-label");
|
|
4480
|
+
pruneLabel.appendChild(element(doc, "span", null, translate("events.pruneBefore")));
|
|
4481
|
+
const pruneInput = element(doc, "input", "hive-event-prune-input");
|
|
4482
|
+
setAttr(pruneInput, "type", "datetime-local");
|
|
4483
|
+
pruneLabel.appendChild(pruneInput);
|
|
4484
|
+
const pruneCount = element(doc, "div", "hive-event-prune-count", "");
|
|
4485
|
+
const pruneConfirm = element(doc, "button", "hive-btn hive-btn-danger hive-event-prune-confirm", translate("events.pruneBefore"));
|
|
4486
|
+
setAttr(pruneConfirm, "type", "button");
|
|
4487
|
+
eventsPrune.appendChild(pruneLabel);
|
|
4488
|
+
eventsPrune.appendChild(pruneCount);
|
|
4489
|
+
eventsPrune.appendChild(pruneConfirm);
|
|
4490
|
+
const eventMenuAction = (labelKey, handler, danger = false) => {
|
|
4491
|
+
const button = element(doc, "button", "hive-menu-item" + (danger ? " is-danger" : ""), translate(labelKey));
|
|
4492
|
+
setAttr(button, "type", "button");
|
|
4493
|
+
button.addEventListener("click", () => {
|
|
4494
|
+
eventsMenu.className = "hive-menu hive-events-menu is-hidden";
|
|
4495
|
+
setAttr(eventsMoreButton, "aria-expanded", "false");
|
|
4496
|
+
handler();
|
|
4497
|
+
});
|
|
4498
|
+
eventsMenu.appendChild(button);
|
|
4499
|
+
return button;
|
|
4500
|
+
};
|
|
4501
|
+
const eventsSelectionCount = element(doc, "div", "hive-menu-selection", "");
|
|
4502
|
+
eventsMenu.appendChild(eventsSelectionCount);
|
|
4503
|
+
const eventSelectAllButton = eventMenuAction("events.selectAll", () => {
|
|
4504
|
+
for (const event of eventState.items) selectedEvents.add(eventKey(event));
|
|
4505
|
+
syncEventSelectionChecks();
|
|
4506
|
+
updateEventSelectionUi();
|
|
4507
|
+
});
|
|
4508
|
+
const eventClearSelectionButton = eventMenuAction("events.clearSelection", () => {
|
|
4509
|
+
selectedEvents.clear();
|
|
4510
|
+
syncEventSelectionChecks();
|
|
4511
|
+
updateEventSelectionUi();
|
|
4512
|
+
});
|
|
4513
|
+
const eventDeleteButton = eventMenuAction("events.deleteSelected", () => {
|
|
4514
|
+
const keys = [...selectedEvents];
|
|
4515
|
+
if (keys.length === 0) return;
|
|
4516
|
+
if (!confirmImpl || !confirmImpl(translate("events.deleteConfirm").replace("{count}", String(keys.length)))) return;
|
|
4517
|
+
selectedEvents.clear();
|
|
4518
|
+
updateEventSelectionUi();
|
|
4519
|
+
void runBatch("events-delete", { ids: keys, keys });
|
|
4520
|
+
}, true);
|
|
4521
|
+
eventMenuAction("events.pruneBefore", () => {
|
|
4522
|
+
eventsPrune.className = "hive-event-prune";
|
|
4523
|
+
pruneInput.value = "";
|
|
4524
|
+
pruneCount.textContent = translate("events.pruneCount").replace("{count}", "0").replace("{time}", "—");
|
|
4525
|
+
focusNode(pruneInput);
|
|
4526
|
+
});
|
|
4527
|
+
function updateEventSelectionUi() {
|
|
4528
|
+
const count = selectedEvents.size;
|
|
4529
|
+
eventsSelectionCount.textContent = translate("events.selectionCount").replace("{count}", String(count));
|
|
4530
|
+
eventDeleteButton.disabled = count === 0;
|
|
4531
|
+
eventSelectAllButton.disabled = eventState.items.length === 0;
|
|
4532
|
+
eventClearSelectionButton.disabled = count === 0;
|
|
4533
|
+
}
|
|
4534
|
+
function syncEventSelectionChecks() {
|
|
4535
|
+
for (const [key, entry] of eventState.rowNodes) {
|
|
4536
|
+
const check = (entry.row.children || []).find((child) => String(child.className).split(/\s+/).includes("hive-event-check"));
|
|
4537
|
+
if (!check) continue;
|
|
4538
|
+
const selected = selectedEvents.has(key);
|
|
4539
|
+
check.checked = selected;
|
|
4540
|
+
entry.row.className = "hive-event" + (entry.details && entry.details.open ? " is-expanded" : "") + (selected ? " is-selected" : "");
|
|
4541
|
+
}
|
|
4542
|
+
}
|
|
4543
|
+
eventsMoreButton.addEventListener("click", () => {
|
|
4544
|
+
const open = eventsMenu.className.includes("is-hidden");
|
|
4545
|
+
eventsMenu.className = "hive-menu hive-events-menu" + (open ? "" : " is-hidden");
|
|
4546
|
+
setAttr(eventsMoreButton, "aria-expanded", open ? "true" : "false");
|
|
4547
|
+
if (open) updateEventSelectionUi();
|
|
4548
|
+
});
|
|
4549
|
+
const pruneBefore = () => {
|
|
4550
|
+
const value = String(pruneInput.value || "");
|
|
4551
|
+
if (!value) return null;
|
|
4552
|
+
const time = Date.parse(value);
|
|
4553
|
+
return Number.isFinite(time) ? time : null;
|
|
4554
|
+
};
|
|
4555
|
+
pruneInput.addEventListener("input", () => {
|
|
4556
|
+
const time = pruneBefore();
|
|
4557
|
+
if (time === null) {
|
|
4558
|
+
pruneCount.textContent = translate("events.pruneCount").replace("{count}", "0").replace("{time}", "—");
|
|
4559
|
+
return;
|
|
4560
|
+
}
|
|
4561
|
+
const count = eventState.items.filter((event) => {
|
|
4562
|
+
const ts = Date.parse(event.ts);
|
|
4563
|
+
return Number.isFinite(ts) && ts < time;
|
|
4564
|
+
}).length;
|
|
4565
|
+
pruneCount.textContent = translate("events.pruneCount").replace("{count}", String(count)).replace("{time}", new Date(time).toLocaleString());
|
|
4566
|
+
});
|
|
4567
|
+
pruneConfirm.addEventListener("click", () => {
|
|
4568
|
+
const time = pruneBefore();
|
|
4569
|
+
if (time === null) return;
|
|
4570
|
+
const count = eventState.items.filter((event) => {
|
|
4571
|
+
const ts = Date.parse(event.ts);
|
|
4572
|
+
return Number.isFinite(ts) && ts < time;
|
|
4573
|
+
}).length;
|
|
4574
|
+
const message = translate("events.pruneConfirm").replace("{count}", String(count)).replace("{time}", new Date(time).toLocaleString());
|
|
4575
|
+
if (!confirmImpl || !confirmImpl(message)) return;
|
|
4576
|
+
eventsPrune.className = "hive-event-prune is-hidden";
|
|
4577
|
+
void runBatch("events-prune", { before: new Date(time).toISOString() });
|
|
4578
|
+
});
|
|
4579
|
+
eventsHead.appendChild(eventsMenu);
|
|
4384
4580
|
const eventsList = element(doc, "div", "hive-scroll hive-event-list");
|
|
4581
|
+
const eventsSkeleton = element(doc, "div", "hive-events-initial");
|
|
4582
|
+
for (let index = 0; index < 3; index += 1) {
|
|
4583
|
+
eventsSkeleton.appendChild(element(doc, "div", "hive-events-initial-row", ""));
|
|
4584
|
+
}
|
|
4385
4585
|
eventsDrawer.appendChild(eventsHead);
|
|
4586
|
+
eventsDrawer.appendChild(eventsPrune);
|
|
4386
4587
|
eventsDrawer.appendChild(eventsList);
|
|
4387
4588
|
eventsFilter.addEventListener("change", () => {
|
|
4388
4589
|
eventState.filter = eventsFilter.value || "";
|
|
@@ -4393,6 +4594,9 @@ export function mount(root, options = {}) {
|
|
|
4393
4594
|
eventState.signature = "";
|
|
4394
4595
|
eventState.expanded.clear();
|
|
4395
4596
|
eventState.rowNodes.clear();
|
|
4597
|
+
eventState.pageError = "";
|
|
4598
|
+
eventState.noMore = false;
|
|
4599
|
+
eventState.pageFailureCount = 0;
|
|
4396
4600
|
eventsList.scrollTop = 0;
|
|
4397
4601
|
void loadEventPage(true);
|
|
4398
4602
|
});
|
|
@@ -7293,16 +7497,6 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
7293
7497
|
const banner = element(doc, "div", "hive-freeze-banner");
|
|
7294
7498
|
setAttr(banner, "role", "status");
|
|
7295
7499
|
banner.appendChild(element(doc, "span", "hive-freeze-text", translate("mode.freeze.banner")));
|
|
7296
|
-
if (model.writable) {
|
|
7297
|
-
const button = element(doc, "button", "hive-btn", translate("action.unfreeze"));
|
|
7298
|
-
setAttr(button, "type", "button");
|
|
7299
|
-
setAttr(button, "title", translate("help.action.unfreeze"));
|
|
7300
|
-
setAttr(button, "aria-label", translate("help.action.unfreeze"));
|
|
7301
|
-
button.addEventListener("click", () => {
|
|
7302
|
-
void postAction("mode", { mode: "free", reason: "panel" });
|
|
7303
|
-
});
|
|
7304
|
-
banner.appendChild(button);
|
|
7305
|
-
}
|
|
7306
7500
|
freezeSlot.appendChild(banner);
|
|
7307
7501
|
}
|
|
7308
7502
|
|
|
@@ -7355,25 +7549,228 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
7355
7549
|
setAttr(agentsCount, "aria-label", label);
|
|
7356
7550
|
}
|
|
7357
7551
|
|
|
7552
|
+
function selectedCount() {
|
|
7553
|
+
return selectedTasks.size + selectedEvents.size;
|
|
7554
|
+
}
|
|
7555
|
+
|
|
7556
|
+
function setBatchBusyState(busy) {
|
|
7557
|
+
for (const state of laneRenderState.values()) {
|
|
7558
|
+
if (!state.menu) continue;
|
|
7559
|
+
for (const child of state.menu.children || []) {
|
|
7560
|
+
if ("disabled" in child) child.disabled = busy;
|
|
7561
|
+
}
|
|
7562
|
+
}
|
|
7563
|
+
if (typeof eventSelectAllButton !== "undefined") {
|
|
7564
|
+
eventSelectAllButton.disabled = busy || eventState.items.length === 0;
|
|
7565
|
+
eventClearSelectionButton.disabled = busy || selectedEvents.size === 0;
|
|
7566
|
+
eventDeleteButton.disabled = busy || selectedEvents.size === 0;
|
|
7567
|
+
pruneConfirm.disabled = busy;
|
|
7568
|
+
}
|
|
7569
|
+
}
|
|
7570
|
+
|
|
7571
|
+
async function readBatchResponse(response) {
|
|
7572
|
+
const status = Number(response && response.status) || 0;
|
|
7573
|
+
const contentType = response && response.headers && typeof response.headers.get === "function"
|
|
7574
|
+
? String(response.headers.get("content-type") || "")
|
|
7575
|
+
: "";
|
|
7576
|
+
let text = "";
|
|
7577
|
+
if (response && typeof response.text === "function") {
|
|
7578
|
+
try {
|
|
7579
|
+
text = await response.text();
|
|
7580
|
+
} catch {
|
|
7581
|
+
text = "";
|
|
7582
|
+
}
|
|
7583
|
+
}
|
|
7584
|
+
if (text !== "") {
|
|
7585
|
+
if (contentType !== "" && !contentType.includes("json")) {
|
|
7586
|
+
return { status, text, invalid: true };
|
|
7587
|
+
}
|
|
7588
|
+
try {
|
|
7589
|
+
return { status, data: JSON.parse(text) };
|
|
7590
|
+
} catch {
|
|
7591
|
+
return { status, text, invalid: true };
|
|
7592
|
+
}
|
|
7593
|
+
}
|
|
7594
|
+
if (response && typeof response.json === "function") {
|
|
7595
|
+
try {
|
|
7596
|
+
return { status, data: await response.json() };
|
|
7597
|
+
} catch {
|
|
7598
|
+
return { status, text: "", invalid: true };
|
|
7599
|
+
}
|
|
7600
|
+
}
|
|
7601
|
+
return { status, text: "", invalid: true };
|
|
7602
|
+
}
|
|
7603
|
+
|
|
7604
|
+
async function fallbackTaskBatch(op, payload) {
|
|
7605
|
+
if (op !== "tasks-rm") return null;
|
|
7606
|
+
const ids = Array.isArray(payload.ids) ? payload.ids : [];
|
|
7607
|
+
const results = [];
|
|
7608
|
+
for (const id of ids) {
|
|
7609
|
+
const result = await requestAction("remove", { id });
|
|
7610
|
+
results.push({ id, ok: result.ok === true, error: result.ok ? "" : actionErrorDetail(result.error) });
|
|
7611
|
+
}
|
|
7612
|
+
return results;
|
|
7613
|
+
}
|
|
7614
|
+
|
|
7615
|
+
function taskStateById(id) {
|
|
7616
|
+
const wanted = String(id);
|
|
7617
|
+
for (const lane of LANE_ORDER) {
|
|
7618
|
+
const task = (taskSlices[lane] || []).find((entry) => String(entry.id) === wanted);
|
|
7619
|
+
if (task) return String(task.state || lane);
|
|
7620
|
+
}
|
|
7621
|
+
if (lastModel) {
|
|
7622
|
+
for (const lane of LANE_ORDER) {
|
|
7623
|
+
const card = ((lastModel.lanes && lastModel.lanes[lane]) || []).find((entry) => String(entry.id) === wanted);
|
|
7624
|
+
if (card) return String(card.state || lane);
|
|
7625
|
+
}
|
|
7626
|
+
const task = (lastModel.taskList || []).find((entry) => String(entry.id) === wanted);
|
|
7627
|
+
if (task) return String(task.state || "pending");
|
|
7628
|
+
}
|
|
7629
|
+
return "";
|
|
7630
|
+
}
|
|
7631
|
+
|
|
7632
|
+
function batchSummaryText(okCount, failCount, skipped) {
|
|
7633
|
+
let text = translate("batch.summary").replace("{ok}", String(okCount)).replace("{fail}", String(failCount));
|
|
7634
|
+
if (skipped > 0) text += " · " + translate("batch.skippedClaimed").replace("{count}", String(skipped));
|
|
7635
|
+
return text;
|
|
7636
|
+
}
|
|
7637
|
+
|
|
7638
|
+
async function runBatch(op, payload, laneNames = []) {
|
|
7639
|
+
if (batchBusy || !fetchImpl) return;
|
|
7640
|
+
batchBusy = true;
|
|
7641
|
+
setBatchBusyState(true);
|
|
7642
|
+
let skippedClaimed = 0;
|
|
7643
|
+
try {
|
|
7644
|
+
if (op === "tasks-rm" && Array.isArray(payload.ids)) {
|
|
7645
|
+
const deletable = [];
|
|
7646
|
+
for (const id of payload.ids) {
|
|
7647
|
+
if (taskStateById(id) === "claimed") skippedClaimed += 1;
|
|
7648
|
+
else deletable.push(id);
|
|
7649
|
+
}
|
|
7650
|
+
payload = { ...payload, ids: deletable };
|
|
7651
|
+
if (deletable.length === 0) {
|
|
7652
|
+
showToast(skippedClaimed > 0 ? "error" : "success", batchSummaryText(0, 0, skippedClaimed), "");
|
|
7653
|
+
return;
|
|
7654
|
+
}
|
|
7655
|
+
}
|
|
7656
|
+
let status = 0;
|
|
7657
|
+
let results = null;
|
|
7658
|
+
try {
|
|
7659
|
+
const response = await fetchImpl(batchUrl, {
|
|
7660
|
+
method: "POST",
|
|
7661
|
+
headers: { "content-type": "application/json", accept: "application/json" },
|
|
7662
|
+
body: JSON.stringify({ op, ...payload }),
|
|
7663
|
+
});
|
|
7664
|
+
status = Number(response && response.status) || 0;
|
|
7665
|
+
const parsed = await readBatchResponse(response);
|
|
7666
|
+
if (!response || response.ok === false || parsed.invalid || !parsed.data) {
|
|
7667
|
+
if (status === 404 || status === 405 || status === 501 || parsed.invalid) {
|
|
7668
|
+
results = await fallbackTaskBatch(op, payload);
|
|
7669
|
+
if (results === null) {
|
|
7670
|
+
const error = new Error("batch endpoint unavailable");
|
|
7671
|
+
error.unavailable = true;
|
|
7672
|
+
error.status = status;
|
|
7673
|
+
error.detail = asString(parsed.text || (parsed.data && parsed.data.error));
|
|
7674
|
+
throw error;
|
|
7675
|
+
}
|
|
7676
|
+
} else {
|
|
7677
|
+
throw new Error("batch failed");
|
|
7678
|
+
}
|
|
7679
|
+
} else {
|
|
7680
|
+
results = Array.isArray(parsed.data.results) ? parsed.data.results : [];
|
|
7681
|
+
}
|
|
7682
|
+
} catch (error) {
|
|
7683
|
+
if (error && error.unavailable) throw error;
|
|
7684
|
+
if (status === 404 || status === 405 || status === 501 || /not found/i.test(String(error && error.message))) {
|
|
7685
|
+
results = await fallbackTaskBatch(op, payload);
|
|
7686
|
+
if (results === null) {
|
|
7687
|
+
const unavailable = new Error("batch endpoint unavailable");
|
|
7688
|
+
unavailable.unavailable = true;
|
|
7689
|
+
unavailable.status = status;
|
|
7690
|
+
throw unavailable;
|
|
7691
|
+
}
|
|
7692
|
+
} else {
|
|
7693
|
+
throw error;
|
|
7694
|
+
}
|
|
7695
|
+
}
|
|
7696
|
+
const failures = (results || []).filter((entry) => entry && entry.ok === false);
|
|
7697
|
+
const okCount = (results || []).filter((entry) => entry && entry.ok === true).length;
|
|
7698
|
+
const summary = batchSummaryText(okCount, failures.length, skippedClaimed);
|
|
7699
|
+
const detail = failures.map((entry) => asString(entry.id || entry.key || "") + ": " + asString(entry.error || entry.stderr || "")).filter(Boolean).join("; ");
|
|
7700
|
+
showToast(failures.length > 0 ? "error" : "success", summary, detail);
|
|
7701
|
+
if (op.startsWith("events-")) {
|
|
7702
|
+
await loadInitialEvents();
|
|
7703
|
+
} else if (laneNames.length > 0) {
|
|
7704
|
+
await Promise.all(laneNames.map((lane) => loadInitialLane(lane)));
|
|
7705
|
+
}
|
|
7706
|
+
} catch (error) {
|
|
7707
|
+
if (error && error.unavailable) {
|
|
7708
|
+
showToast("error", translate("batch.unavailable").replace("{status}", String(error.status || "?")), asString(error.detail || ""));
|
|
7709
|
+
} else {
|
|
7710
|
+
showToast("error", translate("batch.failed"), actionErrorDetail(error));
|
|
7711
|
+
}
|
|
7712
|
+
reportError(error);
|
|
7713
|
+
} finally {
|
|
7714
|
+
batchBusy = false;
|
|
7715
|
+
setBatchBusyState(false);
|
|
7716
|
+
}
|
|
7717
|
+
}
|
|
7718
|
+
|
|
7358
7719
|
function renderCard(card, lane, existing) {
|
|
7359
7720
|
const node = existing || element(doc, "article", "hive-card");
|
|
7360
7721
|
const title = card.title || translate("card.untitled");
|
|
7361
7722
|
if (!existing) {
|
|
7362
7723
|
setAttr(node, "tabindex", "0");
|
|
7363
7724
|
setAttr(node, "role", "button");
|
|
7364
|
-
node.addEventListener("click", () => {
|
|
7725
|
+
node.addEventListener("click", (event) => {
|
|
7726
|
+
const target = event && event.target;
|
|
7727
|
+
if (target && (target === node._hiveCheck || String(target.className || "").includes("hive-card-check"))) return;
|
|
7365
7728
|
if (node._hiveCard) void openCardDetail(node._hiveCard, node._hiveLane, node);
|
|
7366
7729
|
});
|
|
7367
7730
|
node.addEventListener("keydown", (event) => {
|
|
7368
|
-
if (!event
|
|
7731
|
+
if (!event) return;
|
|
7732
|
+
const target = event.target;
|
|
7733
|
+
if (target && (target === node._hiveCheck || String(target.tagName || "").toUpperCase() === "INPUT")) return;
|
|
7734
|
+
if (event.key !== "Enter" && event.key !== " ") return;
|
|
7369
7735
|
if (typeof event.preventDefault === "function") event.preventDefault();
|
|
7370
7736
|
if (node._hiveCard) void openCardDetail(node._hiveCard, node._hiveLane, node);
|
|
7371
7737
|
});
|
|
7372
7738
|
node._hiveTitle = element(doc, "div", "hive-card-title", "");
|
|
7739
|
+
node._hiveCheck = element(doc, "input", "hive-card-check");
|
|
7740
|
+
setAttr(node._hiveCheck, "type", "checkbox");
|
|
7741
|
+
setAttr(node._hiveCheck, "aria-label", translate("board.selectTask"));
|
|
7742
|
+
const applyTaskSelection = (checked) => {
|
|
7743
|
+
node._hiveKnown = checked;
|
|
7744
|
+
if (checked) selectedTasks.add(String(card.id));
|
|
7745
|
+
else selectedTasks.delete(String(card.id));
|
|
7746
|
+
};
|
|
7747
|
+
node._hiveCheck.addEventListener("click", (event) => {
|
|
7748
|
+
if (event && typeof event.stopPropagation === "function") event.stopPropagation();
|
|
7749
|
+
const browserToggled = node._hiveCheck.checked !== node._hiveKnown;
|
|
7750
|
+
const next = browserToggled ? node._hiveCheck.checked : !node._hiveKnown;
|
|
7751
|
+
node._hiveCheck.checked = next;
|
|
7752
|
+
applyTaskSelection(next);
|
|
7753
|
+
});
|
|
7754
|
+
node._hiveCheck.addEventListener("change", () => {
|
|
7755
|
+
const next = node._hiveCheck.checked;
|
|
7756
|
+
if (next === node._hiveKnown) return;
|
|
7757
|
+
applyTaskSelection(next);
|
|
7758
|
+
});
|
|
7759
|
+
node.appendChild(node._hiveCheck);
|
|
7373
7760
|
node.appendChild(node._hiveTitle);
|
|
7374
7761
|
}
|
|
7375
7762
|
node._hiveCard = card;
|
|
7376
7763
|
node._hiveLane = lane;
|
|
7764
|
+
if (node._hiveCheck) {
|
|
7765
|
+
const claimed = String(card.state || lane) === "claimed";
|
|
7766
|
+
node._hiveCheck.checked = selectedTasks.has(String(card.id));
|
|
7767
|
+
node._hiveKnown = node._hiveCheck.checked;
|
|
7768
|
+
node._hiveCheck.disabled = claimed;
|
|
7769
|
+
const label = claimed ? translate("board.claimedNoDelete") : translate("board.selectTask");
|
|
7770
|
+
setAttr(node._hiveCheck, "title", label);
|
|
7771
|
+
setAttr(node._hiveCheck, "aria-label", label);
|
|
7772
|
+
node._hiveCheck.className = "hive-card-check" + (claimed ? " is-disabled" : "");
|
|
7773
|
+
}
|
|
7377
7774
|
node._hiveTitle.textContent = title;
|
|
7378
7775
|
setAttr(node, "aria-label", translate("card.openAria") + " " + title);
|
|
7379
7776
|
setAttr(node, "title", title);
|
|
@@ -7452,7 +7849,6 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
7452
7849
|
|
|
7453
7850
|
const LANE_ROW_HEIGHT = 28;
|
|
7454
7851
|
const LANE_ROW_BUFFER = 4;
|
|
7455
|
-
const LANE_MAX_ROWS = 20;
|
|
7456
7852
|
const LANE_VIEWPORT_FALLBACK = 480;
|
|
7457
7853
|
const LANE_DATA_LIMIT = 5000;
|
|
7458
7854
|
const LANE_PAGE_SIZE = 200;
|
|
@@ -7485,12 +7881,58 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
7485
7881
|
const headActions = element(doc, "span", "hive-lane-head-actions");
|
|
7486
7882
|
const topMore = element(doc, "button", "hive-btn hive-btn-ghost hive-lane-more-top is-hidden", translate("board.loadMore"));
|
|
7487
7883
|
setAttr(topMore, "type", "button");
|
|
7488
|
-
const latest = element(doc, "button", "hive-btn hive-btn-ghost hive-lane-latest", translate("board.latest"));
|
|
7489
|
-
setAttr(latest, "type", "button");
|
|
7490
|
-
setAttr(latest, "title", translate("board.latestAria"));
|
|
7491
|
-
setAttr(latest, "aria-label", translate("board.latestAria"));
|
|
7492
7884
|
headActions.appendChild(topMore);
|
|
7493
|
-
|
|
7885
|
+
const menuButton = element(doc, "button", "hive-btn hive-btn-ghost hive-lane-menu-button", "…");
|
|
7886
|
+
setAttr(menuButton, "type", "button");
|
|
7887
|
+
setAttr(menuButton, "title", translate("board.more"));
|
|
7888
|
+
setAttr(menuButton, "aria-label", translate("board.more"));
|
|
7889
|
+
setAttr(menuButton, "aria-expanded", "false");
|
|
7890
|
+
headActions.appendChild(menuButton);
|
|
7891
|
+
const menu = element(doc, "div", "hive-menu hive-lane-menu is-hidden");
|
|
7892
|
+
const addMenuAction = (labelKey, handler, danger = false) => {
|
|
7893
|
+
const button = element(doc, "button", "hive-menu-item" + (danger ? " is-danger" : ""), translate(labelKey));
|
|
7894
|
+
setAttr(button, "type", "button");
|
|
7895
|
+
button.addEventListener("click", (event) => {
|
|
7896
|
+
if (event && typeof event.stopPropagation === "function") event.stopPropagation();
|
|
7897
|
+
closeLaneMenu();
|
|
7898
|
+
handler();
|
|
7899
|
+
});
|
|
7900
|
+
menu.appendChild(button);
|
|
7901
|
+
return button;
|
|
7902
|
+
};
|
|
7903
|
+
const laneNamesForSelection = () => {
|
|
7904
|
+
const lanes = new Set();
|
|
7905
|
+
for (const laneName of LANE_ORDER) {
|
|
7906
|
+
for (const card of taskSlices[laneName] || []) {
|
|
7907
|
+
if (selectedTasks.has(String(card.id))) lanes.add(laneName);
|
|
7908
|
+
}
|
|
7909
|
+
}
|
|
7910
|
+
return [...lanes];
|
|
7911
|
+
};
|
|
7912
|
+
addMenuAction("board.selectAll", () => {
|
|
7913
|
+
for (const card of state.cards || []) selectedTasks.add(String(card.id));
|
|
7914
|
+
if (lastModel) renderLanes(lastModel);
|
|
7915
|
+
});
|
|
7916
|
+
addMenuAction("board.clearSelection", () => {
|
|
7917
|
+
selectedTasks.clear();
|
|
7918
|
+
if (lastModel) renderLanes(lastModel);
|
|
7919
|
+
});
|
|
7920
|
+
addMenuAction("board.deleteSelected", () => {
|
|
7921
|
+
const ids = [...selectedTasks];
|
|
7922
|
+
if (ids.length === 0) return;
|
|
7923
|
+
if (!confirmImpl || !confirmImpl(translate("board.deleteConfirm").replace("{count}", String(ids.length)))) return;
|
|
7924
|
+
const lanes = laneNamesForSelection();
|
|
7925
|
+
selectedTasks.clear();
|
|
7926
|
+
void runBatch("tasks-rm", { ids }, lanes);
|
|
7927
|
+
}, true);
|
|
7928
|
+
menuButton.addEventListener("click", (event) => {
|
|
7929
|
+
if (event && typeof event.stopPropagation === "function") event.stopPropagation();
|
|
7930
|
+
const open = menu.className.includes("is-hidden");
|
|
7931
|
+
closeLaneMenu();
|
|
7932
|
+
menu.className = "hive-menu hive-lane-menu" + (open ? "" : " is-hidden");
|
|
7933
|
+
setAttr(menuButton, "aria-expanded", open ? "true" : "false");
|
|
7934
|
+
});
|
|
7935
|
+
column.appendChild(menu);
|
|
7494
7936
|
head.appendChild(headActions);
|
|
7495
7937
|
column.appendChild(head);
|
|
7496
7938
|
const recycle = element(doc, "div", "hive-lane-recycle is-hidden");
|
|
@@ -7504,10 +7946,15 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
7504
7946
|
const list = element(doc, "div", "hive-lane-cards");
|
|
7505
7947
|
const inner = element(doc, "div", "hive-lane-virtual");
|
|
7506
7948
|
list.appendChild(inner);
|
|
7949
|
+
const initialSkeleton = element(doc, "div", "hive-lane-initial");
|
|
7950
|
+
for (let index = 0; index < 3; index += 1) {
|
|
7951
|
+
initialSkeleton.appendChild(element(doc, "div", "hive-lane-initial-row", ""));
|
|
7952
|
+
}
|
|
7953
|
+
list.appendChild(initialSkeleton);
|
|
7507
7954
|
column.appendChild(list);
|
|
7508
7955
|
lanesNode.appendChild(column);
|
|
7509
7956
|
|
|
7510
|
-
const state = { lane, column, list, inner, count, cards: [], visible: new Map() };
|
|
7957
|
+
const state = { lane, column, list, inner, count, cards: [], visible: new Map(), initialSkeleton, initialLoading: true, menu, menuButton };
|
|
7511
7958
|
const loadingRow = element(doc, "div", "hive-lane-loading is-hidden", translate("board.loading"));
|
|
7512
7959
|
list.appendChild(loadingRow);
|
|
7513
7960
|
list.addEventListener("scroll", () => {
|
|
@@ -7545,15 +7992,19 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
7545
7992
|
recycleButton.addEventListener("click", () => {
|
|
7546
7993
|
void reloadLaneLatest(state.lane, state);
|
|
7547
7994
|
});
|
|
7548
|
-
latest.addEventListener("click", () => {
|
|
7549
|
-
state.list.scrollTop = 0;
|
|
7550
|
-
});
|
|
7551
7995
|
state.topMore = topMore;
|
|
7552
|
-
state.latest = latest;
|
|
7553
7996
|
observeLaneResize(state);
|
|
7554
7997
|
return state;
|
|
7555
7998
|
}
|
|
7556
7999
|
|
|
8000
|
+
function closeLaneMenu() {
|
|
8001
|
+
for (const state of laneRenderState.values()) {
|
|
8002
|
+
if (!state.menu) continue;
|
|
8003
|
+
state.menu.className = "hive-menu hive-lane-menu is-hidden";
|
|
8004
|
+
if (state.menuButton) setAttr(state.menuButton, "aria-expanded", "false");
|
|
8005
|
+
}
|
|
8006
|
+
}
|
|
8007
|
+
|
|
7557
8008
|
function laneViewportHeight(state) {
|
|
7558
8009
|
let height = 0;
|
|
7559
8010
|
try {
|
|
@@ -7587,10 +8038,12 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
7587
8038
|
const viewport = laneViewportHeight(state);
|
|
7588
8039
|
state.lastViewportHeight = viewport;
|
|
7589
8040
|
const scrollTop = Number(state.list.scrollTop) || 0;
|
|
8041
|
+
const visibleRows = Math.max(1, Math.ceil(viewport / row));
|
|
8042
|
+
const maxRows = visibleRows + LANE_ROW_BUFFER * 2;
|
|
7590
8043
|
const start = Math.max(0, Math.floor(scrollTop / row) - LANE_ROW_BUFFER);
|
|
7591
8044
|
let end = Math.min(total, Math.ceil((scrollTop + viewport) / row) + LANE_ROW_BUFFER);
|
|
7592
|
-
if (end - start >
|
|
7593
|
-
const height = total === 0 ? 0 : total * row
|
|
8045
|
+
if (end - start > maxRows) end = start + maxRows;
|
|
8046
|
+
const height = total === 0 ? 0 : total * row;
|
|
7594
8047
|
setStyle(state.inner, "height", String(height) + "px");
|
|
7595
8048
|
|
|
7596
8049
|
const next = new Map();
|
|
@@ -7833,6 +8286,14 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
7833
8286
|
laneRenderState.set(lane, state);
|
|
7834
8287
|
}
|
|
7835
8288
|
state.cards = cards;
|
|
8289
|
+
if (state.initialSkeleton) {
|
|
8290
|
+
if (state.initialLoading) {
|
|
8291
|
+
state.initialSkeleton.className = "hive-lane-initial";
|
|
8292
|
+
} else {
|
|
8293
|
+
if (state.initialSkeleton.parentNode) state.initialSkeleton.parentNode.removeChild(state.initialSkeleton);
|
|
8294
|
+
state.initialSkeleton = null;
|
|
8295
|
+
}
|
|
8296
|
+
}
|
|
7836
8297
|
const classes = ["hive-lane", "hive-lane-" + lane];
|
|
7837
8298
|
if (cards.length === 0) classes.push("is-empty");
|
|
7838
8299
|
if (stageFilter !== "all" && stageFilter !== lane) classes.push("is-filtered-out");
|
|
@@ -7841,18 +8302,17 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
7841
8302
|
const pageInfo = model.lanePages && model.lanePages[lane] ? model.lanePages[lane] : null;
|
|
7842
8303
|
const loaded = cards.length;
|
|
7843
8304
|
const total = pageInfo ? pageInfo.total : loaded;
|
|
7844
|
-
state.count.textContent = total > loaded ? loaded + " / " + total : String(loaded);
|
|
8305
|
+
state.count.textContent = state.initialLoading ? "—" : total > loaded ? loaded + " / " + total : String(loaded);
|
|
7845
8306
|
const hasMore = Boolean(pageInfo && pageInfo.hasMore);
|
|
7846
8307
|
state.more.className = "hive-btn hive-btn-ghost hive-lane-more" + (hasMore ? "" : " is-hidden");
|
|
7847
8308
|
state.recycle.className = "hive-lane-recycle" + (state.recycled > 0 ? "" : " is-hidden");
|
|
7848
8309
|
state.recycleText.textContent = state.recycled > 0
|
|
7849
8310
|
? translate("board.recycled").replace("{count}", String(state.recycled)) + " · "
|
|
7850
8311
|
: "";
|
|
7851
|
-
state.loadingRow.className = "hive-lane-loading" + (state.loadingPage ? "" : " is-hidden");
|
|
8312
|
+
state.loadingRow.className = "hive-lane-loading" + (state.loadingPage && !state.initialLoading ? "" : " is-hidden");
|
|
7852
8313
|
state.topMore.className = "hive-btn hive-btn-ghost hive-lane-more-top" + (hasMore ? "" : " is-hidden");
|
|
7853
8314
|
state.topMore.disabled = state.loadingPage === true;
|
|
7854
8315
|
state.topMore.textContent = state.loadingPage ? translate("board.loading") : translate("board.loadMore");
|
|
7855
|
-
state.latest.className = "hive-btn hive-btn-ghost hive-lane-latest" + (loaded > 0 ? "" : " is-hidden");
|
|
7856
8316
|
state.more.disabled = state.loadingPage === true;
|
|
7857
8317
|
state.more.textContent = state.loadingPage
|
|
7858
8318
|
? translate("board.loading")
|
|
@@ -7883,12 +8343,53 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
7883
8343
|
}
|
|
7884
8344
|
}
|
|
7885
8345
|
|
|
8346
|
+
function eventPageCursor(cursor) {
|
|
8347
|
+
const number = Number(cursor);
|
|
8348
|
+
return Number.isFinite(number) && number >= 0 ? Math.floor(number) : 0;
|
|
8349
|
+
}
|
|
8350
|
+
|
|
7886
8351
|
function eventPageUrl(cursor) {
|
|
7887
|
-
const params = ["cursor=" + encodeURIComponent(String(cursor)), "limit=80"];
|
|
8352
|
+
const params = ["cursor=" + encodeURIComponent(String(eventPageCursor(cursor))), "limit=80"];
|
|
7888
8353
|
if (eventState.filter) params.push("kind=" + encodeURIComponent(eventState.filter));
|
|
7889
8354
|
return eventsUrl + (eventsUrl.includes("?") ? "&" : "?") + params.join("&");
|
|
7890
8355
|
}
|
|
7891
8356
|
|
|
8357
|
+
async function readEventPagePayload(response) {
|
|
8358
|
+
const status = Number(response && response.status) || 0;
|
|
8359
|
+
if (!response || response.ok === false) {
|
|
8360
|
+
let detail = "";
|
|
8361
|
+
if (response && typeof response.text === "function") {
|
|
8362
|
+
try { detail = String(await response.text()).trim(); } catch { detail = ""; }
|
|
8363
|
+
}
|
|
8364
|
+
const reason = translate("events.pageFailed") + (status ? " (" + String(status) + ")" : "");
|
|
8365
|
+
const error = new Error(reason + (detail ? ": " + detail.slice(0, 160) : ""));
|
|
8366
|
+
error.pageReason = reason;
|
|
8367
|
+
throw error;
|
|
8368
|
+
}
|
|
8369
|
+
const contentType = response.headers && typeof response.headers.get === "function"
|
|
8370
|
+
? String(response.headers.get("content-type") || "")
|
|
8371
|
+
: "";
|
|
8372
|
+
if (contentType !== "" && !contentType.includes("json")) {
|
|
8373
|
+
const error = new Error(translate("events.pageFailed") + ": " + contentType);
|
|
8374
|
+
error.pageReason = translate("events.pageFailed") + " (invalid content-type)";
|
|
8375
|
+
throw error;
|
|
8376
|
+
}
|
|
8377
|
+
let payload;
|
|
8378
|
+
try {
|
|
8379
|
+
payload = await response.json();
|
|
8380
|
+
} catch {
|
|
8381
|
+
const error = new Error(translate("events.pageFailed") + ": invalid JSON");
|
|
8382
|
+
error.pageReason = translate("events.pageFailed") + " (invalid JSON)";
|
|
8383
|
+
throw error;
|
|
8384
|
+
}
|
|
8385
|
+
if (!payload || typeof payload !== "object" || !Array.isArray(payload.items)) {
|
|
8386
|
+
const error = new Error(translate("events.pageFailed") + ": invalid payload");
|
|
8387
|
+
error.pageReason = translate("events.pageFailed") + " (invalid payload)";
|
|
8388
|
+
throw error;
|
|
8389
|
+
}
|
|
8390
|
+
return payload;
|
|
8391
|
+
}
|
|
8392
|
+
|
|
7892
8393
|
function initializeEventState(model) {
|
|
7893
8394
|
if (!eventState.initialized || eventState.repo !== model.repo) {
|
|
7894
8395
|
eventState.items = model.events.slice();
|
|
@@ -7898,6 +8399,9 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
7898
8399
|
eventState.recycled = 0;
|
|
7899
8400
|
eventState.loading = false;
|
|
7900
8401
|
eventState.error = "";
|
|
8402
|
+
eventState.pageError = "";
|
|
8403
|
+
eventState.noMore = false;
|
|
8404
|
+
eventState.pageFailureCount = 0;
|
|
7901
8405
|
eventState.repo = model.repo;
|
|
7902
8406
|
eventState.initialized = true;
|
|
7903
8407
|
eventState.paged = false;
|
|
@@ -7921,17 +8425,47 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
7921
8425
|
eventsRecycle.textContent = eventState.recycled > 0
|
|
7922
8426
|
? translate("events.recycled").replace("{count}", String(eventState.recycled))
|
|
7923
8427
|
: "";
|
|
7924
|
-
const
|
|
8428
|
+
const knownKinds = new Set([
|
|
8429
|
+
"task_add", "add", "task_claim", "claim", "task_done", "done", "task_fail", "fail",
|
|
8430
|
+
"task_edit", "edit", "task_split", "split", "task_supersede", "supersede", "reopen",
|
|
8431
|
+
"task_reopen", "task_delete", "rm", "task_plan", "commit_announce", "guard", "lesson",
|
|
8432
|
+
"arch_review", "queen_intervention", "queen_boundary_violation", "service_down",
|
|
8433
|
+
"service_started", "mode", "checkpoint", "renew", "claim_overlap",
|
|
8434
|
+
]);
|
|
8435
|
+
const counts = new Map(eventState.kindCounts);
|
|
8436
|
+
for (const entry of Array.isArray(model.eventKinds) ? model.eventKinds : []) {
|
|
8437
|
+
if (!entry || !entry.kind) continue;
|
|
8438
|
+
counts.set(String(entry.kind), asCount(entry.count, 0));
|
|
8439
|
+
}
|
|
8440
|
+
const loadedCounts = new Map();
|
|
8441
|
+
for (const event of eventState.items) {
|
|
8442
|
+
const kind = asString(event.kind);
|
|
8443
|
+
if (kind) loadedCounts.set(kind, (loadedCounts.get(kind) || 0) + 1);
|
|
8444
|
+
}
|
|
8445
|
+
for (const [kind, count] of loadedCounts) {
|
|
8446
|
+
if (!counts.has(kind) || asCount(counts.get(kind), 0) < count) counts.set(kind, count);
|
|
8447
|
+
}
|
|
8448
|
+
if (eventState.filter && !counts.has(eventState.filter)) counts.set(eventState.filter, 0);
|
|
8449
|
+
const hasEvents = asCount(eventState.total, 0) > 0 || eventState.items.length > 0;
|
|
8450
|
+
if (hasEvents) eventState.kindCounts = counts;
|
|
8451
|
+
else eventState.kindCounts.clear();
|
|
7925
8452
|
clearNode(eventsFilter);
|
|
7926
8453
|
const all = element(doc, "option", null, translate("events.filterAll"));
|
|
7927
8454
|
setAttr(all, "value", "");
|
|
7928
8455
|
eventsFilter.appendChild(all);
|
|
7929
|
-
|
|
7930
|
-
|
|
7931
|
-
|
|
7932
|
-
|
|
7933
|
-
|
|
8456
|
+
if (hasEvents) {
|
|
8457
|
+
const ordered = [...counts.entries()].sort((left, right) => right[1] - left[1] || left[0].localeCompare(right[0]));
|
|
8458
|
+
for (const [kind, count] of ordered) {
|
|
8459
|
+
const label = knownKinds.has(kind) ? kind : translate("events.filterOther");
|
|
8460
|
+
const option = element(doc, "option", null, label + " (" + String(count) + ")");
|
|
8461
|
+
setAttr(option, "value", kind);
|
|
8462
|
+
setAttr(option, "title", kind);
|
|
8463
|
+
eventsFilter.appendChild(option);
|
|
8464
|
+
}
|
|
8465
|
+
} else {
|
|
8466
|
+
eventState.filter = "";
|
|
7934
8467
|
}
|
|
8468
|
+
eventsFilter.disabled = model.initialised === false;
|
|
7935
8469
|
eventsFilter.value = eventState.filter;
|
|
7936
8470
|
}
|
|
7937
8471
|
|
|
@@ -7949,6 +8483,7 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
7949
8483
|
if (!actor) return "—";
|
|
7950
8484
|
if (actor === "queen") return translate("events.actor.queen");
|
|
7951
8485
|
if (actor === "supervisor") return translate("events.actor.supervisor");
|
|
8486
|
+
if (actor === "dsh") return translate("events.actor.legacy");
|
|
7952
8487
|
const worker = /^worker:(.+)$/.exec(actor);
|
|
7953
8488
|
if (worker) return worker[1];
|
|
7954
8489
|
return actor;
|
|
@@ -8248,13 +8783,38 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
8248
8783
|
|
|
8249
8784
|
function eventKey(event) {
|
|
8250
8785
|
const raw = event.raw || {};
|
|
8251
|
-
const ref = raw.task ||
|
|
8252
|
-
return [event.ts, event.kind, event.actor || raw.actor || "", ref]
|
|
8786
|
+
const ref = raw.task || event.task || "";
|
|
8787
|
+
return JSON.stringify([String(event.ts || ""), String(event.kind || ""), String(event.actor || raw.actor || ""), String(ref)]);
|
|
8253
8788
|
}
|
|
8254
8789
|
|
|
8255
8790
|
function createEventRow(event) {
|
|
8256
8791
|
const key = eventKey(event);
|
|
8257
8792
|
const row = element(doc, "div", "hive-event");
|
|
8793
|
+
const check = element(doc, "input", "hive-event-check");
|
|
8794
|
+
setAttr(check, "type", "checkbox");
|
|
8795
|
+
setAttr(check, "aria-label", translate("board.selectTask"));
|
|
8796
|
+
check.checked = selectedEvents.has(key);
|
|
8797
|
+
let known = check.checked;
|
|
8798
|
+
if (check.checked) row.className = "hive-event is-selected";
|
|
8799
|
+
const applySelected = (next) => {
|
|
8800
|
+
known = next;
|
|
8801
|
+
if (next) selectedEvents.add(key);
|
|
8802
|
+
else selectedEvents.delete(key);
|
|
8803
|
+
row.className = "hive-event" + (details.open ? " is-expanded" : "") + (next ? " is-selected" : "");
|
|
8804
|
+
updateEventSelectionUi();
|
|
8805
|
+
};
|
|
8806
|
+
check.addEventListener("click", (inputEvent) => {
|
|
8807
|
+
if (inputEvent && typeof inputEvent.stopPropagation === "function") inputEvent.stopPropagation();
|
|
8808
|
+
const browserToggled = check.checked !== known;
|
|
8809
|
+
const next = browserToggled ? check.checked : !known;
|
|
8810
|
+
check.checked = next;
|
|
8811
|
+
applySelected(next);
|
|
8812
|
+
});
|
|
8813
|
+
check.addEventListener("change", () => {
|
|
8814
|
+
if (check.checked === known) return;
|
|
8815
|
+
applySelected(check.checked);
|
|
8816
|
+
});
|
|
8817
|
+
row.appendChild(check);
|
|
8258
8818
|
row.appendChild(element(doc, "span", "hive-event-sentence", eventSentence(event)));
|
|
8259
8819
|
const details = element(doc, "details", "hive-event-raw");
|
|
8260
8820
|
details.appendChild(element(doc, "summary", "hive-event-summary", translate("events.details")));
|
|
@@ -8269,14 +8829,14 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
8269
8829
|
if (eventState.expanded.has(key)) {
|
|
8270
8830
|
details.open = true;
|
|
8271
8831
|
setAttr(details, "open", "");
|
|
8272
|
-
row.className = "hive-event is-expanded";
|
|
8832
|
+
row.className = "hive-event is-expanded" + (selectedEvents.has(key) ? " is-selected" : "");
|
|
8273
8833
|
}
|
|
8274
8834
|
details.addEventListener("toggle", () => {
|
|
8275
8835
|
if (details.open) {
|
|
8276
|
-
row.className = "hive-event is-expanded";
|
|
8836
|
+
row.className = "hive-event is-expanded" + (selectedEvents.has(key) ? " is-selected" : "");
|
|
8277
8837
|
eventState.expanded.add(key);
|
|
8278
8838
|
} else {
|
|
8279
|
-
row.className = "hive-event";
|
|
8839
|
+
row.className = "hive-event" + (selectedEvents.has(key) ? " is-selected" : "");
|
|
8280
8840
|
eventState.expanded.delete(key);
|
|
8281
8841
|
}
|
|
8282
8842
|
});
|
|
@@ -8285,11 +8845,19 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
8285
8845
|
}
|
|
8286
8846
|
|
|
8287
8847
|
function renderEventRows() {
|
|
8848
|
+
for (const child of [...(eventsList.children || [])]) {
|
|
8849
|
+
const classes = String(child.className).split(/\s+/);
|
|
8850
|
+
if (classes.includes("hive-events-initial") || classes.includes("hive-events-page-error")) {
|
|
8851
|
+
eventsList.removeChild(child);
|
|
8852
|
+
}
|
|
8853
|
+
}
|
|
8288
8854
|
const signature =
|
|
8289
8855
|
eventState.filter +
|
|
8290
8856
|
"|" + String(eventState.items.length) +
|
|
8291
8857
|
"|" + String(eventState.recycled) +
|
|
8292
8858
|
"|" + String(eventState.error ? 1 : 0) +
|
|
8859
|
+
"|" + eventState.pageError +
|
|
8860
|
+
"|" + String(eventState.noMore ? 1 : 0) +
|
|
8293
8861
|
"|" + (eventState.items[0] ? eventState.items[0].ts : "") +
|
|
8294
8862
|
"|" + (eventState.items[eventState.items.length - 1] ? eventState.items[eventState.items.length - 1].ts : "");
|
|
8295
8863
|
if (signature === eventState.signature) return;
|
|
@@ -8338,10 +8906,29 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
8338
8906
|
cursor = entry.row;
|
|
8339
8907
|
}
|
|
8340
8908
|
restoreEventAnchor(anchor);
|
|
8909
|
+
if (eventState.pageError) {
|
|
8910
|
+
const errorRow = element(doc, "div", "hive-events-page-error");
|
|
8911
|
+
setAttr(errorRow, "role", "status");
|
|
8912
|
+
setAttr(errorRow, "title", eventState.pageError);
|
|
8913
|
+
errorRow.appendChild(element(doc, "span", "hive-events-page-error-text", translate("events.pageFailed")));
|
|
8914
|
+
const reason = eventState.pageError.startsWith(translate("events.pageFailed"))
|
|
8915
|
+
? eventState.pageError.slice(translate("events.pageFailed").length).trim()
|
|
8916
|
+
: eventState.pageError;
|
|
8917
|
+
if (reason) errorRow.appendChild(element(doc, "span", "hive-events-page-error-reason", reason));
|
|
8918
|
+
const retry = element(doc, "button", "hive-btn hive-btn-ghost hive-events-page-retry", translate("events.retry"));
|
|
8919
|
+
setAttr(retry, "type", "button");
|
|
8920
|
+
retry.addEventListener("click", () => {
|
|
8921
|
+
eventState.pageError = "";
|
|
8922
|
+
eventState.signature = "";
|
|
8923
|
+
void loadEventPage(false);
|
|
8924
|
+
});
|
|
8925
|
+
errorRow.appendChild(retry);
|
|
8926
|
+
eventsList.appendChild(errorRow);
|
|
8927
|
+
}
|
|
8341
8928
|
}
|
|
8342
8929
|
|
|
8343
8930
|
function maybeLoadEventPage() {
|
|
8344
|
-
if (eventState.loading || !fetchImpl || !lastModel) return;
|
|
8931
|
+
if (eventState.loading || eventState.pageError || eventState.noMore || !fetchImpl || !lastModel) return;
|
|
8345
8932
|
if (eventState.items.length >= eventState.total) return;
|
|
8346
8933
|
const list = eventsList;
|
|
8347
8934
|
if (list.scrollHeight <= list.clientHeight) return;
|
|
@@ -8350,25 +8937,25 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
8350
8937
|
|
|
8351
8938
|
async function loadEventPage(reset) {
|
|
8352
8939
|
if (eventState.loading || !fetchImpl || !lastModel) return;
|
|
8940
|
+
if (!reset && eventState.pageError) return;
|
|
8353
8941
|
eventState.loading = true;
|
|
8354
|
-
eventState.error = "";
|
|
8355
8942
|
eventState.paged = true;
|
|
8356
|
-
const cursor = reset ? 0 : eventState.cursor;
|
|
8943
|
+
const cursor = reset ? 0 : eventPageCursor(eventState.cursor);
|
|
8357
8944
|
try {
|
|
8358
8945
|
const response = await fetchImpl(eventPageUrl(cursor), {
|
|
8359
8946
|
cache: "no-store",
|
|
8360
8947
|
headers: { accept: "application/json" },
|
|
8361
8948
|
});
|
|
8362
|
-
|
|
8363
|
-
const
|
|
8364
|
-
const
|
|
8365
|
-
const
|
|
8366
|
-
const
|
|
8949
|
+
const payload = await readEventPagePayload(response);
|
|
8950
|
+
const items = normalizeEvents(payload.items);
|
|
8951
|
+
const total = asCount(payload.total, eventState.total);
|
|
8952
|
+
const next = asCount(payload.cursor, cursor + items.length);
|
|
8953
|
+
const noMore = payload.hasMore === false || (payload.hasMore !== true && next >= total) || items.length === 0;
|
|
8367
8954
|
if (reset) {
|
|
8368
8955
|
eventState.items = items;
|
|
8369
8956
|
eventState.recycled = 0;
|
|
8370
8957
|
eventsList.scrollTop = 0;
|
|
8371
|
-
} else {
|
|
8958
|
+
} else if (items.length > 0) {
|
|
8372
8959
|
eventState.items = eventState.items.concat(items);
|
|
8373
8960
|
if (eventState.items.length > 5000) {
|
|
8374
8961
|
const dropped = eventState.items.length - 5000;
|
|
@@ -8376,15 +8963,24 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
8376
8963
|
eventState.recycled += dropped;
|
|
8377
8964
|
}
|
|
8378
8965
|
}
|
|
8379
|
-
eventState.cursor = next;
|
|
8966
|
+
eventState.cursor = eventPageCursor(next);
|
|
8380
8967
|
eventState.total = total;
|
|
8968
|
+
eventState.noMore = noMore;
|
|
8969
|
+
eventState.pageError = "";
|
|
8970
|
+
eventState.pageFailureCount = 0;
|
|
8381
8971
|
eventState.signature = "";
|
|
8382
|
-
if (!destroyed && lastModel)
|
|
8972
|
+
if (!destroyed && lastModel) {
|
|
8973
|
+
renderEventHeader(lastModel);
|
|
8974
|
+
renderEventRows();
|
|
8975
|
+
}
|
|
8383
8976
|
} catch (error) {
|
|
8384
|
-
|
|
8385
|
-
|
|
8386
|
-
|
|
8387
|
-
|
|
8977
|
+
if (!destroyed) {
|
|
8978
|
+
eventState.pageError = asString(error && (error.pageReason || error.message)) || translate("events.pageFailed");
|
|
8979
|
+
eventState.pageFailureCount += 1;
|
|
8980
|
+
eventState.signature = "";
|
|
8981
|
+
if (!destroyed && lastModel) renderEventRows();
|
|
8982
|
+
reportError(error);
|
|
8983
|
+
}
|
|
8388
8984
|
} finally {
|
|
8389
8985
|
eventState.loading = false;
|
|
8390
8986
|
}
|
|
@@ -8409,7 +9005,7 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
8409
9005
|
renderEventRows();
|
|
8410
9006
|
}
|
|
8411
9007
|
|
|
8412
|
-
function
|
|
9008
|
+
function renderChrome(model) {
|
|
8413
9009
|
repoNode.textContent = model.repo || "—";
|
|
8414
9010
|
setAttr(repoNode, "title", model.repo);
|
|
8415
9011
|
|
|
@@ -8422,6 +9018,10 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
8422
9018
|
renderAgents(model);
|
|
8423
9019
|
renderStageChips(model);
|
|
8424
9020
|
renderLanes(model);
|
|
9021
|
+
}
|
|
9022
|
+
|
|
9023
|
+
function render(model) {
|
|
9024
|
+
renderChrome(model);
|
|
8425
9025
|
renderEvents(model);
|
|
8426
9026
|
}
|
|
8427
9027
|
|
|
@@ -8478,6 +9078,10 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
8478
9078
|
eventState.signature = "";
|
|
8479
9079
|
eventState.expanded.clear();
|
|
8480
9080
|
eventState.rowNodes.clear();
|
|
9081
|
+
eventState.kindCounts.clear();
|
|
9082
|
+
eventState.pageError = "";
|
|
9083
|
+
eventState.noMore = false;
|
|
9084
|
+
eventState.pageFailureCount = 0;
|
|
8481
9085
|
eventsList.scrollTop = 0;
|
|
8482
9086
|
planTriggerButton = null;
|
|
8483
9087
|
closeHelp(false);
|
|
@@ -8487,9 +9091,195 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
8487
9091
|
closeToast();
|
|
8488
9092
|
}
|
|
8489
9093
|
|
|
9094
|
+
function normalizeStatusPayload(data) {
|
|
9095
|
+
if (!data || typeof data !== "object") return data;
|
|
9096
|
+
if (data.counts && !data.stats) {
|
|
9097
|
+
const tasks = data.counts.tasks || {};
|
|
9098
|
+
const byState = tasks.byState || {};
|
|
9099
|
+
const lanePages = {};
|
|
9100
|
+
for (const lane of LANE_ORDER) {
|
|
9101
|
+
const total = Number(byState[lane]) || 0;
|
|
9102
|
+
lanePages[lane] = { total, cursor: 0, hasMore: total > 0 };
|
|
9103
|
+
}
|
|
9104
|
+
return {
|
|
9105
|
+
...data,
|
|
9106
|
+
partial: true,
|
|
9107
|
+
mode: data.mode || { mode: "free" },
|
|
9108
|
+
board: [],
|
|
9109
|
+
stats: {
|
|
9110
|
+
total: Number(tasks.total) || 0,
|
|
9111
|
+
byState,
|
|
9112
|
+
byRole: tasks.byRole || {},
|
|
9113
|
+
oldestPending: null,
|
|
9114
|
+
},
|
|
9115
|
+
lanePages,
|
|
9116
|
+
eventTotal: Number(data.counts.events && data.counts.events.total) || 0,
|
|
9117
|
+
eventKinds: (data.counts.events && data.counts.events.kinds) || [],
|
|
9118
|
+
};
|
|
9119
|
+
}
|
|
9120
|
+
return data;
|
|
9121
|
+
}
|
|
9122
|
+
function emptyLanePages() {
|
|
9123
|
+
const pages = {};
|
|
9124
|
+
for (const lane of LANE_ORDER) {
|
|
9125
|
+
const statusPage = statusData && statusData.lanePages ? statusData.lanePages[lane] : null;
|
|
9126
|
+
pages[lane] = {
|
|
9127
|
+
total: statusPage ? asCount(statusPage.total, 0) : 0,
|
|
9128
|
+
cursor: statusPage ? asCount(statusPage.cursor, 0) : 0,
|
|
9129
|
+
hasMore: Boolean(statusPage && statusPage.hasMore),
|
|
9130
|
+
};
|
|
9131
|
+
}
|
|
9132
|
+
return pages;
|
|
9133
|
+
}
|
|
9134
|
+
|
|
9135
|
+
function buildStatusSnapshot() {
|
|
9136
|
+
const base = isRecord(statusData) ? statusData : {};
|
|
9137
|
+
const lanePages = emptyLanePages();
|
|
9138
|
+
for (const lane of LANE_ORDER) {
|
|
9139
|
+
const page = taskSlicePages[lane];
|
|
9140
|
+
if (!page) continue;
|
|
9141
|
+
lanePages[lane] = page;
|
|
9142
|
+
}
|
|
9143
|
+
return {
|
|
9144
|
+
...base,
|
|
9145
|
+
tasks: LANE_ORDER.flatMap((lane) => taskSlices[lane] || []),
|
|
9146
|
+
lanePages,
|
|
9147
|
+
events: eventState.items,
|
|
9148
|
+
eventTotal: Math.max(eventState.total, asCount(base.eventTotal, 0)),
|
|
9149
|
+
eventKinds: Array.isArray(base.eventKinds) ? base.eventKinds : [],
|
|
9150
|
+
};
|
|
9151
|
+
}
|
|
9152
|
+
|
|
9153
|
+
function refreshStatusChrome() {
|
|
9154
|
+
if (!statusData) return;
|
|
9155
|
+
lastSnapshot = buildStatusSnapshot();
|
|
9156
|
+
lastModel = renderModel(lastSnapshot);
|
|
9157
|
+
renderChrome(lastModel);
|
|
9158
|
+
}
|
|
9159
|
+
|
|
9160
|
+
function hideEventSkeleton() {
|
|
9161
|
+
if (eventsSkeleton && eventsSkeleton.parentNode) eventsSkeleton.parentNode.removeChild(eventsSkeleton);
|
|
9162
|
+
}
|
|
9163
|
+
|
|
9164
|
+
function applyStatus(data) {
|
|
9165
|
+
statusData = isRecord(data) ? normalizeStatusPayload(data) : {};
|
|
9166
|
+
const snapshot = buildStatusSnapshot();
|
|
9167
|
+
lastSnapshot = snapshot;
|
|
9168
|
+
lastModel = renderModel(snapshot);
|
|
9169
|
+
finishLoading();
|
|
9170
|
+
setStatus(null);
|
|
9171
|
+
renderChrome(lastModel);
|
|
9172
|
+
// Event filters come from status, but rows stay in their loading skeleton
|
|
9173
|
+
// until the independent events request finishes.
|
|
9174
|
+
initializeEventState(lastModel);
|
|
9175
|
+
eventsCount.textContent = "—";
|
|
9176
|
+
hideEventSkeleton();
|
|
9177
|
+
eventsList.appendChild(eventsSkeleton);
|
|
9178
|
+
}
|
|
9179
|
+
|
|
9180
|
+
async function loadInitialLane(lane) {
|
|
9181
|
+
const state = laneRenderState.get(lane);
|
|
9182
|
+
if (!state || !fetchImpl) {
|
|
9183
|
+
if (state) {
|
|
9184
|
+
state.initialLoading = false;
|
|
9185
|
+
renderLanes(lastModel);
|
|
9186
|
+
}
|
|
9187
|
+
return;
|
|
9188
|
+
}
|
|
9189
|
+
try {
|
|
9190
|
+
const url = tasksUrl + (tasksUrl.includes("?") ? "&" : "?") +
|
|
9191
|
+
"state=" + encodeURIComponent(lane) + "&cursor=0&limit=200";
|
|
9192
|
+
const response = await fetchImpl(url, { cache: "no-store", headers: { accept: "application/json" } });
|
|
9193
|
+
if (!response || response.ok === false) throw new Error("tasks failed for " + lane);
|
|
9194
|
+
const payload = await response.json();
|
|
9195
|
+
const items = Array.isArray(payload && payload.items) ? payload.items : [];
|
|
9196
|
+
const total = asCount(payload && payload.total, items.length);
|
|
9197
|
+
const cursor = asCount(payload && payload.cursor, items.length);
|
|
9198
|
+
taskSlices[lane] = items;
|
|
9199
|
+
taskSlicePages[lane] = { total, cursor, hasMore: Boolean(payload && payload.hasMore) };
|
|
9200
|
+
state.initialLoading = false;
|
|
9201
|
+
if (!destroyed) refreshStatusChrome();
|
|
9202
|
+
} catch (error) {
|
|
9203
|
+
state.initialLoading = false;
|
|
9204
|
+
state.pageFailure = actionErrorDetail(error) || translate("loading.failed");
|
|
9205
|
+
if (!destroyed && lastModel) renderLanes(lastModel);
|
|
9206
|
+
reportError(error);
|
|
9207
|
+
}
|
|
9208
|
+
}
|
|
9209
|
+
|
|
9210
|
+
async function loadInitialEvents() {
|
|
9211
|
+
if (!fetchImpl) return;
|
|
9212
|
+
try {
|
|
9213
|
+
const url = eventsUrl + (eventsUrl.includes("?") ? "&" : "?") + "cursor=0&limit=80";
|
|
9214
|
+
const response = await fetchImpl(url, { cache: "no-store", headers: { accept: "application/json" } });
|
|
9215
|
+
if (!response || response.ok === false) throw new Error("events failed");
|
|
9216
|
+
const payload = await response.json();
|
|
9217
|
+
const items = normalizeEvents(Array.isArray(payload && payload.items) ? payload.items : []);
|
|
9218
|
+
eventState.initialized = true;
|
|
9219
|
+
eventState.repo = statusData ? asString(statusData.repo) : "";
|
|
9220
|
+
eventState.items = items;
|
|
9221
|
+
eventState.total = asCount(payload && payload.total, items.length);
|
|
9222
|
+
eventState.cursor = asCount(payload && payload.cursor, items.length);
|
|
9223
|
+
eventState.pollCursor = statusData ? asCount(statusData.eventTotal, eventState.total) : eventState.total;
|
|
9224
|
+
eventState.filter = "";
|
|
9225
|
+
eventState.recycled = 0;
|
|
9226
|
+
eventState.paged = false;
|
|
9227
|
+
eventState.pageError = "";
|
|
9228
|
+
eventState.noMore = payload.hasMore === false || eventState.cursor >= eventState.total;
|
|
9229
|
+
eventState.signature = "";
|
|
9230
|
+
hideEventSkeleton();
|
|
9231
|
+
if (!destroyed && lastModel) {
|
|
9232
|
+
eventsFilter.disabled = false;
|
|
9233
|
+
renderEventHeader(lastModel);
|
|
9234
|
+
renderEventRows();
|
|
9235
|
+
}
|
|
9236
|
+
} catch (error) {
|
|
9237
|
+
hideEventSkeleton();
|
|
9238
|
+
eventState.error = "";
|
|
9239
|
+
if (!destroyed) {
|
|
9240
|
+
clearNode(eventsList);
|
|
9241
|
+
const message = actionErrorDetail(error) || translate("events.loadFailed");
|
|
9242
|
+
eventsList.appendChild(element(doc, "div", "hive-event-error", translate("events.loadFailed") + ": " + message));
|
|
9243
|
+
const retry = element(doc, "button", "hive-btn hive-btn-ghost hive-events-retry", translate("loading.retry"));
|
|
9244
|
+
retry.addEventListener("click", () => {
|
|
9245
|
+
void loadInitialEvents();
|
|
9246
|
+
});
|
|
9247
|
+
eventsList.appendChild(retry);
|
|
9248
|
+
reportError(error);
|
|
9249
|
+
}
|
|
9250
|
+
}
|
|
9251
|
+
}
|
|
9252
|
+
|
|
9253
|
+
async function startInitialData() {
|
|
9254
|
+
if (initialDataPromise) return initialDataPromise;
|
|
9255
|
+
initialDataPromise = (async () => {
|
|
9256
|
+
if (!statusData || statusData.initialised === false) {
|
|
9257
|
+
for (const lane of LANE_ORDER) {
|
|
9258
|
+
const state = laneRenderState.get(lane);
|
|
9259
|
+
if (state) state.initialLoading = false;
|
|
9260
|
+
}
|
|
9261
|
+
hideEventSkeleton();
|
|
9262
|
+
if (lastModel) renderLanes(lastModel);
|
|
9263
|
+
return;
|
|
9264
|
+
}
|
|
9265
|
+
await Promise.all([
|
|
9266
|
+
...LANE_ORDER.map((lane) => loadInitialLane(lane)),
|
|
9267
|
+
loadInitialEvents(),
|
|
9268
|
+
]);
|
|
9269
|
+
initialDataLoaded = true;
|
|
9270
|
+
})().finally(() => {
|
|
9271
|
+
initialDataPromise = null;
|
|
9272
|
+
});
|
|
9273
|
+
return initialDataPromise;
|
|
9274
|
+
}
|
|
9275
|
+
|
|
8490
9276
|
function setSnapshot(snapshot) {
|
|
8491
9277
|
if (destroyed) return null;
|
|
8492
9278
|
lastSnapshot = isRecord(snapshot) ? snapshot : {};
|
|
9279
|
+
statusData = lastSnapshot;
|
|
9280
|
+
initialDataLoaded = true;
|
|
9281
|
+
for (const state of laneRenderState.values()) state.initialLoading = false;
|
|
9282
|
+
hideEventSkeleton();
|
|
8493
9283
|
const model = renderModel(lastSnapshot);
|
|
8494
9284
|
if (lastModel && lastModel.repo !== model.repo) resetRepoState();
|
|
8495
9285
|
lastModel = model;
|
|
@@ -8519,6 +9309,35 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
8519
9309
|
}
|
|
8520
9310
|
return;
|
|
8521
9311
|
}
|
|
9312
|
+
if (!statusData && !initialDataLoaded) {
|
|
9313
|
+
try {
|
|
9314
|
+
const response = await fetchImpl(statusUrl, {
|
|
9315
|
+
cache: "no-store",
|
|
9316
|
+
headers: { accept: "application/json" },
|
|
9317
|
+
});
|
|
9318
|
+
if (response && response.ok !== false) {
|
|
9319
|
+
const data = await response.json();
|
|
9320
|
+
if (!destroyed) {
|
|
9321
|
+
const hasPageData = Boolean(
|
|
9322
|
+
(Array.isArray(data.tasks) && data.tasks.length > 0) ||
|
|
9323
|
+
(Array.isArray(data.events) && data.events.length > 0) ||
|
|
9324
|
+
Object.values(data.lanePages || {}).some((page) => page && Array.isArray(page.items) && page.items.length > 0),
|
|
9325
|
+
);
|
|
9326
|
+
if (data.partial === true || !hasPageData) {
|
|
9327
|
+
applyStatus(data);
|
|
9328
|
+
await startInitialData();
|
|
9329
|
+
return;
|
|
9330
|
+
}
|
|
9331
|
+
setSnapshot(data);
|
|
9332
|
+
statusData = data;
|
|
9333
|
+
initialDataLoaded = true;
|
|
9334
|
+
return;
|
|
9335
|
+
}
|
|
9336
|
+
}
|
|
9337
|
+
} catch {
|
|
9338
|
+
// Older hosts do not expose /api/status; fall back to the full snapshot.
|
|
9339
|
+
}
|
|
9340
|
+
}
|
|
8522
9341
|
try {
|
|
8523
9342
|
const response = await fetchImpl(snapshotUrl, {
|
|
8524
9343
|
cache: "no-store",
|
|
@@ -8538,6 +9357,74 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
8538
9357
|
}
|
|
8539
9358
|
}
|
|
8540
9359
|
|
|
9360
|
+
function isNodeVisible(node) {
|
|
9361
|
+
if (!node || !node.parentNode) return false;
|
|
9362
|
+
if (String(node.className).split(/\s+/).includes("is-hidden")) return false;
|
|
9363
|
+
if (typeof node.getBoundingClientRect === "function") {
|
|
9364
|
+
const rect = node.getBoundingClientRect();
|
|
9365
|
+
if (rect && (Number(rect.width) === 0 || Number(rect.height) === 0)) return false;
|
|
9366
|
+
}
|
|
9367
|
+
return true;
|
|
9368
|
+
}
|
|
9369
|
+
|
|
9370
|
+
async function pollEventsIncremental() {
|
|
9371
|
+
if (!fetchImpl || !initialDataLoaded || eventState.filter) return;
|
|
9372
|
+
if (!isNodeVisible(eventsDrawer)) return;
|
|
9373
|
+
const after = Math.max(0, Math.floor(Number(eventState.pollCursor) || 0));
|
|
9374
|
+
try {
|
|
9375
|
+
const url = eventsUrl + (eventsUrl.includes("?") ? "&" : "?") +
|
|
9376
|
+
"after=" + encodeURIComponent(String(after)) + "&limit=50";
|
|
9377
|
+
const response = await fetchImpl(url, { cache: "no-store", headers: { accept: "application/json" } });
|
|
9378
|
+
if (!response || response.ok === false) return;
|
|
9379
|
+
const payload = await response.json();
|
|
9380
|
+
const items = normalizeEvents(Array.isArray(payload && payload.items) ? payload.items : []);
|
|
9381
|
+
const nextCursor = asCount(payload && payload.cursor, after);
|
|
9382
|
+
const total = asCount(payload && payload.total, eventState.total);
|
|
9383
|
+
eventState.pollCursor = nextCursor;
|
|
9384
|
+
eventState.total = Math.max(total, eventState.items.length);
|
|
9385
|
+
const known = new Set(eventState.items.map((event) => eventKey(event)));
|
|
9386
|
+
const fresh = items.filter((event) => !known.has(eventKey(event)));
|
|
9387
|
+
if (fresh.length > 0) {
|
|
9388
|
+
eventState.items = fresh.concat(eventState.items);
|
|
9389
|
+
eventState.signature = "";
|
|
9390
|
+
if (!destroyed && lastModel) {
|
|
9391
|
+
renderEventHeader(lastModel);
|
|
9392
|
+
renderEventRows();
|
|
9393
|
+
}
|
|
9394
|
+
}
|
|
9395
|
+
} catch (error) {
|
|
9396
|
+
reportError(error);
|
|
9397
|
+
}
|
|
9398
|
+
}
|
|
9399
|
+
|
|
9400
|
+
async function pollVisibleData() {
|
|
9401
|
+
if (destroyed || doc.hidden) return;
|
|
9402
|
+
if (!initialDataLoaded || !statusData) {
|
|
9403
|
+
await refresh();
|
|
9404
|
+
return;
|
|
9405
|
+
}
|
|
9406
|
+
try {
|
|
9407
|
+
const response = await fetchImpl(statusUrl, {
|
|
9408
|
+
cache: "no-store",
|
|
9409
|
+
headers: { accept: "application/json" },
|
|
9410
|
+
});
|
|
9411
|
+
if (response && response.ok !== false) {
|
|
9412
|
+
const data = await response.json();
|
|
9413
|
+
if (!destroyed && data) {
|
|
9414
|
+
const normalized = normalizeStatusPayload(data);
|
|
9415
|
+
statusData = { ...statusData, ...(normalized && normalized.partial === true ? normalized : data) };
|
|
9416
|
+
refreshStatusChrome();
|
|
9417
|
+
eventsCount.textContent = translate("events.loaded")
|
|
9418
|
+
.replace("{loaded}", String(eventState.items.length))
|
|
9419
|
+
.replace("{total}", String(eventState.total));
|
|
9420
|
+
}
|
|
9421
|
+
}
|
|
9422
|
+
} catch (error) {
|
|
9423
|
+
reportError(error);
|
|
9424
|
+
}
|
|
9425
|
+
await pollEventsIncremental();
|
|
9426
|
+
}
|
|
9427
|
+
|
|
8541
9428
|
function refresh() {
|
|
8542
9429
|
if (destroyed) return Promise.resolve();
|
|
8543
9430
|
void refreshSupervisor().catch(() => {
|
|
@@ -8657,16 +9544,32 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
8657
9544
|
agentsCount.disabled = disabled;
|
|
8658
9545
|
}
|
|
8659
9546
|
|
|
8660
|
-
function
|
|
8661
|
-
|
|
8662
|
-
|
|
8663
|
-
|
|
9547
|
+
function primeInitialUI() {
|
|
9548
|
+
for (const lane of LANE_ORDER) {
|
|
9549
|
+
if (laneRenderState.has(lane)) continue;
|
|
9550
|
+
const state = createLaneState(lane);
|
|
9551
|
+
state.initialLoading = true;
|
|
9552
|
+
state.count.textContent = "—";
|
|
9553
|
+
laneRenderState.set(lane, state);
|
|
8664
9554
|
}
|
|
8665
|
-
|
|
8666
|
-
|
|
9555
|
+
eventsLabel.textContent = translate("pane.events");
|
|
9556
|
+
eventsCount.textContent = "—";
|
|
9557
|
+
eventsFilter.disabled = true;
|
|
9558
|
+
eventsList.appendChild(eventsSkeleton);
|
|
9559
|
+
showStatusPlaceholders();
|
|
9560
|
+
}
|
|
9561
|
+
|
|
9562
|
+
function showStatusPlaceholders() {
|
|
9563
|
+
clearNode(statsNode);
|
|
9564
|
+
statsNode.appendChild(element(doc, "span", "hive-stat is-total", "—"));
|
|
9565
|
+
agentsCount.textContent = "—";
|
|
8667
9566
|
queenBadge.className = "hive-queen-badge is-hidden";
|
|
8668
9567
|
}
|
|
8669
9568
|
|
|
9569
|
+
function showSkeletonStats() {
|
|
9570
|
+
showStatusPlaceholders();
|
|
9571
|
+
}
|
|
9572
|
+
|
|
8670
9573
|
function showLoadingPanel(text) {
|
|
8671
9574
|
loadingText.textContent = text;
|
|
8672
9575
|
loadingPanel.className = "hive-loading";
|
|
@@ -8693,13 +9596,11 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
8693
9596
|
loadingTicks = 0;
|
|
8694
9597
|
loadingPanelError = "";
|
|
8695
9598
|
loadingPanel.className = "hive-loading is-hidden";
|
|
8696
|
-
loadingBadge.className = "hive-loading-badge";
|
|
8697
|
-
|
|
8698
|
-
skeletonNode.className = "hive-skeleton";
|
|
9599
|
+
loadingBadge.className = "hive-loading-badge is-hidden";
|
|
9600
|
+
skeletonNode.className = "hive-skeleton is-hidden";
|
|
8699
9601
|
showSkeletonStats();
|
|
8700
9602
|
setLoadingInteractions(true);
|
|
8701
9603
|
stopLoadingTimer();
|
|
8702
|
-
loadingTimer = scheduleTimeout(loadingTick, 1000);
|
|
8703
9604
|
}
|
|
8704
9605
|
|
|
8705
9606
|
function finishLoading() {
|
|
@@ -8731,7 +9632,7 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
8731
9632
|
function startPolling() {
|
|
8732
9633
|
if (destroyed || timer !== null || doc.hidden) return;
|
|
8733
9634
|
timer = schedule(() => {
|
|
8734
|
-
void
|
|
9635
|
+
if (!doc.hidden) void pollVisibleData();
|
|
8735
9636
|
}, intervalMs);
|
|
8736
9637
|
}
|
|
8737
9638
|
|
|
@@ -8741,13 +9642,15 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
8741
9642
|
stopPolling();
|
|
8742
9643
|
} else {
|
|
8743
9644
|
startPolling();
|
|
8744
|
-
void
|
|
9645
|
+
if (initialDataLoaded) void pollVisibleData();
|
|
9646
|
+
else void refresh();
|
|
8745
9647
|
}
|
|
8746
9648
|
}
|
|
8747
9649
|
|
|
8748
9650
|
if (typeof doc.addEventListener === "function") {
|
|
8749
9651
|
doc.addEventListener("visibilitychange", onVisibilityChange);
|
|
8750
9652
|
}
|
|
9653
|
+
primeInitialUI();
|
|
8751
9654
|
beginLoading();
|
|
8752
9655
|
startPolling();
|
|
8753
9656
|
void refresh();
|