From 078f2d4481efd495c2b029be769560e96d52d82a Mon Sep 17 00:00:00 2001 From: Alex Khomenko Date: Fri, 13 Jan 2023 08:32:09 +0200 Subject: [PATCH] Admin: Remove navigation subheaders (#61344) * Admin: Remove navigation subheaders * Admin: Fix tests --- pkg/services/navtree/models.go | 78 ++++--------------- pkg/services/navtree/models_test.go | 3 - .../NavBar/navBarItem-translations.ts | 6 -- public/locales/de-DE/grafana.json | 9 --- public/locales/en-US/grafana.json | 9 --- public/locales/es-ES/grafana.json | 9 --- public/locales/fr-FR/grafana.json | 9 --- public/locales/pseudo-LOCALE/grafana.json | 9 --- public/locales/zh-Hans/grafana.json | 9 --- 9 files changed, 17 insertions(+), 124 deletions(-) diff --git a/pkg/services/navtree/models.go b/pkg/services/navtree/models.go index d44950e8c4d..e588fb71474 100644 --- a/pkg/services/navtree/models.go +++ b/pkg/services/navtree/models.go @@ -41,9 +41,6 @@ const ( NavIDDashboardsBrowse = "dashboards/browse" NavIDCfg = "cfg" // NavIDCfg is the id for org configuration navigation node NavIDAdmin = "admin" - NavIDAdminGeneral = "admin/general" - NavIDAdminPlugins = "admin/plugins" - NavIDAdminAccess = "admin/access" NavIDAlertsAndIncidents = "alerts-and-incidents" NavIDAlerting = "alerting" NavIDMonitoring = "monitoring" @@ -180,73 +177,32 @@ func ApplyAdminIA(root *NavTreeRoot) { orgAdminNode.Url = "/admin" orgAdminNode.Text = "Administration" - generalNodeLinks := []*NavLink{} - pluginsNodeLinks := []*NavLink{} - accessNodeLinks := []*NavLink{} + adminNodeLinks := []*NavLink{} - generalNodeLinks = AppendIfNotNil(generalNodeLinks, root.FindById("upgrading")) - generalNodeLinks = AppendIfNotNil(generalNodeLinks, root.FindById("licensing")) + adminNodeLinks = AppendIfNotNil(adminNodeLinks, root.FindById("upgrading")) + adminNodeLinks = AppendIfNotNil(adminNodeLinks, root.FindById("licensing")) if orgSettings := root.FindById("org-settings"); orgSettings != nil { orgSettings.Text = "Default preferences" - generalNodeLinks = append(generalNodeLinks, orgSettings) + adminNodeLinks = append(adminNodeLinks, orgSettings) } - generalNodeLinks = AppendIfNotNil(generalNodeLinks, root.FindById("global-orgs")) - generalNodeLinks = AppendIfNotNil(generalNodeLinks, root.FindById("server-settings")) + adminNodeLinks = AppendIfNotNil(adminNodeLinks, root.FindById("global-orgs")) + adminNodeLinks = AppendIfNotNil(adminNodeLinks, root.FindById("server-settings")) - pluginsNodeLinks = AppendIfNotNil(pluginsNodeLinks, root.FindById("plugins")) - pluginsNodeLinks = AppendIfNotNil(pluginsNodeLinks, root.FindById("datasources")) - pluginsNodeLinks = AppendIfNotNil(pluginsNodeLinks, root.FindById("correlations")) - pluginsNodeLinks = AppendIfNotNil(pluginsNodeLinks, root.FindById("plugin-page-grafana-cloud-link-app")) - pluginsNodeLinks = AppendIfNotNil(pluginsNodeLinks, root.FindById("recordedQueries")) // enterprise only + adminNodeLinks = AppendIfNotNil(adminNodeLinks, root.FindById("plugins")) + adminNodeLinks = AppendIfNotNil(adminNodeLinks, root.FindById("datasources")) + adminNodeLinks = AppendIfNotNil(adminNodeLinks, root.FindById("correlations")) + adminNodeLinks = AppendIfNotNil(adminNodeLinks, root.FindById("plugin-page-grafana-cloud-link-app")) + adminNodeLinks = AppendIfNotNil(adminNodeLinks, root.FindById("recordedQueries")) // enterprise only if globalUsers := root.FindById("global-users"); globalUsers != nil { globalUsers.Text = "Users" - accessNodeLinks = append(accessNodeLinks, globalUsers) + adminNodeLinks = append(adminNodeLinks, globalUsers) } - accessNodeLinks = AppendIfNotNil(accessNodeLinks, root.FindById("teams")) - accessNodeLinks = AppendIfNotNil(accessNodeLinks, root.FindById("serviceaccounts")) - accessNodeLinks = AppendIfNotNil(accessNodeLinks, root.FindById("apikeys")) - accessNodeLinks = AppendIfNotNil(accessNodeLinks, root.FindById("ldap")) - accessNodeLinks = AppendIfNotNil(accessNodeLinks, root.FindById("standalone-plugin-page-/a/grafana-auth-app")) // Cloud Access Policies - - generalNode := &NavLink{ - Text: "General", - Id: NavIDAdminGeneral, - Url: "/admin/general", - Icon: "shield", - Children: generalNodeLinks, - } - - pluginsNode := &NavLink{ - Text: "Plugins and data", - Id: NavIDAdminPlugins, - Url: "/admin/plugins", - Icon: "shield", - Children: pluginsNodeLinks, - } - - accessNode := &NavLink{ - Text: "Users and access", - Id: NavIDAdminAccess, - Url: "/admin/access", - Icon: "shield", - Children: accessNodeLinks, - } - - adminNodeLinks := []*NavLink{} - - if len(generalNode.Children) > 0 { - adminNodeLinks = append(adminNodeLinks, generalNode) - } - - if len(pluginsNode.Children) > 0 { - adminNodeLinks = append(adminNodeLinks, pluginsNode) - } - - if len(accessNode.Children) > 0 { - adminNodeLinks = append(adminNodeLinks, accessNode) - } - + adminNodeLinks = AppendIfNotNil(adminNodeLinks, root.FindById("teams")) + adminNodeLinks = AppendIfNotNil(adminNodeLinks, root.FindById("serviceaccounts")) + adminNodeLinks = AppendIfNotNil(adminNodeLinks, root.FindById("apikeys")) + adminNodeLinks = AppendIfNotNil(adminNodeLinks, root.FindById("ldap")) + adminNodeLinks = AppendIfNotNil(adminNodeLinks, root.FindById("standalone-plugin-page-/a/grafana-auth-app")) // Cloud Access Policies adminNodeLinks = AppendIfNotNil(adminNodeLinks, root.FindById("storage")) if len(adminNodeLinks) > 0 { diff --git a/pkg/services/navtree/models_test.go b/pkg/services/navtree/models_test.go index 66f8a01ab55..c76938469a0 100644 --- a/pkg/services/navtree/models_test.go +++ b/pkg/services/navtree/models_test.go @@ -44,9 +44,6 @@ func TestNavTreeRoot(t *testing.T) { treeRoot.RemoveEmptySectionsAndApplyNewInformationArchitecture(true) require.Equal(t, "Administration", treeRoot.Children[0].Text) - require.Equal(t, NavIDAdminGeneral, treeRoot.Children[0].Children[0].Id) - require.Equal(t, NavIDAdminPlugins, treeRoot.Children[0].Children[1].Id) - require.Equal(t, NavIDAdminAccess, treeRoot.Children[0].Children[2].Id) }) t.Run("Should move reports into Dashboards", func(t *testing.T) { diff --git a/public/app/core/components/NavBar/navBarItem-translations.ts b/public/app/core/components/NavBar/navBarItem-translations.ts index a95ac1664bf..801101bc188 100644 --- a/public/app/core/components/NavBar/navBarItem-translations.ts +++ b/public/app/core/components/NavBar/navBarItem-translations.ts @@ -71,12 +71,6 @@ export function getNavTitle(navId: string | undefined) { return config.featureToggles.topnav ? t('nav.config.title', 'Administration') : t('nav.config.titleBeforeTopnav', 'Configuration'); - case 'admin/general': - return t('nav.admin-general.title', 'General'); - case 'admin/plugins': - return t('nav.admin-plugins.title', 'Plugins and data'); - case 'admin/access': - return t('nav.admin-access.title', 'Users and access'); case 'datasources': return t('nav.datasources.title', 'Data sources'); case 'correlations': diff --git a/public/locales/de-DE/grafana.json b/public/locales/de-DE/grafana.json index 0a944ead003..ff9f7eb6ced 100644 --- a/public/locales/de-DE/grafana.json +++ b/public/locales/de-DE/grafana.json @@ -128,15 +128,6 @@ "subtitle": "Serverweite Einstellungen und Zugriff auf Ressourcen wie Organisationen, Benutzer und Lizenzen verwalten", "title": "Server-Administrator" }, - "admin-access": { - "title": "Benutzer und Zugriff" - }, - "admin-general": { - "title": "Allgemein" - }, - "admin-plugins": { - "title": "Plugins und Daten" - }, "alerting": { "subtitle": "Informiere dich über Probleme in deinen Systemen kurz nach deren Auftreten", "title": "Meldungen" diff --git a/public/locales/en-US/grafana.json b/public/locales/en-US/grafana.json index 07087e1a58e..f7ca842cf43 100644 --- a/public/locales/en-US/grafana.json +++ b/public/locales/en-US/grafana.json @@ -128,15 +128,6 @@ "subtitle": "Manage server-wide settings and access to resources such as organizations, users, and licenses", "title": "Server admin" }, - "admin-access": { - "title": "Users and access" - }, - "admin-general": { - "title": "General" - }, - "admin-plugins": { - "title": "Plugins and data" - }, "alerting": { "subtitle": "Learn about problems in your systems moments after they occur", "title": "Alerting" diff --git a/public/locales/es-ES/grafana.json b/public/locales/es-ES/grafana.json index 420b4704cd0..8e070acd782 100644 --- a/public/locales/es-ES/grafana.json +++ b/public/locales/es-ES/grafana.json @@ -128,15 +128,6 @@ "subtitle": "Administrar la configuración de todo el servidor y el acceso a recursos como organizaciones, usuarios y licencias", "title": "Administrador del servidor" }, - "admin-access": { - "title": "Usuarios y acceso" - }, - "admin-general": { - "title": "General" - }, - "admin-plugins": { - "title": "Complementos y datos" - }, "alerting": { "subtitle": "Conozca los problemas de sus sistemas justo después de que se produzcan", "title": "Alertas" diff --git a/public/locales/fr-FR/grafana.json b/public/locales/fr-FR/grafana.json index 314f091930f..57a387e912e 100644 --- a/public/locales/fr-FR/grafana.json +++ b/public/locales/fr-FR/grafana.json @@ -128,15 +128,6 @@ "subtitle": "Gérer les paramètres à l'échelle du serveur et l'accès aux ressources telles que les organisations, les utilisateurs et les licences", "title": "Administrateur de serveur" }, - "admin-access": { - "title": "Utilisateurs et droits d'accès" - }, - "admin-general": { - "title": "Général" - }, - "admin-plugins": { - "title": "Modules complémentaires et données" - }, "alerting": { "subtitle": "En savoir plus sur les problèmes dans vos systèmes quelques instants après qu'ils se produisent", "title": "Alertes" diff --git a/public/locales/pseudo-LOCALE/grafana.json b/public/locales/pseudo-LOCALE/grafana.json index b4a79f44706..a3374d4b435 100644 --- a/public/locales/pseudo-LOCALE/grafana.json +++ b/public/locales/pseudo-LOCALE/grafana.json @@ -128,15 +128,6 @@ "subtitle": "Mäʼnäģę şęřvęř-ŵįđę şęŧŧįʼnģş äʼnđ äččęşş ŧő řęşőūřčęş şūčĥ äş őřģäʼnįžäŧįőʼnş, ūşęřş, äʼnđ ľįčęʼnşęş", "title": "Ŝęřvęř äđmįʼn" }, - "admin-access": { - "title": "Ůşęřş äʼnđ äččęşş" - }, - "admin-general": { - "title": "Ğęʼnęřäľ" - }, - "admin-plugins": { - "title": "Pľūģįʼnş äʼnđ đäŧä" - }, "alerting": { "subtitle": "Ŀęäřʼn äþőūŧ přőþľęmş įʼn yőūř şyşŧęmş mőmęʼnŧş äƒŧęř ŧĥęy őččūř", "title": "Åľęřŧįʼnģ" diff --git a/public/locales/zh-Hans/grafana.json b/public/locales/zh-Hans/grafana.json index 872a4249703..2c9ad82cab2 100644 --- a/public/locales/zh-Hans/grafana.json +++ b/public/locales/zh-Hans/grafana.json @@ -128,15 +128,6 @@ "subtitle": "管理整个服务器范围的设置,以及对组织、用户和许可证等资源的访问权限", "title": "服务器管理员" }, - "admin-access": { - "title": "" - }, - "admin-general": { - "title": "" - }, - "admin-plugins": { - "title": "" - }, "alerting": { "subtitle": "在系统发生问题后立即获悉", "title": "警报"