feature(web/monitor): start session modal with pre-flight + 5-min confirmation#172
Open
jamby77 wants to merge 1 commit into
Open
Conversation
12 tasks
f1a2480 to
40cea3b
Compare
ab6acde to
36dedbc
Compare
40cea3b to
b90faee
Compare
36dedbc to
b90faee
Compare
3486890 to
d6a775f
Compare
…firmation
A modal launched from the Monitor page lets the operator start a capture
session with full pre-flight context: provider restrictions, ACL state
(with the exact ACL SETUSER snippet when +monitor is missing), the
health-gate verdict for the moment, and a throughput / capture-size
estimate based on current ops/sec × duration.
- New components (one-per-file convention):
- pages/monitor/start-session-modal.tsx (form + lifecycle)
- pages/monitor/preflight-panel.tsx (4-section read-only display)
- API client gains preflight() and startSession()
- Monitor.tsx grows a Start session button in the header that opens
the modal; on success, invalidates the sessions list query so the
new row shows immediately rather than waiting for the next 5s poll
- Form fields:
- duration: integer + unit selector (seconds / minutes); minimum 1
- requestedBy: optional free-text, sent to the API and shown in the
sessions table
- 5-minute confirmation guard: if the chosen duration exceeds 5 min,
the first Submit click swaps the panel to a yellow warning ("Sessions
over 5 minutes can produce significant load. Confirm to proceed.")
and changes the primary button to "Yes, start session". Second click
fires the start.
- Pre-flight refreshes whenever the duration changes (so the size
estimate stays accurate as the user adjusts), via a useEffect with
cancelled-flag cleanup to avoid races.
- State reset on close: duration/unit/requestedBy/preflight/confirming/
error all clear when the modal closes, so reopening always shows
defaults. (Caught during live testing — a pre-fix run had carry-over
state from a previous open.)
- Confirmation auto-clears when duration drops back below 5 minutes.
Verification (Playwright, live):
- Click Start session → modal opens, pre-flight panel populates within
~1s with provider 'self-hosted', ACL hasMonitor:true, health:healthy,
estimated 3 lines / 144 B for the default 30s.
- Duration to 6 minutes → first Submit shows the amber confirmation
panel with the exact spec wording; primary button becomes
"Yes, start session".
- Reset to 3s + requestedBy=pr9-final → Submit → modal closes, new
row appears in the table within the 5s poll window with the
requestedBy value, status running → completed.
- Reopening the modal after Cancel shows defaults (30s, no
requestedBy) — fixes a state-carry-over bug spotted during testing.
Screenshots:
- docs/assets/pr9-start-session-modal.png (initial pre-flight)
- docs/assets/pr9-confirmation-dialog.png (5-min guard)
Part of PR 9 of 25 in
docs/plans/specs/monitor-command/plan-implementation.md.
8aefbac to
a86cd6b
Compare
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Summary
PR 9 of 25 in
docs/plans/specs/monitor-command/plan-implementation.md. Stacked on top of #171 (PR 8). Lands the start-session modal with the full pre-flight context the spec describes: provider restrictions, ACL state with the exactACL SETUSERsnippet when+monitoris missing, the health-gate verdict, and a throughput / capture-size estimate.pages/monitor/start-session-modal.tsx— form + lifecyclepages/monitor/preflight-panel.tsx— 4-section read-only displaypreflight()andstartSession()Monitor.tsxgrows a Start session button in the header that opens the modal; on success, invalidates the sessions list query so the new row shows immediately rather than waiting for the next 5 s polluseEffectwith cancelled-flag cleanup.Test plan
pnpm --filter web exec tsc --noEmit→ exit 0MONITOR_DEV_PREVIEW=true pnpm dev:apiandVITE_MONITOR_DEV_PREVIEW=true pnpm dev:webrequestedBy:test→ modal closes; row appears in the table within the 5 s poll window with thatrequestedByvalue; status transitions running → completedNotes for reviewers
useEffect(open)only clearedpreflight/confirming/erroron close;duration/unit/requestedBycarried over. A user who closed the modal at 6 min would still see 6 min when they reopened — and the unrelated state actually tripped the confirmation guard on what looked like a fresh open. Now everything resets on close.docs/assets/:pr9-start-session-modal.png(initial pre-flight)pr9-confirmation-dialog.png(5-min guard)Stacked PR
Base branch is
feature/monitor-web-sessions-list(#171), so the diff shown is ONLY PR 9 changes.