Skip to content

Commit

Permalink
Telco missing value
Browse files Browse the repository at this point in the history
  • Loading branch information
MVarshini committed Aug 27, 2024
1 parent e678519 commit e2efcd2
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 9 deletions.
33 changes: 31 additions & 2 deletions frontend/src/components/molecules/MetaDataRow/index.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
import "./index.less";

import {
CheckCircleIcon,
ExclamationCircleIcon,
ExclamationTriangleIcon,
} from "@patternfly/react-icons";
import { Table, Tbody, Th, Thead, Tr } from "@patternfly/react-table";

import PropTypes from "prop-types";
import { Title } from "@patternfly/react-core";
import { formatTime } from "@/helpers/Formatters.js";
import { uid } from "@/utils/helper.js";
import { useMemo } from "react";
import { useSelector } from "react-redux";
Expand All @@ -25,7 +31,24 @@ const MetadataRow = (props) => {
NODE_COUNT: nodeCount,
};
}, [clusterMetaData, nodeKeys, nodeCount]);

const defaultValue = useMemo(() => {
return {
clusterType: "SNO spoke",
networkType: "OVNKubernetes",
masterNodesCount: "1",
master_type: "Baremetal",
totalNodesCount: "1",
};
}, []);
const icons = useMemo(
() => ({
failed: <ExclamationCircleIcon fill={"#C9190B"} />,
failure: <ExclamationCircleIcon fill={"#C9190B"} />,
success: <CheckCircleIcon fill={"#3E8635"} />,
upstream_failed: <ExclamationTriangleIcon fill={"#F0AB00"} />,
}),
[]
);
return (
<>
<Title headingLevel="h4" className="type_heading">
Expand All @@ -44,7 +67,13 @@ const MetadataRow = (props) => {
{memoObj[props?.category].map((item) => (
<Tr key={uid()}>
<Th>{item.name}</Th>
<Th>{props.metadata[item.value]}</Th>
<Th>
{item.value === "jobDuration"
? formatTime(props.metadata[item.value])
: item.value === "jobStatus"
? icons[props.metadata[item.value]]
: props.metadata[item.value] ?? defaultValue[item.value]}
</Th>
</Tr>
))}
</Tbody>
Expand Down
9 changes: 2 additions & 7 deletions frontend/src/reducers/telcoReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,18 @@ const initialState = {
],
clusterMetaData: [
{ name: "Release Binary", value: "releaseStream" },
{ name: "Cluster Name", value: "clusterName" },
{ name: "Cluster Name", value: "nodeName" },
{ name: "Cluster Type", value: "clusterType" },
{ name: "Network Type", value: "networkType" },
{ name: "Benchmark Status", value: "jobStatus" },
{ name: "Duration", value: "jobDuration" },
{ name: "Test ID", value: "uuid" },
],
nodeKeys: [
{ name: "Master", value: "masterNodesCount" },
{ name: "Worker", value: "workerNodesType" },
{ name: "Infra", value: "infraNodesType" },
{ name: "Master", value: "master_type" },
{ name: "Workload", value: "benchmark" },
],
nodeCount: [
{ name: "Master", value: "masterNodesCount" },
{ name: "Worker", value: "workerNodesCount" },
{ name: "Infra", value: "infraNodesCount" },
{ name: "Total", value: "totalNodesCount" },
],
filterData: [],
Expand Down

0 comments on commit e2efcd2

Please sign in to comment.