shared

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 6 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_MESSAGES  = "messages"
	CONTROLLER_EDITOR    = "editor"
	CONTROLLER_SETTINGS  = "settings"
)

?controller= dispatch names

View Source
const MountAppJS = `` /* 194-byte string literal not displayed */

MountAppJS mounts the shared app-navigation chrome — every section page passes it via LayoutOptions.Scripts so the navbar renders (the shell layout emits <app-navigation> inside #app)

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-level navigation bar: brand, section links (active derived from ?controller=, badges when the store is available) and the Bootlegance theme switcher dropdown — mode (light/dark/auto), theme picker and font-size controls. 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 pills, matching the nav-pills pattern used across the external admin packages (shopadmin, taskadmin). The active tab is derived from the ?controller= query parameter. Workflows and Messages tabs show record counts as badges when the store is available.

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