From 49dffe086d3c6613b5f4437922d5311f34406b0d Mon Sep 17 00:00:00 2001 From: Fred KISSIE Date: Thu, 30 Oct 2025 02:18:48 +0100 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20show=20warning=20toast=20a?= =?UTF-8?q?nd=20do=20not=20throw=20error=20in=20case=20of=20UI=20source?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/lib/blueprints/applyBlueprint.ts | 3 ++- src/components/CreateBlueprintForm.tsx | 7 ++++--- src/components/ui/toast.tsx | 3 ++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/server/lib/blueprints/applyBlueprint.ts b/server/lib/blueprints/applyBlueprint.ts index 235a1591..b3e58824 100644 --- a/server/lib/blueprints/applyBlueprint.ts +++ b/server/lib/blueprints/applyBlueprint.ts @@ -166,7 +166,8 @@ export async function applyBlueprint({ blueprint = newBlueprint[0]; }); - if (!blueprint || !blueprintSucceeded) { + if (!blueprint || (source !== "UI" && !blueprintSucceeded)) { + // ^^^^^^^^^^^^^^^ The UI considers a failed blueprint as a valid response throw error ?? "Unknown Server Error"; } diff --git a/src/components/CreateBlueprintForm.tsx b/src/components/CreateBlueprintForm.tsx index 62328114..617f3026 100644 --- a/src/components/CreateBlueprintForm.tsx +++ b/src/components/CreateBlueprintForm.tsx @@ -107,10 +107,11 @@ export default function CreateBlueprintForm({ }); if (res && res.status === 201) { + const createdBlueprint = res.data.data; toast({ - variant: "default", - title: "Success", - description: res.data.data.message + variant: "warning", + title: createdBlueprint.succeeded ? "Success" : "Warning", + description: createdBlueprint.message }); router.push(`/${orgId}/settings/blueprints`); } diff --git a/src/components/ui/toast.tsx b/src/components/ui/toast.tsx index 26510e84..5f1e5d19 100644 --- a/src/components/ui/toast.tsx +++ b/src/components/ui/toast.tsx @@ -31,7 +31,8 @@ const toastVariants = cva( variant: { default: "border bg-card text-foreground", destructive: - "destructive group border-destructive bg-destructive text-white dark:text-destructive-foreground" + "destructive group border-destructive bg-destructive text-white dark:text-destructive-foreground", + warning: "group border-amber-600 bg-amber-600 text-white" } }, defaultVariants: {