Skip to main content

Crate umbral_admin

Crate umbral_admin 

Source
Expand description

umbral-admin — auto-generated CRUD admin for umbral models.

Drop-in admin interface for any umbral project. Register the AdminPlugin on App::builder() and every model the migration registry knows about gets:

  • A list view at /admin/<table>/ with all rows in a table
  • A detail view at /admin/<table>/<id> with every field
  • A create form at /admin/<table>/new
  • An edit form at /admin/<table>/<id>/edit
  • A delete action at POST /admin/<table>/<id>/delete

Plus a registered-models index at /admin/.

§Customizing per-model display

Register an AdminModel for a model to control list columns, filter facets, search, ordering, bulk actions, and readonly fields. See AdminPlugin::register and the config module.

§Auth

Every admin route requires a session-backed staff user. If the session is missing or the user is not staff, the handler redirects to GET /admin/login?next=<current-url>. POST /admin/login verifies credentials via umbral_auth::authenticate, creates a session via [umbral_sessions::login], then redirects to next.

§Templates

Six include_str!-embedded Jinja templates live in templates/. The admin owns its own minijinja Environment. admin/base.html is the shell (sidebar + topbar + content slot); the other five extend it.

§Form widgets

Inputs dispatch per [SqlType]:

SqlTypeInput
SmallInt, Integer, BigInt<input type="number">
Real, Double<input type="number" step="any">
Boolean<input type="checkbox">
Text, Uuid<input type="text">
Date<input type="date">
Time<input type="time">
Timestamptz<input type="datetime-local">

Nullable fields skip the required attribute.

Re-exports§

pub use files::file_descriptor;
pub use files::resolve_preview_kind;
pub use config::Action;
pub use config::ActionInvocation;
pub use config::ActionResult;
pub use config::ActionScope;
pub use config::ActionVariant;
pub use config::AdminConfig;
pub use config::AdminContext;
pub use config::AdminModel;
pub use config::InlineKind;
pub use config::InlineModel;
pub use config::ToastLevel;
pub use registry::AdminRegistration;
pub use registry::AdminRegistry;
pub use registry::App as AdminApp;
pub use widgets::BarPayload;
pub use widgets::CardPayload;
pub use widgets::CatalogEntry;
pub use widgets::ChartPoint;
pub use widgets::DonutPayload;
pub use widgets::DonutSlice;
pub use widgets::FeedItem;
pub use widgets::FeedPayload;
pub use widgets::FilterOption;
pub use widgets::HeatmapCell;
pub use widgets::HeatmapPayload;
pub use widgets::HeatmapRow;
pub use widgets::KpiPayload;
pub use widgets::LinePayload;
pub use widgets::ProgressItem;
pub use widgets::ProgressPayload;
pub use widgets::RadialPayload;
pub use widgets::RadialTrack;
pub use widgets::Series;
pub use widgets::Span;
pub use widgets::TableColumn;
pub use widgets::TablePayload;
pub use widgets::Widget;
pub use widgets::WidgetDataFn;
pub use widgets::WidgetFilter;
pub use widgets::WidgetFilterKind;
pub use widgets::WidgetInstance;
pub use widgets::WidgetKind;
pub use widgets::WidgetParams;
pub use widgets::WidgetPayload;
pub use widgets::WidgetSection;
pub use widgets::format_thousands;
pub use widgets::humanize_number;

Modules§

branding
Admin chrome the developer can rebrand at plugin-build time — site title, site description, and brand color.
config
Per-model admin customization bundles.
files
File descriptor helpers — MIME / extension → preview kind, plus the serde_json::Value shape the file-preview macros consume.
models
Admin-owned models: user preferences and audit log.
registry
AdminRegistry — per-plugin grouping of registered models.
widgets
Dashboard widget system for umbral-admin.

Structs§

AdminPlugin
AdminView
A registered admin page that is not tied to a model. Renders one or more WidgetSections (the same cards/charts the dashboard uses) inside the admin chrome, mounted at {admin_base}/{path}.

Enums§

DashboardModelsConfig
The plugin. Mounts every admin route under /admin.

Functions§

builtin_recent_users_widget
Recent signups feed — last 5 auth_user rows ordered by date_joined. Gracefully degrades to an empty list if the table is absent (e.g. an admin-only install where AuthPlugin isn’t registered), so this widget never breaks the dashboard.
builtin_total_models_widget
Models by plugin bar chart — counts every model the migration registry knows about, grouped by plugin. Cheap to compute and always present.