arbiter-servant-ui-0.1.0.0: Embedded admin dashboard for arbiter job queue
Safe HaskellNone
LanguageGHC2024

Arbiter.Servant.UI

Description

Embedded admin dashboard (Bootstrap 5 + Alpine.js, compiled-in static files).

Security: No built-in authentication. All queue management operations (view, delete, retry) are publicly accessible. Add auth middleware before exposing to untrusted networks.

Quick Start

run port $ arbiterAppWithAdmin @MyRegistry config

Custom Composition

Mount the API and admin UI under a shared prefix:

type MyApp = "arbiter" :> (ArbiterAPI MyRegistry :<|> AdminUI) :<|> MyRoutes
run port $ serve (Proxy @MyApp) ((arbiterServer config :<|> adminUIServer) :<|> myHandler)

The admin UI auto-discovers the API path from its own URL. If it loads at /arbiter/ it finds the API at /arbiter/api/v1/.

Synopsis

Servant integration

type AdminUI = Raw Source #

Servant API type for the admin UI (catch-all behind API routes)

adminUIServer :: Server AdminUI Source #

Servant server for AdminUI

adminUIServerHoisted :: (forall x. Handler x -> m x) -> ServerT AdminUI m Source #

Hoisted variant for integration into a route tree using a custom monad.

adminUIServerDev :: FilePath -> Server AdminUI Source #

Dev-mode Servant server for AdminUI - serves from disk.

adminUIServerDevHoisted :: (forall x. Handler x -> m x) -> FilePath -> ServerT AdminUI m Source #

Hoisted dev-mode variant for integration into a route tree using a custom monad.

Standalone WAI app

adminApplication :: Application Source #

Standalone WAI Application serving embedded static files.

Serves index.html for / and other files by relative path.

devAdminApplication :: FilePath -> Application Source #

Dev-mode WAI Application serving static files from disk.

Reads files on every request - no recompile needed for HTML/JS/CSS changes.

Combined app helper

arbiterAppWithAdmin :: forall (registry :: JobPayloadRegistry). (BuildServer registry registry, HasServer (ArbiterAPI registry) ('[] :: [Type])) => ArbiterServerConfig registry -> Application Source #

Combine arbiterApp with admin UI

Serves the API at /api/v1/... and admin UI at /

arbiterAppWithAdminDev :: forall (registry :: JobPayloadRegistry). (BuildServer registry registry, HasServer (ArbiterAPI registry) ('[] :: [Type])) => FilePath -> ArbiterServerConfig registry -> Application Source #

Like arbiterAppWithAdmin but serves static files from disk for development.