Skip to content

Commit

Permalink
feat: added admin permission required message in tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
SagarRajput-7 committed Jun 13, 2024
1 parent d0a5909 commit 9128062
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 13 deletions.
18 changes: 14 additions & 4 deletions frontend/src/container/AllAlertChannels/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { PlusOutlined } from '@ant-design/icons';
import { Typography } from 'antd';
import { Tooltip, Typography } from 'antd';
import getAll from 'api/channels/getAll';
import Spinner from 'components/Spinner';
import TextToolTip from 'components/TextToolTip';
Expand Down Expand Up @@ -52,11 +52,21 @@ function AlertChannels(): JSX.Element {
url="https://signoz.io/docs/userguide/alerts-management/#setting-notification-channel"
/>

{addNewChannelPermission && (
<Button onClick={onToggleHandler} icon={<PlusOutlined />}>
<Tooltip
title={
!addNewChannelPermission
? 'Ask an admin to create alert channel'
: undefined
}
>
<Button
onClick={onToggleHandler}
icon={<PlusOutlined />}
disabled={!addNewChannelPermission}
>
{t('button_new_channel')}
</Button>
)}
</Tooltip>
</RightActionContainer>
</ButtonContainer>

Expand Down
28 changes: 19 additions & 9 deletions frontend/src/container/FormAlertRules/BasicInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ function BasicInfo({
<Tooltip
title={
noChannels
? 'Create a notification channel to configure alert'
? 'No channels. Ask an admin to create a notification channel'
: undefined
}
placement="right"
Expand All @@ -179,7 +179,7 @@ function BasicInfo({
<Tooltip
title={
noChannels
? 'Create a notification channel to configure alert'
? 'No channels. Ask an admin to create a notification channel'
: undefined
}
placement="right"
Expand Down Expand Up @@ -209,14 +209,24 @@ function BasicInfo({
</Tooltip>
)}

{noChannels && addNewChannelPermission && (
<Button
onClick={handleCreateNewChannels}
icon={<PlusOutlined />}
className="create-notification-btn"
{noChannels && (
<Tooltip
title={
!addNewChannelPermission
? 'Ask an admin to create a notification channel'
: undefined
}
placement="right"
>
Create a notification channel
</Button>
<Button
onClick={handleCreateNewChannels}
icon={<PlusOutlined />}
className="create-notification-btn"
disabled={!addNewChannelPermission}
>
Create a notification channel
</Button>
</Tooltip>
)}
</FormContainer>
</>
Expand Down

0 comments on commit 9128062

Please sign in to comment.