mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-07-17 20:05:24 +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>
234 lines
6.3 KiB
TypeScript
234 lines
6.3 KiB
TypeScript
"use client";
|
|
|
|
import { BookIcon, CircuitBoard, GlobeIcon } from "lucide-react";
|
|
import { useRouter } from "next/router";
|
|
import React from "react";
|
|
import {
|
|
extractServices,
|
|
type Services,
|
|
} from "@/components/dashboard/settings/users/add-permissions";
|
|
import {
|
|
MariadbIcon,
|
|
MongodbIcon,
|
|
MysqlIcon,
|
|
PostgresqlIcon,
|
|
RedisIcon,
|
|
} from "@/components/icons/data-tools-icons";
|
|
import {
|
|
CommandDialog,
|
|
CommandEmpty,
|
|
CommandGroup,
|
|
CommandInput,
|
|
CommandItem,
|
|
CommandList,
|
|
CommandSeparator,
|
|
} from "@/components/ui/command";
|
|
import { api } from "@/utils/api";
|
|
import { StatusTooltip } from "../shared/status-tooltip";
|
|
|
|
// Extended Services type to include environmentId and environmentName for search navigation
|
|
type SearchServices = Services & {
|
|
environmentId: string;
|
|
environmentName: string;
|
|
};
|
|
|
|
const extractAllServicesFromProject = (project: any): SearchServices[] => {
|
|
const allServices: SearchServices[] = [];
|
|
|
|
// Iterate through all environments in the project
|
|
project.environments?.forEach((environment: any) => {
|
|
const environmentServices = extractServices(environment);
|
|
const servicesWithEnvironmentId: SearchServices[] = environmentServices.map(
|
|
(service) => ({
|
|
...service,
|
|
environmentId: environment.environmentId,
|
|
environmentName: environment.name,
|
|
}),
|
|
);
|
|
allServices.push(...servicesWithEnvironmentId);
|
|
});
|
|
|
|
return allServices;
|
|
};
|
|
|
|
export const SearchCommand = () => {
|
|
const router = useRouter();
|
|
const [open, setOpen] = React.useState(false);
|
|
const [search, setSearch] = React.useState("");
|
|
const { data: session } = api.user.session.useQuery();
|
|
const { data } = api.project.all.useQuery(undefined, {
|
|
enabled: !!session,
|
|
});
|
|
const { data: isCloud } = api.settings.isCloud.useQuery();
|
|
|
|
React.useEffect(() => {
|
|
const down = (e: KeyboardEvent) => {
|
|
if (e.code === "KeyJ" && (e.metaKey || e.ctrlKey)) {
|
|
e.preventDefault();
|
|
setOpen((open) => !open);
|
|
}
|
|
};
|
|
|
|
document.addEventListener("keydown", down);
|
|
return () => document.removeEventListener("keydown", down);
|
|
}, []);
|
|
|
|
return (
|
|
<div>
|
|
<CommandDialog open={open} onOpenChange={setOpen}>
|
|
<CommandInput
|
|
placeholder={"Search projects or settings"}
|
|
value={search}
|
|
onValueChange={setSearch}
|
|
/>
|
|
<CommandList>
|
|
<CommandEmpty>
|
|
No projects added yet. Click on Create project.
|
|
</CommandEmpty>
|
|
<CommandGroup heading={"Projects"}>
|
|
<CommandList>
|
|
{data?.map((project) => {
|
|
// Find default environment from accessible environments, or fall back to first accessible environment
|
|
const defaultEnvironment =
|
|
project.environments.find(
|
|
(environment) => environment.isDefault,
|
|
) || project?.environments?.[0];
|
|
|
|
if (!defaultEnvironment) return null;
|
|
|
|
return (
|
|
<CommandItem
|
|
key={project.projectId}
|
|
onSelect={() => {
|
|
router.push(
|
|
`/dashboard/project/${project.projectId}/environment/${defaultEnvironment.environmentId}`,
|
|
);
|
|
setOpen(false);
|
|
}}
|
|
>
|
|
<BookIcon className="size-4 text-muted-foreground mr-2" />
|
|
{project.name} / {defaultEnvironment.name}
|
|
</CommandItem>
|
|
);
|
|
})}
|
|
</CommandList>
|
|
</CommandGroup>
|
|
<CommandSeparator />
|
|
<CommandGroup heading={"Services"}>
|
|
<CommandList>
|
|
{data?.map((project) => {
|
|
const applications: SearchServices[] =
|
|
extractAllServicesFromProject(project);
|
|
return applications.map((application) => (
|
|
<CommandItem
|
|
key={application.id}
|
|
onSelect={() => {
|
|
router.push(
|
|
`/dashboard/project/${project.projectId}/environment/${application.environmentId}/services/${application.type}/${application.id}`,
|
|
);
|
|
setOpen(false);
|
|
}}
|
|
>
|
|
{application.type === "postgres" && (
|
|
<PostgresqlIcon className="h-6 w-6 mr-2" />
|
|
)}
|
|
{application.type === "redis" && (
|
|
<RedisIcon className="h-6 w-6 mr-2" />
|
|
)}
|
|
{application.type === "mariadb" && (
|
|
<MariadbIcon className="h-6 w-6 mr-2" />
|
|
)}
|
|
{application.type === "mongo" && (
|
|
<MongodbIcon className="h-6 w-6 mr-2" />
|
|
)}
|
|
{application.type === "mysql" && (
|
|
<MysqlIcon className="h-6 w-6 mr-2" />
|
|
)}
|
|
{application.type === "application" && (
|
|
<GlobeIcon className="h-6 w-6 mr-2" />
|
|
)}
|
|
{application.type === "compose" && (
|
|
<CircuitBoard className="h-6 w-6 mr-2" />
|
|
)}
|
|
<span className="grow">
|
|
{project.name} / {application.environmentName} /{" "}
|
|
{application.name}{" "}
|
|
<div style={{ display: "none" }}>{application.id}</div>
|
|
</span>
|
|
<div>
|
|
<StatusTooltip status={application.status} />
|
|
</div>
|
|
</CommandItem>
|
|
));
|
|
})}
|
|
</CommandList>
|
|
</CommandGroup>
|
|
<CommandSeparator />
|
|
<CommandGroup heading={"Application"} hidden={true}>
|
|
<CommandItem
|
|
onSelect={() => {
|
|
router.push("/dashboard/home");
|
|
setOpen(false);
|
|
}}
|
|
>
|
|
Projects
|
|
</CommandItem>
|
|
<CommandItem
|
|
onSelect={() => {
|
|
router.push("/dashboard/deployments");
|
|
setOpen(false);
|
|
}}
|
|
>
|
|
Deployments
|
|
</CommandItem>
|
|
{!isCloud && (
|
|
<>
|
|
<CommandItem
|
|
onSelect={() => {
|
|
router.push("/dashboard/monitoring");
|
|
setOpen(false);
|
|
}}
|
|
>
|
|
Monitoring
|
|
</CommandItem>
|
|
<CommandItem
|
|
onSelect={() => {
|
|
router.push("/dashboard/traefik");
|
|
setOpen(false);
|
|
}}
|
|
>
|
|
Traefik
|
|
</CommandItem>
|
|
<CommandItem
|
|
onSelect={() => {
|
|
router.push("/dashboard/docker");
|
|
setOpen(false);
|
|
}}
|
|
>
|
|
Docker
|
|
</CommandItem>
|
|
<CommandItem
|
|
onSelect={() => {
|
|
router.push("/dashboard/requests");
|
|
setOpen(false);
|
|
}}
|
|
>
|
|
Requests
|
|
</CommandItem>
|
|
</>
|
|
)}
|
|
<CommandItem
|
|
onSelect={() => {
|
|
router.push("/dashboard/settings/server");
|
|
setOpen(false);
|
|
}}
|
|
>
|
|
Settings
|
|
</CommandItem>
|
|
</CommandGroup>
|
|
</CommandList>
|
|
</CommandDialog>
|
|
</div>
|
|
);
|
|
};
|