From f13427ca27ef18f072b365b4985480e48254b34d Mon Sep 17 00:00:00 2001 From: MacRimi Date: Tue, 3 Feb 2026 22:10:53 +0100 Subject: [PATCH] Update modal lxc --- AppImage/components/virtual-machines.tsx | 199 ++++++++++++++++++++++- AppImage/scripts/flask_server.py | 39 ++++- 2 files changed, 227 insertions(+), 11 deletions(-) diff --git a/AppImage/components/virtual-machines.tsx b/AppImage/components/virtual-machines.tsx index 3dbe0704..56d19dc6 100644 --- a/AppImage/components/virtual-machines.tsx +++ b/AppImage/components/virtual-machines.tsx @@ -7,9 +7,12 @@ import { Card, CardContent, CardHeader, CardTitle } from "./ui/card" import { Badge } from "./ui/badge" import { Progress } from "./ui/progress" import { Button } from "./ui/button" -import { Dialog, DialogContent, DialogHeader, DialogTitle } from "./ui/dialog" -import { Server, Play, Square, Cpu, MemoryStick, HardDrive, Network, Power, RotateCcw, StopCircle, Container, ChevronDown, ChevronUp, Terminal, Archive, Plus, Loader2, Clock, Database } from 'lucide-react' +import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter, DialogDescription } from "./ui/dialog" +import { Server, Play, Square, Cpu, MemoryStick, HardDrive, Network, Power, RotateCcw, StopCircle, Container, ChevronDown, ChevronUp, Terminal, Archive, Plus, Loader2, Clock, Database, Shield, Bell, FileText, Settings2 } from 'lucide-react' import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "./ui/select" +import { Checkbox } from "./ui/checkbox" +import { Textarea } from "./ui/textarea" +import { Label } from "./ui/label" import useSWR from "swr" import { MetricsView } from "./metrics-dialog" import { LxcTerminalModal } from "./lxc-terminal-modal" @@ -302,6 +305,14 @@ export function VirtualMachines() { const [selectedBackupStorage, setSelectedBackupStorage] = useState("") const [loadingBackups, setLoadingBackups] = useState(false) const [creatingBackup, setCreatingBackup] = useState(false) + + // Backup modal states + const [showBackupModal, setShowBackupModal] = useState(false) + const [backupMode, setBackupMode] = useState("snapshot") + const [backupProtected, setBackupProtected] = useState(false) + const [backupNotification, setBackupNotification] = useState("auto") + const [backupNotes, setBackupNotes] = useState("{{guestname}}") + const [backupPbsChangeMode, setBackupPbsChangeMode] = useState("default") useEffect(() => { const fetchLXCIPs = async () => { @@ -432,14 +443,34 @@ export function VirtualMachines() { } } + const openBackupModal = () => { + // Reset modal to defaults + setBackupMode("snapshot") + setBackupProtected(false) + setBackupNotification("auto") + setBackupNotes("{{guestname}}") + setBackupPbsChangeMode("default") + setShowBackupModal(true) + } + const handleCreateBackup = async () => { if (!selectedVM || !selectedBackupStorage) return setCreatingBackup(true) + setShowBackupModal(false) + try { await fetchApi(`/api/vms/${selectedVM.vmid}/backup`, { method: "POST", - body: JSON.stringify({ storage: selectedBackupStorage }), + body: JSON.stringify({ + storage: selectedBackupStorage, + mode: backupMode, + compress: "zstd", + protected: backupProtected, + notification: backupNotification, + notes: backupNotes, + pbs_change_detection: backupPbsChangeMode + }), }) setTimeout(() => fetchVmBackups(selectedVM.vmid), 2000) } catch (error) { @@ -1335,7 +1366,7 @@ const handleDownloadLogs = async (vmid: number, vmName: string) => {