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
@@ -0,0 +1,31 @@
|
||||
/** A time of the server in the browser's format, or a dash. */
|
||||
export function when(time: string | null | undefined) {
|
||||
return time ? new Date(time).toLocaleString() : '-'
|
||||
}
|
||||
|
||||
/** A value as text: lists joined with commas, an empty value as a dash. */
|
||||
export function text(value: unknown): string {
|
||||
if (Array.isArray(value)) {
|
||||
return value.length === 0 ? '-' : value.join(', ')
|
||||
}
|
||||
return value === undefined || value === null || value === '' ? '-' : String(value)
|
||||
}
|
||||
|
||||
/** Seconds as "1h 2m 3s". */
|
||||
export function duration(seconds: number) {
|
||||
const h = Math.floor(seconds / 3600)
|
||||
const m = Math.floor((seconds % 3600) / 60)
|
||||
return [h && `${h}h`, (h || m) && `${m}m`, `${seconds % 60}s`].filter(Boolean).join(' ')
|
||||
}
|
||||
|
||||
/** Bytes in B, KiB, MiB or GiB. */
|
||||
export function bytes(count: number) {
|
||||
const units = ['B', 'KiB', 'MiB', 'GiB']
|
||||
let value = count
|
||||
let unit = 0
|
||||
while (value >= 1024 && unit < units.length - 1) {
|
||||
value /= 1024
|
||||
unit += 1
|
||||
}
|
||||
return `${unit === 0 ? value : value.toFixed(1)} ${units[unit]}`
|
||||
}
|
||||
Reference in new issue
Block a user