feature: the CA certificates and CRLs are always published over HTTP and HTTPS on the status and Manager ports, the Shell page is an entry of the page menu, and the web interface passes its lint.
Release / release (push) Successful in 26s
Release / release (push) Successful in 26s
This commit is contained in:
1 parent
4b5318c676
commit
0cec95c19b
72 files changed
+910
-861
No files matched your search
+33
-18
@@ -38,25 +38,40 @@ export default function LogsPanel() {
|
||||
.catch((caught) => setError((caught as Error).message))
|
||||
}, [])
|
||||
|
||||
const read = useCallback(async () => {
|
||||
if (kind === 'file' && !file) {
|
||||
setLines(null)
|
||||
return
|
||||
}
|
||||
setBusy(true)
|
||||
const query = kind === 'journal'
|
||||
// The query of the log chosen, null while the Files tab has no file.
|
||||
const query = kind === 'file' && !file
|
||||
? null
|
||||
: kind === 'journal'
|
||||
? `/logs/journal?lines=${count}${unit ? `&unit=${encodeURIComponent(unit)}` : ''}`
|
||||
: `/logs/file?lines=${count}&path=${encodeURIComponent(file)}`
|
||||
try {
|
||||
setLines((await request<{ lines: string[] }>('GET', query, LOG_LINES_SHAPE)).lines)
|
||||
setError(null)
|
||||
} catch (caught) {
|
||||
setLines(null)
|
||||
setError((caught as Error).message)
|
||||
} finally {
|
||||
setBusy(false)
|
||||
// The query whose answer is shown.
|
||||
const [shown, setShown] = useState<string | null>(null)
|
||||
const reading = busy || (sources !== null && query !== null && shown !== query)
|
||||
|
||||
/** Reads the log chosen; the state changes only once the server answers. */
|
||||
const read = useCallback(async () => {
|
||||
if (query === null) {
|
||||
return
|
||||
}
|
||||
}, [kind, unit, file, count])
|
||||
await request<{ lines: string[] }>('GET', query, LOG_LINES_SHAPE)
|
||||
.then((found) => {
|
||||
setLines(found.lines)
|
||||
setError(null)
|
||||
}, (caught) => {
|
||||
setLines(null)
|
||||
setError((caught as Error).message)
|
||||
})
|
||||
.finally(() => {
|
||||
setShown(query)
|
||||
setBusy(false)
|
||||
})
|
||||
}, [query])
|
||||
|
||||
/** Reads the log again, busy until the server answers. */
|
||||
const refresh = useCallback(() => {
|
||||
setBusy(true)
|
||||
return read()
|
||||
}, [read])
|
||||
|
||||
useEffect(() => {
|
||||
if (sources) {
|
||||
@@ -104,13 +119,13 @@ export default function LogsPanel() {
|
||||
<VerticalAlignBottom fontSize="small" sx={{ mr: 0.5 }} />
|
||||
Follow
|
||||
</ToggleButton>
|
||||
<Button variant="outlined" startIcon={<Refresh />} disabled={busy || follow || !sources} onClick={() => void read()}>
|
||||
<Button variant="outlined" startIcon={<Refresh />} disabled={reading || follow || !sources} onClick={() => void refresh()}>
|
||||
Refresh
|
||||
</Button>
|
||||
</Toolbar>
|
||||
{error && <Alert severity="error" sx={{ mb: 2, whiteSpace: 'pre-line' }}>{error}</Alert>}
|
||||
{kind === 'file' && sources && sources.files.length === 0 && <Alert severity="info" sx={{ mb: 2 }}>No log files are configured.</Alert>}
|
||||
<LogView lines={lines} empty={busy ? '(reading)' : '(no lines)'} maxHeight={600} follow={follow} />
|
||||
<LogView lines={query === null ? null : lines} empty={reading ? '(reading)' : '(no lines)'} maxHeight={600} follow={follow} />
|
||||
</Box>
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user