Clean up warnings and add Status::Pending support to dashboard UI
This commit is contained in:
@@ -61,46 +61,6 @@ impl NotificationManager {
|
||||
})
|
||||
}
|
||||
|
||||
/// Update metric status and return status change if any
|
||||
pub fn update_metric_status(
|
||||
&mut self,
|
||||
metric_name: &str,
|
||||
new_status: Status,
|
||||
) -> Option<StatusChange> {
|
||||
let old_status = self
|
||||
.metric_statuses
|
||||
.get(metric_name)
|
||||
.copied()
|
||||
.unwrap_or(Status::Unknown);
|
||||
|
||||
|
||||
// Check if status actually changed
|
||||
if old_status != new_status {
|
||||
// Update stored status only on change
|
||||
self.metric_statuses
|
||||
.insert(metric_name.to_string(), new_status);
|
||||
|
||||
// Save status to disk only when status changes
|
||||
self.save_status();
|
||||
debug!(
|
||||
"Status change detected for {}: {:?} -> {:?}",
|
||||
metric_name, old_status, new_status
|
||||
);
|
||||
|
||||
Some(StatusChange {
|
||||
metric_name: metric_name.to_string(),
|
||||
old_status,
|
||||
new_status,
|
||||
timestamp: Utc::now(),
|
||||
details: None, // Will be populated when needed
|
||||
})
|
||||
} else {
|
||||
// No status change - update stored status but don't save to disk
|
||||
self.metric_statuses
|
||||
.insert(metric_name.to_string(), new_status);
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
/// Send notification for status change
|
||||
pub async fn send_status_change_notification(
|
||||
@@ -249,11 +209,6 @@ impl NotificationManager {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Process any pending notifications (placeholder)
|
||||
pub async fn process_pending(&mut self) {
|
||||
// Placeholder for batch notification processing
|
||||
// Could be used for email queue processing, etc.
|
||||
}
|
||||
|
||||
/// Load status from disk
|
||||
fn load_status(file_path: &str) -> (HashMap<String, Status>, HashMap<String, String>) {
|
||||
|
||||
Reference in New Issue
Block a user