Skip to content

Commit

Permalink
bugfix(service release process): clear data for new service (#278)
Browse files Browse the repository at this point in the history
  • Loading branch information
lavanya-bmw authored Sep 25, 2023
1 parent 1dc79cb commit 71df55d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
- Service Subscription
- UI Changes
- Add filters
- Service release process
- Clearing fields while registering new service

## 1.6.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,15 @@ import NoItems from 'components/pages/NoItems'
import { useLocation, useNavigate } from 'react-router-dom'
import { PAGES } from 'types/Constants'
import debounce from 'lodash.debounce'
import { setServiceId } from 'features/serviceManagement/actions'
import {
setServiceId,
setServiceStatus,
} from 'features/serviceManagement/actions'
import { useDispatch } from 'react-redux'
import { setServiceReleaseActiveStep } from 'features/serviceManagement/slice'
import { SuccessErrorType } from 'features/admin/appuserApiSlice'
import { Box, useTheme, CircularProgress } from '@mui/material'
import { initialState } from 'features/serviceManagement/types'

enum ServiceSubMenuItems {
DEACTIVATE = 'deactivate',
Expand Down Expand Up @@ -173,6 +177,13 @@ export default function ServiceListOverview() {
setPage(page + 1)
}

const onNewServiceCardClick = () => {
navigate(`/${PAGES.SERVICERELEASEPROCESS}/form`)
dispatch(setServiceId(''))
dispatch(setServiceReleaseActiveStep())
dispatch(setServiceStatus(initialState.serviceStatusData))
}

return (
<main>
<PageHeader
Expand Down Expand Up @@ -236,9 +247,7 @@ export default function ServiceListOverview() {
imageLoader={fetchImageWithToken}
showAddNewCard={false}
newButtonText={t('serviceoverview.addbtn')}
onNewCardButton={() =>
navigate(`/${PAGES.SERVICERELEASEPROCESS}/form`)
}
onNewCardButton={onNewServiceCardClick}
onCardClick={(item: CardItems) => {
// TODO: workaround - fix CardItems type
const cardItem: any = item
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ export default function AppPage() {
}}
name="providerPhoneContact"
label={t('content.apprelease.appPage.providerPhoneContact')}
validate={(value: string) => phone(value).isValid}
validate={(value: string) => value === '' || phone(value).isValid}
/>
{errors.providerPhoneContact &&
errors?.providerPhoneContact.type === 'validate' && (
Expand Down
2 changes: 1 addition & 1 deletion src/features/serviceManagement/apiSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ export const apiSlice = createApi({
}),
deactivateService: builder.mutation<void, string>({
query: (serviceId) => ({
url: `/api/service/ServiceChange/${serviceId}/deactivateService`,
url: `/api/services/ServiceChange/${serviceId}/deactivateService`,
method: 'PUT',
}),
}),
Expand Down

0 comments on commit 71df55d

Please sign in to comment.