templates

package
v0.29.0 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RenderTempl

func RenderTempl(c *gin.Context, status int, component templ.Component)

RenderTempl renders a templ component to a Gin context

Types

type AuditLogsPageProps

type AuditLogsPageProps struct {
	BaseProps
	NavbarProps
	User        *models.User
	Logs        []*models.AuditLog
	TotalItems  int
	Page        int
	TotalPages  int
	NextPage    int
	PrevPage    int
	PageSize    int
	Search      string
	EventType   string
	Severity    string
	Success     string
	ActorIP     string
	QueryString string
}

AuditLogsPageProps contains properties for the audit logs page

type AuthorizationDisplay

type AuthorizationDisplay struct {
	UUID       string
	ClientID   string
	ClientName string
	Scopes     string
	GrantedAt  time.Time
	IsActive   bool
}

AuthorizationDisplay is a view model for a single user authorization entry

type AuthorizationsPageProps

type AuthorizationsPageProps struct {
	BaseProps
	NavbarProps
	Authorizations []AuthorizationDisplay
	Success        string
	Error          string
}

AuthorizationsPageProps contains properties for the account authorizations page

type AuthorizePageProps

type AuthorizePageProps struct {
	BaseProps
	NavbarProps
	Username            string
	ClientID            string
	ClientName          string
	ClientDescription   string
	RedirectURI         string
	Scopes              string   // Space-separated scope string
	ScopeList           []string // Pre-split scope list for template iteration
	State               string
	Nonce               string
	CodeChallenge       string
	CodeChallengeMethod string
	Error               string
}

AuthorizePageProps contains properties for the OAuth consent page

type BaseProps

type BaseProps struct {
	CSRFToken string
}

BaseProps contains common properties shared across all pages

type ClientAuthorizationDisplay

type ClientAuthorizationDisplay struct {
	UUID      string
	UserID    string
	Username  string
	Email     string
	Scopes    string
	GrantedAt time.Time
}

ClientAuthorizationDisplay is a view model for one user's grant on the admin overview page

type ClientAuthorizationsPageProps

type ClientAuthorizationsPageProps struct {
	BaseProps
	NavbarProps
	Client         *models.OAuthApplication
	Authorizations []ClientAuthorizationDisplay
	Error          string
}

ClientAuthorizationsPageProps contains properties for the admin client-authorizations page

type ClientCreatedPageProps

type ClientCreatedPageProps struct {
	BaseProps
	NavbarProps
	Client       *ClientDisplay
	ClientSecret string
}

ClientCreatedPageProps contains properties for the client created page

type ClientDetailPageProps

type ClientDetailPageProps struct {
	BaseProps
	NavbarProps
	Client           *models.OAuthApplication
	ActiveTokenCount int64 // Number of active tokens for this client
	Success          string
	Error            string
}

ClientDetailPageProps contains properties for the client detail page

type ClientDisplay

type ClientDisplay struct {
	ID                          int64
	ClientID                    string
	ClientName                  string
	Description                 string
	UserID                      string
	Scopes                      string
	GrantTypes                  string
	RedirectURIs                string // Comma-separated string
	ClientType                  string // "confidential" or "public"
	EnableDeviceFlow            bool
	EnableAuthCodeFlow          bool
	EnableClientCredentialsFlow bool
	Status                      string // "pending", "active", "inactive"
	TokenProfile                string // "short", "standard", or "long"
	Project                     string // Optional; emitted as JWT "project" claim
	ServiceAccount              string // Optional; emitted as JWT "service_account" claim
	CreatedAt                   time.Time
	UpdatedAt                   time.Time
}

ClientDisplay wraps OAuthApplication with string fields for template rendering

type ClientFormFieldsProps added in v0.17.0

type ClientFormFieldsProps struct {
	Client                *ClientDisplay
	IsEdit                bool
	NameLabel             string // Display label: "App Name" (user) or "Client Name" (admin)
	ShowClientCredentials bool   // Render the Client Credentials Flow checkbox; client-type restriction (disabled for public) is enforced in template JS
	ScopePresetsOnly      bool   // Restrict scopes to preset chips only (user form)
}

ClientFormFieldsProps configures the shared client form fields component.

type ClientFormPageProps

type ClientFormPageProps struct {
	BaseProps
	NavbarProps
	Client *ClientDisplay
	Error  string
	IsEdit bool
	Title  string
	Method string
	Action string
}

ClientFormPageProps contains properties for the client form page

type ClientSecretPageProps

type ClientSecretPageProps struct {
	BaseProps
	NavbarProps
	Client       *models.OAuthApplication
	ClientSecret string
}

ClientSecretPageProps contains properties for the client secret page

type ClientsPageProps

type ClientsPageProps struct {
	BaseProps
	NavbarProps
	User         *models.User
	Clients      []services.ClientWithCreator
	Pagination   store.PaginationResult
	Search       string
	PageSize     int
	Success      string
	StatusFilter string // "pending", "active", "inactive", or "" for all
}

ClientsPageProps contains properties for the admin clients page

type DashboardPageProps added in v0.24.0

type DashboardPageProps struct {
	BaseProps
	NavbarProps
	Stats services.DashboardStats
}

DashboardPageProps contains properties for the admin dashboard page

type DevicePageProps

type DevicePageProps struct {
	BaseProps
	NavbarProps
	Username   string
	UserCode   string
	ClientName string
	Error      string
}

DevicePageProps contains properties for the device authorization page

type DocsEntry added in v0.16.0

type DocsEntry struct {
	Slug  string
	Title string
}

DocsEntry represents a single entry in the docs sidebar navigation. The template derives active-state by comparing Slug to DocsPageProps.CurrentSlug.

type DocsLocaleOption added in v0.28.0

type DocsLocaleOption struct {
	Code  string // BCP-47 locale code, e.g. "en", "zh-TW"
	Label string // human-readable label ("English", "繁體中文")
}

DocsLocaleOption represents a single choice in the docs language switcher. The template derives selected-state by comparing Code to DocsPageProps.Locale and builds the HRef from Code and DocsPageProps.CurrentSlug.

type DocsPageProps added in v0.16.0

type DocsPageProps struct {
	NavbarProps
	Title         string
	ContentHTML   string
	CurrentSlug   string // slug being rendered; drives active/selected state in templ
	Entries       []DocsEntry
	Locale        string // BCP-47 code of the locale used to render this page
	SidebarTitle  string // localized sidebar heading ("Documentation" / "技術文件")
	LangLabel     string // aria-label for the language switcher group
	LocaleOptions []DocsLocaleOption
}

DocsPageProps contains properties for the docs page

type ErrorPageProps

type ErrorPageProps struct {
	BaseProps
	Error    string
	Message  string
	RetryURL string // URL for the "Try Again" button; defaults to "/" if empty
}

ErrorPageProps contains properties for the error page

type LoginPageProps

type LoginPageProps struct {
	BaseProps
	NavbarProps
	Error             string
	Redirect          string
	OAuthProviders    []OAuthProvider
	RememberMeEnabled bool
	RememberMeDays    int // Display label: "Remember me for N days"
}

LoginPageProps contains properties for the login page

type MyAppsPageProps added in v0.17.0

type MyAppsPageProps struct {
	BaseProps
	NavbarProps
	Apps       []models.OAuthApplication
	Pagination store.PaginationResult
	PageSize   int
	Search     string
}

MyAppsPageProps contains properties for the user's own app list page

type NavbarProps struct {
	Username            string
	FullName            string
	IsAdmin             bool
	ActiveLink          string      // e.g. "device", "sessions", "clients", "audit", "docs-<slug>"
	PendingClientsCount int         // Badge count for admin → OAuth Clients link
	DocsNavEntries      []DocsEntry // Docs dropdown entries, localized per the user's docs_lang cookie
}

NavbarProps contains properties for the navigation bar

func (p *NavbarProps) DisplayName() string

DisplayName returns FullName if set, otherwise Username.

func (p *NavbarProps) IsDocsActive() bool

IsDocsActive returns true if the current ActiveLink belongs to a docs page.

type OAuthProvider

type OAuthProvider struct {
	Name        string
	DisplayName string
}

OAuthProvider represents an OAuth provider configuration

type PaginationProps

type PaginationProps struct {
	Pagination  store.PaginationResult
	BaseURL     string
	QueryParams map[string]string
}

PaginationProps contains properties for pagination component

type SecretRegeneratedCardProps added in v0.22.0

type SecretRegeneratedCardProps struct {
	BreadcrumbItems []BreadcrumbItem
	ClientName      string
	PlainSecret     string
	EditLabel       string // e.g. "Edit Client Settings" or "Edit App Settings"
	EditPath        string
	DetailsPath     string
	BackLabel       string // e.g. "Back to Clients List" or "Back to My Apps"
	BackPath        string
}

SecretRegeneratedCardProps configures the shared secret-regeneration card used by both AdminClientSecret and UserAppSecret.

type SessionsPageProps

type SessionsPageProps struct {
	BaseProps
	NavbarProps
	Sessions       []services.TokenWithClient
	Pagination     store.PaginationResult
	Search         string
	PageSize       int
	StatusFilter   string
	CategoryFilter string
}

SessionsPageProps contains properties for the sessions page

func (SessionsPageProps) HasActiveFilters added in v0.24.0

func (p SessionsPageProps) HasActiveFilters() bool

HasActiveFilters returns true if any search or filter is applied.

type SfSearchRowProps added in v0.24.0

type SfSearchRowProps struct {
	Action          string            // form GET target (e.g. "/account/sessions")
	Search          string            // current search value
	PageSize        int               // current page size
	PageSizeOptions []int             // e.g. [10,20,50]; nil defaults to [10,20,50]
	Placeholder     string            // search input placeholder text
	ClearHref       string            // href for the Clear button
	HiddenFields    map[string]string // extra hidden inputs to preserve filter state
	SearchLabel     string            // submit button text; defaults to "Search"
}

SfSearchRowProps configures the shared search & filter toolbar search row.

type SuccessPageProps

type SuccessPageProps struct {
	BaseProps
	Username   string
	ClientName string
}

SuccessPageProps contains properties for the success page

type TokensPageProps added in v0.24.0

type TokensPageProps struct {
	BaseProps
	NavbarProps
	Tokens         []services.TokenWithUser
	Pagination     store.PaginationResult
	Search         string
	PageSize       int
	StatusFilter   string
	CategoryFilter string
	Success        string
	Warning        string
	Now            time.Time
}

TokensPageProps contains properties for the admin tokens page

type UserAuthorizationsPageProps added in v0.26.0

type UserAuthorizationsPageProps struct {
	BaseProps
	NavbarProps
	TargetUser     *models.User
	Authorizations []AuthorizationDisplay
	Success        string
	Error          string
}

UserAuthorizationsPageProps contains properties for the admin user authorizations page

type UserClientCreatedPageProps added in v0.17.0

type UserClientCreatedPageProps struct {
	BaseProps
	NavbarProps
	Client      *ClientDisplay
	PlainSecret string
}

UserClientCreatedPageProps contains properties for the post-creation page (one-time secret reveal)

type UserClientDetailPageProps added in v0.17.0

type UserClientDetailPageProps struct {
	BaseProps
	NavbarProps
	Client       *ClientDisplay
	ActiveTokens int64
	Success      string
	Error        string
}

UserClientDetailPageProps contains properties for the user app detail page

type UserClientFormPageProps added in v0.17.0

type UserClientFormPageProps struct {
	BaseProps
	NavbarProps
	Title  string
	Action string
	Method string
	IsEdit bool
	Client *ClientDisplay // nil when creating
	Error  string
}

UserClientFormPageProps contains properties for the user app create/edit form page

type UserClientSecretPageProps added in v0.22.0

type UserClientSecretPageProps = UserClientCreatedPageProps

UserClientSecretPageProps is used by the dedicated secret-regeneration page. It carries the same fields as UserClientCreatedPageProps but gives the template a self-describing name for the regeneration flow.

type UserCreatePageProps added in v0.26.0

type UserCreatePageProps struct {
	BaseProps
	NavbarProps
	Error    string
	Username string // form repopulation on error
	Email    string
	FullName string
	Role     string
}

UserCreatePageProps contains properties for the admin user create form

type UserCreatedPageProps added in v0.26.0

type UserCreatedPageProps struct {
	BaseProps
	NavbarProps
	TargetUser  *models.User
	NewPassword string
}

UserCreatedPageProps contains properties for the admin user created success page

type UserDetailPageProps added in v0.24.0

type UserDetailPageProps struct {
	BaseProps
	NavbarProps
	TargetUser           *models.User
	ActiveTokenCount     int64
	OAuthConnectionCount int64
	AuthorizationCount   int64
	Success              string
	Error                string
}

UserDetailPageProps contains properties for the admin user detail page

type UserFormPageProps added in v0.24.0

type UserFormPageProps struct {
	BaseProps
	NavbarProps
	TargetUser *models.User
	Error      string
	IsSelf     bool // true if editing own account (disable role change)
}

UserFormPageProps contains properties for the admin user edit form

type UserOAuthConnectionsPageProps added in v0.26.0

type UserOAuthConnectionsPageProps struct {
	BaseProps
	NavbarProps
	TargetUser  *models.User
	Connections []models.OAuthConnection
	Success     string
	Error       string
}

UserOAuthConnectionsPageProps contains properties for the admin user OAuth connections page

type UserPasswordResetPageProps added in v0.24.0

type UserPasswordResetPageProps struct {
	BaseProps
	NavbarProps
	TargetUser  *models.User
	NewPassword string
	Warning     string // non-fatal warning (e.g. token revocation failure)
}

UserPasswordResetPageProps contains properties for the password reset result page

type UsersPageProps added in v0.24.0

type UsersPageProps struct {
	BaseProps
	NavbarProps
	User             *models.User
	Users            []models.User
	Pagination       store.PaginationResult
	Search           string
	PageSize         int
	Success          string
	RoleFilter       string // "admin", "user", or "" for all
	AuthSourceFilter string // "local", "http_api", or "" for all
}

UsersPageProps contains properties for the admin users list page

Jump to

Keyboard shortcuts

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