mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
Ignored IPs not applied #836
This commit is contained in:
@@ -124,6 +124,21 @@
|
||||
border: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
|
||||
.hideOnBigScreen{
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 767px) { /* on mobile */
|
||||
|
||||
.hideOnMobile{
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
Main Sections
|
||||
----------------------------------------------------------------------------- */
|
||||
@@ -781,20 +796,20 @@ height: 50px;
|
||||
/* settings */
|
||||
/* --------------------------------------------------------- */
|
||||
|
||||
@media (max-width: 767px) {
|
||||
@media (max-width: 767px) { /* on mobile */
|
||||
/* hide on mobile */
|
||||
.setting_description {
|
||||
/* color: red; */
|
||||
display: none;
|
||||
}
|
||||
.setting_input{
|
||||
/* .setting_input{
|
||||
width:70%;
|
||||
/* background-color: red; */
|
||||
|
||||
}
|
||||
.setting_name
|
||||
{
|
||||
width:30%;
|
||||
}
|
||||
} */
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
@@ -802,14 +817,14 @@ height: 50px;
|
||||
/* color: green; */
|
||||
display: block;
|
||||
}
|
||||
.setting_input{
|
||||
/* .setting_input{
|
||||
width:40%;
|
||||
/* background-color: green; */
|
||||
|
||||
}
|
||||
.setting_name
|
||||
{
|
||||
width:19%;
|
||||
}
|
||||
} */
|
||||
}
|
||||
|
||||
.settingswrap
|
||||
@@ -874,10 +889,10 @@ height: 50px;
|
||||
}
|
||||
|
||||
|
||||
.table_row {
|
||||
#settingsPage .table_row {
|
||||
padding: 3px;
|
||||
width:100%;
|
||||
display: flex;
|
||||
/* width:100%; */
|
||||
/* display: flex; */
|
||||
border-bottom-width: 1px;
|
||||
border-bottom-style: solid;
|
||||
border-color: #606060;
|
||||
@@ -897,10 +912,6 @@ height: 50px;
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
.setting_description
|
||||
{
|
||||
width:40%;
|
||||
}
|
||||
|
||||
.myhidden
|
||||
{
|
||||
|
||||
@@ -512,6 +512,17 @@ function toggleMetadata(element) {
|
||||
$(`#${id}`).toggle();
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Show setting description in a modal on smaller screens
|
||||
// -----------------------------------------------------------------------------
|
||||
function showDescription(element) {
|
||||
const id = $(element).attr("my-to-show");
|
||||
|
||||
description = $(`${id}`)[0].innerHTML
|
||||
console.log(description);
|
||||
showModalOK(getString("Gen_Description"), description);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// Helper methods
|
||||
// ---------------------------------------------------------
|
||||
|
||||
@@ -281,6 +281,7 @@
|
||||
"Gen_DataUpdatedUITakesTime": "",
|
||||
"Gen_Delete": "",
|
||||
"Gen_DeleteAll": "",
|
||||
"Gen_Description": "",
|
||||
"Gen_Error": "",
|
||||
"Gen_Filter": "",
|
||||
"Gen_LockedDB": "",
|
||||
@@ -567,6 +568,7 @@
|
||||
"Setting_Override": "",
|
||||
"Setting_Override_Description": "",
|
||||
"Settings_Metadata_Toggle": "",
|
||||
"Settings_Show_Description": "",
|
||||
"Settings_device_Scanners_desync": "",
|
||||
"Settings_device_Scanners_desync_popup": "",
|
||||
"Speedtest_Results": "",
|
||||
|
||||
@@ -281,6 +281,7 @@
|
||||
"Gen_DataUpdatedUITakesTime": "",
|
||||
"Gen_Delete": "",
|
||||
"Gen_DeleteAll": "",
|
||||
"Gen_Description": "",
|
||||
"Gen_Error": "",
|
||||
"Gen_Filter": "",
|
||||
"Gen_LockedDB": "",
|
||||
@@ -567,6 +568,7 @@
|
||||
"Setting_Override": "",
|
||||
"Setting_Override_Description": "",
|
||||
"Settings_Metadata_Toggle": "",
|
||||
"Settings_Show_Description": "",
|
||||
"Settings_device_Scanners_desync": "",
|
||||
"Settings_device_Scanners_desync_popup": "",
|
||||
"Speedtest_Results": "",
|
||||
|
||||
@@ -293,6 +293,7 @@
|
||||
"Gen_DataUpdatedUITakesTime": "OK – Es kann einen Moment dauern, bis die Benutzeroberfläche aktualisiert wird, während ein Scan ausgeführt wird.",
|
||||
"Gen_Delete": "Löschen",
|
||||
"Gen_DeleteAll": "Delete all",
|
||||
"Gen_Description": "",
|
||||
"Gen_Error": "Fehler",
|
||||
"Gen_Filter": "Filter",
|
||||
"Gen_LockedDB": "ERROR - DB eventuell gesperrt - Nutze die Konsole in den Entwickler Werkzeugen (F12) zur Überprüfung oder probiere es später erneut.",
|
||||
@@ -636,6 +637,7 @@
|
||||
"Setting_Override": "Override value",
|
||||
"Setting_Override_Description": "Enabling this option will override an App supplied default value with the value specified above.",
|
||||
"Settings_Metadata_Toggle": "Show/hide metadata for the given setting.",
|
||||
"Settings_Show_Description": "",
|
||||
"Settings_device_Scanners_desync": "⚠ Die Zeitpläne des Gerätescanners sind nicht synchronisiert.",
|
||||
"Settings_device_Scanners_desync_popup": "",
|
||||
"Speedtest_Results": "Ergebnisse des Geschwindigkeitstests",
|
||||
|
||||
@@ -281,6 +281,7 @@
|
||||
"Gen_DataUpdatedUITakesTime": "OK - It may take a while for the UI to update if a scan is running.",
|
||||
"Gen_Delete": "Delete",
|
||||
"Gen_DeleteAll": "Delete all",
|
||||
"Gen_Description": "Description",
|
||||
"Gen_Error": "Error",
|
||||
"Gen_Filter": "Filter",
|
||||
"Gen_LockedDB": "ERROR - DB might be locked - Check F12 Dev tools -> Console or try later.",
|
||||
@@ -567,6 +568,7 @@
|
||||
"Setting_Override": "Override value",
|
||||
"Setting_Override_Description": "Enabling this option will override an App supplied default value with the value specified above.",
|
||||
"Settings_Metadata_Toggle": "Show/hide metadata for the given setting.",
|
||||
"Settings_Show_Description": "Show setting description.",
|
||||
"Settings_device_Scanners_desync": "⚠ Device scanner schedules are out-of-sync.",
|
||||
"Settings_device_Scanners_desync_popup": "Schedules of devices scanners (<code>*_RUN_SCHD</code>) are not the same. This will result into inconsistent device online/offline notifications. Unless this is intended, please use the same schedule for all enabled <b>🔍Device scanners</b>.",
|
||||
"Speedtest_Results": "Speedtest Results",
|
||||
|
||||
@@ -291,6 +291,7 @@
|
||||
"Gen_DataUpdatedUITakesTime": "Correcto - La interfaz puede tardar en actualizarse si se está ejecutando un escaneo.",
|
||||
"Gen_Delete": "Eliminar",
|
||||
"Gen_DeleteAll": "Eliminar todo",
|
||||
"Gen_Description": "",
|
||||
"Gen_Error": "Error",
|
||||
"Gen_Filter": "Filtro",
|
||||
"Gen_LockedDB": "Fallo - La base de datos puede estar bloqueada - Pulsa F1 -> Ajustes de desarrolladores -> Consola o prueba más tarde.",
|
||||
@@ -634,6 +635,7 @@
|
||||
"Setting_Override": "Sobreescribir el valor",
|
||||
"Setting_Override_Description": "Habilitar esta opción anulará un valor predeterminado proporcionado por la aplicación con el valor especificado anteriormente.",
|
||||
"Settings_Metadata_Toggle": "Mostrar/ocultar los metadatos de la configuración.",
|
||||
"Settings_Show_Description": "",
|
||||
"Settings_Title": "<i class=\"fa fa-cog\"> Configuración</i>",
|
||||
"Settings_device_Scanners_desync": "⚠ Los horarios del escáner de los dispositivos no están sincronizados.",
|
||||
"Settings_device_Scanners_desync_popup": "Los horarios de escáneres de dispositivos (<code> *_RUN_SCHD</code> ) no son lo mismo. Esto resultará en notificaciones inconsistentes del dispositivo en línea/fuera de línea. A menos que sea así, utilice el mismo horario para todos los habilitados.<b> 🔍Escáneres de dispositivos</b> .",
|
||||
|
||||
@@ -281,6 +281,7 @@
|
||||
"Gen_DataUpdatedUITakesTime": "OK - cela peut prendre du temps à l'interface pour se mettre à jour si un scan est en cours.",
|
||||
"Gen_Delete": "Supprimer",
|
||||
"Gen_DeleteAll": "Supprimer tous",
|
||||
"Gen_Description": "",
|
||||
"Gen_Error": "Erreur",
|
||||
"Gen_Filter": "Filtrer",
|
||||
"Gen_LockedDB": "Erreur - La base de données est peut-être verrouillée - Vérifier avec les outils de dév via F12 -> Console ou essayer plus tard.",
|
||||
@@ -567,6 +568,7 @@
|
||||
"Setting_Override": "Remplacer la valeur",
|
||||
"Setting_Override_Description": "Activer cette option va remplacer la valeur fournie par défaut par une application par la valeur renseignée au-dessus.",
|
||||
"Settings_Metadata_Toggle": "Afficher/masquer les méta données pour le paramètre sélectionné.",
|
||||
"Settings_Show_Description": "",
|
||||
"Settings_device_Scanners_desync": "⚠ La planification des différents scanners d'appareils est désynchronisée.",
|
||||
"Settings_device_Scanners_desync_popup": "La planification des scanners (<code>*_RUN_SCHD</code>) n'est pas identique entre scanners. Cela va entraîner des notifications en ligne/hors-ligne non cohérentes. À moins que cela soit attendu, utilisez la même planification pour tous les <b>🔍scanners d'appareils</b> activés.",
|
||||
"Speedtest_Results": "Résultats du test de débit",
|
||||
|
||||
@@ -281,6 +281,7 @@
|
||||
"Gen_DataUpdatedUITakesTime": "OK: l'aggiornamento dell'interfaccia utente potrebbe richiedere del tempo se è in esecuzione una scansione.",
|
||||
"Gen_Delete": "Elimina",
|
||||
"Gen_DeleteAll": "Elimina tutti",
|
||||
"Gen_Description": "",
|
||||
"Gen_Error": "Errore",
|
||||
"Gen_Filter": "Filtro",
|
||||
"Gen_LockedDB": "ERRORE: il DB potrebbe essere bloccato, controlla F12 Strumenti di sviluppo -> Console o riprova più tardi.",
|
||||
@@ -567,6 +568,7 @@
|
||||
"Setting_Override": "Sovrascrivi valore",
|
||||
"Setting_Override_Description": "L'abilitazione di questa opzione sovrascriverà il valore predefinito fornito dall'app con il valore specificato sopra.",
|
||||
"Settings_Metadata_Toggle": "Mostra/nascondi i metadati per l'impostazione specificata.",
|
||||
"Settings_Show_Description": "",
|
||||
"Settings_device_Scanners_desync": "⚠ Le pianificazioni dello scanner del dispositivo non sono sincronizzate.",
|
||||
"Settings_device_Scanners_desync_popup": "Gli orari degli scanner dei dispositivi (<code>*_RUN_SCHD</code>) non sono gli stessi. Questo comporterà notifiche online/offline incoerenti del dispositivo. A meno che ciò non sia previsto, utilizza la stessa pianificazione per tutti gli <b>🔍Scanner dispositivi</b> abilitati.",
|
||||
"Speedtest_Results": "Risultati test di velocità",
|
||||
|
||||
@@ -281,6 +281,7 @@
|
||||
"Gen_DataUpdatedUITakesTime": "OK - Det kan ta litt tid før brukergrensesnittet oppdateres hvis en skanning kjøres.",
|
||||
"Gen_Delete": "Slett",
|
||||
"Gen_DeleteAll": "Slett alle",
|
||||
"Gen_Description": "",
|
||||
"Gen_Error": "Feil",
|
||||
"Gen_Filter": "Filter",
|
||||
"Gen_LockedDB": "FEIL - DB kan være låst - Sjekk F12 Dev tools -> Konsoll eller prøv senere.",
|
||||
@@ -567,6 +568,7 @@
|
||||
"Setting_Override": "Overstyr verdi",
|
||||
"Setting_Override_Description": "Aktivering av dette alternativet vil overstyre en App som leveres standard-verdi med verdien som er spesifisert ovenfor.",
|
||||
"Settings_Metadata_Toggle": "Vis/skjul metadata for den gitte innstillingen.",
|
||||
"Settings_Show_Description": "",
|
||||
"Settings_device_Scanners_desync": "⚠ Enhetsskanning tidsplan er ikke synkronisert lenger.",
|
||||
"Settings_device_Scanners_desync_popup": "Tidsplanene for enhetsskanning (<code>*_RUN_SCHD</code>) er ikke de samme. Dette vil føre til inkonsekvent enhet på online/offline varsler. Med mindre dette er ment, kan du bruke den samme tidsplanen for alle aktiverte <b> 🔍Enhets-skannere</b>.",
|
||||
"Speedtest_Results": "Speedtest resultater",
|
||||
|
||||
@@ -281,6 +281,7 @@
|
||||
"Gen_DataUpdatedUITakesTime": "OK - Aktualizacja UI może chwile potrwać jeżeli wykonywany jest skan.",
|
||||
"Gen_Delete": "Usuń",
|
||||
"Gen_DeleteAll": "Usuń wszystko",
|
||||
"Gen_Description": "",
|
||||
"Gen_Error": "Błąd",
|
||||
"Gen_Filter": "Filtr",
|
||||
"Gen_LockedDB": "BŁĄD - BAZA DANYCH może być zablokowana - Sprawdź F12 narzędzia dewelopera -> Konsola lub spróbuj ponownie później.",
|
||||
@@ -567,6 +568,7 @@
|
||||
"Setting_Override": "Nadpisz wartość",
|
||||
"Setting_Override_Description": "Włączanie tej opcji nadpisze podstawową wartość na wartość podaną powyżej.",
|
||||
"Settings_Metadata_Toggle": "Pokaż/Ukryj metadane dla podanego ustawienia.",
|
||||
"Settings_Show_Description": "",
|
||||
"Settings_device_Scanners_desync": "⚠ Harmonogramy skanowania urządzeń są niesynchronizowane.",
|
||||
"Settings_device_Scanners_desync_popup": "Harmonogramy skanowania urządzeń (<code>*_RUN_SCHD</code>) nie są takie same. Powodować to będzie nierównomierne powiadomienia o urządzeniach włączynych/wyłączonych. Jeżeli nie jest to zamierzone to proszę włączyć ten sam harmonogram dla wszyskich <b>🔍Skanerów Urządzeń</b>.",
|
||||
"Speedtest_Results": "Wyniki Testu Prędkości",
|
||||
|
||||
@@ -281,6 +281,7 @@
|
||||
"Gen_DataUpdatedUITakesTime": "OK - Pode levar um tempo para a interface do usuário ser atualizada se uma verificação estiver em execução.",
|
||||
"Gen_Delete": "Excluir",
|
||||
"Gen_DeleteAll": "Excluir todos",
|
||||
"Gen_Description": "",
|
||||
"Gen_Error": "Erro",
|
||||
"Gen_Filter": "Filtro",
|
||||
"Gen_LockedDB": "ERRO - O banco de dados pode estar bloqueado - Verifique F12 Ferramentas de desenvolvimento -> Console ou tente mais tarde.",
|
||||
@@ -567,6 +568,7 @@
|
||||
"Setting_Override": "",
|
||||
"Setting_Override_Description": "",
|
||||
"Settings_Metadata_Toggle": "",
|
||||
"Settings_Show_Description": "",
|
||||
"Settings_device_Scanners_desync": "",
|
||||
"Settings_device_Scanners_desync_popup": "",
|
||||
"Speedtest_Results": "",
|
||||
|
||||
@@ -281,6 +281,7 @@
|
||||
"Gen_DataUpdatedUITakesTime": "ОК - Обновление UI может занять некоторое время, если сканирование выполняется.",
|
||||
"Gen_Delete": "Удалить",
|
||||
"Gen_DeleteAll": "Удалить все",
|
||||
"Gen_Description": "",
|
||||
"Gen_Error": "Ошибка",
|
||||
"Gen_Filter": "Фильтр",
|
||||
"Gen_LockedDB": "ОШИБКА - Возможно, база данных заблокирована. Проверьте инструменты разработчика F12 -> Консоль или повторите попытку позже.",
|
||||
@@ -567,6 +568,7 @@
|
||||
"Setting_Override": "Переопределить значение",
|
||||
"Setting_Override_Description": "Включение этой опции приведет к переопределению значения по умолчанию, предоставленного приложением, на значение, указанное выше.",
|
||||
"Settings_Metadata_Toggle": "Показать/скрыть метаданные для данного параметра.",
|
||||
"Settings_Show_Description": "",
|
||||
"Settings_device_Scanners_desync": "⚠ Расписания сканера устройств не синхронизированы.",
|
||||
"Settings_device_Scanners_desync_popup": "Расписания сканеров устройств (<code>*_RUN_SCHD</code>) не совпадают. Это приведет к несогласованным онлайн/оффлайн уведомлениям устройства. Если это не предусмотрено, используйте одно и то же расписание для всех включенных <b>🔍Сканеров устройств</b>.",
|
||||
"Speedtest_Results": "Результаты теста скорости",
|
||||
|
||||
@@ -281,6 +281,7 @@
|
||||
"Gen_DataUpdatedUITakesTime": "TAMAM - Eğer bir tarama çalışıyorsa arayüzün güncellenmesi biraz zaman alabilir",
|
||||
"Gen_Delete": "Sil",
|
||||
"Gen_DeleteAll": "Tümünü sil",
|
||||
"Gen_Description": "",
|
||||
"Gen_Error": "Hata",
|
||||
"Gen_Filter": "Filtre",
|
||||
"Gen_LockedDB": "",
|
||||
@@ -567,6 +568,7 @@
|
||||
"Setting_Override": "",
|
||||
"Setting_Override_Description": "",
|
||||
"Settings_Metadata_Toggle": "",
|
||||
"Settings_Show_Description": "",
|
||||
"Settings_device_Scanners_desync": "",
|
||||
"Settings_device_Scanners_desync_popup": "",
|
||||
"Speedtest_Results": "",
|
||||
|
||||
@@ -281,6 +281,7 @@
|
||||
"Gen_DataUpdatedUITakesTime": "好的 - 如果扫描正在运行,UI 可能需要一段时间才能更新。",
|
||||
"Gen_Delete": "删除",
|
||||
"Gen_DeleteAll": "全部删除",
|
||||
"Gen_Description": "",
|
||||
"Gen_Error": "错误",
|
||||
"Gen_Filter": "筛选",
|
||||
"Gen_LockedDB": "错误 - DB 可能被锁定 - 检查 F12 开发工具 -> 控制台或稍后重试。",
|
||||
@@ -567,6 +568,7 @@
|
||||
"Setting_Override": "覆盖值",
|
||||
"Setting_Override_Description": "启用此选项将用上面指定的值覆盖应用程序提供的默认值。",
|
||||
"Settings_Metadata_Toggle": "显示/隐藏给定设置的元数据。",
|
||||
"Settings_Show_Description": "",
|
||||
"Settings_device_Scanners_desync": "⚠ 设备扫描计划不同步。",
|
||||
"Settings_device_Scanners_desync_popup": "设备扫描 (<code>*_RUN_SCHD</code>) 的时间表并不相同。这将导致设备在线/离线通知不一致。除非有意为之,否则请对所有启用的 <b>🔍设备扫描</b> 使用相同的时间表。",
|
||||
"Speedtest_Results": "Speedtest 结果",
|
||||
|
||||
@@ -259,9 +259,13 @@
|
||||
"function": "CMD",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"element": "input",
|
||||
"elementOptions": ["readonly"],
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "readonly": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": "python3 /app/front/plugins/<plugin folder>/rename_me.py",
|
||||
"options": [],
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"code_name": "dhcp_servers",
|
||||
"unique_prefix": "DHCPSRVS",
|
||||
"plugin_type": "other",
|
||||
"execution_order" : "Layer_3",
|
||||
"execution_order": "Layer_3",
|
||||
"enabled": true,
|
||||
"data_source": "script",
|
||||
"show_ui": true,
|
||||
@@ -349,7 +349,11 @@
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "readonly": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": "python3 /app/front/plugins/dhcp_servers/script.py",
|
||||
|
||||
@@ -125,7 +125,7 @@
|
||||
"description": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "You can specify a SQL where condition to filter out New Devices from notifications. For example <code>AND dev_LastIP NOT LIKE '192.168.3.%'</code> will always exlude New Device notifications for all devices with the IP starting with <code>192.168.3.%</code>."
|
||||
"string": "You can specify a SQL where condition to filter out New Devices from notifications. For example <code>AND dev_LastIP NOT LIKE '192.168.3.%'</code> will always exclude New Device notifications for all devices with the IP starting with <code>192.168.3.%</code>."
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -149,7 +149,7 @@
|
||||
"description": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "You can specify a SQL where condition to filter out Events from notifications. For example <code>AND dev_LastIP NOT LIKE '192.168.3.%'</code> will always exlude New Device notifications for all devices with the IP starting with <code>192.168.3.%</code>."
|
||||
"string": "You can specify a SQL where condition to filter out Events from notifications. For example <code>AND dev_LastIP NOT LIKE '192.168.3.%'</code> will always exclude New Device notifications for all devices with the IP starting with <code>192.168.3.%</code>."
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -238,7 +238,7 @@ def get_ip(*ips: str) -> str:
|
||||
for ip in ips:
|
||||
if ip and ip != 'null':
|
||||
return ip
|
||||
return '0:0:0:0'
|
||||
return '0.0.0.0'
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
@@ -398,26 +398,32 @@ $settingsJSON_DB = json_encode($settings, JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX
|
||||
{
|
||||
// hide metadata by default by assigning it a special class
|
||||
isMetadata ? metadataClass = 'metadata' : metadataClass = '';
|
||||
isMetadata ? infoIcon = '' : infoIcon = `<i
|
||||
isMetadata ? showMetadata = '' : showMetadata = `<i
|
||||
my-to-toggle="row_${codeName}__metadata"
|
||||
title="${getString("Settings_Metadata_Toggle")}"
|
||||
class="fa fa-circle-question pointer"
|
||||
class="fa fa-circle-question pointer hideOnMobile"
|
||||
onclick="toggleMetadata(this)">
|
||||
</i>` ;
|
||||
|
||||
infoIcon = `<i my-to-show="#row_${codeName} .setting_description"
|
||||
title="${getString("Settings_Show_Description")}"
|
||||
class="fa fa-circle-info pointer hideOnBigScreen"
|
||||
onclick="showDescription(this)">
|
||||
</i>` ;
|
||||
|
||||
// NAME & DESCRIPTION columns
|
||||
setHtml += `
|
||||
<div class="row table_row ${metadataClass}" id="row_${codeName}">
|
||||
<div class="table_cell setting_name bold">
|
||||
<div class="row table_row ${metadataClass} " id="row_${codeName}">
|
||||
<div class="table_cell setting_name bold col-sm-2">
|
||||
<label>${getString(codeName + '_name', set['Display_Name'])}</label>
|
||||
<div class="small text-overflow-hidden">
|
||||
<code>${codeName}</code>${infoIcon}
|
||||
<code>${codeName}</code>${showMetadata}${infoIcon}
|
||||
</div>
|
||||
</div>
|
||||
<div class="table_cell setting_description">
|
||||
<div class="table_cell setting_description col-sm-4">
|
||||
${getString(codeName + '_description', set['Description'])}
|
||||
</div>
|
||||
<div class="table_cell input-group setting_input ${overriddenByEnv ? "setting_overriden_by_env" : ""} input-group col-sm-12">
|
||||
<div class="table_cell input-group setting_input ${overriddenByEnv ? "setting_overriden_by_env" : ""} input-group col-xs-12 col-sm-6">
|
||||
`;
|
||||
|
||||
// OVERRIDE
|
||||
|
||||
@@ -41,6 +41,39 @@ class Device_obj:
|
||||
return result[column_name] if result else None
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Removing devices from the CurrentScan DB table which the user chose to ignore by MAC or IP
|
||||
def exclude_ignored_devices(db):
|
||||
sql = db.sql # Database interface for executing queries
|
||||
|
||||
mac_condition = list_to_where('OR', 'cur_MAC', 'LIKE', get_setting_value('NEWDEV_ignored_MACs'))
|
||||
ip_condition = list_to_where('OR', 'cur_IP', 'LIKE', get_setting_value('NEWDEV_ignored_IPs'))
|
||||
|
||||
# Only delete if either the MAC or IP matches an ignored condition
|
||||
conditions = []
|
||||
if mac_condition:
|
||||
conditions.append(mac_condition)
|
||||
if ip_condition:
|
||||
conditions.append(ip_condition)
|
||||
|
||||
# Join conditions and prepare the query
|
||||
conditions_str = " OR ".join(conditions)
|
||||
if conditions_str:
|
||||
query = f"""DELETE FROM CurrentScan WHERE
|
||||
1=1
|
||||
AND (
|
||||
{conditions_str}
|
||||
)
|
||||
"""
|
||||
else:
|
||||
query = "DELETE FROM CurrentScan WHERE 1=1 AND 1=0" # No valid conditions, prevent deletion
|
||||
|
||||
mylog('debug', f'[New Devices] Excluding Ignored Devices Query: {query}')
|
||||
|
||||
sql.execute(query)
|
||||
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
def save_scanned_devices (db):
|
||||
sql = db.sql #TO-DO
|
||||
@@ -146,12 +179,10 @@ def create_new_devices (db):
|
||||
FROM CurrentScan
|
||||
WHERE NOT EXISTS (SELECT 1 FROM Devices
|
||||
WHERE dev_MAC = cur_MAC)
|
||||
{list_to_where('OR', 'cur_MAC', 'NOT LIKE', get_setting_value('NEWDEV_ignored_MACs'))}
|
||||
{list_to_where('OR', 'cur_IP', 'NOT LIKE', get_setting_value('NEWDEV_ignored_IPs'))}
|
||||
"""
|
||||
|
||||
|
||||
mylog('debug',f'[New Devices] Query: {query}')
|
||||
mylog('debug',f'[New Devices] Log Events Query: {query}')
|
||||
|
||||
sql.execute(query)
|
||||
|
||||
@@ -163,8 +194,6 @@ def create_new_devices (db):
|
||||
FROM CurrentScan
|
||||
WHERE NOT EXISTS (SELECT 1 FROM Sessions
|
||||
WHERE ses_MAC = cur_MAC)
|
||||
{list_to_where('OR', 'cur_MAC', 'NOT LIKE', get_setting_value('NEWDEV_ignored_MACs'))}
|
||||
{list_to_where('OR', 'cur_IP', 'NOT LIKE', get_setting_value('NEWDEV_ignored_IPs'))}
|
||||
""")
|
||||
|
||||
# Create new devices from CurrentScan
|
||||
@@ -199,8 +228,13 @@ def create_new_devices (db):
|
||||
{get_setting_value('NEWDEV_dev_LogEvents')},
|
||||
'{sanitize_SQL_input(get_setting_value('NEWDEV_dev_Location'))}'"""
|
||||
|
||||
# Fetch data from CurrentScan
|
||||
current_scan_data = sql.execute("SELECT cur_MAC, cur_Name, cur_Vendor, cur_IP, cur_SyncHubNodeName, cur_NetworkNodeMAC, cur_PORT, cur_NetworkSite, cur_SSID, cur_Type FROM CurrentScan").fetchall()
|
||||
# Fetch data from CurrentScan skipping ignored devices by IP and MAC
|
||||
query = f"""SELECT cur_MAC, cur_Name, cur_Vendor, cur_IP, cur_SyncHubNodeName, cur_NetworkNodeMAC, cur_PORT, cur_NetworkSite, cur_SSID, cur_Type
|
||||
FROM CurrentScan """
|
||||
|
||||
|
||||
mylog('debug',f'[New Devices] Collecting New Devices Query: {query}')
|
||||
current_scan_data = sql.execute(query).fetchall()
|
||||
|
||||
for row in current_scan_data:
|
||||
cur_MAC, cur_Name, cur_Vendor, cur_IP, cur_SyncHubNodeName, cur_NetworkNodeMAC, cur_PORT, cur_NetworkSite, cur_SSID, cur_Type = row
|
||||
|
||||
@@ -462,19 +462,23 @@ def list_to_where(logical_operator, column_name, condition_operator, values_list
|
||||
- A string representing the WHERE condition.
|
||||
"""
|
||||
|
||||
# If the list is empty, return an empty string
|
||||
if not values_list:
|
||||
return " AND 1=1 " # Return a conditioneitehr way if the list is empty to avoid breaking the SQL condition.
|
||||
return ""
|
||||
|
||||
# Replace {s-quote} with single quote in values_list
|
||||
values_list = [value.replace("{s-quote}", "'") for value in values_list]
|
||||
|
||||
# Build the WHERE condition
|
||||
# Build the WHERE condition for the first value
|
||||
condition = f"{column_name} {condition_operator} '{values_list[0]}'"
|
||||
|
||||
# Add the rest of the values using the logical operator
|
||||
for value in values_list[1:]:
|
||||
condition += f" {logical_operator} {column_name} {condition_operator} '{value}'"
|
||||
|
||||
return f' AND ({condition}) '
|
||||
return f'({condition})'
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import conf
|
||||
|
||||
|
||||
from device import create_new_devices, print_scan_stats, save_scanned_devices, update_devices_data_from_scan
|
||||
from device import create_new_devices, print_scan_stats, save_scanned_devices, update_devices_data_from_scan, exclude_ignored_devices
|
||||
from helper import timeNowTZ
|
||||
from logger import mylog
|
||||
from reporting import skip_repeated_notifications
|
||||
@@ -16,6 +16,10 @@ from reporting import skip_repeated_notifications
|
||||
|
||||
def process_scan (db):
|
||||
|
||||
# Apply exclusions
|
||||
mylog('verbose','[Process Scan] Exclude ignored devices')
|
||||
exclude_ignored_devices (db)
|
||||
|
||||
# Load current scan data
|
||||
mylog('verbose','[Process Scan] Processing scan results')
|
||||
save_scanned_devices (db)
|
||||
|
||||
Reference in New Issue
Block a user