mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-06-18 21:55:24 +02:00
fix: update volume backup components for improved functionality
- Refactored HandleVolumeBackups to use consistent naming for mount items. - Added an AlertBlock to RestoreVolumeBackups to inform users about potential volume name conflicts. - Updated mount retrieval logic in the mount router to enhance accuracy and efficiency in fetching volume mounts.
This commit is contained in:
@@ -550,11 +550,8 @@ export const HandleVolumeBackups = ({
|
||||
</FormControl>
|
||||
<SelectContent>
|
||||
{mounts?.map((mount) => (
|
||||
<SelectItem
|
||||
key={mount.mountId}
|
||||
value={mount.volumeName || ""}
|
||||
>
|
||||
{mount.volumeName}
|
||||
<SelectItem key={mount.Name} value={mount.Name || ""}>
|
||||
{mount.Name}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
|
||||
@@ -44,6 +44,7 @@ import { toast } from "sonner";
|
||||
import { z } from "zod";
|
||||
import { type LogLine, parseLogs } from "../../docker/logs/utils";
|
||||
import { formatBytes } from "../../database/backups/restore-backup";
|
||||
import { AlertBlock } from "@/components/shared/alert-block";
|
||||
|
||||
interface Props {
|
||||
id: string;
|
||||
@@ -169,6 +170,9 @@ export const RestoreVolumeBackups = ({ id, type, serverId }: Props) => {
|
||||
<DialogDescription>
|
||||
Select a destination and search for volume backup files
|
||||
</DialogDescription>
|
||||
<AlertBlock>
|
||||
Make sure the volume name is not being used by another container.
|
||||
</AlertBlock>
|
||||
</DialogHeader>
|
||||
|
||||
<Form {...form}>
|
||||
|
||||
@@ -3,18 +3,17 @@ import {
|
||||
apiFindOneMount,
|
||||
apiRemoveMount,
|
||||
apiUpdateMount,
|
||||
mounts,
|
||||
} from "@/server/db/schema";
|
||||
import {
|
||||
createMount,
|
||||
deleteMount,
|
||||
findApplicationById,
|
||||
findMountById,
|
||||
getServiceContainer,
|
||||
updateMount,
|
||||
} from "@dokploy/server";
|
||||
import { createTRPCRouter, protectedProcedure } from "../trpc";
|
||||
import { z } from "zod";
|
||||
import { and, eq } from "drizzle-orm";
|
||||
import { db } from "@dokploy/server/db";
|
||||
|
||||
export const mountRouter = createTRPCRouter({
|
||||
create: protectedProcedure
|
||||
@@ -40,11 +39,11 @@ export const mountRouter = createTRPCRouter({
|
||||
allNamedByApplicationId: protectedProcedure
|
||||
.input(z.object({ applicationId: z.string().min(1) }))
|
||||
.query(async ({ input }) => {
|
||||
return await db.query.mounts.findMany({
|
||||
where: and(
|
||||
eq(mounts.applicationId, input.applicationId),
|
||||
eq(mounts.type, "volume"),
|
||||
),
|
||||
});
|
||||
const app = await findApplicationById(input.applicationId);
|
||||
const container = await getServiceContainer(app.appName, app.serverId);
|
||||
const mounts = container?.Mounts.filter(
|
||||
(mount) => mount.Type === "volume" && mount.Source !== "",
|
||||
);
|
||||
return mounts;
|
||||
}),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user