Nav: Update Observability section nav to phase 2 (#112806)

* Move up a level the knowledge graph children

* Remove unused frontend id

* Add special id to plugin pages
This commit is contained in:
Javier Ruiz
2025-10-29 09:25:09 +01:00
committed by GitHub
parent 5a031b370f
commit c7d77c6c64
2 changed files with 19 additions and 18 deletions
-2
View File
@@ -26,7 +26,6 @@ const (
WeightCloudServiceProviders
WeightInfrastructure
WeightApplication
WeightFrontend
WeightAsserts
WeightDataConnections
WeightApps
@@ -48,7 +47,6 @@ const (
NavIDAlerting = "alerting"
NavIDObservability = "observability"
NavIDInfrastructure = "infrastructure"
NavIDFrontend = "frontend"
NavIDReporting = "reports"
NavIDApps = "apps"
NavIDCfgGeneral = "cfg/general"
+19 -16
View File
@@ -4,6 +4,7 @@ import (
"path"
"sort"
"strconv"
"strings"
"github.com/grafana/grafana/pkg/plugins"
ac "github.com/grafana/grafana/pkg/services/accesscontrol"
@@ -260,10 +261,22 @@ func (s *ServiceImpl) addPluginToSection(c *contextmodel.ReqContext, treeRoot *n
}
}
sectionChildren := []*navtree.NavLink{appLink}
// asserts pages expand to root Observability section instead of it's own node
if plugin.ID == "grafana-asserts-app" {
sectionChildren = appLink.Children
// keep current sorting if the pages, but above all the other apps
for _, child := range sectionChildren {
child.SortWeight = -100 + child.SortWeight
child.Id = "standalone-plugin-page-" + strings.ReplaceAll(strings.ToLower(child.Text), " ", "-")
}
}
if sectionID == navtree.NavIDRoot {
treeRoot.AddSection(appLink)
} else if navNode := treeRoot.FindById(sectionID); navNode != nil {
navNode.Children = append(navNode.Children, appLink)
navNode.Children = append(navNode.Children, sectionChildren...)
} else {
switch sectionID {
case navtree.NavIDApps:
@@ -272,7 +285,7 @@ func (s *ServiceImpl) addPluginToSection(c *contextmodel.ReqContext, treeRoot *n
Icon: "layer-group",
SubTitle: "App plugins that extend the Grafana experience",
Id: navtree.NavIDApps,
Children: []*navtree.NavLink{appLink},
Children: sectionChildren,
SortWeight: navtree.WeightApps,
Url: s.cfg.AppSubURL + "/apps",
})
@@ -283,7 +296,7 @@ func (s *ServiceImpl) addPluginToSection(c *contextmodel.ReqContext, treeRoot *n
SubTitle: "Monitor infrastructure and applications in real time with Grafana Cloud's fully managed observability suite",
Icon: "heart-rate",
SortWeight: navtree.WeightObservability,
Children: []*navtree.NavLink{appLink},
Children: sectionChildren,
Url: s.cfg.AppSubURL + "/observability",
})
case navtree.NavIDInfrastructure:
@@ -293,19 +306,9 @@ func (s *ServiceImpl) addPluginToSection(c *contextmodel.ReqContext, treeRoot *n
SubTitle: "Understand your infrastructure's health",
Icon: "heart-rate",
SortWeight: navtree.WeightInfrastructure,
Children: []*navtree.NavLink{appLink},
Children: sectionChildren,
Url: s.cfg.AppSubURL + "/infrastructure",
})
case navtree.NavIDFrontend:
treeRoot.AddSection(&navtree.NavLink{
Text: "Frontend",
Id: navtree.NavIDFrontend,
SubTitle: "Gain real user monitoring insights",
Icon: "frontend-observability",
SortWeight: navtree.WeightFrontend,
Children: []*navtree.NavLink{appLink},
Url: s.cfg.AppSubURL + "/frontend",
})
case navtree.NavIDAlertsAndIncidents:
alertsAndIncidentsChildren := []*navtree.NavLink{}
for _, alertingNode := range alertingNodes {
@@ -332,7 +335,7 @@ func (s *ServiceImpl) addPluginToSection(c *contextmodel.ReqContext, treeRoot *n
SubTitle: "Optimize performance with k6 and Synthetic Monitoring insights",
Icon: "k6",
SortWeight: navtree.WeightTestingAndSynthetics,
Children: []*navtree.NavLink{appLink},
Children: sectionChildren,
Url: s.cfg.AppSubURL + "/testing-and-synthetics",
})
case navtree.NavIDAdaptiveTelemetry:
@@ -342,7 +345,7 @@ func (s *ServiceImpl) addPluginToSection(c *contextmodel.ReqContext, treeRoot *n
SubTitle: "Reduce noise, cut costs, and accelerate troubleshooting by intelligently ingesting only the telemetry data that matters most.",
Icon: "adaptive-telemetry",
SortWeight: navtree.WeightAIAndML + 1, // Place under "AI & Machine Learning"
Children: []*navtree.NavLink{appLink},
Children: sectionChildren,
Url: "adaptive-telemetry",
// Use the icon URL from the first "Adaptive Telemetry" plugin in the list (they will all be the same)
Img: s.cfg.AppSubURL + plugin.Info.Logos.Large,