dashboard

package
v1.14.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 27, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

templ: version: v0.3.1001

templ: version: v0.3.1001

templ: version: v0.3.1001

Index

Constants

This section is empty.

Variables

View Source
var StaticFS embed.FS

Functions

func AdminAuditLogListPartial added in v1.13.0

func AdminAuditLogListPartial(entries []cloudstore.DashboardAuditRow, pg Pagination, filter cloudstore.AuditFilter) templ.Component

AdminAuditLogListPartial renders the audit log table with filters and pagination. REQ-409, REQ-410.

func AdminAuditLogPage added in v1.13.0

func AdminAuditLogPage(displayName string, filter cloudstore.AuditFilter) templ.Component

AdminAuditLogPage renders the admin audit log shell page. The HTMX container triggers loading the list partial on page load. REQ-408. JW2: buildAuditListURL embeds active filter params into the initial hx-get URL so that deep-linking /dashboard/admin/audit-log?contributor=alice preserves filters.

func AdminForbidden

func AdminForbidden() templ.Component

AdminForbidden renders the 403 page for non-admin users.

func AdminHealthPage

func AdminHealthPage(health *cloudstore.DashboardSystemHealth) templ.Component

AdminHealthPage renders the system health detail view. ADAPTED: SystemHealthInfo -> DashboardSystemHealth.

func AdminPage

AdminPage renders the admin dashboard landing with sub-navigation. ADAPTED: SystemHealthInfo -> DashboardSystemHealth; ProjectSyncControl kept.

func AdminProjectsPage

func AdminProjectsPage(controls []cloudstore.ProjectSyncControl) templ.Component

AdminProjectsPage renders organization-level project sync controls. ADAPTED: ProjectSyncControl kept (integrated cloudstore now has it).

func AdminSyncToggleFormPartial added in v1.13.0

func AdminSyncToggleFormPartial(control cloudstore.ProjectSyncControl) templ.Component

AdminSyncToggleFormPartial renders the HTMX-driven toggle form for a single project.

func AdminUsersListPartial added in v1.13.0

func AdminUsersListPartial(contributors []cloudstore.DashboardContributorRow, pg Pagination) templ.Component

AdminUsersListPartial renders only the admin users table + HtmxPaginationBar (no shell, no outer wrapper). R5-2: used by /dashboard/admin/users/list so HTMX pagination works without full-page nav. R6-1: outer <div id="admin-users-content"> removed — avoids duplicate IDs on HTMX innerHTML swap.

func AdminUsersPage

func AdminUsersPage() templ.Component

AdminUsersPage renders the admin users list shell. R6-1: converted to hx-get/load pattern (mirrors ProjectsPage) — inline table removed. The outer #admin-users-content div triggers an HTMX load of /dashboard/admin/users/list.

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

ContributorDetailPage renders contributor detail. ADAPTED: ContributorStat -> DashboardContributorRow. R4-8: displayName parameter removed — it was passed but never used in the template body.

func ContributorsListPartial added in v1.13.0

func ContributorsListPartial(contributors []cloudstore.DashboardContributorRow, pg Pagination) templ.Component

ContributorsListPartial renders the contributors table + HtmxPaginationBar only (no shell, no outer wrapper). R5-2: used by /dashboard/contributors/list so HTMX pagination works without full-page nav. R6-1: outer <div id="contributors-content"> removed — HTMX swaps innerHTML into the existing

shell div, so re-wrapping in the same ID would create duplicate IDs in the DOM.

func ContributorsPage

func ContributorsPage(search string) templ.Component

ContributorsPage renders the contributors list shell. R6-1: converted to hx-get/load pattern (mirrors ProjectsPage) — the inline table is removed. The outer #contributors-content div triggers an HTMX load of /dashboard/contributors/list.

func DashboardActivityPartial added in v1.13.0

func DashboardActivityPartial(stats []cloudstore.DashboardProjectRow, pg Pagination) templ.Component

DashboardActivityPartial renders the project activity table, loaded via htmx. ADAPTED: ProjectStat -> DashboardProjectRow; no LastActivity (omit that column).

func DashboardHome

func DashboardHome(username string) templ.Component

DashboardHome renders the main dashboard landing content with project stats. ADAPTED: username comes from Principal.DisplayName() at the call site.

func DashboardStatsPartial

func DashboardStatsPartial(stats []cloudstore.DashboardProjectRow, projects []string) templ.Component

DashboardStatsPartial renders the metric cards loaded via htmx. ADAPTED: ProjectStat -> DashboardProjectRow; no LastActivity field (use Chunks).

func EmptyState

func EmptyState(title string, message string) templ.Component

EmptyState renders a centered empty-state placeholder.

func Handler added in v1.13.0

func Handler() http.Handler

func HandlerWithStatus added in v1.13.0

func HandlerWithStatus(provider SyncStatusProvider) http.Handler

func HtmxPaginationBar added in v1.13.0

func HtmxPaginationBar(pg Pagination, endpoint string, target string, includes string) templ.Component

HtmxPaginationBar is the same but triggers htmx requests instead of full-page navigation. target is the htmx target element (e.g. "#browser-content"), includes are extra hx-include selectors. endpoint must be the bare path WITHOUT a trailing "?" (e.g. "/dashboard/browser/observations"). R4-2: URL format uses "?page=..." not "&page=..." to avoid malformed ?& URLs.

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". ADAPTED: username comes from Principal.DisplayName() at the call site (no context reads).

func LoginPage

func LoginPage(errorMsg string, next string) templ.Component

LoginPage renders the standalone login page (no layout wrapper). ADAPTED: added next string parameter for post-login redirect; token-only form (integrated dashboard uses ENGRAM_CLOUD_TOKEN, not user/password credentials).

func Mount

func Mount(mux *http.ServeMux, cfg MountConfig)
func NavTabs(activeTab string, isAdmin bool) templ.Component

NavTabs renders the navigation tab bar. activeTab should be one of: "dashboard", "browser", "projects", "contributors", "admin".

func ObservationDetailPage

ObservationDetailPage renders the full observation payload with session context. ADAPTED: CloudObservation -> DashboardObservationRow; CloudSession -> DashboardSessionRow.

func ObservationsPartial

func ObservationsPartial(observations []cloudstore.DashboardObservationRow, pg Pagination) templ.Component

ObservationsPartial renders the observations list, loaded as an htmx partial. ADAPTED: CloudObservation -> DashboardObservationRow; composite URL for detail page. R3-1: HtmxPaginationBar added so users have visible page controls in the browser.

func PaginationBar added in v1.13.0

func PaginationBar(pg Pagination, baseURL string, extraParams map[string]string) templ.Component

PaginationBar renders page navigation controls with a page-size selector. baseURL is the path without query params (e.g. "/dashboard/projects"). extraParams preserves existing query params (project, q, type, etc.).

func ProjectDetailPage

func ProjectDetailPage(project string, stats *cloudstore.DashboardProjectRow, control *cloudstore.ProjectSyncControl) templ.Component

ProjectDetailPage renders the detail view for a single project. ADAPTED: ProjectStat -> DashboardProjectRow; ProjectSyncControl kept.

func ProjectsListPartial added in v1.13.0

func ProjectsListPartial(stats []cloudstore.DashboardProjectRow, controls map[string]cloudstore.ProjectSyncControl, pg Pagination) templ.Component

ProjectsListPartial renders the project cards grid, loaded via htmx. ADAPTED: ProjectStat -> DashboardProjectRow; ProjectSyncControl kept (now in integrated cloudstore). R4-3: HtmxPaginationBar added so users can navigate beyond the first page.

func ProjectsPage

func ProjectsPage(search string) templ.Component

ProjectsPage renders the projects list view.

func PromptDetailPage

PromptDetailPage renders a prompt detail page. ADAPTED: CloudPrompt -> DashboardPromptRow; CloudSession -> DashboardSessionRow.

func PromptsPartial

func PromptsPartial(prompts []cloudstore.DashboardPromptRow, pg Pagination) templ.Component

PromptsPartial renders the prompts list, loaded as an htmx partial. ADAPTED: CloudPrompt -> DashboardPromptRow; composite URL for detail page. R3-1: HtmxPaginationBar added so users have visible page controls in the browser.

func SessionDetailPage

SessionDetailPage renders a connected session detail surface. ADAPTED: CloudSession -> DashboardSessionRow; CloudObservation -> DashboardObservationRow; CloudPrompt -> DashboardPromptRow.

func SessionsPartial

func SessionsPartial(sessions []cloudstore.DashboardSessionRow, pg Pagination) templ.Component

SessionsPartial renders the sessions list, loaded as an htmx partial. ADAPTED: CloudSessionSummary -> DashboardSessionRow; composite URL for detail page. R3-1: HtmxPaginationBar added so users have visible page controls in the browser.

func StatusBadge

func StatusBadge(label string, variant string) templ.Component

StatusBadge renders a colored status badge. variant should be one of: "success", "warning", "danger", "muted".

Types

type DashboardConfig

type DashboardConfig struct {
	AdminToken string
}

DashboardConfig holds dashboard-specific runtime options.

type DashboardStore added in v1.13.0

type DashboardStore interface {
	// Existing methods (from cloud-dashboard-parity).
	ListProjects(query string) ([]cloudstore.DashboardProjectRow, error)
	ProjectDetail(project string) (cloudstore.DashboardProjectDetail, error)
	ListContributors(query string) ([]cloudstore.DashboardContributorRow, error)
	ListRecentSessions(project string, query string, limit int) ([]cloudstore.DashboardSessionRow, error)
	ListRecentObservations(project string, query string, limit int) ([]cloudstore.DashboardObservationRow, error)
	ListRecentPrompts(project string, query string, limit int) ([]cloudstore.DashboardPromptRow, error)
	AdminOverview() (cloudstore.DashboardAdminOverview, error)

	// Paginated list methods (from cloud-dashboard-visual-parity).
	ListProjectsPaginated(query string, limit, offset int) ([]cloudstore.DashboardProjectRow, int, error)
	ListRecentObservationsPaginated(project, query, obsType string, limit, offset int) ([]cloudstore.DashboardObservationRow, int, error)
	ListRecentSessionsPaginated(project, query string, limit, offset int) ([]cloudstore.DashboardSessionRow, int, error)
	ListRecentPromptsPaginated(project, query string, limit, offset int) ([]cloudstore.DashboardPromptRow, int, error)
	ListContributorsPaginated(query string, limit, offset int) ([]cloudstore.DashboardContributorRow, int, error)

	// Detail methods.
	GetSessionDetail(project, sessionID string) (cloudstore.DashboardSessionRow, []cloudstore.DashboardObservationRow, []cloudstore.DashboardPromptRow, error)
	GetObservationDetail(project, sessionID, syncID string) (cloudstore.DashboardObservationRow, cloudstore.DashboardSessionRow, []cloudstore.DashboardObservationRow, error)
	GetPromptDetail(project, sessionID, syncID string) (cloudstore.DashboardPromptRow, cloudstore.DashboardSessionRow, []cloudstore.DashboardPromptRow, error)

	// SystemHealth.
	SystemHealth() (cloudstore.DashboardSystemHealth, error)

	// Sync control methods.
	ListProjectSyncControls() ([]cloudstore.ProjectSyncControl, error)
	GetProjectSyncControl(project string) (*cloudstore.ProjectSyncControl, error)
	SetProjectSyncEnabled(project string, enabled bool, updatedBy, reason string) error
	IsProjectSyncEnabled(project string) (bool, error)

	// Batch 6: Connected navigation methods.
	GetContributorDetail(name string) (cloudstore.DashboardContributorRow, []cloudstore.DashboardSessionRow, []cloudstore.DashboardObservationRow, []cloudstore.DashboardPromptRow, error)
	ListDistinctTypes() ([]string, error)

	// Audit log (REQ-409).
	ListAuditEntriesPaginated(ctx context.Context, filter cloudstore.AuditFilter, limit, offset int) ([]cloudstore.DashboardAuditRow, int, error)
}

type MountConfig added in v1.13.0

type MountConfig struct {
	RequireSession      func(r *http.Request) error
	ValidateLoginToken  func(token string) error
	CreateSessionCookie func(w http.ResponseWriter, r *http.Request, token string) error
	ClearSessionCookie  func(w http.ResponseWriter, r *http.Request)
	IsAdmin             func(r *http.Request) bool
	GetDisplayName      func(r *http.Request) string
	Store               DashboardStore
	MaxLoginBodyBytes   int64
	StatusProvider      SyncStatusProvider
}

type Pagination added in v1.13.0

type Pagination struct {
	Page       int // current page (1-indexed)
	PageSize   int // items per page
	TotalItems int // total rows from COUNT query
	TotalPages int // computed from TotalItems/PageSize
}

Pagination holds everything a templ component needs to render page controls.

func (Pagination) End added in v1.13.0

func (p Pagination) End() int

End returns the 1-indexed position of the last item on this page.

func (Pagination) HasNext added in v1.13.0

func (p Pagination) HasNext() bool

HasNext returns true if there is a next page.

func (Pagination) HasPrev added in v1.13.0

func (p Pagination) HasPrev() bool

HasPrev returns true if there is a previous page.

func (Pagination) Offset added in v1.13.0

func (p Pagination) Offset() int

Offset returns the SQL OFFSET value for the current page.

func (Pagination) PageNumbers added in v1.13.0

func (p Pagination) PageNumbers() []int

PageNumbers returns a slice of page numbers to render, with -1 as ellipsis.

func (Pagination) ShowPagination added in v1.13.0

func (p Pagination) ShowPagination() bool

ShowPagination returns true if the result set exceeds one page.

func (Pagination) Start added in v1.13.0

func (p Pagination) Start() int

Start returns the 1-indexed position of the first item on this page.

type Principal added in v1.13.0

type Principal struct {
	// contains filtered or unexported fields
}

Principal represents the authenticated dashboard user. It is a read-only view over MountConfig closures — no context reads for identity are performed inside handlers. Satisfies Design Decision 6.

func (Principal) DisplayName added in v1.13.0

func (p Principal) DisplayName() string

DisplayName returns the display name for this principal. An empty or whitespace-only name falls back to "OPERATOR".

func (Principal) IsAdmin added in v1.13.0

func (p Principal) IsAdmin() bool

IsAdmin returns whether this principal has admin privileges.

type SyncStatus added in v1.13.0

type SyncStatus struct {
	Phase                string
	ReasonCode           string
	ReasonMessage        string
	UpgradeStage         string
	UpgradeReasonCode    string
	UpgradeReasonMessage string
}

type SyncStatusProvider added in v1.13.0

type SyncStatusProvider interface {
	Status() SyncStatus
}

type TemplRuntimePolicy added in v1.13.0

type TemplRuntimePolicy struct {
	Mode                     string
	RuntimeGenerationAllowed bool
	GenerateCommand          string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL