diff --git a/.betterer.results b/.betterer.results index 7c07c78c43a..bc541f1749a 100644 --- a/.betterer.results +++ b/.betterer.results @@ -1302,8 +1302,7 @@ exports[`better eslint`] = { [0, 0, 0, "Styles should be written using objects.", "13"], [0, 0, 0, "Styles should be written using objects.", "14"], [0, 0, 0, "Styles should be written using objects.", "15"], - [0, 0, 0, "Styles should be written using objects.", "16"], - [0, 0, 0, "Styles should be written using objects.", "17"] + [0, 0, 0, "Styles should be written using objects.", "16"] ], "public/app/features/admin/UserPermissions.tsx:5381": [ [0, 0, 0, "Styles should be written using objects.", "0"] @@ -1311,11 +1310,7 @@ exports[`better eslint`] = { "public/app/features/admin/UserProfile.tsx:5381": [ [0, 0, 0, "Styles should be written using objects.", "0"], [0, 0, 0, "Styles should be written using objects.", "1"], - [0, 0, 0, "Styles should be written using objects.", "2"], - [0, 0, 0, "Styles should be written using objects.", "3"] - ], - "public/app/features/admin/UserSessions.tsx:5381": [ - [0, 0, 0, "Styles should be written using objects.", "0"] + [0, 0, 0, "Styles should be written using objects.", "2"] ], "public/app/features/alerting/AlertTab.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"], diff --git a/public/app/features/admin/UserAdminPage.tsx b/public/app/features/admin/UserAdminPage.tsx index f1409bc1c7b..0d0109c520a 100644 --- a/public/app/features/admin/UserAdminPage.tsx +++ b/public/app/features/admin/UserAdminPage.tsx @@ -3,6 +3,7 @@ import { connect, ConnectedProps } from 'react-redux'; import { NavModelItem } from '@grafana/data'; import { featureEnabled } from '@grafana/runtime'; +import { Stack } from '@grafana/ui'; import { Page } from 'app/core/components/Page/Page'; import { contextSrv } from 'app/core/core'; import { GrafanaRouteComponentProps } from 'app/core/navigation/types'; @@ -117,50 +118,52 @@ export class UserAdminPage extends PureComponent { return ( - {user && ( - <> - + {user && ( + <> + + {isLDAPUser && + user?.isExternallySynced && + featureEnabled('ldapsync') && + ldapSyncInfo && + canReadLDAPStatus && ( + + )} + + + )} + + {orgs && ( + - {isLDAPUser && - user?.isExternallySynced && - featureEnabled('ldapsync') && - ldapSyncInfo && - canReadLDAPStatus && ( - - )} - - - )} - - {orgs && ( - - )} - - {sessions && canReadSessions && ( - - )} + )} + ); diff --git a/public/app/features/admin/UserOrgs.tsx b/public/app/features/admin/UserOrgs.tsx index 31379631d01..a9b2c6c6241 100644 --- a/public/app/features/admin/UserOrgs.tsx +++ b/public/app/features/admin/UserOrgs.tsx @@ -14,6 +14,7 @@ import { Tooltip, useStyles2, withTheme2, + Stack, } from '@grafana/ui'; import { UserRolePicker } from 'app/core/components/RolePicker/UserRolePicker'; import { fetchRoleOptions, updateUserRoles } from 'app/core/components/RolePicker/api'; @@ -56,32 +57,28 @@ export class UserOrgs extends PureComponent { render() { const { user, orgs, isExternalUser, onOrgRoleChange, onOrgRemove, onOrgAdd } = this.props; const { showAddOrgModal } = this.state; - const addToOrgContainerClass = css` - margin-top: 0.8rem; - `; const canAddToOrg = contextSrv.hasPermission(AccessControlAction.OrgUsersAdd) && !isExternalUser; return ( - <> +

Organizations

-
-
- - - {orgs.map((org, index) => ( - - ))} - -
-
-
+ + + + {orgs.map((org, index) => ( + + ))} + +
+ +
{canAddToOrg && (
- +
+
); } } diff --git a/public/app/features/admin/UserPermissions.tsx b/public/app/features/admin/UserPermissions.tsx index f9be4537bfb..795223dfdc3 100644 --- a/public/app/features/admin/UserPermissions.tsx +++ b/public/app/features/admin/UserPermissions.tsx @@ -38,55 +38,53 @@ export function UserPermissions({ isGrafanaAdmin, isExternalUser, lockMessage, o const styles = useStyles2(getTooltipStyles); return ( - <> +

Permissions

-
- - - - - {isEditing ? ( - - ) : ( - - )} - + + +
Grafana Admin - - - {isGrafanaAdmin ? ( - <> - Yes - - ) : ( - <>No - )} - - {canChangePermissions && ( - - Change - - )} - {isExternalUser && ( -
- -
+ + + + + {isEditing ? ( + + ) : ( + - - -
Grafana Admin + + + {isGrafanaAdmin ? ( + <> + Yes + + ) : ( + <>No )}
- - + )} +
+ {canChangePermissions && ( + + Change + + )} + {isExternalUser && ( +
+ +
+ )} +
+
); } @@ -97,7 +95,4 @@ const getTooltipStyles = (theme: GrafanaTheme2) => ({ font-style: italic; margin-right: ${theme.spacing(0.6)}; `, - container: css({ - marginBottom: theme.spacing(5), - }), }); diff --git a/public/app/features/admin/UserProfile.tsx b/public/app/features/admin/UserProfile.tsx index 847677f4890..222fc27486c 100644 --- a/public/app/features/admin/UserProfile.tsx +++ b/public/app/features/admin/UserProfile.tsx @@ -1,7 +1,7 @@ import { css, cx } from '@emotion/css'; import React, { PureComponent, useRef, useState } from 'react'; -import { Button, ConfirmButton, ConfirmModal, Input, LegacyInputStatus } from '@grafana/ui'; +import { Button, ConfirmButton, ConfirmModal, Input, LegacyInputStatus, Stack } from '@grafana/ui'; import { contextSrv } from 'app/core/core'; import { AccessControlAction, UserDTO } from 'app/types'; @@ -80,10 +80,10 @@ export function UserProfile({ const canEnable = contextSrv.hasPermissionInMetadata(AccessControlAction.UsersEnable, user); return ( - <> +

User information

-
-
+ +
-
+ {canDelete && ( <>
-
- + + +
); } -const styles = { - buttonRow: css` - margin-top: 0.8rem; - > * { - margin-right: 16px; - } - `, -}; - interface UserProfileRowProps { label: string; value?: string; diff --git a/public/app/features/admin/UserSessions.tsx b/public/app/features/admin/UserSessions.tsx index 15846de2d6f..1e63b44448e 100644 --- a/public/app/features/admin/UserSessions.tsx +++ b/public/app/features/admin/UserSessions.tsx @@ -1,7 +1,6 @@ -import { css } from '@emotion/css'; import React, { PureComponent } from 'react'; -import { ConfirmButton, ConfirmModal, Button } from '@grafana/ui'; +import { ConfirmButton, ConfirmModal, Button, Stack } from '@grafana/ui'; import { contextSrv } from 'app/core/core'; import { i18nDate } from 'app/core/internationalization'; import { AccessControlAction, UserSession } from 'app/types'; @@ -48,17 +47,13 @@ class BaseUserSessions extends PureComponent { const { sessions } = this.props; const { showLogoutModal } = this.state; - const logoutFromAllDevicesClass = css` - margin-top: 0.8rem; - `; - const canLogout = contextSrv.hasPermission(AccessControlAction.UsersLogout); return ( - <> +

Sessions

-
-
+ +
@@ -95,7 +90,8 @@ class BaseUserSessions extends PureComponent {
-
+ +
{canLogout && sessions.length > 0 && (
-
- +
+
); } }