From 89693556881de3fad631d643453315117ede503e Mon Sep 17 00:00:00 2001 From: Kevin L'Hereec Date: Fri, 17 Jul 2026 16:57:08 +0200 Subject: [PATCH] feat: improve critical reads, device list and modelPaths bug fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - main_state_machine.ts: add to CriticalReadsState GPV: ProvisioningCode (confirm CPE persisted value), UpTime (detect reboots), ManagementServer.URL (verify ACS URL), ConnectionRequestUsername/Password (ensure wake credentials are always available) - Home.vue: add Last Seen column (device.updatedAt) - pages_controller.ts: fix modelPaths bug — was never passed to DeviceDetail, now auto-detected from dataModel and passed as predefined TR-181/TR-098 paths --- app/controllers/pages_controller.ts | 10 +++++++++- app/services/cwmp/main_state_machine.ts | 5 +++++ inertia/pages/Home.vue | 2 ++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/app/controllers/pages_controller.ts b/app/controllers/pages_controller.ts index 88e75a2..b1b96e6 100644 --- a/app/controllers/pages_controller.ts +++ b/app/controllers/pages_controller.ts @@ -31,7 +31,15 @@ export default class PagesController { )[0] const commands = lastProcessed ? [...pending, lastProcessed] : pending - return (inertia as any).render('DeviceDetail', { device, commands }) + // Predefined model paths for the "Get Model" modal + // Detect data model from device properties to suggest the right root + const isTr181 = (device as any).dataModel === 'tr-181' || + (device as any).properties?.some((p: any) => p.name?.startsWith('Device.')) + const modelPaths = isTr181 + ? ['Device.', 'Device.DeviceInfo.', 'Device.IP.', 'Device.WiFi.', 'Device.ManagementServer.', 'Device.Hosts.'] + : ['InternetGatewayDevice.', 'InternetGatewayDevice.DeviceInfo.', 'InternetGatewayDevice.LANDevice.', 'InternetGatewayDevice.WANDevice.', 'InternetGatewayDevice.ManagementServer.'] + + return (inertia as any).render('DeviceDetail', { device, commands, modelPaths }) } async commands({ inertia, request }: HttpContext) { diff --git a/app/services/cwmp/main_state_machine.ts b/app/services/cwmp/main_state_machine.ts index d8dae55..7386853 100644 --- a/app/services/cwmp/main_state_machine.ts +++ b/app/services/cwmp/main_state_machine.ts @@ -226,7 +226,12 @@ class CriticalReadsState extends DeviceState { `${root}.DeviceInfo.HardwareVersion`, `${root}.DeviceInfo.SoftwareVersion`, `${root}.DeviceInfo.ModelName`, + `${root}.DeviceInfo.ProvisioningCode`, + `${root}.DeviceInfo.UpTime`, + `${root}.ManagementServer.URL`, `${root}.ManagementServer.ConnectionRequestURL`, + `${root}.ManagementServer.ConnectionRequestUsername`, + `${root}.ManagementServer.ConnectionRequestPassword`, `${root}.ManagementServer.PeriodicInformInterval`, `${root}.ManagementServer.PeriodicInformEnable`, ] diff --git a/inertia/pages/Home.vue b/inertia/pages/Home.vue index 22cb0b0..0b9015d 100644 --- a/inertia/pages/Home.vue +++ b/inertia/pages/Home.vue @@ -157,6 +157,7 @@ async function deleteSelected() { {{ t('labels.serialNumber') }} {{ t('labels.externalIP') }} {{ t('labels.softwareVersion') }} + {{ t('labels.lastSeen') }} @@ -185,6 +186,7 @@ async function deleteSelected() { {{ device.deviceId?.serialNumber }} {{ getIpAddress(device.parameters, device.properties) }} {{ getPropertyValue(device.properties, 'InternetGatewayDevice.DeviceInfo.SoftwareVersion') || getPropertyValue(device.properties, 'Device.DeviceInfo.SoftwareVersion') || '—' }} + {{ device.updatedAt ? new Date(device.updatedAt).toLocaleString() : '—' }}