mirror of
https://github.com/grafana/grafana.git
synced 2025-02-10 23:55:47 -06:00
Chore: only show short commit hash in the help menu (#78038)
only show short commit hash in the help menu
This commit is contained in:
parent
a18eee4093
commit
e389ffa137
@ -189,9 +189,18 @@ func isSupportBundlesEnabled(s *ServiceImpl) bool {
|
||||
return s.cfg.SectionWithEnvOverrides("support_bundles").Key("enabled").MustBool(true)
|
||||
}
|
||||
|
||||
// don't need to show the full commit hash in the UI
|
||||
// let's substring to 10 chars like local git does automatically
|
||||
func getShortCommitHash(commitHash string, maxLength int) string {
|
||||
if len(commitHash) > maxLength {
|
||||
return commitHash[:maxLength]
|
||||
}
|
||||
return commitHash
|
||||
}
|
||||
|
||||
func (s *ServiceImpl) addHelpLinks(treeRoot *navtree.NavTreeRoot, c *contextmodel.ReqContext) {
|
||||
if setting.HelpEnabled {
|
||||
helpVersion := fmt.Sprintf(`%s v%s (%s)`, setting.ApplicationName, setting.BuildVersion, setting.BuildCommit)
|
||||
helpVersion := fmt.Sprintf(`%s v%s (%s)`, setting.ApplicationName, setting.BuildVersion, getShortCommitHash(setting.BuildCommit, 10))
|
||||
if s.cfg.AnonymousHideVersion && !c.IsSignedIn {
|
||||
helpVersion = setting.ApplicationName
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user