cmd, templates, integration: extract shared production constants
Constants the operator/test reader benefits from centralising.
Tests stay verbatim (the .golangci.yaml goconst tune skips them);
extraction here applies only where the same literal acts as
shared vocabulary across files.
cmd/headscale/cli/strings.go (new)
Cobra subcommand verbs and aliases shared by every list / show
/ new / delete / expire command across api_key, nodes, policy,
preauthkeys, users — plus the Result / Created / Expiration
column headers used in printOutput maps.
hscontrol/templates/design.go
cssBorderHS, cssBreakWord, cssCenter, cssOverflowWrap — shared
styles applied across design.go, ping.go, register_confirm.go.
spaceS already existed; switch raw "0.5rem" literals to it.
integration/hsic/hsic.go
binHeadscale, flagOutput, acceptJSON — names invoked across
hsic.go and config.go.
integration/tsic/tsic.go
tailscaleBin — used across docker exec call sites.
This commit is contained in:
parent
64c398f2c2
commit
e00c899219
15 changed files with 263 additions and 216 deletions
|
|
@ -17,7 +17,7 @@ type PingResult struct {
|
|||
// Status is "ok", "timeout", or "error".
|
||||
Status string
|
||||
|
||||
// Latency is the round-trip time (only meaningful when Status is "ok").
|
||||
// Latency is the round-trip time (only meaningful when [PingResult.Status] is "ok").
|
||||
Latency time.Duration
|
||||
|
||||
// NodeID is the ID of the pinged node.
|
||||
|
|
@ -27,7 +27,7 @@ type PingResult struct {
|
|||
Message string
|
||||
}
|
||||
|
||||
// ConnectedNode is a node currently connected to the batcher,
|
||||
// ConnectedNode is a node currently connected to the [mapper.Batcher],
|
||||
// displayed as a quick-ping link on the debug ping page.
|
||||
type ConnectedNode struct {
|
||||
ID types.NodeID
|
||||
|
|
@ -36,7 +36,7 @@ type ConnectedNode struct {
|
|||
}
|
||||
|
||||
// PingPage renders the /debug/ping page with a form, optional result,
|
||||
// and a list of connected nodes as quick-ping links.
|
||||
// and a list of connected nodes ([ConnectedNode]) as quick-ping links.
|
||||
func PingPage(query string, result *PingResult, nodes []ConnectedNode) *elem.Element {
|
||||
children := []elem.Node{
|
||||
headscaleLogo(),
|
||||
|
|
@ -94,7 +94,7 @@ func pingForm(query string) *elem.Element {
|
|||
attrs.Style: styles.Props{
|
||||
styles.Display: "flex",
|
||||
styles.Gap: spaceS,
|
||||
styles.AlignItems: "center",
|
||||
styles.AlignItems: cssCenter,
|
||||
styles.FlexWrap: "wrap",
|
||||
styles.MarginTop: spaceM,
|
||||
}.ToInline(),
|
||||
|
|
@ -107,7 +107,7 @@ func pingForm(query string) *elem.Element {
|
|||
attrs.Autofocus: "true",
|
||||
attrs.Style: styles.Props{
|
||||
styles.Padding: "0.75rem " + spaceM,
|
||||
styles.Border: "1px solid var(--hs-border)",
|
||||
styles.Border: cssBorderHS,
|
||||
styles.BorderRadius: "0.375rem",
|
||||
styles.Width: "280px",
|
||||
styles.MaxWidth: "100%",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue