Documentation
¶
Overview ¶
templ: version: v0.3.1001
Package dashboard provides a server-rendered web UI for Engram Cloud. It uses templ for HTML templating and htmx for partial page updates. All static assets are embedded in the binary via go:embed.
templ: version: v0.3.1001
templ: version: v0.3.1001
Index ¶
- Variables
- func AdminForbidden() templ.Component
- func AdminHealthPage(health *cloudstore.SystemHealthInfo) templ.Component
- func AdminPage(health *cloudstore.SystemHealthInfo, controls []cloudstore.ProjectSyncControl) templ.Component
- func AdminProjectsPage(controls []cloudstore.ProjectSyncControl) templ.Component
- func AdminUsersPage(users []cloudstore.CloudUser) templ.Component
- func BrowserPage(projects []string, types []string, activeProject string, search string, ...) templ.Component
- func ContributorDetailPage(user *cloudstore.CloudUser, contributor *cloudstore.ContributorStat, ...) templ.Component
- func ContributorsPage(contributors []cloudstore.ContributorStat) templ.Component
- func DashboardHome(username string) templ.Component
- func DashboardStatsPartial(stats []cloudstore.ProjectStat, projects []string) templ.Component
- func EmptyState(title string, message string) templ.Component
- func Layout(title string, username string, activeTab string, isAdmin bool, ...) templ.Component
- func LoginPage(errorMsg string) templ.Component
- func Mount(mux *http.ServeMux, store *cloudstore.CloudStore, authSvc *auth.Service, ...)
- func NavTabs(activeTab string, isAdmin bool) templ.Component
- func ObservationDetailPage(observation *cloudstore.CloudObservation, session *cloudstore.CloudSession, ...) templ.Component
- func ObservationsPartial(observations []cloudstore.CloudObservation) templ.Component
- func ProjectDetailPage(project string, stats *cloudstore.ProjectStat, ...) templ.Component
- func ProjectsPage(stats []cloudstore.ProjectStat, ...) templ.Component
- func PromptDetailPage(prompt *cloudstore.CloudPrompt, session *cloudstore.CloudSession, ...) templ.Component
- func PromptsPartial(prompts []cloudstore.CloudPrompt) templ.Component
- func SessionDetailPage(session *cloudstore.CloudSession, observations []cloudstore.CloudObservation, ...) templ.Component
- func SessionsPartial(sessions []cloudstore.CloudSessionSummary) templ.Component
- func StatusBadge(label string, variant string) templ.Component
- type DashboardConfig
Constants ¶
This section is empty.
Variables ¶
var StaticFS embed.FS
StaticFS embeds the static/ directory (htmx.min.js, pico.min.css, styles.css) into the binary so no external files are needed at runtime.
Functions ¶
func AdminForbidden ¶
AdminForbidden renders the 403 page for non-admin users.
func AdminHealthPage ¶
func AdminHealthPage(health *cloudstore.SystemHealthInfo) templ.Component
AdminHealthPage renders the system health detail view.
func AdminPage ¶
func AdminPage(health *cloudstore.SystemHealthInfo, controls []cloudstore.ProjectSyncControl) templ.Component
AdminPage renders the admin dashboard landing with sub-navigation.
func AdminProjectsPage ¶
func AdminProjectsPage(controls []cloudstore.ProjectSyncControl) templ.Component
AdminProjectsPage renders organization-level project sync controls.
func AdminUsersPage ¶
func AdminUsersPage(users []cloudstore.CloudUser) templ.Component
AdminUsersPage renders the user management view.
func BrowserPage ¶
func BrowserPage(projects []string, types []string, activeProject string, search string, activeType string) templ.Component
BrowserPage renders the knowledge browser with subtabs and filter controls.
func ContributorDetailPage ¶
func ContributorDetailPage(user *cloudstore.CloudUser, contributor *cloudstore.ContributorStat, sessions []cloudstore.CloudSessionSummary, observations []cloudstore.CloudObservation, prompts []cloudstore.CloudPrompt) templ.Component
func ContributorsPage ¶
func ContributorsPage(contributors []cloudstore.ContributorStat) templ.Component
ContributorsPage renders the contributors list view.
func DashboardHome ¶
DashboardHome renders the main dashboard landing content with project stats.
func DashboardStatsPartial ¶
func DashboardStatsPartial(stats []cloudstore.ProjectStat, projects []string) templ.Component
DashboardStatsPartial renders the project stats table, loaded via htmx.
func EmptyState ¶
EmptyState renders a centered empty-state placeholder.
func Layout ¶
func Layout(title string, username string, activeTab string, isAdmin bool, content templ.Component) templ.Component
Layout wraps page content in the base HTML shell with nav, head, and footer. activeTab should be one of: "dashboard", "browser", "projects", "contributors", "admin".
func Mount ¶
func Mount(mux *http.ServeMux, store *cloudstore.CloudStore, authSvc *auth.Service, cfg DashboardConfig)
Mount registers all dashboard routes on the given mux. It attaches:
- GET /dashboard/static/* — embedded static files (htmx, CSS)
- GET /dashboard/health — dashboard health check
- GET /dashboard/login — login page (unauthenticated)
- POST /dashboard/login — login form submission
- POST /dashboard/logout — clear session cookie
- GET /dashboard/ — main dashboard (authenticated)
- GET /dashboard/stats — dashboard stats partial (htmx)
- GET /dashboard/browser — knowledge browser page
- GET /dashboard/browser/observations — observations partial (htmx)
- GET /dashboard/browser/sessions — sessions partial (htmx)
- GET /dashboard/browser/prompts — prompts partial (htmx)
- GET /dashboard/projects — projects list
- GET /dashboard/projects/{name} — project detail
- GET /dashboard/contributors — contributors list
- GET /dashboard/admin — admin overview (admin only)
- GET /dashboard/admin/users — admin user management (admin only)
- GET /dashboard/admin/health — admin system health (admin only)
func NavTabs ¶
NavTabs renders the navigation tab bar. activeTab should be one of: "dashboard", "browser", "projects", "contributors", "admin".
func ObservationDetailPage ¶
func ObservationDetailPage(observation *cloudstore.CloudObservation, session *cloudstore.CloudSession, related []cloudstore.CloudObservation) templ.Component
ObservationDetailPage renders the full observation payload with session context.
func ObservationsPartial ¶
func ObservationsPartial(observations []cloudstore.CloudObservation) templ.Component
ObservationsPartial renders the observations list, loaded as an htmx partial.
func ProjectDetailPage ¶
func ProjectDetailPage(project string, stats *cloudstore.ProjectStat, control *cloudstore.ProjectSyncControl, sessions []cloudstore.CloudSessionSummary, observations []cloudstore.CloudObservation, prompts []cloudstore.CloudPrompt) templ.Component
ProjectDetailPage renders the detail view for a single project.
func ProjectsPage ¶
func ProjectsPage(stats []cloudstore.ProjectStat, controls map[string]cloudstore.ProjectSyncControl) templ.Component
ProjectsPage renders the projects list view.
func PromptDetailPage ¶
func PromptDetailPage(prompt *cloudstore.CloudPrompt, session *cloudstore.CloudSession, related []cloudstore.CloudPrompt) templ.Component
func PromptsPartial ¶
func PromptsPartial(prompts []cloudstore.CloudPrompt) templ.Component
PromptsPartial renders the prompts list, loaded as an htmx partial.
func SessionDetailPage ¶
func SessionDetailPage(session *cloudstore.CloudSession, observations []cloudstore.CloudObservation, prompts []cloudstore.CloudPrompt) templ.Component
SessionDetailPage renders a connected session detail surface with all related activity.
func SessionsPartial ¶
func SessionsPartial(sessions []cloudstore.CloudSessionSummary) templ.Component
SessionsPartial renders the sessions list, loaded as an htmx partial.
Types ¶
type DashboardConfig ¶
type DashboardConfig struct {
// AdminEmail is the email of the admin user. When set, the Admin tab is
// visible to the authenticated user whose email matches this value.
// Populated from the ENGRAM_CLOUD_ADMIN environment variable.
AdminEmail string
}
DashboardConfig holds dashboard-specific configuration.