mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
Column order bogfix in network
This commit is contained in:
@@ -454,10 +454,10 @@
|
||||
<script src="js/pialert_common.js"></script>
|
||||
|
||||
<script>
|
||||
$.get('php/server/devices.php?action=getDevicesList&status=all', function(data) {
|
||||
$.get('php/server/devices.php?action=getDevicesList&status=all&forceDefaultOrder', function(data) {
|
||||
|
||||
rawData = JSON.parse (data)
|
||||
// console.log(rawData)
|
||||
console.log(rawData)
|
||||
|
||||
devicesListnew = rawData["data"].map(item => { return {
|
||||
"name":item[0],
|
||||
@@ -469,7 +469,9 @@
|
||||
"status":item[10]
|
||||
}})
|
||||
|
||||
setCache('devicesList', JSON.stringify(devicesListnew))
|
||||
setCache('devicesListNew', JSON.stringify(devicesListnew))
|
||||
|
||||
console.log(devicesListnew)
|
||||
|
||||
// create tree
|
||||
initTree(getHierarchy());
|
||||
@@ -488,7 +490,7 @@
|
||||
function getDevicesList()
|
||||
{
|
||||
// Read cache
|
||||
devicesList = getCache('devicesList');
|
||||
devicesList = getCache('devicesListNew');
|
||||
|
||||
if (devicesList != '') {
|
||||
devicesList = JSON.parse (devicesList);
|
||||
|
||||
@@ -569,6 +569,13 @@ function getDevicesTotals() {
|
||||
function getDevicesList() {
|
||||
global $db;
|
||||
|
||||
$forceDefaultOrder = FALSE;
|
||||
|
||||
if (isset ($_REQUEST['forceDefaultOrder']) )
|
||||
{
|
||||
$forceDefaultOrder = TRUE;
|
||||
}
|
||||
|
||||
// This object is used to map from the old order ( second parameter, first number) to the 3rd parameter (Second number (here initialized to -1))
|
||||
$columnOrderMapping = array(
|
||||
array("dev_Name", 0, 0),
|
||||
@@ -588,19 +595,22 @@ function getDevicesList() {
|
||||
array("dev_Network_Node_MAC_ADDR", 14, 14)
|
||||
);
|
||||
|
||||
// get device columns order
|
||||
$sql = 'SELECT par_Value FROM Parameters where par_ID = "Front_Devices_Columns_Order"';
|
||||
$result = $db->query($sql);
|
||||
$row = $result -> fetchArray (SQLITE3_NUM);
|
||||
|
||||
if($row != NULL && count($row) == 1)
|
||||
if($forceDefaultOrder == FALSE)
|
||||
{
|
||||
// ordered columns setting from the maintenance page
|
||||
$orderedColumns = createArray($row[0]);
|
||||
// get device columns order
|
||||
$sql = 'SELECT par_Value FROM Parameters where par_ID = "Front_Devices_Columns_Order"';
|
||||
$result = $db->query($sql);
|
||||
$row = $result -> fetchArray (SQLITE3_NUM);
|
||||
|
||||
// init ordered columns
|
||||
for($i = 0; $i < count($orderedColumns); $i++) {
|
||||
$columnOrderMapping[$i][2] = $orderedColumns[$i];
|
||||
if($row != NULL && count($row) == 1)
|
||||
{
|
||||
// ordered columns setting from the maintenance page
|
||||
$orderedColumns = createArray($row[0]);
|
||||
|
||||
// init ordered columns
|
||||
for($i = 0; $i < count($orderedColumns); $i++) {
|
||||
$columnOrderMapping[$i][2] = $orderedColumns[$i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user