dashboard

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewManifest

func NewManifest(_ *warden.Engine, plugins []plugin.Plugin) *contributor.Manifest

NewManifest builds a contributor.Manifest for the warden dashboard. It starts with the base nav items, widgets, and settings, then merges any additional contributions from plugins implementing Plugin.

func TenantIDFromContext

func TenantIDFromContext(ctx context.Context) (string, bool)

TenantIDFromContext extracts the tenant ID from context, if present.

func WithTenantID

func WithTenantID(ctx context.Context, tenantID string) context.Context

WithTenantID returns a context with the tenant ID embedded. Dashboard plugins can extract this via TenantIDFromContext to scope queries.

Types

type Contributor

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

Contributor implements the dashboard LocalContributor interface for the warden extension. It renders pages, widgets, and settings using templ components and ForgeUI, and supports plugin-contributed UI sections.

func New

func New(manifest *contributor.Manifest, engine *warden.Engine, plugins []plugin.Plugin) *Contributor

New creates a new warden dashboard contributor.

func (*Contributor) Manifest

func (c *Contributor) Manifest() *contributor.Manifest

Manifest returns the contributor manifest.

func (*Contributor) RenderPage

func (c *Contributor) RenderPage(ctx context.Context, route string, params contributor.Params) (templ.Component, error)

RenderPage renders a page for the given route.

func (*Contributor) RenderSettings

func (c *Contributor) RenderSettings(ctx context.Context, settingID string) (templ.Component, error)

RenderSettings renders a settings panel by ID.

func (*Contributor) RenderWidget

func (c *Contributor) RenderWidget(ctx context.Context, widgetID string) (templ.Component, error)

RenderWidget renders a widget by ID.

type PageContributor

type PageContributor interface {
	// DashboardNavItems returns navigation items this plugin contributes.
	DashboardNavItems() []contributor.NavItem
	// DashboardRenderPage renders a page for the given route with params.
	// Returns (nil, ErrPageNotFound) if the route is not handled by this plugin.
	DashboardRenderPage(ctx context.Context, route string, params contributor.Params) (templ.Component, error)
}

PageContributor is an enhanced interface for plugins that need access to route parameters when rendering dashboard pages.

type Plugin

type Plugin interface {
	// DashboardWidgets returns widgets this plugin contributes.
	DashboardWidgets(ctx context.Context) []PluginWidget
	// DashboardSettingsPanel returns a settings templ component, or nil.
	DashboardSettingsPanel(ctx context.Context) templ.Component
	// DashboardPages returns extra page routes this plugin handles.
	DashboardPages() []PluginPage
}

Plugin is optionally implemented by warden plugins to contribute UI sections to the warden dashboard contributor. When plugins implement this interface, their pages, widgets, and settings panels are automatically merged into the dashboard.

type PluginPage

type PluginPage struct {
	Route  string // e.g. "/audit-export"
	Label  string // nav label
	Icon   string // lucide icon name
	Render func(ctx context.Context) templ.Component
}

PluginPage describes an extra page route contributed by a plugin.

type PluginWidget

type PluginWidget struct {
	ID         string
	Title      string
	Size       string // "sm", "md", "lg"
	RefreshSec int
	Render     func(ctx context.Context) templ.Component
}

PluginWidget describes a widget contributed by a warden plugin.

type PolicyDetailContributor

type PolicyDetailContributor interface {
	DashboardPolicyDetailSection(ctx context.Context, policyID id.PolicyID) templ.Component
}

PolicyDetailContributor is optionally implemented by plugins that want to contribute a section to the policy detail page.

type RoleDetailContributor

type RoleDetailContributor interface {
	DashboardRoleDetailSection(ctx context.Context, roleID id.RoleID) templ.Component
}

RoleDetailContributor is optionally implemented by plugins that want to contribute a section to the role detail page.

Directories

Path Synopsis
templ: version: v0.3.1001
templ: version: v0.3.1001
templ: version: v0.3.1001
templ: version: v0.3.1001
templ: version: v0.3.1001
templ: version: v0.3.1001
templ: version: v0.3.1001
templ: version: v0.3.1001

Jump to

Keyboard shortcuts

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