From a0a5410af977bb4e97a9c502cec7b9ad880e47bc Mon Sep 17 00:00:00 2001 From: Jokob-sk Date: Wed, 22 Nov 2023 19:00:52 +1100 Subject: [PATCH] =?UTF-8?q?fix=201=20cycling=20thru=20devices=20=20#509?= =?UTF-8?q?=F0=9F=A9=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- front/deviceDetails.php | 12 +++++++----- front/pluginsCore.php | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/front/deviceDetails.php b/front/deviceDetails.php index af79ee3b..8d77e17c 100755 --- a/front/deviceDetails.php +++ b/front/deviceDetails.php @@ -644,14 +644,15 @@ if ($ENABLED_DARKMODE === True) { // ------------------------------------------------------------ function getDevicesList() { - // Read cache - devicesList = getCache('devicesList'); + // Read cache (skip cookie expiry check) + devicesList = getCache('devicesListAll_JSON', true); if (devicesList != '') { devicesList = JSON.parse (devicesList); } else { devicesList = []; } + return devicesList; } @@ -1283,7 +1284,7 @@ function getDeviceData (readAllData=false) { history.pushState(null, '', newRelativePathQuery); getSessionsPresenceEvents(); - devicesList = getDevicesList(); + devicesList = getDevicesList(); $('#txtMAC').val (deviceData['dev_MAC']); $('#txtName').val (deviceData['dev_Name']); @@ -1324,7 +1325,8 @@ function getDeviceData (readAllData=false) { } // Check if device is part of the devicesList - pos = devicesList.findIndex(item => item.rowid == deviceData['rowid']); + pos = devicesList.findIndex(item => item.rowid == deviceData['rowid']); + if (pos == -1) { devicesList.push({"rowid" : deviceData['rowid'], "mac" : deviceData['dev_MAC'], "name": deviceData['dev_Name'], "type": deviceData['dev_DeviceType']}); pos=0; @@ -1398,7 +1400,7 @@ function performSwitch(direction) // get new mac from the devicesList. Don't change to the commented out line below, the mac query string in the URL isn't updated yet! // mac = params.mac; - mac = devicesList[pos].mac.toString(); + mac = devicesList[pos].dev_MAC.toString(); setCache("piaDeviceDetailsMac", mac); diff --git a/front/pluginsCore.php b/front/pluginsCore.php index 53f3459e..9cbd6153 100755 --- a/front/pluginsCore.php +++ b/front/pluginsCore.php @@ -173,7 +173,7 @@ function processColumnValue(dbColumnDef, value, index, type) { for (const option of dbColumnDef.options) { if (option.type === type) { - console.log(option.param) + // console.log(option.param) value = eval(option.param); } }