@@ -39,6 +39,7 @@ import { MicrosoftTeamsSettings } from './components/MicrosoftTeamsSettings';
3939import { CustomWebhookSettings } from './components/CustomWebhookSettings' ;
4040import { EmailSettings } from './components/EmailSettings' ;
4141import { SlackSettings } from './components/SlackSettings' ;
42+ import { MattermostSettings } from './components/MattermostSettings' ;
4243import { SNSSettings } from './components/SNSSettings' ;
4344import {
4445 constructEmailObject ,
@@ -95,6 +96,7 @@ export function CreateChannel(props: CreateChannelsProps) {
9596 const [ channelType , setChannelType ] = useState ( channelTypeOptions [ 0 ] . value ) ;
9697
9798 const [ slackWebhook , setSlackWebhook ] = useState ( '' ) ;
99+ const [ mattermostWebhook , setMattermostWebhook ] = useState ( '' ) ;
98100 const [ chimeWebhook , setChimeWebhook ] = useState ( '' ) ;
99101 const [ microsoftTeamsWebhook , setMicrosoftTeamsWebhook ] = useState ( '' ) ;
100102
@@ -130,6 +132,7 @@ export function CreateChannel(props: CreateChannelsProps) {
130132 const [ inputErrors , setInputErrors ] = useState < InputErrorsType > ( {
131133 name : [ ] ,
132134 slackWebhook : [ ] ,
135+ mattermostWebhook : [ ] ,
133136 chimeWebhook : [ ] ,
134137 microsoftTeamsWebhook : [ ] ,
135138 smtpSender : [ ] ,
@@ -197,6 +200,8 @@ export function CreateChannel(props: CreateChannelsProps) {
197200
198201 if ( type === BACKEND_CHANNEL_TYPE . SLACK ) {
199202 setSlackWebhook ( response . slack ?. url || '' ) ;
203+ } else if ( type === BACKEND_CHANNEL_TYPE . MATTERMOST ) {
204+ setMattermostWebhook ( response . mattermost ?. url || '' ) ;
200205 } else if ( type === BACKEND_CHANNEL_TYPE . CHIME ) {
201206 setChimeWebhook ( response . chime ?. url || '' ) ;
202207 } else if ( type === BACKEND_CHANNEL_TYPE . MICROSOFT_TEAMS ) {
@@ -249,6 +254,8 @@ export function CreateChannel(props: CreateChannelsProps) {
249254 } ;
250255 if ( channelType === BACKEND_CHANNEL_TYPE . SLACK ) {
251256 errors . slackWebhook = validateWebhookURL ( slackWebhook ) ;
257+ } else if ( channelType === BACKEND_CHANNEL_TYPE . MATTERMOST ) {
258+ errors . mattermostWebhook = validateWebhookURL ( mattermostWebhook ) ;
252259 } else if ( channelType === BACKEND_CHANNEL_TYPE . CHIME ) {
253260 errors . chimeWebhook = validateWebhookURL ( chimeWebhook ) ;
254261 } else if ( channelType === BACKEND_CHANNEL_TYPE . MICROSOFT_TEAMS ) {
@@ -288,6 +295,8 @@ export function CreateChannel(props: CreateChannelsProps) {
288295 } ;
289296 if ( channelType === BACKEND_CHANNEL_TYPE . SLACK ) {
290297 config . slack = { url : slackWebhook } ;
298+ } else if ( channelType === BACKEND_CHANNEL_TYPE . MATTERMOST ) {
299+ config . mattermost = { url : mattermostWebhook } ;
291300 } else if ( channelType === BACKEND_CHANNEL_TYPE . CHIME ) {
292301 config . chime = { url : chimeWebhook } ;
293302 } else if ( channelType === BACKEND_CHANNEL_TYPE . MICROSOFT_TEAMS ) {
@@ -422,6 +431,11 @@ export function CreateChannel(props: CreateChannelsProps) {
422431 slackWebhook = { slackWebhook }
423432 setSlackWebhook = { setSlackWebhook }
424433 />
434+ ) : channelType === BACKEND_CHANNEL_TYPE . MATTERMOST ? (
435+ < MattermostSettings
436+ mattermostWebhook = { mattermostWebhook }
437+ setMattermostWebhook = { setMattermostWebhook }
438+ />
425439 ) : channelType === BACKEND_CHANNEL_TYPE . CHIME ? (
426440 < ChimeSettings
427441 chimeWebhook = { chimeWebhook }
0 commit comments