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
This commit is contained in:
Eric Leijonmarck 2023-12-20 10:59:29 +01:00 committed by GitHub
parent 524debbe53
commit ae3cb8231b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 2 deletions

View File

@ -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();

View File

@ -100,7 +100,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) {

View File

@ -78,7 +78,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}