Merge branch 'ent-8374-12855-giss-agentes-deshabilitados-en-meta' into 'develop'

Addedd metaconsole tree view filter for disabled agents

See merge request artica/pandorafms!4725
This commit is contained in:
Daniel Rodriguez 2022-03-11 11:38:05 +00:00
commit 185be2ddb8
3 changed files with 19 additions and 3 deletions

View File

@ -167,8 +167,10 @@ class Tree
*/
protected function getDisabledFilter()
{
$only_disabled = (is_metaconsole() === true) ? (int) $this->filter['show_disabled'] : 0;
if (empty($this->filter['showDisabled'])) {
return ' tam.disabled = 0 AND ta.disabled = 0';
return ' tam.disabled = 0 AND ta.disabled = '.$only_disabled;
}
return ' 1 = 1';

View File

@ -311,13 +311,14 @@ class TreeGroup extends Tree
$table = is_metaconsole() ? 'tmetaconsole_agent' : 'tagente';
$table_sec = is_metaconsole() ? 'tmetaconsole_agent_secondary_group' : 'tagent_secondary_group';
$only_disabled = (is_metaconsole() === true) ? (int) $this->filter['show_disabled'] : 0;
$sql_model = "SELECT %s FROM
(
SELECT COUNT(DISTINCT(ta.id_agente)) AS total, id_grupo AS g
FROM $table ta
$module_search_inner
WHERE ta.disabled = 0
WHERE ta.disabled = $only_disabled
%s
$agent_search_filter
$agent_status_filter
@ -330,7 +331,7 @@ class TreeGroup extends Tree
FROM $table ta INNER JOIN $table_sec tasg
ON ta.id_agente = tasg.id_agent
$module_search_inner
WHERE ta.disabled = 0
WHERE ta.disabled = $only_disabled
%s
$agent_search_filter
$agent_status_filter

View File

@ -45,6 +45,8 @@ $group_id = (int) get_parameter('group_id');
$tag_id = (int) get_parameter('tag_id');
$strict_acl = (bool) db_get_value('strict_acl', 'tusuario', 'id_user', $config['id_user']);
$serach_hirearchy = (bool) get_parameter('searchHirearchy', false);
$show_disabled = get_parameter('show_disabled', false);
// ---------------------Tabs -------------------------------------------
$enterpriseEnable = false;
if (enterprise_include_once('include/functions_policies.php') !== ENTERPRISE_NOT_HOOK) {
@ -249,6 +251,10 @@ $row[] = html_print_input_hidden('show_not_init_modules_hidden', $show_not_init_
if (is_metaconsole() === true) {
$table->data[] = $row;
$row = [];
$row[] = __('Show only disabled');
$row[] = html_print_checkbox('show_disabled', $show_disabled, false, true);
$table->data[] = $row;
$row = [];
}
$row[] = html_print_submit_button(__('Filter'), 'uptbutton', false, 'class="sub search"', true);
@ -390,6 +396,13 @@ enterprise_hook('close_meta_frame');
$('#hidden-show_not_init_modules_hidden').val(0);
}
if($("#checkbox-show_disabled").is(':checked')){
parameters['filter']['show_disabled'] = 1;
}
else{
parameters['filter']['show_disabled'] = 0;
}
$.ajax({
type: "POST",
url: "<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",