mirror of
https://github.com/grafana/grafana.git
synced 2025-02-15 10:03:33 -06:00
* admin: user page to react WIP * admin user page: basic view * admin user page: refactor, extract orgs and permissions components * admin user: change sessions actions styles * admin user: add disable button * user admin: add change grafana admin action * user admin: able to change org role and remove org * user admin: confirm force logout * user admin: change org button style * user admin: add confirm modals for critical actions * user admin: lock down ldap user info * user admin: align with latest design changes * user admin: add LDAP sync * admin user: confirm button * user admin: add to org modal * user admin: fix ConfirmButton story * admin user: handle grafana admin change * ConfirmButton: make styled component * ConfirmButton: completely styled component * User Admin: permissions section refactor * admin user: refactor (orgs and sessions) * ConfirmButton: able to set confirm variant * admin user: inline org removal * admin user: show ldap sync info only for ldap users * admin user: edit profile * ConfirmButton: some fixes after review * Chore: fix storybook build * admin user: rename handlers * admin user: remove LdapUserPage import from routes * Chore: fix ConfirmButton tests * Chore: fix user api endpoint tests * Chore: update failed test snapshots * admin user: redux actions WIP * admin user: use new ConfirmModal component for user profile * admin user: use new ConfirmModal component for sessions * admin user: use lockMessage * ConfirmButton: use primary button as default * admin user: fix ActionButton color * UI: use Icon component for Modal * UI: refactor ConfirmModal after Modal changes * UI: add link button variant * UI: able to use custom ConfirmButton * Chore: fix type errors after ConfirmButton refactor * Chore: revert Graph component changes (works with TS 3.7) * Chore: use Forms.Button instead of ActionButton * admin user: align items * admin user: align add to org modal * UI: organization picker component * admin user: use org picker for AddToOrgModal * admin user: org actions * admin user: connect sessions actions * admin user: updateUserPermissions action * admin user: enable delete user action * admin user: sync ldap user * Chore: refactor, remove unused code * Chore: refactor, move api calls to actions * admin user: set user password action * Chore: refactor, remove unused components * admin user: set input focus on edit * admin user: pass user into debug LDAP mapping * UserAdminPage: Ux changes * UserAdminPage: align buttons to the left * UserAdminPage: align delete user button * UserAdminPage: swap add to org modal buttons * UserAdminPage: set password field to empty when editing * UserAdminPage: fix tests * Updated button border * Chore: fix ConfirmButton after changes introduced in #21092 Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
34 lines
1.3 KiB
TypeScript
34 lines
1.3 KiB
TypeScript
import { getBackendSrv } from '@grafana/runtime';
|
|
|
|
export interface ServerStat {
|
|
name: string;
|
|
value: number;
|
|
}
|
|
|
|
export const getServerStats = async (): Promise<ServerStat[]> => {
|
|
try {
|
|
const res = await getBackendSrv().get('api/admin/stats');
|
|
return [
|
|
{ name: 'Total users', value: res.users },
|
|
{ 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 },
|
|
{ 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 },
|
|
];
|
|
} catch (error) {
|
|
console.error(error);
|
|
throw error;
|
|
}
|
|
};
|