mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Profile/Help: Expose option to disable profile section and help menu (#46308)
* Expose option to disable help menu * Expose option to disable profile menu * Add Profile FeatureTogglePage * Update public/app/features/profile/FeatureTogglePage.tsx Uptake PR wording suggestion. Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com> * Fix front end lint issue * Fix back end lint issue Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
This commit is contained in:
@@ -105,6 +105,8 @@ func (hs *HTTPServer) getFrontendSettingsMap(c *models.ReqContext) (map[string]i
|
||||
"verifyEmailEnabled": setting.VerifyEmailEnabled,
|
||||
"sigV4AuthEnabled": setting.SigV4AuthEnabled,
|
||||
"exploreEnabled": setting.ExploreEnabled,
|
||||
"helpEnabled": setting.HelpEnabled,
|
||||
"profileEnabled": setting.ProfileEnabled,
|
||||
"queryHistoryEnabled": hs.Cfg.QueryHistoryEnabled,
|
||||
"googleAnalyticsId": setting.GoogleAnalyticsId,
|
||||
"rudderstackWriteKey": setting.RudderstackWriteKey,
|
||||
|
||||
@@ -221,9 +221,7 @@ func (hs *HTTPServer) getNavTree(c *models.ReqContext, hasEditPerm bool) ([]*dto
|
||||
})
|
||||
}
|
||||
|
||||
if c.IsSignedIn {
|
||||
navTree = append(navTree, hs.getProfileNode(c))
|
||||
}
|
||||
navTree = hs.addProfile(navTree, c)
|
||||
|
||||
_, uaIsDisabledForOrg := hs.Cfg.UnifiedAlerting.DisabledOrgs[c.OrgId]
|
||||
uaVisibleForOrg := hs.Cfg.UnifiedAlerting.IsEnabled() && !uaIsDisabledForOrg
|
||||
@@ -364,25 +362,39 @@ func (hs *HTTPServer) getNavTree(c *models.ReqContext, hasEditPerm bool) ([]*dto
|
||||
navTree = append(navTree, serverAdminNode)
|
||||
}
|
||||
|
||||
helpVersion := fmt.Sprintf(`%s v%s (%s)`, setting.ApplicationName, setting.BuildVersion, setting.BuildCommit)
|
||||
if hs.Cfg.AnonymousHideVersion && !c.IsSignedIn {
|
||||
helpVersion = setting.ApplicationName
|
||||
}
|
||||
|
||||
navTree = append(navTree, &dtos.NavLink{
|
||||
Text: "Help",
|
||||
SubTitle: helpVersion,
|
||||
Id: "help",
|
||||
Url: "#",
|
||||
Icon: "question-circle",
|
||||
SortWeight: dtos.WeightHelp,
|
||||
Section: dtos.NavSectionConfig,
|
||||
Children: []*dtos.NavLink{},
|
||||
})
|
||||
navTree = hs.addHelpLinks(navTree, c)
|
||||
|
||||
return navTree, nil
|
||||
}
|
||||
|
||||
func (hs *HTTPServer) addProfile(navTree []*dtos.NavLink, c *models.ReqContext) []*dtos.NavLink {
|
||||
if setting.ProfileEnabled && c.IsSignedIn {
|
||||
navTree = append(navTree, hs.getProfileNode(c))
|
||||
}
|
||||
return navTree
|
||||
}
|
||||
|
||||
func (hs *HTTPServer) addHelpLinks(navTree []*dtos.NavLink, c *models.ReqContext) []*dtos.NavLink {
|
||||
if setting.HelpEnabled {
|
||||
helpVersion := fmt.Sprintf(`%s v%s (%s)`, setting.ApplicationName, setting.BuildVersion, setting.BuildCommit)
|
||||
if hs.Cfg.AnonymousHideVersion && !c.IsSignedIn {
|
||||
helpVersion = setting.ApplicationName
|
||||
}
|
||||
|
||||
navTree = append(navTree, &dtos.NavLink{
|
||||
Text: "Help",
|
||||
SubTitle: helpVersion,
|
||||
Id: "help",
|
||||
Url: "#",
|
||||
Icon: "question-circle",
|
||||
SortWeight: dtos.WeightHelp,
|
||||
Section: dtos.NavSectionConfig,
|
||||
Children: []*dtos.NavLink{},
|
||||
})
|
||||
}
|
||||
return navTree
|
||||
}
|
||||
|
||||
func (hs *HTTPServer) buildSavedItemsNavLinks(c *models.ReqContext) ([]*dtos.NavLink, error) {
|
||||
savedItemsChildNavs := []*dtos.NavLink{}
|
||||
|
||||
|
||||
@@ -171,6 +171,12 @@ var (
|
||||
// Explore UI
|
||||
ExploreEnabled bool
|
||||
|
||||
// Help UI
|
||||
HelpEnabled bool
|
||||
|
||||
// Profile UI
|
||||
ProfileEnabled bool
|
||||
|
||||
// Grafana.NET URL
|
||||
GrafanaComUrl string
|
||||
|
||||
@@ -943,6 +949,12 @@ func (cfg *Cfg) Load(args CommandLineArgs) error {
|
||||
explore := iniFile.Section("explore")
|
||||
ExploreEnabled = explore.Key("enabled").MustBool(true)
|
||||
|
||||
help := iniFile.Section("help")
|
||||
HelpEnabled = help.Key("enabled").MustBool(true)
|
||||
|
||||
profile := iniFile.Section("profile")
|
||||
ProfileEnabled = profile.Key("enabled").MustBool(true)
|
||||
|
||||
queryHistory := iniFile.Section("query_history")
|
||||
cfg.QueryHistoryEnabled = queryHistory.Key("enabled").MustBool(false)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user