diff --git a/CHANGELOG.md b/CHANGELOG.md index 4954b289b..ee1ef7105 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ ## Unreleased +### Bugfixes + +- **Connector Management** + - fixed technical user selection + +## 2.2.0-RC2 + ### Feature - Customer Detail Data Overlay diff --git a/src/components/pages/EdcConnector/AddConnectorOverlay/components/ConnectorInsertForm.tsx b/src/components/pages/EdcConnector/AddConnectorOverlay/components/ConnectorInsertForm.tsx index b2157b8d2..63e0032d6 100644 --- a/src/components/pages/EdcConnector/AddConnectorOverlay/components/ConnectorInsertForm.tsx +++ b/src/components/pages/EdcConnector/AddConnectorOverlay/components/ConnectorInsertForm.tsx @@ -38,6 +38,7 @@ import { Dropzone } from '../../../../shared/basic/Dropzone' import { useEffect, useState } from 'react' import './EdcComponentStyles.scss' import { ConnectorFormFields } from '..' +import { type ServiceAccountListEntry } from 'features/admin/serviceApiSlice' export const ConnectorFormInput = ({ control, @@ -243,6 +244,7 @@ const ConnectorInsertForm = ({ errors, control, trigger, + getValues, selectedService, subscriptions, fetchServiceAccountUsers, @@ -256,6 +258,7 @@ any) => { const { t } = useTranslation() const [selectedValue, setSelectedValue] = useState() const [serviceAccountUsers, setServiceAccountUsers] = useState([]) + const [selectedTechnicalUser, setSelectedTechnicalUser] = useState('') useEffect(() => { if (fetchServiceAccountUsers) @@ -264,6 +267,17 @@ any) => { ) }, [fetchServiceAccountUsers]) + useEffect(() => { + const selectedConnectorTechnicalUser: ServiceAccountListEntry[] = + serviceAccountUsers?.filter( + (i: { serviceAccountId: string }) => + i.serviceAccountId === getValues().ConnectorTechnicalUser + ) + if (selectedConnectorTechnicalUser.length > 0) { + setSelectedTechnicalUser(selectedConnectorTechnicalUser[0]?.name) + } + }, [serviceAccountUsers]) + const handleTechnicalUserSubmit = () => { if ( selectedValue === t('content.edcconnector.modal.createNewTechnicalUser') @@ -374,7 +388,7 @@ any) => { 'content.edcconnector.modal.insertform.technicalUser.error' ), items: serviceAccountUsers, - defaultSelectValue: {}, + defaultSelectValue: selectedTechnicalUser ?? {}, keyTitle: 'name', }} /> diff --git a/src/components/pages/EdcConnector/AddConnectorOverlay/index.tsx b/src/components/pages/EdcConnector/AddConnectorOverlay/index.tsx index 7e79ebfdb..c0077f692 100644 --- a/src/components/pages/EdcConnector/AddConnectorOverlay/index.tsx +++ b/src/components/pages/EdcConnector/AddConnectorOverlay/index.tsx @@ -216,7 +216,7 @@ const AddConnectorOverlay = ({ setNewTechnicalUSer={setNewTechnicalUSer} newUserLoading={newUserLoading} newUserSuccess={newUserSuccess} - {...{ handleSubmit, control, errors, trigger }} + {...{ handleSubmit, control, errors, trigger, getValues }} /> )}