From 3c00937b94ca1e4ad5d9bbc9492857aaff5e8939 Mon Sep 17 00:00:00 2001 From: hehehai Date: Thu, 13 Jun 2024 20:42:46 +0800 Subject: [PATCH] fix: env editor width overflow --- .../advanced/traefik/update-traefik-config.tsx | 16 ++++++++++++---- .../application/advanced/volumes/add-volumes.tsx | 6 +++--- .../dashboard/application/environment/show.tsx | 2 +- components/dashboard/compose/enviroment/show.tsx | 2 +- .../compose/general/compose-file-editor.tsx | 6 +++--- .../dashboard/file-system/show-traefik-file.tsx | 2 +- .../environment/show-mariadb-environment.tsx | 2 +- .../mongo/environment/show-mongo-environment.tsx | 2 +- .../mysql/environment/show-mysql-environment.tsx | 2 +- .../environment/show-postgres-environment.tsx | 2 +- .../redis/environment/show-redis-environment.tsx | 2 +- components/dashboard/settings/web-server.tsx | 2 +- .../web-server/show-main-traefik-config.tsx | 2 +- .../web-server/show-server-middleware-config.tsx | 2 +- .../web-server/show-server-traefik-config.tsx | 2 +- components/shared/code-editor.tsx | 2 +- components/ui/dialog.tsx | 6 ++++-- styles/globals.css | 2 -- 18 files changed, 35 insertions(+), 27 deletions(-) diff --git a/components/dashboard/application/advanced/traefik/update-traefik-config.tsx b/components/dashboard/application/advanced/traefik/update-traefik-config.tsx index 13bec242..659353ec 100644 --- a/components/dashboard/application/advanced/traefik/update-traefik-config.tsx +++ b/components/dashboard/application/advanced/traefik/update-traefik-config.tsx @@ -19,7 +19,7 @@ import { import { api } from "@/utils/api"; import { AlertBlock } from "@/components/shared/alert-block"; import { zodResolver } from "@hookform/resolvers/zod"; -import { useEffect } from "react"; +import { useEffect, useState } from "react"; import { useForm } from "react-hook-form"; import { toast } from "sonner"; import { z } from "zod"; @@ -58,6 +58,7 @@ export const validateAndFormatYAML = (yamlText: string) => { }; export const UpdateTraefikConfig = ({ applicationId }: Props) => { + const [open, setOpen] = useState(false); const { data, refetch } = api.application.readTraefikConfig.useQuery( { applicationId, @@ -81,7 +82,7 @@ export const UpdateTraefikConfig = ({ applicationId }: Props) => { traefikConfig: data || "", }); } - }, [form, form.reset, data]); + }, [data]); const onSubmit = async (data: UpdateTraefikConfig) => { const { valid, error } = validateAndFormatYAML(data.traefikConfig); @@ -100,6 +101,8 @@ export const UpdateTraefikConfig = ({ applicationId }: Props) => { .then(async () => { toast.success("Traefik config Updated"); refetch(); + setOpen(false); + form.reset(); }) .catch(() => { toast.error("Error to update the traefik config"); @@ -107,7 +110,12 @@ export const UpdateTraefikConfig = ({ applicationId }: Props) => { }; return ( - + { + setOpen(open) + if (!open) { + form.reset(); + } + }}> @@ -122,7 +130,7 @@ export const UpdateTraefikConfig = ({ applicationId }: Props) => {
@@ -209,7 +209,7 @@ export const AddVolumes = ({ /> @@ -233,7 +233,7 @@ export const AddVolumes = ({ /> diff --git a/components/dashboard/application/environment/show.tsx b/components/dashboard/application/environment/show.tsx index 72f25d2e..1e91e491 100644 --- a/components/dashboard/application/environment/show.tsx +++ b/components/dashboard/application/environment/show.tsx @@ -124,7 +124,7 @@ export const ShowEnvironment = ({ applicationId }: Props) => { { { { {
{ { { { { { Space - + Actions diff --git a/components/dashboard/settings/web-server/show-main-traefik-config.tsx b/components/dashboard/settings/web-server/show-main-traefik-config.tsx index 4a14d220..16f69b77 100644 --- a/components/dashboard/settings/web-server/show-main-traefik-config.tsx +++ b/components/dashboard/settings/web-server/show-main-traefik-config.tsx @@ -95,7 +95,7 @@ export const ShowMainTraefikConfig = ({ children }: Props) => {
{
{
{props.disabled && ( -
+
)}
); diff --git a/components/ui/dialog.tsx b/components/ui/dialog.tsx index 775c93a9..3c9ec741 100644 --- a/components/ui/dialog.tsx +++ b/components/ui/dialog.tsx @@ -36,12 +36,14 @@ const DialogContent = React.forwardRef< - {children} +
+ {children} +
Close diff --git a/styles/globals.css b/styles/globals.css index 629d2985..5b71cdff 100644 --- a/styles/globals.css +++ b/styles/globals.css @@ -127,10 +127,8 @@ background-color: transparent; } - .compose-file-editor .cm-editor { @apply min-h-[25rem]; - }