From c57041f13b2d60a75f462f09b8655c924ae1562d Mon Sep 17 00:00:00 2001 From: "Grot (@grafanabot)" <43478413+grafanabot@users.noreply.github.com> Date: Wed, 13 Oct 2021 08:08:18 +0100 Subject: [PATCH] Application: Make error-template title configurable (#40310) (#40363) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix error-template title as in index-template.html * Test: fix for AppTitle Co-authored-by: Hugo Häggmark (cherry picked from commit 3d9e2d8c824542652e19875551378f2ae455e809) Co-authored-by: Ben RUBSON <6764151+benrubson@users.noreply.github.com> --- pkg/middleware/recovery.go | 3 ++- pkg/models/context.go | 3 ++- public/views/error-template.html | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/middleware/recovery.go b/pkg/middleware/recovery.go index 5fbad323a92..3dc9c4cedcc 100644 --- a/pkg/middleware/recovery.go +++ b/pkg/middleware/recovery.go @@ -134,10 +134,11 @@ func Recovery(cfg *setting.Cfg) macaron.Handler { data := struct { Title string + AppTitle string AppSubUrl string Theme string ErrorMsg string - }{"Server Error", cfg.AppSubURL, cfg.DefaultTheme, ""} + }{"Server Error", "Grafana", cfg.AppSubURL, cfg.DefaultTheme, ""} if setting.Env == setting.Dev { if err, ok := r.(error); ok { diff --git a/pkg/models/context.go b/pkg/models/context.go index b631f80bc22..cae96a64b42 100644 --- a/pkg/models/context.go +++ b/pkg/models/context.go @@ -30,10 +30,11 @@ type ReqContext struct { func (ctx *ReqContext) Handle(cfg *setting.Cfg, status int, title string, err error) { data := struct { Title string + AppTitle string AppSubUrl string Theme string ErrorMsg error - }{title, cfg.AppSubURL, "dark", nil} + }{title, "Grafana", cfg.AppSubURL, "dark", nil} if err != nil { ctx.Logger.Error(title, "error", err) if setting.Env != setting.Prod { diff --git a/public/views/error-template.html b/public/views/error-template.html index 6e98c6be7bb..0f785120ce1 100644 --- a/public/views/error-template.html +++ b/public/views/error-template.html @@ -6,7 +6,7 @@ - Grafana - Error + [[.AppTitle]] - Error