mirror of
https://github.com/Routstr/routstr-core.git
synced 2026-08-09 02:54:37 +00:00
add copy button & order entries
This commit is contained in:
@@ -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 = []
|
||||
|
||||
@@ -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)}
|
||||
|
||||
Reference in New Issue
Block a user