redux of the worker queue

This commit is contained in:
Connor Johnstone
2026-03-23 18:37:46 -04:00
parent 59a26c18f3
commit 36345b12ee
12 changed files with 813 additions and 516 deletions

View File

@@ -365,6 +365,35 @@ pub fn dashboard() -> Html {
</div>
</div>
// Work Queue Progress
if let Some(ref wq) = s.work_queue {
if wq.download.pending + wq.download.running + wq.tag.pending + wq.tag.running + wq.organize.pending + wq.organize.running > 0
|| wq.download.completed + wq.tag.completed + wq.organize.completed > 0
{
<div class="card">
<h3>{ "Pipeline Progress" }</h3>
<table>
<thead>
<tr><th>{ "Step" }</th><th>{ "Pending" }</th><th>{ "Running" }</th><th>{ "Done" }</th><th>{ "Failed" }</th></tr>
</thead>
<tbody>
{ for [("Download", &wq.download), ("Index", &wq.index), ("Tag", &wq.tag), ("Organize", &wq.organize)].iter().map(|(name, c)| {
html! {
<tr>
<td>{ name }</td>
<td>{ c.pending }</td>
<td>{ if c.running > 0 { html! { <span class="badge badge-accent">{ c.running }</span> } } else { html! { { "0" } } } }</td>
<td>{ c.completed }</td>
<td>{ if c.failed > 0 { html! { <span class="badge badge-danger">{ c.failed }</span> } } else { html! { { "0" } } } }</td>
</tr>
}
})}
</tbody>
</table>
</div>
}
}
// Background Tasks (always show if there are tasks or scheduled items)
if !s.tasks.is_empty() || has_scheduled {
<div class="card">

View File

@@ -225,7 +225,10 @@ pub struct TaskRef {
#[derive(Debug, Clone, PartialEq, Deserialize)]
pub struct PipelineRef {
#[serde(default)]
pub task_ids: Vec<String>,
#[serde(default)]
pub pipeline_id: Option<String>,
}
// --- Status ---
@@ -246,6 +249,10 @@ pub struct Status {
pub tasks: Vec<TaskInfo>,
#[serde(default)]
pub scheduled: Option<ScheduledTasks>,
#[serde(default)]
pub work_queue: Option<WorkQueueStats>,
#[serde(default)]
pub scheduler: Option<serde_json::Value>,
}
#[derive(Debug, Clone, PartialEq, Deserialize)]
@@ -254,6 +261,22 @@ pub struct ScheduledTasks {
pub next_monitor: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize)]
pub struct WorkQueueCounts {
pub pending: u64,
pub running: u64,
pub completed: u64,
pub failed: u64,
}
#[derive(Debug, Clone, PartialEq, Deserialize)]
pub struct WorkQueueStats {
pub download: WorkQueueCounts,
pub index: WorkQueueCounts,
pub tag: WorkQueueCounts,
pub organize: WorkQueueCounts,
}
#[derive(Debug, Clone, PartialEq, Deserialize)]
pub struct LibrarySummary {
pub total_items: u64,