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

[MM-1025]: Fixed the infinite loading state of tooltip modal #88

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
25 changes: 23 additions & 2 deletions webapp/src/components/jira_ticket_tooltip/jira_ticket_tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export type Props = {
export type State = {
ticketId: string;
ticketDetails?: TicketDetails | null;
error: string | null;
};

const isAssignedLabel = ' is assigned';
Expand Down Expand Up @@ -46,6 +47,7 @@ export default class TicketPopover extends React.PureComponent<Props, State> {

this.state = {
ticketId: ticketID,
error: null,
};
}

Expand Down Expand Up @@ -86,11 +88,16 @@ export default class TicketPopover extends React.PureComponent<Props, State> {
const {instanceID} = issueKey;
const {ticketId, ticketDetails} = this.state;
if (!ticketDetails && this.props.show && ticketId) {
this.props.fetchIssueByKey(this.state.ticketId, instanceID).then((res: {data?: TicketData}) => {
this.props.fetchIssueByKey(this.state.ticketId, instanceID).then((res: { data?: TicketData; error?: any}) => {
if (res.error) {
this.setState({error: 'There was a problem loading the details for this Jira link'});
return;
}
const updatedTicketDetails = getJiraTicketDetails(res.data);
if (this.props.connected && updatedTicketDetails && updatedTicketDetails.ticketId === ticketId) {
this.setState({
ticketDetails: updatedTicketDetails,
error: null,
});
}
});
Expand Down Expand Up @@ -166,7 +173,21 @@ export default class TicketPopover extends React.PureComponent<Props, State> {
return null;
}

const {ticketDetails} = this.state;
const {ticketDetails, error} = this.state;
if (error) {
return (
<div className='jira-issue-tooltip jira-issue-tooltip-error'>
<span
className='jira-issue-error-icon fa fa-exclamation-triangle'
Kshitij-Katiyar marked this conversation as resolved.
Show resolved Hide resolved
style={{color: 'red'}}
title={'Hazard Icon'}
/>
<div className='jira-issue-error-message'>{error}</div>
<p className='jira-issue-error-footer'>{'Check your connection or try again later'}</p>
</div>
);
}

if (!ticketDetails) {
// Display the spinner loader while ticket details are being fetched
return (
Expand Down
19 changes: 19 additions & 0 deletions webapp/src/components/jira_ticket_tooltip/ticketStyle.scss
Original file line number Diff line number Diff line change
Expand Up @@ -231,3 +231,22 @@
opacity: 0.72;
}
}

.jira-issue-tooltip-error {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add some padding

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also get this CSS reviewed from @avas27JTG

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @avas27JTG, can you please review these css

height: 210px;
font-size: 28px;
display: flex;
flex-direction: column;
justify-content: center;
gap: 10px;

.jira-issue-error-message {
font-size: 19px;
text-align: center;
}

.jira-issue-error-footer {
font-size: 13px;
font-weight: 100;
}
}
Loading