Documentation
¶
Overview ¶
templ: version: v0.3.1020
Index ¶
- Constants
- func Calendar(days []postgres.Day, workflow string, span int) ([]Square, []Month, int, int)
- func Card(label string) templ.Component
- func Dot(status string) templ.Component
- func Duration(d *time.Duration) string
- func Empty(msg, hint string) templ.Component
- func ErrorButton(runID string) templ.Component
- func ErrorDialog(runID, workflow, status, message string) templ.Component
- func Heatmap(days []postgres.Day, workflow string) templ.Component
- func LoadTrend(series []TrendSeries, window string) templ.Component
- func Metric(label, value, nota string, matiz string) templ.Component
- func Rosca(i postgres.Indicators) templ.Component
- func RunsChart(buckets []postgres.Bucket) templ.Component
- func State(status string) templ.Component
- func Tag(text, rota string) templ.Component
- func Timestamp(t *time.Time) string
- func TrendGeometry() (int, int)
- func TrendWindow(days []postgres.LoadDay) string
- func UTCStamp(t *time.Time) string
- func When(t *time.Time) string
- type Arc
- type Bar
- type Brand
- type GridLine
- type Month
- type Square
- type TrendPoint
- type TrendSeries
- type WeekdayLabel
Constants ¶
const TrendDays = 90
TrendDays is how far back the trend reads. Ninety rather than the calendar's year: a chart with 364 points on 300 units of width draws under one point per pixel, and "is it getting worse" is a question about the recent past.
Variables ¶
This section is empty.
Functions ¶
func Calendar ¶ added in v0.11.2
Calendar lays a year of days out as a GitHub-style grid: one column per week, Sunday at the top.
The colour is the day's WORST OUTCOME, not its volume, and that is the whole decision behind this chart. GitHub encodes how much happened, because that is its question. The question here is "when did this pipeline break", and a heatmap where a busy Tuesday and a broken Tuesday are both dark answers neither. Volume is what the bar chart above already draws.
func Card ¶ added in v0.7.0
Card is the base panel: a light surface, a thin border, a warm wide shadow.
func Dot ¶ added in v0.7.0
Dot is the minimal version, for dense tables where the label is already in the column.
func Duration ¶ added in v0.7.0
Duration picks the unit by order of magnitude. "0.4s" says more than "400ms" in a column whose neighbour takes minutes.
func Empty ¶ added in v0.7.0
Empty communicates the absence of data without looking like an error. An empty table with no explanation sends the operator looking for a defect where there is none.
func ErrorButton ¶ added in v0.7.0
--------------------------------------------------------------------------- Err em dialogo
The error used to occupy a whole row below the run, inside the table. With a real stack trace that pushed the rest of the list off the screen and mixed two things — the list and the detail. Now the row holds a button, and the text lives in a native <dialog>: ESC closes it, the backdrop dims and the focus stays trapped inside it without a line of JavaScript of ours. ---------------------------------------------------------------------------
func ErrorDialog ¶ added in v0.7.0
func Heatmap ¶ added in v0.11.2
Heatmap draws a year of days, one square each.
Server-rendered SVG like every other chart here: it needs no library, it is in the HTML the first time the page arrives, and it prints. The tooltip is a <title>, which the browser shows on its own -- the same one the bar chart uses.
func LoadTrend ¶ added in v0.13.0
func LoadTrend(series []TrendSeries, window string) templ.Component
LoadTrend draws what a workflow's pipelines have been loading.
Four sparklines, server-rendered like the calendar: a chart that needs a runtime is a chart that does not appear on the page somebody opens during an incident.
The panel is DRAWN ONLY when there is history. A workflow whose steps are shell commands has no load to trend, and four empty boxes on its page would be four questions with no answer -- the caller checks, so this never has to render an apology.
func Metric ¶ added in v0.7.0
Metric is one of the four numbers at the top of the Overview. The large serif number is what sets the editorial tone — in sans it would become just another dashboard.
func Rosca ¶
func Rosca(i postgres.Indicators) templ.Component
Rosca resume a mesma janela em proporcao. O total no centro evita a leitura only relative: 95% of twenty runs is not 95% of two thousand.
func RunsChart ¶ added in v0.7.0
RunsChart draws one stacked column per hour, with the average-duration line on top — the two readings the Overview screen has to cross: "how many" and "quanto tempo".
func State ¶ added in v0.7.0
State desenha o estado de um Run.
The colours are desaturated on purpose: a dashboard's pure green and red fight the parchment and shout louder than the information. The shape carries meaning too — the dot is filled for what has finished and ringed for what is still alive — so it does not depend on colour alone.
func Timestamp ¶ added in v0.7.0
Timestamp is the full date, for audit columns, in the timezone of WHOEVER FORMATS -- which is the process's TZ, not the reader's.
The marker is not decoration. It used to render "2026-03-10 22:00:00" and stop there, and the same instant reads 22:00 on a machine at UTC-3 and 01:00 in a pod at UTC. Two people comparing one failure at three in the morning disagreed about when it happened, with nothing on the screen to reconcile them. notify/slack.go had already learned this and appends MST for the same reason; the screen had not.
For a value that IS UTC by contract -- a slot, an auto param -- use UTCStamp: local time there would make the screen disagree with the $BREVIS_AUTO_* variable the step actually reads.
func TrendGeometry ¶ added in v0.13.0
TrendGeometry hands the template the viewBox it should use.
func TrendWindow ¶ added in v0.13.0
TrendWindow is the span the panel covers, for the caption.
func UTCStamp ¶ added in v0.10.1
UTCStamp is the full date in UTC, for values that are UTC by contract.
The slot and the auto params are stored, injected and read in UTC -- a step gets `2026-03-11T01:00:00Z` in $BREVIS_AUTO_ADJUSTED_AT. Rendering those in the server's local time made the screen show `2026-03-10 22:00:00` beside a `date` of `2026-03-11`: one day apart, in the same grid, with nothing saying why, and a third answer for anyone who checked the environment.
The screen agreeing with the contract is worth more than the screen agreeing with the clock of whoever ran the deployment.
Types ¶
type Square ¶ added in v0.11.2
type Square struct {
X, Y int
Date time.Time
Fill string
Tooltip string
Link string
// Empty says nothing ran. It is drawn, and drawn faintly: a missing square
// would make the grid ragged and a reader would count the gap as a week.
Empty bool
}
Square is one day of the calendar.
type TrendPoint ¶ added in v0.13.0
TrendPoint is one day on the line, carrying its own tooltip.
type TrendSeries ¶ added in v0.13.0
type TrendSeries struct {
Label string
Latest string // the current value, formatted
Delta string // how it moved across the window, e.g. "+38%"
Hue string // the CSS class for Delta
Note string // what the number means, in words
Path string // the polyline's points
Area string // the same, closed to the baseline
Points []TrendPoint
Empty bool // no data at all: the panel says so instead of drawing a flat line
Flat bool // one day only, so there is no trend yet
}
TrendSeries is one line of the load trend, ready to draw.
Everything the template needs is computed here rather than in the markup: a `.templ` file that does arithmetic is a file where a division by zero becomes a blank page during an incident.
func Trend ¶ added in v0.13.0
func Trend(days []postgres.LoadDay) []TrendSeries
Trend turns a workflow's load history into the four series the screen draws.
Four, and these four, because they are the note's own questions: is the dataset growing, is each row getting fatter, is the source getting slower, is the destination getting slower. A fifth would be a number nobody asked for, and this panel has to be readable at a glance during an incident.
type WeekdayLabel ¶ added in v0.11.2
WeekdayLabel is one of the three labels down the calendar's left edge.