From 392e2d66ec725c2f01ed8d6edec7e76e5d347859 Mon Sep 17 00:00:00 2001
From: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com>
Date: Sun, 29 Jun 2025 23:14:53 -0600
Subject: [PATCH] fix: improve volume backup validation and refactor component
props
- Added validation to ensure service name is required when service type is "compose" in the volume backup form schema.
- Refactored the ShowVolumeBackups component to use a more consistent prop name for volume backup type, enhancing clarity and maintainability.
- Updated related components to align with the new prop structure, ensuring seamless integration across the application.
---
.../volume-backups/handle-volume-backups.tsx | 8 ++++++
.../volume-backups/show-volume-backups.tsx | 26 ++++++-------------
.../services/application/[applicationId].tsx | 8 +-----
.../services/compose/[composeId].tsx | 14 ++++++++--
4 files changed, 29 insertions(+), 27 deletions(-)
diff --git a/apps/dokploy/components/dashboard/application/volume-backups/handle-volume-backups.tsx b/apps/dokploy/components/dashboard/application/volume-backups/handle-volume-backups.tsx
index 6a621f29a..dbd7c2a1e 100644
--- a/apps/dokploy/components/dashboard/application/volume-backups/handle-volume-backups.tsx
+++ b/apps/dokploy/components/dashboard/application/volume-backups/handle-volume-backups.tsx
@@ -78,6 +78,14 @@ const formSchema = z
path: ["serviceName"],
});
}
+
+ if (data.serviceType === "compose" && !data.serviceName) {
+ ctx.addIssue({
+ code: z.ZodIssueCode.custom,
+ message: "Service name is required",
+ path: ["serviceName"],
+ });
+ }
});
interface Props {
diff --git a/apps/dokploy/components/dashboard/application/volume-backups/show-volume-backups.tsx b/apps/dokploy/components/dashboard/application/volume-backups/show-volume-backups.tsx
index 9b752ff78..bf823c382 100644
--- a/apps/dokploy/components/dashboard/application/volume-backups/show-volume-backups.tsx
+++ b/apps/dokploy/components/dashboard/application/volume-backups/show-volume-backups.tsx
@@ -17,7 +17,6 @@ import {
import { api } from "@/utils/api";
import {
ClipboardList,
- Clock,
DatabaseBackup,
Loader2,
Play,
@@ -29,19 +28,10 @@ import { ShowDeploymentsModal } from "../deployments/show-deployments-modal";
interface Props {
id: string;
- volumeBackupType?:
- | "application"
- | "compose"
- | "postgres"
- | "mariadb"
- | "mongo"
- | "mysql";
+ type?: "application" | "compose" | "postgres" | "mariadb" | "mongo" | "mysql";
}
-export const ShowVolumeBackups = ({
- id,
- volumeBackupType = "application",
-}: Props) => {
+export const ShowVolumeBackups = ({ id, type = "application" }: Props) => {
const {
data: volumeBackups,
isLoading: isLoadingVolumeBackups,
@@ -49,7 +39,7 @@ export const ShowVolumeBackups = ({
} = api.volumeBackups.list.useQuery(
{
id: id || "",
- volumeBackupType,
+ volumeBackupType: type,
},
{
enabled: !!id,
@@ -79,7 +69,7 @@ export const ShowVolumeBackups = ({
{volumeBackups && volumeBackups.length > 0 && (
-
Create your first volume backup to automate your workflows
-