Documentation
¶
Overview ¶
Package nodeadmin provides a mountable admin interface for the nodestore-backed node domain, following the same dracory admin module pattern as flowadmin.
The package exposes a single entry point, New(Options), which returns an http.Handler that the host application can mount under any path on any router (net/http ServeMux, chi, gin, echo, etc.).
The admin UI surface is one Handle(w, r) mounted at "/" dispatching on the ?controller= query parameter through a routes map built once at construction (default: the home dashboard). Sections are functions (section.UI(uiConfig).SectionName(w, r)); outer chrome is host-owned through Options.FuncLayout, falling back to shared.Layout. The API is served under /api/* by the api subpackage backed by nodestore.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrStoreRequired = errors.New("nodeadmin: store is required")
ErrStoreRequired is returned by New when Options.Store is nil
Functions ¶
func BasicAuthenticator ¶
BasicAuthenticator loads a Node-RED-style auth file and returns a request authenticator reporting the authenticated username — the signature noderunner.WorkflowEngine.HTTPAuthenticator expects, so runtime listeners (submitIn auth "admin") share the admin credentials.
func HashPassword ¶
HashPassword returns a bcrypt hash suitable for the auth file's "password" field
Types ¶
type Interface ¶
type Interface interface {
http.Handler
// Handle is the single admin-surface entry point: the
// ?controller= query parameter is dispatched through the routes
// map built once at construction.
Handle(w http.ResponseWriter, r *http.Request)
// HTTPRouter returns the shared-listener adapter mounted on this
// handler — the nodebase.HTTPRouter the engine is wired with at New.
// Routes registered through it serve on this handler, behind the
// same auth middleware.
HTTPRouter() nodebase.HTTPRouter
}
Interface defines the node admin. It is a standard http.Handler and can be mounted on any router.
type Options ¶
type Options struct {
// Store is the nodestore.StoreInterface used for persistence
// (required).
Store nodestore.StoreInterface
// AuthUserID returns the authenticated user ID for the request.
// If set and it returns "", the request is redirected to
// AdminHomeURL. If nil, authentication falls back to the basic-auth
// credentials (AuthFile, then the config store).
AuthUserID func(r *http.Request) string
// AuthFile is the path to a Node-RED adminAuth-style JSON
// credentials file ({"users":[{"username","password(bcrypt)"}]}).
// When set and AuthUserID is nil, HTTP Basic auth is enforced —
// the same file-based protection Node-RED's adminAuth provides.
// When empty, credentials are read from the config store key
// "admin.auth" (interim source; the creds entity lands in P4).
AuthFile string
// AdminHomeURL is the URL unauthenticated requests are redirected
// to (default: "/").
AdminHomeURL string
// NodeAdminURL is the base URL the node admin is mounted on —
// injected into the request context for section link building
// (default: "/nodes").
NodeAdminURL string
// Engine is the engine deployed workflows run in, expressed as the
// narrow api.EngineInterface contract — nodeadmin does not depend
// on a concrete runner (GOD ruling 2026-11-24; the stock
// noderunner.WorkflowEngine satisfies it structurally). If nil a
// fresh noderunner engine is created. On mount, engines that
// support it resume every workflow whose persisted deployed flag
// is set (restart-resume).
Engine api.EngineInterface
// FuncLayout is an optional function to render the admin interface
// inside your own layout (branding, menus, etc.). If nil, the
// default shared.Layout is used.
FuncLayout shared.FuncLayout
// DisableChrome hands chrome ownership to the host: the editor —
// a standalone page that bypasses FuncLayout — emits no nodeadmin
// navbar or section pills so an embedding host can wrap it in its
// own chrome. Sections are unaffected (they already render through
// FuncLayout when set). The zero value keeps the default chrome.
DisableChrome bool
}
Options contains all dependencies and configuration for the node admin.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package api provides the JSON API for the node admin surface — POST endpoints returning gouniverse/api envelopes, same convention as flowadmin/api but backed by nodestore.
|
Package api provides the JSON API for the node admin surface — POST endpoints returning gouniverse/api envelopes, same convention as flowadmin/api but backed by nodestore. |
|
Package dashboard serves the end-user dashboard client page — the single-file HTML shell + widget renderers ported from the retiring pkg/flowdashboard.
|
Package dashboard serves the end-user dashboard client page — the single-file HTML shell + widget renderers ported from the retiring pkg/flowdashboard. |
|
Package editor serves the workflow editor — the same Vue app as flowadmin's /editor — as a nodeadmin section selected through ?controller=editor.
|
Package editor serves the workflow editor — the same Vue app as flowadmin's /editor — as a nodeadmin section selected through ?controller=editor. |
|
Package settings is the settings section of the node admin, modeled on flowadmin's settingsmanager (itself the taskadmin/shopadmin folder-per-controller pattern): the nodeadmin dispatch map invokes section.UI(uiConfig).SettingsManager(w, r) for ?controller=settings — no action renders the page through the UiConfig layout, ?action=load-settings and ?action=save-setting answer JSON AJAX requests in the gouniverse/api envelope under the same controller URL.
|
Package settings is the settings section of the node admin, modeled on flowadmin's settingsmanager (itself the taskadmin/shopadmin folder-per-controller pattern): the nodeadmin dispatch map invokes section.UI(uiConfig).SettingsManager(w, r) for ?controller=settings — no action renders the page through the UiConfig layout, ?action=load-settings and ?action=save-setting answer JSON AJAX requests in the gouniverse/api envelope under the same controller URL. |