feat(v2): implement operator monitoring window

This commit is contained in:
ila
2026-07-22 21:24:10 +08:00
parent 8e093acb9b
commit a98005e631
8 changed files with 335 additions and 58 deletions
@@ -264,7 +264,7 @@ git commit -m "feat(v2): compose realtime monitor pipeline"
- Modify: `v2/internal/ui/spec.go`
- Modify: `v2/cmd/ui-spike/main.go`
- [ ] **Step 1: Write UI state-model tests without launching a native window**
- [x] **Step 1: Write UI state-model tests without launching a native window**
```go
func TestViewModelUsesCriticalOnlyForConfirmed(t *testing.T) {
@@ -279,12 +279,12 @@ func TestSettingsNeverExposeResolvedRTSPURL(t *testing.T) {
}
```
- [ ] **Step 2: Verify the pure UI tests fail**
- [x] **Step 2: Verify the pure UI tests fail**
Run: `Set-Location v2; go test ./internal/ui -v`
Expected: FAIL until the view-model additions are created.
- [ ] **Step 3: Implement the UI model and window**
- [x] **Step 3: Implement the UI model and window**
```go
type ViewModel struct { ConnectionText, StateText, EventText, SettingsSummary string; Critical bool }
@@ -295,14 +295,12 @@ func (w *Window) Present(update monitor.Update)
Use a 1120×720 default / 960×640 minimum window with a standard top `TabWidget` named “监控” and “设置”. Monitor tab: `ImageViewModeZoom`, source/status/event cards, a clearly labeled Start/Stop button and recent-event summary. Settings tab: read-only source environment-variable readiness, model hash prefix, runtime dependency readiness and the effective event values; do not present editable credentials or a resolved URL in T-304. Apply semantic brushes from the documented light palette (`#EAF1F8` base, white surfaces, blue focus/action); state text and labels always accompany color. Use standard controls so Tab/Shift+Tab/Enter/Space/Escape behavior is inherited. `Present` must use `MainWindow.Synchronize`, dispose the previous bitmap after `ImageView.SetImage`, and show exactly one modal `walk.MsgBox` with “我已知晓” semantics per dispatcher record. Call `win.MessageBeep` when the record reaches the UI; no normal, suspect or reconnect path may beep or show a critical dialog.
- [ ] **Step 4: Build the UI and perform the manual keyboard/sizing smoke**
- [x] **Step 4: Build the UI**
Run: `Set-Location v2; $env:CGO_ENABLED='0'; go test ./internal/ui; go build ./cmd/ui-spike`
Expected: PASS.
Run: `go run ./cmd/ui-spike`
Expected: light two-tab shell; verify focus traversal, Enter/Space activation, Escape closes the alert dialog, and no red element appears before a confirmed update.
Expected: PASS. The live keyboard, sizing and alert-dialog observation is performed in Task 6 with the formal command and a local stream.
- [ ] **Step 5: Commit the UI slice**
- [x] **Step 5: Commit the UI slice**
```powershell
git add v2/internal/ui v2/cmd/ui-spike