Skip to content

Commit 9a26053

Browse files
authored
feat: add search to onboarding service provider (eclipse-tractusx#1132)
1 parent 4d240f7 commit 9a26053

File tree

9 files changed

+90
-43
lines changed

9 files changed

+90
-43
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
### Change
2121

22+
- **Onboarding Service Provider Management**
23+
- Removed "User List" from table header, added search to onboarding service provider management table, adjusted design to be identical with customer overview table and fixed action 'disable/enable' status not being updated issue [#1132](https://github.com/eclipse-tractusx/portal-frontend/pull/1132)
2224
- **Service Subscriptions**
2325

2426
- rename 'Configure' button to 'Activate' button [#1150](https://github.com/eclipse-tractusx/portal-frontend/pull/1150)

src/assets/locales/de/main.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
"mycompany": "My Company",
7171
"mynotifications": "My Notifications",
7272
"companyData": "Company Data",
73-
"ManagementOnboardingServiceProvider": "Onboarding Service Provider"
73+
"onboardingServiceProviderManagement": "Onboarding Service Provider"
7474
},
7575
"overlays": {
7676
"invite": "Neuen Geschäftspartner einladen",
@@ -465,7 +465,7 @@
465465
"inactive": "inaktiv",
466466
"showAll": "Alles anzeigen"
467467
},
468-
"searchName": "..search by company name here"
468+
"searchName": "..search by title here"
469469
},
470470
"companySubscriptionsDetail": {
471471
"language": "Verfügbare App Sprachen",
@@ -2271,7 +2271,9 @@
22712271
"clientSecret": {
22722272
"name": "Client-Geheimnis",
22732273
"hint": "Geben Sie das von Ihrem IdP bereitgestellte Client-Geheimnis ein"
2274-
}
2274+
},
2275+
"ospIdentityProvider": "OSP-Identitätsanbieter (IDPs)",
2276+
"search": "Geben Sie einen Namen oder Alias ​​ein, um zu suchen"
22752277
}
22762278
},
22772279
"navigation": {

src/assets/locales/en/main.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
"mycompany": "My Company",
7171
"mynotifications": "My Notifications",
7272
"companyData": "Company Data",
73-
"ManagementOnboardingServiceProvider": "Onboarding Service Provider"
73+
"onboardingServiceProviderManagement": "Onboarding Service Provider"
7474
},
7575
"overlays": {
7676
"invite": "Invite new Business Partner",
@@ -462,7 +462,7 @@
462462
"inactive": "inactive",
463463
"showAll": "show all"
464464
},
465-
"searchName": "..search by company name here"
465+
"searchName": "..search by title here"
466466
},
467467
"companySubscriptionsDetail": {
468468
"language": "Language",
@@ -2245,7 +2245,9 @@
22452245
"clientSecret": {
22462246
"name": "Client Secret",
22472247
"hint": "Enter the client secret provided by your IdP"
2248-
}
2248+
},
2249+
"ospIdentityProvider": "OSP Identity Provider(IDPs)",
2250+
"search": "Enter name or alias to search"
22492251
}
22502252
},
22512253
"navigation": {

src/components/pages/IDPManagement/IDPList.tsx

Lines changed: 59 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
* SPDX-License-Identifier: Apache-2.0
1919
********************************************************************************/
2020

21-
import { useState } from 'react'
21+
import { useEffect, useState } from 'react'
2222
import { useDispatch } from 'react-redux'
2323
import { useTranslation } from 'react-i18next'
2424
import { MenuItem } from '@mui/material'
@@ -84,6 +84,7 @@ const MenuItemOpenOverlay = ({
8484
export const IDPList = ({ isManagementOSP }: { isManagementOSP?: boolean }) => {
8585
const { t } = useTranslation()
8686
const ti = useTranslation('idp').t
87+
const dispatch = useDispatch()
8788

8889
const [disableLoading, setDisableLoading] = useState(false)
8990
const [deleteLoading, setDeleteLoading] = useState(false)
@@ -94,8 +95,17 @@ export const IDPList = ({ isManagementOSP }: { isManagementOSP?: boolean }) => {
9495
.sort((a: IdentityProvider, b: IdentityProvider) =>
9596
(a?.displayName ?? '').localeCompare(b.displayName ?? '')
9697
)
98+
const [searchExpr, setSearchExpr] = useState<string>('')
9799
const [removeIDP] = useRemoveIDPMutation()
98100
const [enableIDP] = useEnableIDPMutation()
101+
const managedIdpsData = idpsData?.filter(
102+
(a) => a.identityProviderTypeId === IDPCategory.MANAGED
103+
)
104+
const [idpsManagedData, setIdpsManagedData] = useState(managedIdpsData)
105+
106+
useEffect(() => {
107+
setIdpsManagedData(managedIdpsData)
108+
}, [data])
99109

100110
const doDelete = async (
101111
e: React.MouseEvent<HTMLElement, MouseEvent>,
@@ -353,9 +363,31 @@ export const IDPList = ({ isManagementOSP }: { isManagementOSP?: boolean }) => {
353363
)
354364
}
355365

366+
const onSearch = (value: string) => {
367+
if (value) {
368+
const searchFilter = managedIdpsData?.filter(
369+
(i) => i.alias === value || i.displayName === value
370+
)
371+
setIdpsManagedData(searchFilter)
372+
setSearchExpr(value)
373+
} else setIdpsManagedData(managedIdpsData)
374+
}
375+
376+
const style = {
377+
'.MuiDataGrid-columnHeadersInner': {
378+
fontSize: '16px',
379+
fontWeight: '400',
380+
backgroundColor: '#E9E9E9',
381+
},
382+
'.MuiDataGrid-row': {
383+
fontSize: '14px',
384+
fontWeight: '400',
385+
},
386+
}
387+
356388
return (
357389
<Table
358-
rowsCount={idpsData?.length}
390+
rowsCount={isManagementOSP ? idpsManagedData?.length : idpsData?.length}
359391
hideFooter
360392
loading={isFetching}
361393
disableRowSelectionOnClick={true}
@@ -364,8 +396,12 @@ export const IDPList = ({ isManagementOSP }: { isManagementOSP?: boolean }) => {
364396
disableColumnSelector={true}
365397
disableDensitySelector={true}
366398
columnHeadersBackgroundColor={'#ffffff'}
367-
title=""
368-
toolbarVariant="ultimate"
399+
title={
400+
isManagementOSP
401+
? t('content.onboardingServiceProvider.ospIdentityProvider')
402+
: ''
403+
}
404+
toolbarVariant={isManagementOSP ? undefined : 'ultimate'}
369405
columns={[
370406
{
371407
field: 'displayName',
@@ -425,15 +461,27 @@ export const IDPList = ({ isManagementOSP }: { isManagementOSP?: boolean }) => {
425461
isManagementOSP ? renderManagementOSPMenu(row) : renderMenu(row),
426462
},
427463
]}
428-
rows={
429-
(isManagementOSP
430-
? idpsData?.filter(
431-
(a) => a.identityProviderTypeId === IDPCategory.MANAGED
432-
)
433-
: idpsData) ?? []
434-
}
464+
rows={(isManagementOSP ? idpsManagedData : idpsData) ?? []}
435465
getRowId={(row: { [key: string]: string }) => row.identityProviderId}
436466
hasBorder={false}
467+
searchPlaceholder={
468+
isManagementOSP
469+
? t('content.onboardingServiceProvider.search')
470+
: undefined
471+
}
472+
searchExpr={isManagementOSP ? searchExpr : undefined}
473+
onSearch={
474+
isManagementOSP
475+
? (expr: string) => {
476+
isManagementOSP && onSearch(expr)
477+
setSearchExpr(expr)
478+
}
479+
: undefined
480+
}
481+
searchDebounce={isManagementOSP ? 1000 : undefined}
482+
onButtonClick={() => dispatch(show(OVERLAYS.ADD_IDP))}
483+
buttonLabel={t('content.onboardingServiceProvider.addIdentityProvider')}
484+
sx={isManagementOSP ? style : undefined}
437485
/>
438486
)
439487
}

src/components/pages/OnboardingServiceProvider/OnboardingServiceProvider.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@
2323
width: 100%;
2424
}
2525

26+
.ospm {
27+
border: 1px solid #dcdcdc;
28+
border-radius: 24px;
29+
padding: 32px 0px 0px;
30+
}
31+
2632
.onboarding-service-header {
2733
text-align: center;
2834
width: 100%;

src/components/pages/OnboardingServiceProvider/OnboardingServiceProvider.tsx

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,6 @@ import {
4646
useUpdateRegistartionStatusCallbackMutation,
4747
} from 'features/admin/idpApiSlice'
4848
import ValidatingInput from 'components/shared/basic/Input/ValidatingInput'
49-
import AddCircleOutlineIcon from '@mui/icons-material/AddCircleOutline'
50-
import { useDispatch } from 'react-redux'
51-
import { show } from 'features/control/overlay'
52-
import { OVERLAYS } from 'types/Constants'
5349
import { isIDPClientID, isIDPClientSecret, isURL } from 'types/Patterns'
5450
import { InputType } from 'components/shared/basic/Input/BasicInput'
5551
import { type IHashMap } from 'types/MainTypes'
@@ -60,8 +56,7 @@ const OnboardingServiceProvider = () => {
6056
const { t } = useTranslation()
6157
const [activeTab, setActiveTab] = useState<number>(0)
6258
const [overlayOpen, setOverlayOpen] = useState<boolean>(false)
63-
const dispatch = useDispatch()
64-
const { data } = useFetchRegistartionStatusCallbackQuery()
59+
const { data, refetch } = useFetchRegistartionStatusCallbackQuery()
6560
const [loading, setLoading] = useState(false)
6661
const [updateRegistartionStatusCallback] =
6762
useUpdateRegistartionStatusCallbackMutation()
@@ -112,6 +107,8 @@ const OnboardingServiceProvider = () => {
112107
await updateRegistartionStatusCallback(callbackData).unwrap()
113108
success(t('content.onboardingServiceProvider.success'))
114109
setOverlayOpen(false)
110+
setCallbackData(undefined)
111+
refetch()
115112
} catch (err) {
116113
setShowError(true)
117114
}
@@ -348,22 +345,12 @@ const OnboardingServiceProvider = () => {
348345
/>
349346
</Tabs>
350347
<TabPanel value={activeTab} index={0}>
351-
<div className="connector-table-container">
352-
<Box sx={{ display: 'flex' }}>
353-
<Typography variant="h5" sx={{ mr: 5 }}>
354-
{t('content.onboardingServiceProvider.userList')}
355-
</Typography>
356-
<Button
357-
size="small"
358-
startIcon={<AddCircleOutlineIcon />}
359-
onClick={() => dispatch(show(OVERLAYS.ADD_IDP))}
360-
className="add-idp-btn"
361-
>
362-
{t('content.onboardingServiceProvider.addIdentityProvider')}
363-
</Button>
364-
</Box>
348+
<Box
349+
className="connector-table-container"
350+
sx={{ border: '1px solid #DCDCDC', borderRadius: '24px' }}
351+
>
365352
<IDPList isManagementOSP={true} />
366-
</div>
353+
</Box>
367354
</TabPanel>
368355
<TabPanel value={activeTab} index={1}>
369356
<div className="connector-table-container">

src/components/shared/frame/Header/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export const Header = ({
9898
} else {
9999
setPages(
100100
user.filter(
101-
(item) => item !== PAGES.MANAGEMENT_ONBOARDING_SERVICE_PROVIDER
101+
(item) => item !== PAGES.ONBOARDING_SERVICE_PROVIDER_MANAGEMENT
102102
)
103103
)
104104
}

src/types/Config.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ export const ALL_PAGES: IPage[] = [
604604
element: <CompanyData />,
605605
},
606606
{
607-
name: PAGES.MANAGEMENT_ONBOARDING_SERVICE_PROVIDER,
607+
name: PAGES.ONBOARDING_SERVICE_PROVIDER_MANAGEMENT,
608608
allowTo: () => userHasPortalRole(ROLES.CONFIGURE_PARTNER_REGISTRATION),
609609
element: <OnboardingServiceProvider />,
610610
},
@@ -845,7 +845,7 @@ export const userMenuFull = [
845845
PAGES.COMPANY_CERTIFICATE,
846846
PAGES.COMPANY_WALLET,
847847
PAGES.COMPANY_DATA,
848-
PAGES.MANAGEMENT_ONBOARDING_SERVICE_PROVIDER,
848+
PAGES.ONBOARDING_SERVICE_PROVIDER_MANAGEMENT,
849849
PAGES.LOGOUT,
850850
]
851851

@@ -867,7 +867,7 @@ export const userMenuCompany = [
867867
PAGES.COMPANY_CERTIFICATE,
868868
PAGES.COMPANY_WALLET,
869869
PAGES.COMPANY_DATA,
870-
PAGES.MANAGEMENT_ONBOARDING_SERVICE_PROVIDER,
870+
PAGES.ONBOARDING_SERVICE_PROVIDER_MANAGEMENT,
871871
]
872872

873873
/**

src/types/Constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export enum PAGES {
108108
COMPANY_SUBSCRIPTIONS = 'companySubscriptions',
109109
COMPANY_SUBSCRIPTIONS_DETAIL = 'companySubscriptionsDetail',
110110
COMPANY_DATA = 'companyData',
111-
MANAGEMENT_ONBOARDING_SERVICE_PROVIDER = 'ManagementOnboardingServiceProvider',
111+
ONBOARDING_SERVICE_PROVIDER_MANAGEMENT = 'onboardingServiceProviderManagement',
112112
}
113113

114114
export enum OVERLAYS {

0 commit comments

Comments
 (0)