From cd6fd9a75d0182fe6d18258f976820fa1590896a Mon Sep 17 00:00:00 2001 From: MananTank Date: Fri, 25 Jul 2025 18:22:38 +0000 Subject: [PATCH] Dashboard: Migrate engine/configuration page from chakra to tailwind, UI improvements (#7716) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ## PR-Codex overview This PR focuses on refactoring and improving the UI of various configuration components for the Engine dashboard, enhancing layout, styling, and user experience while updating some logic related to wallet configurations. ### Detailed summary - Updated layout classes for `local-config.tsx`, `engine-configuration.tsx`, and `system.tsx`. - Added `UnderlineLink` component for links in `engine-wallet-config.tsx`, `circle-config.tsx`, and others. - Improved styling for alerts and forms in various components. - Enhanced error handling and user feedback with toast notifications in `cors.tsx`, `ip-allowlist.tsx`, and wallet config components. - Refactored props handling in `EngineWalletConfig`, `EngineCorsConfig`, and `EngineIpAllowlistConfig` to use inline type definitions. - Added `SaveIcon` and `Spinner` components for better loading and saving indicators in forms. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` --- .../components/circle-config.tsx | 97 +++--- .../configuration/components/cors.tsx | 103 ++++--- .../components/engine-configuration.tsx | 24 +- .../components/engine-wallet-config.tsx | 60 ++-- .../configuration/components/ip-allowlist.tsx | 119 ++++---- .../components/kms-aws-config.tsx | 203 +++++++------ .../components/kms-gcp-config.tsx | 286 +++++++++--------- .../configuration/components/local-config.tsx | 7 +- .../configuration/components/system.tsx | 20 +- 9 files changed, 480 insertions(+), 439 deletions(-) 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. - - +

+
-