fix(appstore): DNS, per-server golden template, bind-mount perms, delete race
App Store install/update pipeline reliability fixes: - explicit nameserver (APPSTORE_NAMESERVER) on App Store LXCs and the golden template build CT, instead of inheriting a node resolver that may be unreachable from the container network (e.g. Tailscale-only DNS) - golden template storage/resolution moved from one global setting to per-server_id (migration 37: app_operations.server_id) — building it on one Proxmox server no longer overwrites the template configured for another - golden template automated build fixed: vzdump export step no longer fails on "unable to parse directory volume name 'vztmpl/probe'" - bind-mount host directories are pre-created with permissive ownership before `docker compose up`, fixing Permission denied for non-root containers (e.g. MariaDB) writing to Docker-auto-created root-owned dirs - delete/teardown now waits for Proxmox to actually confirm the destroy task finished (was silently proceeding after a short timeout, letting a new install reuse the VMID while the node was still wiping the old disk) - pct create retries a few times on transient "got lock" config errors - failed pipeline steps now report the tail of command output (4000 chars) instead of the head, so the real error isn't buried under pull/progress noise - install error box in the UI wraps long text and scrolls instead of stretching the dialog Also carries forward in-progress script catalog / instances / RBAC changes that were already uncommitted in the working tree before this session. Bump to v1.9.1, update WIKI.md/docs/CHANGELOG accordingly. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -32,8 +32,10 @@ export default function GoldenTemplateDialog({ open, onOpenChange }: Props) {
|
||||
|
||||
const build = useBuildGoldenTemplate();
|
||||
|
||||
// Шаблон — файл на storage конкретного сервера, поэтому статус запрашиваем
|
||||
// именно по выбранному serverId (иначе покажем шаблон/прогресс другого сервера).
|
||||
// Пока операция выполняется — опрашиваем статус каждые 2с для прогресса.
|
||||
const { data: status } = useGoldenTemplateStatus(open ? 2000 : 0);
|
||||
const { data: status } = useGoldenTemplateStatus(serverIdNum || undefined, open ? 2000 : 0);
|
||||
const op = status?.last_operation ?? null;
|
||||
const running = op?.status === 'running';
|
||||
const lastStep = op?.steps_log?.length ? op.steps_log[op.steps_log.length - 1].step : null;
|
||||
@@ -81,13 +83,19 @@ export default function GoldenTemplateDialog({ open, onOpenChange }: Props) {
|
||||
'Автоматическая сборка golden-шаблона (Debian 12 + Docker + Compose) на выбранной ноде. Из него App Store клонирует контейнеры приложений.')}
|
||||
</p>
|
||||
|
||||
{/* Текущий шаблон */}
|
||||
<div className="rounded-md border bg-muted/40 px-3 py-2 text-xs">
|
||||
<span className="text-muted-foreground">{t('appstore.golden.current', 'Текущий шаблон')}: </span>
|
||||
{configured
|
||||
? <code className="break-all">{configured}</code>
|
||||
: <span className="text-amber-600">{t('appstore.golden.none', 'не настроен')}</span>}
|
||||
</div>
|
||||
{/* Текущий шаблон — привязан к выбранному серверу (vztmpl лежит на его storage) */}
|
||||
{serverIdNum ? (
|
||||
<div className="rounded-md border bg-muted/40 px-3 py-2 text-xs">
|
||||
<span className="text-muted-foreground">{t('appstore.golden.current', 'Текущий шаблон')}: </span>
|
||||
{configured
|
||||
? <code className="break-all">{configured}</code>
|
||||
: <span className="text-amber-600">{t('appstore.golden.none', 'не настроен для этого сервера')}</span>}
|
||||
</div>
|
||||
) : (
|
||||
<div className="rounded-md border bg-muted/40 px-3 py-2 text-xs text-muted-foreground">
|
||||
{t('appstore.golden.pick_server_hint', 'Выберите сервер, чтобы увидеть его текущий шаблон')}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Сервер */}
|
||||
<div className="space-y-1.5">
|
||||
|
||||
@@ -345,9 +345,11 @@ export default function InstallWizard({ app, open, onOpenChange }: Props) {
|
||||
{!op && <div className="flex items-center gap-2 text-muted-foreground"><Loader2 className="h-3.5 w-3.5 animate-spin" />{t('appstore.installing')}</div>}
|
||||
</div>
|
||||
{phase === 'failed' && (
|
||||
<div className="flex items-start gap-2 rounded-md border border-destructive/40 bg-destructive/5 p-2 text-xs text-destructive">
|
||||
<div className="flex max-h-[35vh] items-start gap-2 overflow-y-auto rounded-md border border-destructive/40 bg-destructive/5 p-2 text-xs text-destructive">
|
||||
<XCircle className="mt-0.5 h-4 w-4 shrink-0" />
|
||||
<span>{op?.error_text || t('appstore.install_failed')}</span>
|
||||
<span className="min-w-0 flex-1 whitespace-pre-wrap break-words">
|
||||
{op?.error_text || t('appstore.install_failed')}
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -231,6 +231,17 @@ export default function BackupsPage() {
|
||||
}
|
||||
}, [servers, selectedServer]);
|
||||
|
||||
// Drop a stale server selection when its server is not in the active
|
||||
// workspace anymore (e.g. after switching workspaces) — otherwise the list
|
||||
// silently empties and the Select shows the raw server id instead of a name.
|
||||
useEffect(() => {
|
||||
if (selectedServer && servers.length > 0 && !servers.some(s => String(s.id) === selectedServer)) {
|
||||
setSelectedServer('');
|
||||
setSelectedNode(ALL_NODES);
|
||||
setSelectedStorage('');
|
||||
}
|
||||
}, [servers, selectedServer]);
|
||||
|
||||
// Auto-select first backup-capable storage when none selected (or current is unavailable)
|
||||
useEffect(() => {
|
||||
if (!sid) return;
|
||||
|
||||
@@ -23,6 +23,7 @@ import {
|
||||
import {
|
||||
useCloneInstance,
|
||||
useMigrateInstance,
|
||||
useRemoteMigrateInstance,
|
||||
useVMStatus,
|
||||
useReinstallInstance,
|
||||
useChangePassword,
|
||||
@@ -33,7 +34,7 @@ import {
|
||||
useDetachIso,
|
||||
useVMConfig,
|
||||
} from '@/hooks/use-instances';
|
||||
import { useNodes } from '@/hooks/use-nodes';
|
||||
import { useNodes, useServers, useNodeNetworks } from '@/hooks/use-nodes';
|
||||
import { useBackupStorages, useCreateBackup } from '@/hooks/use-backups';
|
||||
import { useLXCStorages } from '@/hooks/use-lxc-templates';
|
||||
import { useUsers } from '@/hooks/use-users';
|
||||
@@ -46,6 +47,7 @@ export type PowerAction = 'start' | 'stop' | 'restart' | 'shutdown';
|
||||
export type InstanceAction =
|
||||
| 'clone'
|
||||
| 'migrate'
|
||||
| 'remote-migrate'
|
||||
| 'reinstall'
|
||||
| 'change-password'
|
||||
| 'notes'
|
||||
@@ -74,6 +76,7 @@ export default function InstanceActionDialogs(props: Props) {
|
||||
<>
|
||||
<CloneDialog open={open === 'clone'} onClose={close} {...shared} />
|
||||
<MigrateDialog open={open === 'migrate'} onClose={close} {...shared} />
|
||||
<RemoteMigrateDialog open={open === 'remote-migrate'} onClose={close} {...shared} />
|
||||
<ReinstallDialog open={open === 'reinstall'} onClose={close} {...shared} />
|
||||
<ChangePasswordDialog open={open === 'change-password'} onClose={close} {...shared} />
|
||||
<NotesDialog open={open === 'notes'} onClose={close} {...shared} />
|
||||
@@ -344,6 +347,173 @@ function MigrateDialog({ open, onClose, serverId, vmid, type, node, name }: Omit
|
||||
);
|
||||
}
|
||||
|
||||
// ==================== Remote Migrate (to a different cluster) ====================
|
||||
|
||||
const REMOTE_MIGRATE_SAME = '__same__';
|
||||
|
||||
function RemoteMigrateDialog({ open, onClose, serverId, vmid, type, node, name }: Omit<Props, 'open' | 'onOpenChange'> & { open: boolean; onClose: () => void }) {
|
||||
const { t } = useTranslation();
|
||||
const [targetServerId, setTargetServerId] = useState<number | null>(null);
|
||||
const [targetNode, setTargetNode] = useState('');
|
||||
const [targetStorage, setTargetStorage] = useState('');
|
||||
const [targetBridge, setTargetBridge] = useState('');
|
||||
const [online, setOnline] = useState(false);
|
||||
const [deleteSource, setDeleteSource] = useState(true);
|
||||
const migrate = useRemoteMigrateInstance(serverId, vmid, type, node);
|
||||
const addDeployTask = useDeployTasksStore((s) => s.addTask);
|
||||
|
||||
const { data: allServers = [] } = useServers();
|
||||
// Только другие кластеры, настроенные через API-токен — remote_migrate не принимает пароль.
|
||||
const targetServers = allServers.filter((s) => s.id !== serverId && !s.use_password);
|
||||
|
||||
const { data: nodesResp } = useNodes(targetServerId ?? 0);
|
||||
const nodes = nodesResp?.nodes ?? [];
|
||||
const { data: status } = useVMStatus(serverId, vmid, type, node, open);
|
||||
const isRunning = status?.status === 'running';
|
||||
const { data: storages = [] } = useLXCStorages(targetServerId ?? undefined, targetNode || undefined);
|
||||
const { data: networksResp } = useNodeNetworks(targetServerId ?? 0, targetNode);
|
||||
const bridges = (networksResp?.interfaces ?? []).filter((i) => i.type === 'bridge');
|
||||
|
||||
useEffect(() => {
|
||||
if (open) {
|
||||
setTargetServerId(null);
|
||||
setTargetNode('');
|
||||
setTargetStorage('');
|
||||
setTargetBridge('');
|
||||
setOnline(isRunning);
|
||||
setDeleteSource(true);
|
||||
}
|
||||
}, [open, isRunning]);
|
||||
|
||||
const submit = () => {
|
||||
if (!targetServerId || !targetNode) return;
|
||||
migrate.mutate(
|
||||
{
|
||||
target_server_id: targetServerId,
|
||||
target_node: targetNode,
|
||||
target_storage: targetStorage || undefined,
|
||||
target_bridge: targetBridge || undefined,
|
||||
online,
|
||||
delete_source: deleteSource,
|
||||
},
|
||||
{
|
||||
onSuccess: (data) => {
|
||||
addDeployTask({
|
||||
id: data.task_id,
|
||||
name: data.name,
|
||||
status: 'pending',
|
||||
step: 'В очереди...',
|
||||
progress: 0,
|
||||
vmid,
|
||||
node: targetNode,
|
||||
error_message: null,
|
||||
kind: 'remote_migrate',
|
||||
server_id: serverId,
|
||||
});
|
||||
toast.success(t('instances.remote_migrate_started', 'Миграция на другой кластер запущена в фоне'));
|
||||
onClose();
|
||||
},
|
||||
onError: (e) => toast.error(e.message),
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={(o) => !o && onClose()}>
|
||||
<DialogContent>
|
||||
<DialogHeader>
|
||||
<DialogTitle className="flex items-center gap-2">
|
||||
<ArrowRightLeft className="h-4 w-4" /> {t('instances.remote_migrate', 'Миграция на другой кластер')}
|
||||
</DialogTitle>
|
||||
<DialogDescription>
|
||||
{t('instances.remote_migrate_desc', 'Перенести на независимый Proxmox-кластер (не ноду текущего)')} <strong>{name ?? `#${vmid}`}</strong>
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
<div className="space-y-4">
|
||||
<div className="space-y-1.5">
|
||||
<Label>{t('instances.remote_migrate_target_server', 'Целевой кластер')}</Label>
|
||||
<Select
|
||||
value={targetServerId ? String(targetServerId) : ''}
|
||||
onValueChange={(v) => { if (v) { setTargetServerId(Number(v)); setTargetNode(''); setTargetStorage(''); setTargetBridge(''); } }}
|
||||
>
|
||||
<SelectTrigger><SelectValue placeholder={t('instances.remote_migrate_select_server', 'Выберите сервер')} /></SelectTrigger>
|
||||
<SelectContent>
|
||||
{targetServers.map((s) => (
|
||||
<SelectItem key={s.id} value={String(s.id)}>{s.name}</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
{targetServers.length === 0 && (
|
||||
<p className="text-xs text-warning">
|
||||
{t('instances.remote_migrate_no_targets', 'Нет других серверов с API-токеном. Remote-миграция требует, чтобы у целевого сервера была настроена авторизация по API-токену (не по паролю).')}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="space-y-1.5">
|
||||
<Label>{t('instances.migrate_target_node')}</Label>
|
||||
<Select value={targetNode} onValueChange={(v) => { if (v) { setTargetNode(v); setTargetStorage(''); setTargetBridge(''); } }}>
|
||||
<SelectTrigger><SelectValue placeholder={t('instances.migrate_select_node')} /></SelectTrigger>
|
||||
<SelectContent>
|
||||
{nodes.map((n) => (
|
||||
<SelectItem key={n.node} value={n.node}>{n.node}</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-2 gap-3">
|
||||
<div className="space-y-1.5">
|
||||
<Label>{t('instances.migrate_target_storage')}</Label>
|
||||
<Select value={targetStorage || REMOTE_MIGRATE_SAME} onValueChange={(v) => setTargetStorage(!v || v === REMOTE_MIGRATE_SAME ? '' : v)}>
|
||||
<SelectTrigger><SelectValue /></SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value={REMOTE_MIGRATE_SAME}>{t('instances.migrate_same_storage')}</SelectItem>
|
||||
{storages.map((s) => (
|
||||
<SelectItem key={s.storage} value={s.storage}>{s.storage} ({s.type})</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
<div className="space-y-1.5">
|
||||
<Label>{t('instances.remote_migrate_target_bridge', 'Сетевой мост')}</Label>
|
||||
<Select value={targetBridge || REMOTE_MIGRATE_SAME} onValueChange={(v) => setTargetBridge(!v || v === REMOTE_MIGRATE_SAME ? '' : v)}>
|
||||
<SelectTrigger><SelectValue /></SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value={REMOTE_MIGRATE_SAME}>{t('instances.remote_migrate_same_bridge', 'Как на источнике')}</SelectItem>
|
||||
{bridges.map((b) => (
|
||||
<SelectItem key={b.iface} value={b.iface}>{b.iface}</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label className="flex items-center gap-2.5 cursor-pointer">
|
||||
<Checkbox checked={online} onChange={(e) => setOnline(e.target.checked)} />
|
||||
<span className="text-sm">{t('instances.migrate_online')}</span>
|
||||
</label>
|
||||
<p className="text-xs text-muted-foreground -mt-2">
|
||||
{isRunning ? t('instances.migrate_online_hint_running') : t('instances.migrate_online_hint_stopped')}
|
||||
</p>
|
||||
|
||||
<label className="flex items-center gap-2.5 cursor-pointer">
|
||||
<Checkbox checked={deleteSource} onChange={(e) => setDeleteSource(e.target.checked)} />
|
||||
<span className="text-sm">{t('instances.remote_migrate_delete_source', 'Удалить с исходного кластера после успешного переноса')}</span>
|
||||
</label>
|
||||
</div>
|
||||
<DialogFooter>
|
||||
<Button variant="outline" onClick={onClose}>{t('common.cancel')}</Button>
|
||||
<Button onClick={submit} disabled={!targetServerId || !targetNode || migrate.isPending}>
|
||||
{migrate.isPending && <Loader2 className="mr-2 h-4 w-4 animate-spin" />}
|
||||
{t('instances.remote_migrate', 'Миграция на другой кластер')}
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
|
||||
// ==================== Reinstall ====================
|
||||
|
||||
function ReinstallDialog({ open, onClose, serverId, vmid, node, name, type }: Omit<Props, 'open' | 'onOpenChange'> & { open: boolean; onClose: () => void }) {
|
||||
|
||||
@@ -137,6 +137,8 @@ function RowActionMenu({ vm }: { vm: VMInstance }) {
|
||||
const isRunning = vm.status === 'running';
|
||||
const isQemu = vm.type === 'qemu';
|
||||
const [dialog, setDialog] = useState<InstanceAction>(null);
|
||||
const { data: allServers = [] } = useServers();
|
||||
const hasRemoteMigrateTargets = allServers.some((s) => s.id !== vm.server_id && !s.use_password);
|
||||
const [pendingPower, setPendingPower] = useState<PowerAction | null>(null);
|
||||
|
||||
const handleAction = (action: string) => {
|
||||
@@ -195,6 +197,11 @@ function RowActionMenu({ vm }: { vm: VMInstance }) {
|
||||
<DropdownMenuItem onClick={() => setDialog('migrate')}>
|
||||
<ArrowRightLeft className="mr-2 h-4 w-4" /> {t('instances.migrate', 'Мигрировать')}
|
||||
</DropdownMenuItem>
|
||||
{hasRemoteMigrateTargets && (
|
||||
<DropdownMenuItem onClick={() => setDialog('remote-migrate')}>
|
||||
<ArrowRightLeft className="mr-2 h-4 w-4" /> {t('instances.remote_migrate', 'Миграция на другой кластер')}
|
||||
</DropdownMenuItem>
|
||||
)}
|
||||
<DropdownMenuItem onClick={() => setDialog('clone')}>
|
||||
<Copy className="mr-2 h-4 w-4" /> {t('common.clone', 'Клонировать')}
|
||||
</DropdownMenuItem>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
import { Link } from 'react-router';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Server, Monitor, Container, Plus, Pencil, Trash2, Wifi, Loader2, Clock, Layers, LayoutGrid } from 'lucide-react';
|
||||
import { Server, Monitor, Container, Plus, Pencil, Trash2, Wifi, Loader2, Clock, Layers, LayoutGrid, ExternalLink } from 'lucide-react';
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { Button } from '@/components/ui/button';
|
||||
@@ -329,6 +329,22 @@ export default function NodesPage() {
|
||||
</div>
|
||||
</Link>
|
||||
<div className="flex items-center gap-1 ml-2 opacity-0 group-hover:opacity-100 transition-opacity">
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="h-7 w-7"
|
||||
title={t('nodes.open_pve_ui')}
|
||||
render={
|
||||
<a
|
||||
href={`https://${srv.ip_address}:${srv.port || 8006}/`}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<ExternalLink className="h-3.5 w-3.5" />
|
||||
</Button>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useEffect, useMemo, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { toast } from 'sonner';
|
||||
import { Loader2, Play, CheckCircle2, XCircle } from 'lucide-react';
|
||||
import { Loader2, Play, CheckCircle2, XCircle, AlertTriangle } from 'lucide-react';
|
||||
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from '@/components/ui/dialog';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
@@ -133,6 +133,18 @@ export default function ScriptExecuteDialog({ script, onOpenChange }: Props) {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{script.source === 'community-scripts' && (
|
||||
<div className="flex items-start gap-2 rounded-md border border-amber-500/40 bg-amber-500/10 p-3 text-xs text-amber-700 dark:text-amber-400">
|
||||
<AlertTriangle className="mt-0.5 h-4 w-4 shrink-0" />
|
||||
<p>
|
||||
{t(
|
||||
'scripts.community_scripts_warning',
|
||||
'Скрипт создаст новый LXC-контейнер на хосте Proxmox и во время выполнения сам обратится к GitHub за дополнительным кодом (misc/build.func) — это сторонний код, не проверяемый и не фиксируемый pvemanager.',
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{script.params_schema.length > 0 && (
|
||||
<div className="space-y-3 rounded-md border p-3">
|
||||
{script.params_schema.map((p) => (
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useMemo, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { toast } from 'sonner';
|
||||
import { Terminal, Plus, RefreshCw, Loader2, Play, Pencil, Trash2, GitBranch } from 'lucide-react';
|
||||
import { Terminal, Plus, RefreshCw, Loader2, Play, Pencil, Trash2, GitBranch, Package } from 'lucide-react';
|
||||
import { Card } from '@/components/ui/card';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
@@ -17,6 +17,13 @@ import ScriptEditDialog from './ScriptEditDialog';
|
||||
import ScriptExecuteDialog from './ScriptExecuteDialog';
|
||||
import ExecutionDetailDialog from './ExecutionDetailDialog';
|
||||
|
||||
const COMMUNITY_SCRIPTS_REPO = {
|
||||
url: 'https://github.com/community-scripts/ProxmoxVE',
|
||||
branch: 'main',
|
||||
path_glob: 'ct/*.sh',
|
||||
metadata_format: 'community-scripts-ct' as const,
|
||||
};
|
||||
|
||||
export default function ScriptsPage() {
|
||||
const { t } = useTranslation();
|
||||
const [tab, setTab] = useState('catalog');
|
||||
@@ -39,6 +46,7 @@ export default function ScriptsPage() {
|
||||
|
||||
const manualScripts = useMemo(() => scripts.filter((s) => s.source === 'manual'), [scripts]);
|
||||
const gitScripts = useMemo(() => scripts.filter((s) => s.source === 'git'), [scripts]);
|
||||
const communityScripts = useMemo(() => scripts.filter((s) => s.source === 'community-scripts'), [scripts]);
|
||||
|
||||
const handleDelete = (script: ScriptCatalogItem) => {
|
||||
if (!confirm(t('scripts.confirm_delete', 'Удалить скрипт "{{name}}"?', { name: script.name }))) return;
|
||||
@@ -56,6 +64,13 @@ export default function ScriptsPage() {
|
||||
});
|
||||
};
|
||||
|
||||
const handleAddCommunityScriptsRepo = () => {
|
||||
createRepo.mutate(COMMUNITY_SCRIPTS_REPO, {
|
||||
onSuccess: () => toast.success(t('scripts.repo_added', 'Источник добавлен')),
|
||||
onError: (e) => toast.error((e as Error).message),
|
||||
});
|
||||
};
|
||||
|
||||
const renderScriptCard = (script: ScriptCatalogItem) => (
|
||||
<Card key={script.id} className="flex flex-col gap-2 p-3">
|
||||
<div className="flex items-start justify-between gap-2">
|
||||
@@ -72,6 +87,11 @@ export default function ScriptsPage() {
|
||||
{script.source === 'git' && (
|
||||
<Badge variant="outline" className="gap-1 text-2xs"><GitBranch className="h-3 w-3" />{script.git_path}</Badge>
|
||||
)}
|
||||
{script.source === 'community-scripts' && (
|
||||
<Badge variant="outline" className="gap-1 text-2xs">
|
||||
<Package className="h-3 w-3" />{t('scripts.source_community', 'Community Scripts')}
|
||||
</Badge>
|
||||
)}
|
||||
</div>
|
||||
<div className="mt-auto flex items-center gap-2 pt-1">
|
||||
<Button size="sm" onClick={() => setExecScript(script)}>
|
||||
@@ -135,6 +155,11 @@ export default function ScriptsPage() {
|
||||
{gitScripts.map(renderScriptCard)}
|
||||
</div>
|
||||
)}
|
||||
{communityScripts.length > 0 && (
|
||||
<div className="grid gap-3 sm:grid-cols-2 xl:grid-cols-3">
|
||||
{communityScripts.map(renderScriptCard)}
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</TabsContent>
|
||||
@@ -150,6 +175,9 @@ export default function ScriptsPage() {
|
||||
<Button size="sm" onClick={handleAddRepo} disabled={createRepo.isPending}>
|
||||
<Plus className="mr-1.5 h-4 w-4" />{t('scripts.add_repo', 'Добавить источник')}
|
||||
</Button>
|
||||
<Button size="sm" variant="outline" onClick={handleAddCommunityScriptsRepo} disabled={createRepo.isPending}>
|
||||
<Package className="mr-1.5 h-4 w-4" />{t('scripts.add_community_scripts', 'Community-Scripts (ProxmoxVE)')}
|
||||
</Button>
|
||||
</Card>
|
||||
|
||||
{repos.length === 0 ? (
|
||||
|
||||
Reference in New Issue
Block a user