From 42b8b97f82fc243752e7c0351492f2e6709e7414 Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Thu, 29 Jan 2015 20:26:46 +0100 Subject: [PATCH 01/12] Fixed an error that made impossible the connection with the metaconsole nodes --- pandora_console/include/ajax/module.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pandora_console/include/ajax/module.php b/pandora_console/include/ajax/module.php index 6e5e937da3..d6218d9843 100755 --- a/pandora_console/include/ajax/module.php +++ b/pandora_console/include/ajax/module.php @@ -79,14 +79,15 @@ if ($get_module_detail) { if (defined ('METACONSOLE')) { $server = metaconsole_get_connection ($server_name); - $conexion = mysql_connect ($server['dbhost'], $server['dbuser'], - $server['dbpass']); - $select_db = mysql_select_db ($server['dbname'], $conexion); + + if (metaconsole_connect($server) != NOERR) + return; + $conexion = false; } else { $conexion = false; } - + html_debug_print($conexion, true); $selection_mode = get_parameter('selection_mode', 'fromnow'); $date_from = (string) get_parameter ('date_from', date ('Y-m-j')); $time_from = (string) get_parameter ('time_from', date ('h:iA')); @@ -266,6 +267,7 @@ if ($get_module_detail) { html_print_table($table); } + metaconsole_restore_db(); return; } From 3b449f378931ff209dc0c39d0533b734123a8483 Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Thu, 29 Jan 2015 20:53:00 +0100 Subject: [PATCH 02/12] Now the the items detail is returned correctly --- pandora_console/include/ajax/tree.ajax.php | 41 +++++++++++----------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/pandora_console/include/ajax/tree.ajax.php b/pandora_console/include/ajax/tree.ajax.php index 13639f97fa..64e1416e7c 100644 --- a/pandora_console/include/ajax/tree.ajax.php +++ b/pandora_console/include/ajax/tree.ajax.php @@ -27,7 +27,7 @@ if (is_ajax ()) { $getChildren = (bool) get_parameter('getChildren', 0); $getGroupStatus = (bool) get_parameter('getGroupStatus', 0); - $get_detail = (bool) get_parameter('getDetail'); + $getDetail = (bool) get_parameter('getDetail'); if ($getChildren) { $type = get_parameter('type', 'group'); @@ -82,35 +82,36 @@ if (is_ajax ()) { return; } - if ($get_detail) { + if ($getDetail) { require_once($config['homedir']."/include/functions_treeview.php"); - // Clean the output - ob_clean(); - $id = (int) get_parameter('id'); $type = (string) get_parameter('type'); $server = array(); if (defined ('METACONSOLE')) { - $server_name = (string) get_parameter('server'); - $server = metaconsole_get_connection($server_name); + $server_id = (int) get_parameter('serverID'); + $server = metaconsole_get_servers($server_id); metaconsole_connect($server); } - switch ($type) { - case 'agent': - treeview_printTable($id, $server); - break; - case 'module': - treeview_printModuleTable($id, $server); - break; - case 'alert': - treeview_printAlertsTable($id, $server); - break; - default: - // Nothing - break; + ob_clean(); + + if (!empty($id) && !empty($type)) { + switch ($type) { + case 'agent': + treeview_printTable($id, $server); + break; + case 'module': + treeview_printModuleTable($id, $server); + break; + case 'alert': + treeview_printAlertsTable($id, $server); + break; + default: + // Nothing + break; + } } if (!empty($server) && defined ('METACONSOLE')) { From 5c8956193dabb8c8dc7fae22c478843e45537dd9 Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Thu, 29 Jan 2015 20:58:33 +0100 Subject: [PATCH 03/12] Improved the tree view styles --- pandora_console/include/styles/tree.css | 53 +++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 4 deletions(-) diff --git a/pandora_console/include/styles/tree.css b/pandora_console/include/styles/tree.css index 2db5b7ae26..b49a1b83d4 100644 --- a/pandora_console/include/styles/tree.css +++ b/pandora_console/include/styles/tree.css @@ -5,7 +5,7 @@ .tree-group { margin-left: 16px; - padding-top: 4px; + padding-top: 1px; } .tree-node { @@ -22,11 +22,16 @@ background: 0 0; } .node-content { - height: 21px; + height: 16px; +} + +.node-content>img { + position: relative; + top: -2px; } .node-content:hover { - background-color: #9AB8DF; + background-color: #FFF; -moz-border-radius: 3px; -webkit-border-radius: 3px; @@ -101,6 +106,7 @@ .tree-node>.node-content>img.module-server-type, .tree-node>.node-content>img.agent-status, .tree-node>.node-content>img.agent-alerts-fired, +.tree-node>.node-content>img.agent-quiet, .tree-node>.node-content>img.module-status { padding-right: 3px; } @@ -122,4 +128,43 @@ font-weight: bold; font-size: 7pt; cursor: default; -} \ No newline at end of file +} + +div.tree-table { + display: table; + width: 98%; + margin-top: 10px; +} + +div.tree-table-row { + display: table-row; +} + +div.tree-table-cell { + display: table-cell; + vertical-align: top; +} + +div.tree-table-cell.tree-table-cell-tree { + /*width: 70%;*/ + max-width: 600px; + overflow-x: auto; + overflow-y: hidden; +} + +div.tree-table-cell.tree-table-cell-detail { + padding-left: 10px; + width: 350px; +} + +div.tree-element-detail-closed { + display: none; +} + +div#tree-controller-recipient { + text-align: left; +} + +div#tree-controller-detail-recipient { + /*text-align: right;*/ +} From 81a844d1f39d090766155a5506e6cf41b9274268 Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Thu, 29 Jan 2015 20:59:28 +0100 Subject: [PATCH 04/12] Fixed the tree item detail output --- pandora_console/operation/tree2.php | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/pandora_console/operation/tree2.php b/pandora_console/operation/tree2.php index 58056ce40c..3f6f21c55f 100644 --- a/pandora_console/operation/tree2.php +++ b/pandora_console/operation/tree2.php @@ -105,7 +105,8 @@ ui_print_page_header( // --------------------- form filter ----------------------------------- -$table = null; +$table = new StdClass(); +// $table->class = "blank"; $table->width = "100%"; $table->data = array(); $table->rowspan = array(); @@ -160,9 +161,18 @@ ui_require_javascript_file("TreeController", "include/javascript/tree/"); html_print_image('images/spinner.gif', false, array('class' => "loading_tree", 'style' => 'display: none;')); -echo "
"; -echo "
"; -echo "
"; + +echo "
"; +echo "
"; +echo "
"; +echo "
"; +echo "
"; +echo "
"; +echo "
"; +echo "
"; +echo "
"; +echo "
"; +echo "
"; echo "
"; ?> From 62cb13cd6c4186d431de1fbe3c80bf2a053a0351 Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Fri, 30 Jan 2015 20:09:38 +0100 Subject: [PATCH 12/12] Removed the tree views test file --- pandora_console/operation/tree2.php | 355 ---------------------------- 1 file changed, 355 deletions(-) delete mode 100644 pandora_console/operation/tree2.php diff --git a/pandora_console/operation/tree2.php b/pandora_console/operation/tree2.php deleted file mode 100644 index 3f6f21c55f..0000000000 --- a/pandora_console/operation/tree2.php +++ /dev/null @@ -1,355 +0,0 @@ - "" . - html_print_image("images/operating_system.png", true, - array("title" => __('OS'))) . "", - 'active' => ($tab == "os")); - -$tabs['group'] = array( - 'text' => "" . - html_print_image("images/group.png", true, - array("title" => __('Groups'))) . "", - 'active' => ($tab == "group")); - -$tabs['module_group'] = array( - 'text' => "" . - html_print_image("images/module_group.png", true, - array("title" => __('Module groups'))) . "", - 'active' => ($tab == "module_group")); - -$tabs['module'] = array( - 'text' => "" . - html_print_image("images/brick.png", true, - array("title" => __('Modules'))) . "", - 'active' => ($tab == "module")); - -$tabs['tag'] = array( - 'text' => "" . - html_print_image("images/tag.png", true, - array("title" => __('Tags'))) . "", - 'active' => ($tab == "tag")); - -if ($enterpriseEnable) { - $tabs['policies'] = array( - 'text' => "" . - html_print_image("images/policies_mc.png", true, - array("title" => __('Policies'))) . "", - 'active' => ($tab == "policies")); -} - -$header_title = ""; -switch ($tab) { - case 'os': - $header_title = - __('Tree view - Sort the agents by OS'); - break; - case 'group': - $header_title = - __('Tree view - Sort the agents by groups'); - break; - case 'module_group': - $header_title = - __('Tree view - Sort the agents by module groups'); - break; - case 'module': - $header_title = - __('Tree view - Sort the agents by modules'); - break; - case 'tag': - $header_title = - __('Tree view - Sort the agents by tags'); - break; -} - -ui_print_page_header( - $header_title, "images/extensions.png", false, "", false, $tabs); -// ---------------------Tabs ------------------------------------------- - - -// --------------------- form filter ----------------------------------- -$table = new StdClass(); -// $table->class = "blank"; -$table->width = "100%"; -$table->data = array(); -$table->rowspan = array(); - -// Agent filter -$agent_status_arr = array(); -$agent_status_arr[AGENT_STATUS_ALL] = __('All'); //default -$agent_status_arr[AGENT_STATUS_NORMAL] = __('Normal'); -$agent_status_arr[AGENT_STATUS_WARNING] = __('Warning'); -$agent_status_arr[AGENT_STATUS_CRITICAL] = __('Critical'); -$agent_status_arr[AGENT_STATUS_UNKNOWN] = __('Unknown'); -$agent_status_arr[AGENT_STATUS_NOT_INIT] = __('Not init'); - -$row = array(); -$row[] = __('Agent status'); -$row[] = html_print_select($agent_status_arr, "status_agent", $status_agent, '', '', 0, true); -$row[] = __('Search agent'); -$row[] = html_print_input_text("search_agent", $search_agent, '', 40, 30, true); - -// Button -$row[] = html_print_submit_button(__('Filter'), "uptbutton", false, 'class="sub search"', true); -$table->rowspan[][count($row)-1] = 2; - -$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 filter ----------------------------------- -ui_include_time_picker(); -ui_require_jquery_file("ui.datepicker-" . get_user_language(), "include/javascript/i18n/"); - -ui_require_javascript_file("TreeController", "include/javascript/tree/"); -html_print_image('images/spinner.gif', false, - array('class' => "loading_tree", - 'style' => 'display: none;')); - -echo "
"; -echo "
"; -echo "
"; -echo "
"; -echo "
"; -echo "
"; -echo "
"; -echo "
"; -echo "
"; -echo "
"; -echo "
"; -echo "
"; -?> - \ No newline at end of file