2024-03-04 21:24:26 +00:00
import React from "react" ;
import { syntaxHighlight } from "utilities/helpers" ;
import Button from "components/buttons/Button" ;
import Modal from "components/Modal" ;
const baseClass = "host-status-webhook-preview-modal" ;
const getHostStatusPreview = ( teamScope? : boolean ) = > {
const data = {
unseen_hosts : 1 ,
total_hosts : 2 ,
days_unseen : 3 ,
team_id : 123 ,
} as Record < string , number > ;
if ( ! teamScope ) {
delete data . team_id ;
}
return {
text :
2026-04-14 13:30:26 +00:00
"More than X% of your hosts have not checked into Fleet for more than Y days. You've been sent this message because the Host status webhook is enabled in your Fleet instance." ,
2024-03-04 21:24:26 +00:00
data ,
} ;
} ;
interface IHostStatusWebhookPreviewModal {
isTeamScope? : boolean ;
toggleModal : ( ) = > void ;
}
const HostStatusWebhookPreviewModal = ( {
isTeamScope = false ,
toggleModal ,
} : IHostStatusWebhookPreviewModal ) = > {
return (
< Modal
title = "Host status webhook"
onExit = { toggleModal }
2024-10-16 15:24:08 +00:00
onEnter = { toggleModal }
2024-03-04 21:24:26 +00:00
className = { baseClass }
>
2026-03-10 22:30:55 +00:00
< p >
An example request sent to your configured < b > Destination URL < / b > .
< / p >
< div className = { baseClass } >
< pre
dangerouslySetInnerHTML = { {
__html : syntaxHighlight ( getHostStatusPreview ( isTeamScope ) ) ,
} }
/ >
< / div >
< div className = "modal-cta-wrap" >
< Button type = "button" onClick = { toggleModal } >
2026-03-23 15:59:18 +00:00
Close
2026-03-10 22:30:55 +00:00
< / Button >
< / div >
2024-03-04 21:24:26 +00:00
< / Modal >
) ;
} ;
export default HostStatusWebhookPreviewModal ;