mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-07-20 05:15:23 +02:00
* feat: update dependencies and enhance UI components in Dokploy - Updated various package versions in pnpm-lock.yaml to improve compatibility and performance, including React and Tailwind CSS. - Modified components.json to change the styling to "radix-nova" and added new properties for icon library and menu color. - Refactored multiple components to use updated class names for better styling consistency and responsiveness. - Removed unused Radix UI components from package.json to streamline dependencies. - Adjusted layout and styling in several dashboard components for improved user experience and visual appeal. - Enhanced tooltip and form item components for better accessibility and usability. * refactor: enhance UI components in HandleCertificate and SidebarLogo - Updated the HandleCertificate component to improve dialog content height and textarea styling for better usability. - Adjusted the SidebarLogo component layout to enhance alignment and spacing, ensuring a more consistent appearance across the sidebar. - Implemented responsive design adjustments to textarea elements, preventing overflow and improving user experience. * refactor: improve UI consistency and styling across dashboard components - Updated Card components in ShowDeployments, ShowSchedules, and ShowVolumeBackups to remove unnecessary border styles for a cleaner look. - Enhanced TabsList components in ShowProviderForm and ShowProviderFormCompose by adding a variant for improved visual distinction. - Adjusted spacing in AdvancedEnvironmentSelector for better layout and readability. - Removed redundant border classes in Service component for a more streamlined design. * [autofix.ci] apply automated fixes * chore: update package dependencies and refactor email rendering - Upgraded React and React DOM to version 19.2.7 across multiple packages for improved performance and compatibility. - Updated TSX to version 4.22.4 in various package.json files. - Refactored email rendering from `renderAsync` to `render` in notification utilities and email templates for consistency. - Adjusted Tailwind configuration usage in email templates to utilize a centralized configuration file. These changes enhance the overall stability and maintainability of the codebase. * refactor: update badge variants across dashboard components - Changed badge variant from "outline-solid" to "outline" in multiple components including columns, show-domains, and various deployment tables for consistency in styling. - Updated button variants in billing and project templates to align with the new badge styling. - Enhanced input components to support password generation and error messaging, improving user experience. These changes streamline the UI and ensure a cohesive design across the application. * refactor: clean up calendar component imports and structure - Removed redundant imports of icons from lucide-react and streamlined the import statements for better readability. - Adjusted the placement of type imports to enhance code organization. These changes improve the maintainability and clarity of the calendar component. * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
222 lines
6.9 KiB
TypeScript
222 lines
6.9 KiB
TypeScript
import { Settings } from "lucide-react";
|
|
import { useState } from "react";
|
|
import { AlertBlock } from "@/components/shared/alert-block";
|
|
import { Button } from "@/components/ui/button";
|
|
import {
|
|
Dialog,
|
|
DialogContent,
|
|
DialogDescription,
|
|
DialogHeader,
|
|
DialogTitle,
|
|
DialogTrigger,
|
|
} from "@/components/ui/dialog";
|
|
import {
|
|
Tooltip,
|
|
TooltipContent,
|
|
TooltipProvider,
|
|
TooltipTrigger,
|
|
} from "@/components/ui/tooltip";
|
|
import { cn } from "@/lib/utils";
|
|
import {
|
|
EndpointSpecForm,
|
|
HealthCheckForm,
|
|
LabelsForm,
|
|
ModeForm,
|
|
NetworkForm,
|
|
PlacementForm,
|
|
RestartPolicyForm,
|
|
RollbackConfigForm,
|
|
StopGracePeriodForm,
|
|
UpdateConfigForm,
|
|
} from "./swarm-forms";
|
|
|
|
type MenuItem = {
|
|
id: string;
|
|
label: string;
|
|
description: string;
|
|
docDescription: string;
|
|
};
|
|
|
|
const menuItems: MenuItem[] = [
|
|
{
|
|
id: "health-check",
|
|
label: "Health Check",
|
|
description: "Configure health check settings",
|
|
docDescription:
|
|
"Configure HEALTHCHECK to test a container's health. Determines if a container is healthy by running a command inside the container. Test, Interval, Timeout, StartPeriod, and Retries control health monitoring.",
|
|
},
|
|
{
|
|
id: "restart-policy",
|
|
label: "Restart Policy",
|
|
description: "Configure restart policy",
|
|
docDescription:
|
|
"Configure the restart policy for containers in the service. Condition (none, on-failure, any), Delay (nanoseconds between restarts), MaxAttempts, and Window control restart behavior.",
|
|
},
|
|
{
|
|
id: "placement",
|
|
label: "Placement",
|
|
description: "Configure placement constraints",
|
|
docDescription:
|
|
"Control which nodes service tasks can be scheduled on. Constraints (node.id==xyz), Preferences (spread.node.labels.zone), MaxReplicas, and Platforms specify task placement rules.",
|
|
},
|
|
{
|
|
id: "update-config",
|
|
label: "Update Config",
|
|
description: "Configure update strategy",
|
|
docDescription:
|
|
"Configure how the service should be updated. Parallelism (tasks updated simultaneously), Delay, FailureAction (pause, continue, rollback), Monitor, MaxFailureRatio, and Order (stop-first, start-first) control updates.",
|
|
},
|
|
{
|
|
id: "rollback-config",
|
|
label: "Rollback Config",
|
|
description: "Configure rollback strategy",
|
|
docDescription:
|
|
"Configure automated rollback on update failure. Uses same parameters as UpdateConfig: Parallelism, Delay, FailureAction, Monitor, MaxFailureRatio, and Order.",
|
|
},
|
|
{
|
|
id: "mode",
|
|
label: "Mode",
|
|
description: "Configure service mode",
|
|
docDescription:
|
|
"Set service mode to either 'Replicated' with a specified number of tasks (Replicas), or 'Global' (one task per node).",
|
|
},
|
|
{
|
|
id: "network",
|
|
label: "Network",
|
|
description: "Configure network attachments",
|
|
docDescription:
|
|
"Attach the service to one or more networks. Specify the network name (Target) and optional network aliases for service discovery.",
|
|
},
|
|
{
|
|
id: "labels",
|
|
label: "Labels",
|
|
description: "Configure service labels",
|
|
docDescription:
|
|
"Add metadata to services using labels. Labels are key-value pairs (e.g., com.example.foo=bar) for organizing and filtering services.",
|
|
},
|
|
{
|
|
id: "stop-grace-period",
|
|
label: "Stop Grace Period",
|
|
description: "Configure stop grace period",
|
|
docDescription:
|
|
"Time to wait before forcefully killing a container. Specified in nanoseconds (e.g., 10000000000 = 10 seconds). Allows containers to shutdown gracefully.",
|
|
},
|
|
{
|
|
id: "endpoint-spec",
|
|
label: "Endpoint Spec",
|
|
description: "Configure endpoint specification",
|
|
docDescription:
|
|
"Configure endpoint mode for service discovery. Mode 'vip' (virtual IP - default) uses a single virtual IP. Mode 'dnsrr' (DNS round-robin) returns DNS entries for all tasks.",
|
|
},
|
|
];
|
|
|
|
const hasStopGracePeriodSwarm = (
|
|
value: unknown,
|
|
): value is { stopGracePeriodSwarm: number | string | null } =>
|
|
typeof value === "object" &&
|
|
value !== null &&
|
|
"stopGracePeriodSwarm" in value;
|
|
|
|
interface Props {
|
|
id: string;
|
|
type:
|
|
| "application"
|
|
| "libsql"
|
|
| "mariadb"
|
|
| "mongo"
|
|
| "mysql"
|
|
| "postgres"
|
|
| "redis";
|
|
}
|
|
|
|
export const AddSwarmSettings = ({ id, type }: Props) => {
|
|
const [activeMenu, setActiveMenu] = useState<string>("health-check");
|
|
const [open, setOpen] = useState(false);
|
|
return (
|
|
<Dialog open={open} onOpenChange={setOpen}>
|
|
<DialogTrigger asChild>
|
|
<Button variant="secondary" className="cursor-pointer w-fit">
|
|
<Settings className="size-4 text-muted-foreground" />
|
|
Swarm Settings
|
|
</Button>
|
|
</DialogTrigger>
|
|
<DialogContent className="sm:max-w-6xl max-h-[85vh]">
|
|
<DialogHeader>
|
|
<DialogTitle>Swarm Settings</DialogTitle>
|
|
<DialogDescription>
|
|
Configure swarm settings for your service.
|
|
</DialogDescription>
|
|
</DialogHeader>
|
|
<div>
|
|
<AlertBlock type="info">
|
|
Changing settings such as placements may cause the logs/monitoring,
|
|
backups and other features to be unavailable.
|
|
</AlertBlock>
|
|
</div>
|
|
|
|
<div className="flex gap-4 h-[60vh] py-4">
|
|
{/* Left Column - Menu */}
|
|
<div className="w-64 shrink-0 border-r pr-4 overflow-y-auto">
|
|
<nav className="space-y-1">
|
|
<TooltipProvider>
|
|
{menuItems.map((item) => (
|
|
<Tooltip key={item.id}>
|
|
<TooltipTrigger asChild>
|
|
<button
|
|
type="button"
|
|
onClick={() => setActiveMenu(item.id)}
|
|
className={cn(
|
|
"w-full text-left px-3 py-2 rounded-md text-sm transition-colors",
|
|
activeMenu === item.id
|
|
? "bg-primary text-primary-foreground"
|
|
: "hover:bg-muted",
|
|
)}
|
|
>
|
|
<div className="font-medium">{item.label}</div>
|
|
<div className="text-xs opacity-80">
|
|
{item.description}
|
|
</div>
|
|
</button>
|
|
</TooltipTrigger>
|
|
<TooltipContent side="right" className="max-w-xs">
|
|
<p className="text-xs">{item.docDescription}</p>
|
|
</TooltipContent>
|
|
</Tooltip>
|
|
))}
|
|
</TooltipProvider>
|
|
</nav>
|
|
</div>
|
|
|
|
{/* Right Column - Form */}
|
|
<div className="flex-1 overflow-y-auto">
|
|
{activeMenu === "health-check" && (
|
|
<HealthCheckForm id={id} type={type} />
|
|
)}
|
|
{activeMenu === "restart-policy" && (
|
|
<RestartPolicyForm id={id} type={type} />
|
|
)}
|
|
{activeMenu === "placement" && (
|
|
<PlacementForm id={id} type={type} />
|
|
)}
|
|
{activeMenu === "update-config" && (
|
|
<UpdateConfigForm id={id} type={type} />
|
|
)}
|
|
{activeMenu === "rollback-config" && (
|
|
<RollbackConfigForm id={id} type={type} />
|
|
)}
|
|
{activeMenu === "mode" && <ModeForm id={id} type={type} />}
|
|
{activeMenu === "network" && <NetworkForm id={id} type={type} />}
|
|
{activeMenu === "labels" && <LabelsForm id={id} type={type} />}
|
|
{activeMenu === "stop-grace-period" && (
|
|
<StopGracePeriodForm id={id} type={type} />
|
|
)}
|
|
{activeMenu === "endpoint-spec" && (
|
|
<EndpointSpecForm id={id} type={type} />
|
|
)}
|
|
</div>
|
|
</div>
|
|
</DialogContent>
|
|
</Dialog>
|
|
);
|
|
};
|