Skip to main content

forge_jobs_ui/
lib.rs

1#![forbid(unsafe_code)]
2#![allow(
3    clippy::missing_errors_doc,
4    clippy::missing_panics_doc,
5    clippy::module_name_repetitions,
6    clippy::needless_pass_by_value,
7    clippy::too_many_lines,
8    clippy::cast_precision_loss,
9    clippy::cast_possible_truncation,
10    clippy::cast_sign_loss,
11    clippy::cast_possible_wrap,
12    clippy::doc_markdown,
13    clippy::too_long_first_doc_paragraph,
14    // Framework mismatch — kept after a Task 9 audit (refactor pass
15    // 2026-05-25). Every fire of this lint in this crate is on a
16    // `#[component]` fn whose `impl IntoView` flows directly into the
17    // parent `view!` macro; dropping the return value is not a code
18    // smell here (the macro is what consumes it). The Leptos macro
19    // doesn't expand to anything we could annotate `#[must_use]` on
20    // ourselves, and adding it on the consumer-facing component fns
21    // would be wrong (the discardable thing is the IntoView, not the
22    // component handle). Revisit if Leptos ships its own `#[must_use]`
23    // story upstream.
24    clippy::must_use_candidate,
25    // Selection / bulk-action structs wrap Leptos signals that don't
26    // surface useful Debug output. Derive would just print opaque IDs.
27    missing_debug_implementations
28)]
29
30//! Reusable Jobs panel for the
31//! [`tech-admin-jobs`](https://github.com/dandush03/tech-admin) queue.
32//!
33//! Drop-in Leptos CSR panel that ships its own stylesheet and stays
34//! framework-agnostic via the [`QueueIpc`] trait. Consumers (Tauri,
35//! web, in-process mock) implement the trait once and the panel runs.
36//!
37//! ## Wiring
38//!
39//! - Provide an [`IpcCtx`] via Leptos context before rendering the
40//!   panel: `provide_context::<IpcCtx>(Rc::new(MyIpc))`.
41//! - Inject the bundled stylesheet once at the app root:
42//!   `<Stylesheet text=PANEL_CSS />`.
43//! - Render `<QueueRoot/>` wherever the panel should live.
44
45// `ipc` stays `pub` — consumers implement `QueueIpc` against the types
46// in this module. Everything else is internal UI machinery exposed
47// only via the re-exports below; `pub(crate)` so the SemVer surface
48// is the named items, not the module layout. The `unreachable_pub`
49// allow keeps inner `pub fn` / `pub struct` markers as module-local
50// API documentation rather than forcing every item to be `pub(crate)`.
51pub mod ipc;
52
53// Optional HTTP `QueueIpc` impl (browser / webview `fetch` → a
54// `forge-jobs-api` server). Behind the `http` feature so the base panel
55// stays transport-agnostic.
56#[cfg(feature = "http")]
57mod http;
58
59#[allow(unreachable_pub)]
60pub(crate) mod bulk_actions;
61#[allow(unreachable_pub)]
62pub(crate) mod chart_card;
63#[allow(unreachable_pub)]
64pub(crate) mod chart_fmt;
65#[allow(unreachable_pub)]
66pub(crate) mod confirm;
67#[allow(unreachable_pub)]
68pub(crate) mod cron;
69#[allow(unreachable_pub)]
70pub(crate) mod db_health;
71#[allow(unreachable_pub)]
72pub(crate) mod failed;
73#[allow(unreachable_pub)]
74pub(crate) mod inspector;
75#[allow(unreachable_pub)]
76pub(crate) mod job_table;
77#[allow(unreachable_pub)]
78pub(crate) mod overlay;
79#[allow(unreachable_pub)]
80pub(crate) mod overview;
81#[allow(unreachable_pub)]
82pub(crate) mod per_queue;
83#[allow(unreachable_pub)]
84pub(crate) mod queue_root;
85#[allow(unreachable_pub)]
86pub(crate) mod resources;
87#[allow(unreachable_pub)]
88pub(crate) mod scheduled;
89#[allow(unreachable_pub)]
90pub(crate) mod timeline;
91#[allow(unreachable_pub)]
92pub(crate) mod workers;
93
94pub use ipc::{
95    CleanupReport, CronSchedule, DbHealthBucket, DbHealthHostSeries, IpcCtx, IpcError,
96    JOB_STATUSES, JobInspect, JobRow, JobsEnqueueReq, JobsFilter, JobsPage, MetricSeriesBucket,
97    QueueIpc, QueueOverview, QueueProcess, ResourceBucket, ResourceHostSeries, StatusCounts,
98    TimelineBucket, Worker, WorkerSlot, WorkersOverview,
99};
100pub use queue_root::QueueRoot;
101
102#[cfg(feature = "http")]
103pub use http::HttpQueueIpc;
104
105/// Default stylesheet bundled with the crate. Inject once at the app
106/// root via Leptos `<Stylesheet text=PANEL_CSS />`.
107pub const PANEL_CSS: &str = include_str!("panel.css");
108
109/// The Forge mark as inline SVG (monochrome, `fill="currentColor"` so it
110/// inherits the surrounding text color). Rendered in the panel header and
111/// available to hosts that want it in their own nav/menu — e.g.
112/// `view! { <span inner_html=forge_jobs_ui::FORGE_MARK_SVG /> }`.
113pub const FORGE_MARK_SVG: &str = include_str!("forge-mark.svg");