- Add CollapsibleSection component with animated expand/collapse - Wrap all 6 resource sections (Nodes, VMs, PBS, Storage, Backups, Snapshots) with accordion UI - Add section icons and resource counts in headers - Add expand all / collapse all buttons for quick navigation - Make help banner dismissible with localStorage persistence - Add Ctrl/Cmd+F keyboard shortcut to focus search - Add keyboard shortcut hint badge on search input - Add icons to tab navigation for quick identification - Improve mobile tab labels with shorter text on small screens - Create reusable components: ThresholdBadge, ResourceCard, GlobalDefaultsRow - Create useCollapsedSections hook with localStorage persistence - Default less-used sections (Storage, Backups, Snapshots, PBS) to collapsed
16 KiB
Alert Thresholds Page Redesign
Executive Summary
The current Alert Thresholds page suffers from information overload, poor scalability, and a monolithic codebase (~3000 lines in a single component). This plan outlines a comprehensive redesign focused on:
- Collapsible accordion-based layout - Users can focus on what matters
- Component decomposition - Maintainable, testable code
- Progressive disclosure - Show summaries first, details on demand
- Responsive design - Works on all screen sizes
- Improved visual hierarchy - Clear information architecture
Current Problems
User Experience Issues
| Problem | Impact | Current State |
|---|---|---|
| Information overload | High | 6+ tables stacked vertically, no way to collapse |
| Wide tables | High | 7+ columns cause horizontal scroll |
| No visual hierarchy | Medium | Everything looks equal priority |
| Help banner always visible | Low | Takes space after users understand |
| No density controls | Medium | Can't see more resources at once |
| Unclear tab labels | Low | "Proxmox / PBS" bundles too much |
Technical Debt
| Problem | Impact |
|---|---|
ThresholdsTable.tsx is ~3000 lines |
Very hard to maintain |
| Tightly coupled rendering and state | Difficult to test |
| Repeated code patterns | Inconsistent behavior |
| No clear component boundaries | Hard to extend |
Proposed Architecture
New Component Structure
src/components/Alerts/Thresholds/
├── index.ts # Public exports
├── ThresholdsPage.tsx # Main page layout (~200 lines)
├── ThresholdsContext.tsx # State management context
├── sections/
│ ├── CollapsibleSection.tsx # Reusable accordion section
│ ├── ProxmoxNodesSection.tsx # Nodes-specific logic
│ ├── GuestsSection.tsx # VMs/CTs with node grouping
│ ├── StorageSection.tsx # Storage devices
│ ├── PBSSection.tsx # PBS servers
│ ├── BackupsSection.tsx # Backup thresholds
│ └── SnapshotsSection.tsx # Snapshot thresholds
├── components/
│ ├── ResourceCard.tsx # Expandable resource card
│ ├── ThresholdBadge.tsx # Colored threshold pill
│ ├── ThresholdEditor.tsx # Inline/modal threshold editing
│ ├── GlobalDefaultsRow.tsx # Editable defaults row
│ ├── SearchBar.tsx # Enhanced search/filter
│ └── ViewToggle.tsx # List/Compact toggle
├── hooks/
│ ├── useThresholds.ts # Threshold state management
│ ├── useCollapsedSections.ts # Persist collapsed state
│ └── useResourceFilter.ts # Search/filter logic
└── types.ts # TypeScript interfaces
Component Responsibilities
ThresholdsPage.tsx (~200 lines)
- Page layout and header
- Tab navigation (Proxmox/PBS, Mail Gateway, Hosts, Containers)
- Search bar and view toggle
- Renders appropriate section components based on active tab
CollapsibleSection.tsx (~150 lines)
- Reusable accordion wrapper
- Expand/collapse with animation
- Header with title, count, and actions
- Persists collapsed state to localStorage
ResourceCard.tsx (~200 lines)
- Compact collapsed view: Name, status, key thresholds as pills
- Expanded view: Full threshold editing grid
- Handles inline editing
- Shows "Custom" badge when overridden
ThresholdBadge.tsx (~50 lines)
- Colored pill showing threshold value
- Color indicates severity (green = conservative, red = aggressive, gray = disabled)
- Clickable to edit
New Layout Design
Page Structure
┌─────────────────────────────────────────────────────────────────┐
│ Alert Thresholds │
│ Tune resource thresholds and override rules │
├─────────────────────────────────────────────────────────────────┤
│ [🔍 Search resources...] [List ▼] [💡 Tips] │
├─────────────────────────────────────────────────────────────────┤
│ [Proxmox/PBS] [Mail Gateway] [Host Agents] [Containers] │
╞═════════════════════════════════════════════════════════════════╡
│ │
│ ▼ Proxmox Nodes 2 resources [Edit Defaults]│
│ ┌─────────────────────────────────────────────────────────────┐│
│ │ Global Defaults ││
│ │ [CPU 80%] [Mem 85%] [Disk 90%] [Temp 80°C] ││
│ ├─────────────────────────────────────────────────────────────┤│
│ │ ✓ delly Online [CPU 80%] [Mem 85%] [▼] ││
│ │ ✓ minipc Online [CPU 80%] [Mem 85%] [▼] ││
│ └─────────────────────────────────────────────────────────────┘│
│ │
│ ▼ VMs & Containers 24 resources [Edit Defaults]│
│ ┌─────────────────────────────────────────────────────────────┐│
│ │ Global Defaults ││
│ │ [CPU 80%] [Mem 85%] [Disk 90%] [I/O: Off] ││
│ ├─────────────────────────────────────────────────────────────┤│
│ │ ▼ delly 12 guests ││
│ │ ✓ homeassistant Running [Custom] [CPU 70%] [▼] ││
│ │ ✓ frigate Running [CPU 80%] [▼] ││
│ │ ✓ mqtt Running [CPU 80%] [▼] ││
│ │ ... 9 more ││
│ ├─────────────────────────────────────────────────────────────┤│
│ │ ► minipc 12 guests ││
│ └─────────────────────────────────────────────────────────────┘│
│ │
│ ► Storage 4 resources [Edit Defaults]│
│ │
│ ► PBS Servers 0 resources [Edit Defaults]│
│ │
│ ► Backups [Edit Defaults]│
│ │
│ ► Snapshots [Edit Defaults]│
│ │
└─────────────────────────────────────────────────────────────────┘
Expanded Resource Card
When a resource is expanded:
┌─────────────────────────────────────────────────────────────────┐
│ homeassistant [Custom] [Alerts: ON] [▲ Close]│
│ VM 100 • 192.168.1.100 • delly │
├─────────────────────────────────────────────────────────────────┤
│ │
│ Performance Thresholds │
│ ┌─────────────┬─────────────┬─────────────┬─────────────┐ │
│ │ CPU │ Memory │ Disk │ Temp │ │
│ │ [70 %] │ [85 %] │ [90 %] │ [80°C] │ │
│ └─────────────┴─────────────┴─────────────┴─────────────┘ │
│ │
│ I/O Thresholds │
│ ┌─────────────┬─────────────┬─────────────┬─────────────┐ │
│ │ Disk Read │ Disk Write │ Net In │ Net Out │ │
│ │ [Off] │ [Off] │ [Off] │ [Off] │ │
│ └─────────────┴─────────────┴─────────────┴─────────────┘ │
│ │
│ Offline Alerts: [Warning ▼] │
│ │
│ Note: [Production HA instance ] │
│ │
│ [Reset to Defaults] [Save] │
└─────────────────────────────────────────────────────────────────┘
Key UX Improvements
1. Progressive Disclosure
- Collapsed by default: Sections show count and summary only
- One-click expand: Click anywhere on header to expand
- Nested grouping: VMs/Containers grouped by node, nodes collapsible
- Remember state: Collapsed/expanded state persisted in localStorage
2. Visual Hierarchy
- Section headers: Large, bold, with resource counts
- Global defaults: Always visible at top of each section
- Custom indicators: Blue "Custom" badge for overridden resources
- Status colors: Green checkmarks for healthy, warning/critical indicators
3. Threshold Badges
Color-coded pills that instantly communicate threshold severity:
- Gray: Disabled (Off)
- Green: Conservative (≥85%)
- Yellow: Moderate (70-84%)
- Orange: Aggressive (50-69%)
- Red: Very aggressive (<50%)
4. Search & Filter
Enhanced command bar supporting:
- Simple text search:
homeassistant - Property filters:
node:delly,type:vm,custom:true - Threshold filters:
cpu>80,memory<70 - Combination:
node:delly custom:true
5. Responsive Design
- Wide screens: Full grid layout with all columns
- Medium screens: Hide I/O thresholds, show on expand
- Narrow screens: Single column cards, full expand for editing
Implementation Phases
Phase 1: Component Decomposition (Foundation)
Goal: Break up ThresholdsTable.tsx without changing UI
- Extract shared types to
types.ts - Create
ThresholdsContext.tsxfor state management - Extract
ResourceCard.tsxfrom table row rendering - Extract
ThresholdBadge.tsxfor threshold display - Create section components that wrap current logic
- Update imports and ensure tests pass
Deliverable: Same UI, cleaner code, easier to modify
Phase 2: Collapsible Sections
Goal: Add accordion behavior to sections
- Create
CollapsibleSection.tsxcomponent - Add collapse/expand animation
- Persist collapsed state to localStorage
- Add resource counts to headers
- Move "Edit Defaults" to section headers
Deliverable: Users can collapse sections they don't need
Phase 3: Resource Cards
Goal: Replace table rows with expandable cards
- Create compact card view (collapsed)
- Create full editor view (expanded)
- Add transition animation
- Implement inline editing
- Show threshold pills in collapsed view
Deliverable: Cleaner resource display, less horizontal scroll
Phase 4: Enhanced Filtering
Goal: Powerful search and filter
- Create
SearchBar.tsxwith command palette style - Implement filter parsers
- Add quick filter buttons
- Keyboard navigation support
- Search highlighting in results
Deliverable: Users can quickly find specific resources
Phase 5: Polish & Accessibility
Goal: Production-ready quality
- Keyboard navigation throughout
- Screen reader labels
- Focus management
- Loading states
- Error handling
- Empty states
- Responsive testing
Deliverable: Accessible, polished experience
Success Metrics
| Metric | Current | Target |
|---|---|---|
| Lines in main component | ~3000 | <300 |
| Horizontal scroll needed | Often | Rarely |
| Clicks to find resource | 2-5 + scroll | 1-2 |
| Time to understand page | ~30s | <10s |
| Mobile usability | Poor | Good |
Files to Create/Modify
New Files
src/components/Alerts/Thresholds/index.tssrc/components/Alerts/Thresholds/ThresholdsPage.tsxsrc/components/Alerts/Thresholds/ThresholdsContext.tsxsrc/components/Alerts/Thresholds/types.tssrc/components/Alerts/Thresholds/sections/CollapsibleSection.tsxsrc/components/Alerts/Thresholds/sections/ProxmoxNodesSection.tsxsrc/components/Alerts/Thresholds/sections/GuestsSection.tsxsrc/components/Alerts/Thresholds/sections/StorageSection.tsxsrc/components/Alerts/Thresholds/components/ResourceCard.tsxsrc/components/Alerts/Thresholds/components/ThresholdBadge.tsxsrc/components/Alerts/Thresholds/components/ThresholdEditor.tsxsrc/components/Alerts/Thresholds/components/GlobalDefaultsRow.tsxsrc/components/Alerts/Thresholds/hooks/useThresholds.tssrc/components/Alerts/Thresholds/hooks/useCollapsedSections.ts
Modified Files
src/components/Alerts/ThresholdsTable.tsx→ Eventually deprecatedsrc/pages/Alerts.tsx→ Use new ThresholdsPagesrc/components/Alerts/ResourceTable.tsx→ Simplify or deprecate
Risk Mitigation
- Incremental migration: Keep old component working during transition
- Feature flags: Can switch between old/new implementations
- Comprehensive tests: Add tests for new components before replacing old
- User feedback: Consider A/B testing or beta flag
Next Steps
- ✅ Create this implementation plan
- ⬜ Generate visual mockup for approval
- ⬜ Begin Phase 1: Component decomposition
- ⬜ Add tests for extracted components
- ⬜ Proceed through remaining phases