mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
Empty fields on New Devices selection
This commit is contained in:
@@ -715,12 +715,15 @@ if ($ENABLED_DARKMODE === True) {
|
|||||||
// ------------------------------------------------------------
|
// ------------------------------------------------------------
|
||||||
function getDevicesListValue(idColumn, idValue, returnColumn)
|
function getDevicesListValue(idColumn, idValue, returnColumn)
|
||||||
{
|
{
|
||||||
if(emptyArr.includes(devicesList) || emptyArr.includes(idValue))
|
// Read cache
|
||||||
|
devicesListAll = JSON.parse(getCache('devicesListAll'));
|
||||||
|
|
||||||
|
if(emptyArr.includes(devicesListAll) || emptyArr.includes(idValue))
|
||||||
{
|
{
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
return devicesList.find((item) => {return item[idColumn] == idValue})[returnColumn]
|
return devicesListAll.find((item) => {return item[idColumn] == idValue})[returnColumn]
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------
|
// ------------------------------------------------------------
|
||||||
@@ -741,8 +744,29 @@ if ($ENABLED_DARKMODE === True) {
|
|||||||
|
|
||||||
mac = getMac() // can also be rowID!! not only mac
|
mac = getMac() // can also be rowID!! not only mac
|
||||||
var devicesList = []; // this will contain a list the database row IDs of the devices ordered by the position displayed in the UI
|
var devicesList = []; // this will contain a list the database row IDs of the devices ordered by the position displayed in the UI
|
||||||
|
var devicesListAll = []; // this will contain a list off all devices
|
||||||
|
|
||||||
|
|
||||||
|
$.get('php/server/devices.php?action=getDevicesList&status=all&forceDefaultOrder', function(data) {
|
||||||
|
|
||||||
|
rawData = JSON.parse (data)
|
||||||
|
|
||||||
|
devicesListAll = rawData["data"].map(item => { return {
|
||||||
|
"name":item[0],
|
||||||
|
"type":item[2],
|
||||||
|
"icon":item[3],
|
||||||
|
"mac":item[11],
|
||||||
|
"parentMac":item[14],
|
||||||
|
"rowid":item[13],
|
||||||
|
"status":item[10]
|
||||||
|
}})
|
||||||
|
|
||||||
|
setCache('devicesListAll', JSON.stringify(devicesListAll))
|
||||||
|
|
||||||
|
// Read parameters & Initialize components
|
||||||
|
main();
|
||||||
|
});
|
||||||
|
|
||||||
devicesList = getDevicesList();
|
|
||||||
|
|
||||||
var pos = -1;
|
var pos = -1;
|
||||||
var parPeriod = 'Front_Details_Period';
|
var parPeriod = 'Front_Details_Period';
|
||||||
@@ -759,8 +783,7 @@ if ($ENABLED_DARKMODE === True) {
|
|||||||
var selectedTab = 'tabDetails';
|
var selectedTab = 'tabDetails';
|
||||||
var emptyArr = ['undefined', "", undefined, null];
|
var emptyArr = ['undefined', "", undefined, null];
|
||||||
|
|
||||||
// Read parameters & Initialize components
|
|
||||||
main();
|
|
||||||
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -458,7 +458,6 @@
|
|||||||
$.get('php/server/devices.php?action=getDevicesList&status=all&forceDefaultOrder', function(data) {
|
$.get('php/server/devices.php?action=getDevicesList&status=all&forceDefaultOrder', function(data) {
|
||||||
|
|
||||||
rawData = JSON.parse (data)
|
rawData = JSON.parse (data)
|
||||||
console.log(rawData)
|
|
||||||
|
|
||||||
devicesListnew = rawData["data"].map(item => { return {
|
devicesListnew = rawData["data"].map(item => { return {
|
||||||
"name":item[0],
|
"name":item[0],
|
||||||
@@ -472,8 +471,6 @@
|
|||||||
|
|
||||||
setCache('devicesListNew', JSON.stringify(devicesListnew))
|
setCache('devicesListNew', JSON.stringify(devicesListnew))
|
||||||
|
|
||||||
console.log(devicesListnew)
|
|
||||||
|
|
||||||
// create tree
|
// create tree
|
||||||
initTree(getHierarchy());
|
initTree(getHierarchy());
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user