From 862199756705a370cfe63dcb41b48160ccf254f5 Mon Sep 17 00:00:00 2001 From: Sarath Nair Date: Fri, 26 Jul 2024 14:05:37 +0530 Subject: [PATCH] SONAR-22610 Adjust flag message and table header in users page use doc link Use word sticky --- .../js/app/components/admin/StickyTable.tsx | 32 +++++++++++++++++++ .../src/main/js/apps/users/Header.tsx | 31 +++++++++++------- .../src/main/js/apps/users/UsersList.tsx | 7 ++-- .../js/components/controls/ManagedFilter.tsx | 9 ++++-- .../resources/org/sonar/l10n/core.properties | 9 ++++-- 5 files changed, 69 insertions(+), 19 deletions(-) create mode 100644 server/sonar-web/src/main/js/app/components/admin/StickyTable.tsx diff --git a/server/sonar-web/src/main/js/app/components/admin/StickyTable.tsx b/server/sonar-web/src/main/js/app/components/admin/StickyTable.tsx new file mode 100644 index 00000000000..4bf9ac09abc --- /dev/null +++ b/server/sonar-web/src/main/js/app/components/admin/StickyTable.tsx @@ -0,0 +1,32 @@ +/* + * SonarQube + * Copyright (C) 2009-2024 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +import styled from '@emotion/styled'; +import { LAYOUT_GLOBAL_NAV_HEIGHT, Table, themeColor } from 'design-system'; + +export const LAYOUT_ADMIN_NAV_HEIGHT = 92; + +export const StickyTable = styled(Table)` + & th { + position: sticky; + top: ${LAYOUT_ADMIN_NAV_HEIGHT + LAYOUT_GLOBAL_NAV_HEIGHT}px; + background: ${themeColor('backgroundSecondary')}; + } +`; diff --git a/server/sonar-web/src/main/js/apps/users/Header.tsx b/server/sonar-web/src/main/js/apps/users/Header.tsx index 7dc105c9017..61734b3c962 100644 --- a/server/sonar-web/src/main/js/apps/users/Header.tsx +++ b/server/sonar-web/src/main/js/apps/users/Header.tsx @@ -19,11 +19,11 @@ */ import { Button, ButtonVariety } from '@sonarsource/echoes-react'; -import { FlagMessage, Link, Title } from 'design-system'; +import { Title } from 'design-system'; import * as React from 'react'; import { FormattedMessage } from 'react-intl'; +import DocumentationLink from '../../components/common/DocumentationLink'; import { DocLink } from '../../helpers/doc-links'; -import { useDocUrl } from '../../helpers/docs'; import { translate } from '../../helpers/l10n'; import UserForm from './components/UserForm'; @@ -32,7 +32,6 @@ interface Props { } export default function Header(props: Props) { - const docUrl = useDocUrl(DocLink.AuthOverview); const [openUserForm, setOpenUserForm] = React.useState(false); const { manageProvider } = props; @@ -54,18 +53,28 @@ export default function Header(props: Props) { {manageProvider === undefined ? ( {translate('users.page.description')} ) : ( - - +
+ +
{translate('documentation')}, + link: ( + + {translate('users.page.managing_users')} + + ), }} /> - - +
+
)} diff --git a/server/sonar-web/src/main/js/apps/users/UsersList.tsx b/server/sonar-web/src/main/js/apps/users/UsersList.tsx index 05f957b3325..122d55eea3c 100644 --- a/server/sonar-web/src/main/js/apps/users/UsersList.tsx +++ b/server/sonar-web/src/main/js/apps/users/UsersList.tsx @@ -17,9 +17,10 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { ActionCell, ContentCell, HelperHintIcon, Table, TableRow } from 'design-system'; +import { ActionCell, ContentCell, HelperHintIcon, TableRow } from 'design-system'; import * as React from 'react'; import HelpTooltip from '~sonar-aligned/components/controls/HelpTooltip'; +import { StickyTable } from '../../app/components/admin/StickyTable'; import { translate } from '../../helpers/l10n'; import { IdentityProvider, Provider } from '../../types/types'; import { RestUserDetailed } from '../../types/users'; @@ -52,7 +53,7 @@ export default function UsersList({ identityProviders, users, manageProvider }: ); return ( - + {users.map((user) => ( ))} -
+ ); } diff --git a/server/sonar-web/src/main/js/components/controls/ManagedFilter.tsx b/server/sonar-web/src/main/js/components/controls/ManagedFilter.tsx index 533c3673e3f..1d28a8e172b 100644 --- a/server/sonar-web/src/main/js/components/controls/ManagedFilter.tsx +++ b/server/sonar-web/src/main/js/components/controls/ManagedFilter.tsx @@ -19,7 +19,7 @@ */ import { ToggleButton } from 'design-system'; import * as React from 'react'; -import { translate } from '../../helpers/l10n'; +import { translate, translateWithParameters } from '../../helpers/l10n'; import { Provider } from '../../types/types'; interface ManagedFilterProps { @@ -43,10 +43,13 @@ export function ManagedFilter(props: Readonly) { disabled={loading} options={[ { label: translate('all'), value: 'all' }, - { label: translate('managed'), value: true }, + { + label: translateWithParameters('managed', translate(`managed.${manageProvider}`)), + value: true, + }, { label: translate('local'), value: false }, ]} - onChange={(filterOption) => { + onChange={(filterOption: 'all' | boolean | undefined) => { if (filterOption === 'all') { props.setManaged(undefined); } else { diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties index af18ebc2f0f..b563a9d59f7 100644 --- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties +++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties @@ -314,7 +314,10 @@ less_than_1_hour_ago=< 1 hour ago local=Local logging_out=You're logging out, please wait... manage=Manage -managed=Managed +managed=From {0} +managed.github=GitHub +managed.gitlab=GitLab +managed.SCIM=IdP management=Management more_information=More information new_violations=New violations @@ -5197,7 +5200,9 @@ encryption.how_to_use.content4=For each property that you want to encrypt, gener #------------------------------------------------------------------------------ users.page=Users users.page.description=Create and administer individual users. -users.page.managed_description=Your instance is managed by {provider}. No modification is allowed except for tokens and SCM account information. You can still delete local users. All other operations should be done on your identity provider. See {link} for help managing users. +users.page.managed_description=Your instance is managed by {provider}. No modification is allowed except for tokens and SCM account information. +users.page.managed_description2=We recommend that you delete local users to ensure all operations are done on your identity provider. Read more about {link}. +users.page.managing_users=managing users users.info=User users.deactivate=Deactivate users.deactivate_user=Deactivate User -- 2.39.5