From d090b29c5519d8efe6b92ed9d890ed429bdf12a9 Mon Sep 17 00:00:00 2001 From: Jokob-sk Date: Sat, 11 Mar 2023 08:33:43 +1100 Subject: [PATCH] Plugins 0.4 - UI work + bugfixes --- front/php/templates/language/en_us.php | 12 ++-------- front/plugins.php | 32 ++++++++++++++++++-------- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/front/php/templates/language/en_us.php b/front/php/templates/language/en_us.php index 2bddbbd4..dfdda4e4 100755 --- a/front/php/templates/language/en_us.php +++ b/front/php/templates/language/en_us.php @@ -25,6 +25,8 @@ $lang['en_us'] = array( 'Gen_Upd' => 'Updated successfully', 'Gen_Upd_Fail' => 'Update failed', 'Gen_Help' => 'Need help?', +'Gen_DataUpdatedUITakesTime' => 'OK - It may take a while for the UI to update if a scan is runnig.', +'Gen_LockedDB' => 'ERROR - DB might be locked - Check F12 Dev tools -> Console or try later.', ////////////////////////////////////////////////////////////////// // Login Page - Update by @TeroRERO 03ago2022 @@ -667,16 +669,6 @@ The arp-scan time itself depends on the number of IP addresses to check so set t 'NMAP_ARGS_description' => 'Arguments used to run the Nmap scan. Be careful to specify the arguments correctly. For example -p -10000 scans ports from 1 to 10000.', // API -'API_display_name' => 'API', -'API_icon' => '', -'ENABLE_API_name' => 'Enable API', -'ENABLE_API_description' => 'If enabled the app will start publishing and updating simple API endpoints under the /home/pi/pialert/front/api/ folder and thus on the pialert_url/api/File_name url.', -'API_RUN_name' => 'Scheduling updates', -'API_RUN_description' => 'Scheduling settings to specify when the API endpoints should be updated. If set to schedule then endpoints will be updated on a specified cron-like schedule specified by the API_RUN_SCHD setting. Otherwise if set to interval endpoints will be updated every N seconds specified by the API_RUN_INTERVAL setting.', -'API_RUN_SCHD_name' => 'Schedule', -'API_RUN_SCHD_description' => 'Depends on the API_RUN settings to be set to schedule. Make sure you enter the schedule in the correct cron-like format (e.g. validate at crontab.guru).', -'API_RUN_INTERVAL_name' => 'Update interval', -'API_RUN_INTERVAL_description' => 'Depends on the API_RUN settings to be set to interval. The minimum cycle is 5 seconds.', 'API_CUSTOM_SQL_name' => 'Custom endpoint', 'API_CUSTOM_SQL_description' => 'You can specify a custom SQL query which will generate a JSON file and then expose it via the table_custom_endpoint.json file endpoint.', diff --git a/front/plugins.php b/front/plugins.php index e0bf6fbe..055630c7 100755 --- a/front/plugins.php +++ b/front/plugins.php @@ -100,13 +100,13 @@ function saveData (id) { console.log(data) if(sanitize(data) == 'OK') - { - showMessage("Saved") + { + showMessage('') // Remove navigation prompt "Are you sure you want to leave..." window.onbeforeunload = null; } else { - showMessage("ERROR") + showMessage('') } // if (result) { @@ -372,7 +372,9 @@ function generateTabs() } // -------------------------------------------------------- +// handle first tab (objectsTarget_) display var lastPrefix = '' + function initTabs() { // events on tab change @@ -384,19 +386,29 @@ function initTabs() { lastPrefix = target.split('#')[1] } + + everythingHidden = false; - // show the objectsTarget if no specific pane selected or if selected is - - if($('#objectsTarget_'+ lastPrefix).is(":hidden") && $('#eventsTarget_'+ lastPrefix).is(":hidden") && $('#historyTarget_'+ lastPrefix).is(":hidden")) - { - $('#objectsTarget_'+ lastPrefix).show(); - } else + if($('#objectsTarget_'+ lastPrefix) && $('#historyTarget_'+ lastPrefix) && $('#eventsTarget_'+ lastPrefix)) { - $('#objectsTarget_'+ lastPrefix).hide(); + everythingHidden = $('#objectsTarget_'+ lastPrefix).attr('class').includes('active') == false && $('#historyTarget_'+ lastPrefix).attr('class').includes('active') == false && $('#eventsTarget_'+ lastPrefix).attr('class').includes('active') == false; } + // show the objectsTarget if no specific pane selected or if selected is hidden + if((target == '#'+lastPrefix ) && everythingHidden) //|| target == '#objectsTarget_'+ lastPrefix + { + var classTmp = $('#objectsTarget_'+ lastPrefix).attr('class'); + + if($('#objectsTarget_'+ lastPrefix).attr('class').includes('active') == false) + { + console.log('show') + classTmp += ' active'; + $('#objectsTarget_'+ lastPrefix).attr('class', classTmp) + } + } }); } + // -------------------------------------------------------- plugPrefix = '' dbTable = ''