@@ -734,7 +735,7 @@ function main () {
// Show device icon as it changes
$('#txtIcon').on('change input', function() {
- $('#txtIconFA').removeClass().addClass(`fa fa-${$(this).val()} pointer`)
+ $('#txtIconFA').html(atob($(this).val()))
});
@@ -799,8 +800,6 @@ function initializeiCheck () {
function initializeCombos () {
// Initialize combos with queries
-
- initializeCombo ( '#dropdownIcon', 'getIcons', 'txtIcon', false);
initializeCombo ( '#dropdownAction', 'getActions', 'txtAction', false);
initializeCombo ( '#dropdownDevices', 'getDevices', 'txtFromDevice', false);
@@ -809,9 +808,11 @@ function initializeCombos () {
// valuesArray, // Array of values to be pre-selected in the dropdown
// targetLocation, // ID of the HTML element where dropdown should be rendered (will be replaced)
// callbackToGenerateEntries, // Callback function to generate entries based on options
- // targetField) // Target field or element where selected value should be applied or updated
+ // targetField, // Target field or element where selected value should be applied or updated
+ // nameTransformer) // callback to transform name
+ initSettingDropdown("NEWDEV_dev_Icon", [], "dropdownIcon_tmp", genDevDetailsList, 'txtIcon', atob )
initSettingDropdown("NEWDEV_dev_DeviceType", [], "dropdownDeviceType_tmp", genDevDetailsList, 'txtDeviceType' )
initSettingDropdown("NEWDEV_dev_Owner", [], "dropdownOwner_tmp", genDevDetailsList, 'txtOwner' )
initSettingDropdown("NEWDEV_dev_Group", [], "dropdownGroup_tmp", genDevDetailsList, 'txtGroup' )
diff --git a/front/devices.php b/front/devices.php
index bec3aac1..e79742bb 100755
--- a/front/devices.php
+++ b/front/devices.php
@@ -582,7 +582,7 @@ function initializeDatatable (status) {
{targets: [mapIndx(3)],
'createdCell': function (td, cellData, rowData, row, col) {
if (!emptyArr.includes(cellData)){
- $(td).html (cellData);
+ $(td).html (atob(cellData));
} else {
$(td).html ('');
}
diff --git a/front/js/db_methods.js b/front/js/db_methods.js
index 03c54b8f..9a21dde1 100755
--- a/front/js/db_methods.js
+++ b/front/js/db_methods.js
@@ -3,14 +3,14 @@
// -----------------------------------------------------------------------------
// Read data and place intotarget location, callback processies the results
-function readData(sqlQuery, processDataCallback, valuesArray, targetLocation, targetField) {
+function readData(sqlQuery, processDataCallback, valuesArray, targetLocation, targetField, nameTransformer) {
var apiUrl = `php/server/dbHelper.php?action=read&rawSql=${encodeURIComponent(sqlQuery)}`;
$.get(apiUrl, function(data) {
// Process the JSON data using the provided callback function
data = JSON.parse(data)
- var htmlResult = processDataCallback(data, valuesArray, targetField);
+ var htmlResult = processDataCallback(data, valuesArray, targetField, nameTransformer);
// Place the resulting HTML into the specified placeholder div
$("#" + targetLocation).replaceWith(htmlResult);
diff --git a/front/js/pialert_common.js b/front/js/pialert_common.js
index 937dd5a2..e5be6dd0 100755
--- a/front/js/pialert_common.js
+++ b/front/js/pialert_common.js
@@ -628,10 +628,19 @@ function stopTimerRefreshData () {
// -----------------------------------------------------------------------------
-function newTimerRefreshData (refeshFunction) {
+function newTimerRefreshData (refeshFunction, timeToRefresh) {
+
+ if(timeToRefresh && (timeToRefresh != 0 || timeToRefresh != ""))
+ {
+ time = parseInt(timeToRefresh)
+ } else
+ {
+ time = 60000
+ }
+
timerRefreshData = setTimeout (function() {
refeshFunction();
- }, 60000);
+ }, time);
}
@@ -1247,6 +1256,16 @@ const onAllCallsComplete = () => {
// Call the function to execute the code
executeOnce();
+
+// Set timer for page refresh if configured
+setTimeout(() => {
+ const refreshTime = getSetting("UI_REFRESH");
+ if (refreshTime && refreshTime !== "0" && refreshTime !== "") {
+ newTimerRefreshData(clearCache, refreshTime);
+ }
+}, 10000);
+
+
console.log("init pialert_common.js");
diff --git a/front/js/ui_components.js b/front/js/ui_components.js
index 1273b3fb..d080486b 100755
--- a/front/js/ui_components.js
+++ b/front/js/ui_components.js
@@ -117,7 +117,8 @@ function initSettingDropdown(settingKey, // Identifier for the setting
valuesArray, // Array of values to be pre-selected in the dropdown
targetLocation, // ID of the HTML element where dropdown should be rendered (will be replaced)
callbackToGenerateEntries, // Callback function to generate entries based on options
- targetField) // Target field or element where selected value should be applied or updated
+ targetField, // Target field or element where selected value should be applied or updated
+ nameTransformer) // callback to transform the name (e.g. base64)
{
var optionsHtml = ""
@@ -127,7 +128,7 @@ function initSettingDropdown(settingKey, // Identifier for the setting
// check if the result is a SQL query
if(isSQLQuery(optionsArray[0]))
{
- readData(optionsArray[0], callbackToGenerateEntries, valuesArray, targetLocation, targetField);
+ readData(optionsArray[0], callbackToGenerateEntries, valuesArray, targetLocation, targetField, nameTransformer);
} else // this should be already an array, e.g. from a setting or pre-defined
{
@@ -212,8 +213,8 @@ function generateList(data, valuesArray) {
}
// -----------------------------------------------------------------------------
-// Processor to generate a list
-function genDevDetailsList(data, valuesArray, targetField) {
+// Processor to generate a list in teh deviceDetails page
+function genDevDetailsList(data, valuesArray, targetField, nameTransformer) {
var listHtml = "";
@@ -222,12 +223,17 @@ function genDevDetailsList(data, valuesArray, targetField) {
let selected = valuesArray.includes(item.id) ? 'selected' : '';
-
console.log(item);
- // listHtml += `
diff --git a/front/php/server/devices.php b/front/php/server/devices.php
index 6fc3eac2..d181bad8 100755
--- a/front/php/server/devices.php
+++ b/front/php/server/devices.php
@@ -645,7 +645,7 @@ function getDevicesList() {
$row['dev_Name'],
$row['dev_Owner'],
handleNull($row['dev_DeviceType']),
- handleNull($row['dev_Icon'], "laptop"),
+ handleNull($row['dev_Icon'], ""),
$row['dev_Favorite'],
$row['dev_Group'],
// ----
@@ -754,10 +754,10 @@ function getIcons() {
// arrays of rows
$tableData = array();
while ($row = $result -> fetchArray (SQLITE3_ASSOC)) {
- $icon = handleNull($row['dev_Icon'], "laptop");
+ $icon = handleNull($row['dev_Icon'], "");
// Push row data
$tableData[] = array('id' => $icon,
- 'name' => ' - '.$icon );
+ 'name' => $icon );
}
// Control no rows
diff --git a/front/php/templates/language/de_de.json b/front/php/templates/language/de_de.json
index c4ddc059..7373a706 100755
--- a/front/php/templates/language/de_de.json
+++ b/front/php/templates/language/de_de.json
@@ -685,6 +685,8 @@
"UI_NOT_RANDOM_MAC_name": "",
"UI_PRESENCE_description": "Ausw\u00e4hlen, welche Status im Ger\u00e4tepr\u00e4senz im Laufe der Zeit-Diagramm in der Ger\u00e4te-Seite angzeigt werden sollen. (STRG + klicken zum aus-/abw\u00e4hlen).",
"UI_PRESENCE_name": "Anzeige im Pr\u00e4senzdiagramm",
+ "UI_REFRESH_description": "",
+ "UI_REFRESH_name": "",
"WEBHOOK_PAYLOAD_description": "The Webhook payload data format for the body > attachments > text attribute in the payload json. See an example of the payload here. (e.g.: for discord use text)",
"WEBHOOK_PAYLOAD_name": "Payload type",
"WEBHOOK_REQUEST_METHOD_description": "The HTTP request method to be used for the webhook call.",
diff --git a/front/php/templates/language/en_us.json b/front/php/templates/language/en_us.json
index 6ccd49d6..f32d3016 100755
--- a/front/php/templates/language/en_us.json
+++ b/front/php/templates/language/en_us.json
@@ -616,6 +616,8 @@
"UI_NOT_RANDOM_MAC_name": "Don't mark as Random",
"UI_PRESENCE_description": "Select what statuses should be shown in the Device presence chart in the Devices page. (CTRL + Click to select/deselect)",
"UI_PRESENCE_name": "Show in presence chart",
+ "UI_REFRESH_description": "Enter number of seconds after which the UI reloads. Set to 0 to disable.",
+ "UI_REFRESH_name": "Auto-refresh UI",
"devices_old": "Refreshing...",
"general_event_description": "The event you have triggered might take a while until background processes finish. The execution ended once the below execution queue empties (Check the error log if you encounter issues).
Execution queue:",
"general_event_title": "Executing an ad-hoc event",
diff --git a/front/php/templates/language/es_es.json b/front/php/templates/language/es_es.json
index ba7fbb71..c7195a68 100755
--- a/front/php/templates/language/es_es.json
+++ b/front/php/templates/language/es_es.json
@@ -685,6 +685,8 @@
"UI_NOT_RANDOM_MAC_name": "No marcar como aleatoria",
"UI_PRESENCE_description": "Elige que estados del dispositivo deben mostrarse en la gr\u00e1fica de Presencia del dispositivo a lo largo del tiempo de la p\u00e1gina de Dispositivos. (CTRL + Clic para seleccionar / deseleccionar)",
"UI_PRESENCE_name": "Mostrar en el gr\u00e1fico de presencia",
+ "UI_REFRESH_description": "",
+ "UI_REFRESH_name": "",
"WEBHOOK_PAYLOAD_description": "El formato de datos de carga de Webhook para el atributo body > attachments > text en el json de carga. Vea un ejemplo de la carga aqu\u00ed. (por ejemplo: para discord use text)",
"WEBHOOK_PAYLOAD_name": "Tipo de carga",
"WEBHOOK_REQUEST_METHOD_description": "El m\u00e9todo de solicitud HTTP que se utilizar\u00e1 para la llamada de webhook.",
diff --git a/front/php/templates/language/fr_fr.json b/front/php/templates/language/fr_fr.json
index d5501116..91d6abc1 100755
--- a/front/php/templates/language/fr_fr.json
+++ b/front/php/templates/language/fr_fr.json
@@ -616,6 +616,8 @@
"UI_NOT_RANDOM_MAC_name": "",
"UI_PRESENCE_description": "",
"UI_PRESENCE_name": "",
+ "UI_REFRESH_description": "",
+ "UI_REFRESH_name": "",
"devices_old": "",
"general_event_description": "",
"general_event_title": "",
diff --git a/front/php/templates/language/nb_no.json b/front/php/templates/language/nb_no.json
index 6325070b..d5bed891 100755
--- a/front/php/templates/language/nb_no.json
+++ b/front/php/templates/language/nb_no.json
@@ -616,6 +616,8 @@
"UI_NOT_RANDOM_MAC_name": "",
"UI_PRESENCE_description": "",
"UI_PRESENCE_name": "",
+ "UI_REFRESH_description": "",
+ "UI_REFRESH_name": "",
"devices_old": "",
"general_event_description": "",
"general_event_title": "",
diff --git a/front/php/templates/language/ru_ru.json b/front/php/templates/language/ru_ru.json
index 88caa9f1..ab63181f 100755
--- a/front/php/templates/language/ru_ru.json
+++ b/front/php/templates/language/ru_ru.json
@@ -616,6 +616,8 @@
"UI_NOT_RANDOM_MAC_name": "\u041d\u0435 \u043e\u0442\u043c\u0435\u0447\u0430\u0442\u044c \u043a\u0430\u043a \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0435",
"UI_PRESENCE_description": "\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435, \u043a\u0430\u043a\u0438\u0435 \u0441\u0442\u0430\u0442\u0443\u0441\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0435 \u041f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u00b7 \u00b7 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u0423\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430. (CTRL + Click, \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u0431\u0440\u0430\u0442\u044c/\u043e\u0442\u043c\u0435\u043d\u0438\u0442\u044c \u0432\u044b\u0431\u043e\u0440)",
"UI_PRESENCE_name": "\u041f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0432 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0435 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f",
+ "UI_REFRESH_description": "",
+ "UI_REFRESH_name": "",
"devices_old": "\u0410\u043a\u0442\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f...",
"general_event_description": "\u0421\u043e\u0431\u044b\u0442\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u044b \u0438\u043d\u0438\u0446\u0438\u0438\u0440\u043e\u0432\u0430\u043b\u0438, \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043d\u044f\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f, \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u0444\u043e\u043d\u043e\u0432\u044b\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0442\u0441\u044f. \u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u0441\u044f, \u043a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u0430\u044f \u043d\u0438\u0436\u0435, \u043e\u043f\u0443\u0441\u0442\u0435\u0435\u0442 (\u041f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u0436\u0443\u0440\u043d\u0430\u043b \u043e\u0448\u0438\u0431\u043e\u043a \u043f\u0440\u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c).
\u00b7 \u00b7 \u041e\u0447\u0435\u0440\u0435\u0434\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f:",
"general_event_title": "\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u044f",
diff --git a/front/plugins/newdev_template/config.json b/front/plugins/newdev_template/config.json
index 58b5bbf1..bd7eef81 100755
--- a/front/plugins/newdev_template/config.json
+++ b/front/plugins/newdev_template/config.json
@@ -582,9 +582,16 @@
},
{
"function": "dev_Icon",
- "type": "string",
+ "type": "text.select",
"default_value": "",
- "options": [],
+ "options": ["{value}"],
+ "options_params" : [
+ {
+ "name" : "value",
+ "type" : "sql",
+ "value" : "SELECT DISTINCT '❌None' AS name, '' AS id UNION SELECT Dev_Icon AS name, Dev_Icon AS id FROM Devices WHERE Dev_Icon <> '';"
+ }
+ ],
"localized": ["name", "description"],
"name": [
{
diff --git a/front/plugins/undiscoverables/config.json b/front/plugins/undiscoverables/config.json
index a0f6b7f1..bb6f7ca7 100755
--- a/front/plugins/undiscoverables/config.json
+++ b/front/plugins/undiscoverables/config.json
@@ -71,6 +71,7 @@
"options": [
"disabled",
"once",
+ "schedule",
"always_after_scan"
],
"localized": [
@@ -94,11 +95,11 @@
"description": [
{
"language_code": "en_us",
- "string": "When enabled, ONCE is the preferred option. It runs at startup and after every save of the config here. Changes will only show in the devices after the next scan!"
+ "string": "When enabled, once is the preferred option, or set to schedule and align the UNDIS_RUN_SCHD setting with the other scanners if you want the devices to show up as ONLINE. It runs at startup and after every save of the config here. Changes will only show in the devices after the next scan!"
},
{
"language_code": "es_es",
- "string": "Cuando está habilitado, ONCE es la opción preferida. Se ejecuta al inicio y después de cada guardado de la configuración aquí. ¡Los cambios solo se mostrarán en los dispositivos después del próximo escaneo!"
+ "string": "Cuando está habilitado, once es la opción preferida. Se ejecuta al inicio y después de cada guardado de la configuración aquí. ¡Los cambios solo se mostrarán en los dispositivos después del próximo escaneo!"
},
{
"language_code": "de_de",
@@ -302,6 +303,29 @@
"string": "Geräte, welche der Geräteliste hinzugefügt werden."
}
]
+ },
+ {
+ "function": "RUN_SCHD",
+ "type": "text",
+ "default_value":"*/5 * * * *",
+ "options": [],
+ "localized": ["name", "description"],
+ "name" : [{
+ "language_code":"en_us",
+ "string" : "Schedule"
+ },
+ {
+ "language_code":"es_es",
+ "string" : "Schedule"
+ }],
+ "description": [{
+ "language_code":"en_us",
+ "string" : "Only enabled if you select schedule in the UNDIS_RUN setting. Make sure you enter the schedule in the correct cron-like format (e.g. validate at crontab.guru). For example entering 0 4 * * * will run the scan after 4 am in the TIMEZONE you set above. Will be run NEXT time the time passes. It's recommended to use the same schedule interval for all plugins responsible for discovering new devices. "
+ },
+ {
+ "language_code":"es_es",
+ "string" : "Solo está habilitado si selecciona schedule en la configuración UNDIS_RUN. Asegúrese de ingresar la programación en el formato similar a cron correcto (por ejemplo, valide en crontab.guru). Por ejemplo, ingresar 0 4 * * * ejecutará el escaneo después de las 4 a.m. en el TIMEZONE código> que configuró arriba. Se ejecutará la PRÓXIMA vez que pase el tiempo."
+ }]
}
],
"database_column_definitions": [
diff --git a/pialert/database.py b/pialert/database.py
index adb5cc53..4021718d 100755
--- a/pialert/database.py
+++ b/pialert/database.py
@@ -1,6 +1,7 @@
""" all things database to support Pi.Alert """
import sqlite3
+import base64
# pialert modules
from const import fullDbPath, sql_devices_stats, sql_devices_all
@@ -269,10 +270,32 @@ class DB():
sql_Icons = """ UPDATE Devices SET dev_Icon = ''
WHERE dev_Icon NOT LIKE '