#12288 fixed spinner in empty page

This commit is contained in:
Daniel Cebrian 2023-10-24 14:18:48 +02:00
parent 0baeee66e0
commit 638ba75894
3 changed files with 34 additions and 18 deletions

View File

@ -5409,7 +5409,7 @@ function html_print_link_with_params($text, $params=[], $type='text', $style='',
$formStyle = ' style="'.$formStyle.'"';
}
$html = '<form method="POST"'.$formStyle.'>';
$html = '<form method="POST"'.$formStyle.' class="link-with-params">';
switch ($type) {
case 'image':
$html .= html_print_input_image($text, $text, $text, $style, true);

View File

@ -554,25 +554,24 @@ if (empty($data)) {
'content' => $resultsTable.$pieGraph,
]
);
$spinner = html_print_div(
[
'content' => '<span></span>',
'class' => 'spinner-fixed inherit',
'style' => 'position: initial;',
],
true
);
html_print_div(
[
'id' => 'spinner',
'content' => '<p class="loading-text">'.__('Loading netflow data, please wait...').'</p>'.$spinner,
'class' => 'invisible',
'style' => 'position: initial;',
]
);
}
$spinner = html_print_div(
[
'content' => '<span></span>',
'class' => 'spinner-fixed inherit',
'style' => 'position: initial;',
],
true
);
html_print_div(
[
'id' => 'spinner',
'content' => '<p class="loading-text">'.__('Loading netflow data, please wait...').'</p>'.$spinner,
'class' => 'invisible',
'style' => 'position: initial;',
]
);
?>
<script>
$(document).ready(function(){
@ -594,9 +593,25 @@ $(document).ready(function(){
});
$('#button-update').on('click', function(){
$('.info_box_information').remove();
$('#content-netflow').remove();
$('#spinner').removeClass("invisible");
});
$('.link-with-params').on('submit', function(e){
setTimeout(() => {
if ($('.info_box_information').length > 0) {
$('.info_box_information').remove();
}
if ($('#content-netflow').length > 0) {
$('#content-netflow').remove();
}
if ($('#spinner').length > 0) {
$('#spinner').removeClass("invisible");
}
}, 100); // Prevent fields from being deleted before being sent.
})
});
// Configure jQuery timepickers.

View File

@ -398,6 +398,7 @@ $(document).ready(function(){
});
$('#button-update_netflow').on('click', function(){
$('.info_box_information').remove();
$('.networkconsole').remove();
$('#spinner').removeClass("invisible");
});