Fixed crash in simple dashboard when one disk has failed (#2314)

Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
This commit is contained in:
Alex
2022-09-15 14:26:00 -05:00
committed by GitHub
parent 024ab1212b
commit 41671b4f25
3 changed files with 12 additions and 4 deletions

View File

@@ -236,6 +236,11 @@ const BasicDashboard = ({ usage }: IDashboardProps) => {
label={"Browse"}
icon={<ArrowRightIcon />}
variant={"regular"}
style={{
padding: 5,
height: 30,
fontSize: 14,
}}
/>
</TooltipWrapper>
</Link>

View File

@@ -52,13 +52,16 @@ const driveStatusColor = (health_status: string) => {
};
const DriveInfoItem = ({ drive }: ICardProps) => {
const freeSpace = drive.totalSpace - drive.usedSpace;
const totalSpace = drive.totalSpace || 0;
const usedSpace = drive.usedSpace || 0;
const freeSpace = totalSpace - usedSpace;
const plotValues = [
{ value: freeSpace, color: "#D6D6D6", label: "Free Space" },
{
value: drive.usedSpace,
color: capacityColors(drive.usedSpace, drive.totalSpace),
color: capacityColors(usedSpace, totalSpace),
label: "Used Space",
},
];
@@ -154,7 +157,7 @@ const DriveInfoItem = ({ drive }: ICardProps) => {
fontSize: 12,
}}
>
{niceBytesInt(drive.usedSpace)}
{drive.usedSpace ? niceBytesInt(drive.usedSpace) : "-"}
</span>
<div>
<PieChart width={110} height={110}>

View File

@@ -49,7 +49,7 @@ export interface IDriveInfo {
healing: boolean;
model: string;
totalSpace: number;
usedSpace: number;
usedSpace?: number;
availableSpace: number;
}