shared

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2026 License: MIT Imports: 8 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	KeyEndpoint     = "endpoint"
	KeyAdminHomeURL = "admin_home_url"
	KeyNodeAdminURL = "node_admin_url"
)

context keys used on the admin UI surface

View Source
const (
	CONTROLLER_HOME      = "home"
	CONTROLLER_WORKFLOWS = "workflows"
	CONTROLLER_NODES     = "nodes"
	CONTROLLER_MESSAGES  = "messages"
	CONTROLLER_EDITOR    = "editor"
	CONTROLLER_SETTINGS  = "settings"
)

?controller= dispatch names

View Source
const SkinCSS = `` /* 5729-byte string literal not displayed */

SkinCSS is the shared admin skin: signal-red accent on the neutral Bootstrap canvas, mono "quick nav" pill strip, stat cards, status pills, tables, feed, settings sections and the workflow minimap. All colors resolve against Bootstrap CSS variables so light/dark (data-bs-theme) keeps working everywhere. Exported because the editor — a standalone page that bypasses the layout — injects the same skin so the shared chrome renders consistently there.

Variables

This section is empty.

Functions

func Layout

func Layout(w http.ResponseWriter, r *http.Request, webpageTitle, webpageHtml string, options LayoutOptions) string

Layout is the default layout renderer. It builds a complete HTML page using hb.NewWebpage() with Bootstrap CDN, matching the shopadmin pattern. If a FuncLayout is provided in Options, it takes precedence over this default.

Navbar renders the application top bar: the mono brand mark with the signal-red flow dot and, on the right, the Bootlegance theme switcher dropdown — mode (light/dark/auto), theme picker and font-size controls. Section navigation lives in SectionNav (the "NODES ›" pill strip emitted inside each page's <main>). The page must include bootlegance.min.js (shared.Layout emits it in the head) for the switcher controls to wire up.

func NodeAdminURL

func NodeAdminURL(r *http.Request) string

NodeAdminURL returns the nodeadmin base URL injected into the request context by Handle, defaulting to /nodes.

func SectionNav

func SectionNav(r *http.Request, store nodestore.StoreInterface) hb.TagInterface

SectionNav renders the node admin section navigation as the mono "NODES ›" pill strip. The active tab is derived from the ?controller= query parameter. Workflows, Nodes and Messages tabs show record counts as badges when the store is available.

func ShortID added in v0.3.0

func ShortID(id string) string

ShortID renders an entity ID in the compact form used in list columns (first 12 chars — enough to disambiguate visually).

func WorkflowMinimap added in v0.3.0

func WorkflowMinimap(wf nodestore.WorkflowInterface) string

WorkflowMinimap renders a scaled SVG thumbnail of the workflow topology — real node positions normalized into the 120x44 viewBox with the stored edges drawn as connectors. Empty workflows render the bare dotted thumbnail.

Types

type FuncLayout

type FuncLayout func(w http.ResponseWriter, r *http.Request, webpageTitle, webpageHtml string, options LayoutOptions) string

FuncLayout renders the admin interface inside a host-provided layout (branding, menus). It receives the request and response writer so the host project can access request context when rendering. Returning "" falls back to the default Layout.

type LayoutOptions

type LayoutOptions struct {
	Styles     []string
	StyleURLs  []string
	Scripts    []string
	ScriptURLs []string
	// Store enables the nav badges (Workflows/Messages counts) in the
	// top navbar; nil renders the links badge-free.
	Store nodestore.StoreInterface
}

LayoutOptions are the assets a page can inject into the layout

type UiConfig

type UiConfig struct {
	Store nodestore.StoreInterface
	// Engine is the deployed-workflow engine the settings section
	// inspects/tunes — carried as any so shared stays runner-agnostic;
	// sections type-assert (stock engine: *noderunner.WorkflowEngine).
	Engine any
	Layout func(w http.ResponseWriter, r *http.Request, webpageTitle, webpageHtml string, options LayoutOptions) string
}

UiConfig holds the dependencies passed to section UI factories — the shopadmin/taskadmin pattern, with nodestore as the store

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL