From 8fc4ce14941fd92ed5447e6ab5d98cba9e02ae48 Mon Sep 17 00:00:00 2001 From: Ezra Odio <97199317+ezraodio1@users.noreply.github.com> Date: Thu, 18 Jul 2024 10:31:31 -0400 Subject: [PATCH] Conditionally render tooltip for Edit alert button (#7054) * Made Edit alert tooltip render conditionally --- client/app/pages/alert/AlertView.jsx | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/client/app/pages/alert/AlertView.jsx b/client/app/pages/alert/AlertView.jsx index 0bf98d9ba1..c128140b56 100644 --- a/client/app/pages/alert/AlertView.jsx +++ b/client/app/pages/alert/AlertView.jsx @@ -68,13 +68,23 @@ export default class AlertView extends React.Component { <> <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> + )}