diff --git a/emails/_common/watcloud-email.tsx b/emails/_common/watcloud-email.tsx index 0d95302..a31e3c2 100644 --- a/emails/_common/watcloud-email.tsx +++ b/emails/_common/watcloud-email.tsx @@ -11,7 +11,7 @@ import { getAsset, registerAsset, WATcloudURI } from "../../utils/watcloud-uri"; registerAsset('watcloud-logo', new WATcloudURI("watcloud://v1/sha256:393767e36d5387815c15d11c506c3c820de5db41723ffc062751673621dedb15?name=1024x512%20black%401x.png")) // Wrapper for WATcloud-themed emails -export function Email({ +export function WATcloudEmail({ previewText, children, }: { diff --git a/emails/blog-update.tsx b/emails/blog-update.tsx index e2f7ac8..674bcbe 100644 --- a/emails/blog-update.tsx +++ b/emails/blog-update.tsx @@ -8,7 +8,7 @@ import { } from "@react-email/components"; import { z } from "zod"; import { getAsset, registerAsset, WATcloudURI } from "../utils/watcloud-uri"; -import { Email } from "./_common/watcloud-email"; +import { WATcloudEmail } from "./_common/watcloud-email"; const WATcloudBlogUpdateEmailProps = z.object({ url: z.string().url(), @@ -37,7 +37,7 @@ export function WATcloudBlogUpdateEmail(props: WATcloudBlogUpdateEmailProps) { const imageSrc = getAsset(image).resolveFromCache(); return ( - + Hello! WATcloud has published a new blog post.
{title} @@ -51,7 +51,7 @@ export function WATcloudBlogUpdateEmail(props: WATcloudBlogUpdateEmailProps) { Read more →
You are receiving this email because you are subscribed to the WATcloud blog. -
+ ); }; diff --git a/emails/file-expiry.tsx b/emails/file-expiry.tsx index 398de3b..d9b26f4 100644 --- a/emails/file-expiry.tsx +++ b/emails/file-expiry.tsx @@ -5,7 +5,7 @@ import { Text } from "@react-email/components"; import { z } from "zod"; -import { Email } from "./_common/watcloud-email"; +import { WATcloudEmail } from "./_common/watcloud-email"; const EmailProps = z.object({ name: z.string(), @@ -16,56 +16,23 @@ const EmailProps = z.object({ type EmailProps = z.infer; -export const FileExpiryEmail = (props: EmailProps) => { +const Email = (props: EmailProps) => { const { name, paths, daysForExpiry, deletionDate} = EmailProps.parse(props); const previewText = `You have expired files in the WATO drives`; - const mapPathToMachine = (): Record => { - const pathMap: Record = {}; - - paths.forEach((path: string) => { - const index = path.indexOf(":"); - let machine = ""; - let filepath = ""; - - if (index < 0) { - machine = "Shared storage across machines - Access on any machine"; - filepath = path; - } else { - [machine, filepath] = path.split(":", 2); - } - - // Initialize array for machine if it doesn't exist, then push the filepath - if (!pathMap[machine]) { - pathMap[machine] = []; - } - pathMap[machine].push(filepath); - }); - - return pathMap; // Return the pathMap object - }; - - const pathMap = mapPathToMachine(); const expiredPaths = (
- {Object.keys(pathMap).map((machine) => ( -
-
    -
  • {machine}
  • -
      - {pathMap[machine]?.map((path, pathIndex) => ( -
    • {path}
    • - ))} -
    -
-
- ))} +
    + {paths.map(path => ( +
  • {path}
  • + ))} +
); return ( - + Hi {name}, In an ongoing effort to keep WATcloud's file storage efficient and maintain optimal performance, we routinely clean up specific directories that haven't been accessed in the past {daysForExpiry} days. @@ -80,15 +47,15 @@ export const FileExpiryEmail = (props: EmailProps) => { If you have any questions, please reach out to your WATcloud contact or the WATcloud team at infra-outreach@watonomous.ca. - + ); }; -FileExpiryEmail.PreviewProps = { +Email.PreviewProps = { name: "John Doe", - paths: ["delta-ubuntu2:/var/lib/cluster/users/1234/docker", "tr-ubuntu3:/var/lib/cluster/users/1234/containers", "delta-ubuntu2:/var/lib/cluster/users/1234/containers", "/mnt/wato-drive2/someuser", "/mnt/wato-drive2/other"], + paths: ["delta-ubuntu2:/var/lib/cluster/users/1234/docker", "delta-ubuntu2:/var/lib/cluster/users/1234/containers", "tr-ubuntu3:/var/lib/cluster/users/1234/containers","/mnt/wato-drive2/someuser", "/mnt/wato-drive2/other"], daysForExpiry: "70", deletionDate: "2025-01-01" } as EmailProps; -export default FileExpiryEmail; \ No newline at end of file +export default Email; \ No newline at end of file diff --git a/emails/onboarding.tsx b/emails/onboarding.tsx index ab31165..db136e0 100644 --- a/emails/onboarding.tsx +++ b/emails/onboarding.tsx @@ -6,7 +6,7 @@ import { } from "@react-email/components"; import dedent from "dedent-js"; import { z } from "zod"; -import { Email } from "./_common/watcloud-email"; +import { WATcloudEmail } from "./_common/watcloud-email"; const WATcloudOnboardingEmailProps = z.object({ name: z.string(), @@ -28,7 +28,7 @@ export const WATcloudOnboardingEmail = (props: WATcloudOnboardingEmailProps) => ) return ( - + Hi {name}, Welcome to WATcloud, WATonomous's compute cluster and infrastructure. We are excited to have you on board! @@ -61,7 +61,7 @@ export const WATcloudOnboardingEmail = (props: WATcloudOnboardingEmailProps) => `)} WATcloud Onboarding Bot 🤖 - + ); };