From 4d3e3426cab9f4ad9df729a7365134ce362a083a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=A8=E5=A4=B4981?= Date: Mon, 27 May 2024 05:32:24 +0800 Subject: [PATCH] feat: support code editor (#105) * feat: support code editor * Update codeblock * refactor: remove unused class --------- Co-authored-by: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com> --- .../advanced/traefik/show-traefik-config.tsx | 13 +- .../traefik/update-traefik-config.tsx | 8 +- .../file-system/show-traefik-file.tsx | 12 +- .../file-system/show-traefik-system.tsx | 4 +- .../web-server/show-main-traefik-config.tsx | 6 +- .../show-server-middleware-config.tsx | 8 +- .../web-server/show-server-traefik-config.tsx | 8 +- .../settings/web-server/terminal-modal.tsx | 2 +- components/shared/code-editor.tsx | 45 ++++ package.json | 4 + pnpm-lock.yaml | 246 ++++++++++++++++++ styles/globals.css | 41 +-- 12 files changed, 349 insertions(+), 48 deletions(-) create mode 100644 components/shared/code-editor.tsx diff --git a/components/dashboard/application/advanced/traefik/show-traefik-config.tsx b/components/dashboard/application/advanced/traefik/show-traefik-config.tsx index 7a87e4e8c..6b5415044 100644 --- a/components/dashboard/application/advanced/traefik/show-traefik-config.tsx +++ b/components/dashboard/application/advanced/traefik/show-traefik-config.tsx @@ -9,6 +9,7 @@ import { import { api } from "@/utils/api"; import { File } from "lucide-react"; import { UpdateTraefikConfig } from "./update-traefik-config"; +import { CodeEditor } from "@/components/shared/code-editor"; interface Props { applicationId: string; } @@ -43,11 +44,13 @@ export const ShowTraefikConfig = ({ applicationId }: Props) => { ) : (
-
-
-
{data || "Empty"}
-
-
+
+ +
diff --git a/components/dashboard/application/advanced/traefik/update-traefik-config.tsx b/components/dashboard/application/advanced/traefik/update-traefik-config.tsx index 0155fc1f5..13bec2424 100644 --- a/components/dashboard/application/advanced/traefik/update-traefik-config.tsx +++ b/components/dashboard/application/advanced/traefik/update-traefik-config.tsx @@ -16,7 +16,6 @@ import { FormLabel, FormMessage, } from "@/components/ui/form"; -import { Textarea } from "@/components/ui/textarea"; import { api } from "@/utils/api"; import { AlertBlock } from "@/components/shared/alert-block"; import { zodResolver } from "@hookform/resolvers/zod"; @@ -25,6 +24,7 @@ import { useForm } from "react-hook-form"; import { toast } from "sonner"; import { z } from "zod"; import jsyaml from "js-yaml"; +import { CodeEditor } from "@/components/shared/code-editor"; const UpdateTraefikConfigSchema = z.object({ traefikConfig: z.string(), @@ -122,7 +122,7 @@ export const UpdateTraefikConfig = ({ applicationId }: Props) => {
{ Traefik config -