sysinfo improvements

This commit is contained in:
Jokob-sk
2024-03-16 09:42:21 +11:00
parent 06a1fa3512
commit a99dbaef78
13 changed files with 857 additions and 765 deletions

View File

@@ -26,12 +26,16 @@ var settingsJSON = {}
function getCache(key, noCookie = false)
{
// check cache
if(localStorage.getItem(key))
cachedValue = localStorage.getItem(key)
console.log(cachedValue);
if(cachedValue)
{
// check if not expired
if(noCookie || getCookie(key + '_session_expiry') != "")
{
return localStorage.getItem(key);
return cachedValue;
}
}
@@ -861,7 +865,7 @@ function initDeviceListAll_JSON()
$.get('api/table_devices.json', function(data) {
// console.log(data)
console.log(data)
devicesListAll_JSON = data["data"]
@@ -875,6 +879,8 @@ function initDeviceListAll_JSON()
}
setCache('devicesListAll_JSON', devicesListAll_JSON_str)
console.log(getCache('devicesListAll_JSON'))
}).then(() => handleSuccess('initDeviceListAll_JSON')).catch(() => handleFailure('initDeviceListAll_JSON')); // handle AJAX synchronization
}

View File

@@ -15,10 +15,12 @@ function initDeviceSelectors() {
console.log(devicesList)
// Retrieve device list from session variable
var devicesListAll_JSON = sessionStorage.getItem('devicesListAll_JSON');
var devicesListAll_JSON = getCache('devicesListAll_JSON');
var devicesList = JSON.parse(devicesListAll_JSON);
console.log(devicesList);
// Check if both device list exists
if (devicesListAll_JSON) {
@@ -71,7 +73,7 @@ function initDeviceSelectors() {
}
}, 100);
}, 10);
}