Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(company data): re-enable csv upload and revert setting of ready state #1144

Merged
merged 8 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
- updated technical user details with user type and service endpoint fields. Also, updated copy icon color for better view and made copy icon available only when value is available [#1137](https://github.com/eclipse-tractusx/portal-frontend/pull/1137)
- **Company Subscriptions**
- update API query parameters and fix tab UI scroll [#1131](https://github.com/eclipse-tractusx/portal-frontend/pull/1131)
- **Customer Data**
- re-enabled CSV upload [#1144](https://github.com/eclipse-tractusx/portal-frontend/pull/1144)
- reverted manual intervention with ready state api [#1144](https://github.com/eclipse-tractusx/portal-frontend/pull/1144)
- **Onboarding Service Provider**
- enhanced permission and company role validation for Onboarding Service Provider [#1176](https://github.com/eclipse-tractusx/portal-frontend/pull/1176)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ import {
} from 'features/companyData/slice'
import { statusColorMap } from 'utils/dataMapper'
import AddCircleOutlineIcon from '@mui/icons-material/AddCircleOutline'
import { show } from 'features/control/overlay'
import { OVERLAYS } from 'types/Constants'
import UploadIcon from '@mui/icons-material/Upload'

export const CompanyAddressList = ({
handleButtonClick,
Expand Down Expand Up @@ -195,6 +198,11 @@ export const CompanyAddressList = ({
},
icon: <AddCircleOutlineIcon />,
},
{
title: t('content.companyData.csvUploadBtn'),
click: () => dispatch(show(OVERLAYS.CSV_UPLOAD_OVERLAY)),
icon: <UploadIcon />,
},
]}
autoFocus={false}
onButtonClick={handleButtonClick}
Expand Down
21 changes: 2 additions & 19 deletions src/components/pages/CompanyData/components/EditForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import {
type CompanyDataType,
useUpdateCompanySiteAndAddressMutation,
type CompanyDataFieldsType,
useUpdateCompanyStatusToReadyMutation,
} from 'features/companyData/companyDataApiSlice'
import { useSelector } from 'react-redux'
import {
Expand Down Expand Up @@ -68,7 +67,6 @@ export default function EditForm({
const [loading, setLoading] = useState<boolean>(false)
const [isValid, setIsValid] = useState<boolean>(false)
const [updateData] = useUpdateCompanySiteAndAddressMutation()
const [updateReadyState] = useUpdateCompanyStatusToReadyMutation()
const companyData = useSelector(companyDataSelector)
const [success, setSuccess] = useState<boolean>(false)
const [error, setError] = useState<boolean>(false)
Expand Down Expand Up @@ -123,11 +121,9 @@ export default function EditForm({
}
}

const updateStateToReady = async (response: CompanyDataType[]) => {
const handleCreation = async () => {
try {
await updateReadyState({
externalIds: [response[0].externalId],
})
await updateData([input])
.unwrap()
.then(() => {
setSuccess(true)
Expand All @@ -138,19 +134,6 @@ export default function EditForm({
setLoading(false)
}

const handleCreation = async () => {
try {
await updateData([input])
.unwrap()
.then((response) => {
updateStateToReady(response)
})
} catch (e) {
setError(true)
setLoading(false)
}
}

const getTitle = () => {
if (newForm) {
return isAddress
Expand Down
Loading