From 8528617037ad3f4b446b02b76f912c0e101d0a1f Mon Sep 17 00:00:00 2001 From: cproudlock Date: Mon, 13 Jul 2026 14:15:51 -0400 Subject: [PATCH] Network: consolidate into one tabbed hub; subnet devices span all asset types Replaces the two flat "Network Devices" + "View Networks" nav entries with a single "Network" entry opening a tabbed hub: Devices | Networks | VLANs (NetworkHub renders the existing device list, the subnet browse, and the VLAN list; VLANs is now reachable outside Settings). /network -> hub; /networks redirects to the Networks tab; subnet detail stays at /networks/:id. Subnet "Devices on this network" now matches ANY asset whose primary IP falls in the CIDR (PCs, printers, machines, measuring tools - not just network devices), computed on the core Communication + Asset tables; each row links to its typed detail (extension id resolved lazily/guarded per plugin). Fixes the empty list - printers and PCs carry IPs and now appear (e.g. 35 devices on 10.80.92.0/24). Also: subnet-browse search uses the standard form-control styling; dropped the redundant per-tab page header. Co-Authored-By: Claude Opus 4.8 --- frontend/src/router/routes/network.js | 7 +- frontend/src/views/AppLayout.vue | 3 +- frontend/src/views/network/NetworkHub.vue | 72 ++++++++++++++++++++ frontend/src/views/network/SubnetDetail.vue | 17 +++-- frontend/src/views/network/SubnetsBrowse.vue | 6 +- plugins/network/api/routes.py | 54 +++++++++++---- plugins/network/plugin.py | 8 +-- 7 files changed, 129 insertions(+), 38 deletions(-) create mode 100644 frontend/src/views/network/NetworkHub.vue diff --git a/frontend/src/router/routes/network.js b/frontend/src/router/routes/network.js index a7eea5f..c721ac7 100644 --- a/frontend/src/router/routes/network.js +++ b/frontend/src/router/routes/network.js @@ -5,7 +5,7 @@ export default [ { path: 'network', name: 'network', - component: () => import('../../views/network/NetworkDevicesList.vue'), + component: () => import('../../views/network/NetworkHub.vue'), meta: { plugin: 'network' } }, { @@ -27,10 +27,9 @@ export default [ meta: { requiresAuth: true, plugin: 'network' } }, { + // Legacy path -> the Networks tab of the hub. path: 'networks', - name: 'networks', - component: () => import('../../views/network/SubnetsBrowse.vue'), - meta: { plugin: 'network' } + redirect: { path: '/network', query: { tab: 'networks' } } }, { path: 'networks/:id', diff --git a/frontend/src/views/AppLayout.vue b/frontend/src/views/AppLayout.vue index a0427b6..e101527 100644 --- a/frontend/src/views/AppLayout.vue +++ b/frontend/src/views/AppLayout.vue @@ -156,8 +156,7 @@ const defaultNav = [ { name: 'Map', icon: 'map', route: '/map', position: 4 }, { name: 'Machines', icon: 'cog', route: '/machines', position: 10 }, { name: 'PCs', icon: 'desktop', route: '/pcs', position: 15 }, - { name: 'Network Devices', icon: 'network-wired', route: '/network', position: 18 }, - { name: 'View Networks', icon: 'globe', route: '/networks', position: 19 }, + { name: 'Network', icon: 'network-wired', route: '/network', position: 18 }, { name: 'Printers', icon: 'printer', route: '/printers', position: 20 }, { name: 'USB Devices', icon: 'usb', route: '/usb', position: 45 }, { name: 'Applications', icon: 'app-window', route: '/applications', position: 30, section: 'information' }, diff --git a/frontend/src/views/network/NetworkHub.vue b/frontend/src/views/network/NetworkHub.vue new file mode 100644 index 0000000..089900e --- /dev/null +++ b/frontend/src/views/network/NetworkHub.vue @@ -0,0 +1,72 @@ + + + + + diff --git a/frontend/src/views/network/SubnetDetail.vue b/frontend/src/views/network/SubnetDetail.vue index e317b53..6975044 100644 --- a/frontend/src/views/network/SubnetDetail.vue +++ b/frontend/src/views/network/SubnetDetail.vue @@ -37,14 +37,13 @@ DeviceIPType - + - - {{ dev.name || dev.hostname || dev.assetnumber }} - + {{ dev.name || dev.assetnumber }} + {{ dev.name || dev.assetnumber }} {{ dev.ipaddress }} - {{ dev.networkdevicetypename || '-' }} + {{ typeLabel(dev.assettype) }} @@ -67,6 +66,14 @@ const loading = ref(true) const devices = computed(() => subnet.value?.devices || []) +const TYPE_LABELS = { + computer: 'PC', network_device: 'Network Device', printer: 'Printer', + machine: 'Machine', measuring_tool: 'Measuring Tool', +} +function typeLabel(type) { + return TYPE_LABELS[type] || type || '-' +} + async function load() { loading.value = true try { diff --git a/frontend/src/views/network/SubnetsBrowse.vue b/frontend/src/views/network/SubnetsBrowse.vue index 562e6eb..ad2fa4e 100644 --- a/frontend/src/views/network/SubnetsBrowse.vue +++ b/frontend/src/views/network/SubnetsBrowse.vue @@ -1,11 +1,7 @@