From f094a9d5e5862fc034d6b1dc68efe2119d351cfa Mon Sep 17 00:00:00 2001 From: Bruno Date: Mon, 10 Nov 2025 12:08:56 -0300 Subject: [PATCH] Caching: Add flag to disable clean cache button (#113598) Caching: add flag to disable clean cache button --- packages/grafana-runtime/src/config.ts | 1 + pkg/api/dtos/frontend_settings.go | 3 ++- pkg/api/frontendsettings.go | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/grafana-runtime/src/config.ts b/packages/grafana-runtime/src/config.ts index 343e638fb03..41211ec9abb 100644 --- a/packages/grafana-runtime/src/config.ts +++ b/packages/grafana-runtime/src/config.ts @@ -183,6 +183,7 @@ export class GrafanaBootConfig { }; caching = { enabled: false, + cleanCacheEnabled: true, }; geomapDefaultBaseLayerConfig?: MapLayerOptions; geomapDisableCustomBaseLayer?: boolean; diff --git a/pkg/api/dtos/frontend_settings.go b/pkg/api/dtos/frontend_settings.go index d550d6c88f9..f846e25795c 100644 --- a/pkg/api/dtos/frontend_settings.go +++ b/pkg/api/dtos/frontend_settings.go @@ -78,7 +78,8 @@ type FrontendSettingsAzureDTO struct { } type FrontendSettingsCachingDTO struct { - Enabled bool `json:"enabled"` + Enabled bool `json:"enabled"` + CleanCacheEnabled bool `json:"cleanCacheEnabled"` } type FrontendSettingsRecordedQueriesDTO struct { diff --git a/pkg/api/frontendsettings.go b/pkg/api/frontendsettings.go index 6d93ba00938..f3401ca2180 100644 --- a/pkg/api/frontendsettings.go +++ b/pkg/api/frontendsettings.go @@ -323,7 +323,8 @@ func (hs *HTTPServer) getFrontendSettings(c *contextmodel.ReqContext) (*dtos.Fro }, Caching: dtos.FrontendSettingsCachingDTO{ - Enabled: hs.Cfg.SectionWithEnvOverrides("caching").Key("enabled").MustBool(true), + Enabled: hs.Cfg.SectionWithEnvOverrides("caching").Key("enabled").MustBool(true), + CleanCacheEnabled: hs.Cfg.SectionWithEnvOverrides("caching").Key("clean_cache_enabled").MustBool(true), }, RecordedQueries: dtos.FrontendSettingsRecordedQueriesDTO{ Enabled: hs.Cfg.SectionWithEnvOverrides("recorded_queries").Key("enabled").MustBool(true),