mirror of
https://github.com/grafana/grafana.git
synced 2025-08-03 02:02:12 +08:00
Navigation: Split admin into subsections behind navAdminSubsections
feature toggle (#76280)
* split admin into subsections behind feature toggle * make authentication a section header * add translations for subsections * rename translation keys * add subtitles
This commit is contained in:
@ -166,7 +166,7 @@ func (hs *HTTPServer) setIndexViewData(c *contextmodel.ReqContext) (*dtos.IndexV
|
||||
|
||||
hs.HooksService.RunIndexDataHooks(&data, c)
|
||||
|
||||
data.NavTree.ApplyAdminIA()
|
||||
data.NavTree.ApplyAdminIA(hs.Cfg.IsFeatureToggleEnabled(featuremgmt.FlagNavAdminSubsections))
|
||||
data.NavTree.Sort()
|
||||
|
||||
return &data, nil
|
||||
|
@ -38,6 +38,9 @@ const (
|
||||
NavIDMonitoring = "monitoring"
|
||||
NavIDReporting = "reports"
|
||||
NavIDApps = "apps"
|
||||
NavIDCfgGeneral = "cfg/general"
|
||||
NavIDCfgPlugins = "cfg/plugins"
|
||||
NavIDCfgAccess = "cfg/access"
|
||||
)
|
||||
|
||||
type NavLink struct {
|
||||
@ -115,33 +118,103 @@ func Sort(nodes []*NavLink) {
|
||||
}
|
||||
}
|
||||
|
||||
func (root *NavTreeRoot) ApplyAdminIA() {
|
||||
func (root *NavTreeRoot) ApplyAdminIA(navAdminSubsectionsEnabled bool) {
|
||||
orgAdminNode := root.FindById(NavIDCfg)
|
||||
|
||||
if orgAdminNode != nil {
|
||||
adminNodeLinks := []*NavLink{}
|
||||
|
||||
adminNodeLinks = AppendIfNotNil(adminNodeLinks, root.FindById("datasources"))
|
||||
adminNodeLinks = AppendIfNotNil(adminNodeLinks, root.FindById("plugins"))
|
||||
adminNodeLinks = AppendIfNotNil(adminNodeLinks, root.FindById("global-users"))
|
||||
adminNodeLinks = AppendIfNotNil(adminNodeLinks, root.FindById("teams"))
|
||||
adminNodeLinks = AppendIfNotNil(adminNodeLinks, root.FindById("serviceaccounts"))
|
||||
adminNodeLinks = AppendIfNotNil(adminNodeLinks, root.FindById("apikeys"))
|
||||
adminNodeLinks = AppendIfNotNil(adminNodeLinks, root.FindById("org-settings"))
|
||||
adminNodeLinks = AppendIfNotNil(adminNodeLinks, root.FindById("authentication"))
|
||||
adminNodeLinks = AppendIfNotNil(adminNodeLinks, root.FindById("server-settings"))
|
||||
adminNodeLinks = AppendIfNotNil(adminNodeLinks, root.FindById("global-orgs"))
|
||||
adminNodeLinks = AppendIfNotNil(adminNodeLinks, root.FindById("feature-toggles"))
|
||||
if navAdminSubsectionsEnabled {
|
||||
generalNodeLinks := []*NavLink{}
|
||||
generalNodeLinks = AppendIfNotNil(generalNodeLinks, root.FindById("upgrading")) // TODO does this even exist
|
||||
generalNodeLinks = AppendIfNotNil(generalNodeLinks, root.FindById("licensing"))
|
||||
generalNodeLinks = AppendIfNotNil(generalNodeLinks, root.FindById("org-settings"))
|
||||
generalNodeLinks = AppendIfNotNil(generalNodeLinks, root.FindById("server-settings"))
|
||||
generalNodeLinks = AppendIfNotNil(generalNodeLinks, root.FindById("global-orgs"))
|
||||
generalNodeLinks = AppendIfNotNil(generalNodeLinks, root.FindById("feature-toggles"))
|
||||
generalNodeLinks = AppendIfNotNil(generalNodeLinks, root.FindById("storage"))
|
||||
|
||||
adminNodeLinks = AppendIfNotNil(adminNodeLinks, root.FindById("upgrading"))
|
||||
adminNodeLinks = AppendIfNotNil(adminNodeLinks, root.FindById("licensing"))
|
||||
adminNodeLinks = AppendIfNotNil(adminNodeLinks, root.FindById("recordedQueries")) // enterprise only
|
||||
adminNodeLinks = AppendIfNotNil(adminNodeLinks, root.FindById("correlations"))
|
||||
adminNodeLinks = AppendIfNotNil(adminNodeLinks, root.FindById("plugin-page-grafana-cloud-link-app"))
|
||||
generalNode := &NavLink{
|
||||
Text: "General",
|
||||
SubTitle: "Manage default preferences and settings across Grafana",
|
||||
Id: NavIDCfgGeneral,
|
||||
Url: "/admin/general",
|
||||
Icon: "shield",
|
||||
Children: generalNodeLinks,
|
||||
}
|
||||
|
||||
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"))
|
||||
pluginsNodeLinks := []*NavLink{}
|
||||
pluginsNodeLinks = AppendIfNotNil(pluginsNodeLinks, root.FindById("plugins"))
|
||||
pluginsNodeLinks = AppendIfNotNil(pluginsNodeLinks, root.FindById("datasources"))
|
||||
pluginsNodeLinks = AppendIfNotNil(pluginsNodeLinks, root.FindById("recordedQueries"))
|
||||
pluginsNodeLinks = AppendIfNotNil(pluginsNodeLinks, root.FindById("correlations"))
|
||||
pluginsNodeLinks = AppendIfNotNil(pluginsNodeLinks, root.FindById("plugin-page-grafana-cloud-link-app"))
|
||||
|
||||
pluginsNode := &NavLink{
|
||||
Text: "Plugins and data",
|
||||
SubTitle: "Install plugins and define the relationships between data",
|
||||
Id: NavIDCfgPlugins,
|
||||
Url: "/admin/plugins",
|
||||
Icon: "shield",
|
||||
Children: pluginsNodeLinks,
|
||||
}
|
||||
|
||||
accessNodeLinks := []*NavLink{}
|
||||
accessNodeLinks = AppendIfNotNil(accessNodeLinks, root.FindById("global-users"))
|
||||
accessNodeLinks = AppendIfNotNil(accessNodeLinks, root.FindById("teams"))
|
||||
accessNodeLinks = AppendIfNotNil(accessNodeLinks, root.FindById("standalone-plugin-page-/a/grafana-auth-app"))
|
||||
accessNodeLinks = AppendIfNotNil(accessNodeLinks, root.FindById("serviceaccounts"))
|
||||
accessNodeLinks = AppendIfNotNil(accessNodeLinks, root.FindById("apikeys"))
|
||||
|
||||
usersNode := &NavLink{
|
||||
Text: "Users and access",
|
||||
SubTitle: "Configure access for individual users, teams, and service accounts",
|
||||
Id: NavIDCfgAccess,
|
||||
Url: "/admin/access",
|
||||
Icon: "shield",
|
||||
Children: accessNodeLinks,
|
||||
}
|
||||
|
||||
if len(generalNode.Children) > 0 {
|
||||
adminNodeLinks = append(adminNodeLinks, generalNode)
|
||||
}
|
||||
|
||||
if len(pluginsNode.Children) > 0 {
|
||||
adminNodeLinks = append(adminNodeLinks, pluginsNode)
|
||||
}
|
||||
|
||||
if len(usersNode.Children) > 0 {
|
||||
adminNodeLinks = append(adminNodeLinks, usersNode)
|
||||
}
|
||||
|
||||
authenticationNode := root.FindById("authentication")
|
||||
if authenticationNode != nil {
|
||||
authenticationNode.IsSection = true
|
||||
adminNodeLinks = append(adminNodeLinks, authenticationNode)
|
||||
}
|
||||
} else {
|
||||
adminNodeLinks = AppendIfNotNil(adminNodeLinks, root.FindById("datasources"))
|
||||
adminNodeLinks = AppendIfNotNil(adminNodeLinks, root.FindById("plugins"))
|
||||
adminNodeLinks = AppendIfNotNil(adminNodeLinks, root.FindById("global-users"))
|
||||
adminNodeLinks = AppendIfNotNil(adminNodeLinks, root.FindById("teams"))
|
||||
adminNodeLinks = AppendIfNotNil(adminNodeLinks, root.FindById("serviceaccounts"))
|
||||
adminNodeLinks = AppendIfNotNil(adminNodeLinks, root.FindById("apikeys"))
|
||||
adminNodeLinks = AppendIfNotNil(adminNodeLinks, root.FindById("org-settings"))
|
||||
adminNodeLinks = AppendIfNotNil(adminNodeLinks, root.FindById("authentication"))
|
||||
adminNodeLinks = AppendIfNotNil(adminNodeLinks, root.FindById("server-settings"))
|
||||
adminNodeLinks = AppendIfNotNil(adminNodeLinks, root.FindById("global-orgs"))
|
||||
adminNodeLinks = AppendIfNotNil(adminNodeLinks, root.FindById("feature-toggles"))
|
||||
|
||||
adminNodeLinks = AppendIfNotNil(adminNodeLinks, root.FindById("upgrading"))
|
||||
adminNodeLinks = AppendIfNotNil(adminNodeLinks, root.FindById("licensing"))
|
||||
adminNodeLinks = AppendIfNotNil(adminNodeLinks, root.FindById("recordedQueries")) // enterprise only
|
||||
adminNodeLinks = AppendIfNotNil(adminNodeLinks, root.FindById("correlations"))
|
||||
adminNodeLinks = AppendIfNotNil(adminNodeLinks, root.FindById("plugin-page-grafana-cloud-link-app"))
|
||||
|
||||
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 {
|
||||
orgAdminNode.Children = adminNodeLinks
|
||||
|
@ -74,6 +74,12 @@ export function getNavTitle(navId: string | undefined) {
|
||||
return t('nav.alerting-admin.title', 'Admin');
|
||||
case 'cfg':
|
||||
return t('nav.config.title', 'Administration');
|
||||
case 'cfg/general':
|
||||
return t('nav.config-general.title', 'General');
|
||||
case 'cfg/plugins':
|
||||
return t('nav.config-plugins.title', 'Plugins and data');
|
||||
case 'cfg/access':
|
||||
return t('nav.config-access.title', 'Users and access');
|
||||
case 'datasources':
|
||||
return t('nav.datasources.title', 'Data sources');
|
||||
case 'authentication':
|
||||
@ -230,6 +236,12 @@ export function getNavSubTitle(navId: string | undefined) {
|
||||
'nav.admin.subtitle',
|
||||
'Manage server-wide settings and access to resources such as organizations, users, and licenses'
|
||||
);
|
||||
case 'cfg/general':
|
||||
return t('nav.config-general.subtitle', 'Manage default preferences and settings across Grafana');
|
||||
case 'cfg/plugins':
|
||||
return t('nav.config-plugins.subtitle', 'Install plugins and define the relationships between data');
|
||||
case 'cfg/access':
|
||||
return t('nav.config-access.subtitle', 'Configure access for individual users, teams, and service accounts');
|
||||
case 'apps':
|
||||
return t('nav.apps.subtitle', 'App plugins that extend the Grafana experience');
|
||||
case 'monitoring':
|
||||
|
@ -197,15 +197,15 @@ export function getAppRoutes(): RouteDescriptor[] {
|
||||
},
|
||||
{
|
||||
path: '/admin/general',
|
||||
component: () => <NavLandingPage navId="admin/general" />,
|
||||
component: () => <NavLandingPage navId="cfg/general" />,
|
||||
},
|
||||
{
|
||||
path: '/admin/plugins',
|
||||
component: () => <NavLandingPage navId="admin/plugins" />,
|
||||
component: () => <NavLandingPage navId="cfg/plugins" />,
|
||||
},
|
||||
{
|
||||
path: '/admin/access',
|
||||
component: () => <NavLandingPage navId="admin/access" />,
|
||||
component: () => <NavLandingPage navId="cfg/access" />,
|
||||
},
|
||||
{
|
||||
path: '/org',
|
||||
@ -295,14 +295,6 @@ export function getAppRoutes(): RouteDescriptor[] {
|
||||
)
|
||||
: () => <Redirect to="/admin" />,
|
||||
},
|
||||
{
|
||||
path: '/admin/access',
|
||||
component: () => <NavLandingPage navId="admin/access" />,
|
||||
},
|
||||
{
|
||||
path: '/admin/config',
|
||||
component: () => <NavLandingPage navId="admin/config" />,
|
||||
},
|
||||
{
|
||||
path: '/admin/settings',
|
||||
component: SafeDynamicImport(
|
||||
|
@ -517,6 +517,18 @@
|
||||
"config": {
|
||||
"title": "Verwaltung"
|
||||
},
|
||||
"config-access": {
|
||||
"subtitle": "",
|
||||
"title": ""
|
||||
},
|
||||
"config-general": {
|
||||
"subtitle": "",
|
||||
"title": ""
|
||||
},
|
||||
"config-plugins": {
|
||||
"subtitle": "",
|
||||
"title": ""
|
||||
},
|
||||
"connect-data": {
|
||||
"title": ""
|
||||
},
|
||||
|
@ -517,6 +517,18 @@
|
||||
"config": {
|
||||
"title": "Administration"
|
||||
},
|
||||
"config-access": {
|
||||
"subtitle": "Configure access for individual users, teams, and service accounts",
|
||||
"title": "Users and access"
|
||||
},
|
||||
"config-general": {
|
||||
"subtitle": "Manage default preferences and settings across Grafana",
|
||||
"title": "General"
|
||||
},
|
||||
"config-plugins": {
|
||||
"subtitle": "Install plugins and define the relationships between data",
|
||||
"title": "Plugins and data"
|
||||
},
|
||||
"connect-data": {
|
||||
"title": "Connect data"
|
||||
},
|
||||
|
@ -523,6 +523,18 @@
|
||||
"config": {
|
||||
"title": "Administración"
|
||||
},
|
||||
"config-access": {
|
||||
"subtitle": "",
|
||||
"title": ""
|
||||
},
|
||||
"config-general": {
|
||||
"subtitle": "",
|
||||
"title": ""
|
||||
},
|
||||
"config-plugins": {
|
||||
"subtitle": "",
|
||||
"title": ""
|
||||
},
|
||||
"connect-data": {
|
||||
"title": ""
|
||||
},
|
||||
|
@ -523,6 +523,18 @@
|
||||
"config": {
|
||||
"title": "Administration"
|
||||
},
|
||||
"config-access": {
|
||||
"subtitle": "",
|
||||
"title": ""
|
||||
},
|
||||
"config-general": {
|
||||
"subtitle": "",
|
||||
"title": ""
|
||||
},
|
||||
"config-plugins": {
|
||||
"subtitle": "",
|
||||
"title": ""
|
||||
},
|
||||
"connect-data": {
|
||||
"title": ""
|
||||
},
|
||||
|
@ -517,6 +517,18 @@
|
||||
"config": {
|
||||
"title": "Åđmįʼnįşŧřäŧįőʼn"
|
||||
},
|
||||
"config-access": {
|
||||
"subtitle": "Cőʼnƒįģūřę äččęşş ƒőř įʼnđįvįđūäľ ūşęřş, ŧęämş, äʼnđ şęřvįčę äččőūʼnŧş",
|
||||
"title": "Ůşęřş äʼnđ äččęşş"
|
||||
},
|
||||
"config-general": {
|
||||
"subtitle": "Mäʼnäģę đęƒäūľŧ přęƒęřęʼnčęş äʼnđ şęŧŧįʼnģş äčřőşş Ğřäƒäʼnä",
|
||||
"title": "Ğęʼnęřäľ"
|
||||
},
|
||||
"config-plugins": {
|
||||
"subtitle": "Ĩʼnşŧäľľ pľūģįʼnş äʼnđ đęƒįʼnę ŧĥę řęľäŧįőʼnşĥįpş þęŧŵęęʼn đäŧä",
|
||||
"title": "Pľūģįʼnş äʼnđ đäŧä"
|
||||
},
|
||||
"connect-data": {
|
||||
"title": "Cőʼnʼnęčŧ đäŧä"
|
||||
},
|
||||
|
@ -511,6 +511,18 @@
|
||||
"config": {
|
||||
"title": "管理"
|
||||
},
|
||||
"config-access": {
|
||||
"subtitle": "",
|
||||
"title": ""
|
||||
},
|
||||
"config-general": {
|
||||
"subtitle": "",
|
||||
"title": ""
|
||||
},
|
||||
"config-plugins": {
|
||||
"subtitle": "",
|
||||
"title": ""
|
||||
},
|
||||
"connect-data": {
|
||||
"title": ""
|
||||
},
|
||||
|
Reference in New Issue
Block a user