From 3d9e2d8c824542652e19875551378f2ae455e809 Mon Sep 17 00:00:00 2001 From: Ben RUBSON <6764151+benrubson@users.noreply.github.com> Date: Wed, 13 Oct 2021 08:35:01 +0200 Subject: [PATCH] Application: Make error-template title configurable (#40310) 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 --- 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 760a809109f..730f2ba6843 100644 --- a/pkg/middleware/recovery.go +++ b/pkg/middleware/recovery.go @@ -133,10 +133,11 @@ func Recovery(cfg *setting.Cfg) web.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 5a7a87c315e..dca3b2e5310 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