Skip to content

Commit

Permalink
rename byte formatting function
Browse files Browse the repository at this point in the history
  • Loading branch information
ajhollid committed Nov 19, 2024
1 parent 85c6dd2 commit de66ce9
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions Client/src/Pages/Infrastructure/details/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import PropTypes from "prop-types";
* @param {number} bytes - Number of bytes to convert
* @returns {number} Converted value in gigabytes
*/
const bytesToMBorGB = (bytes) => {
const formatBytes = (bytes) => {
if (typeof bytes !== "number") return "0 GB";
if (bytes === 0) return "0 GB";

Expand Down Expand Up @@ -196,11 +196,11 @@ const InfrastructureDetails = () => {
/>
<StatBox
heading={"Memory"}
subHeading={bytesToMBorGB(monitor.checks[0].memory.total_bytes)}
subHeading={formatBytes(monitor.checks[0].memory.total_bytes)}
/>
<StatBox
heading={"Disk"}
subHeading={bytesToMBorGB(monitor.checks[0].disk[0].total_bytes)}
subHeading={formatBytes(monitor.checks[0].disk[0].total_bytes)}
/>
<StatBox
heading={"Uptime"}
Expand All @@ -219,9 +219,9 @@ const InfrastructureDetails = () => {
value={monitor.checks[0].cpu.usage_percent * 100}
heading={"Memory Usage"}
metricOne={"Used"}
valueOne={bytesToMBorGB(monitor.checks[0].memory.used_bytes)}
valueOne={formatBytes(monitor.checks[0].memory.used_bytes)}
metricTwo={"Total"}
valueTwo={bytesToMBorGB(monitor.checks[0].memory.total_bytes)}
valueTwo={formatBytes(monitor.checks[0].memory.total_bytes)}
/>
<GaugeBox
value={monitor.checks[0].cpu.usage_percent * 100}
Expand All @@ -238,9 +238,9 @@ const InfrastructureDetails = () => {
value={disk.usage_percent * 100}
heading={`Disk${idx} usage`}
metricOne={"Used"}
valueOne={bytesToMBorGB(disk.total_bytes - disk.free_bytes)}
valueOne={formatBytes(disk.total_bytes - disk.free_bytes)}
metricTwo={"Total"}
valueTwo={bytesToMBorGB(disk.total_bytes)}
valueTwo={formatBytes(disk.total_bytes)}
/>
);
})}
Expand Down

0 comments on commit de66ce9

Please sign in to comment.