mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
Notification Report page rewrite v0.1📩
This commit is contained in:
@@ -839,41 +839,6 @@ while ($row = $result -> fetchArray (SQLITE3_ASSOC)) {
|
||||
|
||||
modalEventStatusId = 'modal-message-front-event'
|
||||
|
||||
function handleEvent (element){
|
||||
|
||||
// value has to be in format event|param. e.g. run|ARPSCAN
|
||||
value = $(element).attr('data-myevent') + '|'+ $(element).attr('data-myparam-plugin')
|
||||
|
||||
setParameter ('Front_Event', value)
|
||||
|
||||
// show message
|
||||
showModalOk("<?= lang("general_event_title")?>", "<?= lang("general_event_description")?> <code id='"+modalEventStatusId+"'></code>");
|
||||
|
||||
// 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")} <br/> <br/> <code id='${modalEventStatusId}'></code>`);
|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user