mirror of
https://github.com/grafana/grafana.git
synced 2024-12-28 01:41:24 -06:00
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:
parent
524debbe53
commit
ae3cb8231b
@ -52,6 +52,7 @@ describe('ServerStats', () => {
|
|||||||
|
|
||||||
it('Should render page with anonymous stats', async () => {
|
it('Should render page with anonymous stats', async () => {
|
||||||
config.featureToggles.displayAnonymousStats = true;
|
config.featureToggles.displayAnonymousStats = true;
|
||||||
|
config.anonymousEnabled = true;
|
||||||
config.anonymousDeviceLimit = 10;
|
config.anonymousDeviceLimit = 10;
|
||||||
render(<ServerStats />);
|
render(<ServerStats />);
|
||||||
expect(await screen.findByRole('heading', { name: /instance statistics/i })).toBeInTheDocument();
|
expect(await screen.findByRole('heading', { name: /instance statistics/i })).toBeInTheDocument();
|
||||||
|
@ -100,7 +100,7 @@ export const ServerStats = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const getAnonymousStatsContent = (stats: ServerStat | null, config: GrafanaBootConfig) => {
|
const getAnonymousStatsContent = (stats: ServerStat | null, config: GrafanaBootConfig) => {
|
||||||
if (!config.featureToggles.displayAnonymousStats || !stats?.activeDevices) {
|
if (!config.anonymousEnabled || !config.featureToggles.displayAnonymousStats || !stats?.activeDevices) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
if (!config.anonymousDeviceLimit) {
|
if (!config.anonymousDeviceLimit) {
|
||||||
|
@ -78,7 +78,7 @@ export default function UserListPage() {
|
|||||||
onChangeTab={() => setView(TabView.ORG)}
|
onChangeTab={() => setView(TabView.ORG)}
|
||||||
data-testid={selectors.tabs.orgUsers}
|
data-testid={selectors.tabs.orgUsers}
|
||||||
/>
|
/>
|
||||||
{config.featureToggles.displayAnonymousStats && (
|
{config.anonymousEnabled && config.featureToggles.displayAnonymousStats && (
|
||||||
<Tab
|
<Tab
|
||||||
label="Anonymous devices"
|
label="Anonymous devices"
|
||||||
active={view === TabView.ANON}
|
active={view === TabView.ANON}
|
||||||
|
Loading…
Reference in New Issue
Block a user