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

* observability nav phase 2

* Update order in Observability section

* Update name for database o11y

---------

Co-authored-by: Javier Ruiz Calle <javier.ruizcalle@grafana.com>
Co-authored-by: Edvard Falkskär <457523+edvard-falkskar@users.noreply.github.com>
This commit is contained in:
Domas 2025-10-02 17:47:59 +03:00 committed by GitHub
parent 500e837031
commit 28c458b71d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 23 additions and 22 deletions

View File

@ -48,7 +48,6 @@ const (
NavIDAlerting = "alerting"
NavIDObservability = "observability"
NavIDInfrastructure = "infrastructure"
NavIDFrontend = "frontend"
NavIDReporting = "reports"
NavIDApps = "apps"
NavIDCfgGeneral = "cfg/general"

View File

@ -260,10 +260,21 @@ 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
}
}
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,18 +283,19 @@ 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",
})
case navtree.NavIDObservability:
treeRoot.AddSection(&navtree.NavLink{
Text: "Observability",
Id: navtree.NavIDObservability,
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 +305,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 +334,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:
@ -372,11 +374,11 @@ func (s *ServiceImpl) hasAccessToInclude(c *contextmodel.ReqContext, pluginID st
func (s *ServiceImpl) readNavigationSettings() {
s.navigationAppConfig = map[string]NavigationAppConfig{
"grafana-asserts-app": {SectionID: navtree.NavIDObservability, SortWeight: 1, Icon: "asserts"},
"grafana-app-observability-app": {SectionID: navtree.NavIDObservability, SortWeight: 2, Text: "Application"},
"grafana-csp-app": {SectionID: navtree.NavIDObservability, SortWeight: 3, Icon: "cloud-provider"},
"grafana-k8s-app": {SectionID: navtree.NavIDObservability, SortWeight: 4, Text: "Kubernetes"},
"grafana-dbo11y-app": {SectionID: navtree.NavIDObservability, SortWeight: 5, Text: "Database"},
"grafana-kowalski-app": {SectionID: navtree.NavIDObservability, SortWeight: 6, Text: "Frontend"},
"grafana-kowalski-app": {SectionID: navtree.NavIDObservability, SortWeight: 2, Text: "Frontend"},
"grafana-app-observability-app": {SectionID: navtree.NavIDObservability, SortWeight: 3, Text: "Application"},
"grafana-dbo11y-app": {SectionID: navtree.NavIDObservability, SortWeight: 4, Text: "Database"},
"grafana-k8s-app": {SectionID: navtree.NavIDObservability, SortWeight: 5, Text: "Kubernetes"},
"grafana-csp-app": {SectionID: navtree.NavIDObservability, SortWeight: 6, Icon: "cloud-provider"},
"grafana-metricsdrilldown-app": {SectionID: navtree.NavIDDrilldown, SortWeight: 1, Text: "Metrics"},
"grafana-lokiexplore-app": {SectionID: navtree.NavIDDrilldown, SortWeight: 2, Text: "Logs"},
"grafana-exploretraces-app": {SectionID: navtree.NavIDDrilldown, SortWeight: 3, Text: "Traces"},

View File

@ -387,7 +387,7 @@ func TestReadingNavigationSettings(t *testing.T) {
require.Equal(t, "dashboards", service.navigationAppConfig["grafana-k8s-app"].SectionID)
require.Equal(t, "admin", service.navigationAppConfig["other-app"].SectionID)
require.Equal(t, int64(4), service.navigationAppConfig["grafana-k8s-app"].SortWeight)
require.Equal(t, int64(5), service.navigationAppConfig["grafana-k8s-app"].SortWeight)
require.Equal(t, int64(12), service.navigationAppConfig["other-app"].SortWeight)
require.Equal(t, "admin", service.navigationAppPathConfig["/a/grafana-k8s-app/foo"].SectionID)