fix: admin/logs: "message" column doesn't belong to IPs tab
Massimo Melina committed
Oct 16, 2025 at 23:54 UTC
70360035971116f760da3513aa0719a0be391b3d
2 files changed
+7
-6
admin/src/DataTable.ts
+6
-5
@@ -2,7 +2,7 @@ import { DataGrid, DataGridProps, enUS, getGridStringOperators, GridColDef, Grid
2
GridValidRowModel, useGridApiRef, GridRenderCellParams } from '@mui/x-data-grid'
3
import { Alert, Box, BoxProps, Breakpoint, LinearProgress, useTheme } from '@mui/material'
4
import { createElement as h, Fragment, ReactNode, useCallback, useEffect, useMemo, useRef, useState } from 'react'
5
-import { callable, Callback, newDialog, onlyTruthy, useGetSize } from '@hfs/shared'
5
+import { callable, Callback, Falsy, newDialog, onlyTruthy, useGetSize } from '@hfs/shared'
6
import _ from 'lodash'
7
import { Center, Flex } from './mui'
8
import { SxProps } from '@mui/system'
@@ -19,7 +19,7 @@ export type DataTableColumn<R extends GridValidRowModel=any> = GridColDef<R> & {
19
mergeRenderSx?: SxProps
20
}
21
export interface DataTableProps<R extends GridValidRowModel=any> extends Omit<DataGridProps<R>, 'columns'> {
22
- columns: Array<DataTableColumn<R>>
22
+ columns: Array<DataTableColumn<R> | Falsy>
23
actions?: ({ row, id }: any) => ReactNode[]
24
actionsProps?: Partial<GridColDef<R>> & { hideUnder?: Breakpoint | number }
25
initializing?: boolean
@@ -38,7 +38,8 @@ export function DataTable({ columns, initialState={}, actions, actionsProps, ini
38
const [merged, setMerged] = useState(0)
39
const manipulatedColumns = useMemo(() => {
40
const { localeText } = enUS.components.MuiDataGrid.defaultProps as any
41
- const ret = columns.map(col => {
41
+ const ret = onlyTruthy(columns.map(col => {
42
+ if (!col) return
43
const { type, sx } = col
44
if (!type || type === 'string') // offer negated version of default string operators
45
col.filterOperators ??= getGridStringOperators().flatMap(op => op.value.includes('Empty') ? op : [ // isEmpty already has isNotEmpty
@@ -76,7 +77,7 @@ export function DataTable({ columns, initialState={}, actions, actionsProps, ini
77
)
78
}
79
}
79
- })
80
+ }))
81
if (actions)
82
ret.unshift({
83
field: ACTIONS,
@@ -104,7 +105,7 @@ export function DataTable({ columns, initialState={}, actions, actionsProps, ini
105
const o = Object.fromEntries(fields.map(x => [x, false]))
106
_.merge(initialState, { columns: { columnVisibilityModel: o } })
107
// count the hidden columns that are merged into visible columns
107
- setMerged(_.sumBy(fields, k => _.find(columns, col => !fields.includes(col.field) && col.mergeRender?.[k]) ? 1 : 0))
108
+ setMerged(_.sumBy(fields, k => _.find(columns, col => col && !fields.includes(col.field) && col.mergeRender?.[k]) ? 1 : 0))
109
return fields
110
}, [manipulatedColumns, width])
111
const [vis, setVis] = useState(persist && state.dataTablePersistence[persist]?.columnVisibility || {})
admin/src/LogsPage.ts
+1
-1
@@ -249,7 +249,7 @@ export function LogFile({ file, footerSide, hidden, limit, filter, ...rest }: Lo
249
valueGetter: ({ value }) => _.find(COUNTRIES, { code: value })?.name || value,
250
renderCell: ({ row }) => h(Country, { code: row.country, long: true, def: '-' }),
251
},
252
- {
252
+ !isIps && {
253
field: 'msg',
254
headerName: "Message",
255
flex: 4,