mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-23 04:18:45 +00:00
Merge pull request #3826 from Dokploy/3822-renaming-redis-doesnt-close-the-update-dialog
feat: add state management for dialog visibility in MariaDB, MySQL, a…
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import { standardSchemaResolver as zodResolver } from "@hookform/resolvers/standard-schema";
|
import { standardSchemaResolver as zodResolver } from "@hookform/resolvers/standard-schema";
|
||||||
import { PenBoxIcon } from "lucide-react";
|
import { PenBoxIcon } from "lucide-react";
|
||||||
import { useEffect } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { useForm } from "react-hook-form";
|
import { useForm } from "react-hook-form";
|
||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
@@ -41,6 +41,7 @@ interface Props {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const UpdateMariadb = ({ mariadbId }: Props) => {
|
export const UpdateMariadb = ({ mariadbId }: Props) => {
|
||||||
|
const [isOpen, setIsOpen] = useState(false);
|
||||||
const utils = api.useUtils();
|
const utils = api.useUtils();
|
||||||
const { mutateAsync, error, isError, isPending } =
|
const { mutateAsync, error, isError, isPending } =
|
||||||
api.mariadb.update.useMutation();
|
api.mariadb.update.useMutation();
|
||||||
@@ -79,6 +80,7 @@ export const UpdateMariadb = ({ mariadbId }: Props) => {
|
|||||||
utils.mariadb.one.invalidate({
|
utils.mariadb.one.invalidate({
|
||||||
mariadbId: mariadbId,
|
mariadbId: mariadbId,
|
||||||
});
|
});
|
||||||
|
setIsOpen(false);
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
toast.error("Error updating the Mariadb");
|
toast.error("Error updating the Mariadb");
|
||||||
@@ -87,7 +89,7 @@ export const UpdateMariadb = ({ mariadbId }: Props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog>
|
<Dialog open={isOpen} onOpenChange={setIsOpen}>
|
||||||
<DialogTrigger asChild>
|
<DialogTrigger asChild>
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { standardSchemaResolver as zodResolver } from "@hookform/resolvers/standard-schema";
|
import { standardSchemaResolver as zodResolver } from "@hookform/resolvers/standard-schema";
|
||||||
import { PenBoxIcon } from "lucide-react";
|
import { PenBoxIcon } from "lucide-react";
|
||||||
import { useEffect } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { useForm } from "react-hook-form";
|
import { useForm } from "react-hook-form";
|
||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
@@ -41,6 +41,7 @@ interface Props {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const UpdateMysql = ({ mysqlId }: Props) => {
|
export const UpdateMysql = ({ mysqlId }: Props) => {
|
||||||
|
const [isOpen, setIsOpen] = useState(false);
|
||||||
const utils = api.useUtils();
|
const utils = api.useUtils();
|
||||||
const { mutateAsync, error, isError, isPending } =
|
const { mutateAsync, error, isError, isPending } =
|
||||||
api.mysql.update.useMutation();
|
api.mysql.update.useMutation();
|
||||||
@@ -79,6 +80,7 @@ export const UpdateMysql = ({ mysqlId }: Props) => {
|
|||||||
utils.mysql.one.invalidate({
|
utils.mysql.one.invalidate({
|
||||||
mysqlId: mysqlId,
|
mysqlId: mysqlId,
|
||||||
});
|
});
|
||||||
|
setIsOpen(false);
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
toast.error("Error updating MySQL");
|
toast.error("Error updating MySQL");
|
||||||
@@ -87,7 +89,7 @@ export const UpdateMysql = ({ mysqlId }: Props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog>
|
<Dialog open={isOpen} onOpenChange={setIsOpen}>
|
||||||
<DialogTrigger asChild>
|
<DialogTrigger asChild>
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { standardSchemaResolver as zodResolver } from "@hookform/resolvers/standard-schema";
|
import { standardSchemaResolver as zodResolver } from "@hookform/resolvers/standard-schema";
|
||||||
import { PenBoxIcon } from "lucide-react";
|
import { PenBoxIcon } from "lucide-react";
|
||||||
import { useEffect } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { useForm } from "react-hook-form";
|
import { useForm } from "react-hook-form";
|
||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
@@ -41,6 +41,7 @@ interface Props {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const UpdateRedis = ({ redisId }: Props) => {
|
export const UpdateRedis = ({ redisId }: Props) => {
|
||||||
|
const [isOpen, setIsOpen] = useState(false);
|
||||||
const utils = api.useUtils();
|
const utils = api.useUtils();
|
||||||
const { mutateAsync, error, isError, isPending } =
|
const { mutateAsync, error, isError, isPending } =
|
||||||
api.redis.update.useMutation();
|
api.redis.update.useMutation();
|
||||||
@@ -79,6 +80,7 @@ export const UpdateRedis = ({ redisId }: Props) => {
|
|||||||
utils.redis.one.invalidate({
|
utils.redis.one.invalidate({
|
||||||
redisId: redisId,
|
redisId: redisId,
|
||||||
});
|
});
|
||||||
|
setIsOpen(false);
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
toast.error("Error updating Redis");
|
toast.error("Error updating Redis");
|
||||||
@@ -87,7 +89,7 @@ export const UpdateRedis = ({ redisId }: Props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog>
|
<Dialog open={isOpen} onOpenChange={setIsOpen}>
|
||||||
<DialogTrigger asChild>
|
<DialogTrigger asChild>
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
|
|||||||
Reference in New Issue
Block a user