Repository navigation
Add a shell-level auto-refresh pause/resume control (#4222) - #4365
Merged
Merged
Conversation
Refs #4222. The web viewer's 60s refresh loop only paused while a tab was hidden. Add a real button in the shell chrome, usable on every page, that lets the operator pause/resume the tick directly. State persists in localStorage; resuming runs one refresh immediately. Also add the #/triage route (the alert-notebook deep link landing page) to the existing poll skip guard so the periodic tick does not re-render it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #4222.
Why
Erik's ruling on #4222 (alert-notebook MVP): the notebook must be LIVE, not frozen, and the operator needs a shell-level play/pause control for the 60s auto-refresh — usable on every page, not just the alert-notebook view. Before this change, the refresh loop in
app.jsonly paused automatically while the browser tab was hidden; there was no way for an operator to stop it on a visible tab (for example, while reading a notebook mid-incident) short of closing the tab.What changes
<button id="auto-refresh-toggle">added to the sidebar's brand block inindex.html, so it renders once and survives every route change (it lives outside#main, which every page render replaces).app.js:initAutoRefreshToggle()wires the button, sets its label/aria-label/titleto "Pause auto-refresh" / "Resume auto-refresh", and togglesaria-pressed.darling.autoRefreshPausedlocalStorage key (isAutoRefreshPaused/setAutoRefreshPaused), so it survives a reload or navigation.setIntervaltick and thevisibilitychangehandler — check!isAutoRefreshPaused()in addition to the existing!document.hiddencheck. The existing hidden-tab pause is unchanged; the new control is an independent gate on top of it.refresh()immediately, rather than waiting out whatever is left of the 60s window.refresh()'s existing poll-skip guard (editor/notebookEditor/alertEditor routes) now also skips#/triage— the alert-notebook deep-link landing page. The fix-shape draft's cost item said the periodic tick must not re-render triage every 60s; this reuses the exact same guard line the composer routes already use, computed before the sidebar/view-list/AG-nav reads start their own tick. Nothing else about the triage page changed.app.css: a small pill-style button (.auto-refresh-toggle) using the existing theme variables (--muted,--accent,--border,--fg); no new colors introduced.Darling.Tests/WebFetchLayerTests.csgets three new source pins (this repo has no JS test runner, so these are text-scan pins over the shipped module, same pattern as the existingAppJs_RefreshSkips...tests):AppJs_RefreshSkipsTriageRouteToo— pins thatrouteName === "triage"is in the guard and runs before this tick's own reads start.AppJs_HasAShellLevelAutoRefreshPauseThatGatesBothPollPaths— pins the localStorage key, the toggle functions, and that BOTH poll paths (interval + visibilitychange) check the paused flag, not justdocument.hidden.IndexHtml_HasTheAutoRefreshToggleButtonInTheShellChrome— pins the button markup lives in the shell chrome.Not in this slice: the
/api/alert-notebookendpoint, the notebookreadcell type, andviews.jsare other #4222 lanes' files and were not touched. #4191 (aborting superseded reads) is not implemented here; the new pause/resume gate is orthogonal to that later re-entrancy guard and does not block it.Test plan
dotnet build Darling/Darling.Tests/Darling.Tests.csproj -p:EnableWindowsTargeting=true— 0 warnings, 0 errors (macOS, cross-compiled; Darling.Tests targets net10.0-windows and cannot run here — CI decides the full class).dotnet build Lite.Tests/Lite.Tests.csproj -p:EnableWindowsTargeting=true— 0 warnings, 0 errors (untouched by this change; built to confirm nothing else broke).WebFetchLayerTests(new pins) — CI decides.Lite parity: N/A. This is Darling web viewer only; Lite is the WPF desktop app and has no browser tab or localStorage.
CHANGELOG entry
SECTION: Added
ENTRY:
REF:
[Add a shell-level auto-refresh pause/resume control (#4222) #4365]: Add a shell-level auto-refresh pause/resume control (#4222) #4365
For the coordinator
#auto-refresh-togglebutton inindex.html's sidebar brand block. Other Alert notebook MVP: #/triage renders a read-only notebook bound to the firing (blocking and deadlocks authored, every other family converted) #4222 slices (the/api/alert-notebookendpoint, thereadcell type) do not need to reference it directly — the pause state is read only byapp.js's ownrefresh()/interval/visibilitychange paths.refresh()'s route-skip guard inapp.jsnow includesrouteName === "triage". If a later slice adds its own poll-sensitive route, extend that same guard line rather than adding a second guard.darling.autoRefreshPaused(string"1"when paused, absent otherwise). No other slice should reuse this key.refresh(). The pause/resume gate here is additive and does not need changes when that lands.