diff --git a/front/css/pialert.css b/front/css/pialert.css
index e15c470a..2d62d69f 100755
--- a/front/css/pialert.css
+++ b/front/css/pialert.css
@@ -585,8 +585,24 @@ height: 50px;
.infobox_label {
font-size: 16px !important;
}
+/* --------------------------------------------------------- */
+/* report */
+/* --------------------------------------------------------- */
-/*settings*/
+#notificationData textarea{
+ width: 100%;
+}
+
+#notificationData pre {outline: 1px solid #ccc; padding: 5px; margin: 5px; }
+.string { color: green; }
+.number { color: darkorange; }
+.boolean { color: blue; }
+.null { color: magenta; }
+.key { color: red; }
+
+/* --------------------------------------------------------- */
+/* settings */
+/* --------------------------------------------------------- */
@media (max-width: 767px) {
/* hide on mobile */
diff --git a/front/js/pialert_common.js b/front/js/pialert_common.js
index 9a904ec3..4645a3d6 100755
--- a/front/js/pialert_common.js
+++ b/front/js/pialert_common.js
@@ -304,6 +304,32 @@ function showMessage (textMessage="") {
}
+// -----------------------------------------------------------------------------
+// String utilities
+// -----------------------------------------------------------------------------
+function jsonSyntaxHighlight(json) {
+ if (typeof json != 'string') {
+ json = JSON.stringify(json, undefined, 2);
+ }
+ json = json.replace(/&/g, '&').replace(//g, '>');
+ return json.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g, function (match) {
+ var cls = 'number';
+ if (/^"/.test(match)) {
+ if (/:$/.test(match)) {
+ cls = 'key';
+ } else {
+ cls = 'string';
+ }
+ } else if (/true|false/.test(match)) {
+ cls = 'boolean';
+ } else if (/null/.test(match)) {
+ cls = 'null';
+ }
+ return '' + match + '';
+ });
+}
+
+
// -----------------------------------------------------------------------------
// General utilities
// -----------------------------------------------------------------------------
diff --git a/front/php/server/util.php b/front/php/server/util.php
index cbe9a986..5f7d567a 100755
--- a/front/php/server/util.php
+++ b/front/php/server/util.php
@@ -20,21 +20,21 @@ if(array_key_exists('function', $_REQUEST) != FALSE)
{
$FUNCTION = $_REQUEST['function'];
}
+if(array_key_exists('settings', $_REQUEST) != FALSE)
+{
+ $SETTINGS = $_REQUEST['settings'];
+}
// call functions based on requested params
switch ($FUNCTION) {
case 'savesettings':
+
saveSettings();
break;
case 'cleanLog':
- if(array_key_exists('settings', $_REQUEST) != FALSE)
- {
- $SETTINGS = $_REQUEST['settings'];
- }
-
cleanLog($SETTINGS);
break;
diff --git a/front/php/templates/language/en_us.json b/front/php/templates/language/en_us.json
index e37ab71d..6d4e7736 100755
--- a/front/php/templates/language/en_us.json
+++ b/front/php/templates/language/en_us.json
@@ -452,7 +452,7 @@
"run_event_tooltip" : "Enable the setting and save your changes at first before you run it.",
"run_event_icon" : "fa-play",
"general_event_title" : "Executing an ad-hoc event",
- "general_event_description" : " The event you nove triggered might take a while until background processes finish. The execution ended once you see finished below. Check the error log if you didn not get the expected result.
Status: ",
+ "general_event_description" : " The event you nove triggered might take a while until background processes finish. The execution ended once the below execution queue empties (Check the error log if you envounter issues).
Execution queue:",
"Plugins_Unprocessed_Events" : "Unprocessed Events",
"Plugins_Objects" : "Plugin Objects",
"Plugins_DeleteAll" : "Delete all (filters are ignored)",
@@ -602,7 +602,9 @@
"Systeminfo_System_System": "System:",
"Systeminfo_System_Uname": "Uname:",
"Systeminfo_System_Uptime": "Uptime:",
- "Systeminfo_USB_Devices" : "USB Devices",
+ "Systeminfo_USB_Devices" : "USB Devices",
+ "report_select_format": "Select Format:",
+ "report_time": "Notification time:",
"Donations_Title" : "Donations",
"Donations_Text" : "Hey π! Thanks for clicking on this menu item π
I'm trying to collect some donations to make you better software. Also, it would help me not to get burned out. Me burning out might mean end of support for this app. Any small (recurring or not) sponsorship makes me want ot put more effort into this app. I don't want to lock features (new plugins) behind paywalls π. Currently, I'm waking up 2h before work so I contribute to the app a bit. If I had some recurring income I could shorten my workweek and in the remaining time fully focus on PiAlert. You'd get more functionality, a more polished app and less bugs. Thanks for reading - I'm super grateful for any support β€π TL;DR: By supporting me you get:
");
-
- // Periodically update state of the requested action
- getParam(modalEventStatusId,"Front_Event", true, updateModalState)
-
- updateModalState()
- }
-
-
- // function updateModalState(){
-
- // setTimeout(function(){
- // displayedEvent = $('#'+modalEventStatusId).html()
-
- // // loop until finished
- // if(displayedEvent.indexOf('finished') == -1) // if the message is different from finished, check again in 2s
- // {
-
- // getParam(modalEventStatusId,"Front_Event", true)
-
- // updateModalState()
-
- // }
- // }, 2000);
- // }
-
-
// --------------------------------------------------------
// Calls a backend function to add a front-end event (specified by the attributes 'data-myevent' and 'data-myparam-plugin' on the passed element) to an execution queue
function addToExecutionQueue(element)
@@ -882,34 +847,34 @@ function addToExecutionQueue(element)
// value has to be in format event|param. e.g. run|ARPSCAN
action = `${getGuid()}|${$(element).attr('data-myevent')}|${$(element).attr('data-myparam-plugin')}`
- // addToExecutionQueue(action)
-
$.ajax({
method: "POST",
url: "php/server/util.php",
data: { function: "addToExecutionQueue", action: action },
success: function(data, textStatus) {
- showModalOk ('Result', data );
+ // showModalOk ('Result', data );
+
+ // show message
+ showModalOk(getString("general_event_title"), `${getString("general_event_description")} `);
+
+ updateModalState()
}
})
}
-// TODO
+// --------------------------------------------------------
+// Updating the execution queue in in modal pop-up
function updateModalState() {
setTimeout(function() {
// Fetch the content from the log file using an AJAX request
$.ajax({
- url: '~/log/execution_queue.log',
+ url: '/log/execution_queue.log',
type: 'GET',
success: function(data) {
// Update the content of the HTML element (e.g., a div with id 'logContent')
- $('#logContent').html(data);
+ $('#'+modalEventStatusId).html(data);
- // Check if the displayed content contains 'finished'
- if (data.indexOf('finished') === -1) {
- // If not finished, continue to update
- updateModalState();
- }
+ updateModalState();
},
error: function() {
// Handle error, such as the file not being found
@@ -919,11 +884,6 @@ function updateModalState() {
}, 2000);
}
-// Call the function to start the periodic updates
-updateModalState();
-
-
-
// -----------------------------------------------------------------------------
// handling events on the backend initiated by the front end END
diff --git a/pialert/plugin.py b/pialert/plugin.py
index d81c4861..b939f177 100755
--- a/pialert/plugin.py
+++ b/pialert/plugin.py
@@ -727,38 +727,6 @@ class plugin_object_class:
#===============================================================================
# Handling of user initialized front-end events
#===============================================================================
-
-#-------------------------------------------------------------------------------
-# def check_and_run_user_event(db, pluginsState):
-
-# sql = db.sql # TO-DO
-# sql.execute(""" select * from Parameters where par_ID = "Front_Event" """)
-# rows = sql.fetchall()
-
-# event, param = ['','']
-# if len(rows) > 0 and rows[0]['par_Value'] != 'finished':
-# keyValue = rows[0]['par_Value'].split('|')
-
-# if len(keyValue) == 2:
-# event = keyValue[0]
-# param = keyValue[1]
-# else:
-# return pluginsState
-
-# if event == 'test':
-# pluginsState = handle_test(param, db, pluginsState)
-# if event == 'run':
-# pluginsState = handle_run(param, db, pluginsState)
-
-# # clear event execution flag
-# sql.execute ("UPDATE Parameters SET par_Value='finished' WHERE par_ID='Front_Event'")
-
-# # commit to DB
-# db.commitDB()
-
-# return pluginsState
-
-
def check_and_run_user_event(db, pluginsState):
# Check if the log file exists
logFile = os.path.join(logPath, "execution_queue.log")