feat(web): update-mode toggle and available-version badge (#8)

This commit is contained in:
2026-10-12 20:41:41 +02:00
parent 5d95a35b3b
commit 71d66846f2
6 changed files with 239 additions and 8 deletions
+10 -3
View File
@@ -11,12 +11,19 @@ import (
type serviceGroup struct {
Title string
Services []model.Service
Services []serviceRow
}
// serviceRow is a service as shown in the overview table.
type serviceRow struct {
model.Service
AutoBlocked string // why the service cannot be set to auto; "" when it can
}
// groupServices groups machine-bound services per agent and Swarm services
// in one group, keeping the store's order (machines first, Swarm last).
func groupServices(services []model.Service) []serviceGroup {
// autoBlocked returns the reason a service cannot be set to auto, or "".
func groupServices(services []model.Service, autoBlocked func(model.Service) string) []serviceGroup {
var groups []serviceGroup
index := map[string]int{}
for _, s := range services {
@@ -32,7 +39,7 @@ func groupServices(services []model.Service) []serviceGroup {
index[title] = i
groups = append(groups, serviceGroup{Title: title})
}
groups[i].Services = append(groups[i].Services, s)
groups[i].Services = append(groups[i].Services, serviceRow{Service: s, AutoBlocked: autoBlocked(s)})
}
return groups
}