Commit graph

6 commits

Author SHA1 Message Date
jedarden
9d29d757c7 feat(admin-ui): add 2PC settings preview endpoint and UI integration
Implements P5.19.b §13.19 - Indexes + Aliases sections with LIVE 2PC preview.

Backend changes:
- Add POST /indexes/{index}/settings preview endpoint
- Returns current vs proposed settings with SHA256 fingerprints
- Shows node targets, version info, and diff summary
- Displays full two-phase flow (propose/verify/commit) details
- Export compute_settings_diff for testing

Frontend changes:
- Update previewSettingsChanges() to call new preview endpoint
- Display current/proposed fingerprints, version info
- Show node targets and two-phase flow steps
- Render structured diff (added/removed/modified)

Tests:
- Add p13_19_admin_ui_2pc_preview.rs acceptance tests
- Verify fingerprint computation, diff detection, node targets

Closes: miroir-uhj.19.2
2026-05-25 00:03:35 -04:00
jedarden
5095faa613 feat(admin-ui): add canary failures and CDC backlog to Overview section
Implement P5.19.a §13.19 Admin UI Overview section enhancements:

- Add "Recent Canary Failures" card to Overview section
  - Displays up to 5 most recent failed canaries
  - Shows canary name, index, failed assertion count, and time of failure
  - Shows success message when all canaries are passing
- Add "CDC Backlog" card to Overview section
  - Displays pending CDC event count
  - Shows warning when backlog exists
- Add fetchCanaryStatus() and fetchCDCStatus() API functions
- Add renderCanaryFailures() and renderCDCBacklog() rendering functions
- Add formatTimeAgo() helper function for relative time display
- Update refreshData() to fetch canary/CDC status on Overview section

Data sourced from GET /_miroir/canaries endpoint (per plan §13.18).

Closes: miroir-uhj.19.1
2026-05-24 22:48:51 -04:00
jedarden
0f12192ef4 feat(admin-ui): implement Canaries, Shadow Diff, CDC Inspector, Metrics, Settings sections (P5.19.d)
Implements the remaining 5 Admin UI sections per plan §13.19:

**Canaries Section:**
- List/create/edit/disable canary tests
- Pass-fail heatmap visualization over time
- Seed-from-traffic capture flow
- Canary details modal with recent runs
- Integration with /_miroir/canaries API endpoints

**Shadow Diff Section:**
- Live stream of shadow traffic diffs
- Aggregated statistics (total shadowed, errors, error rate)
- Auto-refresh capability (5s interval)
- Integration with /_miroir/shadow/diff and /_miroir/shadow/stats

**CDC Inspector Section:**
- Live tail of change events via Server-Sent Events
- Filter by index and operation type
- Pause/resume/clear controls
- Current sequence and event count display
- Integration with /_miroir/changes endpoint

**Metrics Section:**
- Tabbed interface (Prometheus/Grafana)
- Prometheus query interface with quick-metric buttons
- Grafana iframe embedding support
- Common metrics: requests, duration, rebalance, degraded shards, AE mismatches

**Settings Section:**
- Read Miroir configuration with restart hints
- General and advanced settings categories
- Visual indicators for restart-required settings
- YAML editor for direct configuration edits

**Design:**
- Consistent with existing Admin UI patterns
- Responsive design with mobile support
- Modal dialogs for detailed views and editing
- Loading states and error handling
- CSS styles for all new components

**Files Modified:**
- crates/miroir-proxy/admin-ui/dist/index.html (+336 lines)
- crates/miroir-proxy/admin-ui/dist/app.js (+755 lines)
- crates/miroir-proxy/admin-ui/dist/styles.css (+240 lines)

Closes: miroir-uhj.19.4
2026-05-24 13:27:52 -04:00
jedarden
041cb5a2a8 feat(admin-ui): implement Documents, Query Sandbox, and Tasks sections (P5.19.c)
Implements plan §13.19 sections for document browsing, query debugging,
and task monitoring in the Admin Web UI.

**Documents Section:**
- Paginated document browser per index with configurable limit/offset
- Filter builder with support for equals, notEquals, gt, gte, lt, lte, in, exists operators
- CSV/NDJSON import via drag-and-drop triggering §13.9 streaming import
- Export documents to JSON
- Dynamic table rendering based on document fields

**Query Sandbox Section:**
- Filter builder for constructing complex query filters
- Sort builder for multi-field sorting with asc/desc
- Facet-request builder for faceted search
- Instant-run with per-shard latency breakdown display
- One-click §13.20 explain integration (query plan visualization)
- Side-by-side diff vs. shadow (§13.16) for comparing live vs shadow results

**Tasks Section:**
- Active and recent tasks display with filtering by status, index, and type
- Per-node breakdown showing task distribution
- Retry/cancel functionality where applicable
- Pagination for large task lists
- Detailed task view modal with error information

**UI/UX Enhancements:**
- Consistent styling with existing admin sections
- Responsive design for mobile and desktop
- Loading states and error handling
- Progress indicators for long-running operations

Closes: miroir-uhj.19.3
2026-05-24 13:11:56 -04:00
jedarden
f83e891214 feat(admin-ui): implement Indexes and Aliases sections with 2PC preview (P5.19.b)
Implements plan §13.19 Indexes and Aliases sections for the Admin Web UI.

**Indexes section:**
- List indexes with UID, primary key, document count, settings version, and fingerprint
- Create index modal with UID and primary key fields
- Delete index with confirmation (requires retyping index name)
- Settings viewer/editor with live 2PC preview:
  - Display current settings as JSON
  - Edit settings in textarea
  - Preview changes with diff view (added/removed/changed fields)
  - Show new fingerprint before commit
  - Apply changes via PATCH /indexes/{uid}/settings

**Aliases section:**
- List aliases with name, type (single/multi), current target, version, created date
- Create alias modal with type selection and target(s)
- Flip alias modal for single-target aliases (blue-green deployments)
- Delete alias with confirmation (requires retyping alias name)
- History timeline showing all alias flips with timestamps

**UI components added:**
- Modal system (overlay, content, header, body, footer)
- Form styles (inputs, labels, hints)
- Button styles (primary, secondary, danger)
- Settings editor (JSON display, textarea, diff view)
- Timeline component for alias history
- Responsive design for mobile devices

Closes: miroir-uhj.19.2
2026-05-24 12:40:21 -04:00
jedarden
5ff45371d5 feat(admin-ui): implement Overview and Topology sections (plan §13.19)
Implements P5.19.a - Overview and Topology sections of the Admin Web UI.

**Overview Section:**
- Cluster health summary (healthy/degraded status)
- Total shards and replication factor
- Node count with degraded nodes highlighted
- Replica group count
- Active operations display (rebalance progress)
- Recent activity placeholder

**Topology Section:**
- Node health table with status badges
- Shard coverage map (heatmap showing healthy/degraded/missing)
- Rebalance progress with per-shard migration status
- Group membership display

**Implementation Details:**
- Single-page app with hash-based navigation
- Responsive design: mobile (< 640px), tablet (640-1024px), desktop (≥ 1024px)
- Dark mode support via prefers-color-scheme
- Auto-refresh every 30 seconds
- API integration with GET /_miroir/topology, /shards, /rebalance/status
- Embedded assets via rust-embed with proper cache headers

**Files:**
- crates/miroir-proxy/admin-ui/dist/index.html - SPA structure
- crates/miroir-proxy/admin-ui/dist/styles.css - Responsive styling
- crates/miroir-proxy/admin-ui/dist/app.js - Data fetching and rendering
- crates/miroir-proxy/src/admin_ui.rs - Asset serving handler
- crates/miroir-proxy/Cargo.toml - Enable rust-embed include-exclude

Closes: miroir-uhj.19.1
2026-05-24 09:53:32 -04:00