Implement unified system widget with NixOS info, CPU, RAM, and Storage
- Create NixOS collector for version and active users detection - Add SystemWidget combining all system information in TODO.md layout - Replace separate CPU/Memory widgets with unified system display - Add tree structure for storage with drive temperature/wear info - Support NixOS version, active users, load averages, memory usage - Follow exact decimal formatting from specification
This commit is contained in:
87
CLAUDE.md
87
CLAUDE.md
@@ -6,52 +6,65 @@ A high-performance Rust-based TUI dashboard for monitoring CMTEC infrastructure.
|
||||
|
||||
## Implementation Strategy
|
||||
|
||||
### Next Phase: Systemd Collector Optimization (Based on TODO.md)
|
||||
### Current Implementation Status
|
||||
|
||||
**Current Status**: Reverted to working baseline (commit 245e546) after optimization broke service discovery.
|
||||
**Systemd Collector Optimization - COMPLETED** ✅
|
||||
|
||||
**Planned Implementation Steps** (step-by-step to avoid breaking functionality):
|
||||
All phases successfully implemented:
|
||||
- ✅ **Phase 1**: Exact name filtering implemented
|
||||
- ✅ **Phase 2**: User service collection removed
|
||||
- ✅ **Phase 3**: Wildcard pattern support added
|
||||
- ✅ **Phase 4**: Status caching and systemctl call optimization completed
|
||||
- ❌ **Phase 5**: Skipped (would increase systemctl calls vs current caching)
|
||||
|
||||
**Phase 1: Exact Name Filtering**
|
||||
- Replace `contains()` matching with exact name matching for service filters
|
||||
- Change `service_name.contains(pattern) || pattern.contains(service_name)` to `service_name == pattern`
|
||||
- Test: Ensure cmbox remains visible with exact service names in config
|
||||
- Commit and test after each change
|
||||
**Performance Results:**
|
||||
- Reduced from ~21 systemctl calls to 1 call every 10 seconds (configurable)
|
||||
- Fixed RwLock deadlock issues
|
||||
- Removed hardcoded discovery intervals
|
||||
|
||||
**Phase 2: Remove User Service Collection**
|
||||
- Remove all `sudo -u` systemctl commands for user services
|
||||
- Remove user_unit_files_output and user_units_output logic
|
||||
- Keep only system service discovery via `systemctl list-units --type=service`
|
||||
- Test: Verify system services still discovered correctly
|
||||
### Next Priority: System Panel Enhancement (Based on TODO.md)
|
||||
|
||||
**Phase 3: Add Wildcard Support**
|
||||
- Implement glob pattern matching for service filters
|
||||
- Support patterns like "nginx*" to match "nginx", "nginx-config-reload", etc.
|
||||
- Use fnmatch or similar for wildcard expansion
|
||||
- Test: Verify patterns work as expected
|
||||
**Target Layout:**
|
||||
```
|
||||
NixOS:
|
||||
Version: xxxxxxxxxx
|
||||
Active users: cm, simon
|
||||
CPU:
|
||||
● Load: 0.02 0.31 0.86 • 3000 MHz
|
||||
RAM:
|
||||
● Usage: 33% 2.6GB/7.6GB
|
||||
● /tmp: 0% 0B/2.0GB
|
||||
Storage:
|
||||
● root (Single):
|
||||
├─ ● nvme0n1 Temp: 40C Wear: 4%
|
||||
└─ ● 8% 75.0GB/906.2GB
|
||||
```
|
||||
|
||||
**Phase 4: Optimize systemctl Calls**
|
||||
- Cache service status information during discovery
|
||||
- Eliminate redundant `systemctl is-active` and `systemctl show` calls per service
|
||||
- Parse status from `systemctl list-units` output directly
|
||||
- Test: Ensure performance improvement without functionality loss
|
||||
**Implementation Tasks:**
|
||||
1. **NixOS Version Display**
|
||||
- Collect system version information
|
||||
- Show timestamp/version for latest nixos rebuild
|
||||
|
||||
**Phase 5: Include-Only Discovery**
|
||||
- Remove auto-discovery of all services
|
||||
- Only check services explicitly listed in service_name_filters
|
||||
- Skip systemctl discovery entirely, use configured list directly
|
||||
- Test: Verify only configured services are monitored
|
||||
2. **Active Users Display**
|
||||
- Implement user session detection
|
||||
- Show currently logged in/active users
|
||||
|
||||
**Critical Requirements:**
|
||||
- Each phase must be tested independently
|
||||
- cmbox must remain visible in dashboard after each change
|
||||
- No functionality regressions allowed
|
||||
- Commit each phase separately with descriptive messages
|
||||
3. **System Widget Layout Update**
|
||||
- Update dashboard to match new layout specification
|
||||
- Integrate NixOS version and user information
|
||||
|
||||
**Rollback Strategy:**
|
||||
- If any phase breaks functionality, immediately revert that specific commit
|
||||
- Do not attempt to "fix forward" - revert and redesign the problematic step
|
||||
- Each phase should be atomic and independently revertible
|
||||
### Future Priorities
|
||||
|
||||
**Keyboard Navigation (Dashboard):**
|
||||
- Change host switching to "Shift-Tab"
|
||||
- Add panel navigation with "Tab"
|
||||
- Add scrolling support for overflow content
|
||||
|
||||
**Remote Execution (Agent/Dashboard):**
|
||||
- Dynamic statusbar with context shortcuts
|
||||
- Remote nixos rebuild commands
|
||||
- Service start/stop/restart controls
|
||||
- Backup trigger functionality
|
||||
|
||||
## Core Architecture Principles - CRITICAL
|
||||
|
||||
|
||||
Reference in New Issue
Block a user