Merge pull request #3595 from bluewave-labs/feat/infrastructure-network-empty-state

feat(infrastructure): show notice when network charts have zero traffic
This commit is contained in:
Alexander Holliday authored and GitHub committed 2026-04-29 09:57:49 -07:00
commit f58456961b
17 files changed
+80 -48

No files matched your search

@@ -1,4 +1,6 @@
import Grid from "@mui/material/Grid"; import Grid from "@mui/material/Grid";
import Stack from "@mui/material/Stack";
import { NoticeBanner } from "@/Components/design-elements";
import { HistogramInfrastructure } from "@/Components/monitors"; import { HistogramInfrastructure } from "@/Components/monitors";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
@@ -6,6 +8,7 @@ import type { HardwareCheckStats } from "@/Types/Monitor";
import { useMemo } from "react"; import { useMemo } from "react";
import { useTheme } from "@mui/material/styles"; import { useTheme } from "@mui/material/styles";
import useMediaQuery from "@mui/material/useMediaQuery"; import useMediaQuery from "@mui/material/useMediaQuery";
import { LAYOUT } from "@/Utils/Theme/constants";
const formatBytesToMB = (value: number) => `${(value / (1024 * 1024)).toFixed(2)} MB`; const formatBytesToMB = (value: number) => `${(value / (1024 * 1024)).toFixed(2)} MB`;
@@ -60,6 +63,11 @@ const getChartConfigs = (
return configs; return configs;
}; };
const hasAnyNetworkTraffic = (checks: HardwareCheckStats[]): boolean =>
checks.some((c) =>
c.net?.some((iface) => iface.bytesSentPerSecond > 0 || iface.deltaBytesRecv > 0)
);
export const InfraNetworkCharts = ({ export const InfraNetworkCharts = ({
checks, checks,
dateRange, dateRange,
@@ -74,35 +82,43 @@ export const InfraNetworkCharts = ({
() => getChartConfigs(theme, checks, t), () => getChartConfigs(theme, checks, t),
[theme, checks, t] [theme, checks, t]
); );
const showNoTrafficNotice = chartConfigs.length > 0 && !hasAnyNetworkTraffic(checks);
return ( return (
<Grid <Stack gap={theme.spacing(LAYOUT.XS)}>
container {showNoTrafficNotice && (
spacing={theme.spacing(8)} <NoticeBanner severity="warning">
> {t("pages.infrastructure.charts.labels.netNoTraffic")}
{chartConfigs.map((config) => { </NoticeBanner>
return ( )}
<Grid <Grid
size={isSmall ? 12 : 6} container
key={`${config.type}-${config.interfaceName ?? config.idx ?? ""}`} spacing={theme.spacing(LAYOUT.MD)}
> >
<HistogramInfrastructure {chartConfigs.map((config) => {
dateRange={dateRange} return (
title={config.title} <Grid
type={config.type} size={isSmall ? 12 : 6}
idx={config.idx} key={`${config.type}-${config.interfaceName ?? config.idx ?? ""}`}
checks={checks} >
xKey="bucketDate" <HistogramInfrastructure
dataKeys={config.dataKeys} dateRange={dateRange}
gradient={true} title={config.title}
gradientStartColor={config.gradientStartColor} type={config.type}
gradientEndColor="#ffffff" idx={config.idx}
strokeColor={config.strokeColor} checks={checks}
yAxisFormatter={formatBytesToMB} xKey="bucketDate"
/> dataKeys={config.dataKeys}
</Grid> gradient={true}
); gradientStartColor={config.gradientStartColor}
})} gradientEndColor="#ffffff"
</Grid> strokeColor={config.strokeColor}
yAxisFormatter={formatBytesToMB}
/>
</Grid>
);
})}
</Grid>
</Stack>
); );
}; };
+2 -1
View File
@@ -769,6 +769,7 @@
"memory": "استخدام الذاكرة", "memory": "استخدام الذاكرة",
"netBytesRecv": "{{name}} - البايتات المستلمة", "netBytesRecv": "{{name}} - البايتات المستلمة",
"netBytesSent": "{{name}} - البايتات المرسلة", "netBytesSent": "{{name}} - البايتات المرسلة",
"netNoTraffic": "Capture يبلغ عن عدم وجود حركة بيانات على أي واجهة. هذا أمر طبيعي عندما يعمل Capture داخل حاوية لا ترى سوى واجهات الاسترجاع — قم بتشغيل Capture مباشرة على المضيف لرؤية نشاط الشبكة الحقيقي.",
"temp": "الحرارة" "temp": "الحرارة"
} }
}, },
@@ -1236,7 +1237,7 @@
"description": "إضافة مراقبات نموذجية لأغراض العرض التوضيحي." "description": "إضافة مراقبات نموذجية لأغراض العرض التوضيحي."
}, },
"removeMonitors": { "removeMonitors": {
"title": "إعادة تعيين النظام", "title": "إعادة ضبط النظام",
"description": "إزالة جميع المراقبات من نظامك.", "description": "إزالة جميع المراقبات من نظامك.",
"dialog": { "dialog": {
"title": "إزالة جميع المراقبات؟", "title": "إزالة جميع المراقبات؟",
+3 -2
View File
@@ -769,6 +769,7 @@
"memory": "Využití paměti", "memory": "Využití paměti",
"netBytesRecv": "{{name}} - přijaté bajty", "netBytesRecv": "{{name}} - přijaté bajty",
"netBytesSent": "{{name}} - odeslané bajty", "netBytesSent": "{{name}} - odeslané bajty",
"netNoTraffic": "Capture hlásí nulový provoz na všech rozhraních. To je normální, když Capture běží uvnitř kontejneru, který vidí pouze loopback rozhraní — spusťte Capture přímo na hostiteli, abyste viděli skutečnou síťovou aktivitu.",
"temp": "Teplota" "temp": "Teplota"
} }
}, },
@@ -1236,8 +1237,8 @@
"description": "Přidejte ukázkové monitory pro demonstrační účely." "description": "Přidejte ukázkové monitory pro demonstrační účely."
}, },
"removeMonitors": { "removeMonitors": {
"title": "Obnovení systému", "title": "Reset systému",
"description": "Odeberte všechny monitory z vašeho systému.", "description": "Odstranit všechny monitory ze systému.",
"dialog": { "dialog": {
"title": "Odebrat všechny monitory?", "title": "Odebrat všechny monitory?",
"description": "Tuto akci nelze vrátit zpět." "description": "Tuto akci nelze vrátit zpět."
+2 -1
View File
@@ -769,6 +769,7 @@
"memory": "Arbeitsspeicherauslastung", "memory": "Arbeitsspeicherauslastung",
"netBytesRecv": "{{name}} - Empfangene Bytes", "netBytesRecv": "{{name}} - Empfangene Bytes",
"netBytesSent": "{{name}} - Gesendete Bytes", "netBytesSent": "{{name}} - Gesendete Bytes",
"netNoTraffic": "Capture meldet null Datenverkehr auf allen Schnittstellen. Das ist normal, wenn Capture in einem Container läuft, der nur Loopback-Schnittstellen sieht — führe Capture direkt auf dem Host aus, um echten Netzwerkverkehr zu sehen.",
"temp": "Temp." "temp": "Temp."
} }
}, },
@@ -1237,7 +1238,7 @@
}, },
"removeMonitors": { "removeMonitors": {
"title": "System zurücksetzen", "title": "System zurücksetzen",
"description": "Alle Monitore aus Ihrem System entfernen.", "description": "Alle Monitore aus dem System entfernen.",
"dialog": { "dialog": {
"title": "Alle Monitore entfernen?", "title": "Alle Monitore entfernen?",
"description": "Dies kann nicht rückgängig gemacht werden." "description": "Dies kann nicht rückgängig gemacht werden."
+1
View File
@@ -769,6 +769,7 @@
"memory": "Memory usage", "memory": "Memory usage",
"netBytesRecv": "{{name}} - Bytes Received", "netBytesRecv": "{{name}} - Bytes Received",
"netBytesSent": "{{name}} - Bytes Sent", "netBytesSent": "{{name}} - Bytes Sent",
"netNoTraffic": "Capture is reporting zero traffic on every interface. This is normal when Capture runs inside a container that can only see loopback interfaces — run Capture directly on the host to see real network activity.",
"temp": "Temp" "temp": "Temp"
} }
}, },
+3 -2
View File
@@ -776,6 +776,7 @@
"memory": "Uso de memoria", "memory": "Uso de memoria",
"netBytesRecv": "{{name}} - Bytes recibidos", "netBytesRecv": "{{name}} - Bytes recibidos",
"netBytesSent": "{{name}} - Bytes enviados", "netBytesSent": "{{name}} - Bytes enviados",
"netNoTraffic": "Capture no informa tráfico en ninguna interfaz. Esto es normal cuando Capture se ejecuta dentro de un contenedor que solo ve interfaces de loopback — ejecuta Capture directamente en el host para ver actividad de red real.",
"temp": "Temp" "temp": "Temp"
} }
}, },
@@ -1243,8 +1244,8 @@
"description": "Agregue monitores de ejemplo con fines demostrativos." "description": "Agregue monitores de ejemplo con fines demostrativos."
}, },
"removeMonitors": { "removeMonitors": {
"title": "Reinicio del sistema", "title": "Reiniciar sistema",
"description": "Elimine todos los monitores de su sistema.", "description": "Eliminar todos los monitores del sistema.",
"dialog": { "dialog": {
"title": "¿Eliminar todos los monitores?", "title": "¿Eliminar todos los monitores?",
"description": "Esto no se puede deshacer." "description": "Esto no se puede deshacer."
+2 -1
View File
@@ -769,6 +769,7 @@
"memory": "Muistin käyttö", "memory": "Muistin käyttö",
"netBytesRecv": "{{name}} - tavua vastaanotettu", "netBytesRecv": "{{name}} - tavua vastaanotettu",
"netBytesSent": "{{name}} - tavua lähetetty", "netBytesSent": "{{name}} - tavua lähetetty",
"netNoTraffic": "Capture ilmoittaa nollaliikennettä kaikilla rajapinnoilla. Tämä on normaalia, kun Capture käynnistetään säiliössä, joka näkee vain loopback-rajapinnat — suorita Capture suoraan isännällä nähdäksesi todellisen verkkoaktiviteetin.",
"temp": "Lämpö" "temp": "Lämpö"
} }
}, },
@@ -1236,7 +1237,7 @@
"description": "Lisää esimerkkimonitoreja esittelytarkoituksiin." "description": "Lisää esimerkkimonitoreja esittelytarkoituksiin."
}, },
"removeMonitors": { "removeMonitors": {
"title": "Järjestelmän nollaus", "title": "Järjestelmän palautus",
"description": "Poista kaikki monitorit järjestelmästäsi.", "description": "Poista kaikki monitorit järjestelmästäsi.",
"dialog": { "dialog": {
"title": "Poistetaanko kaikki monitorit?", "title": "Poistetaanko kaikki monitorit?",
+3 -2
View File
@@ -769,6 +769,7 @@
"memory": "Utilisation mémoire", "memory": "Utilisation mémoire",
"netBytesRecv": "{{name}} - Octets reçus", "netBytesRecv": "{{name}} - Octets reçus",
"netBytesSent": "{{name}} - Octets envoyés", "netBytesSent": "{{name}} - Octets envoyés",
"netNoTraffic": "Capture ne signale aucun trafic sur toutes les interfaces. C'est normal lorsque Capture s'exécute dans un conteneur qui ne voit que les interfaces de loopback — exécutez Capture directement sur l'hôte pour voir l'activité réseau réelle.",
"temp": "Temp." "temp": "Temp."
} }
}, },
@@ -1236,8 +1237,8 @@
"description": "Ajoutez des moniteurs d'exemple à des fins de démonstration." "description": "Ajoutez des moniteurs d'exemple à des fins de démonstration."
}, },
"removeMonitors": { "removeMonitors": {
"title": "Réinitialisation du système", "title": "Réinitialiser le système",
"description": "Supprimez tous les moniteurs de votre système.", "description": "Supprimer tous les moniteurs de votre système.",
"dialog": { "dialog": {
"title": "Supprimer tous les moniteurs ?", "title": "Supprimer tous les moniteurs ?",
"description": "Cette action est irréversible." "description": "Cette action est irréversible."
+1
View File
@@ -769,6 +769,7 @@
"memory": "メモリ使用率", "memory": "メモリ使用率",
"netBytesRecv": "{{name}} - 受信バイト数", "netBytesRecv": "{{name}} - 受信バイト数",
"netBytesSent": "{{name}} - 送信バイト数", "netBytesSent": "{{name}} - 送信バイト数",
"netNoTraffic": "Capture はすべてのインターフェイスでゼロのトラフィックを報告しています。これは Capture がループバックインターフェイスのみを認識できるコンテナ内で実行されている場合に正常です — 実際のネットワークアクティビティを表示するには、ホスト上で Capture を直接実行してください。",
"temp": "温度" "temp": "温度"
} }
}, },
+3 -2
View File
@@ -769,6 +769,7 @@
"memory": "Uso de memória", "memory": "Uso de memória",
"netBytesRecv": "{{name}} - Bytes recebidos", "netBytesRecv": "{{name}} - Bytes recebidos",
"netBytesSent": "{{name}} - Bytes enviados", "netBytesSent": "{{name}} - Bytes enviados",
"netNoTraffic": "Capture está reportando zero tráfego em todas as interfaces. Isso é normal quando Capture é executado dentro de um container que só consegue ver interfaces de loopback — execute Capture diretamente no host para ver a atividade real da rede.",
"temp": "Temp" "temp": "Temp"
} }
}, },
@@ -1236,8 +1237,8 @@
"description": "Adicione monitores de exemplo para fins de demonstração." "description": "Adicione monitores de exemplo para fins de demonstração."
}, },
"removeMonitors": { "removeMonitors": {
"title": "Redefinição do sistema", "title": "Redefinir sistema",
"description": "Remova todos os monitores do seu sistema.", "description": "Remover todos os monitores do seu sistema.",
"dialog": { "dialog": {
"title": "Remover todos os monitores?", "title": "Remover todos os monitores?",
"description": "Isso não pode ser desfeito." "description": "Isso não pode ser desfeito."
+2 -1
View File
@@ -769,6 +769,7 @@
"memory": "Использование памяти", "memory": "Использование памяти",
"netBytesRecv": "{{name}} - байт получено", "netBytesRecv": "{{name}} - байт получено",
"netBytesSent": "{{name}} - байт отправлено", "netBytesSent": "{{name}} - байт отправлено",
"netNoTraffic": "Capture сообщает о нулевом трафике на всех интерфейсах. Это нормально, когда Capture работает внутри контейнера, который видит только loopback-интерфейсы — запустите Capture непосредственно на хосте, чтобы увидеть реальную сетевую активность.",
"temp": "Температура" "temp": "Температура"
} }
}, },
@@ -1237,7 +1238,7 @@
}, },
"removeMonitors": { "removeMonitors": {
"title": "Сброс системы", "title": "Сброс системы",
"description": "Удалить все мониторы из Вашей системы.", "description": "Удалить все мониторы из вашей системы.",
"dialog": { "dialog": {
"title": "Удалить все мониторы?", "title": "Удалить все мониторы?",
"description": "Это действие нельзя отменить." "description": "Это действие нельзя отменить."
+2 -1
View File
@@ -769,6 +769,7 @@
"memory": "การใช้งานหน่วยความจำ", "memory": "การใช้งานหน่วยความจำ",
"netBytesRecv": "{{name}} - ไบต์ที่รับ", "netBytesRecv": "{{name}} - ไบต์ที่รับ",
"netBytesSent": "{{name}} - ไบต์ที่ส่ง", "netBytesSent": "{{name}} - ไบต์ที่ส่ง",
"netNoTraffic": "Capture รายงานว่าไม่มีการรับส่งข้อมูลบนอินเทอร์เฟซใดๆ เลย ซึ่งเป็นเรื่องปกติเมื่อ Capture ทำงานอยู่ในคอนเทนเนอร์ที่มองเห็นเพียงอินเทอร์เฟซ loopback เท่านั้น — รัน Capture บนโฮสต์โดยตรงเพื่อดูกิจกรรมเครือข่ายจริง",
"temp": "อุณหภูมิ" "temp": "อุณหภูมิ"
} }
}, },
@@ -1237,7 +1238,7 @@
}, },
"removeMonitors": { "removeMonitors": {
"title": "รีเซ็ตระบบ", "title": "รีเซ็ตระบบ",
"description": "ลบมอนิเตอร์ทั้งหมดออกจากระบบ", "description": "ลบมอนิเตอร์ทั้งหมดจากระบบของคุณ",
"dialog": { "dialog": {
"title": "ลบมอนิเตอร์ทั้งหมด?", "title": "ลบมอนิเตอร์ทั้งหมด?",
"description": "ไม่สามารถย้อนกลับได้" "description": "ไม่สามารถย้อนกลับได้"
+3 -2
View File
@@ -769,6 +769,7 @@
"memory": "Bellek kullanımı", "memory": "Bellek kullanımı",
"netBytesRecv": "{{name}} - Alınan bayt", "netBytesRecv": "{{name}} - Alınan bayt",
"netBytesSent": "{{name}} - Gönderilen bayt", "netBytesSent": "{{name}} - Gönderilen bayt",
"netNoTraffic": "Capture tüm arabirimlerde sıfır trafik raporluyor. Bu, Capture yalnızca loopback arabirimlerini görebilen bir konteyner içinde çalışırken normaldir — gerçek ağ etkinliğini görmek için Capture'ı doğrudan host üzerinde çalıştırın.",
"temp": "Sıcaklık" "temp": "Sıcaklık"
} }
}, },
@@ -1236,8 +1237,8 @@
"description": "Gösterim amaçlı örnek monitörler ekleyin." "description": "Gösterim amaçlı örnek monitörler ekleyin."
}, },
"removeMonitors": { "removeMonitors": {
"title": "Sistem sıfırlama", "title": "Sistemi sıfırla",
"description": "Sisteminizdeki tüm monitörleri kaldırın.", "description": "Sistemdeki tüm monitörleri kaldır.",
"dialog": { "dialog": {
"title": "Tüm monitörler kaldırılsın mı?", "title": "Tüm monitörler kaldırılsın mı?",
"description": "Bu işlem geri alınamaz." "description": "Bu işlem geri alınamaz."
+2 -1
View File
@@ -769,6 +769,7 @@
"memory": "Використання пам'яті", "memory": "Використання пам'яті",
"netBytesRecv": "{{name}} - Отримано байтів", "netBytesRecv": "{{name}} - Отримано байтів",
"netBytesSent": "{{name}} - Надіслано байтів", "netBytesSent": "{{name}} - Надіслано байтів",
"netNoTraffic": "Capture повідомляє про нульовий трафік на всіх інтерфейсах. Це нормально, коли Capture працює всередині контейнера, який бачить лише loopback-інтерфейси — запустіть Capture безпосередньо на хості, щоб побачити реальну мережеву активність.",
"temp": "Темп." "temp": "Темп."
} }
}, },
@@ -1237,7 +1238,7 @@
}, },
"removeMonitors": { "removeMonitors": {
"title": "Скидання системи", "title": "Скидання системи",
"description": "Видалити всі монітори з Вашої системи.", "description": "Видалити всі монітори з вашої системи.",
"dialog": { "dialog": {
"title": "Видалити всі монітори?", "title": "Видалити всі монітори?",
"description": "Це не можна скасувати." "description": "Це не можна скасувати."
+2 -1
View File
@@ -769,6 +769,7 @@
"memory": "Sử dụng bộ nhớ", "memory": "Sử dụng bộ nhớ",
"netBytesRecv": "{{name}} - Byte nhận", "netBytesRecv": "{{name}} - Byte nhận",
"netBytesSent": "{{name}} - Byte gửi", "netBytesSent": "{{name}} - Byte gửi",
"netNoTraffic": "Capture đang báo cáo lưu lượng bằng không trên mọi giao diện. Điều này là bình thường khi Capture chạy bên trong một container chỉ có thể thấy các giao diện loopback — hãy chạy Capture trực tiếp trên máy chủ để xem hoạt động mạng thực tế.",
"temp": "Nhiệt độ" "temp": "Nhiệt độ"
} }
}, },
@@ -1237,7 +1238,7 @@
}, },
"removeMonitors": { "removeMonitors": {
"title": "Đặt lại hệ thống", "title": "Đặt lại hệ thống",
"description": "Xóa tất cả trình giám sát khỏi hệ thống.", "description": "Xóa tất cả các monitor khỏi hệ thống của bạn.",
"dialog": { "dialog": {
"title": "Xóa tất cả trình giám sát?", "title": "Xóa tất cả trình giám sát?",
"description": "Không thể hoàn tác." "description": "Không thể hoàn tác."
+2 -1
View File
@@ -769,6 +769,7 @@
"memory": "内存使用率", "memory": "内存使用率",
"netBytesRecv": "{{name}} - 接收字节", "netBytesRecv": "{{name}} - 接收字节",
"netBytesSent": "{{name}} - 发送字节", "netBytesSent": "{{name}} - 发送字节",
"netNoTraffic": "Capture 报告所有接口的流量均为零。当 Capture 在只能看到回环接口的容器内运行时,这属于正常情况——请直接在主机上运行 Capture 才能看到真实的网络活动。",
"temp": "温度" "temp": "温度"
} }
}, },
@@ -1237,7 +1238,7 @@
}, },
"removeMonitors": { "removeMonitors": {
"title": "系统重置", "title": "系统重置",
"description": "从系统中移除所有监控。", "description": "从系统中移除所有监视器。",
"dialog": { "dialog": {
"title": "移除所有监控?", "title": "移除所有监控?",
"description": "此操作无法撤销。" "description": "此操作无法撤销。"
+3 -2
View File
@@ -769,6 +769,7 @@
"memory": "記憶體使用率", "memory": "記憶體使用率",
"netBytesRecv": "{{name}} - 接收位元組", "netBytesRecv": "{{name}} - 接收位元組",
"netBytesSent": "{{name}} - 發送位元組", "netBytesSent": "{{name}} - 發送位元組",
"netNoTraffic": "Capture 回報所有介面的流量皆為零。當 Capture 在只能看到回環介面的容器中執行時,這是正常情況——請直接在主機上執行 Capture 才能看到實際的網路活動。",
"temp": "溫度" "temp": "溫度"
} }
}, },
@@ -1236,8 +1237,8 @@
"description": "新增範例監控以供示範用途。" "description": "新增範例監控以供示範用途。"
}, },
"removeMonitors": { "removeMonitors": {
"title": "系統重設", "title": "系統重置",
"description": "從系統中移除所有監控。", "description": "從系統中移除所有監視器。",
"dialog": { "dialog": {
"title": "移除所有監控?", "title": "移除所有監控?",
"description": "此操作無法復原。" "description": "此操作無法復原。"