Update system-logs.tsx

This commit is contained in:
MacRimi
2025-10-18 11:41:49 +02:00
parent a8a4d029f8
commit 7a664ec4ec

View File

@@ -1050,53 +1050,57 @@ export function SystemLogs() {
</Card>
<Dialog open={isLogModalOpen} onOpenChange={setIsLogModalOpen}>
<DialogContent className="max-w-3xl max-h-[80vh] overflow-y-auto">
<DialogContent className="max-w-3xl max-h-[85vh] overflow-y-auto w-[96vw] sm:w-full mx-2 sm:mx-auto">
<DialogHeader>
<DialogTitle className="flex items-center gap-2">
<FileText className="h-5 w-5" />
Log Details
<DialogTitle className="flex items-center gap-2 text-base sm:text-lg pr-8">
<FileText className="h-4 w-4 sm:h-5 sm:w-5 flex-shrink-0" />
<span className="truncate">Log Details</span>
</DialogTitle>
<DialogDescription>Complete information about this log entry</DialogDescription>
<DialogDescription className="text-xs sm:text-sm">
Complete information about this log entry
</DialogDescription>
</DialogHeader>
{selectedLog && (
<div className="space-y-4">
<div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
<div className="grid grid-cols-1 md:grid-cols-2 gap-3 sm:gap-4">
<div>
<div className="text-sm font-medium text-muted-foreground mb-1">Level</div>
<Badge variant="outline" className={getLevelColor(selectedLog.level)}>
<div className="text-xs sm:text-sm font-medium text-muted-foreground mb-1.5">Level</div>
<Badge variant="outline" className={`${getLevelColor(selectedLog.level)} text-xs`}>
{getLevelIcon(selectedLog.level)}
{selectedLog.level.toUpperCase()}
</Badge>
</div>
<div>
<div className="text-sm font-medium text-muted-foreground mb-1">Service</div>
<div className="text-sm text-foreground break-words">{selectedLog.service}</div>
<div className="text-xs sm:text-sm font-medium text-muted-foreground mb-1.5">Service</div>
<div className="text-xs sm:text-sm text-foreground break-words">{selectedLog.service}</div>
</div>
<div className="sm:col-span-2">
<div className="text-sm font-medium text-muted-foreground mb-1">Timestamp</div>
<div className="text-sm text-foreground font-mono break-words">{selectedLog.timestamp}</div>
<div className="md:col-span-2">
<div className="text-xs sm:text-sm font-medium text-muted-foreground mb-1.5">Timestamp</div>
<div className="text-xs sm:text-sm text-foreground font-mono break-all">{selectedLog.timestamp}</div>
</div>
<div>
<div className="text-sm font-medium text-muted-foreground mb-1">Source</div>
<div className="text-sm text-foreground break-words">{selectedLog.source}</div>
<div className="text-xs sm:text-sm font-medium text-muted-foreground mb-1.5">Source</div>
<div className="text-xs sm:text-sm text-foreground break-words">{selectedLog.source}</div>
</div>
{selectedLog.pid && (
<div>
<div className="text-sm font-medium text-muted-foreground mb-1">Process ID</div>
<div className="text-sm text-foreground font-mono">{selectedLog.pid}</div>
<div className="text-xs sm:text-sm font-medium text-muted-foreground mb-1.5">Process ID</div>
<div className="text-xs sm:text-sm text-foreground font-mono">{selectedLog.pid}</div>
</div>
)}
{selectedLog.hostname && (
<div className="sm:col-span-2">
<div className="text-sm font-medium text-muted-foreground mb-1">Hostname</div>
<div className="text-sm text-foreground break-words">{selectedLog.hostname}</div>
<div className="md:col-span-2">
<div className="text-xs sm:text-sm font-medium text-muted-foreground mb-1.5">Hostname</div>
<div className="text-xs sm:text-sm text-foreground break-words">{selectedLog.hostname}</div>
</div>
)}
</div>
<div>
<div className="text-sm font-medium text-muted-foreground mb-2">Message</div>
<div className="p-4 rounded-lg bg-muted/50 border border-border">
<pre className="text-sm text-foreground whitespace-pre-wrap break-words">{selectedLog.message}</pre>
<div className="text-xs sm:text-sm font-medium text-muted-foreground mb-2">Message</div>
<div className="p-3 sm:p-4 rounded-lg bg-muted/50 border border-border max-h-[180px] sm:max-h-[300px] overflow-y-auto">
<pre className="text-xs sm:text-sm text-foreground whitespace-pre-wrap break-all font-mono">
{selectedLog.message}
</pre>
</div>
</div>
</div>
@@ -1105,20 +1109,20 @@ export function SystemLogs() {
</Dialog>
<Dialog open={isEventModalOpen} onOpenChange={setIsEventModalOpen}>
<DialogContent className="max-w-3xl max-h-[80vh] overflow-y-auto">
<DialogContent className="max-w-3xl max-h-[85vh] overflow-y-auto w-[96vw] sm:w-full mx-2 sm:mx-auto">
<DialogHeader>
<DialogTitle className="flex items-center gap-2">
<Activity className="h-5 w-5" />
Event Details
<DialogTitle className="flex items-center gap-2 text-base sm:text-lg pr-8">
<Activity className="h-4 w-4 sm:h-5 sm:w-5 flex-shrink-0" />
<span className="truncate">Event Details</span>
</DialogTitle>
<DialogDescription>Complete information about this event</DialogDescription>
<DialogDescription className="text-xs sm:text-sm">Complete information about this event</DialogDescription>
{selectedEvent && (
<div className="flex gap-2 mt-2">
<Badge variant="outline" className={getLevelColor(selectedEvent.level)}>
<Badge variant="outline" className={`${getLevelColor(selectedEvent.level)} text-xs`}>
{getLevelIcon(selectedEvent.level)}
{selectedEvent.level.toUpperCase()}
</Badge>
<Badge variant="outline" className="bg-purple-500/10 text-purple-500 border-purple-500/20">
<Badge variant="outline" className="bg-purple-500/10 text-purple-500 border-purple-500/20 text-xs">
<Activity className="h-3 w-3 mr-1" />
EVENT
</Badge>
@@ -1127,46 +1131,46 @@ export function SystemLogs() {
</DialogHeader>
{selectedEvent && (
<div className="space-y-4">
<div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
<div className="sm:col-span-2">
<div className="text-sm font-medium text-muted-foreground mb-1">Message</div>
<div className="text-sm text-foreground break-words">{selectedEvent.status}</div>
<div className="grid grid-cols-1 md:grid-cols-2 gap-3 sm:gap-4">
<div className="md:col-span-2">
<div className="text-xs sm:text-sm font-medium text-muted-foreground mb-1.5">Message</div>
<div className="text-xs sm:text-sm text-foreground break-words">{selectedEvent.status}</div>
</div>
<div>
<div className="text-sm font-medium text-muted-foreground mb-1">Type</div>
<div className="text-sm text-foreground break-words">{selectedEvent.type}</div>
<div className="text-xs sm:text-sm font-medium text-muted-foreground mb-1.5">Type</div>
<div className="text-xs sm:text-sm text-foreground break-words">{selectedEvent.type}</div>
</div>
<div>
<div className="text-sm font-medium text-muted-foreground mb-1">Node</div>
<div className="text-sm text-foreground">{selectedEvent.node}</div>
<div className="text-xs sm:text-sm font-medium text-muted-foreground mb-1.5">Node</div>
<div className="text-xs sm:text-sm text-foreground">{selectedEvent.node}</div>
</div>
<div>
<div className="text-sm font-medium text-muted-foreground mb-1">User</div>
<div className="text-sm text-foreground break-words">{selectedEvent.user}</div>
<div className="text-xs sm:text-sm font-medium text-muted-foreground mb-1.5">User</div>
<div className="text-xs sm:text-sm text-foreground break-words">{selectedEvent.user}</div>
</div>
{selectedEvent.vmid && (
<div>
<div className="text-sm font-medium text-muted-foreground mb-1">VM/CT ID</div>
<div className="text-sm text-foreground font-mono">{selectedEvent.vmid}</div>
<div className="text-xs sm:text-sm font-medium text-muted-foreground mb-1.5">VM/CT ID</div>
<div className="text-xs sm:text-sm text-foreground font-mono">{selectedEvent.vmid}</div>
</div>
)}
<div>
<div className="text-sm font-medium text-muted-foreground mb-1">Duration</div>
<div className="text-sm text-foreground">{selectedEvent.duration}</div>
<div className="text-xs sm:text-sm font-medium text-muted-foreground mb-1.5">Duration</div>
<div className="text-xs sm:text-sm text-foreground">{selectedEvent.duration}</div>
</div>
<div className="sm:col-span-2">
<div className="text-sm font-medium text-muted-foreground mb-1">Start Time</div>
<div className="text-sm text-foreground break-words">{selectedEvent.starttime}</div>
<div className="md:col-span-2">
<div className="text-xs sm:text-sm font-medium text-muted-foreground mb-1.5">Start Time</div>
<div className="text-xs sm:text-sm text-foreground break-words">{selectedEvent.starttime}</div>
</div>
<div className="sm:col-span-2">
<div className="text-sm font-medium text-muted-foreground mb-1">End Time</div>
<div className="text-sm text-foreground break-words">{selectedEvent.endtime}</div>
<div className="md:col-span-2">
<div className="text-xs sm:text-sm font-medium text-muted-foreground mb-1.5">End Time</div>
<div className="text-xs sm:text-sm text-foreground break-words">{selectedEvent.endtime}</div>
</div>
</div>
<div>
<div className="text-sm font-medium text-muted-foreground mb-2">UPID</div>
<div className="p-4 rounded-lg bg-muted/50 border border-border">
<pre className="text-sm text-foreground font-mono whitespace-pre-wrap break-all">
<div className="text-xs sm:text-sm font-medium text-muted-foreground mb-2">UPID</div>
<div className="p-3 sm:p-4 rounded-lg bg-muted/50 border border-border max-h-[180px] sm:max-h-[300px] overflow-y-auto">
<pre className="text-xs sm:text-sm text-foreground font-mono whitespace-pre-wrap break-all">
{selectedEvent.upid}
</pre>
</div>
@@ -1177,54 +1181,54 @@ export function SystemLogs() {
</Dialog>
<Dialog open={isBackupModalOpen} onOpenChange={setIsBackupModalOpen}>
<DialogContent className="max-w-3xl max-h-[80vh] overflow-y-auto">
<DialogContent className="max-w-3xl max-h-[85vh] overflow-y-auto w-[96vw] sm:w-full mx-2 sm:mx-auto">
<DialogHeader>
<DialogTitle className="flex items-center gap-2">
<Database className="h-5 w-5" />
Backup Details
<DialogTitle className="flex items-center gap-2 text-base sm:text-lg pr-8">
<Database className="h-4 w-4 sm:h-5 sm:w-5 flex-shrink-0" />
<span className="truncate">Backup Details</span>
</DialogTitle>
<DialogDescription>Complete information about this backup</DialogDescription>
<DialogDescription className="text-xs sm:text-sm">Complete information about this backup</DialogDescription>
</DialogHeader>
{selectedBackup && (
<div className="space-y-4">
<div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
<div className="grid grid-cols-1 md:grid-cols-2 gap-3 sm:gap-4">
<div>
<div className="text-sm font-medium text-muted-foreground mb-1">Type</div>
<Badge variant="outline" className={getBackupTypeColor(selectedBackup.volid)}>
<div className="text-xs sm:text-sm font-medium text-muted-foreground mb-1.5">Type</div>
<Badge variant="outline" className={`${getBackupTypeColor(selectedBackup.volid)} text-xs`}>
{getBackupTypeLabel(selectedBackup.volid)}
</Badge>
</div>
<div>
<div className="text-sm font-medium text-muted-foreground mb-1">Storage Type</div>
<Badge variant="outline" className={getBackupStorageColor(selectedBackup.volid)}>
<div className="text-xs sm:text-sm font-medium text-muted-foreground mb-1.5">Storage Type</div>
<Badge variant="outline" className={`${getBackupStorageColor(selectedBackup.volid)} text-xs`}>
{getBackupStorageLabel(selectedBackup.volid)}
</Badge>
</div>
<div>
<div className="text-sm font-medium text-muted-foreground mb-1">Storage</div>
<div className="text-sm text-foreground break-words">{selectedBackup.storage}</div>
<div className="text-xs sm:text-sm font-medium text-muted-foreground mb-1.5">Storage</div>
<div className="text-xs sm:text-sm text-foreground break-words">{selectedBackup.storage}</div>
</div>
<div>
<div className="text-sm font-medium text-muted-foreground mb-1">Size</div>
<Badge variant="outline" className="bg-green-500/10 text-green-500 border-green-500/20">
<div className="text-xs sm:text-sm font-medium text-muted-foreground mb-1.5">Size</div>
<Badge variant="outline" className="bg-green-500/10 text-green-500 border-green-500/20 text-xs">
{selectedBackup.size_human}
</Badge>
</div>
{selectedBackup.vmid && (
<div>
<div className="text-sm font-medium text-muted-foreground mb-1">VM/CT ID</div>
<div className="text-sm text-foreground font-mono">{selectedBackup.vmid}</div>
<div className="text-xs sm:text-sm font-medium text-muted-foreground mb-1.5">VM/CT ID</div>
<div className="text-xs sm:text-sm text-foreground font-mono">{selectedBackup.vmid}</div>
</div>
)}
<div className="sm:col-span-2">
<div className="text-sm font-medium text-muted-foreground mb-1">Created</div>
<div className="text-sm text-foreground break-words">{selectedBackup.created}</div>
<div className="md:col-span-2">
<div className="text-xs sm:text-sm font-medium text-muted-foreground mb-1.5">Created</div>
<div className="text-xs sm:text-sm text-foreground break-words">{selectedBackup.created}</div>
</div>
</div>
<div>
<div className="text-sm font-medium text-muted-foreground mb-2">Volume ID</div>
<div className="p-4 rounded-lg bg-muted/50 border border-border">
<pre className="text-sm text-foreground font-mono whitespace-pre-wrap break-all">
<div className="text-xs sm:text-sm font-medium text-muted-foreground mb-2">Volume ID</div>
<div className="p-3 sm:p-4 rounded-lg bg-muted/50 border border-border max-h-[180px] sm:max-h-[300px] overflow-y-auto">
<pre className="text-xs sm:text-sm text-foreground font-mono whitespace-pre-wrap break-all">
{selectedBackup.volid}
</pre>
</div>