alerting for gateways and relays

This commit is contained in:
x032205
2025-10-08 23:46:47 -04:00
parent 12b59fc2c0
commit c6696d4fde
12 changed files with 365 additions and 18 deletions
@@ -0,0 +1,41 @@
import { Heading, Section, Text } from "@react-email/components";
import { BaseEmailWrapper, BaseEmailWrapperProps } from "./BaseEmailWrapper";
import { BaseLink } from "./BaseLink";
interface HealthAlertTemplateProps extends Omit<BaseEmailWrapperProps, "title" | "preview" | "children"> {
type: "gateway" | "relay";
names: string;
}
export const HealthAlertTemplate = ({ siteUrl, names, type }: HealthAlertTemplateProps) => {
return (
<BaseEmailWrapper
title={`${type === "gateway" ? "Gateway" : "Relay"} Health Alert`}
preview={`Some ${type}s in your organization have failed their health check.`}
siteUrl={siteUrl}
>
<Heading className="text-black text-[18px] leading-[28px] text-center font-normal p-0 mx-0">
{type === "gateway" ? "Gateway" : "Relay"} Health Alert
</Heading>
<Section className="px-[24px] mt-[36px] pt-[12px] pb-[8px] border border-solid border-gray-200 rounded-md bg-gray-50">
<Text className="text-black text-[14px] leading-[24px]">
The following <strong>{type}</strong>(s) in your organization may be offline as they haven't reported a
heartbeat in over an hour: <strong>{names}</strong>.
</Text>
<Text className="text-black text-[14px] leading-[24px]">
If your issue persists, you can contact the Infisical team at{" "}
<BaseLink href="mailto:[email protected]">[email protected]</BaseLink>.
</Text>
</Section>
</BaseEmailWrapper>
);
};
export default HealthAlertTemplate;
HealthAlertTemplate.PreviewProps = {
type: "gateway",
names: '"gateway1", "gateway2"',
siteUrl: "https://infisical.com"
} as HealthAlertTemplateProps;
@@ -6,6 +6,7 @@ export * from "./EmailVerificationTemplate";
export * from "./ExternalImportFailedTemplate";
export * from "./ExternalImportStartedTemplate";
export * from "./ExternalImportSucceededTemplate";
export * from "./HealthAlertTemplate";
export * from "./IntegrationSyncFailedTemplate";
export * from "./NewDeviceLoginTemplate";
export * from "./OAuthPasswordResetTemplate";
+5 -2
View File
@@ -15,6 +15,7 @@ import {
ExternalImportFailedTemplate,
ExternalImportStartedTemplate,
ExternalImportSucceededTemplate,
HealthAlertTemplate,
IntegrationSyncFailedTemplate,
NewDeviceLoginTemplate,
OAuthPasswordResetTemplate,
@@ -85,7 +86,8 @@ export enum SmtpTemplates {
ServiceTokenExpired = "serviceTokenExpired",
SecretScanningV2ScanFailed = "secretScanningV2ScanFailed",
SecretScanningV2SecretsDetected = "secretScanningV2SecretsDetected",
AccountDeletionConfirmation = "accountDeletionConfirmation"
AccountDeletionConfirmation = "accountDeletionConfirmation",
HealthAlert = "healthAlert"
}
export enum SmtpHost {
@@ -131,7 +133,8 @@ const EmailTemplateMap: Record<SmtpTemplates, React.FC<any>> = {
[SmtpTemplates.PkiExpirationAlert]: PkiExpirationAlertTemplate,
[SmtpTemplates.SecretScanningV2ScanFailed]: SecretScanningScanFailedTemplate,
[SmtpTemplates.SecretScanningV2SecretsDetected]: SecretScanningSecretsDetectedTemplate,
[SmtpTemplates.AccountDeletionConfirmation]: AccountDeletionConfirmationTemplate
[SmtpTemplates.AccountDeletionConfirmation]: AccountDeletionConfirmationTemplate,
[SmtpTemplates.HealthAlert]: HealthAlertTemplate
};
export const smtpServiceFactory = (cfg: TSmtpConfig) => {