add copy button & order entries

This commit is contained in:
9qeklajc
2025-11-16 10:46:10 +01:00
parent 26110a68dd
commit 38356d7bb3
2 changed files with 23 additions and 3 deletions
+2 -2
View File
@@ -827,8 +827,8 @@ async def view_logs(request: Request, request_id: str) -> str:
except Exception as e:
logger.error(f"Error reading log file {log_file}: {e}")
# Sort entries by timestamp if available
log_entries.sort(key=lambda x: x.get("asctime", ""), reverse=False)
# Sort entries by timestamp if available (newest first)
log_entries.sort(key=lambda x: x.get("asctime", ""), reverse=True)
# Format log entries for display
formatted_logs = []
+21 -1
View File
@@ -170,7 +170,27 @@ export function LogDetailsDialog({
)}
<div>
<h4 className='mb-3 text-sm font-medium'>Raw JSON</h4>
<div className='mb-3 flex items-center justify-between'>
<h4 className='text-sm font-medium'>Raw JSON</h4>
<Button
variant='outline'
size='sm'
onClick={() => copyToClipboard(JSON.stringify(log, null, 2), 'json')}
className='h-6 px-2'
>
{copiedField === 'json' ? (
<>
<Check className='mr-1 h-3 w-3' />
Copied
</>
) : (
<>
<Copy className='mr-1 h-3 w-3' />
Copy
</>
)}
</Button>
</div>
<div className='bg-muted max-h-64 overflow-auto rounded-md p-4'>
<pre className='text-xs break-all whitespace-pre-wrap'>
{JSON.stringify(log, null, 2)}