Fix transitional icons and selection highlighting visibility
All checks were successful
Build and Release / build-and-release (push) Successful in 1m15s
All checks were successful
Build and Release / build-and-release (push) Successful in 1m15s
Resolved issues with transitional service icons not being properly visible: - Removed 3-second timeout that was clearing pending transitions prematurely - Fixed selection highlighting disappearing when transitional icons appeared - Implemented conditional coloring for transitional icons: - Blue when service is not selected - Dark background color when service is selected (for visibility against blue selection) - Transitions now persist until actual service status changes occur Both selection highlighting and transitional icons are now visible simultaneously.
This commit is contained in:
parent
c3fc5a181d
commit
2618f6b62f
6
Cargo.lock
generated
6
Cargo.lock
generated
@ -270,7 +270,7 @@ checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d"
|
||||
|
||||
[[package]]
|
||||
name = "cm-dashboard"
|
||||
version = "0.1.27"
|
||||
version = "0.1.28"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"chrono",
|
||||
@ -291,7 +291,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cm-dashboard-agent"
|
||||
version = "0.1.27"
|
||||
version = "0.1.28"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
@ -314,7 +314,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cm-dashboard-shared"
|
||||
version = "0.1.27"
|
||||
version = "0.1.28"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"serde",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "cm-dashboard-agent"
|
||||
version = "0.1.28"
|
||||
version = "0.1.29"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "cm-dashboard"
|
||||
version = "0.1.28"
|
||||
version = "0.1.29"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
|
||||
@ -14,7 +14,7 @@ use app::Dashboard;
|
||||
|
||||
/// Get hardcoded version
|
||||
fn get_version() -> &'static str {
|
||||
"v0.1.28"
|
||||
"v0.1.29"
|
||||
}
|
||||
|
||||
/// Check if running inside tmux session
|
||||
|
||||
@ -462,15 +462,9 @@ impl TuiApp {
|
||||
fn clear_completed_transitions(&mut self, hostname: &str, service_metrics: &[&Metric]) {
|
||||
if let Some(host_widgets) = self.host_widgets.get_mut(hostname) {
|
||||
let mut completed_services = Vec::new();
|
||||
let now = Instant::now();
|
||||
|
||||
// Check each pending transition to see if real status has changed or timed out
|
||||
for (service_name, (command_type, original_status, start_time)) in &host_widgets.pending_service_transitions {
|
||||
// Clear if too much time has passed (3 seconds for redundant commands)
|
||||
if now.duration_since(*start_time).as_secs() > 3 {
|
||||
completed_services.push(service_name.clone());
|
||||
continue;
|
||||
}
|
||||
// Check each pending transition to see if real status has changed
|
||||
for (service_name, (command_type, original_status, _start_time)) in &host_widgets.pending_service_transitions {
|
||||
|
||||
// Look for status metric for this service
|
||||
for metric in service_metrics {
|
||||
|
||||
@ -559,17 +559,25 @@ impl ServicesWidget {
|
||||
// Parent services - check if this parent service has a pending transition using RAW service name
|
||||
if pending_transitions.contains_key(raw_service_name) {
|
||||
// Create spans with transitional status
|
||||
let (icon, status_text, status_color) = self.get_service_icon_and_status(raw_service_name, &ServiceInfo {
|
||||
let (icon, status_text, _) = self.get_service_icon_and_status(raw_service_name, &ServiceInfo {
|
||||
status: "".to_string(),
|
||||
memory_mb: None,
|
||||
disk_gb: None,
|
||||
latency_ms: None,
|
||||
widget_status: *line_status
|
||||
}, pending_transitions);
|
||||
|
||||
// Use blue for transitional icons when not selected, background color when selected
|
||||
let icon_color = if is_selected && !*is_sub && is_focused {
|
||||
Theme::background() // Dark background color for visibility against blue selection
|
||||
} else {
|
||||
Theme::highlight() // Blue for normal case
|
||||
};
|
||||
|
||||
vec![
|
||||
ratatui::text::Span::styled(format!("{} ", icon), Style::default().fg(status_color)),
|
||||
ratatui::text::Span::styled(format!("{} ", icon), Style::default().fg(icon_color)),
|
||||
ratatui::text::Span::styled(line_text.clone(), Style::default().fg(Theme::primary_text())),
|
||||
ratatui::text::Span::styled(format!(" {}", status_text), Style::default().fg(status_color)),
|
||||
ratatui::text::Span::styled(format!(" {}", status_text), Style::default().fg(icon_color)),
|
||||
]
|
||||
} else {
|
||||
StatusIcons::create_status_spans(*line_status, line_text)
|
||||
@ -578,8 +586,8 @@ impl ServicesWidget {
|
||||
|
||||
// Apply selection highlighting to parent services only, preserving status icon color
|
||||
// Only show selection when Services panel is focused
|
||||
// IMPORTANT: Don't override transitional icons that show pending commands
|
||||
if is_selected && !*is_sub && is_focused && !pending_transitions.contains_key(raw_service_name) {
|
||||
// Show selection highlighting even when transitional icons are present
|
||||
if is_selected && !*is_sub && is_focused {
|
||||
for (i, span) in spans.iter_mut().enumerate() {
|
||||
if i == 0 {
|
||||
// First span is the status icon - preserve its color
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "cm-dashboard-shared"
|
||||
version = "0.1.28"
|
||||
version = "0.1.29"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user