Apply 5 missed fixes

- LibraryStep.tsx: Add optional chaining for browse.entries
- Dashboard.tsx: Replace status-success with helios-solar color
- ResourceMonitor.tsx: Replace status-success with helios-solar color
- processor.rs: Add auto-pause on empty queue with SSE notification
- wizard.rs: Wait for scan completion before analyzing pending jobs

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-03-30 13:32:16 -04:00
parent 69902b8517
commit 13f744bd30
5 changed files with 30 additions and 6 deletions

View File

@@ -359,7 +359,19 @@ impl Agent {
}
Ok(None) => {
drop(permit);
tokio::time::sleep(tokio::time::Duration::from_secs(5)).await;
if !self.is_paused() && !self.is_draining() {
info!(
"Queue empty — engine returning to \
paused state automatically."
);
self.pause();
let _ = self.event_channels.system.send(
crate::db::SystemEvent::EngineStatusChanged
);
}
tokio::time::sleep(
tokio::time::Duration::from_secs(5)
).await;
}
Err(e) => {
drop(permit);

View File

@@ -290,10 +290,22 @@ pub(crate) async fn setup_complete_handler(
// Start Scan (optional, but good for UX)
// Use library_scanner so the UI can track progress via /api/scan/status
let scanner = state.library_scanner.clone();
let agent_for_analysis = state.agent.clone();
tokio::spawn(async move {
if let Err(e) = scanner.start_scan().await {
error!("Background initial scan failed: {}", e);
return;
}
loop {
let status = scanner.get_status().await;
if !status.is_running {
break;
}
tokio::time::sleep(
tokio::time::Duration::from_secs(1)
).await;
}
agent_for_analysis.analyze_pending_jobs().await;
});
info!("Configuration saved via web setup. Auth info created.");

View File

@@ -216,7 +216,7 @@ export default function Dashboard() {
{/* Stat row — compact horizontal strip */}
<div className="grid grid-cols-2 lg:grid-cols-4 gap-3">
<StatCard label="Active Jobs" value={stats.active} icon={Zap} colorClass="text-helios-solar" />
<StatCard label="Completed" value={stats.completed} icon={CheckCircle2} colorClass="text-status-success" />
<StatCard label="Completed" value={stats.completed} icon={CheckCircle2} colorClass="text-helios-solar" />
<StatCard label="Failed" value={stats.failed} icon={AlertCircle} colorClass="text-status-error" />
<StatCard label="Total Processed" value={stats.total} icon={Database} colorClass="text-helios-solar" />
</div>
@@ -259,7 +259,7 @@ export default function Dashboard() {
<div className="flex items-center gap-3 min-w-0">
<div className={`w-1.5 h-1.5 rounded-full shrink-0 ${
s === "completed"
? "bg-status-success"
? "bg-helios-solar"
: s === "failed"
? "bg-status-error"
: s === "encoding" || s === "analyzing"

View File

@@ -113,13 +113,13 @@ export default function ResourceMonitor() {
const getUsageColor = (percent: number) => {
if (percent > 90) return "text-status-error bg-status-error/10";
if (percent > 70) return "text-helios-solar bg-helios-solar/10";
return "text-status-success bg-status-success/10";
return "text-helios-solar bg-helios-solar/10";
};
const getBarColor = (percent: number) => {
if (percent > 90) return "bg-status-error";
if (percent > 70) return "bg-helios-solar";
return "bg-status-success";
return "bg-helios-solar";
};
if (!stats) {

View File

@@ -143,7 +143,7 @@ export default function LibraryStep({
const breadcrumbs = browse?.breadcrumbs ?? [];
const parentBreadcrumb =
breadcrumbs.length > 1 ? breadcrumbs[breadcrumbs.length - 2] : null;
const visibleEntries = browse?.entries.filter((entry) => entry.readable) ?? [];
const visibleEntries = browse?.entries?.filter((entry) => entry.readable) ?? [];
return (
<motion.div