From ecc098cd78ff88332f36cbf416b8b428cdb5d33d Mon Sep 17 00:00:00 2001 From: Andrea Leardini Date: Thu, 19 Sep 2024 11:02:24 +0200 Subject: [PATCH] feat: monitoring UI (wip) --- public/i18n/en/translation.json | 1 + .../monitoring/ConnectivityMonitor.vue | 48 ++++- .../standalone/monitoring/SecurityMonitor.vue | 3 + .../standalone/monitoring/TrafficMonitor.vue | 2 +- .../monitoring/connectivity/WanEventsCard.vue | 191 +++++++----------- .../security/BlockedIpsPerHourChart.vue | 20 +- .../security/BlockedPacketsChart.vue | 17 +- .../monitoring/traffic/RecentTrafficChart.vue | 17 +- 8 files changed, 137 insertions(+), 162 deletions(-) diff --git a/public/i18n/en/translation.json b/public/i18n/en/translation.json index 633e77fa8..ecd053153 100644 --- a/public/i18n/en/translation.json +++ b/public/i18n/en/translation.json @@ -1807,6 +1807,7 @@ "host_traffic": "Host traffic", "host": "Host", "connections": "Connections", + "wan_events": "WAN events", "wan_name_events": "{name} events", "wan_name_traffic": "{name} traffic", "blocked_threats": "Blocked threats", diff --git a/src/components/standalone/monitoring/ConnectivityMonitor.vue b/src/components/standalone/monitoring/ConnectivityMonitor.vue index af25a6aba..91e160c6f 100644 --- a/src/components/standalone/monitoring/ConnectivityMonitor.vue +++ b/src/components/standalone/monitoring/ConnectivityMonitor.vue @@ -5,21 +5,32 @@ + + diff --git a/src/components/standalone/monitoring/security/BlockedIpsPerHourChart.vue b/src/components/standalone/monitoring/security/BlockedIpsPerHourChart.vue index 37304b555..f259bcf4e 100644 --- a/src/components/standalone/monitoring/security/BlockedIpsPerHourChart.vue +++ b/src/components/standalone/monitoring/security/BlockedIpsPerHourChart.vue @@ -19,24 +19,16 @@ import 'chartjs-adapter-date-fns' import { Line } from 'vue-chartjs' import { computed } from 'vue' import { useThemeStore } from '@/stores/theme' -import { byteFormat1024 } from '@nethesis/vue-components' import { GRAY_200, GRAY_700, GRAY_800 } from '@/lib/color' import { padStart } from 'lodash-es' -//// review - const themeStore = useThemeStore() -const props = defineProps({ - labels: { - type: Array, - required: true - }, - datasets: { - type: Array, - required: true - } -}) +const props = defineProps<{ + labels: string[] + datasets: any[] + height?: string +}>() const options: any = { // turn off animations and data parsing for performance @@ -97,7 +89,7 @@ const chartData: any = computed(() => { const chartStyle = computed(() => { return { - 'max-height': '25vh', + height: props.height || '', width: '100%', position: 'relative' } diff --git a/src/components/standalone/monitoring/security/BlockedPacketsChart.vue b/src/components/standalone/monitoring/security/BlockedPacketsChart.vue index 3b28c78f9..cdeabb906 100644 --- a/src/components/standalone/monitoring/security/BlockedPacketsChart.vue +++ b/src/components/standalone/monitoring/security/BlockedPacketsChart.vue @@ -24,16 +24,11 @@ import { padStart } from 'lodash-es' const themeStore = useThemeStore() -const props = defineProps({ - labels: { - type: Array, - required: true - }, - datasets: { - type: Array, - required: true - } -}) +const props = defineProps<{ + labels: number[] + datasets: any[] + height?: string +}>() const options: any = { // turn off animations and data parsing for performance @@ -106,7 +101,7 @@ const chartData: any = computed(() => { const chartStyle = computed(() => { return { - 'max-height': '25vh', + height: props.height || '', width: '100%', position: 'relative' } diff --git a/src/components/standalone/monitoring/traffic/RecentTrafficChart.vue b/src/components/standalone/monitoring/traffic/RecentTrafficChart.vue index f701bfaa4..5f72546f1 100644 --- a/src/components/standalone/monitoring/traffic/RecentTrafficChart.vue +++ b/src/components/standalone/monitoring/traffic/RecentTrafficChart.vue @@ -25,16 +25,11 @@ import { padStart } from 'lodash-es' const themeStore = useThemeStore() -const props = defineProps({ - labels: { - type: Array, - required: true - }, - datasets: { - type: Array, - required: true - } -}) +const props = defineProps<{ + labels: string[] + datasets: any[] + height?: string +}>() const options: any = { // turn off animations and data parsing for performance @@ -111,7 +106,7 @@ const chartData: any = computed(() => { const chartStyle = computed(() => { return { - 'max-height': '25vh', + height: props.height || '', width: '100%', position: 'relative' }