mirror of
https://github.com/grafana/grafana.git
synced 2025-07-31 13:42:09 +08:00

* Add anonymous stats and user table - anonymous users users page - add feature toggle `anonymousAccess` - remove check for enterprise for `Device-Id` header in request - add anonusers/device count to stats * promise all, review comments * make use of promise all settled * refactoring: devices instead of users * review comments, moved countdevices to httpserver * fakeAnonService for tests and generate openapi spec * do not commit openapi3 and api-merged * add openapi * Apply suggestions from code review Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> * formatin * precise anon devices to avoid confusion --------- Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> Co-authored-by: jguer <me@jguer.space>
35 lines
716 B
TypeScript
35 lines
716 B
TypeScript
import { getBackendSrv } from '@grafana/runtime';
|
|
|
|
interface AnonServerStat {
|
|
activeDevices?: number;
|
|
}
|
|
|
|
export interface ServerStat extends AnonServerStat {
|
|
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;
|
|
}
|
|
|
|
export const getServerStats = async (): Promise<ServerStat | null> => {
|
|
return getBackendSrv()
|
|
.get('api/admin/stats')
|
|
.catch((err) => {
|
|
console.error(err);
|
|
return null;
|
|
});
|
|
};
|