diff --git a/public/app/features/admin/state/apis.tsx b/public/app/features/admin/state/apis.tsx
index ae3a5731212..79c2061e4f5 100644
--- a/public/app/features/admin/state/apis.tsx
+++ b/public/app/features/admin/state/apis.tsx
@@ -1,58 +1,30 @@
-import React from 'react';
import { getBackendSrv } from '@grafana/runtime';
-import { PopoverContent } from '@grafana/ui';
-import { config } from 'app/core/config';
export interface ServerStat {
- name: string;
- value: number;
- tooltip?: PopoverContent;
+ activeAdmins: number;
+ activeEditors: number;
+ activeSessions: number;
+ activeUsers: number;
+ activeViewers: number;
+ admins: number;
+ alerts: number;
+ dashboards: number;
+ datasources: number;
+ editors: number;
+ orgs: number;
+ playlists: number;
+ snapshots: number;
+ stars: number;
+ tags: number;
+ users: number;
+ viewers: number;
}
-const { hasLicense } = config.licenseInfo;
-
-export const getServerStats = async (): Promise
=> {
- try {
- const res = await getBackendSrv().get('api/admin/stats');
- return [
- { name: 'Total users', value: res.users },
- ...(!hasLicense
- ? [
- { name: 'Total admins', value: res.admins },
- { name: 'Total editors', value: res.editors },
- { name: 'Total viewers', value: res.viewers },
- ]
- : []),
- {
- name: 'Active users (seen last 30 days)',
- value: res.activeUsers,
- tooltip: hasLicense
- ? () => (
- <>
- For active user count by role, see the Licensing page.
- >
- )
- : '',
- },
- ...(!hasLicense
- ? [
- { name: 'Active admins (seen last 30 days)', value: res.activeAdmins },
- { name: 'Active editors (seen last 30 days)', value: res.activeEditors },
- { name: 'Active viewers (seen last 30 days)', value: res.activeViewers },
- ]
- : []),
- { name: 'Active sessions', value: res.activeSessions },
- { name: 'Total dashboards', value: res.dashboards },
- { name: 'Total orgs', value: res.orgs },
- { name: 'Total playlists', value: res.playlists },
- { name: 'Total snapshots', value: res.snapshots },
- { name: 'Total dashboard tags', value: res.tags },
- { name: 'Total starred dashboards', value: res.stars },
- { name: 'Total alerts', value: res.alerts },
- { name: 'Total data sources', value: res.datasources },
- ];
- } catch (error) {
- console.error(error);
- throw error;
- }
+export const getServerStats = async (): Promise => {
+ return getBackendSrv()
+ .get('api/admin/stats')
+ .catch((err) => {
+ console.error(err);
+ return null;
+ });
};
diff --git a/public/app/features/plugins/admin/components/Loader.tsx b/public/app/features/plugins/admin/components/Loader.tsx
index 8cfa0d05dff..1113f8e7215 100644
--- a/public/app/features/plugins/admin/components/Loader.tsx
+++ b/public/app/features/plugins/admin/components/Loader.tsx
@@ -2,11 +2,15 @@ import React from 'react';
import { LoadingPlaceholder } from '@grafana/ui';
import { Page } from './Page';
-export const Loader = () => {
+export interface Props {
+ text?: string;
+}
+
+export const Loader = ({ text = 'Loading...' }: Props) => {
return (
-
+
);
diff --git a/public/app/types/accessControl.ts b/public/app/types/accessControl.ts
index d5e795ed969..445ec2f34e8 100644
--- a/public/app/types/accessControl.ts
+++ b/public/app/types/accessControl.ts
@@ -34,4 +34,6 @@ export enum AccessControlAction {
LDAPUsersSync = 'ldap.user:sync',
LDAPStatusRead = 'ldap.status:read',
DataSourcesExplore = 'datasources:explore',
+
+ ActionServerStatsRead = 'server.stats:read',
}