Remove debug prints and unused code
All checks were successful
Build and Release / build-and-release (push) Successful in 1m19s

- Remove all debug println statements
- Remove unused service_tracker module
- Remove unused struct fields and methods
- Remove empty placeholder files (cpu.rs, memory.rs, defaults.rs)
- Fix all compiler warnings
- Clean build with zero warnings

Version bump to 0.1.159
This commit is contained in:
2025-11-25 12:19:04 +01:00
parent d5ce36ee18
commit df104bf940
21 changed files with 21 additions and 1459 deletions

View File

@@ -1 +0,0 @@
// This file is intentionally left minimal - CPU functionality is handled by the SystemWidget

View File

@@ -1 +0,0 @@
// This file is intentionally left minimal - Memory functionality is handled by the SystemWidget

View File

@@ -1,7 +1,5 @@
use cm_dashboard_shared::AgentData;
pub mod cpu;
pub mod memory;
pub mod services;
pub mod system;

View File

@@ -508,55 +508,6 @@ fn truncate_serial(serial: &str) -> String {
}
}
/// Helper function to render a drive in a MergerFS pool
fn render_mergerfs_drive<'a>(drive: &StorageDrive, tree_symbol: &'a str, lines: &mut Vec<Line<'a>>) {
let mut drive_details = Vec::new();
if let Some(temp) = drive.temperature {
drive_details.push(format!("T: {}°C", temp as i32));
}
if let Some(wear) = drive.wear_percent {
drive_details.push(format!("W: {}%", wear as i32));
}
let drive_text = if !drive_details.is_empty() {
format!("{} {}", drive.name, drive_details.join(" "))
} else {
drive.name.clone()
};
let mut drive_spans = vec![
Span::styled(tree_symbol, Typography::tree()),
];
drive_spans.extend(StatusIcons::create_status_spans(drive.status.clone(), &drive_text));
lines.push(Line::from(drive_spans));
}
/// Helper function to render a drive in a storage pool
fn render_pool_drive(drive: &StorageDrive, is_last: bool, lines: &mut Vec<Line<'_>>) {
let tree_symbol = if is_last { " └─" } else { " ├─" };
let mut drive_details = Vec::new();
if let Some(temp) = drive.temperature {
drive_details.push(format!("T: {}°C", temp as i32));
}
if let Some(wear) = drive.wear_percent {
drive_details.push(format!("W: {}%", wear as i32));
}
let drive_text = if !drive_details.is_empty() {
format!("{} {}", drive.name, drive_details.join(" "))
} else {
format!("{}", drive.name)
};
let mut drive_spans = vec![
Span::styled(tree_symbol, Typography::tree()),
Span::raw(" "),
];
drive_spans.extend(StatusIcons::create_status_spans(drive.status.clone(), &drive_text));
lines.push(Line::from(drive_spans));
}
impl SystemWidget {
/// Render backup section for display
fn render_backup(&self) -> Vec<Line<'_>> {
@@ -622,43 +573,6 @@ impl SystemWidget {
lines
}
/// Format time ago from timestamp
fn format_time_ago(&self, timestamp: u64) -> String {
let now = chrono::Utc::now().timestamp() as u64;
let seconds_ago = now.saturating_sub(timestamp);
let hours = seconds_ago / 3600;
let minutes = (seconds_ago % 3600) / 60;
if hours > 0 {
format!("{}h ago", hours)
} else if minutes > 0 {
format!("{}m ago", minutes)
} else {
"now".to_string()
}
}
/// Format time until from future timestamp
fn format_time_until(&self, timestamp: u64) -> String {
let now = chrono::Utc::now().timestamp() as u64;
if timestamp <= now {
return "overdue".to_string();
}
let seconds_until = timestamp - now;
let hours = seconds_until / 3600;
let minutes = (seconds_until % 3600) / 60;
if hours > 0 {
format!("in {}h", hours)
} else if minutes > 0 {
format!("in {}m", minutes)
} else {
"soon".to_string()
}
}
/// Render system widget
pub fn render(&mut self, frame: &mut Frame, area: Rect, hostname: &str, config: Option<&crate::config::DashboardConfig>) {
let mut lines = Vec::new();