Skip to content

Commit

Permalink
fix(UI): reaction list display break when reaction status not standard
Browse files Browse the repository at this point in the history
Rendering of Overlay component break UI when a reaction status goes to the switch default case.

For example on shared reaction with limited permission (reaction.status = "***")

Refs: ComPlat#1592
  • Loading branch information
phuang26 authored Oct 24, 2023
1 parent 2659436 commit 7bd6a5d
Showing 1 changed file with 16 additions and 21 deletions.
37 changes: 16 additions & 21 deletions app/packs/src/apps/mydb/elements/list/ElementsTableEntries.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,17 @@ export function reactionStatus(element) {
</Tooltip>
);

let icon = null;
const overlay = (_icons) => (
<OverlayTrigger placement="top" overlay={tooltip}>
{_icons}
</OverlayTrigger>
);

switch (element.status) {
case 'Planned':
icon = <i className="fa fa-clock-o c-bs-warning" />;
break;
case 'Running':
icon = (
return overlay(<i className="fa fa-clock-o c-bs-warning" />);
case 'Running': {
const icon = (
<span
style={{ width: '12px', height: '14px', lineHeight: '14px' }}
className="fa fa-stack"
Expand All @@ -122,28 +126,19 @@ export function reactionStatus(element) {
<i className="fa fa-stack-1x fa-hourglass-3 running-3 c-bs-warning" />
</span>
);
break;
return overlay(icon);
}
case 'Done':
icon = <i className="fa fa-hourglass-3 c-bs-primary" />;
break;
return overlay(<i className="fa fa-hourglass-3 c-bs-primary" />);
case 'Analyses Pending':
icon = <i className="fa fa-ellipsis-h c-bs-primary" />;
break;
return overlay(<i className="fa fa-ellipsis-h c-bs-primary" />);
case 'Successful':
icon = <i className="fa fa-check-circle-o c-bs-success" />;
break;
return overlay(<i className="fa fa-check-circle-o c-bs-success" />);
case 'Not Successful':
icon = <i className="fa fa-times-circle-o c-bs-danger" />;
break;
return overlay(<i className="fa fa-times-circle-o c-bs-danger" />);
default:
break;
return null;
}

return (
<OverlayTrigger placement="top" overlay={tooltip}>
{icon}
</OverlayTrigger>
);
}

return null;
Expand Down

0 comments on commit 7bd6a5d

Please sign in to comment.