arbiter-servant-ui-0.1.0.0
arbiter-servant-ui
Safe HaskellNone
LanguageGHC2024

Arbiter.Servant.UI

Description

Embedded admin dashboard. Bootstrap 5 CSS and Vue 3, compiled in.

Security: No built-in authentication. The dashboard calls the arbiter-servant API, which has no authentication. Add auth middleware before you expose either 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/.

Synopsis

Servant integration

type AdminUI = RawSource #

The admin UI route, a catch-all sitting behind the API routes.

adminUIServer :: Server AdminUISource #

Serve AdminUI from the embedded files.

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

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

adminUIServerDev :: FilePath -> Server AdminUISource #

Arguments

:: FilePath

The static directory.

-> Server AdminUI 

Serve AdminUI from disk.

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

Arguments

:: (forall x. Handler x -> m x) 
-> FilePath

The static directory.

-> ServerT AdminUI m 

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

Standalone WAI app

adminApp :: ApplicationSource #

The dashboard as a standalone WAI application over the embedded files.

adminAppDev :: FilePath -> ApplicationSource #

Arguments

:: FilePath

The static directory.

-> Application 

The dashboard served from disk, read per request.

Combined app helper

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

The API at /api and the admin UI at the root, in one application.

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

Arguments

:: forall (registry :: JobPayloadRegistry) (m :: Type -> Type). (BuildServer registry registry, HasRegistry m registry, HasServer (ArbiterAPI registry) ('[] :: [Type])) 
=> FilePath

The static directory.

-> ArbiterServerConfig m registry 
-> Application 

arbiterAppWithAdmin serving the UI from disk.