mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-04-01 21:13:09 +00:00
Feat/automated backups (#2142)
* initial restructuring * very cool * new structure in place * delete unnecessary T * down the rabbit hole * getting better * dont like it * nice * very nice * sessions select all * nice * backup runs * fix targets and more * small improvements * mostly working * address PR comments * fix error * delete issue with merge * fix checkboxes and add API for deleting backup runs * better styling for checkboxes * small button in ssh kpage too * complete multiple UI launcher * fix actions * present error toast too * fix target forms
This commit is contained in:
committed by
Aiden McClelland
parent
9499ea8ca9
commit
e53c90f8f0
@@ -6,12 +6,7 @@ import { Pipe, PipeTransform } from '@angular/core'
|
||||
})
|
||||
export class ConvertBytesPipe implements PipeTransform {
|
||||
transform(bytes: number): string {
|
||||
if (bytes === 0) return '0 Bytes'
|
||||
|
||||
const k = 1024
|
||||
const i = Math.floor(Math.log(bytes) / Math.log(k))
|
||||
|
||||
return parseFloat((bytes / Math.pow(k, i)).toFixed(1)) + ' ' + sizes[i]
|
||||
return convertBytes(bytes)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +22,15 @@ export class DurationToSecondsPipe implements PipeTransform {
|
||||
}
|
||||
}
|
||||
|
||||
export function convertBytes(bytes: number) {
|
||||
if (bytes === 0) return '0 Bytes'
|
||||
|
||||
const k = 1000
|
||||
const i = Math.floor(Math.log(bytes) / Math.log(k))
|
||||
|
||||
return parseFloat((bytes / Math.pow(k, i)).toFixed(1)) + ' ' + sizes[i]
|
||||
}
|
||||
|
||||
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
|
||||
|
||||
const unitsToSeconds: Record<string, number> = {
|
||||
|
||||
Reference in New Issue
Block a user