From 7b063c35a67dbe598064d3dc07002f864ff95dcd Mon Sep 17 00:00:00 2001 From: Sarath Nair Date: Fri, 26 Jul 2024 14:35:27 +0530 Subject: [PATCH] SONAR-22614 Groups page - adjust flag message and table header Fix validation issues and tests --- .../js/app/components/admin/StickyTable.tsx | 1 + .../js/apps/groups/__tests__/GroupsApp-it.tsx | 9 ++++---- .../main/js/apps/groups/components/Header.tsx | 22 ++++++++++++------- .../main/js/apps/groups/components/List.tsx | 7 +++--- .../js/apps/users/__tests__/UsersApp-it.tsx | 11 +++++----- .../js/components/controls/ManagedFilter.tsx | 2 +- .../resources/org/sonar/l10n/core.properties | 4 +++- 7 files changed, 34 insertions(+), 22 deletions(-) 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 index 4bf9ac09abc..8110023b26e 100644 --- a/server/sonar-web/src/main/js/app/components/admin/StickyTable.tsx +++ b/server/sonar-web/src/main/js/app/components/admin/StickyTable.tsx @@ -28,5 +28,6 @@ export const StickyTable = styled(Table)` position: sticky; top: ${LAYOUT_ADMIN_NAV_HEIGHT + LAYOUT_GLOBAL_NAV_HEIGHT}px; background: ${themeColor('backgroundSecondary')}; + z-index: 1; } `; diff --git a/server/sonar-web/src/main/js/apps/groups/__tests__/GroupsApp-it.tsx b/server/sonar-web/src/main/js/apps/groups/__tests__/GroupsApp-it.tsx index d42cec978a0..e1186e4b538 100644 --- a/server/sonar-web/src/main/js/apps/groups/__tests__/GroupsApp-it.tsx +++ b/server/sonar-web/src/main/js/apps/groups/__tests__/GroupsApp-it.tsx @@ -45,13 +45,14 @@ const githubHandler = new GithubProvisioningServiceMock(dopTranslationHandler); const ui = { createGroupButton: byRole('button', { name: 'groups.create_group' }), - infoManageMode: byText(/groups\.page\.managed_description/), + infoManageMode: byText(/groups\.page\.managed_description2/), description: byText('user_groups.page.description'), allFilter: byRole('radio', { name: 'all' }), selectedFilter: byRole('radio', { name: 'selected' }), unselectedFilter: byRole('radio', { name: 'unselected' }), localAndManagedFilter: byRole('radio', { name: 'all' }), - managedFilter: byRole('radio', { name: 'managed' }), + managedByScimFilter: byRole('radio', { name: 'managed.managed.SCIM' }), + managedByGithubFilter: byRole('radio', { name: 'managed.managed.github' }), localFilter: byRole('radio', { name: 'local' }), searchInput: byRole('searchbox', { name: 'search.search_by_name' }), updateButton: byRole('menuitem', { name: 'update_details' }), @@ -344,7 +345,7 @@ describe('in manage mode', () => { const user = userEvent.setup(); renderGroupsApp(); - await user.click(await ui.managedFilter.find()); + await user.click(await ui.managedByScimFilter.find()); expect(await ui.managedGroupRow.find()).toBeInTheDocument(); expect(ui.localGroupRow.query()).not.toBeInTheDocument(); @@ -428,7 +429,7 @@ describe('in manage mode', () => { const user = userEvent.setup(); renderGroupsApp(); - await user.click(await ui.managedFilter.find()); + await user.click(await ui.managedByGithubFilter.find()); expect( within(await ui.githubManagedGroupRow.find()).getByRole('img', { name: 'github' }), diff --git a/server/sonar-web/src/main/js/apps/groups/components/Header.tsx b/server/sonar-web/src/main/js/apps/groups/components/Header.tsx index 513562c1633..2159446f0bc 100644 --- a/server/sonar-web/src/main/js/apps/groups/components/Header.tsx +++ b/server/sonar-web/src/main/js/apps/groups/components/Header.tsx @@ -19,7 +19,7 @@ */ import { Button, ButtonVariety } from '@sonarsource/echoes-react'; -import { FlagMessage, 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'; @@ -53,22 +53,28 @@ export default function Header({ manageProvider }: Readonly) { {manageProvider === undefined ? (

{translate('user_groups.page.description')}

) : ( - -
+
+ +
- {translate('documentation')} + {translate('user_groups.page.managing_groups')} ), }} />
- +
)}
{createModal && setCreateModal(false)} create />} diff --git a/server/sonar-web/src/main/js/apps/groups/components/List.tsx b/server/sonar-web/src/main/js/apps/groups/components/List.tsx index 4ccb9359685..fa780549169 100644 --- a/server/sonar-web/src/main/js/apps/groups/components/List.tsx +++ b/server/sonar-web/src/main/js/apps/groups/components/List.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 { ContentCell, NumericalCell, Table, TableRow } from 'design-system'; +import { ContentCell, NumericalCell, TableRow } from 'design-system'; import { sortBy } from 'lodash'; import * as React from 'react'; +import { StickyTable } from '../../../app/components/admin/StickyTable'; import { translate } from '../../../helpers/l10n'; import { Group, Provider } from '../../../types/types'; import ListItem from './ListItem'; @@ -44,10 +45,10 @@ export default function List(props: Readonly) { const { groups, manageProvider } = props; return ( - } id="groups-list"> + } id="groups-list"> {sortBy(groups, (group) => group.name.toLowerCase()).map((group) => ( ))} -
+ ); } diff --git a/server/sonar-web/src/main/js/apps/users/__tests__/UsersApp-it.tsx b/server/sonar-web/src/main/js/apps/users/__tests__/UsersApp-it.tsx index b8886856ade..d373d9d4049 100644 --- a/server/sonar-web/src/main/js/apps/users/__tests__/UsersApp-it.tsx +++ b/server/sonar-web/src/main/js/apps/users/__tests__/UsersApp-it.tsx @@ -60,7 +60,8 @@ const groupsHandler = new GroupsServiceMock(); const ui = { createUserButton: byRole('button', { name: 'users.create_user' }), localAndManagedFilter: byRole('radio', { name: 'all' }), - managedFilter: byRole('radio', { name: 'managed' }), + managedByScimFilter: byRole('radio', { name: 'managed.managed.SCIM' }), + managedByGithubFilter: byRole('radio', { name: 'managed.managed.github' }), localFilter: byRole('radio', { name: 'local' }), showMore: byRole('button', { name: 'show_more' }), aliceUpdateGroupButton: byRole('button', { name: 'users.update_users_groups.alice.merveille' }), @@ -128,7 +129,7 @@ const ui = { dialogCreateUser: byRole('dialog', { name: 'users.create_user' }), dialogDeactivateUser: byRole('dialog', { name: 'users.deactivate_user' }), - infoManageMode: byText(/users\.page\.managed_description/), + infoManageMode: byText(/users\.page\.managed_description2/), description: byText('users.page.description'), deleteUserAlert: byText('delete-user-warning'), @@ -218,7 +219,7 @@ describe('different filters combinations', () => { const user = userEvent.setup(); renderUsersApp(); - await user.click(await ui.managedFilter.find()); + await user.click(await ui.managedByScimFilter.find()); await waitFor(() => expect(ui.activityFilter.get()).toBeEnabled()); await selectEvent.select( @@ -499,7 +500,7 @@ describe('in manage mode', () => { systemHandler.setProvider(Provider.Github); }); - it('should not be able to create a user"', async () => { + it('should not be able to create a user', async () => { renderUsersApp(); expect(await ui.infoManageMode.find()).toBeInTheDocument(); @@ -568,7 +569,7 @@ describe('in manage mode', () => { expect(await ui.aliceRowWithLocalBadge.find()).toBeInTheDocument(); - await user.click(await ui.managedFilter.find()); + await user.click(await ui.managedByGithubFilter.find()); expect(await ui.bobRow.find()).toBeInTheDocument(); expect(ui.aliceRowWithLocalBadge.query()).not.toBeInTheDocument(); 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 1d28a8e172b..cea36543a27 100644 --- a/server/sonar-web/src/main/js/components/controls/ManagedFilter.tsx +++ b/server/sonar-web/src/main/js/components/controls/ManagedFilter.tsx @@ -49,7 +49,7 @@ export function ManagedFilter(props: Readonly) { }, { label: translate('local'), value: false }, ]} - onChange={(filterOption: 'all' | boolean | undefined) => { + onChange={(filterOption) => { 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 b563a9d59f7..7584bc9e95d 100644 --- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties +++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties @@ -5290,7 +5290,9 @@ users.filter.by=Filter by user_groups.page=Groups user_groups.page.description=Create and administer groups of users. user_groups.page.group_header=Name -user_groups.page.managed_description=Your instance is managed by {provider}. No modification is allowed. You can still delete local groups. All other operations should be done on your identity provider. See {link} for help managing groups. +user_groups.page.managed_description=Your instance is managed by {provider}. No modification is allowed. +user_groups.page.managed_description2=We recommend you delete local groups. All other operations should be done on your identity provider. Read more about {link}. +user_groups.page.managing_groups=managing groups user_groups.anyone.description=Anybody who browses the application belongs to this group. If authentication is not enforced, assigned permissions also apply to non-authenticated users. groups.delete_group=Delete Group groups.delete_group.confirmation=Are you sure you want to delete "{0}"? -- 2.39.5