dashboard

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package dashboard provides an extensible dashboard for Zero.

The dashboard is served under `/_admin/`, with each component directly underneath that.

API calls for each Component should be handled by //zero:api endpoints, and mounted under `/_admin/api/<slug>/...`.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Component

type Component interface {
	Detail() Detail
	// Children returns sub-components for expandable sections.
	Children() Components
	// SetRenderer sets the renderer for the component.
	SetRenderer(renderer *Renderer)
}

Component defines the structure of a dashboard component.

type Components

type Components []Component

type Dashboard

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

func New

func New(logger *slog.Logger, config zerohttp.Config, components Components) *Dashboard

New creates a new Dashboard instance.

func (*Dashboard) Admin

func (d *Dashboard) Admin(ctx context.Context) (string, error)

type Detail

type Detail struct {
	// Icon returns the Font Awesome 5 icon for the sidebar.
	Icon string
	// Title of the component in the sidebar.
	Title string
	// Slug for the component.
	Slug string
}

type Renderer

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

Renderer is used by components to render their content in the admin panel.

func NewRenderer

func NewRenderer(selected Component, components Components) *Renderer

NewRenderer creates a new Renderer instance.

func (*Renderer) RenderString

func (l *Renderer) RenderString(ctx context.Context, content string) (string, error)

RenderString renders a string in the main content container of the admin panel.

func (*Renderer) RenderTemplate

func (l *Renderer) RenderTemplate(ctx context.Context, html *template.Template, data any) (string, error)

RenderTemplate renders a html/template precompiled template in the main content container of the admin panel.

Jump to

Keyboard shortcuts

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