Remove unused code and eliminate build warnings

Removed unused widget subscription system, cache utilities, error variants,
theme functions, and struct fields. Replaced subscription-based widgets
with direct metric filtering. Build now completes with zero warnings.
This commit is contained in:
2025-10-18 23:50:15 +02:00
parent 7f85a6436e
commit 0141a6e111
14 changed files with 15 additions and 764 deletions

View File

@@ -107,19 +107,6 @@ impl BackupWidget {
}
}
/// Format service status counts
fn format_service_counts(&self) -> String {
let completed = self.services_completed_count.unwrap_or(0);
let failed = self.services_failed_count.unwrap_or(0);
let disabled = self.services_disabled_count.unwrap_or(0);
let total = self.total_services.unwrap_or(0);
if failed > 0 {
format!("{}{}{}◯ ({})", completed, failed, disabled, total)
} else {
format!("{}{}◯ ({})", completed, disabled, total)
}
}
/// Format disk usage in format "usedGB/totalGB"
fn format_repo_size(&self) -> String {
@@ -160,30 +147,7 @@ impl BackupWidget {
}
}
/// Get status indicator symbol
fn get_status_symbol(&self) -> &str {
match self.overall_status {
Status::Ok => "",
Status::Warning => "",
Status::Critical => "",
Status::Unknown => "?",
}
}
/// Format size in GB to appropriate unit (kB/MB/GB)
fn format_size_gb(size_gb: f32) -> String {
if size_gb >= 1.0 {
format!("{:.1}GB", size_gb)
} else if size_gb >= 0.001 {
let size_mb = size_gb * 1024.0;
format!("{:.1}MB", size_mb)
} else if size_gb >= 0.000001 {
let size_kb = size_gb * 1024.0 * 1024.0;
format!("{:.0}kB", size_kb)
} else {
format!("{:.0}B", size_gb * 1024.0 * 1024.0 * 1024.0)
}
}
/// Format product name display
fn format_product_name(&self) -> String {

View File

@@ -118,36 +118,6 @@ impl ServicesWidget {
disk_str)
}
/// Format sub-service line (indented, no memory/disk columns) - returns text without icon for span formatting
fn format_sub_service_line(&self, name: &str, info: &ServiceInfo) -> String {
// Truncate long sub-service names to fit layout (accounting for indentation)
let short_name = if name.len() > 18 {
format!("{}...", &name[..15])
} else {
name.to_string()
};
// Sub-services show latency if available, otherwise status
let status_str = if let Some(latency) = info.latency_ms {
if latency < 0.0 {
"timeout".to_string()
} else {
format!("{:.0}ms", latency)
}
} else {
match info.widget_status {
Status::Ok => "active".to_string(),
Status::Warning => "inactive".to_string(),
Status::Critical => "failed".to_string(),
Status::Unknown => "unknown".to_string(),
}
};
// Indent sub-services with " ├─ " prefix (no memory/disk columns)
format!(" ├─ {:<20} {:<10}",
short_name,
status_str)
}
/// Create spans for sub-service with icon next to name
fn create_sub_service_spans(&self, name: &str, info: &ServiceInfo) -> Vec<ratatui::text::Span<'static>> {