PRE-RELEASE 0.9.2: frontend rename source→collector, tab layout fit
Rename the collector-picker concept to 'collector' throughout the frontend so it no longer collides with the ipng_source_tag group-by (which is labelled 'source'). Affects PageData.Collector, the raw JSON output key, template labels, and tests. Proto Source field is untouched (wire-level name used by CLI and aggregator too). Shrink tab padding/gap/font-size and add window:/filter: labels so the four tab rows (window, filter, collector, tor) line up and 7+ collectors fit on one line at the 1100px body width. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -75,14 +75,14 @@ type QueryParams struct {
|
||||
// PageData is passed to the HTML template.
|
||||
type PageData struct {
|
||||
Params QueryParams
|
||||
Source string
|
||||
Collector string
|
||||
Entries []TableRow
|
||||
TotalCount int64
|
||||
Sparkline template.HTML
|
||||
Breadcrumbs []Crumb
|
||||
Windows []Tab
|
||||
GroupBys []Tab
|
||||
Targets []Tab // source/target picker; empty when only one target available
|
||||
Targets []Tab // collector picker; empty when only one target available
|
||||
TorTabs []Tab // all / tor / no-tor toggle
|
||||
RefreshSecs int
|
||||
Error string
|
||||
@@ -455,7 +455,7 @@ func buildTorTabs(p QueryParams) []Tab {
|
||||
return tabs
|
||||
}
|
||||
|
||||
// buildTargetTabs builds the source/target picker tabs from a ListTargets response.
|
||||
// buildTargetTabs builds the collector picker tabs from a ListTargets response.
|
||||
// Returns nil (hide picker) when only one endpoint is reachable.
|
||||
func (h *Handler) buildTargetTabs(p QueryParams, lt *pb.ListTargetsResponse) []Tab {
|
||||
// "all" always points at the configured aggregator default.
|
||||
@@ -577,7 +577,7 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
}()
|
||||
go func() {
|
||||
// Always query the default target for ListTargets so we get the full
|
||||
// list of available sources even when viewing a specific collector.
|
||||
// list of available collectors even when viewing a specific one.
|
||||
ltClient := client
|
||||
var ltConn *grpc.ClientConn
|
||||
if params.Target != h.defaultTarget {
|
||||
@@ -623,7 +623,7 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
data := PageData{
|
||||
Params: params,
|
||||
Source: tn.resp.Source,
|
||||
Collector: tn.resp.Source,
|
||||
Entries: rows,
|
||||
TotalCount: total,
|
||||
Sparkline: sparkline,
|
||||
@@ -668,16 +668,16 @@ func writeRawJSON(w http.ResponseWriter, params QueryParams, resp *pb.TopNRespon
|
||||
Count int64 `json:"count"`
|
||||
}
|
||||
type out struct {
|
||||
Source string `json:"source"`
|
||||
Window string `json:"window"`
|
||||
GroupBy string `json:"group_by"`
|
||||
Entries []entry `json:"entries"`
|
||||
Collector string `json:"collector"`
|
||||
Window string `json:"window"`
|
||||
GroupBy string `json:"group_by"`
|
||||
Entries []entry `json:"entries"`
|
||||
}
|
||||
o := out{
|
||||
Source: resp.Source,
|
||||
Window: params.WindowS,
|
||||
GroupBy: params.GroupByS,
|
||||
Entries: make([]entry, len(resp.Entries)),
|
||||
Collector: resp.Source,
|
||||
Window: params.WindowS,
|
||||
GroupBy: params.GroupByS,
|
||||
Entries: make([]entry, len(resp.Entries)),
|
||||
}
|
||||
for i, e := range resp.Entries {
|
||||
o.Entries[i] = entry{Label: e.Label, Count: e.Count}
|
||||
|
||||
Reference in New Issue
Block a user