contributor

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrContributorExists is returned when a contributor with the same name is already registered.
	ErrContributorExists = errors.New("dashboard: contributor already registered")

	// ErrContributorNotFound is returned when a contributor is not found in the registry.
	ErrContributorNotFound = errors.New("dashboard: contributor not found")

	// ErrPageNotFound is returned when a requested page does not exist in a contributor.
	ErrPageNotFound = errors.New("dashboard: page not found")

	// ErrWidgetNotFound is returned when a requested widget does not exist in a contributor.
	ErrWidgetNotFound = errors.New("dashboard: widget not found")

	// ErrSettingNotFound is returned when a requested setting does not exist in a contributor.
	ErrSettingNotFound = errors.New("dashboard: setting not found")
)

Functions

func ExtractBodyFragment added in v0.10.0

func ExtractBodyFragment(html []byte) []byte

ExtractBodyFragment extracts the inner content of the <body> element from a full HTML document, stripping <!DOCTYPE>, <html>, <head>, and <body> wrappers. If the input does not contain a <body> tag, it is returned as-is (assumed to already be a fragment).

This is used by EmbeddedContributor to convert framework static export output (Astro, Next.js) into dashboard-embeddable HTML fragments.

func IsFragment added in v0.10.0

func IsFragment(html []byte) bool

IsFragment returns true if the HTML content appears to be a fragment (no <html> or <body> wrapper), false if it's a full document.

func StripDocumentWrapper added in v0.10.0

func StripDocumentWrapper(html []byte) []byte

StripDocumentWrapper removes <!DOCTYPE>, <html>, </html>, <head>...</head>, <body>, and </body> tags but preserves all other content. Unlike ExtractBodyFragment, this preserves content outside <body> (e.g., inline styles in <head> are lost, but stray text between </head> and <body> is kept). Prefer ExtractBodyFragment for typical use cases.

Types

type AuthPageContributor added in v0.10.0

type AuthPageContributor interface {
	DashboardContributor

	// RenderAuthPage renders an authentication page by type (e.g. "login", "register").
	RenderAuthPage(ctx context.Context, pageType string, params Params) (templ.Component, error)

	// HandleAuthAction handles form submissions for authentication pages.
	// Returns a redirect URL on success, or a templ component to re-render on failure.
	HandleAuthAction(ctx context.Context, pageType string, params Params) (redirectURL string, component templ.Component, err error)
}

AuthPageContributor optionally contributes authentication pages (login, logout, register, etc.) to the dashboard. Extensions implementing this interface provide the auth page UI that integrates with the dashboard shell.

type AuthPageDef added in v0.10.0

type AuthPageDef struct {
	Type     string `json:"type"`     // "login", "logout", "register", "forgot-password", etc.
	Path     string `json:"path"`     // relative path under auth base (e.g. "/login")
	Title    string `json:"title"`    // page title
	Icon     string `json:"icon"`     // optional icon name
	Priority int    `json:"priority"` // sort order
}

AuthPageDef describes an authentication page contributed by an extension.

type ContextPreparer added in v1.2.0

type ContextPreparer interface {
	PrepareContext(ctx context.Context, route string) context.Context
}

ContextPreparer is an optional interface that contributors can implement to enrich the request context before the layout renders. This allows layout components (sidebar header content, topbar extra content) to access contributor-specific context values such as app/env IDs and slugs.

type ContributorRegistry

type ContributorRegistry struct {
	// contains filtered or unexported fields
}

ContributorRegistry manages all registered contributors and merges their manifests. It is thread-safe for concurrent reads and writes.

func NewContributorRegistry

func NewContributorRegistry() *ContributorRegistry

NewContributorRegistry creates a new empty contributor registry.

func (*ContributorRegistry) ContributorCount

func (r *ContributorRegistry) ContributorCount() int

ContributorCount returns the total number of registered contributors.

func (*ContributorRegistry) ContributorNames

func (r *ContributorRegistry) ContributorNames() []string

ContributorNames returns the names of all registered contributors.

func (*ContributorRegistry) FindContributor

func (r *ContributorRegistry) FindContributor(name string) (DashboardContributor, bool)

FindContributor returns the contributor with the given name.

func (*ContributorRegistry) FindLocalContributor

func (r *ContributorRegistry) FindLocalContributor(name string) (LocalContributor, bool)

FindLocalContributor returns the local contributor with the given name.

func (*ContributorRegistry) FindRemoteContributor

func (r *ContributorRegistry) FindRemoteContributor(name string) (*RemoteContributor, bool)

FindRemoteContributor returns the remote contributor with the given name, type-asserting to *RemoteContributor. Returns false if not found or not a RemoteContributor.

func (*ContributorRegistry) FindSSRContributor added in v0.10.0

func (r *ContributorRegistry) FindSSRContributor(name string) (*SSRContributor, bool)

FindSSRContributor returns the SSR contributor with the given name.

func (*ContributorRegistry) GetAllSettings

func (r *ContributorRegistry) GetAllSettings() []ResolvedSetting

GetAllSettings returns all resolved settings from all contributors. Rebuilds if dirty.

func (*ContributorRegistry) GetAllWidgets

func (r *ContributorRegistry) GetAllWidgets() []ResolvedWidget

GetAllWidgets returns all resolved widgets from all contributors. Rebuilds if dirty.

func (*ContributorRegistry) GetExtensionEntries added in v1.2.0

func (r *ContributorRegistry) GetExtensionEntries(dashboardBasePath string) []ExtensionEntry

GetExtensionEntries returns all contributors that use the "extension" layout, plus the core dashboard entry, for rendering in the app grid navigator.

func (*ContributorRegistry) GetExtensionNavGroups added in v1.2.0

func (r *ContributorRegistry) GetExtensionNavGroups(name string) []NavGroup

GetExtensionNavGroups returns the navigation groups for a specific extension contributor. Used by the extension layout's optional sidebar. Returns nil if the contributor is not found or has no navigation items.

func (*ContributorRegistry) GetManifest

func (r *ContributorRegistry) GetManifest(name string) (*Manifest, bool)

GetManifest returns the manifest for the named contributor.

func (*ContributorRegistry) GetNavGroups

func (r *ContributorRegistry) GetNavGroups() []NavGroup

GetNavGroups returns the merged navigation groups. Rebuilds if dirty.

func (*ContributorRegistry) IsLocal

func (r *ContributorRegistry) IsLocal(name string) bool

IsLocal returns true if the named contributor is registered as a local contributor.

func (*ContributorRegistry) IsRemote

func (r *ContributorRegistry) IsRemote(name string) bool

IsRemote returns true if the named contributor is registered as a remote contributor.

func (*ContributorRegistry) IsSSR added in v0.10.0

func (r *ContributorRegistry) IsSSR(name string) bool

IsSSR returns true if the named contributor is registered as an SSR contributor.

func (*ContributorRegistry) RebuildNavigation

func (r *ContributorRegistry) RebuildNavigation()

RebuildNavigation merges all manifests into NavGroups, sorted by priority. This must be called explicitly after registrations are complete, or it will be called lazily by GetNavGroups if the registry is dirty.

func (*ContributorRegistry) RegisterLocal

func (r *ContributorRegistry) RegisterLocal(c LocalContributor) error

RegisterLocal registers a local (in-process) contributor. This includes EmbeddedContributor (which implements LocalContributor).

func (*ContributorRegistry) RegisterRemote

func (r *ContributorRegistry) RegisterRemote(c DashboardContributor) error

RegisterRemote registers a remote (over-the-network) contributor.

func (*ContributorRegistry) RegisterSSR added in v0.10.0

func (r *ContributorRegistry) RegisterSSR(c *SSRContributor) error

RegisterSSR registers an SSR contributor (Node.js sidecar). SSR contributors are tracked separately for lifecycle management (Start/Stop) and are also registered as local contributors for rendering.

func (*ContributorRegistry) SSRContributorNames added in v0.10.0

func (r *ContributorRegistry) SSRContributorNames() []string

SSRContributorNames returns the names of all registered SSR contributors.

func (*ContributorRegistry) Unregister

func (r *ContributorRegistry) Unregister(name string) error

Unregister removes a contributor by name (local or remote).

type DashboardContributor

type DashboardContributor interface {
	// Manifest returns the contributor's manifest describing its pages, widgets, settings, etc.
	Manifest() *Manifest
}

DashboardContributor is the base interface every dashboard extension implements. It provides a manifest describing the contributor's capabilities.

type DashboardIconProvider added in v1.2.0

type DashboardIconProvider interface {
	Icon() templ.Component
}

DashboardIconProvider is an optional interface that contributors can implement to provide a custom templ.Component icon for use in the app grid, sidebar header, and topbar branding. Takes priority over string-based Icon/ExtensionIcon.

type EmbeddedContributor added in v0.10.0

type EmbeddedContributor struct {
	// contains filtered or unexported fields
}

EmbeddedContributor serves dashboard pages, widgets, and settings from an embedded fs.FS (typically embed.FS). It is framework-agnostic — the FS can contain output from Astro, Next.js, or any other static site generator.

Pages are looked up as HTML files in the pages directory, widgets in the widgets directory, and settings in the settings directory. Full HTML documents are automatically converted to fragments via ExtractBodyFragment.

Static assets (CSS, JS, images) are served via AssetsHandler().

func NewEmbeddedContributor added in v0.10.0

func NewEmbeddedContributor(manifest *Manifest, fsys fs.FS, opts ...EmbeddedOption) *EmbeddedContributor

NewEmbeddedContributor creates an EmbeddedContributor that reads HTML fragments from the provided filesystem.

func (*EmbeddedContributor) AssetsHandler added in v0.10.0

func (ec *EmbeddedContributor) AssetsHandler() http.Handler

AssetsHandler returns an http.Handler that serves static assets (CSS, JS, images) from the embedded filesystem. Mount this at the appropriate path in the dashboard routes.

func (*EmbeddedContributor) FS added in v0.10.0

func (ec *EmbeddedContributor) FS() fs.FS

FS returns the underlying filesystem for direct access if needed.

func (*EmbeddedContributor) Manifest added in v0.10.0

func (ec *EmbeddedContributor) Manifest() *Manifest

Manifest returns the contributor's manifest.

func (*EmbeddedContributor) RenderPage added in v0.10.0

func (ec *EmbeddedContributor) RenderPage(_ context.Context, route string, _ Params) (templ.Component, error)

RenderPage renders a page fragment for the given route. Route "/" looks for pages/index.html, route "/sessions" looks for pages/sessions/index.html or pages/sessions.html.

func (*EmbeddedContributor) RenderSettings added in v0.10.0

func (ec *EmbeddedContributor) RenderSettings(_ context.Context, settingID string) (templ.Component, error)

RenderSettings renders a settings panel fragment by ID.

func (*EmbeddedContributor) RenderWidget added in v0.10.0

func (ec *EmbeddedContributor) RenderWidget(_ context.Context, widgetID string) (templ.Component, error)

RenderWidget renders a widget fragment by ID. Widget "active-sessions" looks for widgets/active-sessions.html.

type EmbeddedOption added in v0.10.0

type EmbeddedOption func(*EmbeddedContributor)

EmbeddedOption configures an EmbeddedContributor.

func WithAssetsDir added in v0.10.0

func WithAssetsDir(dir string) EmbeddedOption

WithAssetsDir sets the directory within the FS where static assets are stored. Default: "assets".

func WithPagesDir added in v0.10.0

func WithPagesDir(dir string) EmbeddedOption

WithPagesDir sets the directory within the FS where page HTML files are stored. Default: "pages".

func WithSettingsDir added in v0.10.0

func WithSettingsDir(dir string) EmbeddedOption

WithSettingsDir sets the directory within the FS where settings HTML files are stored. Default: "settings".

func WithWidgetsDir added in v0.10.0

func WithWidgetsDir(dir string) EmbeddedOption

WithWidgetsDir sets the directory within the FS where widget HTML files are stored. Default: "widgets".

type ExtensionEntry added in v1.2.0

type ExtensionEntry struct {
	Name          string          // contributor name
	DisplayName   string          // display name
	Icon          string          // lucide icon name
	ExtensionIcon string          // custom icon/logo URL (overrides Icon)
	IconComponent templ.Component // custom icon component (highest priority, from DashboardIconProvider)
	BasePath      string          // entry point URL for this extension
}

ExtensionEntry represents an extension shown in the app grid navigator.

type LocalContributor

type LocalContributor interface {
	DashboardContributor

	// RenderPage renders a page for the given route.
	RenderPage(ctx context.Context, route string, params Params) (templ.Component, error)

	// RenderWidget renders a specific widget by ID.
	RenderWidget(ctx context.Context, widgetID string) (templ.Component, error)

	// RenderSettings renders a settings panel for the given setting ID.
	RenderSettings(ctx context.Context, settingID string) (templ.Component, error)
}

LocalContributor runs in-process and renders templ.Component directly. This is the primary interface for extensions that contribute UI to the dashboard.

type Manifest

type Manifest struct {
	// IconComponent is a custom templ.Component icon provided by DashboardIconProvider.
	// Takes priority over Icon and ExtensionIcon when rendering in the app grid,
	// sidebar header, and topbar branding.
	IconComponent templ.Component `json:"-"`

	Name            string               `json:"name"`
	DisplayName     string               `json:"display_name"`
	Icon            string               `json:"icon"`
	Version         string               `json:"version"`
	Layout          string               `json:"layout,omitempty"`       // "dashboard", "settings", "base", "full", "extension" — default "dashboard"
	Root            bool                 `json:"root,omitempty"`         // true = nav paths resolve at dashboard root (e.g. /health), not /ext/{name}/pages/...
	ShowSidebar     *bool                `json:"show_sidebar,omitempty"` // extension layout only: show sidebar with extension nav items (default: false)
	Nav             []NavItem            `json:"nav"`
	Widgets         []WidgetDescriptor   `json:"widgets"`
	Settings        []SettingsDescriptor `json:"settings"`
	SearchProviders []SearchProviderDef  `json:"search_providers,omitempty"`
	Notifications   []NotificationDef    `json:"notifications,omitempty"`
	Capabilities    []string             `json:"capabilities,omitempty"`
	AuthPages       []AuthPageDef        `json:"auth_pages,omitempty"`
	TopbarConfig    *TopbarConfig        `json:"topbar_config,omitempty"`  // per-extension topbar customization (extension layout only)
	ExtensionIcon   string               `json:"extension_icon,omitempty"` // icon/logo URL for the app grid navigator

	// SidebarHeaderContent is custom content rendered in the extension sidebar
	// header below the branding. Used for app switchers, status indicators, etc.
	SidebarHeaderContent templ.Component `json:"-"`

	// SidebarFooterContent is custom content rendered in the extension sidebar
	// footer above the user dropdown. Used for links like API Docs, support, etc.
	SidebarFooterContent templ.Component `json:"-"`

	// TopbarExtraContent is custom content rendered in the extension topbar
	// after the search trigger. Used for environment switchers, context indicators, etc.
	TopbarExtraContent templ.Component `json:"-"`
}

Manifest describes a contributor's capabilities, navigation, widgets, settings, and more.

func FetchManifest

func FetchManifest(ctx context.Context, baseURL string, timeout time.Duration, apiKey string) (*Manifest, error)

FetchManifest fetches the dashboard manifest from a remote service URL. This is used during discovery to get the remote contributor's manifest before registration.

func (*Manifest) ShowSidebarOrDefault added in v1.2.0

func (m *Manifest) ShowSidebarOrDefault() bool

ShowSidebarOrDefault returns the ShowSidebar value, defaulting to false.

type NavGroup struct {
	Name     string // "Platform", "Identity", etc.
	Icon     string
	Items    []ResolvedNav // merged + sorted by priority
	Priority int
}

NavGroup is a merged sidebar section built from contributor manifests.

type NavItem struct {
	Label    string    `json:"label"`
	Path     string    `json:"path"`
	Icon     string    `json:"icon"`
	Badge    string    `json:"badge,omitempty"`
	Group    string    `json:"group,omitempty"`
	Children []NavItem `json:"children,omitempty"`
	Priority int       `json:"priority,omitempty"`
	Access   string    `json:"access,omitempty"` // "public", "protected", "partial" (empty = dashboard default)
}

NavItem represents a navigation entry in the dashboard sidebar.

type NotifiableContributor

type NotifiableContributor interface {
	DashboardContributor

	// Notifications returns a channel that emits notifications.
	// The channel should be closed when the context is cancelled.
	Notifications(ctx context.Context) (<-chan Notification, error)
}

NotifiableContributor optionally streams notifications from a contributor.

type Notification

type Notification struct {
	ID       string `json:"id"`
	Source   string `json:"source"`
	Message  string `json:"message"`
	Severity string `json:"severity"`
	URL      string `json:"url,omitempty"`
	Time     int64  `json:"time"` // unix timestamp
}

Notification represents a real-time notification from a contributor.

type NotificationDef

type NotificationDef struct {
	ID       string `json:"id"`
	Name     string `json:"name"`
	Severity string `json:"severity"` // "info", "warning", "error", "critical"
}

NotificationDef describes a notification type an extension can emit.

type Params

type Params struct {
	Route       string
	BasePath    string
	PathParams  map[string]string
	QueryParams map[string]string
	FormData    map[string]string
}

Params holds route parameters and query strings extracted from the request.

type RemoteContributor

type RemoteContributor struct {
	// contains filtered or unexported fields
}

RemoteContributor wraps a remote service that exposes dashboard pages and widgets via HTTP fragment endpoints. It fetches HTML fragments from the remote service and returns them as raw HTML nodes for embedding in the dashboard shell.

func NewRemoteContributor

func NewRemoteContributor(baseURL string, manifest *Manifest, opts ...RemoteContributorOption) *RemoteContributor

NewRemoteContributor creates a remote contributor from a base URL and manifest.

func (*RemoteContributor) BaseURL

func (rc *RemoteContributor) BaseURL() string

BaseURL returns the remote service base URL.

func (*RemoteContributor) FetchPage

func (rc *RemoteContributor) FetchPage(ctx context.Context, route string) ([]byte, error)

FetchPage fetches an HTML page fragment from the remote service.

func (*RemoteContributor) FetchSettings

func (rc *RemoteContributor) FetchSettings(ctx context.Context, settingID string) ([]byte, error)

FetchSettings fetches an HTML settings form from the remote service.

func (*RemoteContributor) FetchWidget

func (rc *RemoteContributor) FetchWidget(ctx context.Context, widgetID string) ([]byte, error)

FetchWidget fetches an HTML widget fragment from the remote service.

func (*RemoteContributor) Manifest

func (rc *RemoteContributor) Manifest() *Manifest

Manifest returns the contributor's manifest.

type RemoteContributorOption

type RemoteContributorOption func(*RemoteContributor)

RemoteContributorOption configures a RemoteContributor.

func WithAPIKey

func WithAPIKey(key string) RemoteContributorOption

WithAPIKey sets the API key for authenticating with the remote service.

func WithHTTPClient

func WithHTTPClient(client *http.Client) RemoteContributorOption

WithHTTPClient sets a custom HTTP client for the remote contributor.

type ResolvedNav

type ResolvedNav struct {
	NavItem

	Contributor string        // contributor name (e.g., "authsome", "nexus")
	FullPath    string        // resolved path (e.g., "/dashboard/ext/authsome/pages/users")
	Children    []ResolvedNav // resolved child nav items (from NavItem.Children)
}

ResolvedNav is a NavItem enriched with its owning contributor name and resolved path.

type ResolvedSetting

type ResolvedSetting struct {
	SettingsDescriptor

	Contributor string
}

ResolvedSetting is a SettingsDescriptor enriched with its owning contributor name.

type ResolvedWidget

type ResolvedWidget struct {
	WidgetDescriptor

	Contributor string
}

ResolvedWidget is a WidgetDescriptor enriched with its owning contributor name.

type SSRContributor added in v0.10.0

type SSRContributor struct {
	// contains filtered or unexported fields
}

SSRContributor manages a Node.js SSR sidecar process that renders dashboard pages and widgets on the server. It starts a Node.js process, waits for it to be ready, and delegates rendering via HTTP to the running server.

The SSR server must expose the standard Forge dashboard fragment endpoints:

  • GET /_forge/dashboard/pages/* → HTML page fragments
  • GET /_forge/dashboard/widgets/* → HTML widget fragments
  • GET /_forge/dashboard/settings/* → HTML settings fragments

SSRContributor is framework-agnostic — it works with Astro SSR, Next.js, or any Node.js server that implements the endpoint convention.

func NewSSRContributor added in v0.10.0

func NewSSRContributor(manifest *Manifest, entryScript string, opts ...SSROption) *SSRContributor

NewSSRContributor creates an SSR contributor that will launch a Node.js process from the given entry script. Call Start() to launch the process.

func (*SSRContributor) Manifest added in v0.10.0

func (sc *SSRContributor) Manifest() *Manifest

Manifest returns the contributor's manifest.

func (*SSRContributor) Port added in v0.10.0

func (sc *SSRContributor) Port() int

Port returns the port the SSR server is listening on. Returns 0 if not started.

func (*SSRContributor) RenderPage added in v0.10.0

func (sc *SSRContributor) RenderPage(ctx context.Context, route string, _ Params) (templ.Component, error)

RenderPage renders a page fragment by delegating to the SSR server.

func (*SSRContributor) RenderSettings added in v0.10.0

func (sc *SSRContributor) RenderSettings(ctx context.Context, settingID string) (templ.Component, error)

RenderSettings renders a settings fragment by delegating to the SSR server.

func (*SSRContributor) RenderWidget added in v0.10.0

func (sc *SSRContributor) RenderWidget(ctx context.Context, widgetID string) (templ.Component, error)

RenderWidget renders a widget fragment by delegating to the SSR server.

func (*SSRContributor) Start added in v0.10.0

func (sc *SSRContributor) Start(ctx context.Context) error

Start launches the Node.js SSR server. It picks a free port, starts the process, and waits for the port to be accepting connections (max 10s).

func (*SSRContributor) Started added in v0.10.0

func (sc *SSRContributor) Started() bool

Started returns true if the SSR server is running.

func (*SSRContributor) Stop added in v0.10.0

func (sc *SSRContributor) Stop() error

Stop kills the Node.js SSR server process.

type SSROption added in v0.10.0

type SSROption func(*SSRContributor)

SSROption configures an SSRContributor.

func WithSSREnv added in v0.10.0

func WithSSREnv(env map[string]string) SSROption

WithSSREnv sets additional environment variables for the Node.js process.

func WithSSRWorkDir added in v0.10.0

func WithSSRWorkDir(dir string) SSROption

WithSSRWorkDir sets the working directory for the Node.js process.

type SearchProviderDef

type SearchProviderDef struct {
	ID          string   `json:"id"`
	Name        string   `json:"name"`
	Prefix      string   `json:"prefix,omitempty"`       // e.g., "user:" filters to this provider
	ResultTypes []string `json:"result_types,omitempty"` // "page", "entity", "action"
}

SearchProviderDef describes a search provider contributed by an extension.

type SearchResult

type SearchResult struct {
	Title       string  `json:"title"`
	Description string  `json:"description"`
	URL         string  `json:"url"`
	Icon        string  `json:"icon"`
	Source      string  `json:"source"` // contributor name
	Category    string  `json:"category"`
	Score       float64 `json:"score"`
}

SearchResult represents a single search result from a contributor.

type SearchableContributor

type SearchableContributor interface {
	DashboardContributor

	// Search performs a search query and returns matching results.
	Search(ctx context.Context, query string, limit int) ([]SearchResult, error)
}

SearchableContributor optionally adds search capability to a contributor.

type SettingsDescriptor

type SettingsDescriptor struct {
	ID          string `json:"id"`
	Title       string `json:"title"`
	Description string `json:"description"`
	Group       string `json:"group"`
	Icon        string `json:"icon"`
	Priority    int    `json:"priority"`
}

SettingsDescriptor describes a settings panel contributed by an extension.

type TopbarAction added in v1.2.0

type TopbarAction struct {
	// Label is the button text (hidden on small screens if Icon is set).
	Label string `json:"label"`

	// Icon is the lucide icon name for the action button.
	Icon string `json:"icon,omitempty"`

	// Href is the navigation target. Can be a full URL or a dashboard path.
	Href string `json:"href"`

	// Tooltip is shown on hover.
	Tooltip string `json:"tooltip,omitempty"`

	// Variant controls button styling: "default", "outline", "ghost".
	Variant string `json:"variant,omitempty"`
}

TopbarAction defines a custom button/link in the extension topbar.

type TopbarConfig added in v1.2.0

type TopbarConfig struct {
	// Title shown in the topbar (overrides extension DisplayName).
	Title string `json:"title,omitempty"`

	// LogoURL is the URL for the extension logo shown in the topbar.
	LogoURL string `json:"logo_url,omitempty"`

	// LogoIcon is a lucide icon name to use as the logo when LogoURL is empty.
	LogoIcon string `json:"logo_icon,omitempty"`

	// AccentColor is a CSS color value for the topbar accent (e.g. brand color).
	AccentColor string `json:"accent_color,omitempty"`

	// Actions are custom action buttons shown in the topbar (right side).
	Actions []TopbarAction `json:"actions,omitempty"`

	// ShowSearch controls whether the search trigger appears in this extension's topbar.
	ShowSearch bool `json:"show_search,omitempty"`

	// ShowThemeToggle controls whether the theme toggle appears. Default: true.
	ShowThemeToggle *bool `json:"show_theme_toggle,omitempty"`

	// ShowUserMenu controls whether the user menu appears. Default: true.
	ShowUserMenu *bool `json:"show_user_menu,omitempty"`
}

TopbarConfig defines per-extension topbar customization for the standalone extension layout. Only used when Layout is "extension".

func (*TopbarConfig) ShowThemeToggleOrDefault added in v1.2.0

func (tc *TopbarConfig) ShowThemeToggleOrDefault() bool

ShowThemeToggleOrDefault returns the ShowThemeToggle value, defaulting to true.

func (*TopbarConfig) ShowUserMenuOrDefault added in v1.2.0

func (tc *TopbarConfig) ShowUserMenuOrDefault() bool

ShowUserMenuOrDefault returns the ShowUserMenu value, defaulting to true.

type WidgetDescriptor

type WidgetDescriptor struct {
	ID          string `json:"id"`
	Title       string `json:"title"`
	Description string `json:"description"`
	Size        string `json:"size"`        // "sm", "md", "lg"
	RefreshSec  int    `json:"refresh_sec"` // 0 = static
	Group       string `json:"group"`
	Priority    int    `json:"priority"`
}

WidgetDescriptor describes a widget that can be rendered on the dashboard.

Directories

Path Synopsis
Package codegen generates Go source files from forge.contributor.yaml configuration.
Package codegen generates Go source files from forge.contributor.yaml configuration.
Package config defines the schema for forge.contributor.yaml configuration files that declare dashboard contributor metadata, navigation, widgets, settings, and build configuration.
Package config defines the schema for forge.contributor.yaml configuration files that declare dashboard contributor metadata, navigation, widgets, settings, and build configuration.

Jump to

Keyboard shortcuts

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