combine docker charts and chart data

This commit is contained in:
Henry Dollman
2024-10-14 17:25:21 -04:00
parent bea37d62b4
commit 1b0dffc1ab
10 changed files with 232 additions and 378 deletions

View File

@@ -277,17 +277,20 @@ export async function updateUserSettings() {
}
/**
* Get the unit of size (TB or GB) for a given size in gigabytes
* @param n size in gigabytes
* @returns unit of size (TB or GB)
* Get the value and unit of size (TB, GB, or MB) for a given size
* @param n size in gigabytes or megabytes
* @param isGigabytes boolean indicating if n represents gigabytes (true) or megabytes (false)
* @returns an object containing the value and unit of size
*/
export const getSizeUnit = (n: number) => (n >= 1_000 ? ' TB' : ' GB')
export const getSizeAndUnit = (n: number, isGigabytes = true) => {
const sizeInGB = isGigabytes ? n : n / 1_000
/**
* Get the value of number in gigabytes if less than 1000, otherwise in terabytes
* @param n size in gigabytes
* @returns value in GB if less than 1000, otherwise value in TB
*/
export const getSizeVal = (n: number) => (n >= 1_000 ? n / 1_000 : n)
if (sizeInGB >= 1_000) {
return { v: sizeInGB / 1_000, u: ' TB' }
} else if (sizeInGB >= 1) {
return { v: sizeInGB, u: ' GB' }
}
return { v: n, u: ' MB' }
}
export const chartMargin = { top: 12 }