refactor: major architecture refactoring and remote monitoring improvements#1
Merged
Conversation
* fmt implemented if they will be used in the future but have not yet been implemented. * If implementation has already been completed but there are no references to it, they are adopted to strengthen the code structure. * If the implementation is not yet done but is reserved for future use, exception handling added to prevent warnings from appearing.
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the view layer into modular components, extracts terminal and data logic into dedicated modules, and updates the runner to orchestrate these new pieces.
- Introduces
UiLoopandTerminalManagerfor clean initialization and terminal cleanup. - Extracts data collection into
DataCollectorand decomposes the monolithic runner intorunner.rs. - Splits UI rendering into submodules (
layout,tabs,process_renderer,device_renderers, etc.) for maintainability.
Reviewed Changes
Copilot reviewed 43 out of 44 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/view/ui_loop.rs | New asynchronous UI loop handling rendering and input |
| src/view/terminal_manager.rs | Terminal initialization and cleanup via RAII |
| src/view/runner.rs | Updated runner to use TerminalManager, DataCollector, and UiLoop |
| src/view/data_collector.rs | New module for local and remote data collection logic |
| src/view/event_handler.rs | Tab‐scrolling logic refined for left/right arrow handling |
| src/ui/layout.rs | Layout calculation utilities extracted |
| src/ui/tabs.rs | Tab drawing and visibility calculation |
| src/ui/process_renderer.rs | Extracted process table rendering |
| src/ui/device_renderers.rs | Extracted GPU/CPU/Memory/Storage rendering |
| src/utils/disk_filter.rs | New disk filter module with tests |
Comments suppressed due to low confidence (2)
src/view/data_collector.rs:22
- This function drops port information, so hosts distinguished only by port will collide. Consider preserving the full
host:portin the identifier or renaming to clarify that only the hostname is extracted.
fn extract_hostname_from_url(url: &str) -> String {
src/view/event_handler.rs:65
- The call to
size()is unqualified andsizeis not imported in this module, causing a compilation error. Adduse crossterm::terminal::size;at the top.
let (cols, _) = size().unwrap();
|
|
||
| impl Default for TerminalManager { | ||
| fn default() -> Self { | ||
| Self::new().unwrap_or_else(|_| Self { initialized: false }) |
There was a problem hiding this comment.
[nitpick] Silently swallowing initialization errors may hide failures at runtime. Consider logging the error or returning a Result instead of defaulting to initialized: false.
Suggested change
| Self::new().unwrap_or_else(|_| Self { initialized: false }) | |
| match Self::new() { | |
| Ok(manager) => manager, | |
| Err(e) => { | |
| eprintln!("Failed to initialize TerminalManager: {}", e); | |
| Self { initialized: false } | |
| } | |
| } |
This was referenced Nov 22, 2025
12 tasks
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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
This pull request represents a comprehensive refactoring of the all-smi codebase, transforming it from a monolithic structure to a modular, maintainable architecture while significantly enhancing remote monitoring capabilities and introducing advanced testing features.
Major Architectural Changes
Complete Modular Restructure
src/common/- Shared utilities and configurationsrc/metrics/- Data aggregation and coordinationsrc/network/- Remote monitoring and client functionalitysrc/ui/- User interface components and renderingsrc/view/- Application orchestration and data flowsrc/device/- Hardware abstraction and platform detectionsrc/utils/- Utility functions and helpersEnhanced Rendering System
Responsive Event Handling
Remote Monitoring Enhancements
Advanced Connection Management
📈 Live Statistics Integration
Testing and Development Features
Mock Server Capabilities
--failure-nodesparameterCode Quality Improvements
Technical Improvements
New Runner Architecture
UI/UX Enhancements
🔗 Network Layer Improvements
Documentation and Developer Experience
Documentation Updates
Development Tools
Breaking Changes
Module Reorganization
API Changes
Migration Guide
For Users
For Developers
Files Changed
Core Architecture
src/main.rs- Application entry point and orchestrationsrc/app_state.rs- Enhanced state managementsrc/common/*- New shared utilities modulesrc/metrics/*- New metrics coordination systemsrc/view/*- Refactored application logicUI System
src/ui/*- Complete UI system overhaulsrc/ui/dashboard.rs- Enhanced system dashboardsrc/ui/device_renderers.rs- Specialized device renderingsrc/ui/widgets.rs- Reusable UI componentsNetwork & Remote Monitoring
src/network/client.rs- Advanced HTTP clientsrc/network/metrics_parser.rs- Enhanced metrics parsingsrc/bin/all-smi-mock-server.rs- Enhanced mock serverDevelopment Tools
Makefile- New development workflow automationREADME.md- Updated documentationTest Plan
Performance Impact
Improvements
Metrics
This refactoring establishes all-smi as a robust, maintainable, and extensible monitoring solution with enterprise-grade remote monitoring capabilities and comprehensive testing tools.