fixed some unwatch cleanup stuff
This commit is contained in:
@@ -34,6 +34,8 @@ pub fn dashboard() -> Html {
|
||||
let status = use_state(|| None::<Status>);
|
||||
let error = use_state(|| None::<String>);
|
||||
let message = use_state(|| None::<String>);
|
||||
let pipeline_was_active = use_state(|| false);
|
||||
let pipeline_complete = use_state(|| false);
|
||||
|
||||
// Fetch status function
|
||||
let fetch_status = {
|
||||
@@ -280,6 +282,72 @@ pub fn dashboard() -> Html {
|
||||
})
|
||||
};
|
||||
|
||||
let pipeline_progress_html = if let Some(ref wq) = s.work_queue {
|
||||
let active = wq.download.pending
|
||||
+ wq.download.running
|
||||
+ wq.index.pending
|
||||
+ wq.index.running
|
||||
+ wq.tag.pending
|
||||
+ wq.tag.running
|
||||
+ wq.organize.pending
|
||||
+ wq.organize.running
|
||||
+ wq.enrich.pending
|
||||
+ wq.enrich.running;
|
||||
|
||||
// Track pipeline active→inactive transition
|
||||
if active > 0 {
|
||||
if !*pipeline_was_active {
|
||||
pipeline_was_active.set(true);
|
||||
pipeline_complete.set(false);
|
||||
}
|
||||
} else if *pipeline_was_active {
|
||||
pipeline_was_active.set(false);
|
||||
pipeline_complete.set(true);
|
||||
}
|
||||
|
||||
if active > 0 {
|
||||
html! {
|
||||
<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), ("Enrich", &wq.enrich)].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>
|
||||
}
|
||||
} else if *pipeline_complete {
|
||||
html! {
|
||||
<div class="card" style="border-color: var(--success);">
|
||||
<p style="color: var(--success);">{ "Pipeline run complete!" }</p>
|
||||
</div>
|
||||
}
|
||||
} else {
|
||||
html! {}
|
||||
}
|
||||
} else if *pipeline_complete {
|
||||
html! {
|
||||
<div class="card" style="border-color: var(--success);">
|
||||
<p style="color: var(--success);">{ "Pipeline run complete!" }</p>
|
||||
</div>
|
||||
}
|
||||
} else {
|
||||
html! {}
|
||||
};
|
||||
|
||||
let scheduled_jobs_html = {
|
||||
let next_pipeline = s
|
||||
.scheduled
|
||||
@@ -410,33 +478,7 @@ pub fn dashboard() -> Html {
|
||||
</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>
|
||||
}
|
||||
}
|
||||
{ pipeline_progress_html }
|
||||
|
||||
// Scheduled Jobs (always visible)
|
||||
{ scheduled_jobs_html }
|
||||
|
||||
Reference in New Issue
Block a user