Skip to content

Commit d6050ce

Browse files
authored
Merge pull request #2408 from Dokploy/canary
🚀 Release v0.24.12
2 parents 5a46b87 + ff20bb2 commit d6050ce

File tree

5 files changed

+56
-5
lines changed

5 files changed

+56
-5
lines changed

apps/dokploy/components/dashboard/compose/delete-service.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { useState } from "react";
77
import { useForm } from "react-hook-form";
88
import { toast } from "sonner";
99
import { z } from "zod";
10+
import { AlertBlock } from "@/components/shared/alert-block";
1011
import { Badge } from "@/components/ui/badge";
1112
import { Button } from "@/components/ui/button";
1213
import { Checkbox } from "@/components/ui/checkbox";
@@ -114,6 +115,12 @@ export const DeleteService = ({ id, type }: Props) => {
114115
}
115116
};
116117

118+
const isDisabled =
119+
(data &&
120+
"applicationStatus" in data &&
121+
data?.applicationStatus === "running") ||
122+
(data && "composeStatus" in data && data?.composeStatus === "running");
123+
117124
return (
118125
<Dialog open={isOpen} onOpenChange={setIsOpen}>
119126
<DialogTrigger asChild>
@@ -202,6 +209,12 @@ export const DeleteService = ({ id, type }: Props) => {
202209
</form>
203210
</Form>
204211
</div>
212+
{isDisabled && (
213+
<AlertBlock type="warning" className="w-full mt-5">
214+
Cannot delete the service while it is running. Please wait for the
215+
build to finish and then try again.
216+
</AlertBlock>
217+
)}
205218
<DialogFooter>
206219
<Button
207220
variant="secondary"
@@ -211,8 +224,10 @@ export const DeleteService = ({ id, type }: Props) => {
211224
>
212225
Cancel
213226
</Button>
227+
214228
<Button
215229
isLoading={isLoading}
230+
disabled={isDisabled}
216231
form="hook-form-delete-compose"
217232
type="submit"
218233
variant="destructive"

apps/dokploy/components/ui/dialog.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,11 @@ const DialogContent = React.forwardRef<
129129
<DialogPrimitive.Content
130130
ref={ref}
131131
className={cn(
132-
"fixed left-[50%] top-[50%] z-50 w-full max-w-lg translate-x-[-50%] translate-y-[-50%] border bg-background shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
132+
"fixed left-[50%] top-[50%] z-50 pointer-events-auto w-full max-w-lg translate-x-[-50%] translate-y-[-50%] border bg-background shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
133133
"flex flex-col max-h-[90vh]",
134134
className,
135135
)}
136+
style={{ pointerEvents: "auto" }}
136137
onInteractOutside={(event) => event.preventDefault()}
137138
{...props}
138139
>

apps/dokploy/components/ui/sidebar.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ const SidebarProvider = React.forwardRef<
148148
} as React.CSSProperties
149149
}
150150
className={cn(
151-
"group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-sidebar",
151+
"group/sidebar-wrapper flex h-svh w-full has-[[data-variant=inset]]:bg-sidebar",
152152
className,
153153
)}
154154
ref={ref}
@@ -329,10 +329,11 @@ const SidebarInset = React.forwardRef<
329329
<main
330330
ref={ref}
331331
className={cn(
332-
"relative flex min-h-svh overflow-auto w-full flex-col bg-background",
332+
"relative flex min-h-svh overflow-auto w-full flex-col bg-background",
333333
"peer-data-[variant=inset]:min-h-[calc(100svh-theme(spacing.4))] md:peer-data-[variant=inset]:m-2 md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow",
334334
className,
335335
)}
336+
style={{ scrollbarGutter: "stable" }}
336337
{...props}
337338
/>
338339
);

apps/dokploy/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dokploy",
3-
"version": "v0.24.11",
3+
"version": "v0.24.12",
44
"private": true,
55
"license": "Apache-2.0",
66
"type": "module",

apps/dokploy/pages/dashboard/project/[projectId].tsx

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import {
4040
RedisIcon,
4141
} from "@/components/icons/data-tools-icons";
4242
import { DashboardLayout } from "@/components/layouts/dashboard-layout";
43+
import { AlertBlock } from "@/components/shared/alert-block";
4344
import { BreadcrumbSidebar } from "@/components/shared/breadcrumb-sidebar";
4445
import { DateTooltip } from "@/components/shared/date-tooltip";
4546
import { DialogAction } from "@/components/shared/dialog-action";
@@ -598,6 +599,13 @@ const Project = (
598599
return sortServices(filtered);
599600
}, [applications, searchQuery, selectedTypes, sortBy]);
600601

602+
const selectedServicesWithRunningStatus = useMemo(() => {
603+
return filteredServices.filter(
604+
(service) =>
605+
selectedServices.includes(service.id) && service.status === "running",
606+
);
607+
}, [filteredServices, selectedServices]);
608+
601609
return (
602610
<div>
603611
<BreadcrumbSidebar
@@ -740,8 +748,34 @@ const Project = (
740748
<>
741749
<DialogAction
742750
title="Delete Services"
743-
description={`Are you sure you want to delete ${selectedServices.length} services? This action cannot be undone.`}
751+
description={
752+
<div className="space-y-3">
753+
<p>
754+
Are you sure you want to delete{" "}
755+
{selectedServices.length} services? This
756+
action cannot be undone.
757+
</p>
758+
{selectedServicesWithRunningStatus.length >
759+
0 && (
760+
<AlertBlock type="warning">
761+
Warning:{" "}
762+
{
763+
selectedServicesWithRunningStatus.length
764+
}{" "}
765+
of the selected services are currently
766+
running. Please stop these services
767+
first before deleting:{" "}
768+
{selectedServicesWithRunningStatus
769+
.map((s) => s.name)
770+
.join(", ")}
771+
</AlertBlock>
772+
)}
773+
</div>
774+
}
744775
type="destructive"
776+
disabled={
777+
selectedServicesWithRunningStatus.length > 0
778+
}
745779
onClick={handleBulkDelete}
746780
>
747781
<Button

0 commit comments

Comments
 (0)