Registry: trend chart, always-pass indicator, subnet columns in the address list dialog

- Registry: "Динамика по запускам" chart (Chart.js 4.5.1, vendored) over finalized
  runs per target or site, % or count, subnet and calendar period filters;
  GET /admin/registry/trend
- Registry: clickable "Всегда проходили" indicator with the address list and CSV;
  GET /admin/registry/always-pass and /always-pass/list
- Address list dialog: "Подсеть" and "Метка подсети" columns from the
  administrator's subnet list (shared db.SubnetMatcher), per-subnet summary chips
  with a client-side filter; "прочие" renamed to "вне списка подсетей"
- Rebuild control-api and admin-dashboard binaries; plans and summaries in
  docs/changes, README, API and USAGE updated

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
ayurishchevandClaude Sonnet 5.5 committed 2026-10-08 13:15:02 +03:00
1 parent c13139cd41
commit 1536723196
50 files changed
+3560 -154

No files matched your search

+69
View File
@@ -329,6 +329,75 @@ func (c *client) GetRegistryBreakdownCSV(ctx context.Context, q registryQuery, k
return c.getCSV(ctx, registryBreakdownPath(q, key, true, true))
}
// GetRegistryTrend returns the checks of the query's direction (and protocol)
// per target or site in each finalized run, within the subnet and the period
// from/to (YYYY-MM-DD, empty = open). The run, status and address filters of
// the query do not apply to a history.
func (c *client) GetRegistryTrend(ctx context.Context, q registryQuery, from, to string) (registryTrend, error) {
v, f := url.Values{}, q.filter()
for _, k := range []string{"subnet", "direction", "protocol"} {
if x := f.Get(k); x != "" {
v.Set(k, x)
}
}
if from != "" {
v.Set("from", from)
}
if to != "" {
v.Set("to", to)
}
var out registryTrend
err := c.do(ctx, http.MethodGet, "/api/v1/admin/registry/trend?"+v.Encode(), nil, &out)
return out, err
}
// alwaysPassPath is the path of GET /admin/registry/always-pass, or of its list
// when list is set, as a CSV file when csv is. The query's subnet, direction,
// protocol and address search count, with the period from/to (YYYY-MM-DD).
func alwaysPassPath(q registryQuery, from, to string, list, csv bool) string {
v, f := url.Values{}, q.filter()
for _, k := range []string{"q", "subnet", "direction", "protocol"} {
if x := f.Get(k); x != "" {
v.Set(k, x)
}
}
if from != "" {
v.Set("from", from)
}
if to != "" {
v.Set("to", to)
}
p := "/api/v1/admin/registry/always-pass"
if list {
p += "/list"
if csv {
v.Set("format", "csv")
}
}
return p + "?" + v.Encode()
}
// GetRegistryAlwaysPass returns how many addresses never failed a check of the
// query's direction (and protocol) in the finalized runs of the period.
func (c *client) GetRegistryAlwaysPass(ctx context.Context, q registryQuery, from, to string) (registryAlwaysPass, error) {
var out registryAlwaysPass
err := c.do(ctx, http.MethodGet, alwaysPassPath(q, from, to, false, false), nil, &out)
return out, err
}
// GetRegistryAlwaysPassList returns the table (JSON) of those addresses.
func (c *client) GetRegistryAlwaysPassList(ctx context.Context, q registryQuery, from, to string) (json.RawMessage, error) {
var out json.RawMessage
err := c.do(ctx, http.MethodGet, alwaysPassPath(q, from, to, true, false), nil, &out)
return out, err
}
// GetRegistryAlwaysPassCSV returns the CSV file of that table, with the file
// name control-api proposed.
func (c *client) GetRegistryAlwaysPassCSV(ctx context.Context, q registryQuery, from, to string) ([]byte, string, error) {
return c.getCSV(ctx, alwaysPassPath(q, from, to, true, true))
}
// GetRegistryHistory returns one address's registry record plus its full
// retained check history across every cycle still kept.
func (c *client) GetRegistryHistory(ctx context.Context, ip string) (registryHistoryResponse, error) {