From 2f9959c00921642edc445003349fdb3504cbe371 Mon Sep 17 00:00:00 2001 From: MacRimi Date: Sat, 28 Mar 2026 21:32:59 +0100 Subject: [PATCH] Update virtual-machines.tsx --- AppImage/components/virtual-machines.tsx | 213 +++++++++++++++-------- 1 file changed, 137 insertions(+), 76 deletions(-) diff --git a/AppImage/components/virtual-machines.tsx b/AppImage/components/virtual-machines.tsx index a4e14d21..bffd8fae 100644 --- a/AppImage/components/virtual-machines.tsx +++ b/AppImage/components/virtual-machines.tsx @@ -8,7 +8,7 @@ import { Badge } from "./ui/badge" import { Progress } from "./ui/progress" import { Button } from "./ui/button" 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 { Server, Play, Square, Cpu, MemoryStick, HardDrive, Network, Power, RotateCcw, StopCircle, Container, ChevronDown, ChevronUp, Terminal, Archive, Plus, Loader2, Clock, Database, Shield, Bell, FileText, Settings2, Activity } from 'lucide-react' import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "./ui/select" import { Checkbox } from "./ui/checkbox" import { Textarea } from "./ui/textarea" @@ -335,6 +335,25 @@ export function VirtualMachines() { const [backupNotification, setBackupNotification] = useState("auto") const [backupNotes, setBackupNotes] = useState("{{guestname}}") const [backupPbsChangeMode, setBackupPbsChangeMode] = useState("default") + + // Tab state for modal + const [activeModalTab, setActiveModalTab] = useState<"status" | "backups">("status") + + // Detect standalone mode (webapp vs browser) + const [isStandalone, setIsStandalone] = useState(false) + + useEffect(() => { + const checkStandalone = () => { + const standalone = window.matchMedia('(display-mode: standalone)').matches || + (window.navigator as Navigator & { standalone?: boolean }).standalone === true + setIsStandalone(standalone) + } + checkStandalone() + + const mediaQuery = window.matchMedia('(display-mode: standalone)') + mediaQuery.addEventListener('change', checkStandalone) + return () => mediaQuery.removeEventListener('change', checkStandalone) + }, []) useEffect(() => { const fetchLXCIPs = async () => { @@ -1226,10 +1245,15 @@ const handleDownloadLogs = async (vmid: number, vmName: string) => { setShowNotes(false) setIsEditingNotes(false) setEditedNotes("") + setActiveModalTab("status") }} > {currentView === "main" ? ( @@ -1289,7 +1313,38 @@ const handleDownloadLogs = async (vmid: number, vmName: string) => { -
+ {/* Tab Navigation */} +
+ + +
+ +
+ {/* Status Tab */} + {activeModalTab === "status" && (
{selectedVM && ( <> @@ -1398,78 +1453,6 @@ const handleDownloadLogs = async (vmid: number, vmName: string) => {
- {/* Backups Section */} - - -
-
-
- -
-

Backups

-
- -
- - {/* Divider */} -
- - {/* Backup List */} -
- Available backups - {vmBackups.length} -
- - {loadingBackups ? ( -
- - Loading backups... -
- ) : vmBackups.length === 0 ? ( -
- - No backups found -
- ) : ( -
- {vmBackups.map((backup, index) => ( -
-
-
- - {backup.date} - - {backup.storage} - -
- - {backup.size_human} - -
- ))} -
- )} - - - {detailsLoading ? (
Loading configuration...
) : vmDetails?.config ? ( @@ -2034,9 +2017,87 @@ const handleDownloadLogs = async (vmid: number, vmName: string) => { )}
+ )} + + {/* Backups Tab */} + {activeModalTab === "backups" && ( +
+ + +
+
+
+ +
+

Backups

+
+ +
+ + {/* Divider */} +
+ + {/* Backup List */} +
+ Available backups + {vmBackups.length} +
+ + {loadingBackups ? ( +
+ + Loading backups... +
+ ) : vmBackups.length === 0 ? ( +
+ + No backups found + Create your first backup using the button above +
+ ) : ( +
+ {vmBackups.map((backup, index) => ( +
+
+
+ + {backup.date} + + {backup.storage} + +
+ + {backup.size_human} + +
+ ))} +
+ )} + + +
+ )}
-
+
{/* Terminal button for LXC containers - only when running */} {selectedVM?.type === "lxc" && selectedVM?.status === "running" && (