-
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
fix(company data): extended error handling #958
Conversation
…fo in the details overlay
…fix alternative address issue
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.
simplify if-return-else-return... chains
return 'warning' | ||
} else if (status === SharingStateStatusType.Pending) { |
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
if (a) {
return x
} else if (b) {
return y
} else {
return z
}
simply write
if (a)
return x
if (b)
return y
return z
} 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 comment
The reason will be displayed to describe this comment to others. Learn more.
again else after return
@manojava-gk could you please check the comment from @oyo |
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.
change mapping function to map like we did in other PRs
else if (status === SharingStateStatusType.Initial) return 'warning' | ||
else if (status === SharingStateStatusType.Pending) return 'info' | ||
else if (status === SharingStateStatusType.Ready) return 'primary' | ||
return 'error' |
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.
In discussion with Lavanya we came up with a solution using a map instead of a function, which is more elegant imho. Can you please have a look and implement accordingly:
https://github.com/eclipse-tractusx/portal-frontend/pull/967/files#diff-ef36c5be86b0e58f10f5281ace1652ca5c2a443d542d2336fd3b0fd28f945de7R101
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.
I have already used this type of mapping just above this method.
const statusColor: Record<string, 'default' | 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning'> = {
Success: 'success',
Pending: 'info',
Ready: 'primary',
Initial: 'warning',
Error: 'error'
}
Could you pls verify the above one?
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.
I haven't seen that in your code - now I updated your PR with a shared map to get the colors from status types using proper types instead of strings
Quality Gate passedIssues Measures |
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.
lgtm after PR update
Description
Why
new request
Issue
#955 #941
Checklist
Please delete options that are not relevant.