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

updates(technical integration) : App release process #397

Merged
merged 8 commits into from
May 2, 2023
Merged
Show file tree
Hide file tree
Changes from 6 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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ New features, fixed bugs, known defects and other noteworthy changes to each rel
* Connectors
* Show Managed connectors
* Error scenarios implemented in Table component
* App Release Process
* technical integration style updates
* News Section
* Fixed UI of news section in home page
* Sort section
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export interface CustomAccordionProps extends AccordionProps {
children: React.ReactElement
color?: string
icon?: React.ReactElement
titleElement?: React.ReactElement
}

export const CustomAccordionItem = ({
Expand All @@ -41,6 +42,7 @@ export const CustomAccordionItem = ({
children,
color,
icon,
titleElement,
...props
}: CustomAccordionProps) => {
return (
Expand Down Expand Up @@ -73,6 +75,7 @@ export const CustomAccordionItem = ({
{icon && (
<Box sx={{ marginRight: '10px', color: 'action.active' }}>{icon}</Box>
)}
{titleElement}
<Typography variant="label1">{title}</Typography>
</AccordionSummary>
<AccordionDetails sx={{ mb: 5, bgcolor: color }}>
Expand Down
5 changes: 3 additions & 2 deletions cx-portal/src/assets/locales/de/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -943,7 +943,7 @@
"clientCreated": "Client created",
"step2Header": "2. Upload App Roles",
"uploadRolesDescription": "Upload all app roles by using the available upload template (csv) file added attached",
"rolesPreview": "Preview of roles contained in the uploaded files:",
"rolesPreview": "Preview of Roles uploaded",
"uploadAppRolesButton": "Upload App Roles",
"step3Header": "3. Enable your Identity Management Solution",
"step3HeaderDescription": "[copy] How-To-Text -> Lorem ipsum sapientem ne neque dolor erat,eros solet invidunt duo Quisque aliquid leo. Pretium patrioque sociis eu nihil Cum enim ad, ipsum alii vidisse justo id. Option porttitor diam voluptua. Cu Eam augue dolor dolores quis,",
Expand All @@ -957,7 +957,8 @@
"incorrectCSVFileFormat": "CSV file formatting incorrect. Please recheck the columns inside the csv",
"template": "Template",
"getHelp": "Get Help",
"deleteOverlayContent": "Deletion will not be reversable, do you still want to delete?"
"deleteOverlayContent": "Deletion will not be reversable, do you still want to delete?",
"roleUploadIsMandatory": "Role upload is mandatory"
},
"betaTest": {
"headerTitle": "CX Test Runs",
Expand Down
5 changes: 3 additions & 2 deletions cx-portal/src/assets/locales/en/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,7 @@
"clientCreated": "Client created",
"step2Header": "2. Upload App Roles",
"uploadRolesDescription": "Upload all app roles by using the available upload template (csv) file added attached",
"rolesPreview": "Preview of roles contained in the uploaded files:",
"rolesPreview": "Preview of Roles uploaded",
"uploadAppRolesButton": "Upload App Roles",
"step3Header": "3. Enable your Identity Management Solution",
"step3HeaderDescription": "[copy] How-To-Text -> Lorem ipsum sapientem ne neque dolor erat,eros solet invidunt duo Quisque aliquid leo. Pretium patrioque sociis eu nihil Cum enim ad, ipsum alii vidisse justo id. Option porttitor diam voluptua. Cu Eam augue dolor dolores quis,",
Expand All @@ -917,7 +917,8 @@
"incorrectCSVFileFormat": "CSV file formatting incorrect. Please recheck the columns inside the csv",
"template": "Template",
"getHelp": "Get Help",
"deleteOverlayContent": "Deletion will not be reversable, do you still want to delete?"
"deleteOverlayContent": "Deletion will not be reversable, do you still want to delete?",
"roleUploadIsMandatory": "Role upload is mandatory"
},
"betaTest": {
"headerTitle": "CX Test Runs",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,17 @@
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

import { Chip, LoadingButton, Typography } from 'cx-portal-shared-components'
import {
Button,
Chip,
CustomAccordion,
LoadingButton,
Typography,
} from 'cx-portal-shared-components'
import { useTranslation } from 'react-i18next'
import ArrowForwardIcon from '@mui/icons-material/ArrowForward'
import { Box, Grid } from '@mui/material'
import FileDownloadOutlinedIcon from '@mui/icons-material/FileDownloadOutlined'
import FileUploadOutlinedIcon from '@mui/icons-material/FileUploadOutlined'
import { Box, Grid, useMediaQuery, useTheme } from '@mui/material'
import { Controller, useForm } from 'react-hook-form'
import { useEffect, useState } from 'react'
import { useDispatch, useSelector } from 'react-redux'
Expand Down Expand Up @@ -77,6 +84,11 @@ export default function TechnicalIntegration() {
const [updateRoleData, { isLoading }] = useUpdateRoleDataMutation()
const [deleteRoles] = useDeleteRolesMutation()
const [uploadCSVError, setUploadCSVError] = useState(false)
const [enableErrorMessage, setEnableErrorMessage] = useState(false)
const theme = useTheme()
const isMobile = useMediaQuery(theme.breakpoints.down('md'), {
defaultMatches: true,
})

const defaultValues = {
// To-Do : the below code will get enhanced again in R.3.1
Expand All @@ -102,7 +114,9 @@ export default function TechnicalIntegration() {

const onIntegrationSubmit = async (data: any, buttonLabel: string) => {
buttonLabel === 'saveAndProceed' && dispatch(increment())
buttonLabel === 'save' && setTechnicalIntegrationSnackbar(true)
buttonLabel === 'save' && rolesPreviews?.length === 0
? setEnableErrorMessage(true)
: setTechnicalIntegrationSnackbar(true)
}

const csvPreview = (files: File[]) => {
Expand Down Expand Up @@ -171,6 +185,7 @@ export default function TechnicalIntegration() {
.then((data) => {
setRolesPreviews([])
setRolesDescription([])
setEnableErrorMessage(false)
reset(defaultValues)
refetch()
})
Expand Down Expand Up @@ -219,28 +234,30 @@ export default function TechnicalIntegration() {
'content.apprelease.technicalIntegration.uploadRolesDescription'
)}
</Typography>
<Grid item container xs={12} mt={2}>
<Grid item xs={6}>
<a
href="../../app-provider-role-upload-example.csv"
download
style={{ display: 'flex', justifyContent: 'center' }}
>
<ArrowForwardIcon />
<Grid item xs={12} sx={{ mr: 2, mt: 2, textAlign: 'center' }}>
<a
href="../../app-provider-role-upload-example.csv"
download
style={{ textDecoration: 'none' }}
>
<Button variant="outlined" endIcon={<FileDownloadOutlinedIcon />}>
{t('content.apprelease.technicalIntegration.template')}
</a>
</Grid>
<Grid item xs={6}>
<a
href="https://portal.dev.demo.catena-x.net/documentation/?path=docs%2F04.+App%28s%29%2FRelease-Process%2FApp+Release+Workflow.md"
target="_blank"
style={{ display: 'flex', justifyContent: 'center' }}
rel="noreferrer"
>
<ArrowForwardIcon />
{t('content.apprelease.technicalIntegration.getHelp')}
</a>
</Grid>
</Button>
</a>
<Button
sx={{ ml: 2 }}
variant="contained"
color="secondary"
onClick={() =>
window.open(
'https://portal.dev.demo.catena-x.net/documentation/?path=docs%2F04.+App%28s%29%2FRelease-Process%2FApp+Release+Workflow.md',
'_blank',
'noopener'
)
}
>
{t('content.apprelease.technicalIntegration.getHelp')}
</Button>
</Grid>
</Grid>
</Grid>
Expand Down Expand Up @@ -372,34 +389,61 @@ export default function TechnicalIntegration() {
</Typography>
)}
{rolesPreviews?.length > 0 && (
<>
<Typography variant="h6" mb={2} textAlign="center">
<Box
sx={{ pl: 2, pr: 2, pb: 5, pt: 3, mt: 4 }}
style={{
background: '#FFFFFF',
boxShadow: '0px 20px 40px rgba(80, 80, 80, 0.3)',
borderRadius: '24px',
}}
>
<Typography variant="h4" mb={5} textAlign="center">
{t('content.apprelease.technicalIntegration.rolesPreview')}
</Typography>
<Grid item container xs={12}>
<Grid item mb={5} container xs={12}>
{rolesPreviews?.map((role: string, index) => (
<Grid item xs={6} key={role}>
<div>
<Chip
key={role}
label={role}
withIcon={false}
type="plain"
variant="filled"
color="secondary"
sx={{ mb: 1, ml: 1, mr: 1, mt: 1 }}
<>
<Grid
item
md={6}
xs={12}
key={role}
sx={{
pl: !isMobile && index % 2 === 0 ? 0 : 1,
pr: !isMobile && index % 2 === 0 ? 1 : 0,
}}
>
<CustomAccordion
items={[
{
expanded: false,
id: 'role',
title: '',
titleElement: (
<Chip
key={role}
label={role}
withIcon={false}
type="plain"
variant="filled"
color="secondary"
sx={{ mb: 1, ml: 1, mr: 1, mt: 1 }}
/>
),
color: 'background.background09',
children: (
<Typography variant="caption3">
{rolesDescription && rolesDescription[index]}
</Typography>
),
},
]}
/>
</div>
<Typography variant="caption3">
{rolesDescription && rolesDescription[index]}
</Typography>
</Grid>
</Grid>
</>
))}
</Grid>
</>
)}
<Box textAlign="center">
{/* <Button
{/* <Button
variant="contained"
sx={{ mr: 2, mt: 3 }}
onClick={postRoles}
Expand All @@ -415,26 +459,30 @@ export default function TechnicalIntegration() {
)}
</Button> */}

{rolesPreviews?.length > 0 && (
<LoadingButton
loading={isLoading}
variant="contained"
onButtonClick={postRoles}
sx={{
textAlign: 'center',
marginLeft: 'auto',
marginRight: 'auto',
marginTop: '30px',
}}
loadIndicator={t(
'content.apprelease.technicalIntegration.uploadAppRolesButton'
)}
label={t(
'content.apprelease.technicalIntegration.uploadAppRolesButton'
)}
fullWidth={false}
/>
)}
{rolesPreviews?.length > 0 && (
<LoadingButton
loading={isLoading}
variant="contained"
onButtonClick={postRoles}
sx={{
textAlign: 'center',
marginLeft: 'auto',
marginRight: 'auto',
display: 'flex',
}}
startIcon={<FileUploadOutlinedIcon />}
loadIndicator={t(
'content.apprelease.technicalIntegration.uploadAppRolesButton'
)}
label={t(
'content.apprelease.technicalIntegration.uploadAppRolesButton'
)}
fullWidth={false}
/>
)}
</Box>
)}
<Box textAlign="center">
<Typography variant="h4" mb={4} mt={4}>
{t(
'content.apprelease.technicalIntegration.successfullyUploadedAppRoles'
Expand Down Expand Up @@ -472,6 +520,12 @@ export default function TechnicalIntegration() {
)}
</Box>

{enableErrorMessage && (
<Typography variant="body2" className="file-error-msg">
{t('content.apprelease.technicalIntegration.roleUploadIsMandatory')}
</Typography>
)}

{/* To-Do : the below code will get enhanced again in R.3.1 */}
{/* <Divider className="form-divider" />
<Typography variant="h5" mb={4}>
Expand Down Expand Up @@ -530,7 +584,7 @@ export default function TechnicalIntegration() {
}}
helpUrl={`/documentation/?path=docs%2F04.+App%28s%29%2F02.+App+Release+Process`}
// To-Do : the below code will get enhanced again in R.3.1
// isValid={showUserButton}
isValid={data && data?.length > 0}
/>
</div>
)
Expand Down