Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
+17
-10
@@ -8,19 +8,22 @@ import ServerError from "~/components/ui/errors/ServerError";
|
||||
import NotificationTemplatesTable from "~/modules/notifications/components/NotificationTemplatesTable";
|
||||
import { NotificationChannelDto, NotificationChannels } from "~/modules/notifications/services/NotificationChannels";
|
||||
import NotificationService, { IGetTemplatesData } from "~/modules/notifications/services/.server/NotificationService";
|
||||
import { redactNotificationDiagnosticText } from "@hivegrid/db/notifications.server";
|
||||
import { getUser } from "~/utils/db/users.db.server";
|
||||
import { getPaginationFromCurrentUrl } from "~/utils/helpers/RowPaginationHelper";
|
||||
import { getUserInfo, validateCSRFToken } from "~/utils/session.server";
|
||||
import toast from "react-hot-toast";
|
||||
import { toast } from "sonner";
|
||||
import { verifyUserHasPermission } from "~/utils/helpers/.server/PermissionsService";
|
||||
import { appendCSRFToken } from "~/utils/csrf";
|
||||
import { getTranslations } from "~/locale/i18next.server";
|
||||
import { createScopedLogger } from "~/utils/logger.server";
|
||||
import { toSafeErrorLog } from "~/utils/safeErrorLog.server";
|
||||
|
||||
const logger = createScopedLogger("admin.notification-channels");
|
||||
|
||||
type LoaderData = {
|
||||
items: IGetTemplatesData | null;
|
||||
};
|
||||
export const loader = async ({ request, params }: LoaderFunctionArgs) => {
|
||||
export const loader = async ({ request, params: _params }: LoaderFunctionArgs) => {
|
||||
await verifyUserHasPermission(request, "admin.notifications.view");
|
||||
const urlSearchParams = new URL(request.url).searchParams;
|
||||
const currentPagination = getPaginationFromCurrentUrl(urlSearchParams);
|
||||
@@ -52,8 +55,9 @@ export const action: ActionFunction = async ({ request }) => {
|
||||
return Response.json({
|
||||
success: t("notifications.admin.templates.deleted"),
|
||||
});
|
||||
} catch (e: any) {
|
||||
return Response.json({ error: redactNotificationDiagnosticText(e instanceof Error ? e.message : String(e)) }, { status: 500 });
|
||||
} catch (error: unknown) {
|
||||
logger.error({ event: "admin.notification_template.delete_failed", ...toSafeErrorLog(error) }, "Notification template deletion failed");
|
||||
return Response.json({ error: t("notifications.admin.templates.errors.deleteFailed") }, { status: 500 });
|
||||
}
|
||||
} else if (action === "create") {
|
||||
// const name = form.get("name")?.toString() ?? "";
|
||||
@@ -69,8 +73,9 @@ export const action: ActionFunction = async ({ request }) => {
|
||||
// critical: false,
|
||||
// });
|
||||
return Response.json({ success: t("shared.created") });
|
||||
} catch (e: any) {
|
||||
return Response.json({ error: redactNotificationDiagnosticText(e instanceof Error ? e.message : String(e)) }, { status: 500 });
|
||||
} catch (error: unknown) {
|
||||
logger.error({ event: "admin.notification_template.create_failed", ...toSafeErrorLog(error) }, "Notification template creation failed");
|
||||
return Response.json({ error: t("notifications.admin.templates.errors.createFailed") }, { status: 500 });
|
||||
}
|
||||
} else if (action === "send-preview") {
|
||||
const channel = form.get("channel")?.toString() ?? "";
|
||||
@@ -84,10 +89,12 @@ export const action: ActionFunction = async ({ request }) => {
|
||||
required: true,
|
||||
});
|
||||
return Response.json({ success: t("notifications.admin.templates.previewSent", { channel }) });
|
||||
} catch (e: any) {
|
||||
return Response.json({ error: redactNotificationDiagnosticText(e instanceof Error ? e.message : String(e)) }, { status: 500 });
|
||||
} catch (error: unknown) {
|
||||
logger.error({ event: "admin.notification_template.preview_failed", ...toSafeErrorLog(error) }, "Notification template preview failed");
|
||||
return Response.json({ error: t("notifications.admin.templates.errors.previewFailed") }, { status: 500 });
|
||||
}
|
||||
}
|
||||
return Response.json({ error: t("notifications.errors.invalidAction") }, { status: 400 });
|
||||
};
|
||||
|
||||
export default function () {
|
||||
@@ -147,7 +154,7 @@ export default function () {
|
||||
}
|
||||
return (
|
||||
<>
|
||||
<div className="mx-auto w-full max-w-5xl space-y-3 px-4 py-2 pb-6 sm:px-6 sm:pt-3 lg:px-8 xl:max-w-full">
|
||||
<div className="w-full space-y-3 px-6 py-2 pb-6 mobile:px-4 sm:pt-3">
|
||||
<div className="md:border-border md:border-b md:py-2">
|
||||
<div className="flex items-center justify-between">
|
||||
<h3 className="text-foreground text-lg font-medium leading-6">{t("notifications.admin.channels.title")}</h3>
|
||||
|
||||
Reference in new issue
Block a user