From d1bb2b6efbf3a3523afa0ffede92dad6c28b1b12 Mon Sep 17 00:00:00 2001 From: "grafana-delivery-bot[bot]" <132647405+grafana-delivery-bot[bot]@users.noreply.github.com> Date: Wed, 20 Dec 2023 12:12:26 +0200 Subject: [PATCH] [v10.2.x] Anonymous: Fix anonymous access needs anonymousEnabled in config to show in UI (#79747) Anonymous: Fix anonymous access needs anonymousEnabled in config to show in UI (#79738) * fix: anonymous access needs anonymousEnabled in config to show * add enabled to tests (cherry picked from commit ae3cb8231b53ca5e24a6b747a579fe0814dfc19a) Co-authored-by: Eric Leijonmarck --- public/app/features/admin/ServerStats.test.tsx | 1 + public/app/features/admin/ServerStats.tsx | 2 +- public/app/features/admin/UserListPage.tsx | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/public/app/features/admin/ServerStats.test.tsx b/public/app/features/admin/ServerStats.test.tsx index 4c1d85d189c..b658800f12b 100644 --- a/public/app/features/admin/ServerStats.test.tsx +++ b/public/app/features/admin/ServerStats.test.tsx @@ -52,6 +52,7 @@ describe('ServerStats', () => { it('Should render page with anonymous stats', async () => { config.featureToggles.displayAnonymousStats = true; + config.anonymousEnabled = true; config.anonymousDeviceLimit = 10; render(); expect(await screen.findByRole('heading', { name: /instance statistics/i })).toBeInTheDocument(); diff --git a/public/app/features/admin/ServerStats.tsx b/public/app/features/admin/ServerStats.tsx index d0752d46204..1fca8285162 100644 --- a/public/app/features/admin/ServerStats.tsx +++ b/public/app/features/admin/ServerStats.tsx @@ -102,7 +102,7 @@ export const ServerStats = () => { }; const getAnonymousStatsContent = (stats: ServerStat | null, config: GrafanaBootConfig) => { - if (!config.featureToggles.displayAnonymousStats || !stats?.activeDevices) { + if (!config.anonymousEnabled || !config.featureToggles.displayAnonymousStats || !stats?.activeDevices) { return []; } if (!config.anonymousDeviceLimit) { diff --git a/public/app/features/admin/UserListPage.tsx b/public/app/features/admin/UserListPage.tsx index 918a78c99d8..1f1eb6ad311 100644 --- a/public/app/features/admin/UserListPage.tsx +++ b/public/app/features/admin/UserListPage.tsx @@ -77,7 +77,7 @@ export default function UserListPage() { onChangeTab={() => setView(TabView.ORG)} data-testid={selectors.tabs.orgUsers} /> - {config.featureToggles.displayAnonymousStats && ( + {config.anonymousEnabled && config.featureToggles.displayAnonymousStats && (