#11262 added new token in modules by status for filter disabled modules

This commit is contained in:
Daniel Cebrian 2023-05-26 08:57:45 +02:00
parent 9f542a42f0
commit 913775c0d3
2 changed files with 29 additions and 1 deletions

View File

@ -1713,6 +1713,7 @@ if (check_login()) {
$length = ($length != '-1') ? $length : '18446744073709551615';
$order = get_datatable_order(true);
$nodes = get_parameter('nodes', 0);
$disabled_modules = (bool) get_parameter('disabled_modules', false);
$where = '';
$recordsTotal = 0;
@ -1737,9 +1738,13 @@ if (check_login()) {
$where .= sprintf(
'tagente_estado.estado IN (%s)
AND tagente_modulo.delete_pending = 0',
$status
$status,
);
if ($disabled_modules === false) {
$where .= ' AND tagente_modulo.disabled = 0';
}
if (is_metaconsole() === false) {
$order_by = '';
switch ($order['field']) {

View File

@ -216,6 +216,10 @@ class ModulesByStatus extends Widget
$values['nodes'] = $decoder['nodes'];
}
if (isset($decoder['disabled_modules']) === true) {
$values['disabled_modules'] = $decoder['disabled_modules'];
}
return $values;
}
@ -248,6 +252,23 @@ class ModulesByStatus extends Widget
],
];
$inputs[] = [
'label' => html_print_div(
[
'class' => 'flex',
'content' => __('Disabled modules').ui_print_help_tip(__('Include disabled modules'), true),
],
true
),
'arguments' => [
'id' => 'disabled_modules',
'name' => 'disabled_modules',
'type' => 'switch',
'value' => ($values['disabled_modules'] === null) ? true : $values['disabled_modules'],
'return' => true,
],
];
// Status fields.
$status_fields = [];
$status_fields[AGENT_MODULE_STATUS_NORMAL] = __('Normal');
@ -356,6 +377,7 @@ class ModulesByStatus extends Widget
$values['status'] = \get_parameter('status', '');
$values['limit'] = \get_parameter('limit', '');
$values['nodes'] = \get_parameter('nodes', '');
$values['disabled_modules'] = \get_parameter_switch('disabled_modules');
return $values;
}
@ -426,6 +448,7 @@ class ModulesByStatus extends Widget
'search' => $this->values['search'],
'status' => $this->values['status'],
'nodes' => $this->values['nodes'],
'disabled_modules' => $this->values['disabled_modules'],
],
'default_pagination' => $this->values['limit'],
'order' => [