fix: simplify dashboard and disable unauthorized actions
hermetic-ci / test (push) Canceled after 0s

This commit is contained in:
proxyctl coordinator
2026-08-30 15:49:04 +08:00
parent 416425a9bf
commit 30f7206b14
20 changed files with 182 additions and 221 deletions
+1 -41
View File
@@ -1,9 +1,6 @@
package tui
import (
"proxyctl/internal/app"
"proxyctl/internal/target"
)
import "proxyctl/internal/app"
func targetActionLabel(kind app.TargetActionKind) string {
switch kind {
@@ -101,40 +98,3 @@ func (c targetCatalog) retain(id string, formerIndex int) string {
}
return c.items[max(0, min(len(c.items)-1, formerIndex))].ID
}
type targetStateCounts struct {
enabled int
disabled int
external int
drifted int
checking int
failed int
}
func countAvailableTargetStates(snapshot app.Snapshot) targetStateCounts {
var counts targetStateCounts
for _, item := range snapshot.Targets {
switch item.DetectionPhase {
case app.TargetChecking:
counts.checking++
continue
case app.TargetDetectionFailed:
counts.failed++
continue
}
if !item.Available {
continue
}
switch item.State {
case target.Enabled:
counts.enabled++
case target.Disabled:
counts.disabled++
case target.External:
counts.external++
case target.Drifted:
counts.drifted++
}
}
return counts
}