html_report

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2026 License: Apache-2.0 Imports: 20 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetHeaderTemplate added in v0.1.0

func GetHeaderTemplate() string

GetHeaderTemplate returns the HTML header template.

func GetReportTemplate added in v0.1.0

func GetReportTemplate() string

GetReportTemplate returns the HTML report template.

Types

type ChartResult added in v0.1.0

type ChartResult struct {
	Labels   []string       `json:"labels"`
	Datasets []*LineDataSet `json:"datasets"`
}

ChartResult holds chart labels and datasets for history charts.

type CommitInfo added in v0.1.0

type CommitInfo struct {
	Hash        string `json:"hash"`
	Date        string `json:"date"`
	Message     string `json:"message"`
	Author      string `json:"author"`
	AuthorEmail string `json:"authorEmail"`
}

CommitInfo holds git metadata for a single commit.

type GraphData added in v0.1.0

type GraphData struct {
	Mode           string          `json:"mode"`
	Nodes          json.RawMessage `json:"nodes"`
	Edges          json.RawMessage `json:"edges"`
	Changes        json.RawMessage `json:"changes,omitempty"`
	NodeChangeTree json.RawMessage `json:"nodeChangeTree,omitempty"`
	GraphMap       map[int]string  `json:"graphMap,omitempty"`
	Stripped       bool            `json:"stripped,omitempty"`
	StrippedCount  int             `json:"strippedCount,omitempty"`
}

GraphData mirrors the cowboy-components GraphResponse interface. All node/edge/change fields use json.RawMessage to avoid triple-marshal (marshal nodes -> unmarshal to interface{} -> re-marshal in payload). Instead: marshal once, store raw bytes, embed directly in final JSON.

type HistoryData added in v0.1.0

type HistoryData struct {
	QualityData   *ChartResult `json:"qualityData"`
	ChangeData    *ChartResult `json:"changeData"`
	ViolationData *ChartResult `json:"violationData"`
	ChangeIds     []string     `json:"changeIds"`
}

HistoryData matches cowboy-components ChangeHistory interface. QualityData and ViolationData are always nil (serializes as JSON null).

func BuildHistoryData added in v0.1.0

func BuildHistoryData(items []*ReportItem) *HistoryData

BuildHistoryData aggregates across all ReportItems to produce chart datasets for the history line charts. Items are reversed so the chart reads oldest (left) to newest (right).

type LineDataSet added in v0.1.0

type LineDataSet struct {
	Label string    `json:"label"`
	Data  []float64 `json:"data"`
}

LineDataSet is a single line in a history chart.

type ReportData

type ReportData struct {
	BundledJS  string
	BundledCSS string
	Report     string
}

ReportData is the template rendering context.

func NewReportData added in v0.1.0

func NewReportData(payloadJSON string, noExplorer bool) *ReportData

NewReportData creates a ReportData for template rendering.

type ReportItem added in v0.1.0

type ReportItem struct {
	ChangeId            string         `json:"changeId"`
	Graph               *GraphData     `json:"graph"`
	ExplorerGraph       *GraphData     `json:"explorerGraph,omitempty"`
	Summary             *SummaryData   `json:"summary"`
	HtmlReport          string         `json:"htmlReport"`
	OriginalSpec        string         `json:"originalSpec"`
	ModifiedSpec        string         `json:"modifiedSpec"`
	OriginalHighlighted map[int]string `json:"originalHighlighted,omitempty"`
	ModifiedHighlighted map[int]string `json:"modifiedHighlighted,omitempty"`
	Commit              *CommitInfo    `json:"commit"`
}

ReportItem represents a single commit/comparison in the report.

func BuildReportItem added in v0.1.0

func BuildReportItem(
	commit *model.Commit,
	result *changerator.Changerator,
	docChanges *whatChangedModel.DocumentChanges,
	rightDrDoc *drModel.DrDocument,
	changeId string,
) (*ReportItem, error)

BuildReportItem mirrors the bunkhouse production path in timeline_service.go:compareAndBuildReports(). It runs the full changerator pipeline on a single commit and packages the result for the HTML report.

The caller is responsible for calling Release() on the changeratorResult after BuildReportItem returns — this function does not take ownership.

type ReportPayload added in v0.1.0

type ReportPayload struct {
	Version       int           `json:"version"`
	DateGenerated string        `json:"dateGenerated"`
	AppVersion    string        `json:"appVersion,omitempty"`
	OriginalPath  string        `json:"originalPath,omitempty"`
	ModifiedPath  string        `json:"modifiedPath,omitempty"`
	Items         []*ReportItem `json:"items"`
	History       *HistoryData  `json:"history"`
}

ReportPayload is the top-level JSON structure injected into the HTML template. It is the versioned contract between Go and the TypeScript frontend.

type SummaryData added in v0.1.0

type SummaryData struct {
	ChangeId        string `json:"changeId"`
	Created         string `json:"created"`
	TotalChanges    int    `json:"totalChanges"`
	BreakingChanges int    `json:"breakingChanges"`
	Additions       int    `json:"additions"`
	Modifications   int    `json:"modifications"`
	Removals        int    `json:"removals"`
	GitCommitSha    string `json:"gitCommitSha,omitempty"`
	GitAuthor       string `json:"gitAuthor,omitempty"`
	GitMessage      string `json:"gitMessage,omitempty"`
}

SummaryData mirrors the cowboy-components SpecSummary interface (no vacuum fields).

Jump to

Keyboard shortcuts

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