mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-30 01:05:39 +02:00
Added the modules filter
This commit is contained in:
parent
d6c51fb559
commit
e812c55264
@ -34,8 +34,15 @@ if (is_ajax ()) {
|
|||||||
$rootType = get_parameter('rootType', '');
|
$rootType = get_parameter('rootType', '');
|
||||||
$id = get_parameter('id', -1);
|
$id = get_parameter('id', -1);
|
||||||
$rootID = get_parameter('rootID', -1);
|
$rootID = get_parameter('rootID', -1);
|
||||||
$filter = get_parameter('filter', array('searchAgent' => '', 'statusAgent' => AGENT_STATUS_ALL));
|
|
||||||
$childrenMethod = get_parameter('childrenMethod', 'on_demand');
|
$childrenMethod = get_parameter('childrenMethod', 'on_demand');
|
||||||
|
|
||||||
|
$default_filters = array(
|
||||||
|
'searchAgent' => '',
|
||||||
|
'statusAgent' => AGENT_STATUS_ALL,
|
||||||
|
'searchModule' => '',
|
||||||
|
'statusModule' => -1,
|
||||||
|
);
|
||||||
|
$filter = get_parameter('filter', $default_filters);
|
||||||
|
|
||||||
if (class_exists('TreeEnterprise')) {
|
if (class_exists('TreeEnterprise')) {
|
||||||
$tree = new TreeEnterprise($type, $rootType, $id, $rootID, $childrenMethod);
|
$tree = new TreeEnterprise($type, $rootType, $id, $rootID, $childrenMethod);
|
||||||
@ -44,10 +51,7 @@ if (is_ajax ()) {
|
|||||||
$tree = new Tree($type, $rootType, $id, $rootID, $childrenMethod);
|
$tree = new Tree($type, $rootType, $id, $rootID, $childrenMethod);
|
||||||
}
|
}
|
||||||
|
|
||||||
$tree->setFilter(array(
|
$tree->setFilter($filter);
|
||||||
'statusAgent' => $filter['statusAgent'],
|
|
||||||
'searchAgent' => $filter['searchAgent'])
|
|
||||||
);
|
|
||||||
echo json_encode(array('success' => 1, 'tree' => $tree->getArray()));
|
echo json_encode(array('success' => 1, 'tree' => $tree->getArray()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -17,8 +17,10 @@
|
|||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$tab = get_parameter('tab', 'group');
|
$tab = get_parameter('tab', 'group');
|
||||||
$search = get_parameter('search', '');
|
$search_agent = get_parameter('searchAgent', '');
|
||||||
$status = get_parameter('status', AGENT_STATUS_ALL);
|
$status_agent = get_parameter('statusAgent', AGENT_STATUS_ALL);
|
||||||
|
$search_module = get_parameter('searchModule', '');
|
||||||
|
$status_module = get_parameter('statusModule', -1);
|
||||||
|
|
||||||
|
|
||||||
// ---------------------Tabs -------------------------------------------
|
// ---------------------Tabs -------------------------------------------
|
||||||
@ -105,27 +107,46 @@ ui_print_page_header(
|
|||||||
// --------------------- form filter -----------------------------------
|
// --------------------- form filter -----------------------------------
|
||||||
$table = null;
|
$table = null;
|
||||||
$table->width = "100%";
|
$table->width = "100%";
|
||||||
|
$table->data = array();
|
||||||
|
$table->rowspan = array();
|
||||||
|
|
||||||
$table->data[0][0] = __('Agent status');
|
// Agent filter
|
||||||
$fields = array ();
|
$agent_status_arr = array();
|
||||||
$fields[AGENT_STATUS_ALL] = __('All'); //default
|
$agent_status_arr[AGENT_STATUS_ALL] = __('All'); //default
|
||||||
$fields[AGENT_STATUS_NORMAL] = __('Normal');
|
$agent_status_arr[AGENT_STATUS_NORMAL] = __('Normal');
|
||||||
$fields[AGENT_STATUS_WARNING] = __('Warning');
|
$agent_status_arr[AGENT_STATUS_WARNING] = __('Warning');
|
||||||
$fields[AGENT_STATUS_CRITICAL] = __('Critical');
|
$agent_status_arr[AGENT_STATUS_CRITICAL] = __('Critical');
|
||||||
$fields[AGENT_STATUS_UNKNOWN] = __('Unknown');
|
$agent_status_arr[AGENT_STATUS_UNKNOWN] = __('Unknown');
|
||||||
$fields[AGENT_STATUS_NOT_INIT] = __('Not init');
|
$agent_status_arr[AGENT_STATUS_NOT_INIT] = __('Not init');
|
||||||
$table->data[0][1] = html_print_select($fields,
|
|
||||||
"status",
|
$row = array();
|
||||||
$status,
|
$row[] = __('Agent status');
|
||||||
'',
|
$row[] = html_print_select($agent_status_arr, "status_agent", $status_agent, '', '', 0, true);
|
||||||
'',
|
$row[] = __('Search agent');
|
||||||
0,
|
$row[] = html_print_input_text("search_agent", $search_agent, '', 40, 30, true);
|
||||||
true);
|
|
||||||
$table->data[0][2] = __('Search agent');
|
// Button
|
||||||
$table->data[0][3] = html_print_input_text(
|
$row[] = html_print_submit_button(__('Filter'), "uptbutton", false, 'class="sub search"', true);
|
||||||
"search", $search, '', 40, 30, true);
|
$table->rowspan[][count($row)-1] = 2;
|
||||||
$table->data[0][4] = html_print_submit_button(
|
|
||||||
__('Filter'), "uptbutton", false, 'class="sub search"', true);
|
$table->data[] = $row;
|
||||||
|
|
||||||
|
// Module filter
|
||||||
|
$module_status_arr = array();
|
||||||
|
$module_status_arr[-1] = __('All'); //default
|
||||||
|
$module_status_arr[AGENT_MODULE_STATUS_NORMAL] = __('Normal');
|
||||||
|
$module_status_arr[AGENT_MODULE_STATUS_WARNING] = __('Warning');
|
||||||
|
$module_status_arr[AGENT_MODULE_STATUS_CRITICAL_BAD] = __('Critical');
|
||||||
|
$module_status_arr[AGENT_MODULE_STATUS_UNKNOWN] = __('Unknown');
|
||||||
|
$module_status_arr[AGENT_MODULE_STATUS_NOT_INIT] = __('Not init');
|
||||||
|
|
||||||
|
$row = array();
|
||||||
|
$row[] = __('Module status');
|
||||||
|
$row[] = html_print_select($module_status_arr, "status_module", $status_module, '', '', 0, true);
|
||||||
|
$row[] = __('Search module');
|
||||||
|
$row[] = html_print_input_text("search_module", $search_module, '', 40, 30, true);
|
||||||
|
|
||||||
|
$table->data[] = $row;
|
||||||
|
|
||||||
echo '<form id="tree_search" method="post" action="index.php?sec=monitoring&sec2=operation/tree&refr=0&tab='.$tab.'&pure='.$config['pure'].'">';
|
echo '<form id="tree_search" method="post" action="index.php?sec=monitoring&sec2=operation/tree&refr=0&tab='.$tab.'&pure='.$config['pure'].'">';
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
@ -167,8 +188,10 @@ echo "</div>";
|
|||||||
parameters['getChildren'] = 1;
|
parameters['getChildren'] = 1;
|
||||||
parameters['filter'] = {};
|
parameters['filter'] = {};
|
||||||
parameters['type'] = "<?php echo $tab; ?>";
|
parameters['type'] = "<?php echo $tab; ?>";
|
||||||
parameters['filter']['searchAgent'] = $("input#text-search").val();
|
parameters['filter']['searchAgent'] = $("input#text-search_agent").val();
|
||||||
parameters['filter']['statusAgent'] = $("select#status").val();
|
parameters['filter']['statusAgent'] = $("select#status_agent").val();
|
||||||
|
parameters['filter']['searchModule'] = $("input#text-search_module").val();
|
||||||
|
parameters['filter']['statusModule'] = $("select#status_module").val();
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
@ -185,10 +208,7 @@ echo "</div>";
|
|||||||
tree: data.tree,
|
tree: data.tree,
|
||||||
baseURL: "<?php echo ui_get_full_url(false, false, false, false); ?>",
|
baseURL: "<?php echo ui_get_full_url(false, false, false, false); ?>",
|
||||||
ajaxURL: "<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
|
ajaxURL: "<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
|
||||||
filter: {
|
filter: parameters['filter'],
|
||||||
search: parameters['filter']['search'],
|
|
||||||
status: parameters['filter']['status']
|
|
||||||
},
|
|
||||||
counterTitles: {
|
counterTitles: {
|
||||||
total: {
|
total: {
|
||||||
agents: "<?php echo __('Total agents'); ?>",
|
agents: "<?php echo __('Total agents'); ?>",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user