Documentation
¶
Overview ¶
Package web provides a browser-based dashboard for Config Manager. It uses htmx + Go html/template for server-rendered pages with dynamic updates, served alongside the JSON API on the same port.
Index ¶
- func NewHandler(apiURL, authToken string) http.Handler
- type APIError
- type ActionInfo
- type DNSConfig
- type EndpointData
- type Handler
- type JobRun
- type NetworkInterface
- type NetworkStatus
- type NetworkWriteResult
- type NodeInfo
- type PendingUpdate
- type PluginEndpoint
- type PluginInfo
- type PluginSettings
- type PluginSettingsUpdateResult
- type RunStatus
- type Toast
- type UpdateConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHandler ¶
NewHandler creates a web UI handler that renders pages and proxies actions to the CM JSON API at apiURL. When authToken is non-empty, a login page gates access via cookie-based sessions.
Types ¶
type APIError ¶
APIError is returned when the core API responds with a non-2xx status code. Callers can type-assert to distinguish retryable server errors (5xx) from non-retryable client errors (4xx).
type ActionInfo ¶
ActionInfo describes a POST endpoint for the generic plugin template.
type DNSConfig ¶
type DNSConfig struct {
Nameservers []string `json:"nameservers"`
Search []string `json:"search,omitempty"`
}
DNSConfig holds the response from GET /api/v1/plugins/network/dns.
type EndpointData ¶
EndpointData holds the result of fetching a single GET endpoint.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler serves the web UI and proxies actions to the CM JSON API.
type JobRun ¶
type JobRun struct {
JobID string `json:"job_id"`
Status string `json:"status"` // Core API: "running", "completed", "failed"; web-layer synthetic: "error"
StartedAt string `json:"started_at,omitempty"`
EndedAt string `json:"ended_at,omitempty"`
Duration string `json:"duration,omitempty"`
Error string `json:"error,omitempty"`
}
JobRun holds a job execution record returned by GET /api/v1/jobs/{id}/runs/latest and GET /api/v1/jobs/{id}/runs (paginated list).
type NetworkInterface ¶
type NetworkInterface struct {
Name string `json:"name"`
MAC string `json:"mac"`
IP string `json:"ip,omitempty"`
State string `json:"state"`
}
NetworkInterface holds one entry from GET /api/v1/plugins/network/interfaces.
type NetworkStatus ¶
type NetworkStatus struct {
DefaultGateway string `json:"default_gateway,omitempty"`
DNSReachable bool `json:"dns_reachable"`
InternetReachable bool `json:"internet_reachable"`
}
NetworkStatus holds the response from GET /api/v1/plugins/network/status.
type NetworkWriteResult ¶
type NetworkWriteResult struct {
Valid bool `json:"valid,omitempty"`
Changes []string `json:"changes,omitempty"`
Current map[string]any `json:"current,omitempty"`
Proposed map[string]any `json:"proposed,omitempty"`
Message string `json:"message,omitempty"`
}
NetworkWriteResult is the response from network write operations.
type NodeInfo ¶
type NodeInfo struct {
Hostname string `json:"hostname"`
OS string `json:"os"`
Kernel string `json:"kernel"`
Arch string `json:"arch"`
UptimeSeconds int `json:"uptime_seconds"`
}
NodeInfo holds the response from GET /api/v1/node.
type PendingUpdate ¶
type PendingUpdate struct {
Package string `json:"package"`
CurrentVersion string `json:"current_version"`
NewVersion string `json:"new_version"`
Security bool `json:"security"`
}
PendingUpdate holds one entry from GET /api/v1/plugins/update/status.
type PluginEndpoint ¶
type PluginEndpoint struct {
Method string `json:"method"`
Path string `json:"path"`
Description string `json:"description"`
}
PluginEndpoint describes a single endpoint exposed by a plugin.
type PluginInfo ¶
type PluginInfo struct {
Name string `json:"name"`
Version string `json:"version"`
Description string `json:"description"`
RoutePrefix string `json:"route_prefix"`
Endpoints []PluginEndpoint `json:"endpoints"`
}
PluginInfo holds metadata returned by GET /api/v1/plugins.
type PluginSettings ¶
PluginSettings holds the response from GET /api/v1/plugins/{name}/settings.
type PluginSettingsUpdateResult ¶
type PluginSettingsUpdateResult struct {
Config map[string]any `json:"config"`
Warning string `json:"warning,omitempty"`
}
PluginSettingsUpdateResult holds the response from PUT /api/v1/plugins/{name}/settings.
type RunStatus ¶
type RunStatus struct {
Type string `json:"type"`
Status string `json:"status"`
StartedAt string `json:"started_at,omitempty"`
Duration string `json:"duration,omitempty"`
Packages int `json:"packages"`
Log string `json:"log,omitempty"`
}
RunStatus holds the response from GET /api/v1/plugins/update/logs.
type UpdateConfig ¶
type UpdateConfig struct {
SecurityAvailable *bool `json:"security_available"`
AutoSecurity *bool `json:"auto_security"`
SecuritySource string `json:"security_source,omitempty"`
Schedule string `json:"schedule,omitempty"`
}
UpdateConfig holds the response from GET /api/v1/plugins/update/config.