Documentation
¶
Overview ¶
Package view prints a factorymeter/v1 report for people: as text for a terminal, as Markdown for a job summary or a pull request, and as one HTML page with charts.
It reads the report and nothing else, so anything it shows can also be read out of the JSON. The page follows the line: the verdict, the seven stations side by side, agents next to people, then each station with its history, and last what the numbers stand on.
Index ¶
- Constants
- Variables
- func CSP() string
- func Change(s *contract.Series) string
- func Duration(hours float64) string
- func HTML(w io.Writer, r *contract.Report, opt HTMLOptions) error
- func LightsOut(r *contract.Report) string
- func Markdown(w io.Writer, r *contract.Report) error
- func Number(unit string, v *float64) string
- func ServedCSP() string
- func Spark(s *contract.Series) string
- func Text(w io.Writer, r *contract.Report) error
- func WriteDrill(w io.Writer, p *DrillPage) error
- type DrillPage
- type DrillRow
- type Field
- type HTMLOptions
- type Link
- type Nav
Constants ¶
const TrackerKeysNote = "" /* 322-byte string literal not displayed */
TrackerKeysNote says where the keys searched for come from.
Variables ¶
var HealthRule = fmt.Sprintf("Each station gets the worst of three grades. Load: the share of the hours changes spend on the line that the station holds. %.0f%% or more is watch, %.0f%% or more is strained. Rework: the share of its items that failed or were sent back. %.0f%% or more is watch, %.0f%% or more is strained. Wait: a median wait that got worse than in the window before is watch. A number drawn from too few items is left out.",
loadWatch*100, loadStrained*100, reworkWatch*100, reworkStrained*100)
HealthRule says in words how a station is graded. The page shows it next to the grades.
Functions ¶
func CSP ¶
func CSP() string
CSP is the content security policy of the page. It lets the page run its own style and its own script, each pinned by its hash, and nothing else: no request to any host, no frame, no form.
func Duration ¶ added in v0.9.0
Duration prints hours as a person would say them: minutes, hours, days, weeks, months or years, whichever reads shortest.
func HTML ¶
HTML writes the report as one page with its charts. The page carries its own style and script and loads nothing: it reads the same offline, from a file, and from "factorymeter serve".
func LightsOut ¶ added in v0.4.0
LightsOut is the link to the Lights Out simulator, filled in with the numbers of a report. It is empty when the report has none of them.
The numbers ride after the "#". A browser never sends that part of an address to a server, so opening the link shares nothing. The simulator reads them, fills in its form, and takes them out of the address bar. A number the report does not have is left out, and the simulator keeps its own default for it.
func ServedCSP ¶ added in v0.8.0
func ServedCSP() string
ServedCSP is the policy of the page serve shows. Its repository menu is a form that asks the same server for the page again, so a form may go there.
Types ¶
type DrillPage ¶ added in v0.9.0
type DrillPage struct {
Name, Station, Target, Value, Period string
// How says how the number comes from the rows below.
How string
// Others names observations no item can be shown for.
Others, Definition string
// Back is the address of the line, at the station of the number.
Back string
ItemHead, WhenHead, ValueHead string
Rows []DrillRow
}
DrillPage lists the items one number of the line was drawn from.
type DrillRow ¶ added in v0.9.0
type DrillRow struct {
Key, URL, Title, Who, When, Value string
// Dim marks a row that is counted but is not a hit of a share.
Dim bool
}
DrillRow is one item a number counted.
type Field ¶ added in v0.8.0
type Field struct{ Name, Value string }
Field is a name and value a form sends.
type HTMLOptions ¶
type HTMLOptions struct {
}
HTMLOptions sets what the page shows besides the report.
type Nav ¶
type Nav struct {
// shown. The menu is a form that asks for the ticked ones.
Repos []Link
// name, or "3 of 13 repositories".
RepoLabel string
AllRepos string
Keep []Field
// of the page and without the metric. Empty: the page cannot drill.
Drill string
// From and Until are the dates of the window, for the date form, and
// Repos the repositories the form sends again.
Nav holds the links that only a served page has. A page written to a file has none: it shows one window and cannot ask for another.