Skip to content

Commit 8fc4ce1

Browse files
authored
Conditionally render tooltip for Edit alert button (#7054)
* Made Edit alert tooltip render conditionally
1 parent ebb0e2c commit 8fc4ce1

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

client/app/pages/alert/AlertView.jsx

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,23 @@ export default class AlertView extends React.Component {
6868
<>
6969
<Title name={name} alert={alert}>
7070
<DynamicComponent name="AlertView.HeaderExtra" alert={alert} />
71-
<Tooltip title={canEdit ? "" : "You do not have sufficient permissions to edit this alert"}>
72-
<Button type="default" onClick={canEdit ? onEdit : null} className={cx({ disabled: !canEdit })}>
73-
<i className="fa fa-edit m-r-5" aria-hidden="true" />
74-
Edit
75-
</Button>
76-
{menuButton}
77-
</Tooltip>
71+
{canEdit ? (
72+
<>
73+
<Button type="default" onClick={canEdit ? onEdit : null} className={cx({ disabled: !canEdit })}>
74+
<i className="fa fa-edit m-r-5" aria-hidden="true" />
75+
Edit
76+
</Button>
77+
{menuButton}
78+
</>
79+
) : (
80+
<Tooltip title="You do not have sufficient permissions to edit this alert">
81+
<Button type="default" onClick={canEdit ? onEdit : null} className={cx({ disabled: !canEdit })}>
82+
<i className="fa fa-edit m-r-5" aria-hidden="true" />
83+
Edit
84+
</Button>
85+
{menuButton}
86+
</Tooltip>
87+
)}
7888
</Title>
7989
<div className="bg-white tiled p-20">
8090
<Grid.Row type="flex" gutter={16}>

0 commit comments

Comments
 (0)