fix(log): log level value not selected

This commit is contained in:
kunish 2023-09-16 15:38:42 +08:00
parent d4ac016294
commit 3fbed0d694
No known key found for this signature in database
GPG Key ID: 647A12B4F782C430
3 changed files with 3 additions and 4 deletions

View File

@ -8,6 +8,7 @@ import {
TAILWINDCSS_SIZE, TAILWINDCSS_SIZE,
} from '~/constants' } from '~/constants'
import { import {
logLevel,
logMaxRows, logMaxRows,
logsTableSize, logsTableSize,
setLogLevel, setLogLevel,
@ -42,6 +43,7 @@ export const LogsSettingsModal = () => {
<select <select
class="select select-bordered w-full" class="select select-bordered w-full"
value={logLevel()}
onChange={(e) => setLogLevel(e.target.value as LOG_LEVEL)} onChange={(e) => setLogLevel(e.target.value as LOG_LEVEL)}
> >
<For <For

View File

@ -23,7 +23,6 @@ export default () => {
const [logs, setLogs] = createSignal<LogWithSeq[]>([]) const [logs, setLogs] = createSignal<LogWithSeq[]>([])
const logsData = useWsRequest<Log>('logs', { level: logLevel() }) const logsData = useWsRequest<Log>('logs', { level: logLevel() })
const maxRows = logMaxRows()
createEffect(() => { createEffect(() => {
const data = logsData() const data = logsData()
@ -32,7 +31,7 @@ export default () => {
return return
} }
setLogs((logs) => [{ ...data, seq }, ...logs].slice(0, maxRows)) setLogs((logs) => [{ ...data, seq }, ...logs].slice(0, logMaxRows()))
seq++ seq++
}) })

View File

@ -58,12 +58,10 @@ export const [logsTableSize, setLogsTableSize] = makePersisted(
createSignal<TAILWINDCSS_SIZE>(TAILWINDCSS_SIZE.XS), createSignal<TAILWINDCSS_SIZE>(TAILWINDCSS_SIZE.XS),
{ name: 'logsTableSize', storage: localStorage }, { name: 'logsTableSize', storage: localStorage },
) )
export const [logLevel, setLogLevel] = makePersisted( export const [logLevel, setLogLevel] = makePersisted(
createSignal<LOG_LEVEL>(LOG_LEVEL.Info), createSignal<LOG_LEVEL>(LOG_LEVEL.Info),
{ name: 'logLevel', storage: localStorage }, { name: 'logLevel', storage: localStorage },
) )
export const [logMaxRows, setLogMaxRows] = makePersisted(createSignal(300), { export const [logMaxRows, setLogMaxRows] = makePersisted(createSignal(300), {
name: 'logMaxRows', name: 'logMaxRows',
storage: localStorage, storage: localStorage,