Documentation
¶
Index ¶
- func PermissionSelector(data PermissionSelectorData) g.Node
- func RoleForm(data RoleFormData) g.Node
- func RoleListTable(data RoleListTableData) g.Node
- func RoleManagementInterface(data RoleManagementInterfaceData) g.Node
- type DashboardExtension
- type DashboardWidget
- type NavigationItem
- type NavigationPosition
- type PageHelpers
- type PageRenderer
- type PermissionSelectorData
- type RoleFormData
- type RoleListTableData
- type RoleManagementInterfaceData
- type Route
- type SettingsPage
- type SettingsSection
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PermissionSelector ¶
func PermissionSelector(data PermissionSelectorData) g.Node
PermissionSelector renders a permission multi-select component
func RoleForm ¶
func RoleForm(data RoleFormData) g.Node
RoleForm renders a form for creating/editing a role
func RoleListTable ¶
func RoleListTable(data RoleListTableData) g.Node
RoleListTable renders a table of roles with actions
func RoleManagementInterface ¶
func RoleManagementInterface(data RoleManagementInterfaceData) g.Node
RoleManagementInterface renders the complete role management UI
Types ¶
type DashboardExtension ¶
type DashboardExtension interface {
// ExtensionID returns a unique identifier for this extension
ExtensionID() string
NavigationItems() []NavigationItem
// Routes returns routes to register under /dashboard/app/:appId/
Routes() []Route
// SettingsSections returns settings sections to add to the settings page
// Deprecated: Use SettingsPages() instead for full-page settings
// Returns a list of setting section renderers
SettingsSections() []SettingsSection
// SettingsPages returns full settings pages to add to the settings sidebar
// These pages get their own routes and full-page layouts
SettingsPages() []SettingsPage
// DashboardWidgets returns widgets to show on the main dashboard
// These appear as cards on the dashboard home page
DashboardWidgets() []DashboardWidget
}
DashboardExtension is the interface that plugins implement to extend the dashboard
type DashboardWidget ¶
type DashboardWidget struct {
// ID is a unique identifier for this widget
ID string
// Title is the widget title
Title string
// Icon is an optional icon
Icon g.Node
// Order determines display order (lower = first)
Order int
// Size determines the widget size (1 = 1 column, 2 = 2 columns, etc.)
Size int
// Renderer renders the widget content
Renderer func(basePath string, currentApp *app.App) g.Node
}
DashboardWidget represents a widget on the dashboard home page
type NavigationItem ¶
type NavigationItem struct {
ID string
Label string
Icon g.Node
Position NavigationPosition
Order int
// Example: func(basePath string, app *app.App) string {
// return basePath + "/dashboard/app/" + app.ID.String() + "/multisession"
// }
URLBuilder func(basePath string, currentApp *app.App) string
// Example: func(activePage string) bool { return activePage == "multisession" }
ActiveChecker func(activePage string) bool
RequiresPlugin string
PermissionRequired string
}
NavigationItem represents a navigation link registered by a plugin
type NavigationPosition ¶
type NavigationPosition string
NavigationPosition defines where a navigation item should be placed
const ( NavPositionMain NavigationPosition = "main" NavPositionSettings NavigationPosition = "settings" NavPositionUserDropdown NavigationPosition = "user_dropdown" NavPositionFooter NavigationPosition = "footer" )
type PageHelpers ¶
type PageHelpers interface {
// GetCurrentUser returns the currently authenticated user
GetCurrentUser() interface{}
// GetCurrentApp returns the current app from URL context
GetCurrentApp() interface{}
// GetUserApps returns all apps the current user has access to
GetUserApps() []interface{}
// GetBasePath returns the dashboard base path
GetBasePath() string
// GetEnabledPlugins returns map of enabled plugin IDs
GetEnabledPlugins() map[string]bool
// SetTitle sets the page title
SetTitle(title string)
// SetActivePage sets the active page identifier for navigation highlighting
SetActivePage(page string)
}
PageHelpers provides helper functions for extension page renderers
type PageRenderer ¶
type PageRenderer func(helpers PageHelpers) (g.Node, error)
PageRenderer is a function that renders page content for an extension It receives helpers for building PageData and returns the content node The dashboard automatically wraps this in the layout (header, nav, footer)
type PermissionSelectorData ¶
type PermissionSelectorData struct {
Permissions []*schema.Permission
SelectedPermIDs map[xid.ID]bool
}
PermissionSelectorData contains data for the permission selector
type RoleFormData ¶
type RoleFormData struct {
Role *schema.Role
Permissions []*schema.Permission
SelectedPermIDs map[xid.ID]bool
IsTemplate bool
CanSetOwnerRole bool
Errors map[string]string
ActionURL string
CancelURL string
}
RoleFormData contains data for rendering the role form
type RoleListTableData ¶
type RoleListTableData struct {
Roles []*schema.Role
IsTemplate bool
BasePath string
OnEdit func(roleID xid.ID) string
OnDelete func(roleID xid.ID) string
OnClone func(roleID xid.ID) string
ShowActions bool
}
RoleListTableData contains data for the role list table
type RoleManagementInterfaceData ¶
type RoleManagementInterfaceData struct {
Title string
Description string
Roles []*schema.Role
IsTemplate bool
BasePath string
CreateRoleURL string
AppID xid.ID
OrgID *xid.ID
ShowActions bool
}
RoleManagementInterfaceData contains data for the full role management interface
type Route ¶
type Route struct {
// Method is the HTTP method (GET, POST, etc.)
Method string
// Path is the route path (relative to /dashboard/app/:appId/)
// Example: "/multisession" becomes "/dashboard/app/:appId/multisession"
Path string
// Handler is the route handler function
// Should be: func(c forge.Context) error
// Use PageRenderer helper to render with dashboard layout
Handler interface{}
// Name is the route name for identification
Name string
// Summary is a short description for OpenAPI
Summary string
// Description is a detailed description for OpenAPI
Description string
// Tags are OpenAPI tags
Tags []string
// RequireAuth indicates if the route requires authentication
RequireAuth bool
// RequireAdmin indicates if the route requires admin privileges
RequireAdmin bool
// PageRenderer is an optional helper that renders the page content
// The dashboard will wrap this in the layout automatically
PageRenderer PageRenderer
}
Route represents a route registered by a plugin extension
type SettingsPage ¶
type SettingsPage struct {
// ID is a unique identifier for this page (e.g., "role-templates", "api-keys")
ID string
// Label is the display text in the sidebar
Label string
// Description is a brief description of what this page does
Description string
// Icon is an optional icon component (lucide icon recommended)
Icon g.Node
// Category groups pages in the sidebar ("general", "security", "communication", "integrations", "advanced")
Category string
// Order determines the display order within the category (lower = first)
Order int
// Path is the URL path relative to /settings/ (e.g., "roles", "api-keys")
Path string
// RequirePlugin optionally specifies a plugin ID that must be enabled
RequirePlugin string
// RequireAdmin indicates if admin privileges are required
RequireAdmin bool
}
SettingsPage represents a full settings page in the sidebar navigation
type SettingsSection ¶
type SettingsSection struct {
// ID is a unique identifier for this section
ID string
// Title is the section title
Title string
// Description is the section description
Description string
// Icon is an optional icon
Icon g.Node
// Order determines display order (lower = first)
Order int
// Renderer renders the section content
Renderer func(basePath string, currentApp *app.App) g.Node
}
SettingsSection represents a section in the settings page Deprecated: Use SettingsPage instead for full-page settings