feat: Alert preference for deployment failures

This commit is contained in:
Hemachandar committed 2025-11-06 12:51:35 +05:30
1 parent 20e5930ddf
commit af257857c4
3 files changed
+44

No files matched your search

+1
View File
@@ -9,6 +9,7 @@ export type Account = Models.User<
organization?: string;
console: Models.Preferences;
notificationPrefs: Record<string, NotificationPrefItem>;
deploymentFailedEmailAlert: boolean;
} & Record<string, string>
>;
@@ -0,0 +1,38 @@
<script>
import { CardGrid } from "$lib/components";
import { InputChoice } from "$lib/elements/forms";
import { Container } from "$lib/layout";
import { sdk } from '$lib/stores/sdk';
import { user } from '$lib/stores/user';
import { Layout } from "@appwrite.io/pink-svelte";
let deploymentFailedEmailAlert = $user.prefs.deploymentFailedEmailAlert ?? true;
function toggleDeploymentFailedEmailAlert() {
deploymentFailedEmailAlert = !deploymentFailedEmailAlert;
const newPrefs = {
...$user.prefs,
deploymentFailedEmailAlert: deploymentFailedEmailAlert
};
sdk.forConsole.account.updatePrefs({ prefs: newPrefs });
}
</script>
<Container>
<CardGrid>
<svelte:fragment slot="title">Email Alerts</svelte:fragment>
Toggle email preferences to receive notifications when certain events occur.
<svelte:fragment slot="aside">
<Layout.Stack gap="xl">
<InputChoice
on:change={toggleDeploymentFailedEmailAlert}
type="switchbox"
id="mfa"
label="Deployment Failed"
value={deploymentFailedEmailAlert} />
</Layout.Stack>
</svelte:fragment>
</CardGrid>
</Container>
@@ -33,6 +33,11 @@
title: 'Organizations',
event: 'organizations',
hasChildren: true
},
{
href: `${path}/alerts`,
title: 'Alerts',
event: 'alerts',
}
];