Navigation IA: Update Monitoring to Observability (#66963)

* update monitoring -> observability

* update backend test
This commit is contained in:
Ashley Harrison 2023-04-21 08:39:49 +01:00 committed by GitHub
parent 400fae3bd6
commit 1f193f1bad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 19 additions and 9 deletions

View File

@ -205,9 +205,9 @@ func (s *ServiceImpl) addPluginToSection(c *contextmodel.ReqContext, treeRoot *n
}) })
case navtree.NavIDMonitoring: case navtree.NavIDMonitoring:
treeRoot.AddSection(&navtree.NavLink{ treeRoot.AddSection(&navtree.NavLink{
Text: "Monitoring", Text: "Observability",
Id: navtree.NavIDMonitoring, Id: navtree.NavIDMonitoring,
SubTitle: "Monitoring and infrastructure apps", SubTitle: "Observability and infrastructure apps",
Icon: "heart-rate", Icon: "heart-rate",
SortWeight: navtree.WeightMonitoring, SortWeight: navtree.WeightMonitoring,
Children: []*navtree.NavLink{appLink}, Children: []*navtree.NavLink{appLink},
@ -256,6 +256,7 @@ func (s *ServiceImpl) readNavigationSettings() {
s.navigationAppConfig = map[string]NavigationAppConfig{ s.navigationAppConfig = map[string]NavigationAppConfig{
"grafana-k8s-app": {SectionID: navtree.NavIDMonitoring, SortWeight: 1, Text: "Kubernetes"}, "grafana-k8s-app": {SectionID: navtree.NavIDMonitoring, SortWeight: 1, Text: "Kubernetes"},
"grafana-synthetic-monitoring-app": {SectionID: navtree.NavIDMonitoring, SortWeight: 2, Text: "Synthetics"}, "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-oncall-app": {SectionID: navtree.NavIDAlertsAndIncidents, SortWeight: 1, Text: "OnCall"},
"grafana-incident-app": {SectionID: navtree.NavIDAlertsAndIncidents, SortWeight: 2, Text: "Incident"}, "grafana-incident-app": {SectionID: navtree.NavIDAlertsAndIncidents, SortWeight: 2, Text: "Incident"},
"grafana-ml-app": {SectionID: navtree.NavIDAlertsAndIncidents, SortWeight: 3, Text: "Machine Learning"}, "grafana-ml-app": {SectionID: navtree.NavIDAlertsAndIncidents, SortWeight: 3, Text: "Machine Learning"},
@ -283,7 +284,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() { for _, key := range appStandalonePages.Keys() {

View File

@ -203,7 +203,7 @@ func TestAddAppLinks(t *testing.T) {
require.Equal(t, "plugin-page-test-app3", appsNode.Children[1].Id) 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.navigationAppConfig = map[string]NavigationAppConfig{} service.navigationAppConfig = map[string]NavigationAppConfig{}
// Check if the Monitoring section is not there if no apps try to register to it // Check if the Monitoring section is not there if no apps try to register to it
@ -386,7 +386,7 @@ func TestReadingNavigationSettings(t *testing.T) {
require.Equal(t, "dashboards", service.navigationAppConfig["grafana-k8s-app"].SectionID) require.Equal(t, "dashboards", service.navigationAppConfig["grafana-k8s-app"].SectionID)
require.Equal(t, "admin", service.navigationAppConfig["other-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, int64(12), service.navigationAppConfig["other-app"].SortWeight)
require.Equal(t, "admin", service.navigationAppPathConfig["/a/grafana-k8s-app/foo"].SectionID) require.Equal(t, "admin", service.navigationAppPathConfig["/a/grafana-k8s-app/foo"].SectionID)

View File

@ -101,7 +101,7 @@ export function getNavTitle(navId: string | undefined) {
case 'upgrading': case 'upgrading':
return t('nav.upgrading.title', 'Stats and license'); return t('nav.upgrading.title', 'Stats and license');
case 'monitoring': case 'monitoring':
return t('nav.monitoring.title', 'Monitoring'); return t('nav.monitoring.title', 'Observability');
case 'apps': case 'apps':
return t('nav.apps.title', 'Apps'); return t('nav.apps.title', 'Apps');
case 'alerts-and-incidents': case 'alerts-and-incidents':

View File

@ -517,7 +517,7 @@ export const navIndex: NavIndex = {
}, },
monitoring: { monitoring: {
id: 'monitoring', id: 'monitoring',
text: 'Monitoring', text: 'Observability',
subTitle: 'Monitoring and infrastructure apps', subTitle: 'Monitoring and infrastructure apps',
icon: 'heart-rate', icon: 'heart-rate',
url: '/monitoring', url: '/monitoring',

View File

@ -265,7 +265,7 @@
}, },
"monitoring": { "monitoring": {
"subtitle": "Monitoring and infrastructure apps", "subtitle": "Monitoring and infrastructure apps",
"title": "Monitoring" "title": "Observability"
}, },
"new": { "new": {
"title": "New" "title": "New"

View File

@ -265,7 +265,7 @@
}, },
"monitoring": { "monitoring": {
"subtitle": "Mőʼnįŧőřįʼnģ äʼnđ įʼnƒřäşŧřūčŧūřę äppş", "subtitle": "Mőʼnįŧőřįʼnģ äʼnđ įʼnƒřäşŧřūčŧūřę äppş",
"title": "Mőʼnįŧőřįʼnģ" "title": "Øþşęřväþįľįŧy"
}, },
"new": { "new": {
"title": "Ńęŵ" "title": "Ńęŵ"