From a28da3188577e30f72b3926ef4a4cf8afcaed452 Mon Sep 17 00:00:00 2001 From: Martin Rohrmeier Date: Wed, 25 Oct 2023 15:37:24 +0200 Subject: [PATCH 01/13] fix(component): fix key value view for undefined attributes (#325) --- src/components/shared/basic/KeyValueView/index.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/shared/basic/KeyValueView/index.tsx b/src/components/shared/basic/KeyValueView/index.tsx index ff293f3df..f3e9245b5 100644 --- a/src/components/shared/basic/KeyValueView/index.tsx +++ b/src/components/shared/basic/KeyValueView/index.tsx @@ -65,14 +65,15 @@ export const KeyValueView = ({ cols, title, items }: KeyValueViewProps) => { }, }} onClick={async () => { - await navigator.clipboard.writeText(item.value.toString()) - setCopied(item.value.toString()) + const value = item.value?.toString() ?? '' + await navigator.clipboard.writeText(value) + setCopied(value) setTimeout(() => { setCopied('') }, 1000) }} > - {renderValue(item.value.toString())} + {renderValue(item.value?.toString() ?? '')} Date: Mon, 30 Oct 2023 14:56:13 +0530 Subject: [PATCH 02/13] updates(linters): remove extra semicolons (#321) --- .eslintrc.json | 1 - CHANGELOG.md | 5 +++++ src/features/newPartnerNetwork/partnerNetworkApiSlice.ts | 6 +++--- src/services/LogService.ts | 6 +++--- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index f5c01e22e..6a5badc58 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -33,7 +33,6 @@ "@typescript-eslint/explicit-function-return-type": 0, "@typescript-eslint/ban-types": 0, "@typescript-eslint/no-empty-function": 0, - "@typescript-eslint/no-extra-semi": 0, "@typescript-eslint/no-unsafe-argument": 0, "@typescript-eslint/no-unsafe-assignment": 0, "@typescript-eslint/no-unsafe-call": 0, diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c08161a3..bfd28c4e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,9 @@ - Add load element for IDP list - Linter Findings - Fix ban-types + - No Extra Semi +- Partner Network + - Search for Company name issue fix - App Subscription and Servcie Subscripiton - Status UI Changes - Technical User Detail @@ -44,6 +47,8 @@ - UI Changes - Home - Fixed image display for 'my business applications' +- App Subscription and Servcie Subscripiton + - Status UI Changes - Vulnerability from dependency - Set resolution for @babel/traverse (CVE-2023-45133) diff --git a/src/features/newPartnerNetwork/partnerNetworkApiSlice.ts b/src/features/newPartnerNetwork/partnerNetworkApiSlice.ts index 7d0b4247c..c8089dba1 100644 --- a/src/features/newPartnerNetwork/partnerNetworkApiSlice.ts +++ b/src/features/newPartnerNetwork/partnerNetworkApiSlice.ts @@ -51,9 +51,9 @@ export const apiSlice = createApi({ >({ query: (fetchArgs) => { if (fetchArgs.args.expr && !checkIfBPNLNumber(fetchArgs.args.expr)) { - return `/catena/legal-entities?page=${fetchArgs.page}&size=10&name=${ - fetchArgs.args!.expr - }` + return `/catena/legal-entities?page=${ + fetchArgs.page + }&size=10&legalName=${fetchArgs.args!.expr}` } else if (checkIfBPNLNumber(fetchArgs.args.expr)) { return `/catena/legal-entities/${fetchArgs.args!.expr}` } else { diff --git a/src/services/LogService.ts b/src/services/LogService.ts index 26f50edbf..8343ce2a6 100644 --- a/src/services/LogService.ts +++ b/src/services/LogService.ts @@ -33,13 +33,13 @@ export type LogData = LogDataItem | Array const LogService = { logtime: (date?: number) => new Date(date ?? Date.now()).toISOString().substring(11, 19), - log: (level: LogLevel, message: string, data?: LogData) => { - ;((row) => { + const logMessage = (row: string) => { level === LogLevel.SEVERE || level === LogLevel.ERROR ? console.error(row, data ?? '') : console.log(row, data ?? '') - })(`${LogService.logtime()} ${level} ${message}`) + } + logMessage(`${LogService.logtime()} ${level} ${message}`) }, info: (message: string, data?: LogData) => { LogService.log(LogLevel.INFO, message, data) From b0c81fe2bdb44aba6897fba20ecbbaf213b257d0 Mon Sep 17 00:00:00 2001 From: nidhigarg-bmw <101316912+nidhigarg-bmw@users.noreply.github.com> Date: Mon, 30 Oct 2023 15:00:27 +0530 Subject: [PATCH 03/13] update(linters): fix empty fn linter warning (#322) --- .eslintrc.json | 1 - CHANGELOG.md | 1 + .../ActivateServiceSubscription/index.tsx | 440 +++++++++--------- src/components/overlays/AddIDP/index.tsx | 4 +- .../overlays/AddMultipleUser/index.tsx | 4 +- .../overlays/AddServiceProvider/index.tsx | 4 +- .../overlays/AddUser/AddUserContent.tsx | 4 +- src/components/overlays/AddUser/IDPHint.tsx | 4 +- src/components/overlays/AddusersIDP/index.tsx | 8 +- .../overlays/AppMarketplaceRequest/index.tsx | 4 +- .../overlays/DeclineAdminboard/index.tsx | 4 +- src/components/overlays/EditUsecase/index.tsx | 4 +- src/components/overlays/EnableIDP/index.tsx | 4 +- src/components/overlays/InviteForm/index.tsx | 113 +++-- .../overlays/ServiceRequest/index.tsx | 4 +- .../overlays/UpdateCertificate/index.tsx | 4 +- .../overlays/UpdateCompanyRole/index.tsx | 4 +- src/components/overlays/UpdateIDP/index.tsx | 4 +- .../CompanyDetailOverlay/index.tsx | 8 +- .../registrationTableColumns.tsx | 4 +- src/components/pages/AppOverview/AddRoles.tsx | 4 +- .../pages/AppOverview/AddRolesOverlay.tsx | 4 +- .../pages/AppOverview/ChangeDescription.tsx | 4 +- .../pages/AppOverview/ChangeDocuments.tsx | 4 +- .../pages/AppOverview/ChangeImage.tsx | 4 +- .../pages/AppOverview/Deactivate.tsx | 4 +- src/components/pages/AppOverview/index.tsx | 4 +- src/components/pages/AppOverviewNew/index.tsx | 4 +- .../pages/AppReleaseProcess/index.tsx | 4 +- .../ActivateSubscriptionOverlay/index.tsx | 4 +- src/components/pages/EdcConnector/index.tsx | 8 +- .../pages/Organization/AppSubscriptions.tsx | 16 +- .../pages/Organization/UnSubscribeOverlay.tsx | 4 +- .../components/ServiceDeactivate.tsx | 4 +- .../components/ServiceDetails.tsx | 4 +- .../components/ServiceListOverview.tsx | 4 +- .../components/CommonValidateAndPublish.tsx | 4 +- src/setupTests.ts | 8 +- 38 files changed, 393 insertions(+), 326 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 6a5badc58..8e05651eb 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -32,7 +32,6 @@ "@typescript-eslint/comma-dangle": 0, "@typescript-eslint/explicit-function-return-type": 0, "@typescript-eslint/ban-types": 0, - "@typescript-eslint/no-empty-function": 0, "@typescript-eslint/no-unsafe-argument": 0, "@typescript-eslint/no-unsafe-assignment": 0, "@typescript-eslint/no-unsafe-call": 0, diff --git a/CHANGELOG.md b/CHANGELOG.md index bfd28c4e1..76cb67deb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,7 @@ - Add load element for IDP list - Linter Findings - Fix ban-types + - No empty function - No Extra Semi - Partner Network - Search for Company name issue fix diff --git a/src/components/overlays/ActivateServiceSubscription/index.tsx b/src/components/overlays/ActivateServiceSubscription/index.tsx index b3052ebf2..0f13c5590 100644 --- a/src/components/overlays/ActivateServiceSubscription/index.tsx +++ b/src/components/overlays/ActivateServiceSubscription/index.tsx @@ -90,245 +90,241 @@ export default function ActivateserviceSubscription({ } return ( - <> - - {activationResponse && ( -
- - {' '} - {t('serviceSubscription.activation.title')} - - } - intro={t('serviceSubscription.activation.subtitle') + companyName} - closeWithIcon={true} - /> - - + {activationResponse && ( +
+ + {' '} + {t('serviceSubscription.activation.title')} + + } + intro={t('serviceSubscription.activation.subtitle') + companyName} + closeWithIcon={true} + /> + + + - + {isTechUser + ? t( + 'serviceSubscription.activation.successDescriptionWithTechUser' + ) + : t('serviceSubscription.activation.successDescription')} + + + + {isTechUser && techUserInfo && ( + <> + - - {isTechUser - ? t( - 'serviceSubscription.activation.successDescriptionWithTechUser' - ) - : t('serviceSubscription.activation.successDescription')} - - - - {isTechUser && techUserInfo && ( - <> - - {t('serviceSubscription.activation.tableheader')} - - - - - - - - - - - - - - {techUserInfo.clientInfo ? ( - - ) : ( - - )} - - + {t('serviceSubscription.activation.tableheader')} + +
- - {t('serviceSubscription.activation.userId')} - - - - {techUserInfo.technicalUserInfo.technicalUserId} - -
- - {t('serviceSubscription.activation.sercret')} - - - - {techUserInfo.technicalUserInfo.technicalUserSecret} - -
- - {t('serviceSubscription.activation.url')} - - - - {techUserInfo.clientInfo.clientUrl} - - - -
+ + + + + + + + + + + + {techUserInfo.clientInfo ? ( + ) : ( - - -
+ + {t('serviceSubscription.activation.userId')} + + + + {techUserInfo.technicalUserInfo.technicalUserId} + +
+ + {t('serviceSubscription.activation.sercret')} + + + + {techUserInfo.technicalUserInfo.technicalUserSecret} + +
+ + {t('serviceSubscription.activation.url')} + + - {t( - 'serviceSubscription.activation.technicaluserType' - )} + {techUserInfo.clientInfo.clientUrl} - - {techUserInfo.technicalUserInfo.technicalUserPermissions.join( - ', ' - )} - +
- - )} -
- - - -
- )} - {!activationResponse && ( - <> - - - + + + + {t( + 'serviceSubscription.activation.technicaluserType' + )} + + + + + {techUserInfo.technicalUserInfo.technicalUserPermissions.join( + ', ' + )} + + + + + + + )} + + + + +
+ )} + {!activationResponse && ( + <> + + + + - - - {isTechUser - ? t( - 'serviceSubscription.register.descriptionWithTechUser' - ) - : t('serviceSubscription.register.description')} - - - {isTechUser && ( - <> - - - {t('serviceSubscription.register.sectionHeader')} - + + {isTechUser + ? t('serviceSubscription.register.descriptionWithTechUser') + : t('serviceSubscription.register.description')} + + + {isTechUser && ( + <> + + + {t('serviceSubscription.register.sectionHeader')} + + + {t('serviceSubscription.register.sectionDescription')} + + + + + + {t('serviceSubscription.register.help')} + + + + + {t('serviceSubscription.register.sectionHeader')} + + {techUserProfiles && techUserProfiles?.length > 0 ? ( - {t('serviceSubscription.register.sectionDescription')} + {techUserProfiles.join(', ')} - - - - - {t('serviceSubscription.register.help')} - - - - - {t('serviceSubscription.register.sectionHeader')} + ) : ( + + {t('serviceSubscription.register.loading')} - {techUserProfiles && techUserProfiles?.length > 0 ? ( - - {techUserProfiles.join(', ')} - - ) : ( - - {t('serviceSubscription.register.loading')} - - )} - - - )} - - - - + {loading ? ( + { + // do nothing }} - > - {t('serviceSubscription.register.close')} + sx={{ marginLeft: '10px' }} + /> + ) : ( + - {loading ? ( - {}} - sx={{ marginLeft: '10px' }} - /> - ) : ( - - )} - - - )} -
- + )} + + + )} + ) } diff --git a/src/components/overlays/AddIDP/index.tsx b/src/components/overlays/AddIDP/index.tsx index 40b84c6db..972d67e4a 100644 --- a/src/components/overlays/AddIDP/index.tsx +++ b/src/components/overlays/AddIDP/index.tsx @@ -321,7 +321,9 @@ export const AddIdp = () => { loadIndicator={t('action.loading')} loading size="medium" - onButtonClick={() => {}} + onButtonClick={() => { + // do nothing + }} sx={{ marginLeft: '10px' }} /> ) : ( diff --git a/src/components/overlays/AddMultipleUser/index.tsx b/src/components/overlays/AddMultipleUser/index.tsx index 080db174d..43a058279 100644 --- a/src/components/overlays/AddMultipleUser/index.tsx +++ b/src/components/overlays/AddMultipleUser/index.tsx @@ -443,7 +443,9 @@ export default function AddMultipleUser() { loadIndicator={t('global.actions.loading')} loading size="medium" - onButtonClick={() => {}} + onButtonClick={() => { + // do nothing + }} sx={{ marginLeft: '10px', textTransform: 'none' }} /> ) : ( diff --git a/src/components/overlays/AddServiceProvider/index.tsx b/src/components/overlays/AddServiceProvider/index.tsx index b8b25740f..cc036d997 100644 --- a/src/components/overlays/AddServiceProvider/index.tsx +++ b/src/components/overlays/AddServiceProvider/index.tsx @@ -129,7 +129,9 @@ export default function AddServiceProvider() { loadIndicator="Loading ..." loading size="medium" - onButtonClick={() => {}} + onButtonClick={() => { + // do nothing + }} sx={{ marginLeft: '10px' }} /> ) : ( diff --git a/src/components/overlays/AddUser/AddUserContent.tsx b/src/components/overlays/AddUser/AddUserContent.tsx index ee6bb69a6..81d87c8d2 100644 --- a/src/components/overlays/AddUser/AddUserContent.tsx +++ b/src/components/overlays/AddUser/AddUserContent.tsx @@ -179,7 +179,9 @@ export const AddUserContent = ({ idp }: { idp: IdentityProvider }) => { loadIndicator="Loading ..." loading size="medium" - onButtonClick={() => {}} + onButtonClick={() => { + // do nothing + }} sx={{ marginLeft: '10px' }} /> ) : ( diff --git a/src/components/overlays/AddUser/IDPHint.tsx b/src/components/overlays/AddUser/IDPHint.tsx index a4e4c7a7c..13922c851 100644 --- a/src/components/overlays/AddUser/IDPHint.tsx +++ b/src/components/overlays/AddUser/IDPHint.tsx @@ -37,7 +37,9 @@ export const IDPHint = ({ idp }: { idp: IdentityProvider }) => { helperText={t('idp')} disabled={true} defaultValue={idpName} - onChange={() => {}} + onChange={() => { + // do nothing + }} /> ) } diff --git a/src/components/overlays/AddusersIDP/index.tsx b/src/components/overlays/AddusersIDP/index.tsx index a7b91bd65..175c7fde2 100644 --- a/src/components/overlays/AddusersIDP/index.tsx +++ b/src/components/overlays/AddusersIDP/index.tsx @@ -482,7 +482,9 @@ export const AddusersIDP = ({ id }: { id: string }) => { ? store2text(userContent.data) : fetching } - onBlur={() => {}} + onBlur={() => { + // do nothing + }} onChange={(e) => { storeData(e.target.value) }} @@ -638,7 +640,9 @@ export const AddusersIDP = ({ id }: { id: string }) => { loadIndicator={t('action.loading')} loading size="medium" - onButtonClick={() => {}} + onButtonClick={() => { + // do nothing + }} sx={{ marginLeft: '10px' }} /> ) : ( diff --git a/src/components/overlays/AppMarketplaceRequest/index.tsx b/src/components/overlays/AppMarketplaceRequest/index.tsx index 997a564df..17fb8c922 100644 --- a/src/components/overlays/AppMarketplaceRequest/index.tsx +++ b/src/components/overlays/AppMarketplaceRequest/index.tsx @@ -153,7 +153,9 @@ export default function AppMarketplaceRequest({ id }: { id: string }) { onChange={(e) => { handleCheckedAgreement(e.target.checked, agreement) }} - onFocusVisible={function noRefCheck() {}} + onFocusVisible={function noRefCheck() { + // do nothing + }} /> ))} diff --git a/src/components/overlays/DeclineAdminboard/index.tsx b/src/components/overlays/DeclineAdminboard/index.tsx index bf6222bab..314e93483 100644 --- a/src/components/overlays/DeclineAdminboard/index.tsx +++ b/src/components/overlays/DeclineAdminboard/index.tsx @@ -118,7 +118,9 @@ export default function DeclineAdminBoard({ loadIndicator="Loading ..." loading size="medium" - onButtonClick={() => {}} + onButtonClick={() => { + // do nothing + }} sx={{ marginLeft: '10px' }} /> ) : ( diff --git a/src/components/overlays/EditUsecase/index.tsx b/src/components/overlays/EditUsecase/index.tsx index e18fd13a6..807573a58 100644 --- a/src/components/overlays/EditUsecase/index.tsx +++ b/src/components/overlays/EditUsecase/index.tsx @@ -138,7 +138,9 @@ export default function EditUsecase({ loadIndicator="Loading ..." loading size="medium" - onButtonClick={() => {}} + onButtonClick={() => { + // do nothing + }} sx={{ marginLeft: '10px' }} /> ) : ( diff --git a/src/components/overlays/EnableIDP/index.tsx b/src/components/overlays/EnableIDP/index.tsx index a900952d0..94b93c913 100644 --- a/src/components/overlays/EnableIDP/index.tsx +++ b/src/components/overlays/EnableIDP/index.tsx @@ -160,7 +160,9 @@ export const EnableIDP = ({ id }: { id: string }) => { loadIndicator={t('action.loading')} loading size="medium" - onButtonClick={() => {}} + onButtonClick={() => { + // do nothing + }} sx={{ marginLeft: '10px' }} /> ) : ( diff --git a/src/components/overlays/InviteForm/index.tsx b/src/components/overlays/InviteForm/index.tsx index ff1228bd5..9822a68a0 100644 --- a/src/components/overlays/InviteForm/index.tsx +++ b/src/components/overlays/InviteForm/index.tsx @@ -102,65 +102,62 @@ export const InviteForm = ({ } return ( - <> - - - -
- {['company', 'email', 'first', 'last'].map((value, i) => ( - - {t(`global.field.${value}`)} - - } - key={i} - name={value} - placeholder={t(`global.field.${value}`)} - value={inpExpr[i]} - error={inpValid[i]} - autoFocus={value === 'company'} - onChange={(e) => { - doValidate(i, e.target.value) - }} - > - ))} -
-
- - + {state === ProcessingType.BUSY ? ( + { + // do nothing }} - > - {`${t('global.actions.cancel')}`} + sx={{ marginLeft: '10px' }} + /> + ) : ( + - {state === ProcessingType.BUSY ? ( - {}} - sx={{ marginLeft: '10px' }} - /> - ) : ( - - )} - -
- + )} + + ) } diff --git a/src/components/overlays/ServiceRequest/index.tsx b/src/components/overlays/ServiceRequest/index.tsx index e0bae512b..d315b1b35 100644 --- a/src/components/overlays/ServiceRequest/index.tsx +++ b/src/components/overlays/ServiceRequest/index.tsx @@ -121,7 +121,9 @@ export default function ServiceRequest({ id }: { id: string }) { onChange={(e) => { handleSelectedAgreement(e.target.checked, agreement) }} - onFocusVisible={function noRefCheck() {}} + onFocusVisible={function noRefCheck() { + // do nothing + }} /> ))} diff --git a/src/components/overlays/UpdateCertificate/index.tsx b/src/components/overlays/UpdateCertificate/index.tsx index f0b8502ab..6b57891f5 100644 --- a/src/components/overlays/UpdateCertificate/index.tsx +++ b/src/components/overlays/UpdateCertificate/index.tsx @@ -306,7 +306,9 @@ export default function UpdateCertificate({ id }: { id: string }) { loadIndicator="Loading ..." loading size="medium" - onButtonClick={() => {}} + onButtonClick={() => { + // do nothing + }} sx={{ marginLeft: '10px' }} /> ) : ( diff --git a/src/components/overlays/UpdateCompanyRole/index.tsx b/src/components/overlays/UpdateCompanyRole/index.tsx index b319a6b9f..c7fa733ec 100644 --- a/src/components/overlays/UpdateCompanyRole/index.tsx +++ b/src/components/overlays/UpdateCompanyRole/index.tsx @@ -420,7 +420,9 @@ export default function UpdateCompanyRole({ roles }: { roles: string[] }) { loadIndicator="Loading ..." loading size="medium" - onButtonClick={() => {}} + onButtonClick={() => { + // do nothing + }} sx={{ marginLeft: '10px' }} /> ) : ( diff --git a/src/components/overlays/UpdateIDP/index.tsx b/src/components/overlays/UpdateIDP/index.tsx index 73b43a1f4..b897de149 100644 --- a/src/components/overlays/UpdateIDP/index.tsx +++ b/src/components/overlays/UpdateIDP/index.tsx @@ -134,7 +134,9 @@ export const UpdateIDP = ({ id }: { id: string }) => { label="" loading loadIndicator={t('action.loading')} - onButtonClick={() => {}} + onButtonClick={() => { + // do nothing + }} sx={{ marginLeft: '10px' }} /> ) : ( diff --git a/src/components/pages/Admin/components/RegistrationRequests/CompanyDetailOverlay/index.tsx b/src/components/pages/Admin/components/RegistrationRequests/CompanyDetailOverlay/index.tsx index 72e2247f0..056bfa9f4 100644 --- a/src/components/pages/Admin/components/RegistrationRequests/CompanyDetailOverlay/index.tsx +++ b/src/components/pages/Admin/components/RegistrationRequests/CompanyDetailOverlay/index.tsx @@ -399,8 +399,12 @@ const CompanyDetailOverlay = ({ margin: '0px 10px', cursor: 'auto', }} - onClick={function noRefCheck() {}} - onFocusVisible={function noRefCheck() {}} + onClick={function noRefCheck() { + // do nothing + }} + onFocusVisible={function noRefCheck() { + // do nothing + }} size="small" variant="contained" > diff --git a/src/components/pages/Admin/components/RegistrationRequests/registrationTableColumns.tsx b/src/components/pages/Admin/components/RegistrationRequests/registrationTableColumns.tsx index 5909de809..63eca3b5e 100644 --- a/src/components/pages/Admin/components/RegistrationRequests/registrationTableColumns.tsx +++ b/src/components/pages/Admin/components/RegistrationRequests/registrationTableColumns.tsx @@ -156,7 +156,9 @@ export const RegistrationRequestsTableColumns = ( 'content.admin.registration-requests.buttonprogress' ), type: 'progress', - onClick: () => {}, + onClick: () => { + // do nothing + }, withIcon: true, }} /> diff --git a/src/components/pages/AppOverview/AddRoles.tsx b/src/components/pages/AppOverview/AddRoles.tsx index 75d28a4ea..82b2c9ca9 100644 --- a/src/components/pages/AppOverview/AddRoles.tsx +++ b/src/components/pages/AppOverview/AddRoles.tsx @@ -217,7 +217,9 @@ export default function AddRoles() { loadIndicator="Loading..." loading={isLoading} variant="contained" - onButtonClick={() => {}} + onButtonClick={() => { + // do nothing + }} label={`${t('global.actions.confirm')}`} /> ) : ( diff --git a/src/components/pages/AppOverview/AddRolesOverlay.tsx b/src/components/pages/AppOverview/AddRolesOverlay.tsx index e5bd01652..9fd63f457 100644 --- a/src/components/pages/AppOverview/AddRolesOverlay.tsx +++ b/src/components/pages/AppOverview/AddRolesOverlay.tsx @@ -280,7 +280,9 @@ const AddRolesOverlay = ({ {}} + onButtonClick={() => { + // do nothing + }} loading={isLoading} label={`${t('global.actions.confirm')}`} loadIndicator="Loading..." diff --git a/src/components/pages/AppOverview/ChangeDescription.tsx b/src/components/pages/AppOverview/ChangeDescription.tsx index 7a6c31444..4763a0ed3 100644 --- a/src/components/pages/AppOverview/ChangeDescription.tsx +++ b/src/components/pages/AppOverview/ChangeDescription.tsx @@ -328,7 +328,9 @@ export default function ChangeDescription() { {}} + onButtonClick={() => { + // do nothing + }} loading={isLoading} label={`${t('global.actions.confirm')}`} loadIndicator="Loading..." diff --git a/src/components/pages/AppOverview/ChangeDocuments.tsx b/src/components/pages/AppOverview/ChangeDocuments.tsx index 4ce2dff8f..9518e58d9 100644 --- a/src/components/pages/AppOverview/ChangeDocuments.tsx +++ b/src/components/pages/AppOverview/ChangeDocuments.tsx @@ -176,7 +176,9 @@ export default function ChangeDocuments() { size="small" loading={isLoading} variant="contained" - onButtonClick={() => {}} + onButtonClick={() => { + // do nothing + }} loadIndicator="Loading..." label={`${t('global.actions.confirm')}`} /> diff --git a/src/components/pages/AppOverview/ChangeImage.tsx b/src/components/pages/AppOverview/ChangeImage.tsx index 349f7083a..a658f7455 100644 --- a/src/components/pages/AppOverview/ChangeImage.tsx +++ b/src/components/pages/AppOverview/ChangeImage.tsx @@ -221,7 +221,9 @@ export default function ChangeImage() { size="small" loading={isLoading} variant="contained" - onButtonClick={() => {}} + onButtonClick={() => { + // do nothing + }} loadIndicator="Loading..." label={`${t('global.actions.confirm')}`} /> diff --git a/src/components/pages/AppOverview/Deactivate.tsx b/src/components/pages/AppOverview/Deactivate.tsx index 4a343dafc..fdfb8da32 100644 --- a/src/components/pages/AppOverview/Deactivate.tsx +++ b/src/components/pages/AppOverview/Deactivate.tsx @@ -141,7 +141,9 @@ export default function Deactivate() { size="small" loading={isLoading} variant="contained" - onButtonClick={() => {}} + onButtonClick={() => { + // do nothing + }} loadIndicator="Loading..." label={`${t('global.actions.confirm')}`} /> diff --git a/src/components/pages/AppOverview/index.tsx b/src/components/pages/AppOverview/index.tsx index 287cd0851..cee1a8fdf 100644 --- a/src/components/pages/AppOverview/index.tsx +++ b/src/components/pages/AppOverview/index.tsx @@ -306,7 +306,9 @@ export default function AppOverview() { {state && ( {}} + onCloseNotification={() => { + // do nothing + }} severity={ state === 'deactivate-success' ? SuccessErrorType.SUCCESS diff --git a/src/components/pages/AppOverviewNew/index.tsx b/src/components/pages/AppOverviewNew/index.tsx index 7b2fa5bff..7d12168d1 100644 --- a/src/components/pages/AppOverviewNew/index.tsx +++ b/src/components/pages/AppOverviewNew/index.tsx @@ -50,7 +50,9 @@ export default function AppOverviewNew() { filterItem={data.content.map((item: AppMarketplaceApp) => appToCard(item) )} - showOverlay={() => {}} + showOverlay={() => { + // do nothing + }} /> ) : ( <> diff --git a/src/components/pages/AppReleaseProcess/index.tsx b/src/components/pages/AppReleaseProcess/index.tsx index 4499acd49..086524198 100644 --- a/src/components/pages/AppReleaseProcess/index.tsx +++ b/src/components/pages/AppReleaseProcess/index.tsx @@ -78,7 +78,9 @@ export default function AppReleaseProcess() { dispatch(setAppStatus(initialState.appStatusData)) } - const onOverviewButton = () => {} + const onOverviewButton = () => { + // do nothing + } const requirements = [ { diff --git a/src/components/pages/AppSubscription/ActivateSubscriptionOverlay/index.tsx b/src/components/pages/AppSubscription/ActivateSubscriptionOverlay/index.tsx index bc6c86b16..4b89c99f4 100644 --- a/src/components/pages/AppSubscription/ActivateSubscriptionOverlay/index.tsx +++ b/src/components/pages/AppSubscription/ActivateSubscriptionOverlay/index.tsx @@ -298,7 +298,9 @@ const ActivateSubscriptionOverlay = ({ loadIndicator="Loading ..." loading size="medium" - onButtonClick={() => {}} + onButtonClick={() => { + // do nothing + }} sx={{ marginLeft: '10px' }} /> ) : ( diff --git a/src/components/pages/EdcConnector/index.tsx b/src/components/pages/EdcConnector/index.tsx index ad4b6d2d8..f897c10a0 100644 --- a/src/components/pages/EdcConnector/index.tsx +++ b/src/components/pages/EdcConnector/index.tsx @@ -335,7 +335,9 @@ const EdcConnector = () => { title={getSuccessTitle()} intro={getSuccessIntro()} dialogOpen={true} - handleCallback={() => {}} + handleCallback={() => { + // do nothing + }} > @@ -348,7 +350,9 @@ const EdcConnector = () => { iconComponent={ } - handleCallback={() => {}} + handleCallback={() => { + // do nothing + }} > diff --git a/src/components/pages/Organization/AppSubscriptions.tsx b/src/components/pages/Organization/AppSubscriptions.tsx index 19dc9d711..9aa7e23a1 100644 --- a/src/components/pages/Organization/AppSubscriptions.tsx +++ b/src/components/pages/Organization/AppSubscriptions.tsx @@ -29,15 +29,15 @@ export default function AppSubscriptions({ provider, status, image, - onButtonClick = () => {}, - onUnsubscribe = () => {}, + onButtonClick, + onUnsubscribe, }: { - name: string - provider: string - status: SubscriptionStatus | undefined - image: ImageType | undefined - onButtonClick?: React.MouseEventHandler - onUnsubscribe?: React.MouseEventHandler + readonly name: string + readonly provider: string + readonly status: SubscriptionStatus | undefined + readonly image: ImageType | undefined + readonly onButtonClick?: React.MouseEventHandler + readonly onUnsubscribe?: React.MouseEventHandler }) { const { t } = useTranslation() const colorCode = [ diff --git a/src/components/pages/Organization/UnSubscribeOverlay.tsx b/src/components/pages/Organization/UnSubscribeOverlay.tsx index 893573bf8..becfd937f 100644 --- a/src/components/pages/Organization/UnSubscribeOverlay.tsx +++ b/src/components/pages/Organization/UnSubscribeOverlay.tsx @@ -142,7 +142,9 @@ const UnSubscribeOverlay = ({ loadIndicator={t('global.actions.loading')} loading size="medium" - onButtonClick={() => {}} + onButtonClick={() => { + // do nothing + }} sx={{ marginLeft: '10px', textTransform: 'none' }} /> )} diff --git a/src/components/pages/ServiceReleaseProcess/components/ServiceDeactivate.tsx b/src/components/pages/ServiceReleaseProcess/components/ServiceDeactivate.tsx index ba0e43dc4..5bb796b7a 100644 --- a/src/components/pages/ServiceReleaseProcess/components/ServiceDeactivate.tsx +++ b/src/components/pages/ServiceReleaseProcess/components/ServiceDeactivate.tsx @@ -149,7 +149,9 @@ export default function ServiceDeactivate() { loadIndicator="Loading..." variant="contained" size="small" - onButtonClick={() => {}} + onButtonClick={() => { + // do nothing + }} label={`${t('global.actions.confirm')}`} /> ) : ( diff --git a/src/components/pages/ServiceReleaseProcess/components/ServiceDetails.tsx b/src/components/pages/ServiceReleaseProcess/components/ServiceDetails.tsx index 10d970fc8..7792fa262 100644 --- a/src/components/pages/ServiceReleaseProcess/components/ServiceDetails.tsx +++ b/src/components/pages/ServiceReleaseProcess/components/ServiceDetails.tsx @@ -97,7 +97,9 @@ export default function ServiceDetails() { imagePath={`${getAssetBase()}/images/content/ServiceMarketplace.png`} label={''} buttonText="" - onBtnClick={() => {}} + onBtnClick={() => { + // do nothing + }} title={fetchServiceStatus.title} subTitle={getServiceTypes()} description={''} diff --git a/src/components/pages/ServiceReleaseProcess/components/ServiceListOverview.tsx b/src/components/pages/ServiceReleaseProcess/components/ServiceListOverview.tsx index 0ad2b7e7b..bbbc8b86e 100644 --- a/src/components/pages/ServiceReleaseProcess/components/ServiceListOverview.tsx +++ b/src/components/pages/ServiceReleaseProcess/components/ServiceListOverview.tsx @@ -295,7 +295,9 @@ export default function ServiceListOverview() { {state && ( {}} + onCloseNotification={() => { + // do nothing + }} severity={ state === ServiceDeactivateEnum.SERVICE_DEACTIVATE_SUCCESS ? SuccessErrorType.SUCCESS diff --git a/src/components/shared/basic/ReleaseProcess/components/CommonValidateAndPublish.tsx b/src/components/shared/basic/ReleaseProcess/components/CommonValidateAndPublish.tsx index 4ff9a21af..32dd2748f 100644 --- a/src/components/shared/basic/ReleaseProcess/components/CommonValidateAndPublish.tsx +++ b/src/components/shared/basic/ReleaseProcess/components/CommonValidateAndPublish.tsx @@ -356,7 +356,9 @@ export default function CommonValidateAndPublish({ imagePath={cardImage ?? LogoGrayData} label={''} buttonText="" - onBtnClick={() => {}} + onBtnClick={() => { + // do nothing + }} title={statusData?.title ?? ''} subTitle={serviceTypes ?? ''} description={''} diff --git a/src/setupTests.ts b/src/setupTests.ts index 1dde73824..fe2b2533a 100644 --- a/src/setupTests.ts +++ b/src/setupTests.ts @@ -30,7 +30,11 @@ window.matchMedia = function () { return { matches: false, - addListener: function () {}, - removeListener: function () {}, + addListener: function () { + // do nothing + }, + removeListener: function () { + // do nothing + }, } } From f1ac3c7cd39ff74e3dfee55066a95896c7a5655d Mon Sep 17 00:00:00 2001 From: nidhigarg-bmw <101316912+nidhigarg-bmw@users.noreply.github.com> Date: Mon, 30 Oct 2023 15:04:49 +0530 Subject: [PATCH 04/13] feat(usermanagement): user invite idp logic changes (#326) --- CHANGELOG.md | 3 ++- .../overlays/AddMultipleUser/index.tsx | 10 ++++++++-- src/components/overlays/AddusersIDP/index.tsx | 16 ++++------------ .../registrationTableColumns.tsx | 1 + .../NotificationCenter/NotificationItem.tsx | 3 +++ .../components/CommonContractAndConsent.tsx | 1 + .../Subscription/SubscriptionElements.tsx | 1 + src/features/admin/idpApiSlice.ts | 1 + 8 files changed, 21 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 76cb67deb..03d8ec34d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,8 @@ ## unreleased -- ... +- Usermanagement + - User Invite IdP connection logic ## 1.7.0-RC1 diff --git a/src/components/overlays/AddMultipleUser/index.tsx b/src/components/overlays/AddMultipleUser/index.tsx index 43a058279..0d492a361 100644 --- a/src/components/overlays/AddMultipleUser/index.tsx +++ b/src/components/overlays/AddMultipleUser/index.tsx @@ -58,6 +58,7 @@ import { useFetchIDPListQuery, type IdentityProvider, IDPCategory, + IDPProviderType, } from 'features/admin/idpApiSlice' import './AddMultipleUser.scss' import Papa from 'papaparse' @@ -96,8 +97,14 @@ export default function AddMultipleUser() { }, [data, dispatch]) useEffect(() => { + const filteredIdps = idpsData?.filter( + (idp: IdentityProvider) => + idp.identityProviderTypeId !== IDPProviderType.MANAGED + ) setIdps( - idpsData ? idpsData.filter((idp: IdentityProvider) => idp.enabled) : [] + filteredIdps + ? filteredIdps.filter((idp: IdentityProvider) => idp.enabled) + : [] ) }, [idpsData]) @@ -158,7 +165,6 @@ export default function AddMultipleUser() { Papa.parse(uploadedFile, { skipEmptyLines: true, complete: async (results) => { - console.log('results', results) const csvData: Array> = results.data as Array< Array > diff --git a/src/components/overlays/AddusersIDP/index.tsx b/src/components/overlays/AddusersIDP/index.tsx index 175c7fde2..1363066e2 100644 --- a/src/components/overlays/AddusersIDP/index.tsx +++ b/src/components/overlays/AddusersIDP/index.tsx @@ -107,13 +107,7 @@ const SelectFormat = ({ ) } -const AddusersIDPResponse = ({ - response, - storeResponse, -}: { - response: string - storeResponse: (response: string) => void -}) => { +const AddusersIDPResponse = ({ response }: { response: string }) => { const { t } = useTranslation('idp') const userResponse = JSON.parse(response) @@ -601,15 +595,13 @@ export const AddusersIDP = ({ id }: { id: string }) => { intro="" closeWithIcon={true} onCloseWithIcon={() => { - userResponse?.data ? storeResponse('') : dispatch(closeOverlay()) + storeResponse('') + dispatch(closeOverlay()) }} /> {userResponse?.data ? ( - + ) : ( renderContent() )} diff --git a/src/components/pages/Admin/components/RegistrationRequests/registrationTableColumns.tsx b/src/components/pages/Admin/components/RegistrationRequests/registrationTableColumns.tsx index 63eca3b5e..c1073fbf7 100644 --- a/src/components/pages/Admin/components/RegistrationRequests/registrationTableColumns.tsx +++ b/src/components/pages/Admin/components/RegistrationRequests/registrationTableColumns.tsx @@ -81,6 +81,7 @@ export const RegistrationRequestsTableColumns = ( onClick={() => { showConfirmOverlay && showConfirmOverlay(row.applicationId) }} + onKeyDown={() => {}} > diff --git a/src/components/pages/NotificationCenter/NotificationItem.tsx b/src/components/pages/NotificationCenter/NotificationItem.tsx index ea36c1e68..488f0284e 100644 --- a/src/components/pages/NotificationCenter/NotificationItem.tsx +++ b/src/components/pages/NotificationCenter/NotificationItem.tsx @@ -293,6 +293,7 @@ export default function NotificationItem({ )}
  • {}} style={{ backgroundColor: userRead ? 'rgba(255, 255, 255, 1)' @@ -376,6 +377,7 @@ export default function NotificationItem({ setRead(item.id, !userRead) e.stopPropagation() }} + onKeyDown={() => {}} > {userRead ? ( {}} > diff --git a/src/components/shared/basic/ReleaseProcess/components/CommonContractAndConsent.tsx b/src/components/shared/basic/ReleaseProcess/components/CommonContractAndConsent.tsx index 2fd77d049..a07ff5f22 100644 --- a/src/components/shared/basic/ReleaseProcess/components/CommonContractAndConsent.tsx +++ b/src/components/shared/basic/ReleaseProcess/components/CommonContractAndConsent.tsx @@ -461,6 +461,7 @@ export default function CommonContractAndConsent({ onClick={() => handleFrameDocumentDownload(item.name, item.documentId) } + onKeyDown={() => {}} > {item.name} diff --git a/src/components/shared/templates/Subscription/SubscriptionElements.tsx b/src/components/shared/templates/Subscription/SubscriptionElements.tsx index 11e8fe8b3..074262ed5 100644 --- a/src/components/shared/templates/Subscription/SubscriptionElements.tsx +++ b/src/components/shared/templates/Subscription/SubscriptionElements.tsx @@ -260,6 +260,7 @@ export default function SubscriptionElements({ subscriptionId: subscription.subscriptionId, }) }} + onKeyDown={() => {}} > Date: Mon, 30 Oct 2023 15:27:32 +0530 Subject: [PATCH 05/13] updates(eslint): enable prefer-optional-chain (#327) --- .eslintrc.json | 1 - src/components/overlays/AddBPN/index.tsx | 43 ++++++++--------- src/components/overlays/AddUser/UserRoles.tsx | 2 +- .../overlays/AppMarketplaceRequest/index.tsx | 31 ++++++------ .../overlays/EditAppUserRoles/index.tsx | 7 ++- .../overlays/ServiceRequest/index.tsx | 31 ++++++------ .../CompanyDetailOverlay/index.tsx | 36 +++++++------- .../components/CheckList/index.tsx | 4 +- .../registrationTableColumns.tsx | 10 ++-- .../components/BoardPrivacy/index.tsx | 2 +- .../components/AppDetailPrivacy/index.tsx | 2 +- .../components/AppListSection/index.tsx | 5 +- .../components/AppUserDetailsHeader/index.tsx | 33 +++++++------ .../AddConnectorOverlay/index.tsx | 4 +- .../BusinessApplicationsSection/index.tsx | 39 ++++++++------- .../pages/NotificationCenter/index.tsx | 7 ++- src/components/pages/RoleDetails/index.tsx | 45 +++++++++-------- .../RecommendedServices.tsx | 2 +- .../pages/ServiceMarketplace/index.tsx | 22 ++++----- .../components/ServiceListOverview.tsx | 2 +- .../shared/basic/Dropzone/index.tsx | 4 +- .../basic/ReleaseProcess/AppPage/index.tsx | 48 ++++++++----------- .../basic/ReleaseProcess/OfferCard/index.tsx | 2 +- .../TechnicalIntegration/index.tsx | 2 +- .../components/CommonContractAndConsent.tsx | 16 ++----- .../components/CommonValidateAndPublish.tsx | 29 ++++++----- .../components/ConnectorFormInputField.tsx | 6 +-- .../SnackbarNotificationWithButtons.tsx | 10 ++-- .../shared/basic/ReleaseProcess/index.tsx | 45 ++++++++--------- .../shared/frame/AppPermissions/index.tsx | 2 +- .../AdminBoard/AdminBoardElements.tsx | 2 +- .../shared/templates/AdminBoard/index.tsx | 4 +- .../Cards/FlexImages.tsx | 7 ++- .../Cards/GridImages.tsx | 7 ++- .../Cards/TextCenterAlignedBody2.tsx | 21 ++++---- .../StaticTemplateResponsive/StaticTypes.ts | 1 + .../StaticTemplateResponsive/index.tsx | 41 ++++++++-------- .../Subscription/SubscriptionElements.tsx | 2 +- .../shared/templates/Subscription/index.tsx | 7 ++- .../admin/applicationRequestApiSlice.ts | 2 +- 40 files changed, 272 insertions(+), 314 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 8e05651eb..ce64da96c 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -37,7 +37,6 @@ "@typescript-eslint/no-unsafe-call": 0, "@typescript-eslint/no-unsafe-member-access": 0, "@typescript-eslint/no-unsafe-return": 0, - "@typescript-eslint/prefer-optional-chain": 0, "@typescript-eslint/restrict-template-expressions": 0, "@typescript-eslint/strict-boolean-expressions": 0, "@typescript-eslint/array-type": 0, diff --git a/src/components/overlays/AddBPN/index.tsx b/src/components/overlays/AddBPN/index.tsx index b2510a8a2..a2dc8bdb5 100644 --- a/src/components/overlays/AddBPN/index.tsx +++ b/src/components/overlays/AddBPN/index.tsx @@ -104,28 +104,27 @@ export default function AddBPN({ id }: { id: string }) {
      - {bpnValues && - bpnValues.map((bpn: string, i: number) => { - return ( -
    • -

      - {bpn} -

      {' '} - { - onHoverEvent(i) - }} - onMouseOut={() => { - onHoverEvent(-1) - }} - onClick={() => { - onDeleteBpnHandler(bpn) - }} - className="deleteIcon" - /> -
    • - ) - })} + {bpnValues?.map((bpn: string, i: number) => { + return ( +
    • +

      + {bpn} +

      {' '} + { + onHoverEvent(i) + }} + onMouseOut={() => { + onHoverEvent(-1) + }} + onClick={() => { + onDeleteBpnHandler(bpn) + }} + className="deleteIcon" + /> +
    • + ) + })}
    { useEffect(() => { const rolesArr: AppRole[] = [] - data && data.map((a) => rolesArr.push(...a.roles)) + data?.map((a) => rolesArr.push(...a.roles)) setAllRoles(rolesArr) }, [data]) diff --git a/src/components/overlays/AppMarketplaceRequest/index.tsx b/src/components/overlays/AppMarketplaceRequest/index.tsx index 17fb8c922..622ba76d7 100644 --- a/src/components/overlays/AppMarketplaceRequest/index.tsx +++ b/src/components/overlays/AppMarketplaceRequest/index.tsx @@ -106,9 +106,7 @@ export default function AppMarketplaceRequest({ id }: { id: string }) { agreement.agreementId, ]) } else { - const index = - checkedAgreementsIds && - checkedAgreementsIds.indexOf(agreement.agreementId) + const index = checkedAgreementsIds?.indexOf(agreement.agreementId) if (index > -1) { checkedAgreementsIds.splice(index, 1) setCheckedAgreementsIds([...checkedAgreementsIds]) @@ -145,20 +143,19 @@ export default function AppMarketplaceRequest({ id }: { id: string }) { t('content.appMarketplace.desc4').replace('{appName}', data.title)}
      - {agreements && - agreements.map((agreement, index) => ( -
    • - { - handleCheckedAgreement(e.target.checked, agreement) - }} - onFocusVisible={function noRefCheck() { - // do nothing - }} - /> -
    • - ))} + {agreements?.map((agreement, index) => ( +
    • + { + handleCheckedAgreement(e.target.checked, agreement) + }} + onFocusVisible={function noRefCheck() { + // do nothing + }} + /> +
    • + ))}
    {t('content.appMarketplace.statusHeading')} diff --git a/src/components/overlays/EditAppUserRoles/index.tsx b/src/components/overlays/EditAppUserRoles/index.tsx index a9c9dacea..02aa07dd7 100644 --- a/src/components/overlays/EditAppUserRoles/index.tsx +++ b/src/components/overlays/EditAppUserRoles/index.tsx @@ -52,10 +52,9 @@ export default function EditAppUserRoles({ id }: { id: string }) { const appDetails = useFetchAppDetailsQuery(appId ?? '').data const appRoles = useFetchAppRolesQuery(appId ?? '').data const { data, refetch } = useFetchUserDetailsQuery(id) - const assignedRoles = - data && - data.assignedRoles.filter((assignedRole) => assignedRole.appId === appId)[0] - ?.roles + const assignedRoles = data?.assignedRoles.filter( + (assignedRole) => assignedRole.appId === appId + )[0]?.roles useEffect(() => { setRoles(assignedRoles ?? []) diff --git a/src/components/overlays/ServiceRequest/index.tsx b/src/components/overlays/ServiceRequest/index.tsx index d315b1b35..ad19e2012 100644 --- a/src/components/overlays/ServiceRequest/index.tsx +++ b/src/components/overlays/ServiceRequest/index.tsx @@ -85,9 +85,7 @@ export default function ServiceRequest({ id }: { id: string }) { agreement.agreementId, ]) } else { - const index = - selectedAgreementsIds && - selectedAgreementsIds.indexOf(agreement.agreementId) + const index = selectedAgreementsIds?.indexOf(agreement.agreementId) if (index > -1) { selectedAgreementsIds.splice(index, 1) setSelectedAgreementsIds([...selectedAgreementsIds]) @@ -113,20 +111,19 @@ export default function ServiceRequest({ id }: { id: string }) { )}
      - {serviceAgreements && - serviceAgreements.map((agreement, index) => ( -
    • - { - handleSelectedAgreement(e.target.checked, agreement) - }} - onFocusVisible={function noRefCheck() { - // do nothing - }} - /> -
    • - ))} + {serviceAgreements?.map((agreement, index) => ( +
    • + { + handleSelectedAgreement(e.target.checked, agreement) + }} + onFocusVisible={function noRefCheck() { + // do nothing + }} + /> +
    • + ))}
    diff --git a/src/components/pages/Admin/components/RegistrationRequests/CompanyDetailOverlay/index.tsx b/src/components/pages/Admin/components/RegistrationRequests/CompanyDetailOverlay/index.tsx index 056bfa9f4..2a51e96ec 100644 --- a/src/components/pages/Admin/components/RegistrationRequests/CompanyDetailOverlay/index.tsx +++ b/src/components/pages/Admin/components/RegistrationRequests/CompanyDetailOverlay/index.tsx @@ -72,18 +72,15 @@ const CompanyDetailOverlay = ({ const { data } = useFetchCompanySearchQuery({ page: 0, args: { - expr: selectedCompany && selectedCompany.name, + expr: selectedCompany?.name, }, }) useEffect(() => { if (data) { - const selected = - data && - data.content && - data.content.filter( - (company: { bpn: string }) => selectedCompany.bpn === company.bpn - ) + const selected = data?.content?.filter( + (company: { bpn: string }) => selectedCompany.bpn === company.bpn + ) setCompany(selected[0]) } }, [data, selectedCompany]) @@ -135,7 +132,7 @@ const CompanyDetailOverlay = ({ newValue: number ) => { setHeight( - modalElement && modalElement.current + modalElement?.current ? `${modalElement?.current?.clientHeight}px` : '400px' ) @@ -250,18 +247,17 @@ const CompanyDetailOverlay = ({ value: selectedCompany?.bpn, }} /> - {selectedCompany.uniqueIds && - selectedCompany.uniqueIds.map( - (id: { type: string; value: string }) => ( - - ) - )} + {selectedCompany?.uniqueIds?.map( + (id: { type: string; value: string }) => ( + + ) + )} { - onButtonClick && onButtonClick(button) + if (onButtonClick) { + onButtonClick(button) + } }} variant="filled" icon={button?.icon} diff --git a/src/components/pages/Admin/components/RegistrationRequests/registrationTableColumns.tsx b/src/components/pages/Admin/components/RegistrationRequests/registrationTableColumns.tsx index c1073fbf7..c389aeec0 100644 --- a/src/components/pages/Admin/components/RegistrationRequests/registrationTableColumns.tsx +++ b/src/components/pages/Admin/components/RegistrationRequests/registrationTableColumns.tsx @@ -79,7 +79,9 @@ export const RegistrationRequestsTableColumns = ( paddingTop: '2px', }} onClick={() => { - showConfirmOverlay && showConfirmOverlay(row.applicationId) + if (showConfirmOverlay) { + showConfirmOverlay(row.applicationId) + } }} onKeyDown={() => {}} > @@ -207,12 +209,14 @@ export const RegistrationRequestsTableColumns = ( cancelText={t('content.admin.registration-requests.cancel')} alignRow="center" onButtonClick={(button) => { - onChipButtonSelect && + if (onChipButtonSelect) { onChipButtonSelect(button, row.applicationId) + } }} onCancel={() => { - onConfirmationCancel && + if (onConfirmationCancel) { onConfirmationCancel(row.applicationId, row.companyName) + } }} /> ) : null} diff --git a/src/components/pages/AdminBoardDetail/components/BoardPrivacy/index.tsx b/src/components/pages/AdminBoardDetail/components/BoardPrivacy/index.tsx index 6d02879d9..b2c5810b9 100644 --- a/src/components/pages/AdminBoardDetail/components/BoardPrivacy/index.tsx +++ b/src/components/pages/AdminBoardDetail/components/BoardPrivacy/index.tsx @@ -54,7 +54,7 @@ export default function BoardPrivacy({ item }: { item: AppDetails }) { {t('heading')} {t('message')}
    - {item.privacyPolicies && item.privacyPolicies.length ? ( + {item?.privacyPolicies?.length ? (
    {item.privacyPolicies.map((policy: PrivacyPolicyType) => ( {t('heading')} {t('message')}
    - {item.privacyPolicies && item.privacyPolicies.length ? ( + {item?.privacyPolicies?.length ? (
    {item.privacyPolicies.map((policy: PrivacyPolicyType) => ( card.title.toLowerCase().includes(expr.toLowerCase()) || - (card.subtitle && - card.subtitle.toLowerCase().includes(expr.toLowerCase())) + card?.subtitle?.toLowerCase().includes(expr.toLowerCase()) ) : cards ) @@ -135,7 +134,7 @@ export default function AppListSection() {
    ) - } else if (cardsData && cardsData.length) { + } else if (cardsData?.length) { return ( ({ diff --git a/src/components/pages/AppUserManagement/components/AppUserDetailsHeader/index.tsx b/src/components/pages/AppUserManagement/components/AppUserDetailsHeader/index.tsx index c1676d037..8f48ad5da 100644 --- a/src/components/pages/AppUserManagement/components/AppUserDetailsHeader/index.tsx +++ b/src/components/pages/AppUserManagement/components/AppUserDetailsHeader/index.tsx @@ -55,24 +55,23 @@ export default function AppUserDetailsHeader({
    - {roles && - roles.map((role) => { - return ( -
    -
    - - {role.role} - - - {role.description} - -
    + {roles?.map((role) => { + return ( +
    +
    + + {role.role} + + + {role.description} +
    - ) - })} +
    + ) + })}
    {error && ( diff --git a/src/components/pages/EdcConnector/AddConnectorOverlay/index.tsx b/src/components/pages/EdcConnector/AddConnectorOverlay/index.tsx index 7848b22cd..09d2b43d3 100644 --- a/src/components/pages/EdcConnector/AddConnectorOverlay/index.tsx +++ b/src/components/pages/EdcConnector/AddConnectorOverlay/index.tsx @@ -174,8 +174,8 @@ const AddConnectorOverlay = ({ {!loading && (
    diff --git a/src/components/pages/ServiceReleaseProcess/components/ServiceListOverview.tsx b/src/components/pages/ServiceReleaseProcess/components/ServiceListOverview.tsx index bbbc8b86e..55bb1a545 100644 --- a/src/components/pages/ServiceReleaseProcess/components/ServiceListOverview.tsx +++ b/src/components/pages/ServiceReleaseProcess/components/ServiceListOverview.tsx @@ -96,7 +96,7 @@ export default function ServiceListOverview() { useEffect(() => { dispatch(setServiceReleaseActiveStep()) - if (data && data.content) + if (data?.content) setItems( data?.meta.page === 0 ? setDataInfo(data) diff --git a/src/components/shared/basic/Dropzone/index.tsx b/src/components/shared/basic/Dropzone/index.tsx index f9ee8905d..6f2a3e790 100644 --- a/src/components/shared/basic/Dropzone/index.tsx +++ b/src/components/shared/basic/Dropzone/index.tsx @@ -104,7 +104,9 @@ export const Dropzone = ({ setDropped(nextFiles) onChange(nextFiles, undefined, deletedFiles) - handleDelete && handleDelete(documentId) + if (handleDelete) { + handleDelete(documentId) + } }, [currentFiles, onChange, handleDelete] ) diff --git a/src/components/shared/basic/ReleaseProcess/AppPage/index.tsx b/src/components/shared/basic/ReleaseProcess/AppPage/index.tsx index dc147d7ae..7301fcdec 100644 --- a/src/components/shared/basic/ReleaseProcess/AppPage/index.tsx +++ b/src/components/shared/basic/ReleaseProcess/AppPage/index.tsx @@ -94,6 +94,7 @@ export default function AppPage() { const getPrivacyPolicies = useFetchPrivacyPoliciesQuery().data const privacyPolicies = + // eslint-disable-next-line getPrivacyPolicies && getPrivacyPolicies?.privacyPolicies.slice(0, -1) const [selectedPrivacyPolicies, setSelectedPrivacyPolicies] = useState< string[] @@ -211,12 +212,8 @@ export default function AppPage() { Object.keys(defaultuploadDataPrerequisits).length > 0 ) { setValue('uploadDataPrerequisits', { - id: - defaultuploadDataPrerequisits && - defaultuploadDataPrerequisits[0]?.documentId, - name: - defaultuploadDataPrerequisits && - defaultuploadDataPrerequisits[0]?.documentName, + id: defaultuploadDataPrerequisits?.[0]?.documentId, + name: defaultuploadDataPrerequisits?.[0]?.documentName, status: UploadStatus.UPLOAD_SUCCESS, }) setFileStatus('uploadDataPrerequisits', UploadStatus.UPLOAD_SUCCESS) @@ -227,12 +224,8 @@ export default function AppPage() { Object.keys(defaultuploadTechnicalGuide).length > 0 ) { setValue('uploadTechnicalGuide', { - id: - defaultuploadTechnicalGuide && - defaultuploadTechnicalGuide[0]?.documentId, - name: - defaultuploadTechnicalGuide && - defaultuploadTechnicalGuide[0]?.documentName, + id: defaultuploadTechnicalGuide?.[0]?.documentId, + name: defaultuploadTechnicalGuide?.[0]?.documentName, status: UploadStatus.UPLOAD_SUCCESS, }) setFileStatus('uploadTechnicalGuide', UploadStatus.UPLOAD_SUCCESS) @@ -243,9 +236,8 @@ export default function AppPage() { Object.keys(defaultuploadAppContract).length > 0 ) { setValue('uploadAppContract', { - id: defaultuploadAppContract && defaultuploadAppContract[0]?.documentId, - name: - defaultuploadAppContract && defaultuploadAppContract[0]?.documentName, + id: defaultuploadAppContract?.[0]?.documentId, + name: defaultuploadAppContract?.[0]?.documentName, status: UploadStatus.UPLOAD_SUCCESS, }) setFileStatus('uploadAppContract', UploadStatus.UPLOAD_SUCCESS) @@ -680,22 +672,22 @@ export default function AppPage() { {privacyPolicies ? ( - {privacyPolicies && - privacyPolicies?.map((item: string) => ( - - { - selectPrivacyPolicies(item, e.target.checked, 'checkbox') - }} - size="small" - /> - - ))} + {privacyPolicies?.map((item: string) => ( + + { + selectPrivacyPolicies(item, e.target.checked, 'checkbox') + }} + size="small" + /> + + ))} { return { diff --git a/src/components/shared/basic/ReleaseProcess/TechnicalIntegration/index.tsx b/src/components/shared/basic/ReleaseProcess/TechnicalIntegration/index.tsx index 45f362777..721bb12c6 100644 --- a/src/components/shared/basic/ReleaseProcess/TechnicalIntegration/index.tsx +++ b/src/components/shared/basic/ReleaseProcess/TechnicalIntegration/index.tsx @@ -453,7 +453,7 @@ export default function TechnicalIntegration() { color: 'white', children: ( - {rolesDescription && rolesDescription[index]} + {rolesDescription?.[index]} ), }, diff --git a/src/components/shared/basic/ReleaseProcess/components/CommonContractAndConsent.tsx b/src/components/shared/basic/ReleaseProcess/components/CommonContractAndConsent.tsx index a07ff5f22..40489480e 100644 --- a/src/components/shared/basic/ReleaseProcess/components/CommonContractAndConsent.tsx +++ b/src/components/shared/basic/ReleaseProcess/components/CommonContractAndConsent.tsx @@ -274,12 +274,8 @@ export default function CommonContractAndConsent({ Object.keys(defaultuploadImageConformity).length > 0 ) { setValue('uploadImageConformity', { - id: - defaultuploadImageConformity && - defaultuploadImageConformity[0]?.documentId, - name: - defaultuploadImageConformity && - defaultuploadImageConformity[0]?.documentName, + id: defaultuploadImageConformity?.[0]?.documentId, + name: defaultuploadImageConformity?.[0]?.documentName, status: UploadStatus.UPLOAD_SUCCESS, }) setFileStatus('uploadImageConformity', UploadStatus.UPLOAD_SUCCESS) @@ -291,12 +287,8 @@ export default function CommonContractAndConsent({ if (Array.isArray(value)) { setValue('uploadImageConformity', { - id: - defaultuploadImageConformity && - defaultuploadImageConformity[0]?.documentId, - name: - defaultuploadImageConformity && - defaultuploadImageConformity[0]?.documentName, + id: defaultuploadImageConformity?.[0]?.documentId, + name: defaultuploadImageConformity?.[0]?.documentName, status: UploadStatus.UPLOAD_SUCCESS, }) setFileStatus('uploadImageConformity', UploadStatus.UPLOAD_SUCCESS) diff --git a/src/components/shared/basic/ReleaseProcess/components/CommonValidateAndPublish.tsx b/src/components/shared/basic/ReleaseProcess/components/CommonValidateAndPublish.tsx index 32dd2748f..76665efc3 100644 --- a/src/components/shared/basic/ReleaseProcess/components/CommonValidateAndPublish.tsx +++ b/src/components/shared/basic/ReleaseProcess/components/CommonValidateAndPublish.tsx @@ -600,21 +600,20 @@ export default function CommonValidateAndPublish({ {defaultValues && (
    - {defaultValues.cxTestRuns && - defaultValues.cxTestRuns?.map( - (item: { name: string; consentStatus: string }) => ( -
    - -
    - ) - )} + {defaultValues?.cxTestRuns?.map( + (item: { name: string; consentStatus: string }) => ( +
    + +
    + ) + )}
    )} diff --git a/src/components/shared/basic/ReleaseProcess/components/ConnectorFormInputField.tsx b/src/components/shared/basic/ReleaseProcess/components/ConnectorFormInputField.tsx index 5fe61f5de..53018fb6d 100644 --- a/src/components/shared/basic/ReleaseProcess/components/ConnectorFormInputField.tsx +++ b/src/components/shared/basic/ReleaseProcess/components/ConnectorFormInputField.tsx @@ -75,7 +75,7 @@ any) => { label={label} placeholder={placeholder} error={!!errors[name]} - helperText={errors && errors[name] && errors[name].message} + helperText={errors?.[name]?.message} value={value || ''} onChange={(event) => { trigger(name) @@ -94,7 +94,7 @@ any) => { } else if (type === 'dropzone') { return ( { trigger(name) onChange(file) @@ -132,7 +132,7 @@ any) => { label={label} placeholder={placeholder} error={!!errors[name]} - helperText={errors && errors[name] && errors[name].message} + helperText={errors?.[name]?.message} value={value} items={items} keyTitle={keyTitle} diff --git a/src/components/shared/basic/ReleaseProcess/components/SnackbarNotificationWithButtons.tsx b/src/components/shared/basic/ReleaseProcess/components/SnackbarNotificationWithButtons.tsx index 9d04c2754..a0c0a21af 100644 --- a/src/components/shared/basic/ReleaseProcess/components/SnackbarNotificationWithButtons.tsx +++ b/src/components/shared/basic/ReleaseProcess/components/SnackbarNotificationWithButtons.tsx @@ -77,14 +77,14 @@ export default function SnackbarNotificationWithButtons({ { - setPageNotification && setPageNotification(false) + if (setPageNotification) { + setPageNotification(false) + } }} /> diff --git a/src/components/shared/basic/ReleaseProcess/index.tsx b/src/components/shared/basic/ReleaseProcess/index.tsx index d8dc16783..b3d03f921 100644 --- a/src/components/shared/basic/ReleaseProcess/index.tsx +++ b/src/components/shared/basic/ReleaseProcess/index.tsx @@ -152,32 +152,27 @@ export const ReleaseProcess = ({
      - {requirements && - requirements.map((req: RequerementStepType, index) => ( -
    • - + + - {req.neuButton} - - - - {req.marketplaceTitle} - - - {req.marketplaceExplanation} - - -
    • - ))} + {req.marketplaceTitle} + + + {req.marketplaceExplanation} + + + + ))}
    diff --git a/src/components/shared/frame/AppPermissions/index.tsx b/src/components/shared/frame/AppPermissions/index.tsx index 50f85607a..bcbf7e071 100644 --- a/src/components/shared/frame/AppPermissions/index.tsx +++ b/src/components/shared/frame/AppPermissions/index.tsx @@ -43,7 +43,7 @@ export const AppPermissions = ({ user }: { user: TenantUserDetails }) => { > {data ? data.title : id} - {data && data.provider} + {data?.provider} ) diff --git a/src/components/shared/templates/AdminBoard/AdminBoardElements.tsx b/src/components/shared/templates/AdminBoard/AdminBoardElements.tsx index 3d6cb78b0..a3e5a36af 100644 --- a/src/components/shared/templates/AdminBoard/AdminBoardElements.tsx +++ b/src/components/shared/templates/AdminBoard/AdminBoardElements.tsx @@ -134,7 +134,7 @@ export default function AdminBoardElements({ showIcon={true} autoClose={true} /> - {apps && apps.length ? ( + {apps?.length ? ( { diff --git a/src/components/shared/templates/AdminBoard/index.tsx b/src/components/shared/templates/AdminBoard/index.tsx index 3badf4d6d..ee59bce1d 100644 --- a/src/components/shared/templates/AdminBoard/index.tsx +++ b/src/components/shared/templates/AdminBoard/index.tsx @@ -195,7 +195,7 @@ const setCards = ( content: ServiceContent[] } ) => { - if (payload && payload.meta) { + if (payload?.meta) { return payload.meta.page === 0 ? payload.content : state.appCards.concat(payload.content) @@ -264,7 +264,7 @@ export default function CommonAdminBoard({ const { data, refetch, isFetching, isSuccess } = fetchQuery(fetchArgs) useEffect(() => { - if (data && data?.content) + if (data?.content) setState({ type: ActionKind.SET_APPS_AND_APP_CARDS, payload: data }) }, [data]) diff --git a/src/components/shared/templates/StaticTemplateResponsive/Cards/FlexImages.tsx b/src/components/shared/templates/StaticTemplateResponsive/Cards/FlexImages.tsx index a9a8411dd..4c0792093 100644 --- a/src/components/shared/templates/StaticTemplateResponsive/Cards/FlexImages.tsx +++ b/src/components/shared/templates/StaticTemplateResponsive/Cards/FlexImages.tsx @@ -31,10 +31,9 @@ export default function FlexImages({ }) { return (
    - {provider.images && - provider.images.map((path) => ( - - ))} + {provider?.images?.map((path) => ( + + ))}
    ) } diff --git a/src/components/shared/templates/StaticTemplateResponsive/Cards/GridImages.tsx b/src/components/shared/templates/StaticTemplateResponsive/Cards/GridImages.tsx index 7fb4a0ae8..afad65afc 100644 --- a/src/components/shared/templates/StaticTemplateResponsive/Cards/GridImages.tsx +++ b/src/components/shared/templates/StaticTemplateResponsive/Cards/GridImages.tsx @@ -39,10 +39,9 @@ export default function GridImages({ gridTemplateColumns: `repeat(${grid}, 1fr)`, }} > - {provider.images && - provider.images.map((path) => ( - - ))} + {provider?.images?.map((path) => ( + + ))} ) } diff --git a/src/components/shared/templates/StaticTemplateResponsive/Cards/TextCenterAlignedBody2.tsx b/src/components/shared/templates/StaticTemplateResponsive/Cards/TextCenterAlignedBody2.tsx index b32c85f44..404959039 100644 --- a/src/components/shared/templates/StaticTemplateResponsive/Cards/TextCenterAlignedBody2.tsx +++ b/src/components/shared/templates/StaticTemplateResponsive/Cards/TextCenterAlignedBody2.tsx @@ -53,17 +53,16 @@ export default function TextCenterAlignedBody2({ )} )} - {provider.subTitles && - provider.subTitles.map((subtitle) => ( - , -
    , - ]} - >
    - ))} + {provider?.subTitles?.map((subtitle) => ( + , +
    , + ]} + >
    + ))} ) diff --git a/src/components/shared/templates/StaticTemplateResponsive/StaticTypes.ts b/src/components/shared/templates/StaticTemplateResponsive/StaticTypes.ts index b11036e1d..46c74408a 100644 --- a/src/components/shared/templates/StaticTemplateResponsive/StaticTypes.ts +++ b/src/components/shared/templates/StaticTemplateResponsive/StaticTypes.ts @@ -101,4 +101,5 @@ export enum TemplateNames { LinkButtonGrid = 'LinkButtonGrid', AlignedText = 'AlignedText', TextImageSideBySideWithSections = 'TextImageSideBySideWithSections', + TextCenterAlignedWithImagesInList = 'TextCenterAlignedWithImagesInList', } diff --git a/src/components/shared/templates/StaticTemplateResponsive/index.tsx b/src/components/shared/templates/StaticTemplateResponsive/index.tsx index b1bafcc8a..0c0c11a43 100644 --- a/src/components/shared/templates/StaticTemplateResponsive/index.tsx +++ b/src/components/shared/templates/StaticTemplateResponsive/index.tsx @@ -261,28 +261,27 @@ export const StaticTemplateResponsive = ({ window.addEventListener('scroll', checkScrollTop) return (
    - {sectionInfo && - sectionInfo.map((provider: ProviderProps) => { - return ( -
    -
    - -
    + {sectionInfo?.map((provider: ProviderProps) => { + return ( +
    +
    +
    - ) - })} +
    + ) + })}
    ) } diff --git a/src/components/shared/templates/Subscription/SubscriptionElements.tsx b/src/components/shared/templates/Subscription/SubscriptionElements.tsx index 074262ed5..e2bf50623 100644 --- a/src/components/shared/templates/Subscription/SubscriptionElements.tsx +++ b/src/components/shared/templates/Subscription/SubscriptionElements.tsx @@ -235,7 +235,7 @@ export default function SubscriptionElements({ return (
    - {subscriptions && subscriptions.length ? ( + {subscriptions?.length ? (
      {subscriptions.map((subscriptionData) => { return subscriptionData.companySubscriptionStatuses.map( diff --git a/src/components/shared/templates/Subscription/index.tsx b/src/components/shared/templates/Subscription/index.tsx index d4193b665..6e2eafc62 100644 --- a/src/components/shared/templates/Subscription/index.tsx +++ b/src/components/shared/templates/Subscription/index.tsx @@ -215,7 +215,7 @@ const setData = ( content: SubscriptionContent[] } ) => { - if (payload && payload.meta) { + if (payload?.meta) { return payload.meta.page === 0 ? payload.content : state.subscriptions.concat(payload.content) @@ -315,7 +315,7 @@ export default function Subscription({ const success: boolean = useSelector(currentSuccessType) useEffect(() => { - if (data && data?.content) { + if (data?.content) { setState({ type: ActionKind.SET_SUBSCRIPTION_AND_CARD_SUBSCRIPTION, payload: data, @@ -435,8 +435,7 @@ export default function Subscription({ setState({ type: ActionKind.SET_CARD_SUBSCRIPTION, payload: expr - ? subscriptions && - subscriptions.filter((card: SubscriptionContent) => + ? subscriptions?.filter((card: SubscriptionContent) => card.offerName.toLowerCase().includes(expr.toLowerCase()) ) : subscriptions, diff --git a/src/features/admin/applicationRequestApiSlice.ts b/src/features/admin/applicationRequestApiSlice.ts index f53e2c2cc..47f4bb304 100644 --- a/src/features/admin/applicationRequestApiSlice.ts +++ b/src/features/admin/applicationRequestApiSlice.ts @@ -197,7 +197,7 @@ export const apiSlice = createApi({ PaginFetchArgs >({ query: (fetchArgs) => { - const isFetchArgs = fetchArgs.args && fetchArgs.args.expr + const isFetchArgs = fetchArgs?.args?.expr if ( isFetchArgs && fetchArgs.args.statusFilter && From 98b94eb712e00c93ebc47792b30b716b278d0b36 Mon Sep 17 00:00:00 2001 From: Martin Rohrmeier Date: Mon, 30 Oct 2023 11:38:35 +0100 Subject: [PATCH 06/13] fix(linter): fix findings (#328) --- .../registrationTableColumns.tsx | 4 +++- .../pages/NotificationCenter/NotificationItem.tsx | 12 +++++++++--- .../components/CommonContractAndConsent.tsx | 4 +++- .../templates/Subscription/SubscriptionElements.tsx | 4 +++- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/components/pages/Admin/components/RegistrationRequests/registrationTableColumns.tsx b/src/components/pages/Admin/components/RegistrationRequests/registrationTableColumns.tsx index c389aeec0..87090991a 100644 --- a/src/components/pages/Admin/components/RegistrationRequests/registrationTableColumns.tsx +++ b/src/components/pages/Admin/components/RegistrationRequests/registrationTableColumns.tsx @@ -83,7 +83,9 @@ export const RegistrationRequestsTableColumns = ( showConfirmOverlay(row.applicationId) } }} - onKeyDown={() => {}} + onKeyDown={() => { + // do nothing + }} > diff --git a/src/components/pages/NotificationCenter/NotificationItem.tsx b/src/components/pages/NotificationCenter/NotificationItem.tsx index 488f0284e..256f6a9f6 100644 --- a/src/components/pages/NotificationCenter/NotificationItem.tsx +++ b/src/components/pages/NotificationCenter/NotificationItem.tsx @@ -293,7 +293,9 @@ export default function NotificationItem({ )}
    • {}} + onKeyDown={() => { + // do nothing + }} style={{ backgroundColor: userRead ? 'rgba(255, 255, 255, 1)' @@ -377,7 +379,9 @@ export default function NotificationItem({ setRead(item.id, !userRead) e.stopPropagation() }} - onKeyDown={() => {}} + onKeyDown={() => { + // do nothing + }} > {userRead ? ( {}} + onKeyDown={() => { + // do nothing + }} >
    diff --git a/src/components/shared/basic/ReleaseProcess/components/CommonContractAndConsent.tsx b/src/components/shared/basic/ReleaseProcess/components/CommonContractAndConsent.tsx index 40489480e..0df60c5f3 100644 --- a/src/components/shared/basic/ReleaseProcess/components/CommonContractAndConsent.tsx +++ b/src/components/shared/basic/ReleaseProcess/components/CommonContractAndConsent.tsx @@ -453,7 +453,9 @@ export default function CommonContractAndConsent({ onClick={() => handleFrameDocumentDownload(item.name, item.documentId) } - onKeyDown={() => {}} + onKeyDown={() => { + // do nothing + }} > {item.name} diff --git a/src/components/shared/templates/Subscription/SubscriptionElements.tsx b/src/components/shared/templates/Subscription/SubscriptionElements.tsx index e2bf50623..ef3fff440 100644 --- a/src/components/shared/templates/Subscription/SubscriptionElements.tsx +++ b/src/components/shared/templates/Subscription/SubscriptionElements.tsx @@ -260,7 +260,9 @@ export default function SubscriptionElements({ subscriptionId: subscription.subscriptionId, }) }} - onKeyDown={() => {}} + onKeyDown={() => { + // do nothing + }} > Date: Mon, 30 Oct 2023 19:47:29 +0530 Subject: [PATCH 07/13] updates(static templates): template updates (#329) --- .../StaticTemplateResponsive/Cards/TextImageCenterAligned.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/shared/templates/StaticTemplateResponsive/Cards/TextImageCenterAligned.tsx b/src/components/shared/templates/StaticTemplateResponsive/Cards/TextImageCenterAligned.tsx index d224c4dc6..ff399e1a0 100644 --- a/src/components/shared/templates/StaticTemplateResponsive/Cards/TextImageCenterAligned.tsx +++ b/src/components/shared/templates/StaticTemplateResponsive/Cards/TextImageCenterAligned.tsx @@ -50,6 +50,9 @@ export default function TextImageCenterAligned({ }} width="100%" /> + {provider?.images?.map((path) => ( + + ))}
    ) } From c896eb0d5a53ae718de90301e40c1f1ec5e4a528 Mon Sep 17 00:00:00 2001 From: Martin Rohrmeier Date: Mon, 30 Oct 2023 18:00:53 +0100 Subject: [PATCH 08/13] feat(osp): enable onboarding service provider prototype (#315) --- CHANGELOG.md | 2 + src/components/overlays/AddIDP/index.tsx | 183 +++--- .../overlays/AddMultipleUser/index.tsx | 7 +- .../overlays/AddUser/AddUserContent.tsx | 6 +- src/components/overlays/InviteForm/index.tsx | 4 +- .../overlays/OSPConsent/OSPConsentContent.tsx | 160 +++++ src/components/overlays/OSPConsent/index.tsx | 123 ++++ src/components/overlays/OSPConsent/style.scss | 12 + .../OSPRegister/OSPRegisterContent.tsx | 573 ++++++++++++++++++ .../overlays/OSPRegister/OSPRegisterNext.tsx | 88 +++ src/components/overlays/OSPRegister/index.tsx | 143 +++++ src/components/overlays/UpdateIDP/index.tsx | 16 +- .../pages/IDPManagement/IDPList.tsx | 213 ++++--- src/components/pages/OSPManagement/index.tsx | 71 +++ src/components/pages/OSPManagement/style.scss | 162 +++++ .../shared/basic/Input/ValidatingInput.tsx | 12 +- src/features/admin/idpApiSlice.ts | 4 +- src/features/admin/networkApiSlice.ts | 171 ++++++ src/features/store.ts | 3 + src/services/AccessService.tsx | 9 + src/types/Config.tsx | 18 + src/types/Constants.ts | 4 + src/types/Patterns.test.ts | 18 - src/types/Patterns.ts | 19 +- 24 files changed, 1818 insertions(+), 203 deletions(-) create mode 100644 src/components/overlays/OSPConsent/OSPConsentContent.tsx create mode 100644 src/components/overlays/OSPConsent/index.tsx create mode 100644 src/components/overlays/OSPConsent/style.scss create mode 100644 src/components/overlays/OSPRegister/OSPRegisterContent.tsx create mode 100644 src/components/overlays/OSPRegister/OSPRegisterNext.tsx create mode 100644 src/components/overlays/OSPRegister/index.tsx create mode 100644 src/components/pages/OSPManagement/index.tsx create mode 100644 src/components/pages/OSPManagement/style.scss create mode 100644 src/features/admin/networkApiSlice.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 03d8ec34d..7d22ed574 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,8 @@ - Fixed image display in app overview cards - IDP - Add load element for IDP list +- Onboarding Serviceprovider + - Add the OSP prototype - Linter Findings - Fix ban-types - No empty function diff --git a/src/components/overlays/AddIDP/index.tsx b/src/components/overlays/AddIDP/index.tsx index 972d67e4a..3db79039d 100644 --- a/src/components/overlays/AddIDP/index.tsx +++ b/src/components/overlays/AddIDP/index.tsx @@ -26,7 +26,6 @@ import { DialogHeader, LoadingButton, Radio, - SelectList, Stepper, Tooltips, Typography, @@ -55,44 +54,59 @@ enum IDPType { SHARED = 'Shared', } -export type IdentityProviderType = { - title: string - value: string -} - -const IdentityProviderTypeData = [ - { - title: 'own - create an IdP connection to your company IdP for yourself', - value: 'OWN', - }, - { - title: 'managed - create an managed IdP connection for a third party', - value: 'MANAGED', - }, -] - const SelectIdpProviderType = ({ onChange, + providerType = IDPProviderType.OWN, }: { + providerType?: IDPProviderType onChange: (value: IDPProviderType) => void }) => { const { t } = useTranslation('idp') + const [type, setType] = useState(providerType) + return ( -
    +
    {t('field.providerType.name')} + + +
    + } + />
    - { - onChange(e?.value) + { + setType(IDPProviderType.OWN) + onChange(IDPProviderType.OWN) }} - keyTitle={'title'} + value={IDPProviderType.OWN} + inputProps={{ 'aria-label': IDPProviderType.OWN }} + /> + { + setType(IDPProviderType.MANAGED) + onChange(IDPProviderType.MANAGED) + }} + value={IDPProviderType.MANAGED} + inputProps={{ 'aria-label': IDPProviderType.MANAGED }} />
    ) @@ -107,7 +121,9 @@ const SelectIdpAuthType = ({ const [type, setType] = useState(IDPAuthType.OIDC) return ( -
    +
    {t('field.type.name')} @@ -126,21 +142,19 @@ const SelectIdpAuthType = ({ } />
    -
    - { - setType(IDPAuthType.OIDC) - onChange(IDPAuthType.OIDC) - }} - value={IDPAuthType.OIDC} - inputProps={{ 'aria-label': IDPAuthType.OIDC }} - /> -
    { + setType(IDPAuthType.OIDC) + onChange(IDPAuthType.OIDC) + }} + value={IDPAuthType.OIDC} + inputProps={{ 'aria-label': IDPAuthType.OIDC }} + /> + void }) => { const { t } = useTranslation('idp') - const [formData, setFormData] = useState( - initialAddIDPPrepareForm - ) + const [formData, setFormData] = useState({ + type: IDPType.COMPANY, + providerType, + authType: IDPAuthType.OIDC, + name: '', + }) return ( <> @@ -194,32 +206,53 @@ const AddIDPPrepareForm = ({ onChange(currentData) }} /> - { - const currentData = { ...formData } - currentData.providerType = value - setFormData(currentData) - onChange(currentData) - }} - /> - { - const currentData = { ...formData } - currentData.authType = value - setFormData(currentData) - onChange(currentData) +
    + > + { + const currentData = { + ...formData, + providerType: value, + } + setFormData(currentData) + onChange(currentData) + console.log(currentData) + }} + /> + { + const currentData = { + ...formData, + authType: value, + } + setFormData(currentData) + onChange(currentData) + console.log(currentData) + }} + /> +
    ) } -export const AddIdp = () => { +export const AddIdp = ({ + providerType = IDPProviderType.OWN, +}: { + providerType?: IDPProviderType +}) => { const { t } = useTranslation('idp') const dispatch = useDispatch() - const [formData, setFormData] = useState( - initialAddIDPPrepareForm - ) + const [formData, setFormData] = useState({ + type: IDPType.COMPANY, + providerType, + authType: IDPAuthType.OIDC, + name: '', + }) const [loading, setLoading] = useState(false) const [addIdp] = useAddIDPMutation() const [updateIdp] = useUpdateIDPMutation() @@ -284,11 +317,7 @@ export const AddIdp = () => { {t('add.desc')} - { - setFormData(data) - }} - /> + { ) : ( + {loading ? ( + { + // do nothing + }} + sx={{ marginLeft: '10px' }} + /> + ) : ( + + )} + + + ) +} diff --git a/src/components/overlays/OSPConsent/style.scss b/src/components/overlays/OSPConsent/style.scss new file mode 100644 index 000000000..5e27137f7 --- /dev/null +++ b/src/components/overlays/OSPConsent/style.scss @@ -0,0 +1,12 @@ +ul.roles { + list-style-type: none; + padding-inline-start: 0; +} + +ul.roles > li { + margin: 20px 0; +} + +ul.agreements { + list-style-type: none; +} diff --git a/src/components/overlays/OSPRegister/OSPRegisterContent.tsx b/src/components/overlays/OSPRegister/OSPRegisterContent.tsx new file mode 100644 index 000000000..ca5095610 --- /dev/null +++ b/src/components/overlays/OSPRegister/OSPRegisterContent.tsx @@ -0,0 +1,573 @@ +/******************************************************************************** + * Copyright (c) 2021, 2023 BMW Group AG + * Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +import { type CSSProperties, useState } from 'react' +import { type IdentityProvider } from 'features/admin/idpApiSlice' +import { + isBPN, + isCityName, + isCompanyName, + isCountryCode, + isFirstName, + isID, + isLastName, + isMail, + isName, + isRegionName, + isStreetName, + isStreetNumber, + isUserName, + isZipCode, +} from 'types/Patterns' +import { useTranslation } from 'react-i18next' +import ValidatingInput from 'components/shared/basic/Input/ValidatingInput' +import { + Checkbox, + SelectList, + Typography, +} from '@catena-x/portal-shared-components' +import { + type PartnerRegistration, + type CompanyRoleAgreementData, + type CompanyRole, + UNIQUE_ID_TYPE, + emptyPartnerRegistration, +} from 'features/admin/networkApiSlice' + +const emptyData: PartnerRegistration = { + externalId: '', + name: '', + bpn: '', + streetName: '', + streetNumber: '', + city: '', + zipCode: '', + region: '', + countryAlpha2Code: '', + uniqueIds: [], + userDetails: [ + { + identityProviderId: '', + providerId: '', + username: '', + firstName: '', + lastName: '', + email: '', + }, + ], + companyRoles: [], +} + +type ItemType = { id: string } + +const uniqeIdItems: Array = Object.keys(UNIQUE_ID_TYPE).map( + (item) => ({ + id: item, + }) +) + +const OSPRegisterForm = ({ + idp, + companyRoleAgreementData, + onChange, +}: { + idp: IdentityProvider + companyRoleAgreementData: CompanyRoleAgreementData + onChange: (partnerRegistration: PartnerRegistration | undefined) => boolean +}) => { + const { t } = useTranslation('osp') + + const [data, setData] = useState(emptyData) + + const updateData = (newData: PartnerRegistration | undefined) => { + if (newData) setData(newData) + onChange(newData) + } + + const invalidate = () => { + updateData(undefined) + } + + const inputStyle: CSSProperties = { width: 260 } + + const inputs: Record = { + extid: ( + { + updateData({ + ...data, + externalId: value, + }) + }} + /> + ), + company: ( + { + updateData({ + ...data, + name: value, + }) + }} + /> + ), + bpn: ( + { + updateData({ + ...data, + bpn: value, + }) + }} + /> + ), + country: ( + { + updateData({ + ...data, + countryAlpha2Code: value, + }) + }} + /> + ), + region: ( + { + updateData({ + ...data, + region: value, + }) + }} + /> + ), + city: ( + { + updateData({ + ...data, + city: value, + }) + }} + /> + ), + zipcode: ( + { + updateData({ + ...data, + zipCode: value, + }) + }} + /> + ), + + streetName: ( + { + updateData({ + ...data, + streetName: value, + }) + }} + /> + ), + streetNumber: ( + { + updateData({ + ...data, + streetNumber: value, + }) + }} + /> + ), + identityProviderId: ( + { + updateData({ + ...data, + userDetails: [ + { + ...data.userDetails[0], + identityProviderId: value, + }, + ], + }) + }} + /> + ), + providerId: ( + { + updateData({ + ...data, + userDetails: [ + { + ...data.userDetails[0], + providerId: value, + }, + ], + }) + }} + /> + ), + + username: ( + { + updateData({ + ...data, + userDetails: [ + { + ...data.userDetails[0], + username: value, + }, + ], + }) + }} + /> + ), + firstName: ( + { + updateData({ + ...data, + userDetails: [ + { + ...data.userDetails[0], + firstName: value, + }, + ], + }) + }} + /> + ), + lastName: ( + { + updateData({ + ...data, + userDetails: [ + { + ...data.userDetails[0], + lastName: value, + }, + ], + }) + }} + /> + ), + email: ( + { + updateData({ + ...data, + userDetails: [ + { + ...data.userDetails[0], + email: value, + }, + ], + }) + }} + /> + ), + uniqueId: ( +
    + , + { + updateData({ + ...data, + uniqueIds: [ + { + ...data.uniqueIds[0], + type: value.id as UNIQUE_ID_TYPE, + }, + ], + }) + }, + }} + /> +
    + ), + uniqeIdValue: ( + { + updateData({ + ...data, + uniqueIds: [ + { + ...data.uniqueIds[0], + value, + }, + ], + }) + }} + /> + ), + companyRoles: ( +
    +
    + + {t('field.companyRoles.name')} + +
    + {companyRoleAgreementData.companyRoles.map((role: CompanyRole) => ( + { + const useRole = e.target.checked + const companyRoles = [...data.companyRoles] + if (useRole) { + companyRoles.push(role.companyRole) + companyRoles.sort((a, b) => a.localeCompare(b)) + } else { + const index = companyRoles.indexOf(role.companyRole) + if (index > -1) { + companyRoles.splice(index, 1) + } + } + updateData({ + ...data, + companyRoles, + }) + }} + /> + ))} +
    + ), + } + + const rowStyle: CSSProperties = { + display: 'flex', + flexDirection: 'row', + justifyContent: 'space-between', + width: 864, + } + + return ( + <> +
    + {inputs.company} + {inputs.extid} + {inputs.bpn} +
    +
    + {inputs.country} + {inputs.region} + {inputs.zipcode} +
    +
    + {inputs.city} + {inputs.streetName} + {inputs.streetNumber} +
    +
    + {inputs.uniqueId} + {inputs.uniqeIdValue} +
    +
    + {inputs.identityProviderId} + {inputs.providerId} + {inputs.username} +
    +
    + {inputs.firstName} + {inputs.lastName} + {inputs.email} +
    +
    {inputs.companyRoles}
    + + ) +} + +export const OSPRegisterContent = ({ + idp, + companyRoleAgreementData, + onValid, +}: { + idp: IdentityProvider + companyRoleAgreementData: CompanyRoleAgreementData + onValid: (form: PartnerRegistration | undefined) => void +}) => { + const initialData: PartnerRegistration = { + ...emptyPartnerRegistration, + userDetails: [ + { + ...emptyPartnerRegistration.userDetails[0], + identityProviderId: idp.identityProviderId, + }, + ], + } + const [formData, setFormData] = useState( + JSON.stringify(initialData, null, 2) + ) + const [debug, setDebug] = useState(false) + const toggleDebug = () => { + setDebug(!debug) + } + + const doCheckForm = ( + partnerRegistration: PartnerRegistration | undefined + ) => { + const valid = + partnerRegistration?.name !== undefined && + partnerRegistration?.externalId !== undefined && + partnerRegistration.companyRoles.length > 0 && + partnerRegistration?.uniqueIds.length > 0 && + partnerRegistration?.uniqueIds[0].value !== undefined + onValid(valid ? partnerRegistration : undefined) + setFormData( + valid ? JSON.stringify(partnerRegistration, null, 2) : '# data invalid' + ) + return !!valid + } + + return ( + <> + +
    +        {debug ? formData : '{...}'}
    +      
    + , + + ) +} diff --git a/src/components/overlays/OSPRegister/OSPRegisterNext.tsx b/src/components/overlays/OSPRegister/OSPRegisterNext.tsx new file mode 100644 index 000000000..5069b5749 --- /dev/null +++ b/src/components/overlays/OSPRegister/OSPRegisterNext.tsx @@ -0,0 +1,88 @@ +/******************************************************************************** + * Copyright (c) 2021, 2023 BMW Group AG + * Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +import { Trans, useTranslation } from 'react-i18next' +import { + Button, + DialogActions, + DialogContent, + DialogHeader, + Stepper, + Typography, +} from '@catena-x/portal-shared-components' +import { closeOverlay } from 'features/control/overlay' +import { useDispatch } from 'react-redux' + +export const OSPRegisterNext = ({ id }: { id: string }) => { + const { t } = useTranslation('osp') + const dispatch = useDispatch() + + const steps = [ + { + step: 1, + headline: t('steps.one.title'), + text: t('steps.one.text'), + }, + { + step: 2, + headline: t('steps.two.title'), + text: t('steps.two.text'), + }, + { + step: 3, + headline: t('steps.three.title'), + text: t('steps.three.text'), + }, + { + step: 4, + headline: t('steps.four.title'), + }, + ] + + return ( + <> + dispatch(closeOverlay())} + /> + +
    + +
    +
    + + {t('register.next.desc')} + +
    + {t('register.next.heading')} + + Registration for IDP {id} successful. Next steps... + +
    + + + + + ) +} diff --git a/src/components/overlays/OSPRegister/index.tsx b/src/components/overlays/OSPRegister/index.tsx new file mode 100644 index 000000000..8009ec3af --- /dev/null +++ b/src/components/overlays/OSPRegister/index.tsx @@ -0,0 +1,143 @@ +/******************************************************************************** + * Copyright (c) 2021, 2023 BMW Group AG + * Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +import { Trans, useTranslation } from 'react-i18next' +import { + Button, + DialogActions, + DialogContent, + DialogHeader, + LoadingButton, + Stepper, + Typography, +} from '@catena-x/portal-shared-components' +import { useDispatch } from 'react-redux' +import { closeOverlay } from 'features/control/overlay' +import { useState } from 'react' +import { useFetchIDPDetailQuery } from 'features/admin/idpApiSlice' +import { OSPRegisterContent } from './OSPRegisterContent' +import { error, success } from 'services/NotifyService' +import { + useRegisterPartnerMutation, + type PartnerRegistration, + useFetchCompanyRoleAgreementDataQuery, +} from 'features/admin/networkApiSlice' + +export const OSPRegister = ({ id }: { id: string }) => { + const { t } = useTranslation('osp') + const dispatch = useDispatch() + const { data } = useFetchIDPDetailQuery(id) + const companyRoleAgreementData = useFetchCompanyRoleAgreementDataQuery().data + console.log(companyRoleAgreementData) + + const [registerPartner] = useRegisterPartnerMutation() + + const [registerData, setRegisterData] = useState< + PartnerRegistration | undefined + >(undefined) + const [loading, setLoading] = useState(false) + + const doRegister = async () => { + if (!(data && registerData)) return + setLoading(true) + try { + await registerPartner(registerData).unwrap() + dispatch(closeOverlay()) + success(t('register.success')) + } catch (err) { + error(t('register.error'), '', err as object) + } + setLoading(false) + } + + const steps = [ + { + headline: t('add.stepLists.firstStep'), + step: 1, + text: t('edit.created'), + }, + { + headline: t('add.stepLists.secondStep'), + step: 2, + text: t('edit.created'), + }, + { + headline: t('add.stepLists.thirdStep'), + step: 3, + }, + ] + + return ( + <> + dispatch(closeOverlay())} + /> + +
    + +
    +
    + + {t('register.desc')} + +
    + {t('register.addDataHeading')} + {data && companyRoleAgreementData && ( + + )} +
    + + + {loading ? ( + { + // do nothing + }} + sx={{ marginLeft: '10px' }} + /> + ) : ( + + )} + + + ) +} diff --git a/src/components/overlays/UpdateIDP/index.tsx b/src/components/overlays/UpdateIDP/index.tsx index b897de149..6a1945778 100644 --- a/src/components/overlays/UpdateIDP/index.tsx +++ b/src/components/overlays/UpdateIDP/index.tsx @@ -36,6 +36,8 @@ import { type IdentityProviderUpdate, useFetchIDPDetailQuery, useUpdateIDPMutation, + useEnableIDPMutation, + IDPCategory, } from 'features/admin/idpApiSlice' import { UpdateIDPContent } from './UpdateIDPContent' import { OVERLAYS } from 'types/Constants' @@ -46,18 +48,30 @@ export const UpdateIDP = ({ id }: { id: string }) => { const dispatch = useDispatch() const { data } = useFetchIDPDetailQuery(id) const [updateIdp] = useUpdateIDPMutation() + const [enableIdp] = useEnableIDPMutation() const [idpUpdateData, setIdpUpdateData] = useState< IdentityProviderUpdate | undefined >(undefined) const [loading, setLoading] = useState(false) + console.log(data) + const doUpdateIDP = async () => { if (!(data && idpUpdateData)) return setLoading(true) try { await updateIdp(idpUpdateData).unwrap() - dispatch(show(OVERLAYS.ENABLE_IDP, id)) success(t('edit.success')) + if (data.identityProviderTypeId === IDPCategory.MANAGED) { + await enableIdp({ + id, + enabled: true, + }).unwrap() + success(t('enable.success')) + dispatch(show(OVERLAYS.REGISTER_OSP, id)) + } else { + dispatch(show(OVERLAYS.ENABLE_IDP, id)) + } } catch (err) { error(t('edit.error'), '', err as object) } diff --git a/src/components/pages/IDPManagement/IDPList.tsx b/src/components/pages/IDPManagement/IDPList.tsx index 106318db4..8bd978ee9 100644 --- a/src/components/pages/IDPManagement/IDPList.tsx +++ b/src/components/pages/IDPManagement/IDPList.tsx @@ -39,10 +39,45 @@ import { useEnableIDPMutation, useFetchIDPListQuery, useRemoveIDPMutation, + IDPCategory, } from 'features/admin/idpApiSlice' -export const IDPList = () => { +const MenuItemOpenOverlay = ({ + overlay, + id, + label, +}: { + overlay: OVERLAYS + id: string + label: string +}) => { const dispatch = useDispatch() + + const openOverlay = async ( + e: React.MouseEvent, + overlay: OVERLAYS, + id: string + ) => { + try { + e.stopPropagation() + dispatch(show(overlay, id)) + } catch (error) { + console.log(error) + } + } + + return ( + ) => + openOverlay(e, overlay, id) + } + > + {label} + + ) +} + +export const IDPList = () => { const { t } = useTranslation() const ti = useTranslation('idp').t @@ -53,36 +88,12 @@ export const IDPList = () => { const idpsData = data ?.slice() .sort((a: IdentityProvider, b: IdentityProvider) => - a?.alias?.localeCompare(b.alias) + (a?.displayName ?? '').localeCompare(b.displayName ?? '') ) const [removeIDP] = useRemoveIDPMutation() const [enableIDP] = useEnableIDPMutation() - const doAddUsers = async ( - e: React.MouseEvent, - idp: IdentityProvider - ) => { - try { - e.stopPropagation() - dispatch(show(OVERLAYS.ADDUSERS_IDP, idp.identityProviderId)) - } catch (error) { - console.log(error) - } - } - - const doConfigure = async ( - e: React.MouseEvent, - idp: IdentityProvider - ) => { - try { - e.stopPropagation() - dispatch(show(OVERLAYS.UPDATE_IDP, idp.identityProviderId)) - } catch (error) { - console.log(error) - } - } - - const doConfirmDelete = async ( + const doDelete = async ( e: React.MouseEvent, idp: IdentityProvider ) => { @@ -127,71 +138,101 @@ export const IDPList = () => { } const renderMenu = (idp: IdentityProvider) => { - return ( -
    - - ) => - doConfigure(e, idp) - } - > - {ti('action.configure')} - - {idp.oidc?.clientId && ( - ) => - !disableLoading && doEnableDisableToggle(e, idp) - } + const menuItems = { + configure: ( + + ), + addUsers: ( + + ), + delete: ( + ) => + !deleteLoading && doDelete(e, idp) + } + sx={{ + color: deleteLoading ? '#b6b6b6' : '#111111', + }} + disabled={idp.enabled} + > + {ti('action.delete')} + {deleteLoading && ( + idp.enabled) - .length < 2 - } - > - {idp.enabled ? ti('action.disable') : ti('action.enable')} - {disableLoading && ( - - )} - + /> )} - {idp.enabled ? ( - ) => - doAddUsers(e, idp) - } - > - {ti('action.users')} - - ) : ( - ) => - !deleteLoading && doConfirmDelete(e, idp) - } + + ), + register: ( + + ), + registerNext: ( + + ), + consent: ( + + ), + enableToggle: ( + ) => + !disableLoading && doEnableDisableToggle(e, idp) + } + sx={{ + color: disableLoading ? '#b6b6b6' : '#111111', + }} + disabled={ + data && + idp.enabled && + data?.filter((idp: IdentityProvider) => idp.enabled).length < 2 + } + > + {idp.enabled ? ti('action.disable') : ti('action.enable')} + {disableLoading && ( + - {ti('action.delete')} - {deleteLoading && ( - - )} - + /> )} + + ), + } + + const isManaged = idp.identityProviderTypeId === IDPCategory.MANAGED + + return ( +
    + + {menuItems.configure} + {isManaged && idp.enabled && menuItems.register} + {isManaged && idp.enabled && menuItems.registerNext} + {isManaged && idp.enabled && menuItems.consent} + {!isManaged && idp.oidc?.clientId && menuItems.enableToggle} + {!isManaged && (idp.enabled ? menuItems.addUsers : menuItems.delete)}
    ) diff --git a/src/components/pages/OSPManagement/index.tsx b/src/components/pages/OSPManagement/index.tsx new file mode 100644 index 000000000..a88c0f741 --- /dev/null +++ b/src/components/pages/OSPManagement/index.tsx @@ -0,0 +1,71 @@ +/******************************************************************************** + * Copyright (c) 2021, 2023 BMW Group AG + * Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +import AddCircleOutlineIcon from '@mui/icons-material/AddCircleOutline' +import { OVERLAYS } from 'types/Constants' +import { Button, Image, Typography } from '@catena-x/portal-shared-components' +import { Trans, useTranslation } from 'react-i18next' +import { useDispatch } from 'react-redux' +import { show } from 'features/control/overlay' +import './style.scss' +import { getAssetBase } from 'services/EnvironmentService' +import { IDPList } from '../IDPManagement/IDPList' + +export default function OSPManagement() { + const { t } = useTranslation('osp') + const dispatch = useDispatch() + + return ( +
    +
    +
    + + + {t('onboarding.title')} + + + + + {t('onboarding.desc')} + + + {t('onboarding.title')} +
    + +
    +
    +
    + +
    +
    +
    + ) +} diff --git a/src/components/pages/OSPManagement/style.scss b/src/components/pages/OSPManagement/style.scss new file mode 100644 index 000000000..7424b1026 --- /dev/null +++ b/src/components/pages/OSPManagement/style.scss @@ -0,0 +1,162 @@ +/******************************************************************************** + * Copyright (c) 2021, 2023 BMW Group AG + * Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +.idp-management-header { + text-align: center; + width: 100%; + margin: 0 auto; + .idp-management-title { + text-align: center; + padding-bottom: 20px; + position: relative; + } + .idp-management-title::after { + content: ''; + width: 70px; + border-bottom: 2px solid; + position: absolute; + bottom: 0; + left: 50%; + transform: translateX(-50%); + } + .idp-management-desc { + width: 74%; + margin: 50px auto; + } + img { + border-radius: 10px; + } + .add-idp-btn { + margin-top: 30px; + text-transform: capitalize; + } +} + +.idp-list { + list-style-type: none; + margin-block-start: 0; + margin-block-end: 0; + padding-inline-start: 0; + + .idp-list-item { + border: 1px solid #eeeeee; + border-radius: 5px; + background-color: #fcfcfc; + padding: 8px 30px; + margin-bottom: 12px; + font-weight: bold; + white-space: nowrap; + display: flex; + flex-direction: row; + + &:hover { + background-color: #f4f4f4; + } + + .category, + .name, + .alias, + .action { + display: inline-block; + margin: 16px 0; + } + + .state { + display: inline-block; + margin: 6px 0; + } + + .action.buttons { + margin: 10px 0; + } + + .action.menu { + margin: 0; + } + + .category { + color: #888; + width: 280px; + font-weight: normal; + } + + .name { + width: 300px; + } + + .alias { + color: #888; + width: 280px; + font-weight: normal; + } + + .action { + margin-left: 0px; + width: 220px; + display: flex; + flex-direction: row; + justify-content: flex-end; + + button { + margin-left: 10px; + } + } + } + + .content { + padding: 8px 16px 16px; + border: 1px solid #ccc; + margin-top: 0px; + margin-bottom: 20px; + border-radius: 10px; + } +} + +.progress-section { + display: flex; + .number { + color: white; + border-radius: 50%; + text-align: center; + margin-right: 5px; + width: 30px; + height: 30px; + display: flex; + align-items: center; + justify-content: center; + svg { + font-size: 20px; + } + } +} + +.action-menu { + button { + box-shadow: none; + font-size: 12px; + padding: 8px !important; + &:hover { + box-shadow: none; + } + &:focus { + box-shadow: none; + } + } +} diff --git a/src/components/shared/basic/Input/ValidatingInput.tsx b/src/components/shared/basic/Input/ValidatingInput.tsx index d6940f25e..dea677ae9 100644 --- a/src/components/shared/basic/Input/ValidatingInput.tsx +++ b/src/components/shared/basic/Input/ValidatingInput.tsx @@ -31,6 +31,7 @@ export type ValidatingInputProps = BasicInputProps & { debounceTime?: number validate?: (expr: string) => boolean onValid?: (name: string, value: string) => void + onInvalid?: (name: string, value: string) => void } const ValidatingInput = ({ @@ -46,16 +47,19 @@ const ValidatingInput = ({ debounceTime = 250, validate, onValid, + onInvalid, }: ValidatingInputProps) => { const [color, setColor] = useState(Colors.secondary) + const [currentValue, setCurrentValue] = useState(value) const immediateValidate = useCallback( (expr: string) => { const isValid = validate ? validate(expr) : true setColor(isValid ? Colors.success : Colors.error) - isValid && onValid && onValid(name, expr) + if (isValid && onValid) onValid(name, expr) + else if (!isValid && onInvalid) onInvalid(name, expr) }, - [name, onValid, validate] + [name, onValid, onInvalid, validate] ) const debouncedValidate = useMemo( @@ -65,6 +69,10 @@ const ValidatingInput = ({ const doValidate = useCallback( (expr: string) => { + if (expr === currentValue) { + return + } + setCurrentValue(expr) if (debounceTime === 0) immediateValidate(expr) else debouncedValidate(expr) }, diff --git a/src/features/admin/idpApiSlice.ts b/src/features/admin/idpApiSlice.ts index cc000841e..a2112d39a 100644 --- a/src/features/admin/idpApiSlice.ts +++ b/src/features/admin/idpApiSlice.ts @@ -24,6 +24,7 @@ import { apiBaseQuery } from 'utils/rtkUtil' export enum IDPCategory { SHARED = 'SHARED', OWN = 'OWN', + MANAGED = 'MANAGED', } export enum IDPProviderType { @@ -134,10 +135,9 @@ export interface UserIdentityProviders { } export interface IdentityProvider { - identityProviderTypeId: string identityProviderId: string alias: string - ProviderTypeId: IDPCategory + identityProviderTypeId: IDPCategory displayName?: string redirectUrl: string enabled: boolean diff --git a/src/features/admin/networkApiSlice.ts b/src/features/admin/networkApiSlice.ts new file mode 100644 index 000000000..bfa3448aa --- /dev/null +++ b/src/features/admin/networkApiSlice.ts @@ -0,0 +1,171 @@ +/******************************************************************************** + * Copyright (c) 2021, 2023 BMW Group AG + * Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react' +import { apiBaseQuery } from 'utils/rtkUtil' + +export enum COMPANY_ROLE { + ACTIVE_PARTICIPANT = 'ACTIVE_PARTICIPANT', + APP_PROVIDER = 'APP_PROVIDER', + SERVICE_PROVIDER = 'SERVICE_PROVIDER', +} + +export enum UNIQUE_ID_TYPE { + COMMERCIAL_REG_NUMBER = 'COMMERCIAL_REG_NUMBER', + VAT_ID = 'VAT_ID', + LEI_CODE = 'LEI_CODE', + VIES = 'VIES', + EORI = 'EORI', +} + +export enum CONSENT_STATUS { + ACTIVE = 'ACTIVE', + INACTIVE = 'INACTIVE', +} + +export type PartnerRegistrationUniqeId = { + type: UNIQUE_ID_TYPE + value: string +} + +export type PartnerRegistrationUser = { + identityProviderId: string + providerId: string + username: string + firstName: string + lastName: string + email: string +} + +export type PartnerRegistration = { + externalId: string + bpn: string + name: string + streetName: string + streetNumber: string + city: string + zipCode: string + region: string + countryAlpha2Code: string + uniqueIds: Array + userDetails: Array + companyRoles: Array +} + +export type Agreement = { + agreementId: string + name: string + agreementLink: string + documentId: string +} + +export type AgreementConsent = { + agreementId: string + consentStatus?: CONSENT_STATUS.ACTIVE +} + +export type PartnerRegistrationConsent = { + companyRoles: Array + agreements: Array +} + +export type CompanyRoleDescriptions = Record + +export type CompanyRole = { + companyRole: COMPANY_ROLE + descriptions: CompanyRoleDescriptions + agreementIds: Array +} + +export type CompanyRoleAgreementData = { + companyRoles: Array + agreements: Array +} + +export const emptyPartnerRegistration: PartnerRegistration = { + externalId: '', + name: '', + bpn: '', + streetName: '', + streetNumber: '', + city: '', + zipCode: '', + region: '', + countryAlpha2Code: '', + uniqueIds: [], + userDetails: [ + { + identityProviderId: '', + providerId: '', + username: '', + firstName: '', + lastName: '', + email: '', + }, + ], + companyRoles: [], +} + +export const emptyPartnerRegistrationConsent: PartnerRegistrationConsent = { + companyRoles: [], + agreements: [], +} + +enum TAGS { + PARTNER_REGISTRATION = 'PARTNER_REGISTRATION', + REGISTRATION = 'REGISTRATION', +} + +export const apiSlice = createApi({ + reducerPath: 'rtk/admin/network', + baseQuery: fetchBaseQuery(apiBaseQuery()), + tagTypes: [TAGS.PARTNER_REGISTRATION, TAGS.REGISTRATION], + endpoints: (builder) => ({ + registerPartner: builder.mutation({ + query: (data: PartnerRegistration) => ({ + url: '/api/administration/registration/Network/partnerRegistration', + method: 'POST', + body: data, + }), + invalidatesTags: [TAGS.PARTNER_REGISTRATION], + }), + fetchCompanyRoleAgreementData: builder.query< + CompanyRoleAgreementData, + void + >({ + query: () => '/api/registration/companyRoleAgreementData', + providesTags: [TAGS.REGISTRATION], + }), + registerPartnerConsent: builder.mutation({ + query: (data: PartnerRegistrationConsent) => ({ + url: '/api/registration/Network/partnerRegistration/submit', + method: 'POST', + body: data, + }), + invalidatesTags: [TAGS.REGISTRATION], + }), + }), +}) + +export const { + useRegisterPartnerMutation, + useFetchCompanyRoleAgreementDataQuery, + useRegisterPartnerConsentMutation, +} = apiSlice diff --git a/src/features/store.ts b/src/features/store.ts index 354f8ae85..78f5f0b3d 100644 --- a/src/features/store.ts +++ b/src/features/store.ts @@ -52,6 +52,7 @@ import { apiSlice as serviceProviderApiSlice } from './serviceProvider/servicePr import { apiSlice as appSubscriptionApiSlice } from './appSubscription/appSubscriptionApiSlice' import { apiSlice as adminBoardApiSlice } from './adminBoard/adminBoardApiSlice' import { apiSlice as inviteApiSlice } from './admin/inviteApiSlice' +import { apiSlice as networkApiSlice } from './admin/networkApiSlice' import { apiSlice as applicationRequestApiSlice } from './admin/applicationRequestApiSlice' import { apiSlice as partnerNetworkApiSlice } from './newPartnerNetwork/partnerNetworkApiSlice' import { apiSlice as partnerNetworkPortalApiSlice } from './newPartnerNetwork/partnerNetworkPortalApiSlice' @@ -102,6 +103,7 @@ export const reducers = { [appSubscriptionApiSlice.reducerPath]: appSubscriptionApiSlice.reducer, [adminBoardApiSlice.reducerPath]: adminBoardApiSlice.reducer, [inviteApiSlice.reducerPath]: inviteApiSlice.reducer, + [networkApiSlice.reducerPath]: networkApiSlice.reducer, [applicationRequestApiSlice.reducerPath]: applicationRequestApiSlice.reducer, [partnerNetworkApiSlice.reducerPath]: partnerNetworkApiSlice.reducer, [partnerNetworkPortalApiSlice.reducerPath]: @@ -134,6 +136,7 @@ export const store = configureStore({ .concat(appSubscriptionApiSlice.middleware) .concat(adminBoardApiSlice.middleware) .concat(inviteApiSlice.middleware) + .concat(networkApiSlice.middleware) .concat(applicationRequestApiSlice.middleware) .concat(partnerNetworkApiSlice.middleware) .concat(partnerNetworkPortalApiSlice.middleware) diff --git a/src/services/AccessService.tsx b/src/services/AccessService.tsx index a4a144b11..a133a9ccd 100644 --- a/src/services/AccessService.tsx +++ b/src/services/AccessService.tsx @@ -67,6 +67,9 @@ import UpdateCompanyRole from 'components/overlays/UpdateCompanyRole' import EditUsecase from 'components/overlays/EditUsecase' import UpdateCertificate from 'components/overlays/UpdateCertificate' import AddMultipleUser from 'components/overlays/AddMultipleUser' +import { OSPRegister } from 'components/overlays/OSPRegister' +import { OSPConsent } from 'components/overlays/OSPConsent' +import { OSPRegisterNext } from 'components/overlays/OSPRegister/OSPRegisterNext' let pageMap: { [page: string]: IPage } let actionMap: { [action: string]: IAction } @@ -173,6 +176,12 @@ export const getOverlay = (overlay: OverlayState) => { return case OVERLAYS.IDP_TEST_RUN: return + case OVERLAYS.REGISTER_OSP: + return + case OVERLAYS.REGISTER_NEXT_OSP: + return + case OVERLAYS.CONSENT_OSP: + return case OVERLAYS.APP_OVERVIEW_CONFIRM: return case OVERLAYS.APP_DETAILS_OVERLAY: diff --git a/src/types/Config.tsx b/src/types/Config.tsx index 315eb6213..81d8b8250 100644 --- a/src/types/Config.tsx +++ b/src/types/Config.tsx @@ -81,6 +81,7 @@ import AdminCredential from 'components/pages/AdminCredential' import AddRoles from 'components/pages/AppOverview/AddRoles' import ServiceDeactivate from 'components/pages/ServiceReleaseProcess/components/ServiceDeactivate' import ChangeDocuments from 'components/pages/AppOverview/ChangeDocuments' +import OSPManagement from 'components/pages/OSPManagement' /** * ALL_PAGES @@ -526,6 +527,11 @@ export const ALL_PAGES: IPage[] = [ role: ROLES.DECISION_SSICREDENTIAL, element: , }, + { + name: PAGES.ONBOARDING_SERVICEPROVIDER, + role: ROLES.IDP_VIEW, + element: , + }, ] export const ALL_OVERLAYS: IOverlay[] = [ @@ -631,6 +637,18 @@ export const ALL_OVERLAYS: IOverlay[] = [ name: OVERLAYS.IDP_TEST_RUN, role: ROLES.IDP_ADD, }, + { + name: OVERLAYS.REGISTER_OSP, + role: ROLES.IDP_SETUP, + }, + { + name: OVERLAYS.REGISTER_NEXT_OSP, + role: ROLES.IDP_SETUP, + }, + { + name: OVERLAYS.CONSENT_OSP, + role: ROLES.IDP_SETUP, + }, { name: OVERLAYS.APP_OVERVIEW_CONFIRM, role: ROLES.APPOVERVIEW_VIEW, diff --git a/src/types/Constants.ts b/src/types/Constants.ts index 4f832e583..35fd9ae5f 100644 --- a/src/types/Constants.ts +++ b/src/types/Constants.ts @@ -100,6 +100,7 @@ export enum PAGES { CERTIFICATE_CREDENTIAL = 'certificate-credential', DATA_SPACE = 'dataspace', ADMIN_CREDENTIAL = 'admin-credential', + ONBOARDING_SERVICEPROVIDER = 'onboarding-serviceprovider', } export enum OVERLAYS { @@ -133,6 +134,9 @@ export enum OVERLAYS { IDP_STATUS = 'idp_status', IDP_TEST_RUN = 'idp_test_run', ENABLE_IDP_SUCCESS = 'enable_idp_success', + REGISTER_OSP = 'register_osp', + REGISTER_NEXT_OSP = 'register_next_osp', + CONSENT_OSP = 'consent_osp', APP_OVERVIEW_CONFIRM = 'app_overview_confirm', APP_DETAILS_OVERLAY = 'app_details_overlay', CONFIRM_USER_ACTION = 'confirm_user_action', diff --git a/src/types/Patterns.test.ts b/src/types/Patterns.test.ts index e1da17ee7..55dd1fa98 100644 --- a/src/types/Patterns.test.ts +++ b/src/types/Patterns.test.ts @@ -28,7 +28,6 @@ import { isCName, isCountryCode, isFirstName, - isLastName, isClientID, } from './Patterns' @@ -175,15 +174,6 @@ const TESTDATA = { ' Julia Sophie ', ], }, - LASTNAME: { - valid: ['Julia Sophie', 'Julia-Sophie', 'Chloé', 'Paŭlo'], - invalid: [ - 'Julia Sophie', - 'Julia–Sophie', - 'Julia Sophie ', - ' Julia Sophie ', - ], - }, CLIENTID: { valid: ['sa-12', 'JSSS', 'Julia12'], invalid: ['&^%#@', '!', 'hash &*^#$'], @@ -270,14 +260,6 @@ describe('Input Pattern Tests', () => { expect(isFirstName(expr)).toBe(false) }) }) - it('validates lastName', () => { - TESTDATA.LASTNAME.valid.forEach((expr) => { - expect(isLastName(expr)).toBe(true) - }) - TESTDATA.LASTNAME.invalid.forEach((expr) => { - expect(isLastName(expr)).toBe(false) - }) - }) it('validate tech user clientId', () => { TESTDATA.CLIENTID.valid.forEach((expr) => { expect(isClientID(expr)).toBe(true) diff --git a/src/types/Patterns.ts b/src/types/Patterns.ts index 325e7fa46..ecc384387 100644 --- a/src/types/Patterns.ts +++ b/src/types/Patterns.ts @@ -33,13 +33,11 @@ export const Patterns = { `^(https)://(${DOMAIN.source})(:\\d{1,5})?(${URLPATH.source})?$`, 'i' ), - NAME: /^([A-Za-zÀ-ÿ-,.']{1,40} ?){1,8}$/i, UUID: /^[a-f0-9]{8}(-[a-f0-9]{4}){4}[a-f0-9]{8}$/i, COMPANY_NAME: /^\d*?[a-zÀ-ÿ]\d?([a-z0-9À-ÿ-_+=.,:;!?'"&#@()]\s?){1,29}$/i, - firstName: - /^([A-Za-zÀ-ÿ-,.'](?!.*[-,.]{2})[A-Za-zÀ-ÿ-,.']{1,40} ?)[^ –]{1,40}$/, - lastName: - /^([A-Za-zÀ-ÿ-,.'](?!.*[-,.]{2})[A-Za-zÀ-ÿ-,.']{1,40} ?)[^ –]{1,40}$/, + name: /^([A-Za-zÀ-ÿ-,.'](?!.*[-,.]{2})[A-Za-zÀ-ÿ-,.']{1,40} ?)[^ –]{1,40}$/, + zipcode: /^[A-Z0-9-]{1,8}$/, + streetNumber: /^[0-9A-Za-z- ]{1,20}$/, prefix: { BPN: /^BPNL/i, URL: /^https:/i, @@ -96,8 +94,15 @@ export const isKeycloakURL = (expr: string) => isURL(expr) && !expr.includes('#') export const isUUID = (expr: string) => Patterns.UUID.test(expr) export const isCompanyName = (expr: string) => Patterns.COMPANY_NAME.test(expr) -export const isFirstName = (expr: string) => Patterns.firstName.test(expr) -export const isLastName = (expr: string) => Patterns.lastName.test(expr) +export const isName = (expr: string) => Patterns.name.test(expr) +export const isCityName = isName +export const isStreetName = isName +export const isRegionName = isName +export const isFirstName = isName +export const isLastName = isName +export const isUserName = (expr: string) => isName(expr) || isMail(expr) +export const isZipCode = (expr: string) => Patterns.zipcode.test(expr) +export const isStreetNumber = (expr: string) => Patterns.streetNumber.test(expr) export const isIDPClientID = (expr: string) => Patterns.idp.clientId.test(expr) export const isIDPClientSecret = (expr: string) => Patterns.idp.clientSecret.test(expr) From a06c87c8e6c3cb240079321248d1028a44288354 Mon Sep 17 00:00:00 2001 From: nidhigarg-bmw <101316912+nidhigarg-bmw@users.noreply.github.com> Date: Tue, 31 Oct 2023 13:34:21 +0530 Subject: [PATCH 09/13] feat(app subscription): change the button activation (#330) --- CHANGELOG.md | 2 + src/assets/locales/de/main.json | 2 + src/assets/locales/en/main.json | 2 + .../templates/Subscription/Subscription.scss | 3 -- .../Subscription/SubscriptionElements.tsx | 43 ++++++++++++------- .../appSubscriptionApiSlice.ts | 7 +++ 6 files changed, 41 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d22ed574..1f2931fde 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## unreleased +- App Subscription + - Autosetup Process Worker implementation (adjust overlay) - Usermanagement - User Invite IdP connection logic diff --git a/src/assets/locales/de/main.json b/src/assets/locales/de/main.json index df7a6ba02..8444ff261 100644 --- a/src/assets/locales/de/main.json +++ b/src/assets/locales/de/main.json @@ -1233,6 +1233,8 @@ "activateBtn": "Activate", "configureBtn": "Configure", "pleaseEnterValidURL": "Please enter a valid URL", + "error": "Error", + "success": "Success", "tabs": { "request": "Request", "active": "Active", diff --git a/src/assets/locales/en/main.json b/src/assets/locales/en/main.json index fa1e5c52b..f97e2e1f4 100644 --- a/src/assets/locales/en/main.json +++ b/src/assets/locales/en/main.json @@ -1197,6 +1197,8 @@ "activateBtn": "Activate", "configureBtn": "Configure", "pleaseEnterValidURL": "Please enter a valid URL", + "error": "Error", + "success": "Success", "tabs": { "request": "Request", "active": "Active", diff --git a/src/components/shared/templates/Subscription/Subscription.scss b/src/components/shared/templates/Subscription/Subscription.scss index 151478b74..bf43ee52f 100644 --- a/src/components/shared/templates/Subscription/Subscription.scss +++ b/src/components/shared/templates/Subscription/Subscription.scss @@ -209,9 +209,6 @@ border-radius: 15px; padding: 5px; } - .configureBtn { - pointer-events: none; - } .statusIcon { height: 30px; float: right; diff --git a/src/components/shared/templates/Subscription/SubscriptionElements.tsx b/src/components/shared/templates/Subscription/SubscriptionElements.tsx index ef3fff440..5ab60e533 100644 --- a/src/components/shared/templates/Subscription/SubscriptionElements.tsx +++ b/src/components/shared/templates/Subscription/SubscriptionElements.tsx @@ -32,6 +32,7 @@ import { type CompanySubscriptionData, ProcessStep, type SubscriptionContent, + useActivateSubscriptionMutation, } from 'features/appSubscription/appSubscriptionApiSlice' import NoItems from 'components/pages/NoItems' import './Subscription.scss' @@ -44,6 +45,7 @@ import { SubscriptionTypes } from '.' import { getAssetBase } from 'services/EnvironmentService' import AddTaskIcon from '@mui/icons-material/AddTask' import HistoryIcon from '@mui/icons-material/History' +import { error, success } from 'services/NotifyService' type ViewDetail = { appId: string @@ -146,6 +148,17 @@ export default function SubscriptionElements({ const [subscriptionDetail, setSubscriptionDetail] = useState(SubscriptionInitialData) + const [activateSubscription] = useActivateSubscriptionMutation() + + const handleActivate = async (subscriptionId: string) => { + try { + await activateSubscription(subscriptionId).unwrap() + success(t('content.appSubscription.success')) + } catch (err) { + error(t('content.appSubscription.error'), '', err as object) + } + } + if (subscriptions && subscriptions.length === 0 && isSuccess) { return } else if (!isSuccess) { @@ -176,21 +189,6 @@ export default function SubscriptionElements({ label={t('content.appSubscription.configureBtn')} type="plain" variant="filled" - className="configureBtn" - /> - - - ) - } else if ( - subscriptionData.processStepTypeId === ProcessStep.ACTIVATE_SUBSCRIPTION - ) { - return ( - <> - { type === SubscriptionTypes.APP_SUBSCRIPTION ? setSubscriptionDetail({ @@ -215,6 +213,21 @@ export default function SubscriptionElements({ ) + } else if ( + subscriptionData.processStepTypeId === ProcessStep.ACTIVATE_SUBSCRIPTION + ) { + return ( + <> + handleActivate(subscription.subscriptionId)} + /> + + + ) } else { return ( ({ + query: (subscriptionId) => ({ + url: `/subscription/${subscriptionId}/activate `, + method: 'PUT', + }), + }), }), }) @@ -196,4 +202,5 @@ export const { useFetchTechnicalProfilesQuery, useAddUserSubscribtionMutation, useUpdateTenantUrlMutation, + useActivateSubscriptionMutation, } = apiSlice From 14e4a114b9bfab61cf1cbc1493e21d533fea2118 Mon Sep 17 00:00:00 2001 From: Martin Rohrmeier Date: Thu, 2 Nov 2023 08:40:58 +0100 Subject: [PATCH 10/13] fix(osp): fix OSP PO remarks --- src/assets/locales/en/idp.json | 68 ++++++++- src/components/overlays/AddIDP/index.tsx | 30 ++-- .../overlays/OSPConsent/OSPConsentContent.tsx | 84 +++++----- src/components/overlays/OSPConsent/index.tsx | 42 +++-- src/components/overlays/OSPConsent/style.scss | 20 +++ .../OSPRegister/OSPRegisterContent.tsx | 144 +++++++----------- .../overlays/OSPRegister/OSPRegisterNext.tsx | 27 ++-- src/components/overlays/OSPRegister/index.tsx | 33 +--- src/components/overlays/UpdateIDP/index.tsx | 12 +- .../pages/IDPManagement/IDPList.tsx | 2 - src/components/pages/OSPManagement/index.tsx | 8 +- src/features/admin/networkApiSlice.ts | 40 ++++- src/services/AccessService.tsx | 2 +- src/types/Config.tsx | 1 - src/types/Patterns.ts | 39 +++-- 15 files changed, 342 insertions(+), 210 deletions(-) diff --git a/src/assets/locales/en/idp.json b/src/assets/locales/en/idp.json index 9b814a456..c89e2a55d 100644 --- a/src/assets/locales/en/idp.json +++ b/src/assets/locales/en/idp.json @@ -188,7 +188,12 @@ }, "providerType": { "name": "Identity Provider Type", - "placeholder": "Please select a type" + "placeholder": "Please select a type", + "hint": "Select provider type for your own company or managed for a third party company", + "option": { + "OWN": "create an IdP connection to your company IdP for yourself", + "MANAGED": "create a managed IdP connection for a third party" + } }, "redirectUri": { "name": "Redirect URL", @@ -213,6 +218,26 @@ "copy": { "hint": "click to copy" }, + "name": { + "name": "Client ID", + "hint": "Enter the client ID provided by your IdP" + }, + "company": { "name": "company", "hint": "company" }, + "extid": { "name": "extid", "hint": "extid" }, + "bpn": { "name": "bpn", "hint": "bpn" }, + "country": { "name": "country", "hint": "country" }, + "region": { "name": "region", "hint": "region" }, + "zipcode": { "name": "zipcode", "hint": "zipcode" }, + "city": { "name": "city", "hint": "city" }, + "streetName": { "name": "street", "hint": "street" }, + "streetNumber": { "name": "street no", "hint": "street no" }, + "uniqueId": { "name": "unique id", "hint": "unique id" }, + "uniqeIdValue": { "name": "uid value", "hint": "uid value" }, + "providerId": { "name": "provider id", "hint": "provider id" }, + "email": { "name": "email", "hint": "email" }, + "firstName": { "name": "first name", "hint": "first name" }, + "lastName": { "name": "last name", "hint": "last name" }, + "companyRoles": { "name": "company roles", "hint": "company roles" }, "not": "not", "configured": "configured", "enabled": "enabled", @@ -227,6 +252,45 @@ "status3": "disabled", "status4": "active" }, + "osp": { + "title": "Onboarding Serviceprovider", + "desc": "{Description of the Onboarding Serviceprovider process}", + "steps": { + "one": { + "text": "done", + "title": "Create" + }, + "two": { + "text": "done", + "title": "Configure" + }, + "three": { + "text": "done", + "title": "Register" + }, + "four": { + "text": "done", + "title": "Next Steps" + } + }, + "register": { + "title": "Register Partner", + "desc": "{Description of the Register Partner process}", + "error": "Error submitting registration", + "success": "Registration successful" + }, + "register_next": { + "title": "Next Steps", + "desc": "{Description of next steps}", + "body1": "Registration of IDP {{id}} successful. Now do ..." + }, + "consent": { + "title": "Consent", + "desc": "{Description of the Consent process}", + "error": "Error submitting consent", + "success": "Consent successful" + } + }, "action": { "actions": "Actions", "createIdp": "Create IdP entry", @@ -237,6 +301,8 @@ "delete": "Delete", "edit": "Edit", "configure": "Configure", + "register": "Register Partner", + "consent": "Consent", "users": "Users", "signout": "Sign out", "confirm": "Confirm", diff --git a/src/components/overlays/AddIDP/index.tsx b/src/components/overlays/AddIDP/index.tsx index 3db79039d..4b0c194fa 100644 --- a/src/components/overlays/AddIDP/index.tsx +++ b/src/components/overlays/AddIDP/index.tsx @@ -88,7 +88,7 @@ const SelectIdpProviderType = ({
    { setType(IDPProviderType.OWN) @@ -99,7 +99,9 @@ const SelectIdpProviderType = ({ /> { setType(IDPProviderType.MANAGED) @@ -210,29 +212,27 @@ const AddIDPPrepareForm = ({ style={{ display: 'flex', flexDirection: 'row', - justifyContent: 'space-around', + justifyContent: 'space-between', }} > - { const currentData = { ...formData, - providerType: value, + authType: value, } setFormData(currentData) onChange(currentData) - console.log(currentData) }} /> - { const currentData = { ...formData, - authType: value, + providerType: value, } setFormData(currentData) onChange(currentData) - console.log(currentData) }} />
    @@ -312,7 +312,17 @@ export const AddIdp = ({ />
    - +
    {t('add.desc')} diff --git a/src/components/overlays/OSPConsent/OSPConsentContent.tsx b/src/components/overlays/OSPConsent/OSPConsentContent.tsx index d625b6e99..8c56d6d82 100644 --- a/src/components/overlays/OSPConsent/OSPConsentContent.tsx +++ b/src/components/overlays/OSPConsent/OSPConsentContent.tsx @@ -20,12 +20,12 @@ import { Checkbox } from '@catena-x/portal-shared-components' import { Typography } from '@mui/material' -import { type IdentityProvider } from 'features/admin/idpApiSlice' import { CONSENT_STATUS, type CompanyRole, type CompanyRoleAgreementData, type PartnerRegistrationConsent, + type PartnerRegistration, } from 'features/admin/networkApiSlice' import i18next from 'i18next' import { useState } from 'react' @@ -60,13 +60,19 @@ const DocumentDownloadLink = ({ id, name }: { id: string; name: string }) => { } const OSPConsentContentForm = ({ + application, companyRoleAgreementData, onChange, }: { + application: PartnerRegistration companyRoleAgreementData: CompanyRoleAgreementData onChange: (consent: Set) => void }) => { - const [consent, setConsent] = useState>(new Set()) + const [consent, setConsent] = useState>( + new Set( + application.agreements?.map((agreement) => agreement.agreementId) + ) + ) const toggleConsent = (id: string) => { const newConsent = new Set(consent) @@ -81,43 +87,45 @@ const OSPConsentContentForm = ({ return (
      - {companyRoleAgreementData.companyRoles.map((role: CompanyRole) => ( -
    • - {role.companyRole} -
      {role.descriptions[i18next.language]}
      -
        - {role.agreementIds.map((id) => { - const agreement = companyRoleAgreementData.agreements.filter( - (a) => id === a.agreementId - )?.[0] - return agreement ? ( -
      • - { - toggleConsent(agreement.agreementId) - }} - checked={consent.has(agreement.agreementId)} - /> - -
      • - ) : ( - <> - ) - })} -
      -
    • - ))} + {companyRoleAgreementData.companyRoles + .filter((role) => application.companyRoles.includes(role.companyRole)) + .map((role: CompanyRole) => ( +
    • + {role.companyRole} +
      {role.descriptions[i18next.language]}
      +
        + {role.agreementIds.map((id) => { + const agreement = companyRoleAgreementData.agreements.filter( + (a) => id === a.agreementId + )?.[0] + return agreement ? ( +
      • + { + toggleConsent(agreement.agreementId) + }} + checked={consent.has(agreement.agreementId)} + /> + +
      • + ) : ( + <> + ) + })} +
      +
    • + ))}
    ) } export const OSPConsentContent = ({ - idp, + application, companyRoleAgreementData, onValid, }: { - idp: IdentityProvider + application: PartnerRegistration companyRoleAgreementData: CompanyRoleAgreementData onValid: (consent: PartnerRegistrationConsent) => void }) => { @@ -128,9 +136,7 @@ export const OSPConsentContent = ({ const doCheckData = (consent: Set) => { onValid({ - companyRoles: companyRoleAgreementData.companyRoles.map( - (role) => role.companyRole - ), + companyRoles: application.companyRoles, agreements: [...consent].map((agreementId) => ({ agreementId, consentStatus: CONSENT_STATUS.ACTIVE, @@ -140,7 +146,17 @@ export const OSPConsentContent = ({ return (
    +
    +        {JSON.stringify(application, null, 2)}
    +      
    diff --git a/src/components/overlays/OSPConsent/index.tsx b/src/components/overlays/OSPConsent/index.tsx index 10f148475..cd8cf6a2b 100644 --- a/src/components/overlays/OSPConsent/index.tsx +++ b/src/components/overlays/OSPConsent/index.tsx @@ -30,7 +30,6 @@ import { import { useDispatch } from 'react-redux' import { closeOverlay } from 'features/control/overlay' import { useState } from 'react' -import { useFetchIDPDetailQuery } from 'features/admin/idpApiSlice' import { OSPConsentContent } from './OSPConsentContent' import { error, success } from 'services/NotifyService' import { @@ -38,12 +37,14 @@ import { useFetchCompanyRoleAgreementDataQuery, useRegisterPartnerConsentMutation, emptyPartnerRegistrationConsent, + useFetchRegistrationApplicationsQuery, + useFetchRegistrationApplicationDataQuery, } from 'features/admin/networkApiSlice' -export const OSPConsent = ({ id }: { id: string }) => { - const { t } = useTranslation('osp') +export const OSPApplicationConsent = ({ id }: { id: string }) => { + const { t } = useTranslation('idp') const dispatch = useDispatch() - const { data } = useFetchIDPDetailQuery(id) + const application = useFetchRegistrationApplicationDataQuery(id).data const companyRoleAgreementData = useFetchCompanyRoleAgreementDataQuery().data const [registerPartnerConsent] = useRegisterPartnerConsentMutation() const [consent, setConsent] = useState( @@ -51,15 +52,18 @@ export const OSPConsent = ({ id }: { id: string }) => { ) const [loading, setLoading] = useState(false) + console.log(application, companyRoleAgreementData) + const doConsent = async () => { - if (!(data && consent)) return + if (!(application && consent)) return setLoading(true) try { + console.log(consent) await registerPartnerConsent(consent).unwrap() - success(t('consent.success')) + success(t('osp.consent.success')) dispatch(closeOverlay()) } catch (err) { - error(t('consent.error'), '', err as object) + error(t('osp.consent.error'), '', err as object) } setLoading(false) } @@ -67,7 +71,7 @@ export const OSPConsent = ({ id }: { id: string }) => { return ( <> dispatch(closeOverlay())} @@ -75,13 +79,12 @@ export const OSPConsent = ({ id }: { id: string }) => {
    - {t('consent.desc')} + {t('osp.consent.desc')}
    - {t('consent.addDataHeading')} - {data && companyRoleAgreementData && ( + {application && companyRoleAgreementData && ( @@ -111,7 +114,11 @@ export const OSPConsent = ({ id }: { id: string }) => { onClick={doConsent} disabled={ consent.agreements.length !== - companyRoleAgreementData?.agreements.length + companyRoleAgreementData?.companyRoles + .filter((role) => + application?.companyRoles.includes(role.companyRole) + ) + .reduce((a, r) => a + r.agreementIds.length, 0) } > {t('action.consent')} @@ -121,3 +128,12 @@ export const OSPConsent = ({ id }: { id: string }) => { ) } + +export const OSPConsent = () => { + const applications = useFetchRegistrationApplicationsQuery().data + return applications && applications.length > 0 ? ( + + ) : ( + <> + ) +} diff --git a/src/components/overlays/OSPConsent/style.scss b/src/components/overlays/OSPConsent/style.scss index 5e27137f7..a3c981854 100644 --- a/src/components/overlays/OSPConsent/style.scss +++ b/src/components/overlays/OSPConsent/style.scss @@ -1,3 +1,23 @@ +/******************************************************************************** + * Copyright (c) 2021, 2023 BMW Group AG + * Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + ul.roles { list-style-type: none; padding-inline-start: 0; diff --git a/src/components/overlays/OSPRegister/OSPRegisterContent.tsx b/src/components/overlays/OSPRegister/OSPRegisterContent.tsx index ca5095610..aa6eb796d 100644 --- a/src/components/overlays/OSPRegister/OSPRegisterContent.tsx +++ b/src/components/overlays/OSPRegister/OSPRegisterContent.tsx @@ -21,20 +21,20 @@ import { type CSSProperties, useState } from 'react' import { type IdentityProvider } from 'features/admin/idpApiSlice' import { - isBPN, + isBPNOrEmpty, isCityName, isCompanyName, isCountryCode, isFirstName, isID, + isIDOrEmpty, isLastName, isMail, - isName, - isRegionName, + isRegionNameOrEmpty, isStreetName, - isStreetNumber, - isUserName, - isZipCode, + isStreetNumberOrEmpty, + isUUID, + isZipCodeOrEmpty, } from 'types/Patterns' import { useTranslation } from 'react-i18next' import ValidatingInput from 'components/shared/basic/Input/ValidatingInput' @@ -75,6 +75,16 @@ const emptyData: PartnerRegistration = { companyRoles: [], } +const getEmptyPartnerRegistration = (identityProviderId: string) => ({ + ...emptyData, + userDetails: [ + { + ...emptyData.userDetails[0], + identityProviderId, + }, + ], +}) + type ItemType = { id: string } const uniqeIdItems: Array = Object.keys(UNIQUE_ID_TYPE).map( @@ -92,9 +102,11 @@ const OSPRegisterForm = ({ companyRoleAgreementData: CompanyRoleAgreementData onChange: (partnerRegistration: PartnerRegistration | undefined) => boolean }) => { - const { t } = useTranslation('osp') + const { t } = useTranslation('idp') - const [data, setData] = useState(emptyData) + const [data, setData] = useState( + getEmptyPartnerRegistration(idp.identityProviderId) + ) const updateData = (newData: PartnerRegistration | undefined) => { if (newData) setData(newData) @@ -105,16 +117,17 @@ const OSPRegisterForm = ({ updateData(undefined) } - const inputStyle: CSSProperties = { width: 260 } + const inputStyle2: CSSProperties = { width: 406 } + const inputStyle3: CSSProperties = { width: 260 } const inputs: Record = { extid: ( { updateData({ @@ -126,7 +139,7 @@ const OSPRegisterForm = ({ ), company: ( { updateData({ ...data, - bpn: value, + bpn: value ? value.toLocaleUpperCase() : null, }) }} /> ), country: ( { updateData({ @@ -190,7 +203,7 @@ const OSPRegisterForm = ({ ), city: ( { updateData({ @@ -220,10 +233,9 @@ const OSPRegisterForm = ({ }} /> ), - streetName: ( { updateData({ @@ -253,30 +265,9 @@ const OSPRegisterForm = ({ }} /> ), - identityProviderId: ( - { - updateData({ - ...data, - userDetails: [ - { - ...data.userDetails[0], - identityProviderId: value, - }, - ], - }) - }} - /> - ), providerId: ( ), - - username: ( - { - updateData({ - ...data, - userDetails: [ - { - ...data.userDetails[0], - username: value, - }, - ], - }) - }} - /> - ), firstName: ( ), uniqueId: ( -
    - , +
    { updateData({ ...data, - uniqueIds: [ - { - ...data.uniqueIds[0], - type: value.id as UNIQUE_ID_TYPE, - }, - ], + uniqueIds: value + ? [ + { + ...data.uniqueIds[0], + type: value.id as UNIQUE_ID_TYPE, + }, + ] + : [], }) }, }} @@ -411,11 +381,11 @@ const OSPRegisterForm = ({ ), uniqeIdValue: ( { updateData({ @@ -493,14 +463,12 @@ const OSPRegisterForm = ({ {inputs.uniqeIdValue}
    - {inputs.identityProviderId} {inputs.providerId} - {inputs.username} + {inputs.email}
    {inputs.firstName} {inputs.lastName} - {inputs.email}
    {inputs.companyRoles}
    @@ -537,11 +505,9 @@ export const OSPRegisterContent = ({ partnerRegistration: PartnerRegistration | undefined ) => { const valid = - partnerRegistration?.name !== undefined && - partnerRegistration?.externalId !== undefined && + partnerRegistration && partnerRegistration.companyRoles.length > 0 && - partnerRegistration?.uniqueIds.length > 0 && - partnerRegistration?.uniqueIds[0].value !== undefined + partnerRegistration?.uniqueIds.length > 0 onValid(valid ? partnerRegistration : undefined) setFormData( valid ? JSON.stringify(partnerRegistration, null, 2) : '# data invalid' diff --git a/src/components/overlays/OSPRegister/OSPRegisterNext.tsx b/src/components/overlays/OSPRegister/OSPRegisterNext.tsx index 5069b5749..3dd0bc644 100644 --- a/src/components/overlays/OSPRegister/OSPRegisterNext.tsx +++ b/src/components/overlays/OSPRegister/OSPRegisterNext.tsx @@ -31,35 +31,35 @@ import { closeOverlay } from 'features/control/overlay' import { useDispatch } from 'react-redux' export const OSPRegisterNext = ({ id }: { id: string }) => { - const { t } = useTranslation('osp') + const { t } = useTranslation('idp') const dispatch = useDispatch() const steps = [ { step: 1, - headline: t('steps.one.title'), - text: t('steps.one.text'), + headline: t('osp.steps.one.title'), + text: t('osp.steps.one.text'), }, { step: 2, - headline: t('steps.two.title'), - text: t('steps.two.text'), + headline: t('osp.steps.two.title'), + text: t('osp.steps.two.text'), }, { step: 3, - headline: t('steps.three.title'), - text: t('steps.three.text'), + headline: t('osp.steps.three.title'), + text: t('osp.steps.three.text'), }, { step: 4, - headline: t('steps.four.title'), + headline: t('osp.steps.four.title'), }, ] return ( <> dispatch(closeOverlay())} @@ -70,12 +70,13 @@ export const OSPRegisterNext = ({ id }: { id: string }) => {
    - {t('register.next.desc')} + + {t('osp.register_next.desc')} +
    - {t('register.next.heading')} - - Registration for IDP {id} successful. Next steps... + + {t('osp.register_next.body1', { id })}
    diff --git a/src/components/overlays/OSPRegister/index.tsx b/src/components/overlays/OSPRegister/index.tsx index 8009ec3af..ea110e6ae 100644 --- a/src/components/overlays/OSPRegister/index.tsx +++ b/src/components/overlays/OSPRegister/index.tsx @@ -25,7 +25,6 @@ import { DialogContent, DialogHeader, LoadingButton, - Stepper, Typography, } from '@catena-x/portal-shared-components' import { useDispatch } from 'react-redux' @@ -41,11 +40,10 @@ import { } from 'features/admin/networkApiSlice' export const OSPRegister = ({ id }: { id: string }) => { - const { t } = useTranslation('osp') + const { t } = useTranslation('idp') const dispatch = useDispatch() const { data } = useFetchIDPDetailQuery(id) const companyRoleAgreementData = useFetchCompanyRoleAgreementDataQuery().data - console.log(companyRoleAgreementData) const [registerPartner] = useRegisterPartnerMutation() @@ -60,48 +58,27 @@ export const OSPRegister = ({ id }: { id: string }) => { try { await registerPartner(registerData).unwrap() dispatch(closeOverlay()) - success(t('register.success')) + success(t('osp.register.success')) } catch (err) { - error(t('register.error'), '', err as object) + error(t('osp.register.error'), '', err as object) } setLoading(false) } - const steps = [ - { - headline: t('add.stepLists.firstStep'), - step: 1, - text: t('edit.created'), - }, - { - headline: t('add.stepLists.secondStep'), - step: 2, - text: t('edit.created'), - }, - { - headline: t('add.stepLists.thirdStep'), - step: 3, - }, - ] - return ( <> dispatch(closeOverlay())} /> -
    - -
    - {t('register.desc')} + {t('osp.register.desc')}
    - {t('register.addDataHeading')} {data && companyRoleAgreementData && ( { enabled: true, }).unwrap() success(t('enable.success')) - dispatch(show(OVERLAYS.REGISTER_OSP, id)) + dispatch(closeOverlay()) } else { dispatch(show(OVERLAYS.ENABLE_IDP, id)) } @@ -96,6 +96,14 @@ export const UpdateIDP = ({ id }: { id: string }) => { }, ] + const steps = + data?.identityProviderTypeId === IDPCategory.MANAGED + ? UpdateStepsList.slice(0, 2) + : UpdateStepsList + + const numberSteps = + data?.identityProviderTypeId === IDPCategory.MANAGED ? 2 : 3 + return ( <> { />
    - +
    diff --git a/src/components/pages/IDPManagement/IDPList.tsx b/src/components/pages/IDPManagement/IDPList.tsx index 8bd978ee9..657cc2901 100644 --- a/src/components/pages/IDPManagement/IDPList.tsx +++ b/src/components/pages/IDPManagement/IDPList.tsx @@ -229,8 +229,6 @@ export const IDPList = () => { {menuItems.configure} {isManaged && idp.enabled && menuItems.register} - {isManaged && idp.enabled && menuItems.registerNext} - {isManaged && idp.enabled && menuItems.consent} {!isManaged && idp.oidc?.clientId && menuItems.enableToggle} {!isManaged && (idp.enabled ? menuItems.addUsers : menuItems.delete)} diff --git a/src/components/pages/OSPManagement/index.tsx b/src/components/pages/OSPManagement/index.tsx index a88c0f741..71f84153d 100644 --- a/src/components/pages/OSPManagement/index.tsx +++ b/src/components/pages/OSPManagement/index.tsx @@ -29,7 +29,7 @@ import { getAssetBase } from 'services/EnvironmentService' import { IDPList } from '../IDPManagement/IDPList' export default function OSPManagement() { - const { t } = useTranslation('osp') + const { t } = useTranslation('idp') const dispatch = useDispatch() return ( @@ -38,18 +38,18 @@ export default function OSPManagement() {
    - {t('onboarding.title')} + {t('osp.title')} - {t('onboarding.desc')} + {t('osp.desc')} {t('onboarding.title')}
    -
    +
    {item.longDescription}
    -