]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-21428 - User list in security with provider adopts new UI
authorKevin Silva <kevin.silva@sonarsource.com>
Mon, 15 Jan 2024 17:14:46 +0000 (18:14 +0100)
committersonartech <sonartech@sonarsource.com>
Tue, 16 Jan 2024 20:02:43 +0000 (20:02 +0000)
server/sonar-web/src/main/js/apps/groups/GroupsApp.tsx
server/sonar-web/src/main/js/apps/users/__tests__/UsersApp-it.tsx
server/sonar-web/src/main/js/apps/users/components/UserListItemIdentity.tsx
server/sonar-web/src/main/js/components/controls/ManagedFilter.tsx

index b03999481ba194e401be001724b80e62ec8b7065..7a37e33d6524fbde3a8b190e328d0cb2c203c6ef 100644 (file)
@@ -61,7 +61,6 @@ export default function GroupsApp() {
               loading={isLoading}
               managed={managed}
               setManaged={setManaged}
-              miui
             />
             <InputSearch
               minLength={2}
index 7057c0b9bd767230629b9082a51e064f9baa308e..103e08362286cb05fc160e3f364eedf27b15965e 100644 (file)
@@ -45,9 +45,9 @@ const githubHandler = new GithubProvisioningServiceMock();
 
 const ui = {
   createUserButton: byRole('button', { name: 'users.create_user' }),
-  localAndManagedFilter: byRole('button', { name: 'all' }),
-  managedFilter: byRole('button', { name: 'managed' }),
-  localFilter: byRole('button', { name: 'local' }),
+  localAndManagedFilter: byRole('radio', { name: 'all' }),
+  managedFilter: byRole('radio', { name: 'managed' }),
+  localFilter: byRole('radio', { name: 'local' }),
   showMore: byRole('button', { name: 'show_more' }),
   aliceUpdateGroupButton: byRole('button', { name: 'users.update_users_groups.alice.merveille' }),
   aliceUpdateButton: byRole('button', { name: 'users.manage_user.alice.merveille' }),
index 60de244e2ae3f16e877b6543f67675a6d004ddb2..ad93135f5aa997f6b118cce661dd3d7245e67d92 100644 (file)
@@ -61,7 +61,8 @@ export function ExternalProvider({ identityProvider, user }: Omit<Props, 'manage
 
   return (
     <div className="it__user-identity-provider sw-mt-1">
-      <div
+      <span
+        className="sw-inline-flex sw-items-center sw-px-1"
         style={{
           backgroundColor: identityProvider.backgroundColor,
           color: getTextColor(identityProvider.backgroundColor, colors.secondFontColor),
@@ -75,7 +76,7 @@ export function ExternalProvider({ identityProvider, user }: Omit<Props, 'manage
           width="14"
         />
         {user.externalLogin}
-      </div>
+      </span>
     </div>
   );
 }
index b04441437944f11757dcb6bfdd40c99473ed41c1..1f3e82c8f2aad610662053a5f90c0d45e674804b 100644 (file)
@@ -21,18 +21,16 @@ import { ToggleButton } from 'design-system';
 import * as React from 'react';
 import { translate } from '../../helpers/l10n';
 import { Provider } from '../../types/types';
-import ButtonToggle from './ButtonToggle';
 
 interface ManagedFilterProps {
   manageProvider: Provider | undefined;
   loading: boolean;
   managed: boolean | undefined;
-  miui?: boolean;
   setManaged: (managed: boolean | undefined) => void;
 }
 
 export function ManagedFilter(props: Readonly<ManagedFilterProps>) {
-  const { manageProvider, loading, managed, miui } = props;
+  const { manageProvider, loading, managed } = props;
 
   if (manageProvider === undefined) {
     return null;
@@ -40,41 +38,22 @@ export function ManagedFilter(props: Readonly<ManagedFilterProps>) {
 
   return (
     <div className="sw-mr-4">
-      {miui ? (
-        <ToggleButton
-          value={managed ?? 'all'}
-          disabled={loading}
-          options={[
-            { label: translate('all'), value: 'all' },
-            { label: translate('managed'), value: true },
-            { label: translate('local'), value: false },
-          ]}
-          onChange={(filterOption) => {
-            if (filterOption === 'all') {
-              props.setManaged(undefined);
-            } else {
-              props.setManaged(filterOption);
-            }
-          }}
-        />
-      ) : (
-        <ButtonToggle
-          value={managed ?? 'all'}
-          disabled={loading}
-          options={[
-            { label: translate('all'), value: 'all' },
-            { label: translate('managed'), value: true },
-            { label: translate('local'), value: false },
-          ]}
-          onCheck={(filterOption) => {
-            if (filterOption === 'all') {
-              props.setManaged(undefined);
-            } else {
-              props.setManaged(filterOption as boolean);
-            }
-          }}
-        />
-      )}
+      <ToggleButton
+        value={managed ?? 'all'}
+        disabled={loading}
+        options={[
+          { label: translate('all'), value: 'all' },
+          { label: translate('managed'), value: true },
+          { label: translate('local'), value: false },
+        ]}
+        onChange={(filterOption) => {
+          if (filterOption === 'all') {
+            props.setManaged(undefined);
+          } else {
+            props.setManaged(filterOption);
+          }
+        }}
+      />
     </div>
   );
 }