Skip to content

Commit

Permalink
Conditionally render tooltip for Edit alert button (#7054)
Browse files Browse the repository at this point in the history
* Made Edit alert tooltip render conditionally
  • Loading branch information
ezraodio1 authored Jul 18, 2024
1 parent ebb0e2c commit 8fc4ce1
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions client/app/pages/alert/AlertView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,23 @@ export default class AlertView extends React.Component {
<>
<Title name={name} alert={alert}>
<DynamicComponent name="AlertView.HeaderExtra" alert={alert} />
<Tooltip title={canEdit ? "" : "You do not have sufficient permissions to edit this alert"}>
<Button type="default" onClick={canEdit ? onEdit : null} className={cx({ disabled: !canEdit })}>
<i className="fa fa-edit m-r-5" aria-hidden="true" />
Edit
</Button>
{menuButton}
</Tooltip>
{canEdit ? (
<>
<Button type="default" onClick={canEdit ? onEdit : null} className={cx({ disabled: !canEdit })}>
<i className="fa fa-edit m-r-5" aria-hidden="true" />
Edit
</Button>
{menuButton}
</>
) : (
<Tooltip title="You do not have sufficient permissions to edit this alert">
<Button type="default" onClick={canEdit ? onEdit : null} className={cx({ disabled: !canEdit })}>
<i className="fa fa-edit m-r-5" aria-hidden="true" />
Edit
</Button>
{menuButton}
</Tooltip>
)}
</Title>
<div className="bg-white tiled p-20">
<Grid.Row type="flex" gutter={16}>
Expand Down

0 comments on commit 8fc4ce1

Please sign in to comment.