[autofix.ci] apply automated fixes

This commit is contained in:
autofix-ci[bot]
2025-12-17 03:09:23 +00:00
committed by GitHub
parent 0ddf6b851f
commit 3a5ac9d31f
2 changed files with 130 additions and 75 deletions
@@ -1,5 +1,18 @@
import { format } from "date-fns"; import { format } from "date-fns";
import { KeyIcon, Loader2, MoreHorizontal, ServerIcon, Clock, User, Key, Network, Terminal, Settings, Pencil, Trash2 } from "lucide-react"; import {
KeyIcon,
Loader2,
MoreHorizontal,
ServerIcon,
Clock,
User,
Key,
Network,
Terminal,
Settings,
Pencil,
Trash2,
} from "lucide-react";
import Link from "next/link"; import Link from "next/link";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import { useTranslation } from "next-i18next"; import { useTranslation } from "next-i18next";
@@ -116,10 +129,12 @@ export const ShowServers = () => {
{data?.map((server) => { {data?.map((server) => {
const canDelete = server.totalSum === 0; const canDelete = server.totalSum === 0;
const isActive = server.serverStatus === "active"; const isActive = server.serverStatus === "active";
const isBuildServer = const isBuildServer = server.serverType === "build";
server.serverType === "build";
return ( return (
<Card key={server.serverId} className="relative hover:shadow-lg transition-shadow flex flex-col bg-transparent"> <Card
key={server.serverId}
className="relative hover:shadow-lg transition-shadow flex flex-col bg-transparent"
>
<CardHeader className="pb-3"> <CardHeader className="pb-3">
<div className="flex items-start justify-between"> <div className="flex items-start justify-between">
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
@@ -128,50 +143,52 @@ export const ShowServers = () => {
{server.name} {server.name}
</CardTitle> </CardTitle>
</div> </div>
{isActive && server.sshKeyId && !isBuildServer && ( {isActive &&
<DropdownMenu> server.sshKeyId &&
<DropdownMenuTrigger asChild> !isBuildServer && (
<Button <DropdownMenu>
variant="ghost" <DropdownMenuTrigger asChild>
className="h-8 w-8 p-0" <Button
> variant="ghost"
<span className="sr-only"> className="h-8 w-8 p-0"
More options >
</span> <span className="sr-only">
<MoreHorizontal className="h-4 w-4" /> More options
</Button> </span>
</DropdownMenuTrigger> <MoreHorizontal className="h-4 w-4" />
<DropdownMenuContent align="end"> </Button>
<DropdownMenuLabel> </DropdownMenuTrigger>
Advanced <DropdownMenuContent align="end">
</DropdownMenuLabel> <DropdownMenuLabel>
<ShowTraefikFileSystemModal Advanced
serverId={server.serverId} </DropdownMenuLabel>
/> <ShowTraefikFileSystemModal
<ShowDockerContainersModal serverId={server.serverId}
serverId={server.serverId}
/>
{isCloud && (
<ShowMonitoringModal
url={`http://${server.ipAddress}:${server?.metricsConfig?.server?.port}/metrics`}
token={
server?.metricsConfig
?.server?.token
}
/> />
)} <ShowDockerContainersModal
<ShowSwarmOverviewModal serverId={server.serverId}
serverId={server.serverId} />
/> {isCloud && (
<ShowNodesModal <ShowMonitoringModal
serverId={server.serverId} url={`http://${server.ipAddress}:${server?.metricsConfig?.server?.port}/metrics`}
/> token={
<ShowSchedulesModal server?.metricsConfig?.server
serverId={server.serverId} ?.token
/> }
</DropdownMenuContent> />
</DropdownMenu> )}
)} <ShowSwarmOverviewModal
serverId={server.serverId}
/>
<ShowNodesModal
serverId={server.serverId}
/>
<ShowSchedulesModal
serverId={server.serverId}
/>
</DropdownMenuContent>
</DropdownMenu>
)}
</div> </div>
<TooltipProvider> <TooltipProvider>
<div className="flex gap-2 mt-2 flex-wrap"> <div className="flex gap-2 mt-2 flex-wrap">
@@ -185,14 +202,24 @@ export const ShowServers = () => {
<Tooltip delayDuration={0}> <Tooltip delayDuration={0}>
<TooltipTrigger asChild> <TooltipTrigger asChild>
<span className="inline-block"> <span className="inline-block">
<Badge variant="destructive" className="cursor-help"> <Badge
variant="destructive"
className="cursor-help"
>
{server.serverStatus} {server.serverStatus}
</Badge> </Badge>
</span> </span>
</TooltipTrigger> </TooltipTrigger>
<TooltipContent className="max-w-xs" side="bottom"> <TooltipContent
className="max-w-xs"
side="bottom"
>
<p className="text-sm"> <p className="text-sm">
This server is deactivated due to lack of payment. Please pay your invoice to reactivate it. If you think this is an error, please contact support. This server is deactivated due
to lack of payment. Please pay
your invoice to reactivate it.
If you think this is an error,
please contact support.
</p> </p>
</TooltipContent> </TooltipContent>
</Tooltip> </Tooltip>
@@ -201,7 +228,9 @@ export const ShowServers = () => {
)} )}
<Badge <Badge
variant={ variant={
isBuildServer ? "secondary" : "default" isBuildServer
? "secondary"
: "default"
} }
> >
{server.serverType} {server.serverType}
@@ -212,19 +241,33 @@ export const ShowServers = () => {
<CardContent className="space-y-3 flex-1 flex flex-col"> <CardContent className="space-y-3 flex-1 flex flex-col">
<div className="flex items-center gap-2 text-sm"> <div className="flex items-center gap-2 text-sm">
<Network className="size-4 text-muted-foreground" /> <Network className="size-4 text-muted-foreground" />
<span className="text-muted-foreground">IP:</span> <span className="text-muted-foreground">
<Badge variant="outline">{server.ipAddress}</Badge> IP:
<span className="text-muted-foreground">Port:</span> </span>
<span className="font-medium">{server.port}</span> <Badge variant="outline">
{server.ipAddress}
</Badge>
<span className="text-muted-foreground">
Port:
</span>
<span className="font-medium">
{server.port}
</span>
</div> </div>
<div className="flex items-center gap-2 text-sm"> <div className="flex items-center gap-2 text-sm">
<User className="size-4 text-muted-foreground" /> <User className="size-4 text-muted-foreground" />
<span className="text-muted-foreground">User:</span> <span className="text-muted-foreground">
<span className="font-medium">{server.username}</span> User:
</span>
<span className="font-medium">
{server.username}
</span>
</div> </div>
<div className="flex items-center gap-2 text-sm"> <div className="flex items-center gap-2 text-sm">
<Key className="size-4 text-muted-foreground" /> <Key className="size-4 text-muted-foreground" />
<span className="text-muted-foreground">SSH Key:</span> <span className="text-muted-foreground">
SSH Key:
</span>
<span className="font-medium"> <span className="font-medium">
{server.sshKeyId ? "Yes" : "No"} {server.sshKeyId ? "Yes" : "No"}
</span> </span>
@@ -232,7 +275,11 @@ export const ShowServers = () => {
<div className="flex items-center gap-2 text-sm pt-2 border-t"> <div className="flex items-center gap-2 text-sm pt-2 border-t">
<Clock className="size-4 text-muted-foreground" /> <Clock className="size-4 text-muted-foreground" />
<span className="text-xs text-muted-foreground"> <span className="text-xs text-muted-foreground">
Created {format(new Date(server.createdAt), "PPp")} Created{" "}
{format(
new Date(server.createdAt),
"PPp",
)}
</span> </span>
</div> </div>
@@ -325,12 +372,14 @@ export const ShowServers = () => {
"This will delete the server and all associated data" "This will delete the server and all associated data"
) : ( ) : (
<div className="flex flex-col gap-2"> <div className="flex flex-col gap-2">
You can not delete this server You can not delete this
because it has active services. server because it has
active services.
<AlertBlock type="warning"> <AlertBlock type="warning">
You have active services You have active services
associated with this server, associated with this
please delete them first. server, please delete
them first.
</AlertBlock> </AlertBlock>
</div> </div>
) )
@@ -353,7 +402,7 @@ export const ShowServers = () => {
<Button <Button
variant="ghost" variant="ghost"
size="icon" size="icon"
className={`h-9 w-9 ${canDelete ? 'text-destructive hover:text-destructive hover:bg-destructive/10' : 'text-muted-foreground hover:bg-muted'}`} className={`h-9 w-9 ${canDelete ? "text-destructive hover:text-destructive hover:bg-destructive/10" : "text-muted-foreground hover:bg-muted"}`}
> >
<Trash2 className="h-4 w-4" /> <Trash2 className="h-4 w-4" />
</Button> </Button>
@@ -361,7 +410,11 @@ export const ShowServers = () => {
</div> </div>
</TooltipTrigger> </TooltipTrigger>
<TooltipContent> <TooltipContent>
<p>{canDelete ? 'Delete Server' : 'Cannot delete - has active services'}</p> <p>
{canDelete
? "Delete Server"
: "Cannot delete - has active services"}
</p>
</TooltipContent> </TooltipContent>
</Tooltip> </Tooltip>
</TooltipProvider> </TooltipProvider>
@@ -27,7 +27,11 @@ interface Props {
asButton?: boolean; asButton?: boolean;
} }
export const TerminalModal = ({ children, serverId, asButton = false }: Props) => { export const TerminalModal = ({
children,
serverId,
asButton = false,
}: Props) => {
const [terminalKey, setTerminalKey] = useState<string>(getTerminalKey()); const [terminalKey, setTerminalKey] = useState<string>(getTerminalKey());
const [isOpen, setIsOpen] = useState(false); const [isOpen, setIsOpen] = useState(false);
const isLocalServer = serverId === "local"; const isLocalServer = serverId === "local";
@@ -47,9 +51,7 @@ export const TerminalModal = ({ children, serverId, asButton = false }: Props) =
return ( return (
<Dialog open={isOpen} onOpenChange={setIsOpen}> <Dialog open={isOpen} onOpenChange={setIsOpen}>
{asButton ? ( {asButton ? (
<DialogTrigger asChild> <DialogTrigger asChild>{children}</DialogTrigger>
{children}
</DialogTrigger>
) : ( ) : (
<DropdownMenuItem <DropdownMenuItem
className="w-full cursor-pointer space-x-3" className="w-full cursor-pointer space-x-3"