Display log chooser with copy button

This commit is contained in:
Nick Mowen 2022-12-05 11:22:49 -07:00
parent 7c9ccf6df3
commit 5eed08016d

View File

@ -1,11 +1,29 @@
import { h } from 'preact'; import { h } from 'preact';
import Heading from '../components/Heading'; import Heading from '../components/Heading';
import { useEffect } from 'preact/hooks'; import { useEffect, useState } from 'preact/hooks';
import ButtonsTabbed from '../components/ButtonsTabbed';
import useSWR from 'swr';
import Button from '../components/Button';
export default function Logs() { export default function Logs() {
const [logService, setLogService] = useState('frigate');
const { data: frigateLogs } = useSWR('logs/frigate');
const { data: go2rtcLogs } = useSWR('logs/go2rtc');
const { data: nginxLogs } = useSWR('logs/nginx');
return ( return (
<div className="space-y-4 p-2 px-4"> <div className="space-y-4 p-2 px-4">
<Heading>Logs</Heading> <Heading>Logs</Heading>
<ButtonsTabbed viewModes={['frigate', 'go2rtc', 'nginx']} setViewMode={setLogService} />
<div className='overflow-auto font-mono text-gray-900 dark:text-gray-100 rounded bg-gray-100 dark:bg-gray-800 p-2 whitespace-pre-wrap'>
{frigateLogs}
</div>
<Button className="">
Copy to Clipboard
</Button>
</div> </div>
); );
} }