Unify sub-service display formatting for Info status
All checks were successful
Build and Release / build-and-release (push) Successful in 1m39s

Change docker images to use name field for all data instead of metrics,
matching the pattern used by torrent stats and VPN routes. Increase display
width for Status::Info sub-services from 18 to 50 characters to accommodate
longer informational text without truncation.

- Docker images now show: "image-name size: 994.0 MB" in name field
- Torrent stats show: "17 active, ↓ 2.5 MB/s, ↑ 1.2 MB/s" in name field
- Remove fixed-width padding for Info status sub-services
- Update version to v0.1.245
This commit is contained in:
Christoffer Martinsson 2025-12-02 11:36:27 +01:00
parent 7a3ed17952
commit 477724b4f4
6 changed files with 16 additions and 18 deletions

6
Cargo.lock generated
View File

@ -279,7 +279,7 @@ checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d"
[[package]]
name = "cm-dashboard"
version = "0.1.243"
version = "0.1.244"
dependencies = [
"anyhow",
"chrono",
@ -301,7 +301,7 @@ dependencies = [
[[package]]
name = "cm-dashboard-agent"
version = "0.1.243"
version = "0.1.244"
dependencies = [
"anyhow",
"async-trait",
@ -325,7 +325,7 @@ dependencies = [
[[package]]
name = "cm-dashboard-shared"
version = "0.1.243"
version = "0.1.244"
dependencies = [
"chrono",
"serde",

View File

@ -1,6 +1,6 @@
[package]
name = "cm-dashboard-agent"
version = "0.1.244"
version = "0.1.245"
edition = "2021"
[dependencies]

View File

@ -142,16 +142,11 @@ impl SystemdCollector {
// Add Docker images
let docker_images = self.get_docker_images();
for (image_name, image_status, image_size_mb) in docker_images {
let mut metrics = Vec::new();
metrics.push(SubServiceMetric {
label: "size".to_string(),
value: image_size_mb,
unit: Some("MB".to_string()),
});
for (image_name, _image_status, image_size_mb) in docker_images {
let metrics = Vec::new();
sub_services.push(SubServiceData {
name: image_name.to_string(),
name: format!("{} size: {:.1} MB", image_name, image_size_mb),
service_status: Status::Info, // Informational only, no status icon
metrics,
service_type: "image".to_string(),

View File

@ -1,6 +1,6 @@
[package]
name = "cm-dashboard"
version = "0.1.244"
version = "0.1.245"
edition = "2021"
[dependencies]

View File

@ -230,9 +230,12 @@ impl ServicesWidget {
info: &ServiceInfo,
is_last: bool,
) -> Vec<ratatui::text::Span<'static>> {
// Informational sub-services (Status::Info) can use more width since they don't show columns
let max_width = if info.widget_status == Status::Info { 50 } else { 18 };
// Truncate long sub-service names to fit layout (accounting for indentation)
let short_name = if name.len() > 18 {
format!("{}...", &name[..15])
let short_name = if name.len() > max_width {
format!("{}...", &name[..(max_width.saturating_sub(3))])
} else {
name.to_string()
};
@ -281,9 +284,9 @@ impl ServicesWidget {
format!(" {} ", tree_symbol),
Typography::tree(),
),
// Service name (no icon)
// Service name (no icon) - no fixed width padding for Info status
ratatui::text::Span::styled(
format!("{:<18} ", short_name),
short_name,
Style::default()
.fg(Theme::secondary_text())
.bg(Theme::background()),

View File

@ -1,6 +1,6 @@
[package]
name = "cm-dashboard-shared"
version = "0.1.244"
version = "0.1.245"
edition = "2021"
[dependencies]