Fix NPE on ServerInfoCard (#1009)

* Fix NPE on ServerInfoCard

Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>

* missing import

Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
This commit is contained in:
Daniel Valdivia
2021-09-04 21:37:53 -07:00
committed by GitHub
parent 39eeedec2c
commit 50c1fe8298

View File

@@ -22,6 +22,7 @@ import { ServerInfo } from "../types";
import { niceDays } from "../../../../common/utils";
import { Card, CardHeader } from "@material-ui/core";
import { CircleIcon } from "../../../../icons";
import get from "lodash/get";
const styles = (theme: Theme) =>
createStyles({
@@ -92,7 +93,6 @@ interface ICardProps {
}
const ServerInfoCard = ({ classes, server }: ICardProps) => {
console.log(server);
const serverStatusToClass = (health_status: string) => {
switch (health_status) {
case "offline":
@@ -104,7 +104,7 @@ const ServerInfoCard = ({ classes, server }: ICardProps) => {
}
};
const networkKeys = Object.keys(server.network);
const networkKeys = Object.keys(get(server, "network", []));
const networkTotal = networkKeys.length;
const totalDrives = server.drives.length;