change(ui): change teams alert msg
This commit is contained in:
parent
62b4e22ff3
commit
bf59ae84b9
2 changed files with 21 additions and 3 deletions
|
|
@ -306,10 +306,10 @@ const AlertForm = (props) => {
|
|||
<div className="w-4/6">
|
||||
<DropdownChips
|
||||
fluid
|
||||
selected={instance.msTeamsInput}
|
||||
selected={instance.msteamsInput}
|
||||
options={msTeamsChannels}
|
||||
placeholder="Select Channel"
|
||||
onChange={(selected) => props.edit({ msTeamsInput: selected })}
|
||||
onChange={(selected) => props.edit({ msteamsInput: selected })}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -36,13 +36,31 @@ const getNotifyChannel = (alert: Record<string, any>, webhooks: Array<any>) => {
|
|||
')'
|
||||
);
|
||||
};
|
||||
const getMsTeamsChannels = () => {
|
||||
return (
|
||||
' (' +
|
||||
alert.msteamsInput
|
||||
.map((channelId: number) => {
|
||||
return (
|
||||
webhooks.find((hook) => hook.webhookId === channelId && hook.type === 'msteams')?.name
|
||||
);
|
||||
})
|
||||
.join(', ') +
|
||||
')'
|
||||
);
|
||||
};
|
||||
let str = '';
|
||||
if (alert.slack) {
|
||||
str = 'Slack';
|
||||
str += alert.slackInput.length > 0 ? getSlackChannels() : '';
|
||||
if (alert.slackInput.length > 0) {
|
||||
str += getSlackChannels();
|
||||
}
|
||||
}
|
||||
if (alert.msteams) {
|
||||
str = 'MS Teams'
|
||||
if (alert.msteamsInput.length > 0) {
|
||||
str += getMsTeamsChannels();
|
||||
}
|
||||
}
|
||||
if (alert.email) {
|
||||
str += (str === '' ? '' : ' and ') + (alert.emailInput.length > 1 ? 'Emails' : 'Email');
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue