Fixed crash in simple dashboard when one disk has failed (#2314)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
This commit is contained in:
@@ -236,6 +236,11 @@ const BasicDashboard = ({ usage }: IDashboardProps) => {
|
||||
label={"Browse"}
|
||||
icon={<ArrowRightIcon />}
|
||||
variant={"regular"}
|
||||
style={{
|
||||
padding: 5,
|
||||
height: 30,
|
||||
fontSize: 14,
|
||||
}}
|
||||
/>
|
||||
</TooltipWrapper>
|
||||
</Link>
|
||||
|
||||
@@ -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}>
|
||||
|
||||
@@ -49,7 +49,7 @@ export interface IDriveInfo {
|
||||
healing: boolean;
|
||||
model: string;
|
||||
totalSpace: number;
|
||||
usedSpace: number;
|
||||
usedSpace?: number;
|
||||
availableSpace: number;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user