chore: apply review comments

pull/19135/head
Pavel Zavora 2020-08-12 13:07:37 +02:00
parent 3bb7cc575c
commit 039d730a1c
1 changed files with 9 additions and 11 deletions

View File

@ -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 {
@ -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> = ({
@ -48,10 +49,7 @@ const EndpointTypeDropdown: FC<Props> = ({
blockedEndpoints,
}) => {
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}