diff --git a/back/pialert.py b/back/pialert.py index 8995406f..ff263bb2 100755 --- a/back/pialert.py +++ b/back/pialert.py @@ -452,7 +452,7 @@ def importConfig (): closeDB() #------------------------------------------------------------------------------- -importConfig() +# importConfig() #=============================================================================== # USER CONFIG VARIABLES - END @@ -1562,6 +1562,7 @@ def resolve_device_name (pMAC, pIP): # Check MAC parameter mac = pMACstr.replace (':','') + # file_print( ">>>>>> DIG >>>>>") if len(pMACstr) != 17 or len(mac) != 12 : return -2 @@ -1569,6 +1570,7 @@ def resolve_device_name (pMAC, pIP): # file_print(pMAC, pIP) # Resolve name with DIG + # file_print( ">>>>>> DIG1 >>>>>") dig_args = ['dig', '+short', '-x', pIP] # Execute command @@ -1580,6 +1582,8 @@ def resolve_device_name (pMAC, pIP): file_print(e.output) newName = "Error - check logs" + # file_print( ">>>>>> DIG2 >>>>> Name", newName) + # Check returns newName = newName.strip() if len(newName) == 0 : @@ -2554,11 +2558,12 @@ def upgradeDB (): AND name='Settings'; """).fetchone() == None - # Re-creating Settings table - # if settingsMissing: + # Re-creating Settings table file_print("[upgradeDB] Re-creating Settings table") - sql.execute("DROP TABLE Settings;") + if settingsMissing == False: + sql.execute("DROP TABLE Settings;") + sql.execute(""" CREATE TABLE "Settings" ( "Code_Name" TEXT, diff --git a/front/css/pialert.css b/front/css/pialert.css index cf0b8fb9..a89f0eca 100755 --- a/front/css/pialert.css +++ b/front/css/pialert.css @@ -692,3 +692,9 @@ height: 50px; width: auto } + +/* Devices */ +.drp-edit +{ + cursor: pointer; +} \ No newline at end of file diff --git a/front/deviceDetails.php b/front/deviceDetails.php index 2112695c..7181f21b 100755 --- a/front/deviceDetails.php +++ b/front/deviceDetails.php @@ -166,9 +166,10 @@ if ($_REQUEST['mac'] == 'Internet') { $DevDetail_Tap_temp = "Tools"; } else { $D
+
+
@@ -182,14 +183,12 @@ if ($_REQUEST['mac'] == 'Internet') { $DevDetail_Tap_temp = "Tools"; } else { $D
@@ -218,16 +217,12 @@ if ($_REQUEST['mac'] == 'Internet') { $DevDetail_Tap_temp = "Tools"; } else { $D
@@ -240,17 +235,12 @@ if ($_REQUEST['mac'] == 'Internet') { $DevDetail_Tap_temp = "Tools"; } else { $D
@@ -357,9 +347,8 @@ if ($_REQUEST['mac'] == 'Internet') { $DevDetail_Tap_temp = "Tools"; } else { $D
@@ -831,7 +820,7 @@ function initializeCombos () { // Initialize static combos initializeComboSkipRepeated (); } - +// ----------------------------------------------------------------------------- function initializeCombo (dropdownId, queryAction, txtDataField, useCache) { // check if we have the value cached already @@ -873,7 +862,15 @@ function initializeCombo (dropdownId, queryAction, txtDataField, useCache) { writeDropdownHtml(dropdownId, dropdownHtmlContent) } } +// ----------------------------------------------------------------------------- +// Edit dropdown value +function editDrp(dropdownId) +{ + $('#'+dropdownId).focus(); +} + +// ----------------------------------------------------------------------------- // write out the HTML for the dropdown function writeDropdownHtml(dropdownId, dropdownHtmlContent) { @@ -885,7 +882,7 @@ function writeDropdownHtml(dropdownId, dropdownHtmlContent) HTMLelement.innerHTML = '' HTMLelement.innerHTML += dropdownHtmlContent; } - +// ----------------------------------------------------------------------------- function getCache(key) { // check cache @@ -897,12 +894,12 @@ function getCache(key) return ""; } } - +// ----------------------------------------------------------------------------- function setCache(key, data) { sessionStorage.setItem(key, data); } - +// ----------------------------------------------------------------------------- function initializeComboSkipRepeated () { // find dropdown menu element @@ -918,6 +915,8 @@ function initializeComboSkipRepeated () { }); } +// ----------------------------------------------------------------------------- + function findSkipRepeated (value='0') { var itemSelected = skipRepeatedItems[0]; @@ -1286,7 +1285,7 @@ function getDeviceData (readAllData=false) { $('#txtStatus').val (deviceData['dev_Status'].replace('-', '')); if (deviceData['dev_StaticIP'] == 1) {$('#chkStaticIP').iCheck('check');} else {$('#chkStaticIP').iCheck('uncheck');} - $('#txtScanCycle').val (deviceData['dev_ScanCycle'] +' min'); + $('#txtScanCycle').val (deviceData['dev_ScanCycle'] == "1" ? "yes" : "no"); if (deviceData['dev_AlertEvents'] == 1) {$('#chkAlertEvents').iCheck('check');} else {$('#chkAlertEvents').iCheck('uncheck');} if (deviceData['dev_AlertDeviceDown'] == 1) {$('#chkAlertDown').iCheck('check');} else {$('#chkAlertDown').iCheck('uncheck');} $('#txtSkipRepeated').val (findSkipRepeated (deviceData['dev_SkipRepeated'])); @@ -1390,7 +1389,7 @@ function setDeviceData (refreshCallback='') { + '&networknode=' + $('#txtNetworkNodeMac').val() + '&networknodeport=' + $('#txtNetworkPort').val() + '&staticIP=' + ($('#chkStaticIP')[0].checked * 1) - + '&scancycle=' + $('#txtScanCycle').val().split(' ')[0] + + '&scancycle=' + ($('#txtScanCycle').val() == "yes" ? "1" : "0") + '&alertevents=' + ($('#chkAlertEvents')[0].checked * 1) + '&alertdown=' + ($('#chkAlertDown')[0].checked * 1) + '&skiprepeated=' + $('#txtSkipRepeated').val().split(' ')[0] @@ -1402,6 +1401,13 @@ function setDeviceData (refreshCallback='') { deactivateSaveRestoreData (); showMessage (msg); + // clear session storage + setCache("#dropdownOwner",""); + setCache("#dropdownDeviceType",""); + setCache("#dropdownGroup",""); + setCache("#dropdownLocation",""); + setCache("#dropdownNetworkNodeMac",""); + // Callback fuction if (typeof refreshCallback == 'function') { refreshCallback(); @@ -1419,7 +1425,7 @@ function askSkipNotifications () { } // When Archived - if ($('#chkArchived')[0].checked && $('#txtScanCycle').val().split(' ')[0] != "0") { + if ($('#chkArchived')[0].checked && $('#txtScanCycle').val() != "no") { // Ask skip notifications showModalDefault ('Device Archived', 'Do you want to skip all notifications for this device?', '', '', 'skipNotifications'); @@ -1434,7 +1440,7 @@ function skipNotifications () { } // Set cycle 0 - $('#txtScanCycle').val ('0 min'); + $('#txtScanCycle').val ('no'); activateSaveRestoreData(); } @@ -1552,4 +1558,9 @@ function setTextValue (textElement, textValue) { activateSaveRestoreData (); } +function addNewDrpItem(textElement) +{ + showModalDefault("Add new item","Enter new item: ","Cancel","OK", "alert"); +} + diff --git a/front/php/templates/header.php b/front/php/templates/header.php index bec70142..df018275 100755 --- a/front/php/templates/header.php +++ b/front/php/templates/header.php @@ -237,23 +237,6 @@ if ($ENABLED_DARKMODE === True) {
  • - diff --git a/front/php/templates/language/de_de.php b/front/php/templates/language/de_de.php index 089649f2..6ec296de 100755 --- a/front/php/templates/language/de_de.php +++ b/front/php/templates/language/de_de.php @@ -183,8 +183,8 @@ $lang['de_de'] = array( 'DevDetail_EveandAl_NewDevice' => 'Neues Gerät', 'DevDetail_EveandAl_Archived' => 'Archivierung', 'DevDetail_EveandAl_RandomMAC' => 'Zufällige MAC', -'DevDetail_EveandAl_ScanCycle_a' => 'Gerät scannen (1 min)', -'DevDetail_EveandAl_ScanCycle_z' => 'Gerät nicht scannen (0 min)', +'DevDetail_EveandAl_ScanCycle_a' => 'Gerät scannen', +'DevDetail_EveandAl_ScanCycle_z' => 'Gerät nicht scannen', 'DevDetail_button_Delete' => 'Lösche Gerät', 'DevDetail_button_Reset' => 'Verwerfen', 'DevDetail_button_Save' => 'Speichern', diff --git a/front/php/templates/language/en_us.php b/front/php/templates/language/en_us.php index f5d540e5..a7bc685e 100755 --- a/front/php/templates/language/en_us.php +++ b/front/php/templates/language/en_us.php @@ -172,15 +172,15 @@ $lang['en_us'] = array( 'DevDetail_SessionInfo_LastIP' => 'Last IP', 'DevDetail_SessionInfo_StaticIP' => 'Static IP', 'DevDetail_EveandAl_Title' => 'Events & Alerts config', -'DevDetail_EveandAl_ScanCycle' => 'Scan Cycle', +'DevDetail_EveandAl_ScanCycle' => 'Scan device', 'DevDetail_EveandAl_AlertAllEvents' => 'Alert All Events', 'DevDetail_EveandAl_AlertDown' => 'Alert Down', 'DevDetail_EveandAl_Skip' => 'Skip repeated notifications during', 'DevDetail_EveandAl_NewDevice' => 'New Device', 'DevDetail_EveandAl_Archived' => 'Archived', 'DevDetail_EveandAl_RandomMAC' => 'Random MAC', -'DevDetail_EveandAl_ScanCycle_a' => 'Scan Device (1 min)', -'DevDetail_EveandAl_ScanCycle_z' => 'Don't Scan Device (0 min)', +'DevDetail_EveandAl_ScanCycle_a' => 'Scan Device', +'DevDetail_EveandAl_ScanCycle_z' => 'Don't Scan Device', 'DevDetail_button_Delete' => 'Delete Device', 'DevDetail_button_DeleteEvents' => 'Delete Events', 'DevDetail_button_DeleteEvents_Warning' => 'Are you sure you want to delete all Events of this device?

    (this will clear the Events history and the Sessions and might help with constant (persistent) notifications)', diff --git a/front/php/templates/language/es_es.php b/front/php/templates/language/es_es.php index 9da2d98a..9e7131a8 100755 --- a/front/php/templates/language/es_es.php +++ b/front/php/templates/language/es_es.php @@ -179,8 +179,8 @@ $lang['es_es'] = array( 'DevDetail_EveandAl_NewDevice' => 'Nuevo dispositivo', 'DevDetail_EveandAl_Archived' => 'Archivada', 'DevDetail_EveandAl_RandomMAC' => 'MAC al azar', -'DevDetail_EveandAl_ScanCycle_a' => 'Escanear Dispositivo (1 min)', -'DevDetail_EveandAl_ScanCycle_z' => 'No Escanear Dispositivo (0 min)', +'DevDetail_EveandAl_ScanCycle_a' => 'Escanear Dispositivo', +'DevDetail_EveandAl_ScanCycle_z' => 'No Escanear Dispositivo', 'DevDetail_button_Delete' => 'Eliminar dispositivo', 'DevDetail_button_Reset' => 'Restablecer cambios', 'DevDetail_button_Save' => 'Guardar',