diff --git a/src/components/standalone/monitoring/InstantTrafficMonitor.vue b/src/components/standalone/monitoring/InstantTrafficMonitor.vue
new file mode 100644
index 000000000..adcd8dac4
--- /dev/null
+++ b/src/components/standalone/monitoring/InstantTrafficMonitor.vue
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/components/standalone/monitoring/TrafficMonitor.vue b/src/components/standalone/monitoring/TrafficMonitor.vue
index 43ab27a1a..7d5a4ec74 100644
--- a/src/components/standalone/monitoring/TrafficMonitor.vue
+++ b/src/components/standalone/monitoring/TrafficMonitor.vue
@@ -7,12 +7,8 @@
import { useI18n } from 'vue-i18n'
import { useTrafficSummary } from '@/composables/useTrafficSummary'
import { NeCard, NeEmptyState, NeHeading, byteFormat1024 } from '@nethesis/vue-components'
-import InstantHostTrafficCard from '@/components/standalone/monitoring/traffic/InstantHostTrafficCard.vue'
import TrafficByHourChart from './TrafficByHourChart.vue'
import SimpleStat from '../../charts/SimpleStat.vue'
-import { useTopTalkers } from '@/composables/useTopTalkers'
-import InstantAppTrafficCard from './traffic/InstantAppTrafficCard.vue'
-import InstantProtocolTrafficCard from './traffic/InstantProtocolTrafficCard.vue'
import BasicPieChart from '@/components/charts/BasicPieChart.vue'
const { t } = useI18n()
@@ -33,15 +29,6 @@ const {
trafficSummaryError,
trafficSummaryErrorDescription
} = useTrafficSummary()
-
-const {
- topApps,
- topHosts,
- topProtocols,
- loadingTopTalkers,
- errorTopTalkers,
- errorTopTalkersDescription
-} = useTopTalkers(20)
@@ -169,36 +156,6 @@ const {
height="25vh"
/>
-
-
-
- {{ t('standalone.real_time_monitor.instant_traffic') }}
-
-
-
-
-
-
-
-
diff --git a/src/components/standalone/monitoring/traffic/InstantAppTrafficCard.vue b/src/components/standalone/monitoring/traffic/InstantAppTrafficCard.vue
index 956e5efd1..f1040d567 100644
--- a/src/components/standalone/monitoring/traffic/InstantAppTrafficCard.vue
+++ b/src/components/standalone/monitoring/traffic/InstantAppTrafficCard.vue
@@ -5,33 +5,43 @@
-
+
+
+
+
+
+
+
+
import {
+ kbpsFormat,
NeCard,
+ NeEmptyState,
+ NePaginator,
NeTable,
+ NeTableBody,
+ NeTableCell,
NeTableHead,
NeTableHeadCell,
- NeTableBody,
NeTableRow,
- NeTableCell,
- NePaginator,
- useItemPagination,
- NeEmptyState
+ NeTextInput,
+ useItemPagination
} from '@nethesis/vue-components'
-import { kbpsFormat } from '@nethesis/vue-components'
-import { ref } from 'vue'
+import { computed, ref } from 'vue'
import { useI18n } from 'vue-i18n'
import { type TopHost } from '@/composables/useTopTalkers'
+import { faSearch } from '@fortawesome/free-solid-svg-icons'
+import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
+import { refDebounced } from '@vueuse/core'
-const props = defineProps<{
+const { topHosts } = defineProps<{
topHosts: TopHost[]
- loading: boolean
- error: string
- errorDescription: string
}>()
const { t } = useI18n()
+const filter = ref('')
+const filterDebounced = refDebounced(filter, 400)
+
+const filteredItems = computed(() => {
+ return topHosts.filter((item) =>
+ item.host.toLowerCase().includes(filterDebounced.value.toLowerCase())
+ )
+})
+
const pageSize = ref(10)
-const { currentPage, paginatedItems } = useItemPagination(() => props.topHosts, {
+const { currentPage, paginatedItems } = useItemPagination(() => filteredItems.value, {
itemsPerPage: pageSize
})
@@ -41,12 +51,14 @@ function formatTraffic(value: number) {
-
+
+
+
+
+
+
+
+
import {
+ kbpsFormat,
NeCard,
+ NeEmptyState,
+ NePaginator,
NeTable,
+ NeTableBody,
+ NeTableCell,
NeTableHead,
NeTableHeadCell,
- NeTableBody,
NeTableRow,
- NeTableCell,
- NePaginator,
- useItemPagination,
- NeEmptyState
+ NeTextInput,
+ useItemPagination
} from '@nethesis/vue-components'
-import { kbpsFormat } from '@nethesis/vue-components'
-import { ref } from 'vue'
+import { computed, ref } from 'vue'
import { useI18n } from 'vue-i18n'
import { type TopItem } from '@/composables/useTopTalkers'
+import { refDebounced } from '@vueuse/core'
+import { faSearch } from '@fortawesome/free-solid-svg-icons'
+import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
-const props = defineProps<{
+const { topProtocols } = defineProps<{
topProtocols: TopItem[]
- loading: boolean
- error: string
- errorDescription: string
}>()
const { t } = useI18n()
+const filter = ref('')
+const filterDebounced = refDebounced(filter, 400)
+
+const filteredItems = computed(() => {
+ return topProtocols.filter((item) =>
+ item.name.toLowerCase().includes(filterDebounced.value.toLowerCase())
+ )
+})
+
const pageSize = ref(10)
-const { currentPage, paginatedItems } = useItemPagination(() => props.topProtocols, {
+const { currentPage, paginatedItems } = useItemPagination(() => filteredItems.value, {
itemsPerPage: pageSize
})
@@ -41,12 +51,14 @@ function formatTraffic(value: number) {
-
+
+
+
+
+
+
+
+
= 20) {
const topHosts = ref([])
const topApps = ref([])
const topProtocols = ref([])
- const loadingTopTalkers = ref(false)
+ const loadingTopTalkers = ref(true)
const errorTopTalkers = ref('')
const errorTopTalkersDescription = ref('')
@@ -55,11 +55,6 @@ export function useTopTalkers(limit: MaybeRefOrGetter = 20) {
errorTopTalkers.value = ''
errorTopTalkersDescription.value = ''
- // show skeleton only the first time
- if (!intervalId.value) {
- loadingTopTalkers.value = true
- }
-
try {
const res = await ubusCall('ns.talkers', 'list', {
limit: toValue(limit)
diff --git a/src/views/standalone/monitoring/RealTimeMonitoringView.vue b/src/views/standalone/monitoring/RealTimeMonitoringView.vue
index f8c001a46..1856b81d4 100644
--- a/src/views/standalone/monitoring/RealTimeMonitoringView.vue
+++ b/src/views/standalone/monitoring/RealTimeMonitoringView.vue
@@ -20,6 +20,7 @@ import SecurityMonitor from '@/components/standalone/monitoring/SecurityMonitor.
import { isStandaloneMode } from '@/lib/config'
import { onMounted, ref } from 'vue'
import { ubusCall } from '@/lib/standalone/ubus'
+import InstantTrafficMonitor from '@/components/standalone/monitoring/InstantTrafficMonitor.vue'
const { t } = useI18n()
@@ -39,6 +40,10 @@ const { tabs, selectedTab } = useTabs([
{
name: 'security',
label: t('standalone.real_time_monitor.security')
+ },
+ {
+ name: 'instant-traffic',
+ label: t('standalone.real_time_monitor.instant_traffic')
}
])
@@ -161,5 +166,6 @@ function openGrafana() {
+