diff --git a/docs/DEBUG_API_SERVER.md b/docs/DEBUG_API_SERVER.md index 2c3db557..b8feac8a 100644 --- a/docs/DEBUG_API_SERVER.md +++ b/docs/DEBUG_API_SERVER.md @@ -40,7 +40,7 @@ There are several ways to check if the GraphQL server is running. ### Init Check -You can navigate to Maintenance -> Init Check to see if `isGraphQLServerRunning` is ticked: +You can navigate to System Info -> Init Check to see if `isGraphQLServerRunning` is ticked: ![Init Check](./img/DEBUG_API_SERVER/Init_check.png) diff --git a/docs/img/DEBUG_API_SERVER/Init_check.png b/docs/img/DEBUG_API_SERVER/Init_check.png index 92d9d562..54ef9c9b 100644 Binary files a/docs/img/DEBUG_API_SERVER/Init_check.png and b/docs/img/DEBUG_API_SERVER/Init_check.png differ diff --git a/front/js/tests.js b/front/js/tests.js index 67261ea8..01840fd5 100755 --- a/front/js/tests.js +++ b/front/js/tests.js @@ -5,24 +5,24 @@ function lockDatabase(delay=20) { url: 'php/server/dbHelper.php', // Replace with the actual path to your PHP file type: 'GET', data: { action: 'lockDatabase', delay: delay }, - success: function(response) { - console.log('Executed'); + success: function(response) { + console.log('Executed'); }, error: function() { - console.log('Error ocurred'); + console.log('Error ocurred'); } }); - let times = delay; + let times = delay; let countdownInterval = setInterval(() => { times--; console.log(`Remaining time: ${times} seconds`); - + if (times <= 0) { clearInterval(countdownInterval); console.log('Countdown finished'); } - }, 1000); + }, 5000); } @@ -52,7 +52,7 @@ const requiredFiles = [ function updateFileStatusUI(file, status) { const item = $(`#file-${file.replace(/[^a-z0-9]/gi, '-')}`); const icon = item.find('span.icon-wrap'); - + if (status === 'ok') { icon.html(''); } else if (status === 'fail') { @@ -61,7 +61,7 @@ const requiredFiles = [ icon.html(''); } } - + function checkAppInitializedJson() { requiredFiles.forEach(file => { @@ -77,17 +77,17 @@ const requiredFiles = [ updateFileStatusUI(file, 'fail'); }); }); - + const allOk = requiredFiles.every(file => fileStatus[file] === 'ok'); - + if (allOk) { checkInternalStatusAfterFiles(); } else { - setTimeout(checkAppInitializedJson, 1000); + setTimeout(checkAppInitializedJson, 5000); } } - - + + function checkInternalStatusAfterFiles() { const promises = [ waitForAppInitialized().then(() => { @@ -97,7 +97,7 @@ const requiredFiles = [ fileStatus['isAppInitialized'] = 'fail'; updateFileStatusUI('isAppInitialized', 'fail'); }), - + waitForGraphQLServer().then(() => { fileStatus['isGraphQLServerRunning'] = 'ok'; updateFileStatusUI('isGraphQLServerRunning', 'ok'); @@ -106,14 +106,14 @@ const requiredFiles = [ updateFileStatusUI('isGraphQLServerRunning', 'fail'); }) ]; - + Promise.allSettled(promises).then(() => { const allPassed = internalChecks.every(key => fileStatus[key] === 'ok'); if (allPassed) { $('#check-status').show(); $('#check-status-plc').hide(); } else { - setTimeout(checkInternalStatusAfterFiles, 1000); + setTimeout(checkInternalStatusAfterFiles, 5000); } }); } @@ -132,8 +132,8 @@ function checkAppInitializedJsonInit() { const allItems = [...requiredFiles, ...internalChecks]; allItems.forEach(file => { - - + + $('#file-check-list').append(`
@@ -151,7 +151,7 @@ function checkAppInitializedJsonInit() { checkAppInitializedJson(); } - + diff --git a/front/maintenance.php b/front/maintenance.php index ceb9ce4a..dc4427ec 100755 --- a/front/maintenance.php +++ b/front/maintenance.php @@ -8,7 +8,7 @@
- + @@ -28,7 +28,7 @@ $nax_db_mod = file_exists($nax_db) ? date ("F d Y H:i:s", filemtime($nax_db)) : // Table sizes ----------------------------------------------------------------- $tableSizesHTML = ""; - + // Open a connection to the SQLite database $db = new SQLite3($nax_db); @@ -46,7 +46,7 @@ while ($row = $result->fetchArray(SQLITE3_ASSOC)) { // Close the database connection $db->close(); - + ?> @@ -55,13 +55,13 @@ $db->close();

- +

-
+
@@ -73,41 +73,41 @@ $db->close();
-
- +
+
-
- +
+
- +
(wal: ) -
+
-
+
-
-
+
+
@@ -118,34 +118,28 @@ $db->close();
@@ -215,13 +209,13 @@ $db->close();
-
+
-
+
@@ -233,7 +227,7 @@ $db->close();
-
+ @@ -257,17 +251,17 @@ $db->close();
-
+
-
-
+
+
- +
@@ -280,20 +274,6 @@ $db->close();
- -
-
-
- - - -
-
-
- - @@ -302,22 +282,22 @@ $db->close();
- + - - + +
- - + + - + ', '', 'Cancel', 'Delete', 'deleteDevicesWithEmptyMACs'); } // ----------------------------------------------------------- function deleteDevicesWithEmptyMACs() -{ +{ // Delete device $.get('php/server/devices.php?action=deleteAllWithEmptyMACs', function(msg) { showMessage (msg); @@ -355,15 +335,15 @@ function deleteDevicesWithEmptyMACs() } // ----------------------------------------------------------- -// delete all devices +// delete all devices function askDeleteAllDevices () { - // Ask + // Ask showModalWarning('', '', '', '', 'deleteAllDevices'); } // ----------------------------------------------------------- function deleteAllDevices() -{ +{ // Delete device $.get('php/server/devices.php?action=deleteAllDevices', function(msg) { showMessage (msg); @@ -372,15 +352,15 @@ function deleteAllDevices() } // ----------------------------------------------------------- -// delete all (unknown) devices +// delete all (unknown) devices function askDeleteUnknown () { - // Ask + // Ask showModalWarning('', '', '', '', 'deleteUnknownDevices'); } // ----------------------------------------------------------- function deleteUnknownDevices() -{ +{ // Execute $.get('php/server/devices.php?action=deleteUnknownDevices', function(msg) { showMessage (msg); @@ -389,15 +369,15 @@ function deleteUnknownDevices() } // ----------------------------------------------------------- -// delete all Events +// delete all Events function askDeleteEvents () { - // Ask + // Ask showModalWarning('', '', '', '', 'deleteEvents'); } // ----------------------------------------------------------- function deleteEvents() -{ +{ // Execute $.get('php/server/devices.php?action=deleteEvents', function(msg) { showMessage (msg); @@ -408,13 +388,13 @@ function deleteEvents() // ----------------------------------------------------------- // delete all Events older than 30 days function askDeleteEvents30 () { - // Ask + // Ask showModalWarning('', '', '', '', 'deleteEvents30'); } // ----------------------------------------------------------- function deleteEvents30() -{ +{ // Execute $.get('php/server/devices.php?action=deleteEvents30', function(msg) { showMessage (msg); @@ -423,14 +403,14 @@ function deleteEvents30() } // ----------------------------------------------------------- -// delete History +// delete History function askDeleteActHistory () { - // Ask + // Ask showModalWarning('', '', '', '', 'deleteActHistory'); } function deleteActHistory() -{ +{ // Execute $.get('php/server/devices.php?action=deleteActHistory', function(msg) { showMessage (msg); @@ -441,7 +421,7 @@ function deleteActHistory() // Import pasted Config ASK function askImportPastedConfig() { - // Add new icon as base64 string + // Add new icon as base64 string showModalInput (' ', '', '', '', 'UploadConfig'); } @@ -449,15 +429,15 @@ function askImportPastedConfig() { // ----------------------------------------------------------- // Upload Settings Config function UploadConfig() -{ +{ appConf = $('#modal-input-textarea').val() // encode for import appConfBase64 = btoa(appConf) // import $.post('php/server/query_replace_config.php', { base64data: appConfBase64, fileName: "app.conf" }, function(msg) { - console.log(msg); - // showMessage(msg); + console.log(msg); + // showMessage(msg); write_notification(`[Maintenance]: ${msg}`, 'interrupt'); }); @@ -466,7 +446,7 @@ function UploadConfig() // ----------------------------------------------------------- // Download Settings Config function DownloadConfig() -{ +{ // Execute openInNewTab("php/server/query_config.php?file=app.conf&download=true") } @@ -475,7 +455,7 @@ function DownloadConfig() // Download Workflows function DownloadWorkflows() -{ +{ // Execute openInNewTab("php/server/query_config.php?file=workflows.json&download=true") } @@ -485,7 +465,7 @@ function DownloadWorkflows() // ----------------------------------------------------------- // Export CSV function ExportCSV() -{ +{ // Execute openInNewTab("php/server/devices.php?action=ExportCSV") } @@ -493,12 +473,12 @@ function ExportCSV() // ----------------------------------------------------------- // Import CSV function askImportCSV() { - // Ask + // Ask showModalWarning('', '', '', '', 'ImportCSV'); } function ImportCSV() -{ +{ // Execute $.get('php/server/devices.php?action=ImportCSV', function(msg) { showMessage (msg); @@ -510,21 +490,21 @@ function ImportCSV() // Import pasted CSV function askImportPastedCSV() { - // Add new icon as base64 string + // Add new icon as base64 string showModalInput (' ', '', '', '', 'ImportPastedCSV'); } function ImportPastedCSV() -{ +{ var csv = $('#modal-input-textarea').val(); console.log(csv); - csvBase64 = utf8ToBase64(csv); + csvBase64 = utf8ToBase64(csv); console.log(csvBase64); - + $.post('php/server/devices.php?action=ImportCSV', { content: csvBase64 }, function(msg) { showMessage(msg); @@ -537,7 +517,7 @@ function ImportPastedCSV() // -------------------------------------------------------- -// Clean log file +// Clean log file var targetLogFile = ""; var logFileAction = ""; @@ -547,17 +527,17 @@ var logFileAction = ""; function logManage(callback) { targetLogFile = arguments[0]; // target logFileAction = arguments[1]; // action - // Ask + // Ask showModalWarning('' + ' ' + arguments[1], '', '', '', "performLogManage"); } // -------------------------------------------------------- -function performLogManage() { +function performLogManage() { // Execute console.log("targetLogFile:" + targetLogFile) console.log("logFileAction:" + logFileAction) - + $.ajax({ method: "POST", url: "php/server/util.php", @@ -572,7 +552,7 @@ function performLogManage() { // -------------------------------------------------------- // scroll down the log areas function scrollDown() { - + var elementToCheck = $("#tab_Logging_id"); // Check if the parent
  • is active @@ -583,14 +563,14 @@ function scrollDown() { $(this).scrollTop(this.scrollHeight); }); } - + } // -------------------------------------------------------- // General initialization // -------------------------------------------------------- -function initializeTabs() { +function initializeTabs() { setTimeout(() => { const key = "activeMaintenanceTab"; @@ -608,7 +588,7 @@ function initializeTabs() { } // update cookie if target specified - if (target) { + if (target) { selectedTab = target.endsWith("_id") ? target : `${target}_id`; setCache(key, selectedTab); // _id is added so it doesn't conflict with AdminLTE tab behavior } @@ -659,15 +639,15 @@ function toggleAutoRefresh() { // Manages the filter application on the logs function applyFilter() { const filterText = $("#logsFilter").val().toLowerCase(); - + $(".logs").each(function() { const originalText = $(this).data('originalText') || $(this).val(); - + if (!$(this).data('originalText')) { $(this).data('originalText', originalText); } - const filteredLines = originalText.split('\n').filter(line => + const filteredLines = originalText.split('\n').filter(line => line.toLowerCase().includes(filterText) ); @@ -692,7 +672,7 @@ function renderLogs(customData) { { scrollDown(); // scroll down the logs } - + }, error: function(xhr, status, error) { console.error('Error fetching infoboxes:', error); diff --git a/front/php/templates/header.php b/front/php/templates/header.php index 5e621cf2..55919a89 100755 --- a/front/php/templates/header.php +++ b/front/php/templates/header.php @@ -1,8 +1,8 @@ @@ -15,7 +15,7 @@ ?> - + @@ -80,7 +80,7 @@ - + - + NetAlertx - + @@ -175,35 +175,35 @@ - - + +
    - + @@ -336,11 +336,11 @@
  • -
  • +
  • -
  • - + + @@ -374,10 +374,6 @@
  • -
  • - -
  • - @@ -408,7 +404,7 @@
  • - + @@ -420,13 +416,13 @@ -