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

View File

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

View File

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