-
-
Notifications
You must be signed in to change notification settings - Fork 192
FE: Show connector-level trace when status is FAILED #1319
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
base: main
Are you sure you want to change the base?
FE: Show connector-level trace when status is FAILED #1319
Conversation
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.
Hi mehmetcangulesci! 👋
Welcome, and thank you for opening your first PR in the repo!
Please wait for triaging by our maintainers.
Please take a look at our contributing guide.
3a324b3
to
5425423
Compare
@@ -0,0 +1,81 @@ | |||
import styled, { css } from 'styled-components'; | |||
|
|||
export const ModalOverlay = styled.div` |
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.
Maybe you could create reusable component Modal
in components/common
?
You are already have everything to do it and I think that there will be a lot of another cases where kafbat/ui
will need Modal
component.
const hasTraceInfo = connector.status.trace; | ||
|
||
const handleStateClick = () => { | ||
if (connector.status.state === ConnectorState.FAILED && hasTraceInfo) { |
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.
Looks like will be better to move this condition into separate helper. Something like
const canShowTrace = (connector: Connector) => connector.status.state === ConnectorState.FAILED && !!connector.status.trace;
const hasTraceInfo = connector.status.trace; | ||
|
||
const handleStateClick = () => { | ||
if (connector.status.state === ConnectorState.FAILED && hasTraceInfo) { |
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.
Looks like will be better to move this condition into separate helper. Something like
const canShowTrace = (connector: Connector) =>
connector.status.state === ConnectorState.FAILED && !!connector.status.trace;
And use it here firstly
const handleStateClick = () => {
if (canShowTrace(connector)) {
setShowTraceModal(true);
}
};
style={{ | ||
cursor: | ||
connector.status.state === ConnectorState.FAILED && | ||
hasTraceInfo | ||
? 'pointer' | ||
: 'default', | ||
}} |
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.
And here instead of inline style - create an optional prop clickable
for C.Tag
where you will manage cursor styles.
<C.Tag
color={getTagColor(connector.status.state)}
clickable={canShowTrace(connector)}
onClick={handleStateClick}
>
{connector.status.state}
</C.Tag>
<S.TraceContent> | ||
{connector.status.trace ? ( | ||
<div>{connector.status.trace}</div> | ||
) : null} | ||
</S.TraceContent> |
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.
<S.TraceContent> | |
{connector.status.trace ? ( | |
<div>{connector.status.trace}</div> | |
) : null} | |
</S.TraceContent> | |
{connector.status.trace ? ( | |
<S.TraceContent> | |
<div>{connector.status.trace}</div> | |
</S.TraceContent> | |
) : null} |
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.
Hi, @mehmetcangulesci !
Thank you for contributing! I have add few comments, please, check it out
What changes did you make? (Give an overview)
Implemented the feature request #1318
Is there anything you'd like reviewers to focus on?
How Has This Been Tested? (put an "x" (case-sensitive!) next to an item)
Checklist (put an "x" (case-sensitive!) next to all the items, otherwise the build will fail)
Check out Contributing and Code of Conduct
A picture of a cute animal (not mandatory but encouraged)