From 124e0ce1b9a3502160a3eb2e32dca658e7b053df Mon Sep 17 00:00:00 2001 From: Javier Marcos <1271349+javuto@users.noreply.github.com> Date: Wed, 15 Oct 2025 19:04:44 +0200 Subject: [PATCH 1/3] Skip tag creation for UUIDs, localnames and hostname --- cmd/admin/handlers/templates.go | 7 +++++++ cmd/admin/handlers/types-templates.go | 1 + cmd/admin/templates/tags.html | 6 +++--- cmd/cli/node.go | 6 ------ pkg/tags/tags.go | 30 ++++++++++++++++----------- pkg/tags/utils.go | 26 ----------------------- pkg/tags/utils_test.go | 6 ------ 7 files changed, 29 insertions(+), 53 deletions(-) diff --git a/cmd/admin/handlers/templates.go b/cmd/admin/handlers/templates.go index 594afa1e..663fcd55 100644 --- a/cmd/admin/handlers/templates.go +++ b/cmd/admin/handlers/templates.go @@ -1422,6 +1422,12 @@ func (h *HandlersAdmin) TagsGETHandler(w http.ResponseWriter, r *http.Request) { log.Err(err).Msg("error getting tags") return } + // Get current tags count + tagsCount, err := h.Tags.CountTaggedNodes(tags) + if err != nil { + log.Err(err).Msg("error getting tags count") + return + } // Get if the user is admin user, err := h.Users.Get(ctx[sessions.CtxUser]) if err != nil { @@ -1434,6 +1440,7 @@ func (h *HandlersAdmin) TagsGETHandler(w http.ResponseWriter, r *http.Request) { Metadata: h.TemplateMetadata(ctx, h.ServiceMetadata, user.Admin), Environments: h.allowedEnvironments(ctx[sessions.CtxUser], envAll), Tags: tags, + CounterTags: tagsCount, } if err := t.Execute(w, templateData); err != nil { log.Err(err).Msg("template error") diff --git a/cmd/admin/handlers/types-templates.go b/cmd/admin/handlers/types-templates.go index ec037197..31e54c9f 100644 --- a/cmd/admin/handlers/types-templates.go +++ b/cmd/admin/handlers/types-templates.go @@ -225,6 +225,7 @@ type TagsTemplateData struct { Environments []environments.TLSEnvironment Platforms []string Tags []tags.AdminTag + CounterTags tags.TagCounter Metadata TemplateMetadata LeftMetadata AsideLeftMetadata } diff --git a/cmd/admin/templates/tags.html b/cmd/admin/templates/tags.html index 166d3e3a..b82fbf6c 100644 --- a/cmd/admin/templates/tags.html +++ b/cmd/admin/templates/tags.html @@ -49,10 +49,12 @@ Color Icon Environment + Tagged Nodes + {{ $counterTags := $.CounterTags }} {{range $i, $t := $.Tags}} @@ -70,6 +72,7 @@ {{ environmentFinder $t.EnvironmentID $.Environments false }} + {{index $counterTags $t.ID}}