diff --git a/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/dedicated/(instance)/[engineId]/configuration/components/circle-config.tsx b/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/dedicated/(instance)/[engineId]/configuration/components/circle-config.tsx index d6bfaa21f40..db9122e0cad 100644 --- a/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/dedicated/(instance)/[engineId]/configuration/components/circle-config.tsx +++ b/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/dedicated/(instance)/[engineId]/configuration/components/circle-config.tsx @@ -1,4 +1,4 @@ -import Link from "next/link"; +import { SaveIcon } from "lucide-react"; import { useId } from "react"; import { useForm } from "react-hook-form"; import { toast } from "sonner"; @@ -7,6 +7,7 @@ import { Button } from "@/components/ui/button"; import { Form } from "@/components/ui/form"; import { Input } from "@/components/ui/input"; import { Spinner } from "@/components/ui/Spinner/Spinner"; +import { UnderlineLink } from "@/components/ui/UnderlineLink"; import { type EngineInstance, type SetWalletConfigInput, @@ -58,55 +59,61 @@ export const CircleConfig: React.FC = ({ const circleApiKeyId = useId(); return ( -
-
-

- Circle wallets require an API Key from your Circle account with - sufficient permissions. Created wallets are stored in your AWS - account. Configure your Circle API Key to use Circle wallets. Learn - more about{" "} - - how to get an API Key - - . -

-
- +
- - - - + +
+
+

Credentials

+ +

+ Circle wallets require an API Key from your Circle account with + sufficient permissions.
Created wallets are stored in + your AWS account. Configure your Circle API Key to use Circle + wallets. Learn more about{" "} + + how to get an API Key + + . +

+
+ + + + +
-
+
diff --git a/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/dedicated/(instance)/[engineId]/configuration/components/cors.tsx b/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/dedicated/(instance)/[engineId]/configuration/components/cors.tsx index 16edca08d84..0664ff62f72 100644 --- a/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/dedicated/(instance)/[engineId]/configuration/components/cors.tsx +++ b/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/dedicated/(instance)/[engineId]/configuration/components/cors.tsx @@ -1,42 +1,36 @@ -import { Flex, Textarea } from "@chakra-ui/react"; -import { Button } from "chakra/button"; -import { Heading } from "chakra/heading"; -import { Text } from "chakra/text"; +import { SaveIcon } from "lucide-react"; import { useForm } from "react-hook-form"; +import { toast } from "sonner"; +import { Button } from "@/components/ui/button"; import { InlineCode } from "@/components/ui/inline-code"; +import { Spinner } from "@/components/ui/Spinner/Spinner"; +import { Textarea } from "@/components/ui/textarea"; import { useEngineCorsConfiguration, useEngineSetCorsConfiguration, } from "@/hooks/useEngine"; -import { useTxNotifications } from "@/hooks/useTxNotifications"; +import { parseError } from "@/utils/errorParser"; -interface EngineCorsConfigProps { - instanceUrl: string; - authToken: string; -} - -interface CorsForm { +type CorsForm = { raw: string; -} +}; -export const EngineCorsConfig: React.FC = ({ +export function EngineCorsConfig({ instanceUrl, authToken, -}) => { +}: { + instanceUrl: string; + authToken: string; +}) { const { data: existingUrls } = useEngineCorsConfiguration({ authToken, instanceUrl, }); - const { mutateAsync: setCorsConfig } = useEngineSetCorsConfiguration({ + const setCorsConfigMutation = useEngineSetCorsConfiguration({ authToken, instanceUrl, }); - const { onSuccess, onError } = useTxNotifications( - "CORS URLs updated successfully.", - "Failed to update CORS URLs.", - ); - const form = useForm({ values: { raw: existingUrls?.join("\n") ?? "" }, }); @@ -47,52 +41,57 @@ export const EngineCorsConfig: React.FC = ({ // Assert all URLs are well formed and strip the path. const sanitized = urls.map(parseOriginFromUrl); - await setCorsConfig({ urls: sanitized }); - onSuccess(); + await setCorsConfigMutation.mutateAsync({ urls: sanitized }); + toast.success("CORS URLs updated successfully."); } catch (error) { - onError(error); + toast.error("Failed to update CORS URLs.", { + description: parseError(error), + }); } }; return ( - - - Allowlisted Domains - +
+
+

Allowlisted Domains

+

Specify the origins that can call Engine ( ).
Enter one origin per line, or leave this list empty to disallow calls from web clients. - - +

+
-