From f7eac3086b04dbc0e88f7d52fb940f5ef7c1b1c5 Mon Sep 17 00:00:00 2001 From: jinapurapu <65002498+jinapurapu@users.noreply.github.com> Date: Wed, 3 Nov 2021 16:49:46 -0700 Subject: [PATCH] Fixed health color logic for two drive case (#1185) * Fixed health color logic for two drive case * Removed unneeded code --- .../BasicDashboard/ServerInfoCard.tsx | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/portal-ui/src/screens/Console/Dashboard/BasicDashboard/ServerInfoCard.tsx b/portal-ui/src/screens/Console/Dashboard/BasicDashboard/ServerInfoCard.tsx index 7e81fc9e2..036a202c9 100644 --- a/portal-ui/src/screens/Console/Dashboard/BasicDashboard/ServerInfoCard.tsx +++ b/portal-ui/src/screens/Console/Dashboard/BasicDashboard/ServerInfoCard.tsx @@ -13,7 +13,6 @@ // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . - import React from "react"; import { Theme } from "@mui/material/styles"; import createStyles from "@mui/styles/createStyles"; @@ -25,18 +24,15 @@ import { Card, CardHeader } from "@mui/material"; import { CircleIcon, VersionIcon } from "../../../../icons"; import get from "lodash/get"; import { commonDashboardInfocard } from "../../Common/FormComponents/common/styleLibrary"; - const styles = (theme: Theme) => createStyles({ ...commonDashboardInfocard, }); - interface ICardProps { classes: any; server: ServerInfo; index: number; } - const ServerInfoCard = ({ classes, server, index }: ICardProps) => { const serverStatusToClass = (health_status: string) => { switch (health_status) { @@ -48,12 +44,9 @@ const ServerInfoCard = ({ classes, server, index }: ICardProps) => { return classes.greyState; } }; - const networkKeys = Object.keys(get(server, "network", {})); - const networkTotal = networkKeys.length; const totalDrives = server.drives ? server.drives.length : 0; - const activeNetwork = networkKeys.reduce((acc: number, currValue: string) => { const item = server.network[currValue]; if (item === "online") { @@ -61,11 +54,9 @@ const ServerInfoCard = ({ classes, server, index }: ICardProps) => { } return acc; }, 0); - const activeDisks = server.drives ? server.drives.filter((element) => element.state === "ok").length : 0; - return ( { @@ -122,5 +114,4 @@ const ServerInfoCard = ({ classes, server, index }: ICardProps) => { ); }; - -export default withStyles(styles)(ServerInfoCard); +export default withStyles(styles)(ServerInfoCard); \ No newline at end of file