9555-First load, more than 10 elements & Services redirecs agent

This commit is contained in:
Pablo Aragon 2023-04-24 08:27:14 +02:00
parent 4e1c158879
commit d8f4a7a078
4 changed files with 79 additions and 25 deletions

View File

@ -1522,21 +1522,40 @@ class Events
\"json\");
}
let intervalId;
let count = 0;
function getFreeSpace() {
let headerHeight = $('div[data-role=\"header\"].ui-header').outerHeight();
let contentHeight = $('div[data-role=\"content\"].ui-content').outerHeight();
let windowHeight = $(window).height();
let freeSpace = windowHeight - (headerHeight + contentHeight);
if (freeSpace > 0 && count < 50) {
custom_scroll();
} else {
clearInterval(intervalId);
}
count++;
}
$(document).ready(function() {
ajax_load_rows();
$(window).bind(\"scroll\", function () {
custom_scroll();
});
$(window).on(\"touchmove\", function(event) {
custom_scroll();
});
intervalId = setInterval(getFreeSpace, 500);
ajax_load_rows();
$(window).bind(\"scroll\", function () {
custom_scroll();
});
$(window).on(\"touchmove\", function(event) {
custom_scroll();
});
});
function custom_scroll() {
if ($(this).scrollTop() + $(this).height()
>= ($(document).height() - 100)) {
ajax_load_rows();
}
>= ($(document).height() - 100)) {
ajax_load_rows();
}
}
</script>"
);

View File

@ -592,16 +592,16 @@ class Modules
}
$script = '';
if ($system->getRequest('page') === 'modules') {
if ($system->getConfig('metaconsole')) {
$script = 'onclick="openDialog('.$module['id_agente_modulo'].', '.$this->id_agent.' ,'.$module['server_id'].');"';
} else {
$script = 'onclick="openDialog('.$module['id_agente_modulo'].', '.$this->id_agent.', \'node\');"';
}
if ($system->getConfig('metaconsole')) {
$script = 'onclick="openDialog('.$module['id_agente_modulo'].', '.$this->id_agent.' ,'.$module['server_id'].');"';
} else {
$script = 'onclick="openDialog('.$module['id_agente_modulo'].', '.$this->id_agent.', \'node\');"';
}
if ($system->getRequest('page') === 'modules') {
$row[0] = $row[__('Module name')] = '<span '.$script.'><span class="tiny module-status">'.$image_status.'</span>'.'<span class="data module_name">'.ui_print_truncate_text($module['module_name'], 30, false).'</span></span>';
} else {
$row[0] = $row[__('Module name')] = '<span class="tiny module-status">'.$image_status.'</span>'.'<span class="data module_name">'.ui_print_truncate_text($module['module_name'], 30, false).'</span>';
$row[0] = $row[__('Module name')] = '<span class="tiny module-status">'.$image_status.'</span>'.'<span '.$script.' class="data module_name">'.ui_print_truncate_text($module['module_name'], 30, false).'</span>';
}
if ($this->columns['agent']) {
@ -940,8 +940,28 @@ class Modules
$('#module-dialog-button').click();
}
let intervalId;
let count = 0;
function getFreeSpace() {
let headerHeight = $('div[data-role=\"header\"].ui-header').outerHeight();
let contentHeight = $('div[data-role=\"content\"].ui-content').outerHeight();
let windowHeight = $(window).height();
let freeSpace = windowHeight - (headerHeight + contentHeight);
if (freeSpace > 0 && count < 50) {
custom_scroll();
} else {
clearInterval(intervalId);
}
count++;
}
$(document).ready(function() {
intervalId = setInterval(getFreeSpace, 500);
$(window).bind(\"scroll\", function () {
custom_scroll();
});

View File

@ -456,8 +456,27 @@ class ServerStatus
}
}
}
let intervalId;
let count = 0;
function getFreeSpace() {
let headerHeight = $('div[data-role=\"header\"].ui-header').outerHeight();
let contentHeight = $('div[data-role=\"content\"].ui-content').outerHeight();
let windowHeight = $(window).height();
let freeSpace = windowHeight - (headerHeight + contentHeight);
if (freeSpace > 0 && count < 50) {
custom_scroll();
} else {
clearInterval(intervalId);
}
count++;
}
$(document).ready(function() {
intervalId = setInterval(getFreeSpace, 500);
$(window).bind(\"scroll\", function () {
custom_scroll();

View File

@ -178,7 +178,7 @@ class Services
);
$ui->contentAddHtml('<div class="border-collapsible" data-collapsed-icon="group_'.$count.'" data-expanded-icon="group_'.$count.'" data-iconpos="right" data-role="collapsible" data-collapsed="true" data-content-theme="d">');
$arrow = '<span class="ui-icon ui-icon-arrow-d"></span>';
$ui->contentAddHtml('<h4 id="service-'.$service['id'].'" onclick="loadTable(\''.$service['id'].'\')">'.$arrow.$group_icon.'&nbsp;'.$service['description'].'</h4>');
$ui->contentAddHtml('<h4 id="service-'.$service['id'].'" onclick="loadTable(\''.$service['id'].'\')">'.$arrow.$group_icon.'&nbsp;'.$service['name'].'</h4>');
$spinner = '
<div class="spinner mt15px" id="spinner-'.$service['id'].'">
@ -230,9 +230,7 @@ class Services
if ($item->exists() !== true) {
$name .= '<strong class="no-data">'.__('Nonexistent. This element should be deleted').'</strong>';
} else {
$url = ui_get_full_url(
'index.php?sec=eventos&sec2=operation/events/events&event_view_hr=8&severity=4&id_agent='.$item->agent()->id_agente()
);
$url = ui_get_full_url('mobile/index.php?page=agent&id='.$item->agent()->id_agente());
$name = '<a target="_blank" href="'.$url.'">';
if (((bool) $item->agent()->disabled()) === true) {
$disabled_element = true;
@ -339,9 +337,7 @@ class Services
if ($item->exists() !== true) {
$name .= '<strong class="no-data">'.__('Nonexistent. This element should be deleted').'</strong>';
} else {
$url = ui_get_full_url(
'index.php?sec=eventos&sec2=operation/events/events&event_view_hr=8&severity=4&id_agent='.$item->module()->id_agente().'&id_agent_module='.$item->id_agente_modulo()
);
$url = ui_get_full_url('mobile/index.php?page=agent&id='.$item->agent()->id_agente());
$name = '<a target="_blank" href="'.$url.'">';
if (((bool) $item->module()->disabled()) === true) {