Simplify backup timestamp display with raw TOML format and remove spacing
All checks were successful
Build and Release / build-and-release (push) Successful in 1m41s
All checks were successful
Build and Release / build-and-release (push) Successful in 1m41s
Replace timestamp parsing with direct display of start_time from backup TOML file to ensure timestamp always appears regardless of format. Remove empty line spacing above backup section for compact layout. Changes: - Remove parsed timestamp fields and use raw start_time string from TOML - Display backup time directly from TOML file without parsing - Remove blank line above backup section for tighter layout - Simplify BackupData structure by removing last_run and next_scheduled fields Version bump to v0.1.150
This commit is contained in:
@@ -39,8 +39,7 @@ pub struct SystemWidget {
|
||||
|
||||
// Backup metrics
|
||||
backup_status: String,
|
||||
backup_last_run: Option<u64>,
|
||||
backup_next_scheduled: Option<u64>,
|
||||
backup_start_time_raw: Option<String>,
|
||||
backup_disk_serial: Option<String>,
|
||||
backup_disk_usage_percent: Option<f32>,
|
||||
backup_disk_used_gb: Option<f32>,
|
||||
@@ -104,8 +103,7 @@ impl SystemWidget {
|
||||
tmpfs_mounts: Vec::new(),
|
||||
storage_pools: Vec::new(),
|
||||
backup_status: "unknown".to_string(),
|
||||
backup_last_run: None,
|
||||
backup_next_scheduled: None,
|
||||
backup_start_time_raw: None,
|
||||
backup_disk_serial: None,
|
||||
backup_disk_usage_percent: None,
|
||||
backup_disk_used_gb: None,
|
||||
@@ -196,8 +194,7 @@ impl Widget for SystemWidget {
|
||||
// Extract backup data
|
||||
let backup = &agent_data.backup;
|
||||
self.backup_status = backup.status.clone();
|
||||
self.backup_last_run = backup.last_run;
|
||||
self.backup_next_scheduled = backup.next_scheduled;
|
||||
self.backup_start_time_raw = backup.start_time_raw.clone();
|
||||
self.backup_last_size_gb = backup.last_backup_size_gb;
|
||||
|
||||
if let Some(disk) = &backup.repository_disk {
|
||||
@@ -427,27 +424,17 @@ impl SystemWidget {
|
||||
let disk_spans = StatusIcons::create_status_spans(backup_status, &disk_text);
|
||||
lines.push(Line::from(disk_spans));
|
||||
|
||||
// Last backup time
|
||||
if let Some(last_run) = self.backup_last_run {
|
||||
let time_ago = self.format_time_ago(last_run);
|
||||
let last_text = if let Some(size) = self.backup_last_size_gb {
|
||||
format!("Last: {} ({:.1}GB)", time_ago, size)
|
||||
// Show backup time from TOML if available
|
||||
if let Some(start_time) = &self.backup_start_time_raw {
|
||||
let time_text = if let Some(size) = self.backup_last_size_gb {
|
||||
format!("Time: {} ({:.1}GB)", start_time, size)
|
||||
} else {
|
||||
format!("Last: {}", time_ago)
|
||||
format!("Time: {}", start_time)
|
||||
};
|
||||
|
||||
lines.push(Line::from(vec![
|
||||
Span::styled(" ├─ ", Typography::tree()),
|
||||
Span::styled(last_text, Typography::secondary())
|
||||
]));
|
||||
}
|
||||
|
||||
// Next backup time
|
||||
if let Some(next_scheduled) = self.backup_next_scheduled {
|
||||
let next_text = format!("Next: {}", self.format_time_until(next_scheduled));
|
||||
lines.push(Line::from(vec![
|
||||
Span::styled(" ├─ ", Typography::tree()),
|
||||
Span::styled(next_text, Typography::secondary())
|
||||
Span::styled(time_text, Typography::secondary())
|
||||
]));
|
||||
}
|
||||
|
||||
@@ -602,9 +589,6 @@ impl SystemWidget {
|
||||
|
||||
// Backup section (if available)
|
||||
if self.backup_status != "unavailable" && self.backup_status != "unknown" {
|
||||
lines.push(Line::from(vec![
|
||||
Span::styled("", Typography::secondary()) // Empty line for spacing
|
||||
]));
|
||||
lines.push(Line::from(vec![
|
||||
Span::styled("Backup:", Typography::widget_title())
|
||||
]));
|
||||
|
||||
Reference in New Issue
Block a user