feat(logs): fixes #194

This commit is contained in:
kunish 2023-09-10 01:10:56 +08:00
parent e935aedfcf
commit b000f919fc
No known key found for this signature in database
GPG Key ID: 647A12B4F782C430
2 changed files with 20 additions and 5 deletions

View File

@ -34,17 +34,32 @@ export default () => {
const columns: ColumnDef<LogWithSeq>[] = [
{
accessorKey: 'Sequence',
header: t('sequence'),
accessorFn: (row) => row.seq,
},
{
accessorKey: 'Type',
header: t('type'),
accessorFn: (row) => row.type,
cell: ({ row }) => {
const type = row.original.type
let className = ''
switch (type) {
case 'error':
className = 'text-error'
break
case 'warning':
className = 'text-warning'
break
case 'info':
className = 'text-info'
break
}
return <span class={className}>{`[${row.original.type}]`}</span>
},
},
{
accessorKey: 'Payload',
header: t('payload'),
accessorFn: (row) => row.payload,
},

View File

@ -106,7 +106,7 @@ export type Connection = ConnectionRawMessage & {
}
export type Log = {
type: string
type: 'error' | 'warning' | 'info' | 'debug' | 'silent'
payload: string
}