Navigation IA: Update Monitoring to Observability (#66963) (#67023)

* update monitoring -> observability

* update backend test

(cherry picked from commit 1f193f1bad)
This commit is contained in:
Ashley Harrison
2023-04-21 10:40:15 +01:00
committed by GitHub
parent d153c50454
commit ae716112dc
6 changed files with 19 additions and 9 deletions
+13 -3
View File
@@ -217,9 +217,9 @@ func (s *ServiceImpl) addPluginToSection(c *contextmodel.ReqContext, treeRoot *n
})
case navtree.NavIDMonitoring:
treeRoot.AddSection(&navtree.NavLink{
Text: "Monitoring",
Text: "Observability",
Id: navtree.NavIDMonitoring,
SubTitle: "Monitoring and infrastructure apps",
SubTitle: "Observability and infrastructure apps",
Icon: "heart-rate",
Section: navtree.NavSectionCore,
SortWeight: navtree.WeightMonitoring,
@@ -270,6 +270,7 @@ func (s *ServiceImpl) readNavigationSettings() {
s.navigationAppConfig = map[string]NavigationAppConfig{
"grafana-k8s-app": {SectionID: navtree.NavIDMonitoring, SortWeight: 1, Text: "Kubernetes"},
"grafana-synthetic-monitoring-app": {SectionID: navtree.NavIDMonitoring, SortWeight: 2, Text: "Synthetics"},
"grafana-kowalski-app": {SectionID: navtree.NavIDMonitoring, SortWeight: 3, Text: "Frontend"},
"grafana-oncall-app": {SectionID: navtree.NavIDAlertsAndIncidents, SortWeight: 1, Text: "OnCall"},
"grafana-incident-app": {SectionID: navtree.NavIDAlertsAndIncidents, SortWeight: 2, Text: "Incident"},
"grafana-ml-app": {SectionID: navtree.NavIDAlertsAndIncidents, SortWeight: 3, Text: "Machine Learning"},
@@ -297,7 +298,16 @@ func (s *ServiceImpl) readNavigationSettings() {
}
}
s.navigationAppConfig[pluginId] = *appCfg
// Only apply the new values, don't completely overwrite the entry if it exists
if entry, ok := s.navigationAppConfig[pluginId]; ok {
entry.SectionID = appCfg.SectionID
if appCfg.SortWeight != 0 {
entry.SortWeight = appCfg.SortWeight
}
s.navigationAppConfig[pluginId] = entry
} else {
s.navigationAppConfig[pluginId] = *appCfg
}
}
for _, key := range appStandalonePages.Keys() {
@@ -206,7 +206,7 @@ func TestAddAppLinks(t *testing.T) {
require.Equal(t, "plugin-page-test-app3", appsNode.Children[1].Id)
})
t.Run("Should only add a 'Monitoring' section if a plugin exists that wants to live there", func(t *testing.T) {
t.Run("Should only add an 'Observability' section if a plugin exists that wants to live there", func(t *testing.T) {
service.features = featuremgmt.WithFeatures(featuremgmt.FlagTopnav)
service.navigationAppConfig = map[string]NavigationAppConfig{}
@@ -393,7 +393,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(0), service.navigationAppConfig["grafana-k8s-app"].SortWeight)
require.Equal(t, int64(1), 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)