-
Notifications
You must be signed in to change notification settings - Fork 37
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
fix(company data): extended error handling #958
Merged
oyo
merged 12 commits into
eclipse-tractusx:main
from
manojava-gk:issues/fix-941-companydata-sharing-state-error
Aug 12, 2024
Merged
Changes from 8 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
2e87bf7
fix(company data): initegrate /ready api. show sharing state error in…
manojava-gk 8e072b9
fix(compant data): notes
manojava-gk 79dab87
fix(chor): sonar cloud issue
manojava-gk 81db3cd
fix(company data): show different type of chip for different states. …
manojava-gk 1811619
fix(company data): fix issues related to request body
manojava-gk ad0b774
Merge branch 'main' into issues/fix-941-companydata-sharing-state-error
manojava-gk 036ead9
fix(chor): new dependency file
manojava-gk 8bb7fb0
fix(chor): new dependency file
manojava-gk 79332a2
fix(company data): simplify if else statement
manojava-gk 3a3a2e8
fix(coding): use map instead of mapping function
oyo cd0bf97
fix(coding): add shared status color map
oyo c58f660
fix(coding): add shared status color map
oyo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,9 +25,16 @@ import { useSelector } from 'react-redux' | |
import HourglassBottomIcon from '@mui/icons-material/HourglassBottom' | ||
import WarningAmberIcon from '@mui/icons-material/WarningAmber' | ||
import CheckCircleIcon from '@mui/icons-material/CheckCircle' | ||
import { SharingStateStatusType } from 'features/companyData/companyDataApiSlice' | ||
import { | ||
SharingStateStatusType, | ||
type SharingStateType, | ||
} from 'features/companyData/companyDataApiSlice' | ||
|
||
export default function StatusInformation() { | ||
export default function StatusInformation({ | ||
error, | ||
}: { | ||
readonly error?: SharingStateType | ||
}) { | ||
const { t } = useTranslation() | ||
const status = useSelector(statusSelector) | ||
|
||
|
@@ -42,58 +49,99 @@ export default function StatusInformation() { | |
const getStatusColor = (status: string | undefined) => { | ||
if (status === SharingStateStatusType.Success) { | ||
return 'success' | ||
} else if ( | ||
status === SharingStateStatusType.Pending || | ||
status === SharingStateStatusType.Initial | ||
) { | ||
} else if (status === SharingStateStatusType.Initial) { | ||
return 'warning' | ||
} else if (status === SharingStateStatusType.Pending) { | ||
return 'info' | ||
} else if (status === SharingStateStatusType.Ready) { | ||
return 'primary' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. again else after return |
||
} else { | ||
return 'error' | ||
} | ||
} | ||
|
||
return ( | ||
<Box | ||
sx={{ | ||
display: 'flex', | ||
justifyContent: 'flex-start', | ||
alignItems: 'flex-start', | ||
marginBottom: '50px', | ||
padding: '0px 10%', | ||
marginTop: '50px', | ||
}} | ||
> | ||
<Typography | ||
variant="body1" | ||
sx={{ | ||
fontSize: '18px', | ||
width: '200px', | ||
}} | ||
> | ||
{t('content.companyData.statusInfo.title')} | ||
</Typography> | ||
<> | ||
<Box | ||
sx={{ | ||
display: 'flex', | ||
alignItems: 'center', | ||
marginLeft: '20%', | ||
justifyContent: 'flex-start', | ||
alignItems: 'flex-start', | ||
marginBottom: '50px', | ||
padding: '0px 10%', | ||
marginTop: '50px', | ||
}} | ||
> | ||
<Chip | ||
icon={statusIcon[status]} | ||
color={getStatusColor(status)} | ||
variant="filled" | ||
label={status} | ||
size="medium" | ||
withIcon={true} | ||
<Typography | ||
variant="body1" | ||
sx={{ | ||
marginRight: '0 !important', | ||
margin: '0 auto', | ||
width: '100px', | ||
maxWidth: '100px', | ||
fontSize: '18px', | ||
width: '200px', | ||
}} | ||
/> | ||
> | ||
{t('content.companyData.statusInfo.title')} | ||
</Typography> | ||
<Box | ||
sx={{ | ||
display: 'flex', | ||
alignItems: 'center', | ||
marginLeft: '20%', | ||
flexDirection: 'column', | ||
}} | ||
> | ||
<Chip | ||
icon={statusIcon[status]} | ||
color={getStatusColor(status)} | ||
variant="filled" | ||
label={status} | ||
size="medium" | ||
withIcon={true} | ||
sx={{ | ||
marginRight: '0 !important', | ||
margin: '0 auto', | ||
width: '100px', | ||
maxWidth: '100px', | ||
}} | ||
/> | ||
</Box> | ||
</Box> | ||
</Box> | ||
{error && ( | ||
<Box | ||
sx={{ | ||
display: 'flex', | ||
justifyContent: 'flex-start', | ||
alignItems: 'flex-start', | ||
marginBottom: '50px', | ||
padding: '0px 10%', | ||
marginTop: '50px', | ||
}} | ||
> | ||
<Box | ||
sx={{ | ||
width: '200px', | ||
}} | ||
></Box> | ||
<Box | ||
sx={{ | ||
display: 'flex', | ||
alignItems: 'center', | ||
marginLeft: '20%', | ||
flexDirection: 'column', | ||
}} | ||
> | ||
<Typography | ||
variant="body1" | ||
sx={{ | ||
fontSize: '18px', | ||
width: '200px', | ||
color: '#d32f2f', | ||
}} | ||
> | ||
{error.sharingErrorMessage} | ||
</Typography> | ||
</Box> | ||
</Box> | ||
)} | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it has been in the code before but we don't need
else
in cases where the previous code will return 100% sure.instead of
simply write