Column order bogfix in network
This commit is contained in:
@@ -2840,6 +2840,17 @@ def upgradeDB ():
|
|||||||
AND name='Nmap_Scan';
|
AND name='Nmap_Scan';
|
||||||
""").fetchone() == None
|
""").fetchone() == None
|
||||||
|
|
||||||
|
# Re-creating Parameters table
|
||||||
|
file_print("[upgradeDB] Re-creating Parameters table")
|
||||||
|
sql.execute("DROP TABLE Parameters;")
|
||||||
|
|
||||||
|
sql.execute("""
|
||||||
|
CREATE TABLE "Parameters" (
|
||||||
|
"par_ID" TEXT PRIMARY KEY,
|
||||||
|
"par_Value" TEXT
|
||||||
|
);
|
||||||
|
""")
|
||||||
|
|
||||||
# Initialize Parameters if unavailable
|
# Initialize Parameters if unavailable
|
||||||
initOrSetParam('Back_App_State','Initializing')
|
initOrSetParam('Back_App_State','Initializing')
|
||||||
|
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ services:
|
|||||||
network_mode: "host"
|
network_mode: "host"
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
volumes:
|
volumes:
|
||||||
- ${APP_DATA_LOCATION}/pialert/config2:/home/pi/pialert/config
|
- ${APP_DATA_LOCATION}/pialert/config:/home/pi/pialert/config
|
||||||
# - ${APP_DATA_LOCATION}/pialert/db/pialert.db:/home/pi/pialert/db/pialert.db
|
# - ${APP_DATA_LOCATION}/pialert/db/pialert.db:/home/pi/pialert/db/pialert.db
|
||||||
- ${APP_DATA_LOCATION}/pialert/db2:/home/pi/pialert/db
|
- ${APP_DATA_LOCATION}/pialert/db:/home/pi/pialert/db
|
||||||
# (optional) useful for debugging if you have issues setting up the container
|
# (optional) useful for debugging if you have issues setting up the container
|
||||||
- ${LOGS_LOCATION}:/home/pi/pialert/front/log
|
- ${LOGS_LOCATION}:/home/pi/pialert/front/log
|
||||||
# DELETE START anyone trying to use this file: comment out / delete BELOW lines, they are only for development purposes
|
# DELETE START anyone trying to use this file: comment out / delete BELOW lines, they are only for development purposes
|
||||||
|
|||||||
@@ -454,10 +454,10 @@
|
|||||||
<script src="js/pialert_common.js"></script>
|
<script src="js/pialert_common.js"></script>
|
||||||
|
|
||||||
<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)
|
rawData = JSON.parse (data)
|
||||||
// console.log(rawData)
|
console.log(rawData)
|
||||||
|
|
||||||
devicesListnew = rawData["data"].map(item => { return {
|
devicesListnew = rawData["data"].map(item => { return {
|
||||||
"name":item[0],
|
"name":item[0],
|
||||||
@@ -469,7 +469,9 @@
|
|||||||
"status":item[10]
|
"status":item[10]
|
||||||
}})
|
}})
|
||||||
|
|
||||||
setCache('devicesList', JSON.stringify(devicesListnew))
|
setCache('devicesListNew', JSON.stringify(devicesListnew))
|
||||||
|
|
||||||
|
console.log(devicesListnew)
|
||||||
|
|
||||||
// create tree
|
// create tree
|
||||||
initTree(getHierarchy());
|
initTree(getHierarchy());
|
||||||
@@ -488,7 +490,7 @@
|
|||||||
function getDevicesList()
|
function getDevicesList()
|
||||||
{
|
{
|
||||||
// Read cache
|
// Read cache
|
||||||
devicesList = getCache('devicesList');
|
devicesList = getCache('devicesListNew');
|
||||||
|
|
||||||
if (devicesList != '') {
|
if (devicesList != '') {
|
||||||
devicesList = JSON.parse (devicesList);
|
devicesList = JSON.parse (devicesList);
|
||||||
|
|||||||
@@ -569,6 +569,13 @@ function getDevicesTotals() {
|
|||||||
function getDevicesList() {
|
function getDevicesList() {
|
||||||
global $db;
|
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))
|
// 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(
|
$columnOrderMapping = array(
|
||||||
array("dev_Name", 0, 0),
|
array("dev_Name", 0, 0),
|
||||||
@@ -588,6 +595,8 @@ function getDevicesList() {
|
|||||||
array("dev_Network_Node_MAC_ADDR", 14, 14)
|
array("dev_Network_Node_MAC_ADDR", 14, 14)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if($forceDefaultOrder == FALSE)
|
||||||
|
{
|
||||||
// get device columns order
|
// get device columns order
|
||||||
$sql = 'SELECT par_Value FROM Parameters where par_ID = "Front_Devices_Columns_Order"';
|
$sql = 'SELECT par_Value FROM Parameters where par_ID = "Front_Devices_Columns_Order"';
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
@@ -603,6 +612,7 @@ function getDevicesList() {
|
|||||||
$columnOrderMapping[$i][2] = $orderedColumns[$i];
|
$columnOrderMapping[$i][2] = $orderedColumns[$i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// SQL
|
// SQL
|
||||||
$condition = getDeviceCondition ($_REQUEST['status']);
|
$condition = getDeviceCondition ($_REQUEST['status']);
|
||||||
|
|||||||
Reference in New Issue
Block a user