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:
@@ -3,6 +3,7 @@ use ratatui::widgets::{Block, Borders};
|
||||
use cm_dashboard_shared::Status;
|
||||
|
||||
/// Complete terminal color palette matching your configuration
|
||||
#[allow(dead_code)]
|
||||
pub struct TerminalColors {
|
||||
// Primary colors
|
||||
pub foreground: Color,
|
||||
@@ -86,6 +87,7 @@ impl Default for TerminalColors {
|
||||
/// Comprehensive theming engine for dashboard consistency
|
||||
pub struct Theme;
|
||||
|
||||
#[allow(dead_code)]
|
||||
impl Theme {
|
||||
fn colors() -> &'static TerminalColors {
|
||||
static COLORS: std::sync::OnceLock<TerminalColors> = std::sync::OnceLock::new();
|
||||
@@ -243,22 +245,6 @@ impl StatusIcons {
|
||||
}
|
||||
}
|
||||
|
||||
/// Get style for status-colored text (icon + text in status color)
|
||||
pub fn get_status_style(status: Status) -> Style {
|
||||
let color = match status {
|
||||
Status::Ok => Theme::success(), // Green
|
||||
Status::Warning => Theme::warning(), // Yellow
|
||||
Status::Critical => Theme::error(), // Red
|
||||
Status::Unknown => Theme::muted_text(), // Gray
|
||||
};
|
||||
Style::default().fg(color).bg(Theme::background())
|
||||
}
|
||||
|
||||
/// Format text with status icon (entire line uses status color)
|
||||
pub fn format_with_status(status: Status, text: &str) -> String {
|
||||
let icon = Self::get_icon(status);
|
||||
format!("{} {}", icon, text)
|
||||
}
|
||||
|
||||
/// Create spans with status icon colored and text in foreground color
|
||||
pub fn create_status_spans(status: Status, text: &str) -> Vec<ratatui::text::Span<'static>> {
|
||||
@@ -282,17 +268,11 @@ impl StatusIcons {
|
||||
]
|
||||
}
|
||||
|
||||
/// Get style for secondary text with status icon (icon in status color, text in secondary)
|
||||
pub fn get_secondary_with_status_style(_status: Status) -> Style {
|
||||
// For now, use secondary color but we could enhance this later
|
||||
// The icon color will come from the status color in the formatted text
|
||||
Style::default().fg(Theme::secondary_text()).bg(Theme::background())
|
||||
}
|
||||
}
|
||||
|
||||
impl Components {
|
||||
/// Standard widget block with title using bright foreground for title
|
||||
pub fn widget_block(title: &str) -> Block {
|
||||
pub fn widget_block(title: &str) -> Block<'_> {
|
||||
Block::default()
|
||||
.title(title)
|
||||
.borders(Borders::ALL)
|
||||
@@ -300,40 +280,6 @@ impl Components {
|
||||
.title_style(Style::default().fg(Theme::border_title()).bg(Theme::background()))
|
||||
}
|
||||
|
||||
/// Status bar style
|
||||
pub fn status_bar() -> Style {
|
||||
Style::default()
|
||||
.fg(Theme::muted_text())
|
||||
.bg(Theme::background())
|
||||
}
|
||||
|
||||
/// CPU usage styling based on percentage
|
||||
pub fn cpu_usage_style(percentage: u16) -> Style {
|
||||
Style::default()
|
||||
.fg(Theme::cpu_color(percentage))
|
||||
.bg(Theme::background())
|
||||
}
|
||||
|
||||
/// Memory usage styling based on percentage
|
||||
pub fn memory_usage_style(percentage: u16) -> Style {
|
||||
Style::default()
|
||||
.fg(Theme::memory_color(percentage))
|
||||
.bg(Theme::background())
|
||||
}
|
||||
|
||||
/// Service status styling
|
||||
pub fn service_status_style(status: Status) -> Style {
|
||||
Style::default()
|
||||
.fg(Theme::status_color(status))
|
||||
.bg(Theme::background())
|
||||
}
|
||||
|
||||
/// Backup item styling
|
||||
pub fn backup_item_style(status: Status) -> Style {
|
||||
Style::default()
|
||||
.fg(Theme::status_color(status))
|
||||
.bg(Theme::background())
|
||||
}
|
||||
}
|
||||
|
||||
impl Typography {
|
||||
@@ -367,10 +313,4 @@ impl Typography {
|
||||
.add_modifier(Modifier::BOLD)
|
||||
}
|
||||
|
||||
/// Status text with dynamic colors
|
||||
pub fn status(status: Status) -> Style {
|
||||
Style::default()
|
||||
.fg(Theme::status_color(status))
|
||||
.bg(Theme::background())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user