Add cur_ScanMethod & fix Plugins display name in lists

This commit is contained in:
Jokob-sk
2023-09-06 22:03:28 +10:00
parent cd43935656
commit 8676b7ccde
10 changed files with 123 additions and 41 deletions

View File

@@ -795,27 +795,7 @@ if ($ENABLED_DARKMODE === True) {
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();
});
var pos = -1;
var parPeriod = 'Front_Details_Period';
@@ -834,7 +814,6 @@ if ($ENABLED_DARKMODE === True) {
// -----------------------------------------------------------------------------
function main () {
// Initialize MAC

View File

@@ -506,6 +506,32 @@ function getNameByMacAddress(macAddress) {
return "Unknown"; // Return a default value if MAC address is not found
}
// -----------------------------------------------------------------------------
function initDeviceListAll()
{
$.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))
});
}
var devicesListAll = []; // this will contain a list off all devices
// -----------------------------------------------------------------------------
function isEmpty(value)
{
@@ -515,6 +541,7 @@ function isEmpty(value)
// initialize
cacheSettings()
cacheStrings()
initDeviceListAll()
console.log("init pialert_common.js")

View File

@@ -267,8 +267,11 @@
}]
} ,
{
"column": "Extra",
"column": "Dummy",
"mapped_to_column": "cur_ScanMethod",
"mapped_to_column_data": {
"value": "arp-scan"
},
"css_classes": "col-sm-2",
"show": true,
"type": "label",
@@ -281,7 +284,7 @@
},
{
"language_code":"es_es",
"string" : "Método de escaneado"
"string" : "Método de escaneo"
}]
} ,
{

View File

@@ -5,6 +5,7 @@ import pathlib
import subprocess
import argparse
import os
import sys
sys.path.append("/home/pi/pialert/front/plugins")
sys.path.append('/home/pi/pialert/pialert')

View File

@@ -3,6 +3,12 @@
import subprocess
from datetime import datetime
import sys
sys.path.append("/home/pi/pialert/front/plugins")
sys.path.append('/home/pi/pialert/pialert')
from plugin_helper import Plugin_Objects, Plugin_Object
from logger import mylog

View File

@@ -266,8 +266,11 @@
}]
},
{
"column": "Extra",
"column": "Dummy",
"mapped_to_column": "cur_ScanMethod",
"mapped_to_column_data": {
"value": "PIHOLE"
},
"css_classes": "col-sm-2",
"show": true,
"type": "label",

View File

@@ -247,6 +247,27 @@
"string" : "salida RAW"
}]
},
{
"column": "Dummy",
"mapped_to_column": "cur_ScanMethod",
"mapped_to_column_data": {
"value": "SNMPDSC"
},
"css_classes": "col-sm-2",
"show": true,
"type": "label",
"default_value":"",
"options": [],
"localized": ["name"],
"name":[{
"language_code":"en_us",
"string" : "Scan method"
},
{
"language_code":"es_es",
"string" : "Método de escaneo"
}]
} ,
{
"column": "Status",
"css_classes": "col-sm-1",

View File

@@ -79,7 +79,7 @@ def main():
plugin_objects.add_object(
primaryId=macAddress,
secondaryId=ipAddress,
secondaryId=ipAddress.strip(), # Remove leading/trailing spaces from IP
watched1='(unknown)',
watched2=snmpwalkArgs[6], # router IP
extra=line,

View File

@@ -292,6 +292,27 @@
"string" : "Cambiado"
}]
},
{
"column": "Dummy",
"mapped_to_column": "cur_ScanMethod",
"mapped_to_column_data": {
"value": "UNDIS"
},
"css_classes": "col-sm-2",
"show": true,
"type": "label",
"default_value":"",
"options": [],
"localized": ["name"],
"name":[{
"language_code":"en_us",
"string" : "Scan method"
},
{
"language_code":"es_es",
"string" : "Método de escaneo"
}]
} ,
{
"column": "ForeignKey",
"css_classes": "col-sm-2",

View File

@@ -319,6 +319,27 @@
"string" : "Kommentar"
}]
},
{
"column": "Dummy",
"mapped_to_column": "cur_ScanMethod",
"mapped_to_column_data": {
"value": "UNFIMP"
},
"css_classes": "col-sm-2",
"show": true,
"type": "label",
"default_value":"",
"options": [],
"localized": ["name"],
"name":[{
"language_code":"en_us",
"string" : "Scan method"
},
{
"language_code":"es_es",
"string" : "Método de escaneo"
}]
} ,
{
"column": "Extra",
"css_classes": "col-sm-3",