Skip to content

Commit

Permalink
fix(app release process): update roles endpoint (#737)
Browse files Browse the repository at this point in the history
  • Loading branch information
lavanya-bmw authored Apr 25, 2024
1 parent 62f1474 commit 1e6178c
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 21 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

### Change

- App Release Process
- Updated roles endpoint to get roles
- Connect Credential Management UI with new Issuer Component

## 2.0.0-RC3
Expand Down
4 changes: 2 additions & 2 deletions src/components/pages/AppOverview/AppOverViewDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { Grid } from '@mui/material'
import { useTranslation } from 'react-i18next'
import {
ConsentStatusEnum,
useFetchRolesDataQuery,
useFetchAppRolesDataQuery,
useSubmitappMutation,
} from 'features/appManagement/apiSlice'
import { useCallback, useEffect, useMemo, useState } from 'react'
Expand All @@ -50,7 +50,7 @@ export default function AppOverViewDetails({
const [cardImage, setCardImage] = useState('')
const [fetchDocumentById] = useFetchDocumentByIdMutation()
const [cardLanguage, setCardLanguage] = useState<string>('en')
const { data } = useFetchRolesDataQuery(id ?? '')
const { data } = useFetchAppRolesDataQuery(id ?? '')
const [submitapp] = useSubmitappMutation()

const defaultValues = useMemo(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ import {
import { Dropzone, type DropzoneFile } from 'components/shared/basic/Dropzone'
import { isString } from 'lodash'
import {
type rolesType,
useDeleteRolesMutation,
useFetchAppStatusQuery,
useFetchRolesDataQuery,
useFetchAppRolesDataQuery,
useFetchTechnicalUserProfilesQuery,
useFetchUserRolesQuery,
useSaveTechnicalUserProfilesMutation,
useUpdateRoleDataMutation,
type updateRolePayload,
} from 'features/appManagement/apiSlice'
import { setAppStatus } from 'features/appManagement/actions'
import SnackbarNotificationWithButtons from '../components/SnackbarNotificationWithButtons'
Expand All @@ -73,7 +73,7 @@ export default function TechnicalIntegration() {
const fetchAppStatus = useFetchAppStatusQuery(appId ?? '', {
refetchOnMountOrArgChange: true,
}).data
const { data, refetch: refetchRolesData } = useFetchRolesDataQuery(
const { data, refetch: refetchRolesData } = useFetchAppRolesDataQuery(
appId ?? '',
{
refetchOnMountOrArgChange: true,
Expand Down Expand Up @@ -580,12 +580,12 @@ export default function TechnicalIntegration() {
)}
</Typography>
<Grid item container xs={12}>
{data?.map((role: rolesType, index) => (
{data?.map((role: updateRolePayload, index) => (
<Grid
item
md={6}
xs={12}
key={role.roleId}
key={role.role}
sx={{
pl: !isMobile && index % 2 === 0 ? 0 : 1,
pr: !isMobile && index % 2 === 0 ? 1 : 0,
Expand All @@ -595,11 +595,11 @@ export default function TechnicalIntegration() {
items={[
{
expanded: false,
id: role.roleId,
id: role.role,
title: '',
titleElement: (
<Chip
key={role.roleId}
key={role.role}
label={role.role}
withIcon={true}
type="delete"
Expand All @@ -611,14 +611,14 @@ export default function TechnicalIntegration() {
},
}}
handleDelete={() => {
onChipDelete(role.roleId)
onChipDelete(role.role)
}}
/>
),
color: 'white',
children: (
<Typography variant="caption3">
{role.description}
{role.descriptions?.[0].description}
</Typography>
),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { appIdSelector } from 'features/appManagement/slice'
import {
ConsentStatusEnum,
useFetchAppStatusQuery,
useFetchRolesDataQuery,
useFetchAppRolesDataQuery,
useSubmitappMutation,
} from 'features/appManagement/apiSlice'
import { setAppStatus } from 'features/appManagement/actions'
Expand All @@ -48,7 +48,7 @@ export default function ValidateAndPublish({
const fetchAppStatus = useFetchAppStatusQuery(appId ?? '', {
refetchOnMountOrArgChange: true,
}).data
const { data } = useFetchRolesDataQuery(appId ?? '')
const { data } = useFetchAppRolesDataQuery(appId ?? '')

useEffect(() => {
if (fetchAppStatus) dispatch(setAppStatus(fetchAppStatus))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import {
ConsentStatusEnum,
type DocumentData,
DocumentTypeId,
type rolesType,
type updateRolePayload,
} from 'features/appManagement/apiSlice'
import ArticleOutlinedIcon from '@mui/icons-material/ArticleOutlined'
import CommonService from 'services/CommonService'
Expand Down Expand Up @@ -110,7 +110,7 @@ interface CommonValidateAndPublishType {
| ReleaseProcessTypes.SERVICE_RELEASE
| AppOverviewTypes.APP_OVERVIEW_DETAILS
serviceTypes?: string
rolesData?: rolesType[]
rolesData?: updateRolePayload[]
}

export default function CommonValidateAndPublish({
Expand Down Expand Up @@ -532,9 +532,11 @@ export default function CommonValidateAndPublish({
{rolesData.length > 0 ? (
<Grid container spacing={2} sx={{ margin: '0px' }}>
{rolesData?.map((role) => (
<Grid item xs={6} key={role.roleId} className="roles-data">
<Grid item xs={6} key={role.role} className="roles-data">
<Typography variant="label2">{role.role}</Typography>
<Typography variant="body3">{role.description}</Typography>
<Typography variant="body3">
{role.descriptions?.[0].description}
</Typography>
</Grid>
))}
</Grid>
Expand Down
7 changes: 3 additions & 4 deletions src/features/appManagement/apiSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,8 @@ export const apiSlice = createApi({
}),
invalidatesTags: [Tags.APP],
}),
fetchRolesData: builder.query<rolesType[], string>({
query: (appId: string) =>
`/api/administration/user/owncompany/roles/apps/${appId}?languageShortName=${i18next.language}`,
fetchAppRolesData: builder.query<updateRolePayload[], string>({
query: (appId: string) => `/api/apps/AppReleaseProcess/${appId}/roles`,
}),
updateRoleData: builder.mutation<postRolesResponseType[], updateRoleType>({
query: (data) => ({
Expand Down Expand Up @@ -449,7 +448,7 @@ export const {
useFetchSalesManagerDataQuery,
useSaveAppMutation,
useDeleteAppReleaseDocumentMutation,
useFetchRolesDataQuery,
useFetchAppRolesDataQuery,
useUpdateRoleDataMutation,
useDeleteRolesMutation,
useFetchNewDocumentByIdMutation,
Expand Down

0 comments on commit 1e6178c

Please sign in to comment.