diff --git a/changes/issue-7902-disk-space-formatting-for-linux b/changes/issue-7902-disk-space-formatting-for-linux new file mode 100644 index 0000000000..82dd2aa36d --- /dev/null +++ b/changes/issue-7902-disk-space-formatting-for-linux @@ -0,0 +1 @@ +* Remove tooltips and conditional coloring in the disk space graph for Linux hosts diff --git a/frontend/components/DiskSpaceGraph/DiskSpaceGraph.tsx b/frontend/components/DiskSpaceGraph/DiskSpaceGraph.tsx index 6c51a54150..8d55e54757 100644 --- a/frontend/components/DiskSpaceGraph/DiskSpaceGraph.tsx +++ b/frontend/components/DiskSpaceGraph/DiskSpaceGraph.tsx @@ -7,6 +7,7 @@ interface IDiskSpaceGraphProps { gigsDiskSpaceAvailable: number | string; percentDiskSpaceAvailable: number; id: string; + platform: string; } const DiskSpaceGraph = ({ @@ -14,28 +15,31 @@ const DiskSpaceGraph = ({ gigsDiskSpaceAvailable, percentDiskSpaceAvailable, id, + platform, }: IDiskSpaceGraphProps): JSX.Element => { - const diskSpaceIndicator = () => { - switch (true) { - case gigsDiskSpaceAvailable < 16: + const getDiskSpaceIndicatorColor = (): string => { + // return space-dependent graph colors for mac and windows hosts, green for linux + if (platform === "darwin" || platform === "windows") { + if (gigsDiskSpaceAvailable < 16) { return "red"; - case gigsDiskSpaceAvailable < 32: + } else if (gigsDiskSpaceAvailable < 32) { return "yellow"; - default: - return "green"; + } } + return "green"; }; - const diskSpaceTooltip = (): string | undefined => { - switch (true) { - case gigsDiskSpaceAvailable < 16: + const diskSpaceTooltipText = ((): string | undefined => { + if (platform === "darwin" || platform === "windows") { + if (gigsDiskSpaceAvailable < 16) { return "Not enough disk space available to install most small operating systems updates."; - case gigsDiskSpaceAvailable < 32: + } else if (gigsDiskSpaceAvailable < 32) { return "Not enough disk space available to install most large operating systems updates."; - default: - return "Enough disk space available to install most operating systems updates."; + } + return "Enough disk space available to install most operating systems updates."; } - }; + return undefined; + })(); if (gigsDiskSpaceAvailable === 0 || gigsDiskSpaceAvailable === "---") { return No data available; @@ -46,29 +50,35 @@ const DiskSpaceGraph = ({