diff --git a/src/opnsense/www/js/widgets/Disk.js b/src/opnsense/www/js/widgets/Disk.js index 00746b79a42..0f9672fa2c3 100644 --- a/src/opnsense/www/js/widgets/Disk.js +++ b/src/opnsense/www/js/widgets/Disk.js @@ -57,7 +57,19 @@ export default class Disk extends BaseGaugeWidget { return size * units[unit]; } - + + /** + * Converts bytes to gigabytes using SI units (base-10). + * This returns a numeric value rounded to one decimal place without the "GB" label, + * useful for displaying raw numbers in a compact format. + * Note: Uses 1000-based conversion to match user-facing expectations + * (e.g. disk labels and UI conventions), not binary (1024-based) units. + */ + + _formatGB(bytes) { + return (bytes / (1000 * 1000 * 1000)).toFixed(1); + } + getMarkup() { return $(`