@samitouri / QOSami-HFS / commits / f8eb4f4d

admin/logs: hide agent column if not available

Massimo Melina committed Dec 20, 2023 at 12:04 UTC f8eb4f4d90100edfcc0e000cd38364f5aca6054c
1 file changed +6 -2
admin/src/LogsPage.ts
+6 -2
@@ -38,6 +38,7 @@ export default function LogsPage() {
38
39 function LogFile({ file, pause, showApi }: { file: string, pause?: boolean, showApi: boolean }) {
40 const [showCountry, setShowCountry] = useState(false)
41 + const [showAgent, setShowAgent] = useState(false)
42 const { list, error, connecting } = useApiList('get_log', { file }, {
43 invert: true,
44 pause,
@@ -45,6 +46,8 @@ function LogFile({ file, pause, showApi }: { file: string, pause?: boolean, show
46 const { extra } = x
47 if (extra?.country && !showCountry)
48 setShowCountry(true)
49 + if (extra?.ua && !showAgent)
50 + setShowAgent(true)
51 x.notes = extra?.dl ? "fully downloaded"
52 : extra?.ul ? "uploaded " + formatBytes(extra.size)
53 : x.status === HTTP_UNAUTHORIZED && x.uri?.startsWith(API_URL + 'loginSrp') ? "login failed" + prefix(':\n', extra?.u)
@@ -138,8 +141,9 @@ function LogFile({ file, pause, showApi }: { file: string, pause?: boolean, show
141 {
142 headerName: "Agent",
143 hideUnder: 'xl',
141 - field: 'extra',
142 - valueGetter: ({ value }) => value?.ua,
144 + field: 'ua',
145 + hidden: !showAgent,
146 + valueGetter: ({ row }) => row.extra?.ua,
147 renderCell: ({ value }) =>
148 value && agentIcons(value),
149 },