admin/logs: nicer rendering of URI column
Massimo Melina committed
Dec 23, 2023 at 20:24 UTC
536d070b91d7734d52e96bd2634272b84929a943
2 files changed
+8
-11
admin/src/LogsPage.ts
+7
-10
@@ -163,19 +163,16 @@ function LogFile({ file, pause, showApi }: { file: string, pause?: boolean, show
163
minWidth: 100,
164
mergeRender: { other: 'method', fontSize: 'small' },
165
renderCell: ({ value, row }) => {
166
- value = decodeURIComponent(value)
166
+ const [path, query] = splitAt('?', value).map(decodeURIComponent)
167
const ul = row.extra?.ul
168
if (ul)
169
return typeof ul === 'string' ? ul // legacy pre-0.51
170
- : splitAt('?', value)[0] + ul.join(' + ')
171
- if (!value.startsWith(API_URL))
172
- return value
173
- const ofs = API_URL.length
174
- const i = value.indexOf('?', ofs)
175
- const name = value.slice(ofs, i > 0 ? i : Infinity)
176
- const params = i < 0 ? ''
177
- : Array.from(new URLSearchParams(value.slice(i))).map(x => `${x[0]}=${tryJson(x[1]) ?? x[1]}`).join(' ; ')
178
- return `API ${name} ${params}`
170
+ : path + ul.join(' + ')
171
+ if (!path.startsWith(API_URL))
172
+ return [path, query && h(Box, { key: 0, component: 'span', color: 'text.secondary', fontSize: 'smaller' }, '?', query)]
173
+ const name = path.slice(API_URL.length)
174
+ const params = query && ': ' + Array.from(new URLSearchParams(query)).map(x => `${x[0]}=${tryJson(x[1]) ?? x[1]}`).join(' ; ')
175
+ return "API " + name + params
176
}
177
},
178
]
admin/src/theme.ts
+1
-1
@@ -13,7 +13,7 @@ export function useMyTheme() {
13
return useMemo(() => createTheme({
14
palette: lightMode || {
15
mode: 'dark',
16
- text: { primary: '#bbb' },
16
+ text: { primary: '#bbb', secondary: '#777' },
17
primary: { main: '#469', light: '#68c' },
18
secondary: { main: '#969' },
19
},