Skip to content

Commit

Permalink
fix(connector management): fixed customer link selection and fixed re…
Browse files Browse the repository at this point in the history
…setting values
  • Loading branch information
lavanya-bmw committed Sep 17, 2024
1 parent dca9400 commit 55127eb
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

- **Connector Management**
- fixed technical user selection
- fixed customer link selection and fixed resetting values

## 2.2.0-RC2

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ import {
} from '@catena-x/portal-shared-components'
import HelpOutlineIcon from '@mui/icons-material/HelpOutline'
import Patterns from 'types/Patterns'
import { ConnectType } from 'features/connector/connectorApiSlice'
import {
ConnectType,
type EdcSubscriptionsType,
} from 'features/connector/connectorApiSlice'
import { Dropzone } from '../../../../shared/basic/Dropzone'
import { useEffect, useState } from 'react'
import './EdcComponentStyles.scss'
Expand Down Expand Up @@ -259,6 +262,7 @@ any) => {
const [selectedValue, setSelectedValue] = useState<string>()
const [serviceAccountUsers, setServiceAccountUsers] = useState([])
const [selectedTechnicalUser, setSelectedTechnicalUser] = useState('')
const [selectedCustomerLink, setSelectedCustomerLink] = useState('')

useEffect(() => {
if (fetchServiceAccountUsers)
Expand All @@ -278,6 +282,16 @@ any) => {
}
}, [serviceAccountUsers])

useEffect(() => {
const selectedCustomer: EdcSubscriptionsType[] = subscriptions?.filter(
(item: { subscriptionId: string }) =>
item.subscriptionId === getValues().ConnectorSubscriptionId
)
if (selectedCustomer.length > 0) {
setSelectedCustomerLink(selectedCustomer[0].name ?? '')
}
}, [subscriptions])

const handleTechnicalUserSubmit = () => {
if (
selectedValue === t('content.edcconnector.modal.createNewTechnicalUser')
Expand Down Expand Up @@ -612,7 +626,7 @@ any) => {
'content.edcconnector.modal.insertform.subscription.error'
),
items: subscriptions,
defaultSelectValue: {},
defaultSelectValue: selectedCustomerLink ?? {},
keyTitle: 'name',
}}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,10 @@ const AddConnectorOverlay = ({
const [selected, setSelected] = useState<ConnectorType>({})

useEffect(() => {
if (openDialog) reset(formFields)
}, [openDialog, reset])
if (openDialog || connectorStep === 0) {
reset(formFields)
}
}, [openDialog, reset, connectorStep])

useEffect(() => {
if (serviceAccounts && serviceAccounts?.meta?.totalPages > page) {
Expand Down

0 comments on commit 55127eb

Please sign in to comment.