feat(ui): design polish — semantic status tokens, self-hosted fonts, a11y, skeletons
Design system & theme: - add semantic status tokens (success/warning/danger + track) for both themes - replace hardcoded green/red/amber/blue across ~20 files with tokens - fix light-mode bugs (bg-white/10, rgba white gauges) via theme-aware track - add named text-2xs (11px) step; unify ad-hoc text-[10px]/[11px] - consistent card elevation (shadow-sm) + opt-in interactive hover Fonts & perf: - self-host DM Sans / JetBrains Mono via @fontsource-variable (font-display: swap) - drop render-blocking Google Fonts link; remove unused Geist dep Accessibility & mobile: - global prefers-reduced-motion; focus-visible on custom buttons - StatusDot role/aria-label; aria-sort on sortable table headers - Button auto nativeButton=false when rendered as Link/anchor - 100vh -> dvh in app shell; pointer-coarse min 44px touch targets Loading & types: - Skeleton primitive + table loading state on InstancesPage - fix all 36 pre-existing tsc errors (Select null coercion, SDN query keys, Dashboard Rec typing, VMInstance, profile language, JSX namespace) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -4,9 +4,7 @@
|
|||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
|
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
<!-- Fonts are self-hosted via @fontsource-variable (imported in main.tsx) -->
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
||||||
<link href="https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet" />
|
|
||||||
<title>PVEmanager</title>
|
<title>PVEmanager</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
18
frontend/package-lock.json
generated
18
frontend/package-lock.json
generated
@@ -9,7 +9,8 @@
|
|||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@base-ui/react": "^1.3.0",
|
"@base-ui/react": "^1.3.0",
|
||||||
"@fontsource-variable/geist": "^5.2.8",
|
"@fontsource-variable/dm-sans": "^5.2.8",
|
||||||
|
"@fontsource-variable/jetbrains-mono": "^5.2.8",
|
||||||
"@novnc/novnc": "^1.6.0",
|
"@novnc/novnc": "^1.6.0",
|
||||||
"@tailwindcss/vite": "^4.2.2",
|
"@tailwindcss/vite": "^4.2.2",
|
||||||
"@tanstack/react-query": "^5.96.2",
|
"@tanstack/react-query": "^5.96.2",
|
||||||
@@ -912,10 +913,19 @@
|
|||||||
"integrity": "sha512-RiB/yIh78pcIxl6lLMG0CgBXAZ2Y0eVHqMPYugu+9U0AeT6YBeiJpf7lbdJNIugFP5SIjwNRgo4DhR1Qxi26Gg==",
|
"integrity": "sha512-RiB/yIh78pcIxl6lLMG0CgBXAZ2Y0eVHqMPYugu+9U0AeT6YBeiJpf7lbdJNIugFP5SIjwNRgo4DhR1Qxi26Gg==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/@fontsource-variable/geist": {
|
"node_modules/@fontsource-variable/dm-sans": {
|
||||||
"version": "5.2.8",
|
"version": "5.2.8",
|
||||||
"resolved": "https://registry.npmjs.org/@fontsource-variable/geist/-/geist-5.2.8.tgz",
|
"resolved": "https://registry.npmjs.org/@fontsource-variable/dm-sans/-/dm-sans-5.2.8.tgz",
|
||||||
"integrity": "sha512-cJ6m9e+8MQ5dCYJsLylfZrgBh6KkG4bOLckB35Tr9J/EqdkEM6QllH5PxqP1dhTvFup+HtMRPuz9xOjxXJggxw==",
|
"integrity": "sha512-AxkvMTvNWgfrmlyjiV05vlHYJa+nRQCf1EfvIrQAPBpFJW0O9VTz7oAFr9S3lvbWdmnFoBk7yFqQL86u64nl2g==",
|
||||||
|
"license": "OFL-1.1",
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/ayuhito"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@fontsource-variable/jetbrains-mono": {
|
||||||
|
"version": "5.2.8",
|
||||||
|
"resolved": "https://registry.npmjs.org/@fontsource-variable/jetbrains-mono/-/jetbrains-mono-5.2.8.tgz",
|
||||||
|
"integrity": "sha512-WBA9elru6Jdp5df2mES55wuOO0WIrn3kpXnI4+W2ek5u3ZgLS9XS4gmIlcQhiZOWEKl95meYdvK7xI+ETLCq/Q==",
|
||||||
"license": "OFL-1.1",
|
"license": "OFL-1.1",
|
||||||
"funding": {
|
"funding": {
|
||||||
"url": "https://github.com/sponsors/ayuhito"
|
"url": "https://github.com/sponsors/ayuhito"
|
||||||
|
|||||||
@@ -12,7 +12,8 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@base-ui/react": "^1.3.0",
|
"@base-ui/react": "^1.3.0",
|
||||||
"@fontsource-variable/geist": "^5.2.8",
|
"@fontsource-variable/dm-sans": "^5.2.8",
|
||||||
|
"@fontsource-variable/jetbrains-mono": "^5.2.8",
|
||||||
"@novnc/novnc": "^1.6.0",
|
"@novnc/novnc": "^1.6.0",
|
||||||
"@tailwindcss/vite": "^4.2.2",
|
"@tailwindcss/vite": "^4.2.2",
|
||||||
"@tanstack/react-query": "^5.96.2",
|
"@tanstack/react-query": "^5.96.2",
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ export default function NotificationsDropdown() {
|
|||||||
{unread > 0 && (
|
{unread > 0 && (
|
||||||
<Badge
|
<Badge
|
||||||
variant="destructive"
|
variant="destructive"
|
||||||
className="absolute -right-0.5 -top-0.5 h-4 min-w-4 px-1 text-[10px]"
|
className="absolute -right-0.5 -top-0.5 h-4 min-w-4 px-1 text-2xs"
|
||||||
>
|
>
|
||||||
{unread > 99 ? '99+' : unread}
|
{unread > 99 ? '99+' : unread}
|
||||||
</Badge>
|
</Badge>
|
||||||
@@ -67,7 +67,7 @@ export default function NotificationsDropdown() {
|
|||||||
{n.title && n.message && (
|
{n.title && n.message && (
|
||||||
<p className="text-xs text-muted-foreground mt-0.5 line-clamp-2">{n.message}</p>
|
<p className="text-xs text-muted-foreground mt-0.5 line-clamp-2">{n.message}</p>
|
||||||
)}
|
)}
|
||||||
<p className="text-[10px] text-muted-foreground mt-1">
|
<p className="text-2xs text-muted-foreground mt-1">
|
||||||
{n.created_at ? new Date(n.created_at).toLocaleString() : ''}
|
{n.created_at ? new Date(n.created_at).toLocaleString() : ''}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ export function ColumnFilter<TData>({ column, variant = 'text', formatOption }:
|
|||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
size="icon"
|
size="icon"
|
||||||
className={cn('h-6 w-6', isActive && 'text-amber-500')}
|
className={cn('h-6 w-6', isActive && 'text-warning')}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ export function ProtectedRoute() {
|
|||||||
|
|
||||||
if (isLoading) {
|
if (isLoading) {
|
||||||
return (
|
return (
|
||||||
<div className="flex h-screen items-center justify-center">
|
<div className="flex h-dvh items-center justify-center">
|
||||||
<div className="h-8 w-8 animate-spin rounded-full border-2 border-primary border-t-transparent" />
|
<div className="h-8 w-8 animate-spin rounded-full border-2 border-primary border-t-transparent" />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import { cn } from '@/lib/utils';
|
import { cn } from '@/lib/utils';
|
||||||
|
|
||||||
const statusColors: Record<string, string> = {
|
const statusColors: Record<string, string> = {
|
||||||
running: 'bg-green-500',
|
running: 'bg-success',
|
||||||
stopped: 'bg-muted-foreground/40',
|
stopped: 'bg-muted-foreground/40',
|
||||||
paused: 'bg-amber-500',
|
paused: 'bg-warning',
|
||||||
suspended: 'bg-amber-500',
|
suspended: 'bg-warning',
|
||||||
unknown: 'bg-muted-foreground/30',
|
unknown: 'bg-muted-foreground/30',
|
||||||
online: 'bg-green-500',
|
online: 'bg-success',
|
||||||
offline: 'bg-red-500',
|
offline: 'bg-danger',
|
||||||
};
|
};
|
||||||
|
|
||||||
interface StatusDotProps {
|
interface StatusDotProps {
|
||||||
@@ -19,7 +19,14 @@ interface StatusDotProps {
|
|||||||
export function StatusDot({ status, className, pulse }: StatusDotProps) {
|
export function StatusDot({ status, className, pulse }: StatusDotProps) {
|
||||||
const color = statusColors[status] ?? statusColors.unknown;
|
const color = statusColors[status] ?? statusColors.unknown;
|
||||||
return (
|
return (
|
||||||
<span className={cn('relative inline-block h-2 w-2 rounded-full', color, className)}>
|
// role/aria-label so the status is not conveyed by colour alone — screen
|
||||||
|
// readers announce it, and sighted users get a native tooltip.
|
||||||
|
<span
|
||||||
|
role="img"
|
||||||
|
aria-label={status}
|
||||||
|
title={status}
|
||||||
|
className={cn('relative inline-block h-2 w-2 rounded-full', color, className)}
|
||||||
|
>
|
||||||
{pulse && status === 'running' && (
|
{pulse && status === 'running' && (
|
||||||
<span className={cn('absolute inset-0 animate-ping rounded-full opacity-75', color)} />
|
<span className={cn('absolute inset-0 animate-ping rounded-full opacity-75', color)} />
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { cva, type VariantProps } from "class-variance-authority"
|
|||||||
import { cn } from "@/lib/utils"
|
import { cn } from "@/lib/utils"
|
||||||
|
|
||||||
const buttonVariants = cva(
|
const buttonVariants = cva(
|
||||||
"group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
"group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 pointer-coarse:min-h-11 pointer-coarse:min-w-11 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
||||||
{
|
{
|
||||||
variants: {
|
variants: {
|
||||||
variant: {
|
variant: {
|
||||||
@@ -44,11 +44,18 @@ function Button({
|
|||||||
className,
|
className,
|
||||||
variant = "default",
|
variant = "default",
|
||||||
size = "default",
|
size = "default",
|
||||||
|
nativeButton,
|
||||||
|
render,
|
||||||
...props
|
...props
|
||||||
}: ButtonPrimitive.Props & VariantProps<typeof buttonVariants>) {
|
}: ButtonPrimitive.Props & VariantProps<typeof buttonVariants>) {
|
||||||
return (
|
return (
|
||||||
<ButtonPrimitive
|
<ButtonPrimitive
|
||||||
data-slot="button"
|
data-slot="button"
|
||||||
|
// A `render` prop replaces the underlying <button> (e.g. with a Link/<a>),
|
||||||
|
// so it's no longer a native button — tell Base UI to apply the button
|
||||||
|
// role + keyboard semantics instead. Explicit nativeButton always wins.
|
||||||
|
nativeButton={nativeButton ?? render === undefined}
|
||||||
|
render={render}
|
||||||
className={cn(buttonVariants({ variant, size, className }))}
|
className={cn(buttonVariants({ variant, size, className }))}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -5,14 +5,21 @@ import { cn } from "@/lib/utils"
|
|||||||
function Card({
|
function Card({
|
||||||
className,
|
className,
|
||||||
size = "default",
|
size = "default",
|
||||||
|
interactive = false,
|
||||||
...props
|
...props
|
||||||
}: React.ComponentProps<"div"> & { size?: "default" | "sm" }) {
|
}: React.ComponentProps<"div"> & {
|
||||||
|
size?: "default" | "sm"
|
||||||
|
/** Adds hover elevation + pointer affordance for clickable cards. */
|
||||||
|
interactive?: boolean
|
||||||
|
}) {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
data-slot="card"
|
data-slot="card"
|
||||||
data-size={size}
|
data-size={size}
|
||||||
className={cn(
|
className={cn(
|
||||||
"group/card flex flex-col gap-4 overflow-hidden rounded-xl bg-card py-4 text-sm text-card-foreground ring-1 ring-foreground/10 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",
|
"group/card flex flex-col gap-4 overflow-hidden rounded-xl bg-card py-4 text-sm text-card-foreground ring-1 ring-foreground/10 shadow-sm has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",
|
||||||
|
interactive &&
|
||||||
|
"cursor-pointer transition-shadow transition-[--tw-ring-color] hover:shadow-md hover:ring-foreground/20",
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
|
|||||||
18
frontend/src/components/ui/skeleton.tsx
Normal file
18
frontend/src/components/ui/skeleton.tsx
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
import { cn } from "@/lib/utils"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Placeholder shimmer for content that is still loading. Prefer this over a
|
||||||
|
* blocking spinner for loads that may exceed ~300ms. The pulse animation is
|
||||||
|
* automatically neutralised under prefers-reduced-motion (see index.css).
|
||||||
|
*/
|
||||||
|
function Skeleton({ className, ...props }: React.ComponentProps<"div">) {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
data-slot="skeleton"
|
||||||
|
className={cn("animate-pulse rounded-md bg-muted", className)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export { Skeleton }
|
||||||
@@ -782,7 +782,7 @@ export default function BackupsPage() {
|
|||||||
{Array.from(selectedBackups.values()).map((b) => (
|
{Array.from(selectedBackups.values()).map((b) => (
|
||||||
<div key={b.volid} className="flex items-center justify-between gap-2 px-2.5 py-1.5">
|
<div key={b.volid} className="flex items-center justify-between gap-2 px-2.5 py-1.5">
|
||||||
<span className="flex items-center gap-2 min-w-0">
|
<span className="flex items-center gap-2 min-w-0">
|
||||||
<Badge variant="outline" className="uppercase text-[10px] shrink-0">{detectVmType(b.volid)}</Badge>
|
<Badge variant="outline" className="uppercase text-2xs shrink-0">{detectVmType(b.volid)}</Badge>
|
||||||
<span className="font-mono shrink-0">#{b.vmid}</span>
|
<span className="font-mono shrink-0">#{b.vmid}</span>
|
||||||
<span className="font-mono text-xs text-muted-foreground truncate">{b.volid}</span>
|
<span className="font-mono text-xs text-muted-foreground truncate">{b.volid}</span>
|
||||||
</span>
|
</span>
|
||||||
@@ -794,7 +794,7 @@ export default function BackupsPage() {
|
|||||||
|
|
||||||
<div>
|
<div>
|
||||||
<Label>{t('backups.bulk_target_node')}</Label>
|
<Label>{t('backups.bulk_target_node')}</Label>
|
||||||
<Select value={bulkTargetNode} onValueChange={v => setBulkTargetNode(v)}>
|
<Select value={bulkTargetNode} onValueChange={v => setBulkTargetNode(v ?? "")}>
|
||||||
<SelectTrigger className="mt-1 w-full"><SelectValue /></SelectTrigger>
|
<SelectTrigger className="mt-1 w-full"><SelectValue /></SelectTrigger>
|
||||||
<SelectContent alignItemWithTrigger={false}>
|
<SelectContent alignItemWithTrigger={false}>
|
||||||
<SelectItem value="__source__">— {t('backups.bulk_target_node_source')}</SelectItem>
|
<SelectItem value="__source__">— {t('backups.bulk_target_node_source')}</SelectItem>
|
||||||
@@ -806,7 +806,7 @@ export default function BackupsPage() {
|
|||||||
|
|
||||||
<div>
|
<div>
|
||||||
<Label>{t('backups.restore_target_storage')}</Label>
|
<Label>{t('backups.restore_target_storage')}</Label>
|
||||||
<Select value={bulkTargetStorage} onValueChange={v => setBulkTargetStorage(v)}>
|
<Select value={bulkTargetStorage} onValueChange={v => setBulkTargetStorage(v ?? "")}>
|
||||||
<SelectTrigger className="mt-1 w-full"><SelectValue /></SelectTrigger>
|
<SelectTrigger className="mt-1 w-full"><SelectValue /></SelectTrigger>
|
||||||
<SelectContent alignItemWithTrigger={false}>
|
<SelectContent alignItemWithTrigger={false}>
|
||||||
<SelectItem value={FROM_BACKUP}>{t('backups.storage_from_backup')}</SelectItem>
|
<SelectItem value={FROM_BACKUP}>{t('backups.storage_from_backup')}</SelectItem>
|
||||||
@@ -986,7 +986,7 @@ export default function BackupsPage() {
|
|||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Badge variant="outline" className="uppercase text-[10px] px-1">{vm.type}</Badge>
|
<Badge variant="outline" className="uppercase text-2xs px-1">{vm.type}</Badge>
|
||||||
<span className="font-mono text-xs w-12">{vm.vmid}</span>
|
<span className="font-mono text-xs w-12">{vm.vmid}</span>
|
||||||
<span className="truncate">{vm.name || '—'}</span>
|
<span className="truncate">{vm.name || '—'}</span>
|
||||||
<span className="ml-auto text-xs text-muted-foreground font-mono">{vm.node}</span>
|
<span className="ml-auto text-xs text-muted-foreground font-mono">{vm.node}</span>
|
||||||
|
|||||||
@@ -417,10 +417,10 @@ function NativeJobDialog({ serverId, open, onOpenChange, editing, backupStorages
|
|||||||
<div>
|
<div>
|
||||||
<Label className="text-xs text-muted-foreground">{t('storages.retention')}</Label>
|
<Label className="text-xs text-muted-foreground">{t('storages.retention')}</Label>
|
||||||
<div className="mt-1.5 grid grid-cols-4 gap-2">
|
<div className="mt-1.5 grid grid-cols-4 gap-2">
|
||||||
<div className="space-y-1"><Label className="text-[11px]">{t('backups.keep_last')}</Label><Input type="number" min={0} value={form.keep_last} onChange={e => set('keep_last', e.target.value)} /></div>
|
<div className="space-y-1"><Label className="text-2xs">{t('backups.keep_last')}</Label><Input type="number" min={0} value={form.keep_last} onChange={e => set('keep_last', e.target.value)} /></div>
|
||||||
<div className="space-y-1"><Label className="text-[11px]">{t('backups.keep_daily')}</Label><Input type="number" min={0} value={form.keep_daily} onChange={e => set('keep_daily', e.target.value)} /></div>
|
<div className="space-y-1"><Label className="text-2xs">{t('backups.keep_daily')}</Label><Input type="number" min={0} value={form.keep_daily} onChange={e => set('keep_daily', e.target.value)} /></div>
|
||||||
<div className="space-y-1"><Label className="text-[11px]">{t('backups.keep_weekly')}</Label><Input type="number" min={0} value={form.keep_weekly} onChange={e => set('keep_weekly', e.target.value)} /></div>
|
<div className="space-y-1"><Label className="text-2xs">{t('backups.keep_weekly')}</Label><Input type="number" min={0} value={form.keep_weekly} onChange={e => set('keep_weekly', e.target.value)} /></div>
|
||||||
<div className="space-y-1"><Label className="text-[11px]">{t('backups.keep_monthly')}</Label><Input type="number" min={0} value={form.keep_monthly} onChange={e => set('keep_monthly', e.target.value)} /></div>
|
<div className="space-y-1"><Label className="text-2xs">{t('backups.keep_monthly')}</Label><Input type="number" min={0} value={form.keep_monthly} onChange={e => set('keep_monthly', e.target.value)} /></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -566,7 +566,7 @@ export default function StoragesTab() {
|
|||||||
<TableRow key={s.storage}>
|
<TableRow key={s.storage}>
|
||||||
<TableCell className="font-mono font-medium">
|
<TableCell className="font-mono font-medium">
|
||||||
{s.storage}
|
{s.storage}
|
||||||
{s.disable === 1 && <Badge variant="secondary" className="ml-2 text-[10px]">{t('storages.disabled')}</Badge>}
|
{s.disable === 1 && <Badge variant="secondary" className="ml-2 text-2xs">{t('storages.disabled')}</Badge>}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell><Badge variant="outline">{s.type}</Badge></TableCell>
|
<TableCell><Badge variant="outline">{s.type}</Badge></TableCell>
|
||||||
<TableCell className="text-xs">{s.content || '—'}</TableCell>
|
<TableCell className="text-xs">{s.content || '—'}</TableCell>
|
||||||
|
|||||||
@@ -248,14 +248,14 @@ function JoinWizard({
|
|||||||
{step === 2 && check && (
|
{step === 2 && check && (
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
{check.guests_count === 0 ? (
|
{check.guests_count === 0 ? (
|
||||||
<div className="flex items-start gap-2 rounded-md bg-green-500/10 p-3 text-sm">
|
<div className="flex items-start gap-2 rounded-md bg-success/10 p-3 text-sm">
|
||||||
<Info className="mt-0.5 h-4 w-4 shrink-0 text-green-500" />
|
<Info className="mt-0.5 h-4 w-4 shrink-0 text-success" />
|
||||||
<span>{t('cluster.node_clean', 'Node has no VMs/containers — ready to join.')}</span>
|
<span>{t('cluster.node_clean', 'Node has no VMs/containers — ready to join.')}</span>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<div className="flex items-start gap-2 rounded-md bg-amber-500/10 p-3 text-sm">
|
<div className="flex items-start gap-2 rounded-md bg-warning/10 p-3 text-sm">
|
||||||
<AlertTriangle className="mt-0.5 h-4 w-4 shrink-0 text-amber-500" />
|
<AlertTriangle className="mt-0.5 h-4 w-4 shrink-0 text-warning" />
|
||||||
<span>
|
<span>
|
||||||
{t('cluster.guests_warning',
|
{t('cluster.guests_warning',
|
||||||
'Joining a cluster overwrites /etc/pve — all VMs/containers on this node will be lost. They must be backed up and deleted first.')}
|
'Joining a cluster overwrites /etc/pve — all VMs/containers on this node will be lost. They must be backed up and deleted first.')}
|
||||||
@@ -266,7 +266,7 @@ function JoinWizard({
|
|||||||
{check.guests.map((g) => (
|
{check.guests.map((g) => (
|
||||||
<div key={`${g.type}-${g.vmid}`} className="flex items-center justify-between border-b px-3 py-1.5 text-sm last:border-b-0">
|
<div key={`${g.type}-${g.vmid}`} className="flex items-center justify-between border-b px-3 py-1.5 text-sm last:border-b-0">
|
||||||
<span className="flex items-center gap-2">
|
<span className="flex items-center gap-2">
|
||||||
<Badge variant="outline" className="text-[10px]">{g.type === 'qemu' ? 'VM' : 'LXC'}</Badge>
|
<Badge variant="outline" className="text-2xs">{g.type === 'qemu' ? 'VM' : 'LXC'}</Badge>
|
||||||
{g.name} <span className="text-muted-foreground">#{g.vmid}</span>
|
{g.name} <span className="text-muted-foreground">#{g.vmid}</span>
|
||||||
</span>
|
</span>
|
||||||
<StatusDot status={g.status} />
|
<StatusDot status={g.status} />
|
||||||
@@ -306,8 +306,8 @@ function JoinWizard({
|
|||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
{prepared && (
|
{prepared && (
|
||||||
<div className="flex items-center gap-2 rounded-md bg-green-500/10 p-3 text-sm">
|
<div className="flex items-center gap-2 rounded-md bg-success/10 p-3 text-sm">
|
||||||
<Info className="h-4 w-4 text-green-500" />
|
<Info className="h-4 w-4 text-success" />
|
||||||
{t('cluster.node_ready', 'Node cleared and ready to join.')}
|
{t('cluster.node_ready', 'Node cleared and ready to join.')}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
@@ -468,8 +468,8 @@ export default function ClusterPage() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{members.length === 2 && (
|
{members.length === 2 && (
|
||||||
<div className="flex items-start gap-2 rounded-md bg-amber-500/10 p-2.5 text-xs">
|
<div className="flex items-start gap-2 rounded-md bg-warning/10 p-2.5 text-xs">
|
||||||
<Info className="mt-0.5 h-3.5 w-3.5 shrink-0 text-amber-500" />
|
<Info className="mt-0.5 h-3.5 w-3.5 shrink-0 text-warning" />
|
||||||
<span>{t('cluster.two_node_quorum', 'A 2-node cluster loses quorum if one node fails. 3+ nodes or a QDevice is recommended for production.')}</span>
|
<span>{t('cluster.two_node_quorum', 'A 2-node cluster loses quorum if one node fails. 3+ nodes or a QDevice is recommended for production.')}</span>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -269,7 +269,7 @@ export default function ConsolePage() {
|
|||||||
<span className="text-xs text-muted-foreground">Node: {node}</span>
|
<span className="text-xs text-muted-foreground">Node: {node}</span>
|
||||||
<Badge
|
<Badge
|
||||||
variant="secondary"
|
variant="secondary"
|
||||||
className={`text-[10px] ${
|
className={`text-2xs ${
|
||||||
status === 'connected'
|
status === 'connected'
|
||||||
? 'bg-green-500/10 text-green-500'
|
? 'bg-green-500/10 text-green-500'
|
||||||
: status === 'connecting'
|
: status === 'connecting'
|
||||||
@@ -293,7 +293,7 @@ export default function ConsolePage() {
|
|||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
{isSerial && (
|
{isSerial && (
|
||||||
<Badge variant="secondary" className="text-[10px] bg-blue-500/10 text-blue-500">serial</Badge>
|
<Badge variant="secondary" className="text-2xs bg-blue-500/10 text-blue-500">serial</Badge>
|
||||||
)}
|
)}
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ export default function NodeShellPage() {
|
|||||||
<span className="text-xs text-muted-foreground">Node: {node}</span>
|
<span className="text-xs text-muted-foreground">Node: {node}</span>
|
||||||
<Badge
|
<Badge
|
||||||
variant="secondary"
|
variant="secondary"
|
||||||
className={`text-[10px] ${
|
className={`text-2xs ${
|
||||||
status === 'connected'
|
status === 'connected'
|
||||||
? 'bg-green-500/10 text-green-500'
|
? 'bg-green-500/10 text-green-500'
|
||||||
: status === 'connecting'
|
: status === 'connecting'
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import { getTasksWebSocket } from '@/lib/websocket'
|
|||||||
import { useInstancesMetricsSync } from '@/hooks/use-instances'
|
import { useInstancesMetricsSync } from '@/hooks/use-instances'
|
||||||
import { useAllTasks, useActiveTaskCount } from '@/hooks/use-tasks'
|
import { useAllTasks, useActiveTaskCount } from '@/hooks/use-tasks'
|
||||||
import { useIPAMNetworks } from '@/hooks/use-ipam'
|
import { useIPAMNetworks } from '@/hooks/use-ipam'
|
||||||
import { useNodeRrddata } from '@/hooks/use-nodes'
|
|
||||||
|
|
||||||
const CHART_COLORS = ['#3b82f6', '#22c55e', '#f59e0b', '#ef4444', '#a855f7', '#06b6d4', '#ec4899', '#84cc16']
|
const CHART_COLORS = ['#3b82f6', '#22c55e', '#f59e0b', '#ef4444', '#a855f7', '#06b6d4', '#ec4899', '#84cc16']
|
||||||
|
|
||||||
@@ -18,11 +17,12 @@ type Rec = Record<string, unknown>
|
|||||||
|
|
||||||
// ==================== Helpers ====================
|
// ==================== Helpers ====================
|
||||||
function barColor(pct: number) {
|
function barColor(pct: number) {
|
||||||
return pct >= 90 ? 'bg-red-500' : pct >= 70 ? 'bg-amber-500' : 'bg-green-500'
|
return pct >= 90 ? 'bg-danger' : pct >= 70 ? 'bg-warning' : 'bg-success'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SVG stroke colour — reference theme tokens so light/dark stay in sync.
|
||||||
function gaugeStroke(pct: number) {
|
function gaugeStroke(pct: number) {
|
||||||
return pct >= 90 ? '#ef4444' : pct >= 70 ? '#f59e0b' : '#22c55e'
|
return pct >= 90 ? 'var(--danger)' : pct >= 70 ? 'var(--warning)' : 'var(--success)'
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==================== Resource Bar ====================
|
// ==================== Resource Bar ====================
|
||||||
@@ -33,7 +33,7 @@ function ResourceBar({ label, percent }: { label: string; percent: number }) {
|
|||||||
<span className="text-muted-foreground">{label}</span>
|
<span className="text-muted-foreground">{label}</span>
|
||||||
<span className="tabular-nums font-medium">{percent.toFixed(1)}%</span>
|
<span className="tabular-nums font-medium">{percent.toFixed(1)}%</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="h-1.5 rounded-full bg-white/10 overflow-hidden">
|
<div className="h-1.5 rounded-full bg-track overflow-hidden">
|
||||||
<div
|
<div
|
||||||
className={`h-full rounded-full transition-all ${barColor(percent)}`}
|
className={`h-full rounded-full transition-all ${barColor(percent)}`}
|
||||||
style={{ width: `${Math.min(percent, 100)}%` }}
|
style={{ width: `${Math.min(percent, 100)}%` }}
|
||||||
@@ -54,7 +54,7 @@ function CircularGauge({ label, value }: { label: string; value: number }) {
|
|||||||
<div className="flex flex-col items-center gap-1.5">
|
<div className="flex flex-col items-center gap-1.5">
|
||||||
<div className="relative w-[68px] h-[68px]">
|
<div className="relative w-[68px] h-[68px]">
|
||||||
<svg viewBox="0 0 72 72" className="w-full h-full -rotate-90">
|
<svg viewBox="0 0 72 72" className="w-full h-full -rotate-90">
|
||||||
<circle cx="36" cy="36" r={r} fill="none" stroke="rgba(255,255,255,0.08)" strokeWidth="7" />
|
<circle cx="36" cy="36" r={r} fill="none" stroke="var(--track)" strokeWidth="7" />
|
||||||
<circle
|
<circle
|
||||||
cx="36" cy="36" r={r}
|
cx="36" cy="36" r={r}
|
||||||
fill="none" stroke={gaugeStroke(value)} strokeWidth="7"
|
fill="none" stroke={gaugeStroke(value)} strokeWidth="7"
|
||||||
@@ -67,7 +67,7 @@ function CircularGauge({ label, value }: { label: string; value: number }) {
|
|||||||
<span className="text-[13px] font-bold tabular-nums">{Math.round(clamped)}</span>
|
<span className="text-[13px] font-bold tabular-nums">{Math.round(clamped)}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<span className="text-[10px] text-muted-foreground tracking-wide">{label}</span>
|
<span className="text-2xs text-muted-foreground tracking-wide">{label}</span>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -93,7 +93,7 @@ function ClusterOverviewCard({ serverList, nodeStats, allVMs, memPercent, diskPe
|
|||||||
<Card className="h-full">
|
<Card className="h-full">
|
||||||
<CardContent className="p-5 flex flex-col gap-4 h-full">
|
<CardContent className="p-5 flex flex-col gap-4 h-full">
|
||||||
<div className="flex items-center gap-1.5">
|
<div className="flex items-center gap-1.5">
|
||||||
<button className="flex items-center gap-1.5 group text-left">
|
<button className="flex items-center gap-1.5 group text-left rounded-md outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-card">
|
||||||
<span className="text-base font-semibold group-hover:text-primary transition-colors">{clusterName}</span>
|
<span className="text-base font-semibold group-hover:text-primary transition-colors">{clusterName}</span>
|
||||||
<ChevronDown className="h-4 w-4 text-muted-foreground" />
|
<ChevronDown className="h-4 w-4 text-muted-foreground" />
|
||||||
</button>
|
</button>
|
||||||
@@ -102,16 +102,16 @@ function ClusterOverviewCard({ serverList, nodeStats, allVMs, memPercent, diskPe
|
|||||||
<div className={`grid ${cols} gap-4`}>
|
<div className={`grid ${cols} gap-4`}>
|
||||||
{availableIPs > 0 && (
|
{availableIPs > 0 && (
|
||||||
<div>
|
<div>
|
||||||
<p className="text-[10px] font-semibold uppercase tracking-wider text-muted-foreground mb-1">IPv4 доступно</p>
|
<p className="text-2xs font-semibold uppercase tracking-wider text-muted-foreground mb-1">IPv4 доступно</p>
|
||||||
<p className="text-3xl font-bold tabular-nums text-green-400">{availableIPs.toLocaleString()}</p>
|
<p className="text-3xl font-bold tabular-nums text-success">{availableIPs.toLocaleString()}</p>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<div>
|
<div>
|
||||||
<p className="text-[10px] font-semibold uppercase tracking-wider text-muted-foreground mb-1">Узлов</p>
|
<p className="text-2xs font-semibold uppercase tracking-wider text-muted-foreground mb-1">Узлов</p>
|
||||||
<p className="text-3xl font-bold tabular-nums">{nodeStats.length}</p>
|
<p className="text-3xl font-bold tabular-nums">{nodeStats.length}</p>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<p className="text-[10px] font-semibold uppercase tracking-wider text-muted-foreground mb-1">VM</p>
|
<p className="text-2xs font-semibold uppercase tracking-wider text-muted-foreground mb-1">VM</p>
|
||||||
<p className="text-3xl font-bold tabular-nums">{totalVMs + totalCTs}</p>
|
<p className="text-3xl font-bold tabular-nums">{totalVMs + totalCTs}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -175,7 +175,7 @@ function TasksTodayCard() {
|
|||||||
{rows.map(({ label, value, red }) => (
|
{rows.map(({ label, value, red }) => (
|
||||||
<div key={label} className="flex items-center justify-between">
|
<div key={label} className="flex items-center justify-between">
|
||||||
<span className="text-sm text-muted-foreground">{label}</span>
|
<span className="text-sm text-muted-foreground">{label}</span>
|
||||||
<span className={`text-sm font-semibold tabular-nums ${red ? 'text-red-500' : ''}`}>{value}</span>
|
<span className={`text-sm font-semibold tabular-nums ${red ? 'text-danger' : ''}`}>{value}</span>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
<div className="border-t border-border pt-2.5 flex items-center justify-between">
|
<div className="border-t border-border pt-2.5 flex items-center justify-between">
|
||||||
@@ -252,7 +252,7 @@ function ClusterNodesSection({ nodeStats }: { nodeStats: Rec[] }) {
|
|||||||
<button
|
<button
|
||||||
key={t}
|
key={t}
|
||||||
onClick={() => setTab(t)}
|
onClick={() => setTab(t)}
|
||||||
className={`rounded-full px-3 py-1 text-xs font-medium transition-colors ${
|
className={`rounded-full px-3 py-1 text-xs font-medium transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-card ${
|
||||||
tab === t
|
tab === t
|
||||||
? 'bg-primary text-primary-foreground'
|
? 'bg-primary text-primary-foreground'
|
||||||
: 'bg-muted text-muted-foreground hover:text-foreground'
|
: 'bg-muted text-muted-foreground hover:text-foreground'
|
||||||
@@ -265,7 +265,7 @@ function ClusterNodesSection({ nodeStats }: { nodeStats: Rec[] }) {
|
|||||||
</div>
|
</div>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent className="px-5 pb-4">
|
<CardContent className="px-5 pb-4">
|
||||||
<div className="grid grid-cols-[1fr_56px_56px_56px] gap-2 px-2 py-1 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground border-b border-border mb-1">
|
<div className="grid grid-cols-[1fr_56px_56px_56px] gap-2 px-2 py-1 text-2xs font-semibold uppercase tracking-wider text-muted-foreground border-b border-border mb-1">
|
||||||
<span>Название узлов</span>
|
<span>Название узлов</span>
|
||||||
<span className="text-right">CPU, %</span>
|
<span className="text-right">CPU, %</span>
|
||||||
<span className="text-right">RAM</span>
|
<span className="text-right">RAM</span>
|
||||||
@@ -285,18 +285,18 @@ function ClusterNodesSection({ nodeStats }: { nodeStats: Rec[] }) {
|
|||||||
className="grid grid-cols-[1fr_56px_56px_56px] gap-2 items-center px-2 py-2 rounded hover:bg-muted/40 text-sm"
|
className="grid grid-cols-[1fr_56px_56px_56px] gap-2 items-center px-2 py-2 rounded hover:bg-muted/40 text-sm"
|
||||||
>
|
>
|
||||||
<div className="flex items-center gap-2 min-w-0">
|
<div className="flex items-center gap-2 min-w-0">
|
||||||
<span className={`h-2 w-2 shrink-0 rounded-full ${online ? 'bg-green-500' : 'bg-red-400'}`} />
|
<span className={`h-2 w-2 shrink-0 rounded-full ${online ? 'bg-success' : 'bg-danger'}`} />
|
||||||
<span className="truncate">{String(n.node || n.name || `node-${i + 1}`)}</span>
|
<span className="truncate">{String(n.node || n.name || `node-${i + 1}`)}</span>
|
||||||
{n.server_name && (
|
{!!n.server_name && (
|
||||||
<span className="text-[10px] text-muted-foreground shrink-0">
|
<span className="text-2xs text-muted-foreground shrink-0">
|
||||||
#{String(n.server_name)}
|
#{String(n.server_name)}
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<span className={`text-right tabular-nums text-xs font-medium ${cpu >= 90 ? 'text-red-400' : cpu >= 70 ? 'text-amber-400' : ''}`}>
|
<span className={`text-right tabular-nums text-xs font-medium ${cpu >= 90 ? 'text-danger' : cpu >= 70 ? 'text-warning' : ''}`}>
|
||||||
{cpu.toFixed(0)}
|
{cpu.toFixed(0)}
|
||||||
</span>
|
</span>
|
||||||
<span className={`text-right tabular-nums text-xs ${ram >= 90 ? 'text-red-400' : ram >= 70 ? 'text-amber-400' : ''}`}>
|
<span className={`text-right tabular-nums text-xs ${ram >= 90 ? 'text-danger' : ram >= 70 ? 'text-warning' : ''}`}>
|
||||||
{ram.toFixed(0)}
|
{ram.toFixed(0)}
|
||||||
</span>
|
</span>
|
||||||
<span className="text-right tabular-nums text-xs text-muted-foreground">{disk.toFixed(0)}</span>
|
<span className="text-right tabular-nums text-xs text-muted-foreground">{disk.toFixed(0)}</span>
|
||||||
@@ -346,7 +346,7 @@ function ClusterNodesSection({ nodeStats }: { nodeStats: Rec[] }) {
|
|||||||
color: 'var(--popover-foreground)',
|
color: 'var(--popover-foreground)',
|
||||||
}}
|
}}
|
||||||
itemStyle={{ color: 'var(--popover-foreground)' }}
|
itemStyle={{ color: 'var(--popover-foreground)' }}
|
||||||
formatter={(v: number, name: string) => [`${v}%`, name]}
|
formatter={(v, name) => [`${v}%`, name]}
|
||||||
/>
|
/>
|
||||||
<Legend
|
<Legend
|
||||||
formatter={(value) => <span style={{ fontSize: 11 }}>{value}</span>}
|
formatter={(value) => <span style={{ fontSize: 11 }}>{value}</span>}
|
||||||
@@ -396,7 +396,7 @@ export default function DashboardPage() {
|
|||||||
)
|
)
|
||||||
|
|
||||||
const nodeStats = serverList.flatMap(s =>
|
const nodeStats = serverList.flatMap(s =>
|
||||||
((s.nodes as Rec[]) ?? []).map(n => ({
|
((s.nodes as Rec[]) ?? []).map((n): Rec => ({
|
||||||
...n,
|
...n,
|
||||||
server_name: s.server_name,
|
server_name: s.server_name,
|
||||||
server_id: s.id,
|
server_id: s.id,
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ export default function DownloadImageDialog({ open, onClose, serverId, node, ima
|
|||||||
</SelectContent>
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
{!storagesLoading && storages.length === 0 && (
|
{!storagesLoading && storages.length === 0 && (
|
||||||
<p className="mt-2 text-sm text-amber-600 dark:text-amber-500">
|
<p className="mt-2 text-sm text-warning">
|
||||||
{content === 'import'
|
{content === 'import'
|
||||||
? 'Нет хранилища с поддержкой импорта (content=import). Нужен dir/NFS storage с типом контента «Import» (PVE 8.2+).'
|
? 'Нет хранилища с поддержкой импорта (content=import). Нужен dir/NFS storage с типом контента «Import» (PVE 8.2+).'
|
||||||
: 'Нет хранилища с поддержкой шаблонов контейнеров (vztmpl).'}
|
: 'Нет хранилища с поддержкой шаблонов контейнеров (vztmpl).'}
|
||||||
@@ -191,7 +191,7 @@ export default function DownloadImageDialog({ open, onClose, serverId, node, ima
|
|||||||
</SelectContent>
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
{diskStorages.length === 0 && (
|
{diskStorages.length === 0 && (
|
||||||
<p className="mt-2 text-sm text-amber-600 dark:text-amber-500">
|
<p className="mt-2 text-sm text-warning">
|
||||||
Нет хранилища для дисков ВМ (content=images).
|
Нет хранилища для дисков ВМ (content=images).
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ export default function AddNetworkInterfaceDialog({ open, onClose, serverId, vmi
|
|||||||
) : (
|
) : (
|
||||||
<div className="space-y-1.5">
|
<div className="space-y-1.5">
|
||||||
<Label>{t('netif.model', 'Модель')}</Label>
|
<Label>{t('netif.model', 'Модель')}</Label>
|
||||||
<Select value={model} onValueChange={setModel}>
|
<Select value={model} onValueChange={(v) => setModel(v ?? "")}>
|
||||||
<SelectTrigger>
|
<SelectTrigger>
|
||||||
<SelectValue />
|
<SelectValue />
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
@@ -187,7 +187,7 @@ export default function AddNetworkInterfaceDialog({ open, onClose, serverId, vmi
|
|||||||
|
|
||||||
<div className="space-y-1.5">
|
<div className="space-y-1.5">
|
||||||
<Label>{t('netif.bridge', 'Мост')}</Label>
|
<Label>{t('netif.bridge', 'Мост')}</Label>
|
||||||
<Select value={bridge} onValueChange={setBridge}>
|
<Select value={bridge} onValueChange={(v) => setBridge(v ?? "")}>
|
||||||
<SelectTrigger>
|
<SelectTrigger>
|
||||||
<SelectValue placeholder={t('netif.select_bridge', 'Выберите мост')} />
|
<SelectValue placeholder={t('netif.select_bridge', 'Выберите мост')} />
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ export default function AddPciDeviceDialog({ open, onClose, serverId, vmid, node
|
|||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
<div className="space-y-1.5">
|
<div className="space-y-1.5">
|
||||||
<Label>{t('hw.pci_device', 'Устройство')}</Label>
|
<Label>{t('hw.pci_device', 'Устройство')}</Label>
|
||||||
<Select value={deviceId} onValueChange={setDeviceId}>
|
<Select value={deviceId} onValueChange={(v) => setDeviceId(v ?? "")}>
|
||||||
<SelectTrigger className="w-full">
|
<SelectTrigger className="w-full">
|
||||||
<SelectValue
|
<SelectValue
|
||||||
placeholder={
|
placeholder={
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ export default function AddUsbDeviceDialog({ open, onClose, serverId, vmid, node
|
|||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
<div className="space-y-1.5">
|
<div className="space-y-1.5">
|
||||||
<Label>{t('hw.usb_device', 'Устройство')}</Label>
|
<Label>{t('hw.usb_device', 'Устройство')}</Label>
|
||||||
<Select value={selected} onValueChange={setSelected}>
|
<Select value={selected} onValueChange={(v) => setSelected(v ?? "")}>
|
||||||
<SelectTrigger className="w-full">
|
<SelectTrigger className="w-full">
|
||||||
<SelectValue
|
<SelectValue
|
||||||
placeholder={
|
placeholder={
|
||||||
|
|||||||
@@ -257,13 +257,13 @@ export default function CreateInstanceWizard({ onClose }: { onClose?: () => void
|
|||||||
{STEPS.map((s, i) => (
|
{STEPS.map((s, i) => (
|
||||||
<div key={s} className="flex items-center gap-2">
|
<div key={s} className="flex items-center gap-2">
|
||||||
<div className={`flex h-8 w-8 items-center justify-center rounded-full text-sm font-medium ${
|
<div className={`flex h-8 w-8 items-center justify-center rounded-full text-sm font-medium ${
|
||||||
i < stepIdx ? 'bg-green-500/20 text-green-400' :
|
i < stepIdx ? 'bg-success/20 text-success' :
|
||||||
i === stepIdx ? 'bg-blue-500/20 text-blue-400 ring-2 ring-blue-500/50' :
|
i === stepIdx ? 'bg-primary/20 text-primary ring-2 ring-primary/50' :
|
||||||
'bg-muted text-muted-foreground'
|
'bg-muted text-muted-foreground'
|
||||||
}`}>
|
}`}>
|
||||||
{i < stepIdx ? <CheckCircle className="h-4 w-4" /> : i + 1}
|
{i < stepIdx ? <CheckCircle className="h-4 w-4" /> : i + 1}
|
||||||
</div>
|
</div>
|
||||||
{i < STEPS.length - 1 && <div className={`h-0.5 w-8 ${i < stepIdx ? 'bg-green-500/50' : 'bg-border'}`} />}
|
{i < STEPS.length - 1 && <div className={`h-0.5 w-8 ${i < stepIdx ? 'bg-success/50' : 'bg-border'}`} />}
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
@@ -276,7 +276,7 @@ export default function CreateInstanceWizard({ onClose }: { onClose?: () => void
|
|||||||
{servers.map(srv => (
|
{servers.map(srv => (
|
||||||
<Card
|
<Card
|
||||||
key={srv.id}
|
key={srv.id}
|
||||||
className={`cursor-pointer transition-colors hover:border-blue-500/50 ${selectedServer?.id === srv.id ? 'border-blue-500 bg-blue-500/5' : ''}`}
|
className={`cursor-pointer transition-colors hover:border-primary/50 ${selectedServer?.id === srv.id ? 'border-primary bg-primary/5' : ''}`}
|
||||||
onClick={() => { setSelectedServer(srv); setSelectedLXCTemplate(null); setSelectedTemplate(null); }}
|
onClick={() => { setSelectedServer(srv); setSelectedLXCTemplate(null); setSelectedTemplate(null); }}
|
||||||
>
|
>
|
||||||
<CardContent className="flex items-center gap-3 p-4">
|
<CardContent className="flex items-center gap-3 p-4">
|
||||||
@@ -301,29 +301,31 @@ export default function CreateInstanceWizard({ onClose }: { onClose?: () => void
|
|||||||
<h3 className="text-lg font-semibold">{t('wizard.select_type')}</h3>
|
<h3 className="text-lg font-semibold">{t('wizard.select_type')}</h3>
|
||||||
<div className="grid gap-3 sm:grid-cols-2">
|
<div className="grid gap-3 sm:grid-cols-2">
|
||||||
<Card
|
<Card
|
||||||
className={`cursor-pointer transition-colors hover:border-blue-500/50 ${kind === 'vm' ? 'border-blue-500 bg-blue-500/5' : ''}`}
|
interactive
|
||||||
|
className={kind === 'vm' ? 'border-primary bg-primary/5' : ''}
|
||||||
onClick={() => setKind('vm')}
|
onClick={() => setKind('vm')}
|
||||||
>
|
>
|
||||||
<CardContent className="flex items-center gap-4 p-5">
|
<CardContent className="flex items-center gap-4 p-5">
|
||||||
<HardDrive className="h-10 w-10 text-blue-400 shrink-0" />
|
<HardDrive className="h-10 w-10 text-primary shrink-0" />
|
||||||
<div>
|
<div>
|
||||||
<p className="font-semibold">{t('wizard.type_vm')}</p>
|
<p className="font-semibold">{t('wizard.type_vm')}</p>
|
||||||
<p className="text-sm text-muted-foreground">{t('wizard.type_vm_desc')}</p>
|
<p className="text-sm text-muted-foreground">{t('wizard.type_vm_desc')}</p>
|
||||||
</div>
|
</div>
|
||||||
{kind === 'vm' && <CheckCircle className="ml-auto h-5 w-5 text-blue-400 shrink-0" />}
|
{kind === 'vm' && <CheckCircle className="ml-auto h-5 w-5 text-primary shrink-0" />}
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
<Card
|
<Card
|
||||||
className={`cursor-pointer transition-colors hover:border-green-500/50 ${kind === 'lxc' ? 'border-green-500 bg-green-500/5' : ''}`}
|
interactive
|
||||||
|
className={kind === 'lxc' ? 'border-success bg-success/5' : ''}
|
||||||
onClick={() => setKind('lxc')}
|
onClick={() => setKind('lxc')}
|
||||||
>
|
>
|
||||||
<CardContent className="flex items-center gap-4 p-5">
|
<CardContent className="flex items-center gap-4 p-5">
|
||||||
<Container className="h-10 w-10 text-green-400 shrink-0" />
|
<Container className="h-10 w-10 text-success shrink-0" />
|
||||||
<div>
|
<div>
|
||||||
<p className="font-semibold">{t('wizard.type_lxc')}</p>
|
<p className="font-semibold">{t('wizard.type_lxc')}</p>
|
||||||
<p className="text-sm text-muted-foreground">{t('wizard.type_lxc_desc')}</p>
|
<p className="text-sm text-muted-foreground">{t('wizard.type_lxc_desc')}</p>
|
||||||
</div>
|
</div>
|
||||||
{kind === 'lxc' && <CheckCircle className="ml-auto h-5 w-5 text-green-400 shrink-0" />}
|
{kind === 'lxc' && <CheckCircle className="ml-auto h-5 w-5 text-success shrink-0" />}
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
</div>
|
</div>
|
||||||
@@ -344,7 +346,7 @@ export default function CreateInstanceWizard({ onClose }: { onClose?: () => void
|
|||||||
{groupTemplates.map(tpl => (
|
{groupTemplates.map(tpl => (
|
||||||
<Card
|
<Card
|
||||||
key={tpl.id}
|
key={tpl.id}
|
||||||
className={`cursor-pointer transition-colors hover:border-blue-500/50 ${selectedTemplate?.id === tpl.id ? 'border-blue-500 bg-blue-500/5' : ''}`}
|
className={`cursor-pointer transition-colors hover:border-primary/50 ${selectedTemplate?.id === tpl.id ? 'border-primary bg-primary/5' : ''}`}
|
||||||
onClick={() => selectTemplate(tpl)}
|
onClick={() => selectTemplate(tpl)}
|
||||||
>
|
>
|
||||||
<CardContent className="p-3">
|
<CardContent className="p-3">
|
||||||
@@ -390,12 +392,12 @@ export default function CreateInstanceWizard({ onClose }: { onClose?: () => void
|
|||||||
{lxcTemplates.map(tpl => (
|
{lxcTemplates.map(tpl => (
|
||||||
<Card
|
<Card
|
||||||
key={tpl.volid}
|
key={tpl.volid}
|
||||||
className={`cursor-pointer transition-colors hover:border-green-500/50 ${selectedLXCTemplate?.volid === tpl.volid ? 'border-green-500 bg-green-500/5' : ''}`}
|
className={`cursor-pointer transition-colors hover:border-success/50 ${selectedLXCTemplate?.volid === tpl.volid ? 'border-success bg-success/5' : ''}`}
|
||||||
onClick={() => setSelectedLXCTemplate(tpl)}
|
onClick={() => setSelectedLXCTemplate(tpl)}
|
||||||
>
|
>
|
||||||
<CardContent className="p-3">
|
<CardContent className="p-3">
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<Container className="h-5 w-5 text-green-400 shrink-0" />
|
<Container className="h-5 w-5 text-success shrink-0" />
|
||||||
<span className="font-medium text-sm truncate">{tpl.name}</span>
|
<span className="font-medium text-sm truncate">{tpl.name}</span>
|
||||||
</div>
|
</div>
|
||||||
<p className="mt-1 text-xs text-muted-foreground font-mono">
|
<p className="mt-1 text-xs text-muted-foreground font-mono">
|
||||||
@@ -479,7 +481,7 @@ export default function CreateInstanceWizard({ onClose }: { onClose?: () => void
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<Label>{t('wizard.storage')}</Label>
|
<Label>{t('wizard.storage')}</Label>
|
||||||
<Select value={config.storage} onValueChange={v => setConfig(p => ({ ...p, storage: v }))}>
|
<Select value={config.storage} onValueChange={v => setConfig(p => ({ ...p, storage: v ?? '' }))}>
|
||||||
<SelectTrigger><SelectValue /></SelectTrigger>
|
<SelectTrigger><SelectValue /></SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
{vmStorages.length > 0
|
{vmStorages.length > 0
|
||||||
@@ -583,7 +585,7 @@ export default function CreateInstanceWizard({ onClose }: { onClose?: () => void
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<Label>{t('wizard.storage')}</Label>
|
<Label>{t('wizard.storage')}</Label>
|
||||||
<Select value={lxcConfig.storage} onValueChange={v => setLxcConfig(p => ({ ...p, storage: v }))}>
|
<Select value={lxcConfig.storage} onValueChange={v => setLxcConfig(p => ({ ...p, storage: v ?? '' }))}>
|
||||||
<SelectTrigger><SelectValue /></SelectTrigger>
|
<SelectTrigger><SelectValue /></SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
{lxcStorages.length > 0
|
{lxcStorages.length > 0
|
||||||
@@ -814,7 +816,7 @@ function QuotaHint({ addCores, addMemoryMb, addDiskGb }: { addCores: number; add
|
|||||||
];
|
];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card className="border-amber-500/40">
|
<Card className="border-warning/40">
|
||||||
<CardHeader className="pb-3"><CardTitle className="text-sm flex items-center gap-2"><Gauge className="h-4 w-4" />{t('users.quota.manage')}</CardTitle></CardHeader>
|
<CardHeader className="pb-3"><CardTitle className="text-sm flex items-center gap-2"><Gauge className="h-4 w-4" />{t('users.quota.manage')}</CardTitle></CardHeader>
|
||||||
<CardContent className="grid gap-2 sm:grid-cols-2">
|
<CardContent className="grid gap-2 sm:grid-cols-2">
|
||||||
{rows.filter(r => r.limit !== null).map(r => {
|
{rows.filter(r => r.limit !== null).map(r => {
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ function CloneDialog({ open, onClose, serverId, vmid, type, node, name }: Omit<P
|
|||||||
<div className="grid grid-cols-2 gap-3">
|
<div className="grid grid-cols-2 gap-3">
|
||||||
<div className="space-y-1.5">
|
<div className="space-y-1.5">
|
||||||
<Label>Целевой узел</Label>
|
<Label>Целевой узел</Label>
|
||||||
<Select value={targetNode || CLONE_AUTO} onValueChange={(v) => { setTargetNode(v === CLONE_AUTO ? '' : v); setTargetStorage(''); }}>
|
<Select value={targetNode || CLONE_AUTO} onValueChange={(v) => { setTargetNode(v && v !== CLONE_AUTO ? v : ''); setTargetStorage(''); }}>
|
||||||
<SelectTrigger><SelectValue /></SelectTrigger>
|
<SelectTrigger><SelectValue /></SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
<SelectItem value={CLONE_AUTO}>Тот же узел ({node})</SelectItem>
|
<SelectItem value={CLONE_AUTO}>Тот же узел ({node})</SelectItem>
|
||||||
@@ -176,7 +176,7 @@ function CloneDialog({ open, onClose, serverId, vmid, type, node, name }: Omit<P
|
|||||||
|
|
||||||
<div className="space-y-1.5">
|
<div className="space-y-1.5">
|
||||||
<Label>Хранилище</Label>
|
<Label>Хранилище</Label>
|
||||||
<Select value={targetStorage || CLONE_AUTO} onValueChange={(v) => setTargetStorage(v === CLONE_AUTO ? '' : v)}>
|
<Select value={targetStorage || CLONE_AUTO} onValueChange={(v) => setTargetStorage(v && v !== CLONE_AUTO ? v : '')}>
|
||||||
<SelectTrigger><SelectValue /></SelectTrigger>
|
<SelectTrigger><SelectValue /></SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
<SelectItem value={CLONE_AUTO}>Как у источника</SelectItem>
|
<SelectItem value={CLONE_AUTO}>Как у источника</SelectItem>
|
||||||
@@ -303,7 +303,7 @@ function MigrateDialog({ open, onClose, serverId, vmid, type, node, name }: Omit
|
|||||||
</SelectContent>
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
{nodes.length === 0 && (
|
{nodes.length === 0 && (
|
||||||
<p className="text-xs text-amber-500">{t('instances.migrate_no_targets')}</p>
|
<p className="text-xs text-warning">{t('instances.migrate_no_targets')}</p>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -381,7 +381,7 @@ function ReinstallDialog({ open, onClose, serverId, vmid, node, name, type }: Om
|
|||||||
<DialogDescription>
|
<DialogDescription>
|
||||||
Это пересоздаст инстанс <strong>{expected}</strong> из исходного шаблона. Все данные будут утеряны.
|
Это пересоздаст инстанс <strong>{expected}</strong> из исходного шаблона. Все данные будут утеряны.
|
||||||
{type === 'lxc' && (
|
{type === 'lxc' && (
|
||||||
<span className="mt-2 block text-amber-500">Поддержка LXC — экспериментальная.</span>
|
<span className="mt-2 block text-warning">Поддержка LXC — экспериментальная.</span>
|
||||||
)}
|
)}
|
||||||
</DialogDescription>
|
</DialogDescription>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
@@ -609,7 +609,7 @@ function ExecuteCommandDialog({ open, onClose, serverId, vmid, node, type }: Omi
|
|||||||
{result && (
|
{result && (
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<div className="text-xs">
|
<div className="text-xs">
|
||||||
exit_code: <span className={result.exit_code === 0 ? 'text-green-500' : 'text-red-500'}>{result.exit_code}</span>
|
exit_code: <span className={result.exit_code === 0 ? 'text-success' : 'text-danger'}>{result.exit_code}</span>
|
||||||
</div>
|
</div>
|
||||||
{result.stdout && (
|
{result.stdout && (
|
||||||
<div>
|
<div>
|
||||||
@@ -620,10 +620,10 @@ function ExecuteCommandDialog({ open, onClose, serverId, vmid, node, type }: Omi
|
|||||||
{result.stderr && (
|
{result.stderr && (
|
||||||
<div>
|
<div>
|
||||||
<p className="mb-1 text-xs text-muted-foreground">stderr</p>
|
<p className="mb-1 text-xs text-muted-foreground">stderr</p>
|
||||||
<pre className="max-h-32 overflow-auto rounded-md bg-red-500/10 p-2 text-xs font-mono text-red-500">{result.stderr}</pre>
|
<pre className="max-h-32 overflow-auto rounded-md bg-danger/10 p-2 text-xs font-mono text-danger">{result.stderr}</pre>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{result.error && <p className="text-xs text-red-500">{result.error}</p>}
|
{result.error && <p className="text-xs text-danger">{result.error}</p>}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
@@ -756,20 +756,20 @@ type ActionConfig = {
|
|||||||
|
|
||||||
const POWER_ACTION_CONFIG: Record<PowerAction, ActionConfig> = {
|
const POWER_ACTION_CONFIG: Record<PowerAction, ActionConfig> = {
|
||||||
start: {
|
start: {
|
||||||
icon: <Play className="h-4 w-4 text-green-500" />,
|
icon: <Play className="h-4 w-4 text-success" />,
|
||||||
title: 'Запустить',
|
title: 'Запустить',
|
||||||
description: 'Запустить инстанс',
|
description: 'Запустить инстанс',
|
||||||
btnLabel: 'Запустить',
|
btnLabel: 'Запустить',
|
||||||
btnVariant: 'default',
|
btnVariant: 'default',
|
||||||
btnClass: 'bg-green-600 hover:bg-green-700 text-white border-0',
|
btnClass: 'bg-success text-success-foreground hover:bg-success/90 border-0',
|
||||||
},
|
},
|
||||||
restart: {
|
restart: {
|
||||||
icon: <RotateCcw className="h-4 w-4 text-amber-500" />,
|
icon: <RotateCcw className="h-4 w-4 text-warning" />,
|
||||||
title: 'Перезапустить',
|
title: 'Перезапустить',
|
||||||
description: 'Перезапустить инстанс',
|
description: 'Перезапустить инстанс',
|
||||||
btnLabel: 'Перезапустить',
|
btnLabel: 'Перезапустить',
|
||||||
btnVariant: 'outline',
|
btnVariant: 'outline',
|
||||||
btnClass: 'border-amber-500 text-amber-500 hover:bg-amber-500/10',
|
btnClass: 'border-warning text-warning hover:bg-warning/10',
|
||||||
},
|
},
|
||||||
shutdown: {
|
shutdown: {
|
||||||
icon: <Power className="h-4 w-4 text-orange-500" />,
|
icon: <Power className="h-4 w-4 text-orange-500" />,
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ import {
|
|||||||
} from 'lucide-react';
|
} from 'lucide-react';
|
||||||
import InstanceActionDialogs, { PowerConfirmDialog, type InstanceAction, type PowerAction } from './InstanceActionDialogs';
|
import InstanceActionDialogs, { PowerConfirmDialog, type InstanceAction, type PowerAction } from './InstanceActionDialogs';
|
||||||
import { Card, CardContent } from '@/components/ui/card';
|
import { Card, CardContent } from '@/components/ui/card';
|
||||||
|
import { Skeleton } from '@/components/ui/skeleton';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
import { Input } from '@/components/ui/input';
|
import { Input } from '@/components/ui/input';
|
||||||
import { Badge } from '@/components/ui/badge';
|
import { Badge } from '@/components/ui/badge';
|
||||||
@@ -86,7 +87,7 @@ import { toast } from 'sonner';
|
|||||||
// ==================== Inline Progress Bar ====================
|
// ==================== Inline Progress Bar ====================
|
||||||
function InlineProgress({ value, max, className }: { value: number; max: number; className?: string }) {
|
function InlineProgress({ value, max, className }: { value: number; max: number; className?: string }) {
|
||||||
const pct = max > 0 ? Math.min((value / max) * 100, 100) : 0;
|
const pct = max > 0 ? Math.min((value / max) * 100, 100) : 0;
|
||||||
const color = pct >= 90 ? 'bg-red-500' : pct >= 70 ? 'bg-amber-500' : 'bg-primary';
|
const color = pct >= 90 ? 'bg-danger' : pct >= 70 ? 'bg-warning' : 'bg-primary';
|
||||||
return (
|
return (
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<div className={`h-1.5 w-16 overflow-hidden rounded-full bg-muted ${className}`}>
|
<div className={`h-1.5 w-16 overflow-hidden rounded-full bg-muted ${className}`}>
|
||||||
@@ -110,7 +111,7 @@ function CircularProgress({ value }: { value: number }) {
|
|||||||
stroke="currentColor" strokeWidth="3"
|
stroke="currentColor" strokeWidth="3"
|
||||||
strokeDasharray={circ} strokeDashoffset={offset}
|
strokeDasharray={circ} strokeDashoffset={offset}
|
||||||
strokeLinecap="round"
|
strokeLinecap="round"
|
||||||
className="text-blue-500 transition-all duration-500"
|
className="text-primary transition-all duration-500"
|
||||||
transform="rotate(-90 14 14)"
|
transform="rotate(-90 14 14)"
|
||||||
/>
|
/>
|
||||||
</svg>
|
</svg>
|
||||||
@@ -580,7 +581,7 @@ export default function InstancesPage() {
|
|||||||
const task = deployTasks.find((t) => t.id === vm._deployTaskId);
|
const task = deployTasks.find((t) => t.id === vm._deployTaskId);
|
||||||
return (
|
return (
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<Loader2 className="h-3.5 w-3.5 animate-spin text-blue-500 shrink-0" />
|
<Loader2 className="h-3.5 w-3.5 animate-spin text-primary shrink-0" />
|
||||||
<div>
|
<div>
|
||||||
<span className="font-medium text-muted-foreground">{vm.name || 'New VM'}</span>
|
<span className="font-medium text-muted-foreground">{vm.name || 'New VM'}</span>
|
||||||
<span className="ml-2 text-xs text-muted-foreground">
|
<span className="ml-2 text-xs text-muted-foreground">
|
||||||
@@ -620,7 +621,7 @@ export default function InstancesPage() {
|
|||||||
return (
|
return (
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<CircularProgress value={progress} />
|
<CircularProgress value={progress} />
|
||||||
<Badge variant="secondary" className="bg-blue-500/10 text-blue-600 text-[10px]">
|
<Badge variant="secondary" className="bg-primary/10 text-primary text-2xs">
|
||||||
{t('instances.status_creating', 'Creating')}
|
{t('instances.status_creating', 'Creating')}
|
||||||
{progress > 0 ? ` ${progress}%` : ''}
|
{progress > 0 ? ` ${progress}%` : ''}
|
||||||
</Badge>
|
</Badge>
|
||||||
@@ -632,8 +633,8 @@ export default function InstancesPage() {
|
|||||||
if (bulkOv) {
|
if (bulkOv) {
|
||||||
return (
|
return (
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<Loader2 className="h-3.5 w-3.5 animate-spin text-blue-500 shrink-0" />
|
<Loader2 className="h-3.5 w-3.5 animate-spin text-primary shrink-0" />
|
||||||
<Badge variant="secondary" className="bg-blue-500/10 text-blue-600 text-[10px]">
|
<Badge variant="secondary" className="bg-primary/10 text-primary text-2xs">
|
||||||
{bulkActionLabel(bulkOv.action)}
|
{bulkActionLabel(bulkOv.action)}
|
||||||
</Badge>
|
</Badge>
|
||||||
</div>
|
</div>
|
||||||
@@ -647,7 +648,7 @@ export default function InstancesPage() {
|
|||||||
return (
|
return (
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<CircularProgress value={overlay.progress ?? 0} />
|
<CircularProgress value={overlay.progress ?? 0} />
|
||||||
<Badge variant="secondary" className="bg-amber-500/10 text-amber-600 text-[10px]">
|
<Badge variant="secondary" className="bg-warning/10 text-warning text-2xs">
|
||||||
{label}{(overlay.progress ?? 0) > 0 ? ` ${overlay.progress}%` : ''}
|
{label}{(overlay.progress ?? 0) > 0 ? ` ${overlay.progress}%` : ''}
|
||||||
</Badge>
|
</Badge>
|
||||||
</div>
|
</div>
|
||||||
@@ -657,14 +658,14 @@ export default function InstancesPage() {
|
|||||||
<div className="flex items-center gap-1.5">
|
<div className="flex items-center gap-1.5">
|
||||||
<Badge
|
<Badge
|
||||||
variant="secondary"
|
variant="secondary"
|
||||||
className={status === 'running' ? 'bg-green-500/10 text-green-500' : 'bg-muted text-muted-foreground'}
|
className={status === 'running' ? 'bg-success/10 text-success' : 'bg-muted text-muted-foreground'}
|
||||||
>
|
>
|
||||||
{status}
|
{status}
|
||||||
</Badge>
|
</Badge>
|
||||||
{vm.lock && (
|
{vm.lock && (
|
||||||
<Badge
|
<Badge
|
||||||
variant="secondary"
|
variant="secondary"
|
||||||
className="bg-amber-500/10 text-amber-600 text-[10px] gap-1"
|
className="bg-warning/10 text-warning text-2xs gap-1"
|
||||||
title={t('instances.locked_hint', 'Заблокировано Proxmox — операция выполняется')}
|
title={t('instances.locked_hint', 'Заблокировано Proxmox — операция выполняется')}
|
||||||
>
|
>
|
||||||
<Lock className="h-3 w-3" />
|
<Lock className="h-3 w-3" />
|
||||||
@@ -819,7 +820,7 @@ export default function InstancesPage() {
|
|||||||
id: 'net_io',
|
id: 'net_io',
|
||||||
header: () => (
|
header: () => (
|
||||||
<span className="flex items-center gap-1">
|
<span className="flex items-center gap-1">
|
||||||
<ArrowDown className="h-3 w-3 text-blue-500" />
|
<ArrowDown className="h-3 w-3 text-primary" />
|
||||||
<ArrowUp className="h-3 w-3 text-violet-500" />
|
<ArrowUp className="h-3 w-3 text-violet-500" />
|
||||||
Net
|
Net
|
||||||
</span>
|
</span>
|
||||||
@@ -834,7 +835,7 @@ export default function InstancesPage() {
|
|||||||
return (
|
return (
|
||||||
<div className="space-y-0.5">
|
<div className="space-y-0.5">
|
||||||
<div className="flex items-center gap-1">
|
<div className="flex items-center gap-1">
|
||||||
<ArrowDown className="h-3 w-3 shrink-0 text-blue-500" />
|
<ArrowDown className="h-3 w-3 shrink-0 text-primary" />
|
||||||
<span className="text-xs tabular-nums">{fmt(inRate)}</span>
|
<span className="text-xs tabular-nums">{fmt(inRate)}</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center gap-1">
|
<div className="flex items-center gap-1">
|
||||||
@@ -864,11 +865,11 @@ export default function InstancesPage() {
|
|||||||
return (
|
return (
|
||||||
<div className="space-y-0.5">
|
<div className="space-y-0.5">
|
||||||
<div className="flex items-center gap-1">
|
<div className="flex items-center gap-1">
|
||||||
<span className="text-[10px] text-cyan-500 font-medium w-3">R</span>
|
<span className="text-2xs text-cyan-500 font-medium w-3">R</span>
|
||||||
<span className="text-xs tabular-nums">{fmt(readRate)}</span>
|
<span className="text-xs tabular-nums">{fmt(readRate)}</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center gap-1">
|
<div className="flex items-center gap-1">
|
||||||
<span className="text-[10px] text-orange-500 font-medium w-3">W</span>
|
<span className="text-2xs text-orange-500 font-medium w-3">W</span>
|
||||||
<span className="text-xs tabular-nums">{fmt(writeRate)}</span>
|
<span className="text-xs tabular-nums">{fmt(writeRate)}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -951,15 +952,15 @@ export default function InstancesPage() {
|
|||||||
<Tabs value={typeTab} onValueChange={setTypeTab}>
|
<Tabs value={typeTab} onValueChange={setTypeTab}>
|
||||||
<TabsList>
|
<TabsList>
|
||||||
<TabsTrigger value="all">
|
<TabsTrigger value="all">
|
||||||
All <Badge variant="secondary" className="ml-1.5 text-[10px]">{counts.all}</Badge>
|
All <Badge variant="secondary" className="ml-1.5 text-2xs">{counts.all}</Badge>
|
||||||
</TabsTrigger>
|
</TabsTrigger>
|
||||||
<TabsTrigger value="vm">
|
<TabsTrigger value="vm">
|
||||||
<Monitor className="mr-1 h-3.5 w-3.5" /> VM
|
<Monitor className="mr-1 h-3.5 w-3.5" /> VM
|
||||||
<Badge variant="secondary" className="ml-1.5 text-[10px]">{counts.vm}</Badge>
|
<Badge variant="secondary" className="ml-1.5 text-2xs">{counts.vm}</Badge>
|
||||||
</TabsTrigger>
|
</TabsTrigger>
|
||||||
<TabsTrigger value="lxc">
|
<TabsTrigger value="lxc">
|
||||||
<Container className="mr-1 h-3.5 w-3.5" /> LXC
|
<Container className="mr-1 h-3.5 w-3.5" /> LXC
|
||||||
<Badge variant="secondary" className="ml-1.5 text-[10px]">{counts.lxc}</Badge>
|
<Badge variant="secondary" className="ml-1.5 text-2xs">{counts.lxc}</Badge>
|
||||||
</TabsTrigger>
|
</TabsTrigger>
|
||||||
</TabsList>
|
</TabsList>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
@@ -1043,9 +1044,9 @@ export default function InstancesPage() {
|
|||||||
return (
|
return (
|
||||||
<div key={task.id} className="flex items-center gap-3 rounded-lg border bg-muted/50 p-2">
|
<div key={task.id} className="flex items-center gap-3 rounded-lg border bg-muted/50 p-2">
|
||||||
{isDone ? (
|
{isDone ? (
|
||||||
<Power className={`h-4 w-4 ${task.failed > 0 ? 'text-amber-500' : 'text-green-500'}`} />
|
<Power className={`h-4 w-4 ${task.failed > 0 ? 'text-warning' : 'text-success'}`} />
|
||||||
) : (
|
) : (
|
||||||
<Loader2 className="h-4 w-4 animate-spin text-blue-500" />
|
<Loader2 className="h-4 w-4 animate-spin text-primary" />
|
||||||
)}
|
)}
|
||||||
<span className="text-sm font-medium">{bulkActionLabel(task.action)}</span>
|
<span className="text-sm font-medium">{bulkActionLabel(task.action)}</span>
|
||||||
<InlineProgress value={processed} max={task.total} />
|
<InlineProgress value={processed} max={task.total} />
|
||||||
@@ -1053,7 +1054,7 @@ export default function InstancesPage() {
|
|||||||
{processed}/{task.total}
|
{processed}/{task.total}
|
||||||
</span>
|
</span>
|
||||||
{task.failed > 0 && (
|
{task.failed > 0 && (
|
||||||
<span className="text-xs text-red-500">
|
<span className="text-xs text-danger">
|
||||||
{task.failed} {t('instances.bulk_failed', 'с ошибкой')}
|
{task.failed} {t('instances.bulk_failed', 'с ошибкой')}
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
@@ -1065,8 +1066,17 @@ export default function InstancesPage() {
|
|||||||
<Card>
|
<Card>
|
||||||
<CardContent className="p-0">
|
<CardContent className="p-0">
|
||||||
{isLoading ? (
|
{isLoading ? (
|
||||||
<div className="flex items-center justify-center py-20">
|
<div className="space-y-3 p-4" aria-busy="true" aria-label={t('common.loading', 'Loading')}>
|
||||||
<Loader2 className="h-6 w-6 animate-spin text-muted-foreground" />
|
{Array.from({ length: 8 }).map((_, i) => (
|
||||||
|
<div key={i} className="flex items-center gap-4">
|
||||||
|
<Skeleton className="h-4 w-4 rounded" />
|
||||||
|
<Skeleton className="h-4 flex-1 max-w-[220px]" />
|
||||||
|
<Skeleton className="h-4 w-16" />
|
||||||
|
<Skeleton className="hidden h-4 w-24 sm:block" />
|
||||||
|
<Skeleton className="hidden h-4 w-20 md:block" />
|
||||||
|
<Skeleton className="ml-auto h-4 w-8" />
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
</div>
|
</div>
|
||||||
) : allRows.length === 0 ? (
|
) : allRows.length === 0 ? (
|
||||||
<div className="flex flex-col items-center justify-center py-20 text-muted-foreground">
|
<div className="flex flex-col items-center justify-center py-20 text-muted-foreground">
|
||||||
@@ -1081,8 +1091,21 @@ export default function InstancesPage() {
|
|||||||
<TableRow key={headerGroup.id}>
|
<TableRow key={headerGroup.id}>
|
||||||
{headerGroup.headers.map((header) => {
|
{headerGroup.headers.map((header) => {
|
||||||
const filterVariant = header.column.columnDef.meta?.filter;
|
const filterVariant = header.column.columnDef.meta?.filter;
|
||||||
|
// Expose sort state to assistive tech (WCAG aria-sort).
|
||||||
|
const sorted = header.column.getIsSorted();
|
||||||
|
const ariaSort = !header.column.getCanSort()
|
||||||
|
? undefined
|
||||||
|
: sorted === 'asc'
|
||||||
|
? 'ascending'
|
||||||
|
: sorted === 'desc'
|
||||||
|
? 'descending'
|
||||||
|
: 'none';
|
||||||
return (
|
return (
|
||||||
<TableHead key={header.id} style={{ width: header.getSize() }}>
|
<TableHead
|
||||||
|
key={header.id}
|
||||||
|
style={{ width: header.getSize() }}
|
||||||
|
aria-sort={ariaSort}
|
||||||
|
>
|
||||||
{header.isPlaceholder ? null : (
|
{header.isPlaceholder ? null : (
|
||||||
<div className="flex items-center gap-0.5">
|
<div className="flex items-center gap-0.5">
|
||||||
{flexRender(header.column.columnDef.header, header.getContext())}
|
{flexRender(header.column.columnDef.header, header.getContext())}
|
||||||
@@ -1108,7 +1131,7 @@ export default function InstancesPage() {
|
|||||||
<TableRow
|
<TableRow
|
||||||
key={row.id}
|
key={row.id}
|
||||||
data-state={row.getIsSelected() && 'selected'}
|
data-state={row.getIsSelected() && 'selected'}
|
||||||
className={isGhost ? 'opacity-70 bg-blue-500/5 border-l-2 border-l-blue-500' : undefined}
|
className={isGhost ? 'opacity-70 bg-primary/5 border-l-2 border-l-primary' : undefined}
|
||||||
>
|
>
|
||||||
{row.getVisibleCells().map((cell) => (
|
{row.getVisibleCells().map((cell) => (
|
||||||
<TableCell key={cell.id}>
|
<TableCell key={cell.id}>
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ export default function SnapshotArchivesPage() {
|
|||||||
<TableCell>
|
<TableCell>
|
||||||
<span className="text-sm">{a.vm_name || '—'}</span>
|
<span className="text-sm">{a.vm_name || '—'}</span>
|
||||||
<span className="ml-1 text-xs text-muted-foreground">#{a.vmid}</span>
|
<span className="ml-1 text-xs text-muted-foreground">#{a.vmid}</span>
|
||||||
{a.vm_type && <Badge variant="outline" className="ml-2 text-[10px]">{a.vm_type === 'qemu' ? 'VM' : 'LXC'}</Badge>}
|
{a.vm_type && <Badge variant="outline" className="ml-2 text-2xs">{a.vm_type === 'qemu' ? 'VM' : 'LXC'}</Badge>}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell className="text-xs text-muted-foreground">{a.server_name || a.server_id}{a.node ? ` / ${a.node}` : ''}</TableCell>
|
<TableCell className="text-xs text-muted-foreground">{a.server_name || a.server_id}{a.node ? ` / ${a.node}` : ''}</TableCell>
|
||||||
<TableCell className="text-xs">{a.deleted_by || '—'}</TableCell>
|
<TableCell className="text-xs">{a.deleted_by || '—'}</TableCell>
|
||||||
|
|||||||
@@ -81,11 +81,11 @@ function ChartCard({ title, data, dataKey, color, formatValue, unit, headerRight
|
|||||||
<XAxis
|
<XAxis
|
||||||
dataKey="time"
|
dataKey="time"
|
||||||
tickFormatter={fmtTime}
|
tickFormatter={fmtTime}
|
||||||
className="text-[10px] fill-muted-foreground"
|
className="text-2xs fill-muted-foreground"
|
||||||
tick={{ fontSize: 10 }}
|
tick={{ fontSize: 10 }}
|
||||||
/>
|
/>
|
||||||
<YAxis
|
<YAxis
|
||||||
className="text-[10px] fill-muted-foreground"
|
className="text-2xs fill-muted-foreground"
|
||||||
tick={{ fontSize: 10 }}
|
tick={{ fontSize: 10 }}
|
||||||
tickFormatter={(v) => (formatValue ? formatValue(v) : String(v))}
|
tickFormatter={(v) => (formatValue ? formatValue(v) : String(v))}
|
||||||
width={55}
|
width={55}
|
||||||
@@ -150,7 +150,7 @@ export default function GraphsTab({ serverId, vmid, type, node }: Props) {
|
|||||||
nic,
|
nic,
|
||||||
});
|
});
|
||||||
|
|
||||||
const points = (data?.data ?? []) as Array<Record<string, unknown>>;
|
const points = (data?.data ?? []) as unknown as Array<Record<string, unknown>>;
|
||||||
const nics = data?.meta?.nics ?? [];
|
const nics = data?.meta?.nics ?? [];
|
||||||
|
|
||||||
function resetCustom() {
|
function resetCustom() {
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ function PlatformCard({
|
|||||||
<div className="grid gap-4 sm:grid-cols-2">
|
<div className="grid gap-4 sm:grid-cols-2">
|
||||||
<div className="space-y-1.5">
|
<div className="space-y-1.5">
|
||||||
<Label>{t('hw.bios', 'BIOS')}</Label>
|
<Label>{t('hw.bios', 'BIOS')}</Label>
|
||||||
<Select value={bios} onValueChange={setBios}>
|
<Select value={bios} onValueChange={(v) => setBios(v ?? "")}>
|
||||||
<SelectTrigger className="w-full"><SelectValue /></SelectTrigger>
|
<SelectTrigger className="w-full"><SelectValue /></SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
{BIOS_OPTIONS.map((o) => <SelectItem key={o.value} value={o.value}>{o.label}</SelectItem>)}
|
{BIOS_OPTIONS.map((o) => <SelectItem key={o.value} value={o.value}>{o.label}</SelectItem>)}
|
||||||
@@ -132,7 +132,7 @@ function PlatformCard({
|
|||||||
</div>
|
</div>
|
||||||
<div className="space-y-1.5">
|
<div className="space-y-1.5">
|
||||||
<Label>{t('hw.machine', 'Тип платформы')}</Label>
|
<Label>{t('hw.machine', 'Тип платформы')}</Label>
|
||||||
<Select value={machine} onValueChange={setMachine}>
|
<Select value={machine} onValueChange={(v) => setMachine(v ?? "")}>
|
||||||
<SelectTrigger className="w-full"><SelectValue /></SelectTrigger>
|
<SelectTrigger className="w-full"><SelectValue /></SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
{MACHINE_OPTIONS.map((o) => <SelectItem key={o.value} value={o.value}>{o.label}</SelectItem>)}
|
{MACHINE_OPTIONS.map((o) => <SelectItem key={o.value} value={o.value}>{o.label}</SelectItem>)}
|
||||||
@@ -141,7 +141,7 @@ function PlatformCard({
|
|||||||
</div>
|
</div>
|
||||||
<div className="space-y-1.5">
|
<div className="space-y-1.5">
|
||||||
<Label>{t('hw.vga', 'Дисплей (VGA)')}</Label>
|
<Label>{t('hw.vga', 'Дисплей (VGA)')}</Label>
|
||||||
<Select value={vga} onValueChange={setVga}>
|
<Select value={vga} onValueChange={(v) => setVga(v ?? "")}>
|
||||||
<SelectTrigger className="w-full"><SelectValue /></SelectTrigger>
|
<SelectTrigger className="w-full"><SelectValue /></SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
{VGA_OPTIONS.map((o) => <SelectItem key={o} value={o}>{o}</SelectItem>)}
|
{VGA_OPTIONS.map((o) => <SelectItem key={o} value={o}>{o}</SelectItem>)}
|
||||||
@@ -150,7 +150,7 @@ function PlatformCard({
|
|||||||
</div>
|
</div>
|
||||||
<div className="space-y-1.5">
|
<div className="space-y-1.5">
|
||||||
<Label>{t('hw.scsihw', 'SCSI-контроллер')}</Label>
|
<Label>{t('hw.scsihw', 'SCSI-контроллер')}</Label>
|
||||||
<Select value={scsihw} onValueChange={setScsihw}>
|
<Select value={scsihw} onValueChange={(v) => setScsihw(v ?? "")}>
|
||||||
<SelectTrigger className="w-full"><SelectValue /></SelectTrigger>
|
<SelectTrigger className="w-full"><SelectValue /></SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
{SCSIHW_OPTIONS.map((o) => <SelectItem key={o} value={o}>{o}</SelectItem>)}
|
{SCSIHW_OPTIONS.map((o) => <SelectItem key={o} value={o}>{o}</SelectItem>)}
|
||||||
@@ -166,8 +166,8 @@ function PlatformCard({
|
|||||||
|
|
||||||
{/* EFI-диск: обязателен для OVMF, показываем выбор хранилища */}
|
{/* EFI-диск: обязателен для OVMF, показываем выбор хранилища */}
|
||||||
{needsEfiDisk && (
|
{needsEfiDisk && (
|
||||||
<div className="rounded-md border border-amber-500/40 bg-amber-500/5 p-3 space-y-2">
|
<div className="rounded-md border border-warning/40 bg-warning/5 p-3 space-y-2">
|
||||||
<div className="flex items-center gap-2 text-sm font-medium text-amber-600 dark:text-amber-500">
|
<div className="flex items-center gap-2 text-sm font-medium text-warning">
|
||||||
<AlertTriangle className="h-4 w-4" />
|
<AlertTriangle className="h-4 w-4" />
|
||||||
{t('hw.efi_required_title', 'Для OVMF (UEFI) нужен EFI-диск')}
|
{t('hw.efi_required_title', 'Для OVMF (UEFI) нужен EFI-диск')}
|
||||||
</div>
|
</div>
|
||||||
@@ -176,7 +176,7 @@ function PlatformCard({
|
|||||||
</p>
|
</p>
|
||||||
<div className="space-y-1.5">
|
<div className="space-y-1.5">
|
||||||
<Label>{t('hw.efi_storage', 'Хранилище EFI-диска')}</Label>
|
<Label>{t('hw.efi_storage', 'Хранилище EFI-диска')}</Label>
|
||||||
<Select value={efiStorage} onValueChange={setEfiStorage}>
|
<Select value={efiStorage} onValueChange={(v) => setEfiStorage(v ?? "")}>
|
||||||
<SelectTrigger className="w-full">
|
<SelectTrigger className="w-full">
|
||||||
<SelectValue placeholder={
|
<SelectValue placeholder={
|
||||||
storagesLoading
|
storagesLoading
|
||||||
@@ -275,7 +275,7 @@ export default function HardwareTab({ serverId, vmid, type, node }: Props) {
|
|||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent className="space-y-3">
|
<CardContent className="space-y-3">
|
||||||
{isRunning && (
|
{isRunning && (
|
||||||
<div className="flex items-center gap-2 rounded-md border border-amber-500/40 bg-amber-500/5 p-2.5 text-xs text-amber-600 dark:text-amber-500">
|
<div className="flex items-center gap-2 rounded-md border border-warning/40 bg-warning/5 p-2.5 text-xs text-warning">
|
||||||
<AlertTriangle className="h-3.5 w-3.5 shrink-0" />
|
<AlertTriangle className="h-3.5 w-3.5 shrink-0" />
|
||||||
{t('hw.running_lock', 'VM запущена — проброс устройств нельзя добавить или удалить. Выключите VM.')}
|
{t('hw.running_lock', 'VM запущена — проброс устройств нельзя добавить или удалить. Выключите VM.')}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ export default function NetworkingTab({ serverId, vmid, type, node }: Props) {
|
|||||||
{iface.ips.map((ip) => (
|
{iface.ips.map((ip) => (
|
||||||
<div key={ip.address} className="flex items-center gap-2">
|
<div key={ip.address} className="flex items-center gap-2">
|
||||||
<span className="font-mono text-xs">{ip.address}/{ip.prefix}</span>
|
<span className="font-mono text-xs">{ip.address}/{ip.prefix}</span>
|
||||||
<Badge variant="secondary" className="text-[10px]">{ip.type}</Badge>
|
<Badge variant="secondary" className="text-2xs">{ip.type}</Badge>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -28,9 +28,9 @@ function MetricCard({
|
|||||||
const barColor =
|
const barColor =
|
||||||
percent !== undefined
|
percent !== undefined
|
||||||
? percent >= 90
|
? percent >= 90
|
||||||
? 'bg-red-500'
|
? 'bg-danger'
|
||||||
: percent >= 70
|
: percent >= 70
|
||||||
? 'bg-amber-500'
|
? 'bg-warning'
|
||||||
: 'bg-primary'
|
: 'bg-primary'
|
||||||
: 'bg-primary';
|
: 'bg-primary';
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@ function NetworkCard({ label, inRate, outRate }: { label: string; inRate?: numbe
|
|||||||
|
|
||||||
function DiskCard({ disk }: { disk: DiskInfo }) {
|
function DiskCard({ disk }: { disk: DiskInfo }) {
|
||||||
const pct = disk.total > 0 ? (disk.used / disk.total) * 100 : 0;
|
const pct = disk.total > 0 ? (disk.used / disk.total) * 100 : 0;
|
||||||
const barColor = pct >= 90 ? 'bg-red-500' : pct >= 70 ? 'bg-amber-500' : 'bg-primary';
|
const barColor = pct >= 90 ? 'bg-danger' : pct >= 70 ? 'bg-warning' : 'bg-primary';
|
||||||
return (
|
return (
|
||||||
<Card>
|
<Card>
|
||||||
<CardContent className="p-4">
|
<CardContent className="p-4">
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ function ExecuteScriptCard({ serverId, vmid, node }: { serverId: number; vmid: n
|
|||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<div className="flex items-center gap-2 text-xs">
|
<div className="flex items-center gap-2 text-xs">
|
||||||
<span className="text-muted-foreground">{t('instances.exit_code')}:</span>
|
<span className="text-muted-foreground">{t('instances.exit_code')}:</span>
|
||||||
<code className={r.exit_code === 0 ? 'text-green-600 dark:text-green-500' : 'text-destructive'}>{r.exit_code ?? '—'}</code>
|
<code className={r.exit_code === 0 ? 'text-success' : 'text-destructive'}>{r.exit_code ?? '—'}</code>
|
||||||
</div>
|
</div>
|
||||||
{r.error && <p className="text-xs text-destructive">{r.error}</p>}
|
{r.error && <p className="text-xs text-destructive">{r.error}</p>}
|
||||||
{r.stdout != null && r.stdout !== '' && (
|
{r.stdout != null && r.stdout !== '' && (
|
||||||
@@ -433,7 +433,7 @@ function CloudInitCard({ serverId, vmid, type, node }: { serverId: number; vmid:
|
|||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent className="space-y-4">
|
<CardContent className="space-y-4">
|
||||||
{!hasCloudInit && (
|
{!hasCloudInit && (
|
||||||
<p className="rounded-md bg-amber-500/10 px-3 py-2 text-xs text-amber-600 dark:text-amber-500">
|
<p className="rounded-md bg-warning/10 px-3 py-2 text-xs text-warning">
|
||||||
{t('instances.ci_no_drive')}
|
{t('instances.ci_no_drive')}
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
@@ -953,7 +953,7 @@ function DiskManagementCard({ serverId, vmid, type, node }: { serverId: number;
|
|||||||
<div className="space-y-2 border-t pt-3">
|
<div className="space-y-2 border-t pt-3">
|
||||||
<Label className="text-xs font-medium">{t('instances.disk_add')}</Label>
|
<Label className="text-xs font-medium">{t('instances.disk_add')}</Label>
|
||||||
<div className="grid gap-3 sm:grid-cols-3">
|
<div className="grid gap-3 sm:grid-cols-3">
|
||||||
<div className="space-y-1"><Label className="text-[11px]">{t('instances.disk_bus')}</Label>
|
<div className="space-y-1"><Label className="text-2xs">{t('instances.disk_bus')}</Label>
|
||||||
<Select value={addBus} onValueChange={(v) => v && setAddBus(v)}>
|
<Select value={addBus} onValueChange={(v) => v && setAddBus(v)}>
|
||||||
<SelectTrigger><SelectValue /></SelectTrigger>
|
<SelectTrigger><SelectValue /></SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
@@ -963,13 +963,13 @@ function DiskManagementCard({ serverId, vmid, type, node }: { serverId: number;
|
|||||||
</SelectContent>
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
</div>
|
</div>
|
||||||
<div className="space-y-1"><Label className="text-[11px]">{t('instances.migrate_target_storage')}</Label>
|
<div className="space-y-1"><Label className="text-2xs">{t('instances.migrate_target_storage')}</Label>
|
||||||
<Select value={addStorage} onValueChange={(v) => v && setAddStorage(v)}>
|
<Select value={addStorage} onValueChange={(v) => v && setAddStorage(v)}>
|
||||||
<SelectTrigger><SelectValue placeholder="—" /></SelectTrigger>
|
<SelectTrigger><SelectValue placeholder="—" /></SelectTrigger>
|
||||||
<SelectContent>{storages.map((s) => <SelectItem key={s.storage} value={s.storage}>{s.storage}</SelectItem>)}</SelectContent>
|
<SelectContent>{storages.map((s) => <SelectItem key={s.storage} value={s.storage}>{s.storage}</SelectItem>)}</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
</div>
|
</div>
|
||||||
<div className="space-y-1"><Label className="text-[11px]">{t('instances.new_size_gb')}</Label>
|
<div className="space-y-1"><Label className="text-2xs">{t('instances.new_size_gb')}</Label>
|
||||||
<Input type="number" min={1} value={addSize} onChange={(e) => setAddSize(e.target.value)} />
|
<Input type="number" min={1} value={addSize} onChange={(e) => setAddSize(e.target.value)} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1159,7 +1159,7 @@ export default function SettingsTab({ serverId, vmid, type, node }: Props) {
|
|||||||
<div className="space-y-1.5">
|
<div className="space-y-1.5">
|
||||||
<Label htmlFor="disk-device">{t('instances.disk_device')}</Label>
|
<Label htmlFor="disk-device">{t('instances.disk_device')}</Label>
|
||||||
{diskDevices.length > 0 ? (
|
{diskDevices.length > 0 ? (
|
||||||
<Select value={diskDevice} onValueChange={setDiskDevice}>
|
<Select value={diskDevice} onValueChange={(v) => setDiskDevice(v ?? "")}>
|
||||||
<SelectTrigger id="disk-device">
|
<SelectTrigger id="disk-device">
|
||||||
<SelectValue placeholder={t('common.placeholder_disk')} />
|
<SelectValue placeholder={t('common.placeholder_disk')} />
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
@@ -1212,7 +1212,7 @@ export default function SettingsTab({ serverId, vmid, type, node }: Props) {
|
|||||||
</p>
|
</p>
|
||||||
{growResult && (
|
{growResult && (
|
||||||
<div className="space-y-1.5">
|
<div className="space-y-1.5">
|
||||||
<p className={`text-xs font-medium ${growResult.grown ? 'text-green-500' : 'text-amber-500'}`}>
|
<p className={`text-xs font-medium ${growResult.grown ? 'text-success' : 'text-warning'}`}>
|
||||||
{growResult.grown
|
{growResult.grown
|
||||||
? 'Файловая система расширена внутри ОС'
|
? 'Файловая система расширена внутри ОС'
|
||||||
: 'Файловая система не расширена — вывод growpart ниже'}
|
: 'Файловая система не расширена — вывод growpart ниже'}
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ export default function SnapshotsTab({ serverId, vmid, type, node }: Props) {
|
|||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell>
|
<TableCell>
|
||||||
{snap.vmstate ? (
|
{snap.vmstate ? (
|
||||||
<Badge variant="secondary" className="text-[10px]">RAM</Badge>
|
<Badge variant="secondary" className="text-2xs">RAM</Badge>
|
||||||
) : (
|
) : (
|
||||||
<span className="text-xs text-muted-foreground">No</span>
|
<span className="text-xs text-muted-foreground">No</span>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -345,7 +345,7 @@ function PoolsCard({ networkId, pools }: { networkId: number; pools: IPAMPool[]
|
|||||||
const ipMapColors: Record<string, string> = {
|
const ipMapColors: Record<string, string> = {
|
||||||
gateway: 'bg-purple-500',
|
gateway: 'bg-purple-500',
|
||||||
allocated: 'bg-blue-500',
|
allocated: 'bg-blue-500',
|
||||||
reserved: 'bg-amber-500',
|
reserved: 'bg-warning',
|
||||||
available: 'bg-muted',
|
available: 'bg-muted',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -302,7 +302,7 @@ function IPHistoryCard() {
|
|||||||
<div className="rounded-lg border divide-y text-sm">
|
<div className="rounded-lg border divide-y text-sm">
|
||||||
{rows.map((h, i) => (
|
{rows.map((h, i) => (
|
||||||
<div key={i} className="flex items-center gap-2 px-3 py-2">
|
<div key={i} className="flex items-center gap-2 px-3 py-2">
|
||||||
<Badge variant="outline" className="text-[10px]">{String(h.action ?? '')}</Badge>
|
<Badge variant="outline" className="text-2xs">{String(h.action ?? '')}</Badge>
|
||||||
<span className="text-muted-foreground">{String(h.resource_name ?? '')}</span>
|
<span className="text-muted-foreground">{String(h.resource_name ?? '')}</span>
|
||||||
<span className="ml-auto text-xs text-muted-foreground">
|
<span className="ml-auto text-xs text-muted-foreground">
|
||||||
{String(h.performed_by ?? '')} · {h.performed_at ? new Date(String(h.performed_at)).toLocaleString() : ''}
|
{String(h.performed_by ?? '')} · {h.performed_at ? new Date(String(h.performed_at)).toLocaleString() : ''}
|
||||||
|
|||||||
@@ -11,15 +11,15 @@ import type { AuditLog } from '@/types';
|
|||||||
function levelClass(level?: string) {
|
function levelClass(level?: string) {
|
||||||
switch ((level || '').toUpperCase()) {
|
switch ((level || '').toUpperCase()) {
|
||||||
case 'ERROR':
|
case 'ERROR':
|
||||||
return 'bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-300';
|
return 'bg-danger/10 text-danger';
|
||||||
case 'WARNING':
|
case 'WARNING':
|
||||||
case 'WARN':
|
case 'WARN':
|
||||||
return 'bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-300';
|
return 'bg-warning/10 text-warning';
|
||||||
case 'SUCCESS':
|
case 'SUCCESS':
|
||||||
return 'bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300';
|
return 'bg-success/10 text-success';
|
||||||
case 'INFO':
|
case 'INFO':
|
||||||
default:
|
default:
|
||||||
return 'bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300';
|
return 'bg-primary/10 text-primary';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,10 +79,10 @@ export default function LogsPage() {
|
|||||||
<CardTitle className="text-sm font-medium">
|
<CardTitle className="text-sm font-medium">
|
||||||
{t('logs.errors_24h', 'Errors (24h)')}
|
{t('logs.errors_24h', 'Errors (24h)')}
|
||||||
</CardTitle>
|
</CardTitle>
|
||||||
<AlertCircle className="h-4 w-4 text-red-500" />
|
<AlertCircle className="h-4 w-4 text-danger" />
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent>
|
<CardContent>
|
||||||
<div className="text-2xl font-bold text-red-600">
|
<div className="text-2xl font-bold text-danger">
|
||||||
{statsQuery.data?.errors_count ?? '—'}
|
{statsQuery.data?.errors_count ?? '—'}
|
||||||
</div>
|
</div>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
@@ -92,10 +92,10 @@ export default function LogsPage() {
|
|||||||
<CardTitle className="text-sm font-medium">
|
<CardTitle className="text-sm font-medium">
|
||||||
{t('logs.failed_logins', 'Failed Logins')}
|
{t('logs.failed_logins', 'Failed Logins')}
|
||||||
</CardTitle>
|
</CardTitle>
|
||||||
<ShieldAlert className="h-4 w-4 text-yellow-500" />
|
<ShieldAlert className="h-4 w-4 text-warning" />
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent>
|
<CardContent>
|
||||||
<div className="text-2xl font-bold text-yellow-600">
|
<div className="text-2xl font-bold text-warning">
|
||||||
{statsQuery.data?.failed_logins ?? '—'}
|
{statsQuery.data?.failed_logins ?? '—'}
|
||||||
</div>
|
</div>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
@@ -156,7 +156,7 @@ export default function LogsPage() {
|
|||||||
{t('common.loading', 'Loading…')}
|
{t('common.loading', 'Loading…')}
|
||||||
</div>
|
</div>
|
||||||
) : logsQuery.error ? (
|
) : logsQuery.error ? (
|
||||||
<div className="p-8 text-center text-red-500 text-sm">
|
<div className="p-8 text-center text-danger text-sm">
|
||||||
{t('logs.load_error', 'Failed to load logs')}
|
{t('logs.load_error', 'Failed to load logs')}
|
||||||
</div>
|
</div>
|
||||||
) : logs.length === 0 ? (
|
) : logs.length === 0 ? (
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ function TokenDialog({ serverId, userid, open, onClose }: { serverId: number; us
|
|||||||
|
|
||||||
{secret ? (
|
{secret ? (
|
||||||
<div className="space-y-3">
|
<div className="space-y-3">
|
||||||
<div className="rounded-md border border-amber-500/40 bg-amber-500/5 p-3 text-xs text-amber-600 dark:text-amber-500">
|
<div className="rounded-md border border-warning/40 bg-warning/5 p-3 text-xs text-warning">
|
||||||
{t('access.secret_warning', 'Секрет показывается только один раз — сохраните его сейчас.')}
|
{t('access.secret_warning', 'Секрет показывается только один раз — сохраните его сейчас.')}
|
||||||
</div>
|
</div>
|
||||||
<div className="space-y-1.5">
|
<div className="space-y-1.5">
|
||||||
|
|||||||
@@ -261,13 +261,13 @@ export default function DiskManager({ serverId, nodeNames }: { serverId: number;
|
|||||||
{disks.map(d => (
|
{disks.map(d => (
|
||||||
<TableRow key={d.devpath}>
|
<TableRow key={d.devpath}>
|
||||||
<TableCell className="font-mono text-xs font-medium">{d.devpath}</TableCell>
|
<TableCell className="font-mono text-xs font-medium">{d.devpath}</TableCell>
|
||||||
<TableCell><Badge variant="outline" className="uppercase text-[10px]">{d.type || '—'}</Badge></TableCell>
|
<TableCell><Badge variant="outline" className="uppercase text-2xs">{d.type || '—'}</Badge></TableCell>
|
||||||
<TableCell className="text-xs">{d.model || '—'}{d.serial ? <span className="block text-[10px] text-muted-foreground font-mono">{d.serial}</span> : null}</TableCell>
|
<TableCell className="text-xs">{d.model || '—'}{d.serial ? <span className="block text-2xs text-muted-foreground font-mono">{d.serial}</span> : null}</TableCell>
|
||||||
<TableCell className="text-xs tabular-nums">{formatBytes(d.size || 0)}</TableCell>
|
<TableCell className="text-xs tabular-nums">{formatBytes(d.size || 0)}</TableCell>
|
||||||
<TableCell className="text-xs">{d.used || <span className="text-muted-foreground">{t('disks.free', 'свободен')}</span>}</TableCell>
|
<TableCell className="text-xs">{d.used || <span className="text-muted-foreground">{t('disks.free', 'свободен')}</span>}</TableCell>
|
||||||
<TableCell>
|
<TableCell>
|
||||||
{d.health ? <Badge variant={healthVariant(d.health)}>{d.health}</Badge> : <span className="text-xs text-muted-foreground">—</span>}
|
{d.health ? <Badge variant={healthVariant(d.health)}>{d.health}</Badge> : <span className="text-xs text-muted-foreground">—</span>}
|
||||||
{d.wearout != null && d.wearout !== '' && <span className="ml-1 text-[10px] text-muted-foreground">wear {d.wearout}%</span>}
|
{d.wearout != null && d.wearout !== '' && <span className="ml-1 text-2xs text-muted-foreground">wear {d.wearout}%</span>}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell className="text-right">
|
<TableCell className="text-right">
|
||||||
<div className="flex justify-end gap-1">
|
<div className="flex justify-end gap-1">
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ export function RuleRow({ rule, onToggle, onDelete }: {
|
|||||||
rule: FirewallRule; onToggle?: () => void; onDelete: () => void;
|
rule: FirewallRule; onToggle?: () => void; onDelete: () => void;
|
||||||
}) {
|
}) {
|
||||||
const disabled = rule.enable === 0;
|
const disabled = rule.enable === 0;
|
||||||
const actionColor = rule.action === 'ACCEPT' ? 'text-green-600 dark:text-green-500'
|
const actionColor = rule.action === 'ACCEPT' ? 'text-success'
|
||||||
: rule.action === 'DROP' || rule.action === 'REJECT' ? 'text-destructive' : '';
|
: rule.action === 'DROP' || rule.action === 'REJECT' ? 'text-destructive' : '';
|
||||||
return (
|
return (
|
||||||
<TableRow className={disabled ? 'opacity-50' : ''}>
|
<TableRow className={disabled ? 'opacity-50' : ''}>
|
||||||
@@ -206,7 +206,7 @@ export function RuleRow({ rule, onToggle, onDelete }: {
|
|||||||
<div className="flex justify-end gap-1">
|
<div className="flex justify-end gap-1">
|
||||||
{onToggle && (
|
{onToggle && (
|
||||||
<Button variant="ghost" size="icon" className="h-7 w-7" onClick={onToggle} title={disabled ? 'Enable' : 'Disable'}>
|
<Button variant="ghost" size="icon" className="h-7 w-7" onClick={onToggle} title={disabled ? 'Enable' : 'Disable'}>
|
||||||
<Power className={`h-3.5 w-3.5 ${disabled ? '' : 'text-green-600 dark:text-green-500'}`} />
|
<Power className={`h-3.5 w-3.5 ${disabled ? '' : 'text-success'}`} />
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
<Button variant="ghost" size="icon" className="h-7 w-7 text-destructive" onClick={onDelete}>
|
<Button variant="ghost" size="icon" className="h-7 w-7 text-destructive" onClick={onDelete}>
|
||||||
@@ -299,7 +299,7 @@ function IpsetEntries({ serverId, name }: { serverId: number; name: string }) {
|
|||||||
{entries.map(e => (
|
{entries.map(e => (
|
||||||
<div key={e.cidr} className="flex items-center gap-2 rounded border px-2 py-1 text-xs">
|
<div key={e.cidr} className="flex items-center gap-2 rounded border px-2 py-1 text-xs">
|
||||||
<span className="font-mono">{e.cidr}</span>
|
<span className="font-mono">{e.cidr}</span>
|
||||||
{e.nomatch ? <Badge variant="outline" className="text-[10px]">nomatch</Badge> : null}
|
{e.nomatch ? <Badge variant="outline" className="text-2xs">nomatch</Badge> : null}
|
||||||
{e.comment && <span className="text-muted-foreground">— {e.comment}</span>}
|
{e.comment && <span className="text-muted-foreground">— {e.comment}</span>}
|
||||||
<Button variant="ghost" size="icon" className="ml-auto h-6 w-6 text-destructive" onClick={() => remove(e.cidr)}>
|
<Button variant="ghost" size="icon" className="ml-auto h-6 w-6 text-destructive" onClick={() => remove(e.cidr)}>
|
||||||
<Trash2 className="h-3 w-3" />
|
<Trash2 className="h-3 w-3" />
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@
|
|||||||
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from '@/components/ui/dialog';
|
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from '@/components/ui/dialog';
|
||||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
|
||||||
import { useHAStatus, useAddToHA, useRemoveFromHA } from '@/hooks/use-ha';
|
import { useHAStatus, useAddToHA, useRemoveFromHA } from '@/hooks/use-ha';
|
||||||
import type { VirtualMachine } from '@/types';
|
import type { VMInstance } from '@/types';
|
||||||
import { toast } from 'sonner';
|
import { toast } from 'sonner';
|
||||||
import { useConfirm } from '@/components/shared/ConfirmDialog';
|
import { useConfirm } from '@/components/shared/ConfirmDialog';
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@ const emptyAddForm: AddForm = {
|
|||||||
comment: '',
|
comment: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function HAResources({ serverId, vms }: { serverId: number; vms: VirtualMachine[] }) {
|
export default function HAResources({ serverId, vms }: { serverId: number; vms: VMInstance[] }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const confirm = useConfirm();
|
const confirm = useConfirm();
|
||||||
const { data, isLoading, isFetching, refetch } = useHAStatus(serverId);
|
const { data, isLoading, isFetching, refetch } = useHAStatus(serverId);
|
||||||
@@ -203,7 +203,7 @@ export default function HAResources({ serverId, vms }: { serverId: number; vms:
|
|||||||
<div>
|
<div>
|
||||||
<Label>{t('ha.group')}</Label>
|
<Label>{t('ha.group')}</Label>
|
||||||
{groups.length > 0 ? (
|
{groups.length > 0 ? (
|
||||||
<Select value={form.group || '__none'} onValueChange={v => set('group', v === '__none' ? '' : v)}>
|
<Select value={form.group || '__none'} onValueChange={v => set('group', v && v !== '__none' ? v : '')}>
|
||||||
<SelectTrigger className="mt-1"><SelectValue /></SelectTrigger>
|
<SelectTrigger className="mt-1"><SelectValue /></SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
<SelectItem value="__none">{t('ha.no_group')}</SelectItem>
|
<SelectItem value="__none">{t('ha.no_group')}</SelectItem>
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ export default function NodeAdminManager({ serverId, nodeNames }: { serverId: nu
|
|||||||
<TableRow key={u.Package}>
|
<TableRow key={u.Package}>
|
||||||
<TableCell className="font-mono text-xs font-medium">{u.Package}</TableCell>
|
<TableCell className="font-mono text-xs font-medium">{u.Package}</TableCell>
|
||||||
<TableCell className="font-mono text-xs text-muted-foreground">{u.OldVersion || '—'}</TableCell>
|
<TableCell className="font-mono text-xs text-muted-foreground">{u.OldVersion || '—'}</TableCell>
|
||||||
<TableCell className="font-mono text-xs text-green-600 dark:text-green-500">{u.Version || '—'}</TableCell>
|
<TableCell className="font-mono text-xs text-success">{u.Version || '—'}</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
))}
|
))}
|
||||||
</TableBody>
|
</TableBody>
|
||||||
@@ -174,9 +174,9 @@ export default function NodeAdminManager({ serverId, nodeNames }: { serverId: nu
|
|||||||
const enabled = r.Enabled === 1 || r.Enabled === true;
|
const enabled = r.Enabled === 1 || r.Enabled === true;
|
||||||
return (
|
return (
|
||||||
<div key={idx} className="flex items-center gap-2 rounded border px-2 py-1.5 text-xs">
|
<div key={idx} className="flex items-center gap-2 rounded border px-2 py-1.5 text-xs">
|
||||||
<Badge variant={enabled ? 'default' : 'secondary'} className="text-[10px]">{enabled ? 'on' : 'off'}</Badge>
|
<Badge variant={enabled ? 'default' : 'secondary'} className="text-2xs">{enabled ? 'on' : 'off'}</Badge>
|
||||||
<span className="font-mono truncate">{(r.URIs || []).join(' ')} {(r.Suites || []).join(' ')} {(r.Components || []).join(' ')}</span>
|
<span className="font-mono truncate">{(r.URIs || []).join(' ')} {(r.Suites || []).join(' ')} {(r.Components || []).join(' ')}</span>
|
||||||
<Button size="sm" variant="outline" className="ml-auto h-6 text-[11px]"
|
<Button size="sm" variant="outline" className="ml-auto h-6 text-2xs"
|
||||||
onClick={() => toggleRepo(f.path, idx, !enabled)} disabled={setRepo.isPending}>
|
onClick={() => toggleRepo(f.path, idx, !enabled)} disabled={setRepo.isPending}>
|
||||||
{enabled ? t('nodeadm.disable', 'Выключить') : t('nodeadm.enable', 'Включить')}
|
{enabled ? t('nodeadm.disable', 'Выключить') : t('nodeadm.enable', 'Включить')}
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -229,7 +229,7 @@ export default function NodeNetworks({ serverId, nodeNames }: { serverId: number
|
|||||||
<TableCell className="font-mono font-medium">
|
<TableCell className="font-mono font-medium">
|
||||||
{iface.iface}
|
{iface.iface}
|
||||||
{iface.ipam_name && (
|
{iface.ipam_name && (
|
||||||
<Badge variant="outline" className="ml-2 text-[10px]">IPAM: {iface.ipam_name}</Badge>
|
<Badge variant="outline" className="ml-2 text-2xs">IPAM: {iface.ipam_name}</Badge>
|
||||||
)}
|
)}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell><Badge variant="secondary">{iface.type}</Badge></TableCell>
|
<TableCell><Badge variant="secondary">{iface.type}</Badge></TableCell>
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ function PoolMembers({ serverId, poolid, vms }: { serverId: number; poolid: stri
|
|||||||
: available.map(v => (
|
: available.map(v => (
|
||||||
<SelectItem key={v.vmid} value={String(v.vmid)}>
|
<SelectItem key={v.vmid} value={String(v.vmid)}>
|
||||||
<span className="flex items-center gap-2">
|
<span className="flex items-center gap-2">
|
||||||
<Badge variant="outline" className="text-[10px]">{v.type === 'qemu' ? 'VM' : 'LXC'}</Badge>
|
<Badge variant="outline" className="text-2xs">{v.type === 'qemu' ? 'VM' : 'LXC'}</Badge>
|
||||||
{v.name || `#${v.vmid}`} <span className="text-xs text-muted-foreground">#{v.vmid}</span>
|
{v.name || `#${v.vmid}`} <span className="text-xs text-muted-foreground">#{v.vmid}</span>
|
||||||
</span>
|
</span>
|
||||||
</SelectItem>
|
</SelectItem>
|
||||||
@@ -78,7 +78,7 @@ function PoolMembers({ serverId, poolid, vms }: { serverId: number; poolid: stri
|
|||||||
<div className="space-y-1">
|
<div className="space-y-1">
|
||||||
{members.map(m => (
|
{members.map(m => (
|
||||||
<div key={m.id} className="flex items-center gap-2 rounded border px-2 py-1 text-xs">
|
<div key={m.id} className="flex items-center gap-2 rounded border px-2 py-1 text-xs">
|
||||||
<Badge variant="outline" className="text-[10px]">
|
<Badge variant="outline" className="text-2xs">
|
||||||
{m.type === 'storage' ? 'STORAGE' : m.type === 'qemu' ? 'VM' : 'LXC'}
|
{m.type === 'storage' ? 'STORAGE' : m.type === 'qemu' ? 'VM' : 'LXC'}
|
||||||
</Badge>
|
</Badge>
|
||||||
<span className="font-medium">{m.name || m.storage || m.id}</span>
|
<span className="font-medium">{m.name || m.storage || m.id}</span>
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ function ZoneDialog({ serverId, open, onOpenChange, editing }: {
|
|||||||
<Label>DNS</Label>
|
<Label>DNS</Label>
|
||||||
<Select
|
<Select
|
||||||
value={form.dns}
|
value={form.dns}
|
||||||
onValueChange={v => set('dns', v === '__none__' ? '' : v)}
|
onValueChange={v => set('dns', v && v !== '__none__' ? v : '')}
|
||||||
disabled={dnsEntries.length === 0}
|
disabled={dnsEntries.length === 0}
|
||||||
>
|
>
|
||||||
<SelectTrigger className="mt-1 w-full">
|
<SelectTrigger className="mt-1 w-full">
|
||||||
@@ -470,7 +470,7 @@ export default function SDNManager({ serverId }: { serverId: number }) {
|
|||||||
>
|
>
|
||||||
<ChevronRight className={`h-4 w-4 transition-transform ${expandedVNet === v.vnet ? 'rotate-90' : ''}`} />
|
<ChevronRight className={`h-4 w-4 transition-transform ${expandedVNet === v.vnet ? 'rotate-90' : ''}`} />
|
||||||
<span className="font-mono font-medium">{v.vnet}</span>
|
<span className="font-mono font-medium">{v.vnet}</span>
|
||||||
<Badge variant="outline" className="text-[10px]">{v.zone}</Badge>
|
<Badge variant="outline" className="text-2xs">{v.zone}</Badge>
|
||||||
{v.tag != null && <span className="text-xs text-muted-foreground">tag {v.tag}</span>}
|
{v.tag != null && <span className="text-xs text-muted-foreground">tag {v.tag}</span>}
|
||||||
{v.alias && <span className="text-xs text-muted-foreground">— {v.alias}</span>}
|
{v.alias && <span className="text-xs text-muted-foreground">— {v.alias}</span>}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -60,12 +60,12 @@ export default function ServerUpdatesBadge({
|
|||||||
{total > 0 && (
|
{total > 0 && (
|
||||||
<Link
|
<Link
|
||||||
to={`/nodes/${serverId}?tab=admin`}
|
to={`/nodes/${serverId}?tab=admin`}
|
||||||
className="flex items-center gap-2 rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs font-medium text-amber-600 transition-colors hover:bg-amber-500/20 dark:text-amber-400"
|
className="flex items-center gap-2 rounded-lg border border-warning/30 bg-warning/10 px-3 py-2 text-xs font-medium text-warning transition-colors hover:bg-warning/20"
|
||||||
title={t('nodes.updates_available_count', { count: total })}
|
title={t('nodes.updates_available_count', { count: total })}
|
||||||
>
|
>
|
||||||
<ArrowUpCircle className="h-4 w-4 shrink-0" />
|
<ArrowUpCircle className="h-4 w-4 shrink-0" />
|
||||||
<span className="flex-1 min-w-0 truncate">{t('nodes.updates_available')}</span>
|
<span className="flex-1 min-w-0 truncate">{t('nodes.updates_available')}</span>
|
||||||
<span className="rounded-full bg-amber-500/20 px-2 py-0.5 font-semibold tabular-nums">
|
<span className="rounded-full bg-warning/20 px-2 py-0.5 font-semibold tabular-nums">
|
||||||
{total}
|
{total}
|
||||||
</span>
|
</span>
|
||||||
</Link>
|
</Link>
|
||||||
|
|||||||
@@ -503,7 +503,7 @@ function AboutTab() {
|
|||||||
{check.error ? (
|
{check.error ? (
|
||||||
<p className="text-destructive">{check.error}</p>
|
<p className="text-destructive">{check.error}</p>
|
||||||
) : check.update_available ? (
|
) : check.update_available ? (
|
||||||
<p className="font-medium text-amber-600 dark:text-amber-500">
|
<p className="font-medium text-warning">
|
||||||
{t('settings.update_available')}: {check.latest_version}
|
{t('settings.update_available')}: {check.latest_version}
|
||||||
</p>
|
</p>
|
||||||
) : (
|
) : (
|
||||||
@@ -517,7 +517,7 @@ function AboutTab() {
|
|||||||
|
|
||||||
{/* Update in progress banner */}
|
{/* Update in progress banner */}
|
||||||
{status?.is_updating && (
|
{status?.is_updating && (
|
||||||
<div className="rounded-md border border-amber-500/40 bg-amber-500/10 p-3 text-sm">
|
<div className="rounded-md border border-warning/40 bg-warning/10 p-3 text-sm">
|
||||||
<p className="font-medium">{t('settings.update_in_progress')}</p>
|
<p className="font-medium">{t('settings.update_in_progress')}</p>
|
||||||
<p className="text-xs text-muted-foreground">{status.stage} — {status.progress}%</p>
|
<p className="text-xs text-muted-foreground">{status.stage} — {status.progress}%</p>
|
||||||
<Button size="sm" variant="ghost" className="mt-2" onClick={() => resetUpdate.mutate()} disabled={resetUpdate.isPending}>
|
<Button size="sm" variant="ghost" className="mt-2" onClick={() => resetUpdate.mutate()} disabled={resetUpdate.isPending}>
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
|
import type { ReactElement } from 'react';
|
||||||
import { Monitor } from 'lucide-react';
|
import { Monitor } from 'lucide-react';
|
||||||
|
|
||||||
type OsInfo = {
|
type OsInfo = {
|
||||||
label: string;
|
label: string;
|
||||||
bg: string;
|
bg: string;
|
||||||
fg: string;
|
fg: string;
|
||||||
svg?: JSX.Element;
|
svg?: ReactElement;
|
||||||
};
|
};
|
||||||
|
|
||||||
const OS_MAP: Array<{ keys: string[]; info: OsInfo }> = [
|
const OS_MAP: Array<{ keys: string[]; info: OsInfo }> = [
|
||||||
|
|||||||
@@ -574,7 +574,7 @@ function UserServersForm({
|
|||||||
: t('users.no_workspaces')}
|
: t('users.no_workspaces')}
|
||||||
</div>
|
</div>
|
||||||
{!data.user_workspaces.length && (
|
{!data.user_workspaces.length && (
|
||||||
<div className="text-xs text-amber-600">{t('users.workspace_required')}</div>
|
<div className="text-xs text-warning">{t('users.workspace_required')}</div>
|
||||||
)}
|
)}
|
||||||
<div className="space-y-2 max-h-80 overflow-y-auto">
|
<div className="space-y-2 max-h-80 overflow-y-auto">
|
||||||
{data.servers.map(srv => (
|
{data.servers.map(srv => (
|
||||||
|
|||||||
5
frontend/src/fontsource.d.ts
vendored
Normal file
5
frontend/src/fontsource.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
// @fontsource-variable/* packages ship CSS with no type declarations, so a
|
||||||
|
// bare side-effect import isn't matched by Vite's `*.css` module glob. Declare
|
||||||
|
// them as typeless modules to satisfy `tsc` (see main.tsx font imports).
|
||||||
|
declare module '@fontsource-variable/dm-sans';
|
||||||
|
declare module '@fontsource-variable/jetbrains-mono';
|
||||||
@@ -58,7 +58,7 @@ export function useSDNDns(serverId: number, enabled = true) {
|
|||||||
// Invalidate the SDN status (pending indicator) alongside the changed entity.
|
// Invalidate the SDN status (pending indicator) alongside the changed entity.
|
||||||
function useSDNInvalidator(serverId: number) {
|
function useSDNInvalidator(serverId: number) {
|
||||||
const qc = useQueryClient();
|
const qc = useQueryClient();
|
||||||
return (...keys: readonly unknown[][]) => {
|
return (...keys: ReadonlyArray<readonly unknown[]>) => {
|
||||||
qc.invalidateQueries({ queryKey: sdnKeys.status(serverId) });
|
qc.invalidateQueries({ queryKey: sdnKeys.status(serverId) });
|
||||||
keys.forEach(k => qc.invalidateQueries({ queryKey: k }));
|
keys.forEach(k => qc.invalidateQueries({ queryKey: k }));
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ export function useMyQuota() {
|
|||||||
export function useUpdateProfile() {
|
export function useUpdateProfile() {
|
||||||
const qc = useQueryClient();
|
const qc = useQueryClient();
|
||||||
return useMutation({
|
return useMutation({
|
||||||
mutationFn: (data: { full_name?: string; email?: string; ssh_public_key?: string }) =>
|
mutationFn: (data: { full_name?: string; email?: string; ssh_public_key?: string; language?: string }) =>
|
||||||
apiClient.put<{ message: string }>('/settings/api/profile', data),
|
apiClient.put<{ message: string }>('/settings/api/profile', data),
|
||||||
onSuccess: () => qc.invalidateQueries({ queryKey: settingsKeys.profile }),
|
onSuccess: () => qc.invalidateQueries({ queryKey: settingsKeys.profile }),
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,15 +5,26 @@
|
|||||||
@custom-variant dark (&:is(.dark *));
|
@custom-variant dark (&:is(.dark *));
|
||||||
|
|
||||||
@theme inline {
|
@theme inline {
|
||||||
--font-sans: "DM Sans", system-ui, sans-serif;
|
--font-sans: "DM Sans Variable", system-ui, sans-serif;
|
||||||
--font-mono: "JetBrains Mono", ui-monospace, monospace;
|
--font-mono: "JetBrains Mono Variable", ui-monospace, monospace;
|
||||||
--font-heading: var(--font-sans);
|
--font-heading: var(--font-sans);
|
||||||
|
|
||||||
--color-surface-0: #09090B;
|
/* One named step below text-xs (12px) for micro labels / meta text, so the
|
||||||
--color-surface-1: #111113;
|
type scale is 11·12·14·16·18·24·32 instead of ad-hoc text-[10px]/[11px]. */
|
||||||
--color-surface-2: #1A1A1F;
|
--text-2xs: 0.6875rem; /* 11px */
|
||||||
--color-text-primary: #F0F0F3;
|
--text-2xs--line-height: 1rem;
|
||||||
--color-text-secondary: #A0A0AB;
|
|
||||||
|
/* Semantic status tokens — use text-success / bg-warning / text-danger etc.
|
||||||
|
instead of hardcoded green-500 / amber-500 / red-500 so both themes and
|
||||||
|
future palette changes stay consistent. */
|
||||||
|
--color-success: var(--success);
|
||||||
|
--color-success-foreground: var(--success-foreground);
|
||||||
|
--color-warning: var(--warning);
|
||||||
|
--color-warning-foreground: var(--warning-foreground);
|
||||||
|
--color-danger: var(--danger);
|
||||||
|
--color-danger-foreground: var(--danger-foreground);
|
||||||
|
/* Neutral track for progress bars / gauge backgrounds (theme-aware). */
|
||||||
|
--color-track: var(--track);
|
||||||
|
|
||||||
--color-sidebar-ring: var(--sidebar-ring);
|
--color-sidebar-ring: var(--sidebar-ring);
|
||||||
--color-sidebar-border: var(--sidebar-border);
|
--color-sidebar-border: var(--sidebar-border);
|
||||||
@@ -93,6 +104,13 @@
|
|||||||
--sidebar-accent-foreground: oklch(0.205 0.015 264);
|
--sidebar-accent-foreground: oklch(0.205 0.015 264);
|
||||||
--sidebar-border: oklch(0.922 0.004 264);
|
--sidebar-border: oklch(0.922 0.004 264);
|
||||||
--sidebar-ring: oklch(0.592 0.19 264);
|
--sidebar-ring: oklch(0.592 0.19 264);
|
||||||
|
--success: oklch(0.62 0.17 149);
|
||||||
|
--success-foreground: oklch(1 0 0);
|
||||||
|
--warning: oklch(0.70 0.15 70);
|
||||||
|
--warning-foreground: oklch(0.2 0.03 70);
|
||||||
|
--danger: oklch(0.577 0.245 27.33);
|
||||||
|
--danger-foreground: oklch(1 0 0);
|
||||||
|
--track: oklch(0.922 0.004 264);
|
||||||
}
|
}
|
||||||
|
|
||||||
.dark {
|
.dark {
|
||||||
@@ -128,6 +146,13 @@
|
|||||||
--sidebar-accent-foreground: oklch(0.94 0.005 264);
|
--sidebar-accent-foreground: oklch(0.94 0.005 264);
|
||||||
--sidebar-border: oklch(0.27 0.008 264);
|
--sidebar-border: oklch(0.27 0.008 264);
|
||||||
--sidebar-ring: oklch(0.592 0.19 264);
|
--sidebar-ring: oklch(0.592 0.19 264);
|
||||||
|
--success: oklch(0.723 0.191 149);
|
||||||
|
--success-foreground: oklch(0.16 0.02 149);
|
||||||
|
--warning: oklch(0.80 0.15 75);
|
||||||
|
--warning-foreground: oklch(0.18 0.03 75);
|
||||||
|
--danger: oklch(0.62 0.22 27.33);
|
||||||
|
--danger-foreground: oklch(1 0 0);
|
||||||
|
--track: oklch(0.30 0.008 264);
|
||||||
}
|
}
|
||||||
|
|
||||||
@layer base {
|
@layer base {
|
||||||
@@ -137,4 +162,17 @@
|
|||||||
body {
|
body {
|
||||||
@apply bg-background text-foreground font-sans antialiased;
|
@apply bg-background text-foreground font-sans antialiased;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Respect users who ask for less motion: neutralise transitions/animations
|
||||||
|
globally instead of auditing every component (WCAG reduced-motion). */
|
||||||
|
@media (prefers-reduced-motion: reduce) {
|
||||||
|
*,
|
||||||
|
*::before,
|
||||||
|
*::after {
|
||||||
|
animation-duration: 0.01ms !important;
|
||||||
|
animation-iteration-count: 1 !important;
|
||||||
|
transition-duration: 0.01ms !important;
|
||||||
|
scroll-behavior: auto !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ function SidebarContent() {
|
|||||||
<nav className="flex-1 space-y-4 overflow-y-auto px-3 py-4">
|
<nav className="flex-1 space-y-4 overflow-y-auto px-3 py-4">
|
||||||
{visibleGroups.map((group) => (
|
{visibleGroups.map((group) => (
|
||||||
<div key={group.title}>
|
<div key={group.title}>
|
||||||
<p className="mb-1.5 px-2 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground">
|
<p className="mb-1.5 px-2 text-2xs font-semibold uppercase tracking-wider text-muted-foreground">
|
||||||
{t(`nav.${group.title.toLowerCase()}`, group.title)}
|
{t(`nav.${group.title.toLowerCase()}`, group.title)}
|
||||||
</p>
|
</p>
|
||||||
<div className="space-y-0.5">
|
<div className="space-y-0.5">
|
||||||
@@ -185,7 +185,7 @@ function UserSection() {
|
|||||||
</div>
|
</div>
|
||||||
<div className="min-w-0 flex-1">
|
<div className="min-w-0 flex-1">
|
||||||
<p className="truncate text-[13px] font-medium">{user?.username ?? 'User'}</p>
|
<p className="truncate text-[13px] font-medium">{user?.username ?? 'User'}</p>
|
||||||
<p className="truncate text-[11px] text-muted-foreground">
|
<p className="truncate text-2xs text-muted-foreground">
|
||||||
{user?.is_admin ? 'Admin' : 'User'}
|
{user?.is_admin ? 'Admin' : 'User'}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
@@ -304,7 +304,7 @@ export default function AppLayout() {
|
|||||||
useGlobalRealtimeSync();
|
useGlobalRealtimeSync();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex h-screen overflow-hidden">
|
<div className="flex h-dvh overflow-hidden">
|
||||||
{/* Desktop sidebar */}
|
{/* Desktop sidebar */}
|
||||||
<aside className="hidden w-[var(--sidebar-width)] shrink-0 border-r bg-card lg:block">
|
<aside className="hidden w-[var(--sidebar-width)] shrink-0 border-r bg-card lg:block">
|
||||||
<SidebarContent />
|
<SidebarContent />
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ export default function AuthLayout() {
|
|||||||
const authBg = theme === 'light' ? authBgLight : authBgDark;
|
const authBg = theme === 'light' ? authBgLight : authBgDark;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="grid min-h-screen bg-background lg:grid-cols-[1.4fr_1fr]">
|
<div className="grid min-h-dvh bg-background lg:grid-cols-[1.4fr_1fr]">
|
||||||
{/* Левая декоративная панель со сгенерированным фоном */}
|
{/* Левая декоративная панель со сгенерированным фоном */}
|
||||||
<div className="relative hidden overflow-hidden bg-muted lg:block">
|
<div className="relative hidden overflow-hidden bg-muted lg:block">
|
||||||
<img
|
<img
|
||||||
@@ -42,7 +42,7 @@ export default function AuthLayout() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Правая панель с формой */}
|
{/* Правая панель с формой */}
|
||||||
<div className="flex min-h-screen flex-col px-6 py-8 sm:px-12">
|
<div className="flex min-h-dvh flex-col px-6 py-8 sm:px-12">
|
||||||
{/* Логотип */}
|
{/* Логотип */}
|
||||||
<div className="flex items-center gap-3">
|
<div className="flex items-center gap-3">
|
||||||
<div className="flex h-10 w-10 items-center justify-center rounded-xl bg-primary">
|
<div className="flex h-10 w-10 items-center justify-center rounded-xl bg-primary">
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
import { StrictMode } from 'react'
|
import { StrictMode } from 'react'
|
||||||
import { createRoot } from 'react-dom/client'
|
import { createRoot } from 'react-dom/client'
|
||||||
|
// Self-hosted fonts (font-display: swap built in) — no render-blocking
|
||||||
|
// external Google Fonts request. Family names: "DM Sans Variable" /
|
||||||
|
// "JetBrains Mono Variable" (see --font-sans / --font-mono in index.css).
|
||||||
|
import '@fontsource-variable/dm-sans'
|
||||||
|
import '@fontsource-variable/jetbrains-mono'
|
||||||
import './lib/i18n'
|
import './lib/i18n'
|
||||||
import './index.css'
|
import './index.css'
|
||||||
import App from './App'
|
import App from './App'
|
||||||
|
|||||||
Reference in New Issue
Block a user