diff --git a/src/components/standalone/monitoring/connectivity/WanConnectionsCard.vue b/src/components/standalone/monitoring/connectivity/WanConnectionsCard.vue index fa1f9e838..77325b750 100644 --- a/src/components/standalone/monitoring/connectivity/WanConnectionsCard.vue +++ b/src/components/standalone/monitoring/connectivity/WanConnectionsCard.vue @@ -13,11 +13,16 @@ import { NeTableRow, NeTableCell, NePaginator, - useItemPagination + useItemPagination, + getAxiosErrorMessage, + NeInlineNotification, + NeSkeleton } from '@nethesis/vue-components' -import { ref } from 'vue' +import { onMounted, ref } from 'vue' import { useI18n } from 'vue-i18n' import type { Wan } from '../ConnectivityMonitor.vue' +import type { QoSInterface } from '@/views/standalone/network/QoSView.vue' +import { ubusCall } from '@/lib/standalone/ubus' const props = defineProps<{ wanConnections: Wan[] @@ -29,16 +34,64 @@ const pageSize = ref(5) const { currentPage, paginatedItems } = useItemPagination(() => props.wanConnections, { itemsPerPage: pageSize }) +const qosData = ref([]) + +const loading = ref({ + listQos: false +}) + +const error = ref({ + listQos: '', + listQosDetails: '' +}) + +onMounted(() => { + listQos() +}) + +async function listQos() { + loading.value.listQos = true + error.value.listQos = '' + error.value.listQosDetails = '' + + try { + const res = await ubusCall('ns.qos', 'list') + qosData.value = res.data.rules + } catch (err: any) { + error.value.listQos = t(getAxiosErrorMessage(err)) + error.value.listQosDetails = err.toString() + } finally { + loading.value.listQos = false + } +} + +function getQosRule(item: Wan) { + return qosData.value.find((qosRule) => qosRule.interface === item.iface) +}