Home page now shows one clickable summary card per entity type (Networks, Hosts, Applications). Each card displays the total count fetched from the database via a single get_summary() server function, then navigates to the corresponding page on click. Counts are pre-rendered server-side via <Suspense> so the page is useful even before the WASM bundle loads. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
21 lines
895 B
Rust
21 lines
895 B
Rust
// api/ — Leptos server functions (the bridge between client and server)
|
|
//
|
|
// Server functions are annotated with `#[server]`.
|
|
// Leptos compiles them differently depending on the active feature:
|
|
//
|
|
// ssr → the function body runs on the server (normal async Rust code)
|
|
// hydrate → the body is replaced by an HTTP POST call to /api/<fn-name>
|
|
//
|
|
// This means:
|
|
// - Function signatures (arguments + return types) must compile for BOTH targets.
|
|
// All types used here must also be in `models.rs` (shared code).
|
|
// - Imports inside the function body are only compiled for `ssr`,
|
|
// so ssr-only modules (server::repository, sqlx) can be used freely there.
|
|
// - The pool is retrieved via `use_context::<AnyPool>()` — it is injected
|
|
// into the Leptos context by `main.rs` for every request.
|
|
|
|
pub mod applications;
|
|
pub mod hosts;
|
|
pub mod networks;
|
|
pub mod summary;
|