diff --git a/client/src/Pages/Infrastructure/Details/Components/NetworkStats/index.jsx b/client/src/Pages/Infrastructure/Details/Components/NetworkStats/index.jsx
index 227523439..41d2b0a87 100644
--- a/client/src/Pages/Infrastructure/Details/Components/NetworkStats/index.jsx
+++ b/client/src/Pages/Infrastructure/Details/Components/NetworkStats/index.jsx
@@ -1,8 +1,9 @@
import PropTypes from "prop-types";
import { useState, useEffect } from "react";
-import { FormControl, InputLabel, Select, MenuItem, Box } from "@mui/material";
+import { Box } from "@mui/material";
import { useTranslation } from "react-i18next";
import { useTheme } from "@emotion/react";
+import Select from "../../../../../Components/Inputs/Select";
import NetworkStatBoxes from "./NetworkStatBoxes";
import NetworkCharts from "./NetworkCharts";
import MonitorTimeFrameHeader from "../../../../../Components/MonitorTimeFrameHeader";
@@ -63,27 +64,17 @@ const Network = ({ net, checks, isLoading, dateRange, setDateRange }) => {
gap={theme.spacing(4)}
>
{availableInterfaces.length > 0 && (
- setSelectedInterface(e.target.value)}
+ items={availableInterfaces.map((interfaceName) => ({
+ _id: interfaceName,
+ name: interfaceName,
+ }))}
sx={{ minWidth: 200 }}
- >
- {t("networkInterface")}
-
-
+ />
)}
{
{
$project: {
diskCount: {
- $size: "$disk",
+ $size: { $ifNull: ["$disk", []] },
},
- netCount: { $size: "$net" },
+ netCount: { $size: { $ifNull: ["$net", []] } },
},
},
{
@@ -381,7 +381,7 @@ const buildHardwareDetailsPipeline = (monitor, dates, dateString) => {
},
net: {
$map: {
- input: { $range: [0, { $size: { $arrayElemAt: ["$net", 0] } }] },
+ input: { $range: [0, { $size: { $ifNull: [{ $arrayElemAt: ["$net", 0] }, []] } }] },
as: "netIndex",
in: {
name: {
@@ -409,7 +409,9 @@ const buildHardwareDetailsPipeline = (monitor, dates, dateString) => {
$arrayElemAt: [
{
$map: {
- input: { $arrayElemAt: ["$net", { $subtract: [{ $size: "$net" }, 1] }] },
+ input: {
+ $arrayElemAt: [{ $ifNull: ["$net", []] }, { $subtract: [{ $size: { $ifNull: ["$net", []] } }, 1] }],
+ },
as: "iface",
in: "$$iface.bytes_sent",
},
@@ -418,7 +420,9 @@ const buildHardwareDetailsPipeline = (monitor, dates, dateString) => {
],
},
tFirst: { $arrayElemAt: ["$updatedAts", 0] },
- tLast: { $arrayElemAt: ["$updatedAts", { $subtract: [{ $size: "$updatedAts" }, 1] }] },
+ tLast: {
+ $arrayElemAt: [{ $ifNull: ["$updatedAts", []] }, { $subtract: [{ $size: { $ifNull: ["$updatedAts", []] } }, 1] }],
+ },
},
in: {
$cond: [
@@ -444,7 +448,9 @@ const buildHardwareDetailsPipeline = (monitor, dates, dateString) => {
$arrayElemAt: [
{
$map: {
- input: { $arrayElemAt: ["$net", { $subtract: [{ $size: "$net" }, 1] }] },
+ input: {
+ $arrayElemAt: [{ $ifNull: ["$net", []] }, { $subtract: [{ $size: { $ifNull: ["$net", []] } }, 1] }],
+ },
as: "iface",
in: "$$iface.bytes_recv",
},
@@ -453,7 +459,9 @@ const buildHardwareDetailsPipeline = (monitor, dates, dateString) => {
],
},
tFirst: { $arrayElemAt: ["$updatedAts", 0] },
- tLast: { $arrayElemAt: ["$updatedAts", { $subtract: [{ $size: "$updatedAts" }, 1] }] },
+ tLast: {
+ $arrayElemAt: [{ $ifNull: ["$updatedAts", []] }, { $subtract: [{ $size: { $ifNull: ["$updatedAts", []] } }, 1] }],
+ },
},
in: {
$cond: [
@@ -479,7 +487,9 @@ const buildHardwareDetailsPipeline = (monitor, dates, dateString) => {
$arrayElemAt: [
{
$map: {
- input: { $arrayElemAt: ["$net", { $subtract: [{ $size: "$net" }, 1] }] },
+ input: {
+ $arrayElemAt: [{ $ifNull: ["$net", []] }, { $subtract: [{ $size: { $ifNull: ["$net", []] } }, 1] }],
+ },
as: "iface",
in: "$$iface.packets_sent",
},
@@ -488,7 +498,9 @@ const buildHardwareDetailsPipeline = (monitor, dates, dateString) => {
],
},
tFirst: { $arrayElemAt: ["$updatedAts", 0] },
- tLast: { $arrayElemAt: ["$updatedAts", { $subtract: [{ $size: "$updatedAts" }, 1] }] },
+ tLast: {
+ $arrayElemAt: [{ $ifNull: ["$updatedAts", []] }, { $subtract: [{ $size: { $ifNull: ["$updatedAts", []] } }, 1] }],
+ },
},
in: {
$cond: [
@@ -522,9 +534,9 @@ const buildHardwareDetailsPipeline = (monitor, dates, dateString) => {
$map: {
input: {
$arrayElemAt: [
- "$net",
+ { $ifNull: ["$net", []] },
{
- $subtract: [{ $size: "$net" }, 1],
+ $subtract: [{ $size: { $ifNull: ["$net", []] } }, 1],
},
],
},
@@ -538,9 +550,9 @@ const buildHardwareDetailsPipeline = (monitor, dates, dateString) => {
tFirst: { $arrayElemAt: ["$updatedAts", 0] },
tLast: {
$arrayElemAt: [
- "$updatedAts",
+ { $ifNull: ["$updatedAts", []] },
{
- $subtract: [{ $size: "$updatedAts" }, 1],
+ $subtract: [{ $size: { $ifNull: ["$updatedAts", []] } }, 1],
},
],
},
@@ -566,7 +578,9 @@ const buildHardwareDetailsPipeline = (monitor, dates, dateString) => {
$arrayElemAt: [
{
$map: {
- input: { $arrayElemAt: ["$net", { $subtract: [{ $size: "$net" }, 1] }] },
+ input: {
+ $arrayElemAt: [{ $ifNull: ["$net", []] }, { $subtract: [{ $size: { $ifNull: ["$net", []] } }, 1] }],
+ },
as: "iface",
in: "$$iface.err_in",
},
@@ -575,7 +589,9 @@ const buildHardwareDetailsPipeline = (monitor, dates, dateString) => {
],
},
tFirst: { $arrayElemAt: ["$updatedAts", 0] },
- tLast: { $arrayElemAt: ["$updatedAts", { $subtract: [{ $size: "$updatedAts" }, 1] }] },
+ tLast: {
+ $arrayElemAt: [{ $ifNull: ["$updatedAts", []] }, { $subtract: [{ $size: { $ifNull: ["$updatedAts", []] } }, 1] }],
+ },
},
in: {
$cond: [
@@ -609,9 +625,9 @@ const buildHardwareDetailsPipeline = (monitor, dates, dateString) => {
$map: {
input: {
$arrayElemAt: [
- "$net",
+ { $ifNull: ["$net", []] },
{
- $subtract: [{ $size: "$net" }, 1],
+ $subtract: [{ $size: { $ifNull: ["$net", []] } }, 1],
},
],
},
@@ -625,9 +641,9 @@ const buildHardwareDetailsPipeline = (monitor, dates, dateString) => {
tFirst: { $arrayElemAt: ["$updatedAts", 0] },
tLast: {
$arrayElemAt: [
- "$updatedAts",
+ { $ifNull: ["$updatedAts", []] },
{
- $subtract: [{ $size: "$updatedAts" }, 1],
+ $subtract: [{ $size: { $ifNull: ["$updatedAts", []] } }, 1],
},
],
},
@@ -664,9 +680,9 @@ const buildHardwareDetailsPipeline = (monitor, dates, dateString) => {
$map: {
input: {
$arrayElemAt: [
- "$net",
+ { $ifNull: ["$net", []] },
{
- $subtract: [{ $size: "$net" }, 1],
+ $subtract: [{ $size: { $ifNull: ["$net", []] } }, 1],
},
],
},
@@ -680,9 +696,9 @@ const buildHardwareDetailsPipeline = (monitor, dates, dateString) => {
tFirst: { $arrayElemAt: ["$updatedAts", 0] },
tLast: {
$arrayElemAt: [
- "$updatedAts",
+ { $ifNull: ["$updatedAts", []] },
{
- $subtract: [{ $size: "$updatedAts" }, 1],
+ $subtract: [{ $size: { $ifNull: ["$updatedAts", []] } }, 1],
},
],
},
@@ -719,9 +735,9 @@ const buildHardwareDetailsPipeline = (monitor, dates, dateString) => {
$map: {
input: {
$arrayElemAt: [
- "$net",
+ { $ifNull: ["$net", []] },
{
- $subtract: [{ $size: "$net" }, 1],
+ $subtract: [{ $size: { $ifNull: ["$net", []] } }, 1],
},
],
},
@@ -735,9 +751,9 @@ const buildHardwareDetailsPipeline = (monitor, dates, dateString) => {
tFirst: { $arrayElemAt: ["$updatedAts", 0] },
tLast: {
$arrayElemAt: [
- "$updatedAts",
+ { $ifNull: ["$updatedAts", []] },
{
- $subtract: [{ $size: "$updatedAts" }, 1],
+ $subtract: [{ $size: { $ifNull: ["$updatedAts", []] } }, 1],
},
],
},