diff --git a/front/js/settings_utils.js b/front/js/settings_utils.js
index 77627a77..4b903728 100755
--- a/front/js/settings_utils.js
+++ b/front/js/settings_utils.js
@@ -412,58 +412,6 @@ function filterRows(inputText) {
- // -----------------------------------------------------------------------------
- // handling events on the backend initiated by the front end START
- // -----------------------------------------------------------------------------
-
- modalEventStatusId = 'modal-message-front-event'
-
- // --------------------------------------------------------
- // 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)
- {
-
- // value has to be in format event|param. e.g. run|ARPSCAN
- action = `${getGuid()}|${$(element).attr('data-myevent')}|${$(element).attr('data-myparam-plugin')}`
-
- $.ajax({
- method: "POST",
- url: "php/server/util.php",
- data: { function: "addToExecutionQueue", action: action },
- success: function(data, textStatus) {
- // showModalOk ('Result', data );
-
- // show message
- showModalOk(getString("general_event_title"), `${getString("general_event_description")}
`);
-
- updateModalState()
- }
- })
- }
-
- // --------------------------------------------------------
- // 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',
- type: 'GET',
- success: function(data) {
- // Update the content of the HTML element (e.g., a div with id 'logContent')
- $('#'+modalEventStatusId).html(data);
-
- updateModalState();
- },
- error: function() {
- // Handle error, such as the file not being found
- $('#logContent').html('Error: Log file not found.');
- }
- });
- }, 2000);
- }
-
-
// -----------------------------------------------------------------------------
// handling events on the backend initiated by the front end END
// -----------------------------------------------------------------------------
diff --git a/front/js/ui_components.js b/front/js/ui_components.js
index 20da9d48..518bf587 100755
--- a/front/js/ui_components.js
+++ b/front/js/ui_components.js
@@ -306,6 +306,57 @@ function getCellValue(row, index) {
return $(row).children('td').eq(index).text();
}
+ // -----------------------------------------------------------------------------
+ // handling events on the backend initiated by the front end START
+ // -----------------------------------------------------------------------------
+
+ modalEventStatusId = 'modal-message-front-event'
+
+ // --------------------------------------------------------
+ // 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)
+ {
+
+ // value has to be in format event|param. e.g. run|ARPSCAN
+ action = `${getGuid()}|${$(element).attr('data-myevent')}|${$(element).attr('data-myparam-plugin')}`
+
+ $.ajax({
+ method: "POST",
+ url: "php/server/util.php",
+ data: { function: "addToExecutionQueue", action: action },
+ success: function(data, textStatus) {
+ // showModalOk ('Result', data );
+
+ // show message
+ showModalOk(getString("general_event_title"), `${getString("general_event_description")}
`);
+
+ updateModalState()
+ }
+ })
+ }
+
+ // --------------------------------------------------------
+ // 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',
+ type: 'GET',
+ success: function(data) {
+ // Update the content of the HTML element (e.g., a div with id 'logContent')
+ $('#'+modalEventStatusId).html(data);
+
+ updateModalState();
+ },
+ error: function() {
+ // Handle error, such as the file not being found
+ $('#logContent').html('Error: Log file not found.');
+ }
+ });
+ }, 2000);
+ }
+
// -----------------------------------------------------------------------------
// initialize
diff --git a/front/maintenance.php b/front/maintenance.php
index af9021ae..25722ceb 100755
--- a/front/maintenance.php
+++ b/front/maintenance.php
@@ -405,112 +405,8 @@ $db->close();
-
-
-
-
-
-
-
app.log
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
app_front.log
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
app.php_errors.log
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
nginx/error.log
-
-
-
-
-
-
-
-
-
-
-
stdout.log
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
stderr.log
-
-
-
-
-
-
-
-
-
+
@@ -566,12 +462,14 @@ var selectedTab = 'tab_Settings_id';
initializeTabs();
+// -----------------------------------------------------------
// delete devices with emty macs
function askDeleteDevicesWithEmptyMACs () {
// Ask
showModalWarning('= lang('Maintenance_Tool_del_empty_macs_noti');?>', '= lang('Maintenance_Tool_del_empty_macs_noti_text');?>',
'Cancel', 'Delete', 'deleteDevicesWithEmptyMACs');
}
+// -----------------------------------------------------------
function deleteDevicesWithEmptyMACs()
{
// Delete device
@@ -580,12 +478,14 @@ function deleteDevicesWithEmptyMACs()
});
}
+// -----------------------------------------------------------
// delete all devices
function askDeleteAllDevices () {
// Ask
showModalWarning('= lang('Maintenance_Tool_del_alldev_noti');?>', '= lang('Maintenance_Tool_del_alldev_noti_text');?>',
'= lang('Gen_Cancel');?>', '= lang('Gen_Delete');?>', 'deleteAllDevices');
}
+// -----------------------------------------------------------
function deleteAllDevices()
{
// Delete device
@@ -594,12 +494,14 @@ function deleteAllDevices()
});
}
+// -----------------------------------------------------------
// delete all (unknown) devices
function askDeleteUnknown () {
// Ask
showModalWarning('= lang('Maintenance_Tool_del_unknowndev_noti');?>', '= lang('Maintenance_Tool_del_unknowndev_noti_text');?>',
'= lang('Gen_Cancel');?>', '= lang('Gen_Delete');?>', 'deleteUnknownDevices');
}
+// -----------------------------------------------------------
function deleteUnknownDevices()
{
// Execute
@@ -608,12 +510,14 @@ function deleteUnknownDevices()
});
}
+// -----------------------------------------------------------
// delete all Events
function askDeleteEvents () {
// Ask
showModalWarning('= lang('Maintenance_Tool_del_allevents_noti');?>', '= lang('Maintenance_Tool_del_allevents_noti_text');?>',
'= lang('Gen_Cancel');?>', '= lang('Gen_Delete');?>', 'deleteEvents');
}
+// -----------------------------------------------------------
function deleteEvents()
{
// Execute
@@ -622,12 +526,14 @@ function deleteEvents()
});
}
+// -----------------------------------------------------------
// delete all Events older than 30 days
function askDeleteEvents30 () {
// Ask
showModalWarning('= lang('Maintenance_Tool_del_allevents30_noti');?>', '= lang('Maintenance_Tool_del_allevents30_noti_text');?>',
'= lang('Gen_Cancel');?>', '= lang('Gen_Delete');?>', 'deleteEvents30');
}
+// -----------------------------------------------------------
function deleteEvents30()
{
// Execute
@@ -636,6 +542,7 @@ function deleteEvents30()
});
}
+// -----------------------------------------------------------
// delete History
function askDeleteActHistory () {
// Ask
@@ -650,6 +557,7 @@ function deleteActHistory()
});
}
+// -----------------------------------------------------------
// Backup DB to Archive
function askPiaBackupDBtoArchive () {
// Ask
@@ -664,6 +572,7 @@ function PiaBackupDBtoArchive()
});
}
+// -----------------------------------------------------------
// Restore DB from Archive
function askPiaRestoreDBfromArchive () {
// Ask
@@ -678,6 +587,7 @@ function PiaRestoreDBfromArchive()
});
}
+// -----------------------------------------------------------
// Purge Backups
function askPiaPurgeDBBackups() {
// Ask
@@ -692,22 +602,37 @@ function PiaPurgeDBBackups()
});
}
-// Restart Backend
-function restartBackend() {
- // Execute
- $.ajax({
- method: "POST",
- url: "php/server/util.php",
- data: { function: 'restartBackend' },
- success: function(data, textStatus) {
- showModalOk ('Result', data );
- }
- })
-
-
-
+// -----------------------------------------------------------
+// Restart Backend Python Server
+
+function askRestartBackend() {
+ // Ask
+ showModalWarning('= lang('Maint_RestartServer');?>', '= lang('Maint_Restart_Server_noti_text');?>',
+ '= lang('Gen_Cancel');?>', '= lang('Maint_RestartServer');?>', 'restartBackend');
}
+// -----------------------------------------------------------
+function restartBackend() {
+
+ modalEventStatusId = 'modal-message-front-event'
+
+ // Execute
+ $.ajax({
+ method: "POST",
+ url: "php/server/util.php",
+ data: { function: "addToExecutionQueue", action: 'cron_restart_backend' },
+ success: function(data, textStatus) {
+ // showModalOk ('Result', data );
+
+ // show message
+ showModalOk(getString("general_event_title"), `${getString("general_event_description")}
`);
+
+ updateModalState()
+ }
+ })
+}
+
+// -----------------------------------------------------------
// Export CSV
function askExportCSV() {
// Ask
@@ -720,6 +645,7 @@ function ExportCSV()
openInNewTab("php/server/devices.php?action=ExportCSV")
}
+// -----------------------------------------------------------
// Import CSV
function askImportCSV() {
// Ask
@@ -952,13 +878,31 @@ function initializeTabs () {
}
+//------------------------------------------------------------------------------
+function renderLogs(customData) {
+ $.ajax({
+ url: 'php/components/logs.php', // PHP script URL
+ type: 'POST', // Use POST method to send data
+ dataType: 'html', // Expect HTML response
+ // data: { items: JSON.stringify(customData) }, // Send customData as JSON
+ success: function(response) {
+ $('#logsPlc').html(response); // Replace container content with fetched HTML
+ },
+ error: function(xhr, status, error) {
+ console.error('Error fetching infoboxes:', error);
+ }
+ });
+ }
-// load footer asynchronously not to block the page load/other sections
+
+// Init
window.onload = function asyncFooter()
{
initializeSelectedColumns();
- scrollDown();
- initializeTabs();
+ renderLogs();
+ scrollDown(); // scroll down the logs
+
+ // initializeTabs();
$("#lastCommit").append('');
@@ -967,10 +911,6 @@ window.onload = function asyncFooter()
}
-// scroll to the latest log entrie sat teh bottom of the file
-
-
-
diff --git a/front/php/components/logs.php b/front/php/components/logs.php
new file mode 100755
index 00000000..a989226c
--- /dev/null
+++ b/front/php/components/logs.php
@@ -0,0 +1,76 @@
+ 2000000) {
+ $content = file_get_contents($filePath, false, null, -2000000);
+ } else {
+ $content = file_get_contents($filePath);
+ }
+
+ // Render the log area HTML
+ $html = '
+