Add pending upload indicator to UI
This commit introduces a visual indicator in the UI to show when a case has pending uploads. The `WorkerSnapshot` struct has been updated to include a `pending_case_ids` field, which is an `Arc<HashSet<Uuid>>`. This set stores the IDs of cases that currently have files in the pending directory. The `run_loop` function now populates this set by scanning the pending directory and collecting the `case_id`s of any files found. This snapshot is then sent to the UI via the `worker_rx` channel. In the `DoctateApp::ui` method, the `pending_ids` set is cloned from the worker's snapshot. If a case's ID is present in this set, a distinct "⬆" prefix and a yellow label are used to highlight it, signifying an ongoing or pending upload. Otherwise, the standard label is used.
This commit is contained in:
@@ -483,6 +483,14 @@ impl DoctateApp {
|
||||
return None;
|
||||
}
|
||||
|
||||
// Pending-upload lookup for the badge. Cheap clone (Arc) from the
|
||||
// worker's last published snapshot; empty set if no worker yet.
|
||||
let pending_ids = self
|
||||
.worker_rx
|
||||
.as_ref()
|
||||
.map(|rx| rx.borrow().pending_case_ids.clone())
|
||||
.unwrap_or_default();
|
||||
|
||||
let mut action = None;
|
||||
// Ready-for-new means the user-intent state is Idle AND no ffmpeg
|
||||
// instance is still flushing. Upload-queue depth does NOT gate.
|
||||
@@ -499,7 +507,17 @@ impl DoctateApp {
|
||||
.as_deref()
|
||||
.map(str::to_owned)
|
||||
.unwrap_or_else(|| "⏳".to_owned());
|
||||
ui.label(format!("{time_str} · {oneliner}"));
|
||||
let has_pending = pending_ids.contains(&marker.case_id);
|
||||
let line = if has_pending {
|
||||
format!("⬆ {time_str} · {oneliner}")
|
||||
} else {
|
||||
format!("{time_str} · {oneliner}")
|
||||
};
|
||||
if has_pending {
|
||||
ui.colored_label(egui::Color32::from_rgb(200, 140, 0), line);
|
||||
} else {
|
||||
ui.label(line);
|
||||
}
|
||||
|
||||
ui.horizontal(|ui| {
|
||||
if ui
|
||||
|
||||
Reference in New Issue
Block a user