Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(notification/telegram): add telegram notification #19135

Merged
merged 5 commits into from
Aug 12, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
chore: apply review comments
  • Loading branch information
sranka committed Aug 12, 2020
commit 039d730a1c4b7f48f195996e2ebdc8dbb65c305b
20 changes: 9 additions & 11 deletions ui/src/notifications/endpoints/components/EndpointTypeDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@ interface EndpointType {
id: NotificationEndpointType
type: NotificationEndpointType
name: string
flag?: string // feature flag that enable/disable endpoint type
}

function isFlaggedOn(type: string) {
if (type === 'telegram') {
return isFlagEnabled('notification-endpoint-telegram')
}
return true
}

interface StateProps {
Expand All @@ -34,12 +40,7 @@ const types: EndpointType[] = [
{name: 'HTTP', type: 'http', id: 'http'},
{name: 'Slack', type: 'slack', id: 'slack'},
{name: 'Pagerduty', type: 'pagerduty', id: 'pagerduty'},
{
name: 'Telegram',
type: 'telegram',
id: 'telegram',
flag: 'notification-endpoint-telegram',
},
{name: 'Telegram', type: 'telegram', id: 'telegram'},
]

const EndpointTypeDropdown: FC<Props> = ({
Expand All @@ -48,10 +49,7 @@ const EndpointTypeDropdown: FC<Props> = ({
blockedEndpoints,
}) => {
sranka marked this conversation as resolved.
Show resolved Hide resolved
const items = types
.filter(
({type, flag}) =>
!blockedEndpoints.includes(type) && (!flag || isFlagEnabled(flag))
)
.filter(({type}) => !blockedEndpoints.includes(type) && isFlaggedOn(type))
.map(({id, type, name}) => (
<Dropdown.Item
key={id}
Expand Down