Documentation
¶
Index ¶
- Constants
- func AdminHomeURL(r *http.Request) string
- func Breadcrumbs(breadcrumbs []Breadcrumb) hb.TagInterface
- func Endpoint(r *http.Request) string
- func ErrorAlert(message string) string
- func ErrorPopup(errorMessage string) hb.TagInterface
- func FaaSAdminURL(r *http.Request) string
- func FileManagerURL(r *http.Request) string
- func Header(store funcstore.StoreInterface, logger *slog.Logger, r *http.Request) hb.TagInterface
- func Layout(w http.ResponseWriter, r *http.Request, webpageTitle, webpageHtml string, ...) string
- func SuccessPopup(successMessage string) hb.TagInterface
- func SuccessPopupWithRedirect(successMessage string, redirectUrl string, redirectSeconds int) hb.TagInterface
- func URL(endpoint string, controller string, params map[string]string) string
- func URLR(r *http.Request, controller string, params map[string]string) string
- type Breadcrumb
- type Links
- func (l *Links) Dashboard(params map[string]string) string
- func (l *Links) FunctionInvoke(params map[string]string) string
- func (l *Links) FunctionManager(params map[string]string) string
- func (l *Links) FunctionUpdate(params map[string]string) string
- func (l *Links) GroupManager(params map[string]string) string
- func (l *Links) GroupUpdate(params map[string]string) string
- type UiBase
- type UiConfig
- type UiInterface
Constants ¶
const ( CONTROLLER_DASHBOARD = "dashboard" CONTROLLER_FUNCTION_MANAGER = "function-manager" CONTROLLER_FUNCTION_UPDATE = "function-update" CONTROLLER_FUNCTION_INVOKE = "function-invoke" CONTROLLER_GROUP_MANAGER = "group-manager" CONTROLLER_GROUP_UPDATE = "group-update" )
Controller names used in the ?controller= query parameter
const CatchAll = "/*"
CatchAll is the catch-all route suffix
const ERROR_LOGGER_IS_NIL = "logger cannot be nil"
const ERROR_STORE_IS_NIL = "store cannot be nil"
Error messages
const KeyAdminHomeURL = "admin_home_url"
const KeyEndpoint = "endpoint"
Context keys for config values injected by Handle()
const KeyFaaSAdminURL = "FaaS_admin_url"
const KeyFileManagerURL = "file_manager_url"
Variables ¶
This section is empty.
Functions ¶
func AdminHomeURL ¶
AdminHomeURL returns the admin home URL from request context
func Breadcrumbs ¶
func Breadcrumbs(breadcrumbs []Breadcrumb) hb.TagInterface
Breadcrumbs renders a breadcrumb navigation from the given items
func ErrorAlert ¶
ErrorAlert returns an inline HTML error alert for the given message.
func ErrorPopup ¶
func ErrorPopup(errorMessage string) hb.TagInterface
ErrorPopup returns a Notiflix error notification tag.
func FaaSAdminURL ¶
FaaSAdminURL returns the FaaS admin base URL from request context
func FileManagerURL ¶
FileManagerURL returns the file manager URL from request context
func Header ¶
func Header(store funcstore.StoreInterface, logger *slog.Logger, r *http.Request) hb.TagInterface
Header renders the FaaS admin navigation header. It is nil-safe for both store and logger.
func Layout ¶
func Layout(w http.ResponseWriter, r *http.Request, webpageTitle, webpageHtml string, options struct { Styles []string StyleURLs []string Scripts []string ScriptURLs []string }) string
Layout is the default layout renderer. It builds a complete HTML page using hb.NewWebpage() with Bootstrap + Vue CDN, matching the blogadmin/shopadmin pattern. If a FuncLayout is provided in AdminOptions, it takes precedence over this default.
func SuccessPopup ¶
func SuccessPopup(successMessage string) hb.TagInterface
SuccessPopup returns a Notiflix success notification tag.
func SuccessPopupWithRedirect ¶
func SuccessPopupWithRedirect(successMessage string, redirectUrl string, redirectSeconds int) hb.TagInterface
SuccessPopupWithRedirect returns a Notiflix success notification tag with an optional redirect. If redirectUrl is empty, no redirect is configured.
Types ¶
type Breadcrumb ¶
Breadcrumb represents a single breadcrumb navigation item
type Links ¶
type Links struct {
// contains filtered or unexported fields
}
Links provides URL helpers for FaaSadmin controllers. The base URL is read from request context (injected by Handle()), not hardcoded. This follows the blogadmin/shopadmin pattern.
func NewLinks ¶
NewLinks creates a Links helper with the given base URL. If baseURL is empty, defaults to "/admin/faas".
func NewLinksFromRequest ¶
NewLinksFromRequest creates a Links helper using the FaaS admin URL from the request context.
func (*Links) FunctionInvoke ¶
FunctionInvoke builds the URL for the function invoke controller
func (*Links) FunctionManager ¶
FunctionManager builds the URL for the function manager controller
func (*Links) FunctionUpdate ¶
FunctionUpdate builds the URL for the function update controller
func (*Links) GroupManager ¶
GroupManager builds the URL for the group manager controller
type UiBase ¶
type UiBase struct {
StoreField funcstore.StoreInterface
LoggerField *slog.Logger
LayoutField func(w http.ResponseWriter, r *http.Request, webpageTitle, webpageHtml string, options struct {
Styles []string
StyleURLs []string
Scripts []string
ScriptURLs []string
}) string
}
UiBase is a base struct that implements shared.UiInterface. Subcontroller ui structs can embed this to get the Store(), Logger(), and Layout() methods for free, following the blogadmin/shopadmin pattern.
func (UiBase) Store ¶
func (u UiBase) Store() funcstore.StoreInterface
type UiConfig ¶
type UiConfig struct {
Store funcstore.StoreInterface
Logger *slog.Logger
Layout func(w http.ResponseWriter, r *http.Request, webpageTitle, webpageHtml string, options struct {
Styles []string
StyleURLs []string
Scripts []string
ScriptURLs []string
}) string
}
UiConfig holds the dependencies passed to subcontroller UI factories. The Layout function uses an anonymous struct for options to match blogadmin/shopadmin exactly, allowing consumers to reuse their existing layout function for funcadmin.
type UiInterface ¶
type UiInterface interface {
Store() funcstore.StoreInterface
Logger() *slog.Logger
Layout(w http.ResponseWriter, r *http.Request, webpageTitle, webpageHtml string, options struct {
Styles []string
StyleURLs []string
Scripts []string
ScriptURLs []string
}) string
}
UiInterface defines the methods every subcontroller UI must implement. This follows the blogadmin/shopadmin pattern.
Core controllers only use Store(), Logger(), and Layout().