[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 ae3cb8231b)

Co-authored-by: Eric Leijonmarck <eric.leijonmarck@gmail.com>
This commit is contained in:
grafana-delivery-bot[bot]
2023-12-20 12:12:26 +02:00
committed by GitHub
co-authored by Eric Leijonmarck
parent b27bbadce7
commit d1bb2b6efb
3 changed files with 3 additions and 2 deletions
@@ -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(<ServerStats />);
expect(await screen.findByRole('heading', { name: /instance statistics/i })).toBeInTheDocument();
+1 -1
View File
@@ -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) {
+1 -1
View File
@@ -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 && (
<Tab
label="Anonymous devices"
active={view === TabView.ANON}