Documentation
¶
Index ¶
- func NewManifest(_ *warden.Engine, plugins []plugin.Plugin) *contributor.Manifest
- func TenantIDFromContext(ctx context.Context) (string, bool)
- func WithTenantID(ctx context.Context, tenantID string) context.Context
- type Contributor
- func (c *Contributor) Manifest() *contributor.Manifest
- func (c *Contributor) RenderPage(ctx context.Context, route string, params contributor.Params) (templ.Component, error)
- func (c *Contributor) RenderSettings(ctx context.Context, settingID string) (templ.Component, error)
- func (c *Contributor) RenderWidget(ctx context.Context, widgetID string) (templ.Component, error)
- type PageContributor
- type Plugin
- type PluginPage
- type PluginWidget
- type PolicyDetailContributor
- type RoleDetailContributor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewManifest ¶
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 ¶
TenantIDFromContext extracts the tenant ID from context, if present.
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 ¶
RenderWidget renders a widget by ID.
type PageContributor ¶
type PageContributor interface {
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.
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 |