Treeview improvement

This commit is contained in:
Jose Gonzalez 2023-01-19 00:31:11 +01:00
parent 9356f05056
commit 8510629781
11 changed files with 309 additions and 247 deletions

View File

@ -184,8 +184,6 @@ if (isset($_POST['template_id']) === true) {
// ==========================
// TEMPLATE ASSIGMENT FORM
// ==========================
echo '<form style="margin: 10px" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=template&id_agente='.$id_agente.'">';
$nps = db_get_all_fields_in_table('tnetwork_profile', 'name');
if ($nps === false) {
$nps = [];
@ -196,12 +194,13 @@ foreach ($nps as $row) {
$select[$row['id_np']] = $row['name'];
}
echo '<table width="100%" cellpadding="0" cellspacing="0" class="databox filters" >';
echo "<tr><td class='datos w50p'>";
html_print_select($select, 'template_id', '', '', '', 0, false, false, true, '', false, 'max-width: 200px !important');
echo '</td>';
echo '<td class="datos">';
html_print_div(
$filterTable = new stdClass();
$filterTable->width = '100%';
$filterTable->class = 'fixed_filter_bar';
$filterTable->data = [];
$filterTable->data[0][0] = __('Module templates');
$filterTable->data[1][0] = html_print_select($select, 'template_id', '', '', '', 0, true, false, true, '', false, 'max-width: 200px !important');
$filterTable->data[1][1] = html_print_div(
[
'class' => 'action-buttons',
'content' => html_print_submit_button(
@ -214,13 +213,15 @@ html_print_div(
],
true
),
]
],
true
);
echo '</td>';
echo '</tr>';
echo '</form>';
echo '</table>';
echo '</form>';
$outputFilterTable = '<form style="border:0" class="fixed_filter_bar" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=template&id_agente='.$id_agente.'">';
$outputFilterTable .= html_print_table($filterTable, true);
$outputFilterTable .= '</form>';
echo $outputFilterTable;
// ==========================
// MODULE VISUALIZATION TABLE
@ -288,8 +289,14 @@ foreach ($result as $row) {
}
if (empty($table->data) === false) {
html_print_table($table);
unset($table);
$output = html_print_table($table, true);
} else {
ui_print_empty_data(__('No modules'));
$output = ui_print_empty_data(__('No modules'), '', true);
}
html_print_div(
[
'class' => 'datatable_form',
'content' => $output,
]
);

View File

@ -241,7 +241,7 @@ if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AW')) {
echo "<a href='".$url."' title='Visual console".$favourite_v['name']."' alt='".$favourite_v['name']."'><li>";
echo "<div class='icon_img'>";
echo html_print_image(
'images/groups_small/'.groups_get_icon($favourite_v['id_group']).'.png',
'images/'.groups_get_icon($favourite_v['id_group']).'.png',
true,
['style' => '']
);

View File

@ -570,7 +570,7 @@ if (check_login()) {
}
if (empty($table->data)) {
ui_print_error_message(__('No available data to show'));
ui_print_error_message(__('No available data to showaaaa'));
} else {
ui_pagination(
count($count),

View File

@ -396,13 +396,13 @@ class Tree
$processed_item['rootType'] = $this->rootType;
$processed_item['searchChildren'] = 1;
if (isset($item['type'])) {
if (isset($item['type']) === true) {
$processed_item['type'] = $item['type'];
} else {
$processed_item['type'] = $this->type;
}
if (isset($item['rootType'])) {
if (isset($item['rootType']) === true) {
$processed_item['rootType'] = $item['rootType'];
} else {
$processed_item['rootType'] = $this->rootType;
@ -411,23 +411,23 @@ class Tree
if ($processed_item['type'] == 'group') {
$processed_item['parent'] = $item['parent'];
$processed_item['icon'] = empty($item['icon']) ? 'without_group.png' : $item['icon'].'.png';
$processed_item['icon'] = empty($item['icon']) === true ? 'unknown@groups.svg' : $item['icon'];
}
if (isset($item['iconHTML'])) {
if (isset($item['iconHTML']) === true) {
$processed_item['icon'] = $item['iconHTML'];
}
if (is_metaconsole() && !empty($server)) {
if (is_metaconsole() === true && empty($server) === false) {
$processed_item['serverID'] = $server['id'];
}
$counters = [];
if (isset($item['total_unknown_count'])) {
if (isset($item['total_unknown_count']) === true) {
$counters['unknown'] = $item['total_unknown_count'];
}
if (isset($item['total_critical_count'])) {
if (isset($item['total_critical_count']) === true) {
$counters['critical'] = $item['total_critical_count'];
}

View File

@ -2029,7 +2029,7 @@ function group_get_data(
}
$stats_by_group = [];
if (!empty($data_stats)) {
if (empty($data_stats) === false) {
foreach ($data_stats as $value) {
$group_id = (int) $value['id_grupo'];
@ -2045,47 +2045,47 @@ function group_get_data(
$stats_by_group[$group_id] = $stats;
}
if (!empty($stats_by_group)) {
if (!empty($data_stats_unknown)) {
if (empty($stats_by_group) === false) {
if (empty($data_stats_unknown) === false) {
foreach ($data_stats_unknown as $value) {
$group_id = (int) $value['id_grupo'];
if (isset($stats_by_group[$group_id])) {
if (isset($stats_by_group[$group_id]) === true) {
$stats_by_group[$group_id]['agents_unknown'] = (int) $value['agents_unknown'];
}
}
}
if (!empty($data_stats_not_init)) {
if (empty($data_stats_not_init) === false) {
foreach ($data_stats_not_init as $value) {
$group_id = (int) $value['id_grupo'];
if (isset($stats_by_group[$group_id])) {
if (isset($stats_by_group[$group_id]) === true) {
$stats_by_group[$group_id]['agents_not_init'] = (int) $value['agents_not_init'];
}
}
}
if (!empty($data_stats_ok)) {
if (empty($data_stats_ok) === false) {
foreach ($data_stats_ok as $value) {
$group_id = (int) $value['id_grupo'];
if (isset($stats_by_group[$group_id])) {
if (isset($stats_by_group[$group_id]) === true) {
$stats_by_group[$group_id]['agents_ok'] = (int) $value['agents_ok'];
}
}
}
if (!empty($data_stats_warning)) {
if (empty($data_stats_warning) === false) {
foreach ($data_stats_warning as $value) {
$group_id = (int) $value['id_grupo'];
if (isset($stats_by_group[$group_id])) {
if (isset($stats_by_group[$group_id]) === true) {
$stats_by_group[$group_id]['agents_warning'] = (int) $value['agents_warning'];
}
}
}
if (!empty($data_stats_critical)) {
if (empty($data_stats_critical) === false) {
foreach ($data_stats_critical as $value) {
$group_id = (int) $value['id_grupo'];
if (isset($stats_by_group[$group_id])) {
if (isset($stats_by_group[$group_id]) === true) {
$stats_by_group[$group_id]['agents_critical'] = (int) $value['agents_critical'];
}
}
@ -2097,18 +2097,18 @@ function group_get_data(
foreach ($list_groups as $key => $item) {
$id = $item['id_grupo'];
if (is_metaconsole()) {
// Agent cache
if (is_metaconsole() === true) {
// Agent cache.
$group_stat = [];
if (isset($stats_by_group[$id])) {
if (isset($stats_by_group[$id]) === true) {
$group_stat = $stats_by_group[$id];
}
$list[$i]['_id_'] = $id;
$list[$i]['_name_'] = $item['nombre'];
$list[$i]['_iconImg_'] = html_print_image('images/groups_small/'.groups_get_icon($item['id_grupo']).'.png', true, ['style' => 'vertical-align: middle;']);
$list[$i]['_iconImg_'] = html_print_image('images/'.groups_get_icon($item['id_grupo']).'.png', true, ['style' => 'vertical-align: middle;']);
if ($mode == 'tree' && !empty($item['parent'])) {
if ($mode === 'tree' && empty($item['parent']) === false) {
$list[$i]['_parent_id_'] = $item['parent'];
}
@ -2116,7 +2116,7 @@ function group_get_data(
$list[$i]['_monitors_alerts_fired_'] = isset($group_stat['alerts_fired']) ? $group_stat['alerts_fired'] : 0;
$list[$i]['_total_agents_'] = isset($group_stat['agents_total']) ? $group_stat['agents_total'] : 0;
// This fields are not in database
// This fields are not in database.
$list[$i]['_monitors_ok_'] = isset($group_stat['monitors_ok']) ? $group_stat['monitors_ok'] : 0;
$list[$i]['_monitors_critical_'] = isset($group_stat['monitors_critical']) ? $group_stat['monitors_critical'] : 0;
$list[$i]['_monitors_warning_'] = isset($group_stat['monitors_warning']) ? $group_stat['monitors_warning'] : 0;
@ -2124,7 +2124,7 @@ function group_get_data(
$list[$i]['_monitors_not_init_'] = isset($group_stat['monitors_not_init']) ? $group_stat['monitors_not_init'] : 0;
$list[$i]['_agents_not_init_'] = isset($group_stat['agents_not_init']) ? $group_stat['agents_not_init'] : 0;
if ($mode == 'tactical' || $mode == 'tree') {
if ($mode === 'tactical' || $mode === 'tree') {
$list[$i]['_agents_ok_'] = isset($group_stat['agents_ok']) ? $group_stat['agents_ok'] : 0;
$list[$i]['_agents_warning_'] = isset($group_stat['agents_warning']) ? $group_stat['agents_warning'] : 0;
$list[$i]['_agents_critical_'] = isset($group_stat['agents_critical']) ? $group_stat['agents_critical'] : 0;
@ -2136,11 +2136,11 @@ function group_get_data(
$list[$i]['_total_alerts_'] = $group_stat[0]['alerts'];
}
if ($mode == 'tactical') {
if ($mode === 'tactical') {
// Get total count of monitors for this group, except disabled.
$list[$i]['_monitor_checks_'] = ($list[$i]['_monitors_not_init_'] + $list[$i]['_monitors_unknown_'] + $list[$i]['_monitors_warning_'] + $list[$i]['_monitors_critical_'] + $list[$i]['_monitors_ok_']);
// Calculate not_normal monitors
// Calculate not_normal monitors.
$list[$i]['_monitor_not_normal_'] = ($list[$i]['_monitor_checks_'] - $list[$i]['_monitors_ok_']);
if ($list[$i]['_monitor_not_normal_'] > 0 && $list[$i]['_monitor_checks_'] > 0) {
@ -2155,7 +2155,7 @@ function group_get_data(
$list[$i]['_module_sanity_'] = 100;
}
if (isset($list[$i]['_alerts_'])) {
if (isset($list[$i]['_alerts_']) === true) {
if ($list[$i]['_monitors_alerts_fired_'] > 0 && $list[$i]['_alerts_'] > 0) {
$list[$i]['_alert_level_'] = format_numeric((100 - ($list[$i]['_monitors_alerts_fired_'] / ($list[$i]['_alerts_'] / 100))), 1);
} else {
@ -2177,7 +2177,7 @@ function group_get_data(
$list[$i]['_server_sanity_'] = format_numeric((100 - $list[$i]['_module_sanity_']), 1);
}
if ($returnAllGroup) {
if ($returnAllGroup === true) {
$list[0]['_agents_unknown_'] += $list[$i]['_agents_unknown_'];
$list[0]['_monitors_alerts_fired_'] += $list[$i]['_monitors_alerts_fired_'];
$list[0]['_total_agents_'] += $list[$i]['_total_agents_'];
@ -2188,7 +2188,7 @@ function group_get_data(
$list[0]['_monitors_not_init_'] += $list[$i]['_monitors_not_init_'];
$list[0]['_agents_not_init_'] += $list[$i]['_agents_not_init_'];
if ($mode == 'tactical' || $mode == 'tree') {
if ($mode === 'tactical' || $mode === 'tree') {
$list[0]['_agents_ok_'] += $list[$i]['_agents_ok_'];
$list[0]['_agents_warning_'] += $list[$i]['_agents_warning_'];
$list[0]['_agents_critical_'] += $list[$i]['_agents_critical_'];
@ -2196,7 +2196,7 @@ function group_get_data(
}
}
if ($mode == 'group') {
if ($mode === 'group') {
if (($list[$i]['_agents_unknown_'] == 0) && ($list[$i]['_monitors_alerts_fired_'] == 0)
&& ($list[$i]['_total_agents_'] == 0) && ($list[$i]['_monitors_ok_'] == 0)
&& ($list[$i]['_monitors_critical_'] == 0) && ($list[$i]['_monitors_warning_'] == 0)
@ -2204,7 +2204,7 @@ function group_get_data(
unset($list[$i]);
}
}
} else if (($config['realtimestats'] == 0)) {
} else if (((int) $config['realtimestats'] === 0)) {
$group_stat = db_get_all_rows_sql(
"SELECT *
FROM tgroup_stat, tgrupo
@ -2215,9 +2215,9 @@ function group_get_data(
$list[$i]['_id_'] = $id;
$list[$i]['_name_'] = $item['nombre'];
$list[$i]['_iconImg_'] = html_print_image('images/groups_small/'.groups_get_icon($item['id_grupo']).'.png', true, ['style' => 'vertical-align: middle;']);
$list[$i]['_iconImg_'] = html_print_image('images/'.groups_get_icon($item['id_grupo']).'.png', true, ['style' => 'vertical-align: middle;']);
if ($mode == 'tree' && !empty($item['parent'])) {
if ($mode === 'tree' && empty($item['parent']) === false) {
$list[$i]['_parent_id_'] = $item['parent'];
}
@ -2225,7 +2225,7 @@ function group_get_data(
$list[$i]['_monitors_alerts_fired_'] = $group_stat[0]['alerts_fired'];
$list[$i]['_total_agents_'] = $group_stat[0]['agents'];
// This fields are not in database
// This fields are not in database.
$list[$i]['_monitors_ok_'] = (int) groups_get_normal_monitors($id);
$list[$i]['_monitors_critical_'] = (int) groups_get_critical_monitors($id);
$list[$i]['_monitors_warning_'] = (int) groups_get_warning_monitors($id);
@ -2318,7 +2318,7 @@ function group_get_data(
} else {
$list[$i]['_id_'] = $id;
$list[$i]['_name_'] = $item['nombre'];
$list[$i]['_iconImg_'] = html_print_image('images/groups_small/'.groups_get_icon($item['id_grupo']).'.png', true, ['style' => 'vertical-align: middle;']);
$list[$i]['_iconImg_'] = html_print_image('images/'.groups_get_icon($item['id_grupo']).'.png', true, ['style' => 'vertical-align: middle;']);
if ($mode == 'tree' && !empty($item['parent'])) {
$list[$i]['_parent_id_'] = $item['parent'];

View File

@ -765,7 +765,7 @@ function ui_print_group_icon($id_group, $return=false, $path='', $style='', $lin
*
* @return string HTML code if return parameter is true.
*/
function ui_print_group_icon_path($id_group, $return=false, $path='images/groups_small', $style='', $link=true)
function ui_print_group_icon_path($id_group, $return=false, $path='images', $style='', $link=true)
{
if ($id_group > 0) {
$icon = (string) db_get_value('icon', 'tgrupo', 'id_grupo', (int) $id_group);

View File

@ -326,10 +326,7 @@
id_group: id_group
},
function(data) {
var img = $("<img />").attr(
"src",
"images/groups_small/" + data["icon"] + ".png"
);
var img = $("<img />").attr("src", "images/" + data["icon"]);
$(config.spanPreview)
.append(img)
.fadeIn("fast");

View File

@ -755,7 +755,7 @@ function getGroupIcon(id_group, img_container) {
id_group: id_group
},
success: function(data) {
img_container.attr("src", "images/groups_small/" + data["icon"] + ".png");
img_container.attr("src", "images/" + data["icon"]);
},
error: function() {
img_container.attr("src", "");

View File

@ -648,11 +648,11 @@ var TreeController = {
element.icon.length > 0
) {
$content.append(
'<img src="' +
'<div class="node-icon" style="background-image: url(' +
(controller.baseURL.length > 0 ? controller.baseURL : "") +
"images/groups_small/" +
"images/" +
element.icon +
'" /> '
');" /> </div>'
);
} else if (
typeof element.iconHTML != "undefined" &&
@ -660,7 +660,9 @@ var TreeController = {
) {
$content.append(element.iconHTML + " ");
}
$content.append(element.name);
$content.append(
'<div class="node-name">' + element.name + "</div>"
);
if (typeof element.edit != "undefined") {
var url_edit =
@ -670,7 +672,7 @@ var TreeController = {
var $updateicon = $(
'<img src="' +
(controller.baseURL.length > 0 ? controller.baseURL : "") +
'images/config.png" class="invert_filter" style="width:18px; vertical-align: middle;"/>'
'images/edit.svg" class="invert_filter" style="width:18px; vertical-align: middle;"/>'
);
var $updatebtn = $('<a href = "' + url_edit + '"></a>').append(
$updateicon
@ -686,7 +688,7 @@ var TreeController = {
var $deleteBtn = $(
'<a><img src="' +
(controller.baseURL.length > 0 ? controller.baseURL : "") +
'images/cross.png" class="invert_filter" style="width:18px; vertical-align: middle; cursor: pointer;"/></a>'
'images/delete.svg" class="invert_filter" style="width:18px; vertical-align: middle; cursor: pointer;"/></a>'
);
$deleteBtn.click(function(event) {
var ok_function = function() {
@ -745,7 +747,7 @@ var TreeController = {
(controller.baseURL.length > 0
? controller.baseURL
: "") +
'images/tree_events.png" /> '
'images/event.svg" /> '
);
$eventImage.addClass("agent-alerts-fired");
$eventImage
@ -770,7 +772,7 @@ var TreeController = {
var IPAMSupernetDetailImage = $(
'<img class="invert_filter" src="' +
(controller.baseURL.length > 0 ? controller.baseURL : "") +
'images/transactional_map.png" /> '
'images/server-transactions@svg.svg" /> '
);
if (typeof element.id !== "undefined") {
@ -811,7 +813,7 @@ var TreeController = {
var IPAMNetworkDetailImage = $(
'<img class="invert_filter" src="' +
(controller.baseURL.length > 0 ? controller.baseURL : "") +
'images/list.png" /> '
'images/logs@svg.svg" /> '
);
if (typeof element.id !== "undefined") {
@ -862,7 +864,7 @@ var TreeController = {
(element.title ? element.title : element.name) +
'" data-use_title_for_force_title="1" src="' +
(controller.baseURL.length > 0 ? controller.baseURL : "") +
'images/help.png" class="img_help" ' +
'images/info@svg.svg" class="img_help" ' +
' alt="' +
element.name +
'"/></span> ';
@ -870,7 +872,7 @@ var TreeController = {
var $serviceDetailImage = $(
'<img class="invert_filter" src="' +
(controller.baseURL.length > 0 ? controller.baseURL : "") +
'images/tree_service_map.png" /> '
'images/snmp-trap@svg.svg" /> '
);
if (
@ -931,7 +933,7 @@ var TreeController = {
(controller.baseURL.length > 0
? controller.baseURL
: "") +
'images/tree_events.png" /> '
'images/event.svg" /> '
);
$moduleImage
.click(function(e) {
@ -997,11 +999,12 @@ var TreeController = {
(controller.baseURL.length > 0
? controller.baseURL
: "") +
'images/histograma.png" /> '
'images/event-history.svg" /> '
);
graphImageHistogram
.addClass("module-graph")
.addClass("module-button")
.click(function(e) {
e.stopPropagation();
try {
@ -1027,7 +1030,7 @@ var TreeController = {
(controller.baseURL.length > 0
? controller.baseURL
: "") +
'images/photo.png" /> '
'images/item-icon.svg" /> '
);
} else {
var $graphImage = $(
@ -1035,36 +1038,39 @@ var TreeController = {
(controller.baseURL.length > 0
? controller.baseURL
: "") +
'images/chart_curve.png" /> '
'images/module-graph.svg" /> '
);
}
$graphImage.addClass("module-graph").click(function(e) {
e.stopPropagation();
if (element.statusImageHTML.indexOf("data:image") != -1) {
try {
winopeng_var(
decodeURI(element.snapshot[0]),
element.snapshot[1],
element.snapshot[2],
element.snapshot[3]
);
} catch (error) {
// console.log(error);
$graphImage
.addClass("module-graph")
.addClass("module-button")
.click(function(e) {
e.stopPropagation();
if (element.statusImageHTML.indexOf("data:image") != -1) {
try {
winopeng_var(
decodeURI(element.snapshot[0]),
element.snapshot[1],
element.snapshot[2],
element.snapshot[3]
);
} catch (error) {
// console.log(error);
}
} else {
try {
winopeng_var(
element.moduleGraph.url,
element.moduleGraph.handle,
800,
480
);
} catch (error) {
// console.log(error);
}
}
} else {
try {
winopeng_var(
element.moduleGraph.url,
element.moduleGraph.handle,
800,
480
);
} catch (error) {
// console.log(error);
}
}
});
});
$content.append($graphImage);
}
@ -1077,29 +1083,32 @@ var TreeController = {
(controller.baseURL.length > 0
? controller.baseURL
: "") +
'images/binary.png" /> '
'images/simple-value.svg" /> '
);
$dataImage.addClass("module-data").click(function(e) {
e.stopPropagation();
$dataImage
.addClass("module-data")
.addClass("module-button")
.click(function(e) {
e.stopPropagation();
try {
var serverName =
element.serverName.length > 0
? element.serverName
: "";
if ($("#module_details_window").length > 0)
show_module_detail_dialog(
element.id,
"",
serverName,
0,
86400,
element.name.replace(/&#x20;/g, " ")
);
} catch (error) {
// console.log(error);
}
});
try {
var serverName =
element.serverName.length > 0
? element.serverName
: "";
if ($("#module_details_window").length > 0)
show_module_detail_dialog(
element.id,
"",
serverName,
0,
86400,
element.name.replace(/&#x20;/g, " ")
);
} catch (error) {
// console.log(error);
}
});
$content.append($dataImage);
}
@ -1148,7 +1157,7 @@ var TreeController = {
$content.append(
'<img src="' +
(controller.baseURL.length > 0 ? controller.baseURL : "") +
"images/os_icons/" +
"images/" +
element.icon +
'" /> '
);
@ -1163,7 +1172,7 @@ var TreeController = {
$content.append(
'<img src="' +
(controller.baseURL.length > 0 ? controller.baseURL : "") +
"images/os_icons/" +
"images/" +
element.icon +
'" /> '
);

View File

@ -1,8 +1,28 @@
.tree-root {
border: 1px solid red;
margin-top: 0px;
margin-bottom: 0px;
}
.tree-node img {
padding: 10px;
}
.tree-node .node-icon {
background-position: 10px;
background-repeat: no-repeat;
width: 40px;
height: 38px;
display: inline-block;
box-sizing: border-box;
border-right: 1px solid #aeaeae;
}
.tree-node .node-name {
position: relative;
top: -15px;
}
.tree-group {
margin-left: 24px;
padding-top: 1px;
@ -30,7 +50,12 @@ div.tree-node span {
background: 0 0;
}
.node-content {
height: 26px;
border: 1px solid #aeaeae;
border-radius: 8px;
width: calc(100% - 17px);
box-sizing: border-box;
height: 40px;
/*height: 26px;*/
font-size: 1.2em;
display: flex;
flex-direction: row;
@ -44,16 +69,17 @@ div.tree-node span {
}
.node-content:hover {
background-color: #fff;
background-color: #f5f5f5;
}
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
.node-content:active {
background-color: #dddddd;
}
.leaf-icon {
width: 18px;
height: 20px;
/*height: 20px;*/
height: 35px;
}
.node-content,
@ -105,6 +131,7 @@ div.tree-node span {
.tree-node > .leaf-icon {
background-position: 0px 0px;
background-repeat: no-repeat;
width: 17px;
}
.tree-node > .node-content > img {
@ -115,31 +142,38 @@ div.tree-node span {
.tree-node > .node-content > img.module-data,
.tree-node > .node-content > img.module-graph {
cursor: pointer;
padding-right: 3px;
/*padding-right: 3px;*/
}
.tree-node > .node-content > .agent-status.status_balls,
.tree-node > .node-content > .status_small_balls {
width: 0.6em;
height: 1.5em;
margin-bottom: -0.4em;
width: 1.5em;
border-radius: 0;
border-top-left-radius: 6px;
border-bottom-left-radius: 6px;
height: 39px;
position: relative;
top: -2px;
}
.tree-node > .node-content > .module-status.status_small_balls {
width: 0.4em;
top: -8px;
}
.tree-node > .node-content > .module-name {
margin: 0 0 0 1em;
width: 250px;
/*width: 250px;*/
width: 60%;
display: inline-block;
font-weight: bold;
}
.tree-node > .node-content > .module-value {
width: 120px;
/*width: 120px;*/
width: 130px;
display: inline-block;
text-align: right;
margin: 0 1em;
margin: 8px 1em;
float: right;
}
.tree-node > .node-content > img.module-server-type,
@ -158,6 +192,10 @@ div.tree-node span {
.tree-node > .node-content > .tree-node-counters {
font-size: 1.2em;
float: right;
position: relative;
top: 8px;
right: 10px;
}
.tree-node > .node-content > img {
@ -172,13 +210,15 @@ div.tree-node span {
div#tree-controller-recipient {
text-align: left;
width: 98%;
width: 65%;
/* width: 98%; */
margin-top: 10px;
}
.tree-controller-recipient {
text-align: left;
width: 98%;
width: 65%;
/* width: 98%; */
margin-top: 10px;
}
@ -193,3 +233,23 @@ div#tree-controller-recipient {
.ipam-network {
font-size: 9pt;
}
.tree-group .node-content {
position: relative;
top: -10px;
}
.tree-group .node-content.module {
top: -12px;
}
.node-content .module-button {
margin-top: 5px;
padding: 6px;
}
.node-content .module-button:hover {
width: 20px;
background-color: #fff;
border-radius: 8px;
}

View File

@ -14,7 +14,7 @@
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
* Copyright (c) 2005-2023 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -194,110 +194,15 @@ if (is_metaconsole() === false) {
// --------------------- form filter -----------------------------------
$table = new StdClass();
$table->width = '100%';
$table->class = 'databox filters';
$table->class = 'filter_table';
$table->cellstyle['captions_agent_row'][0] = 'width: 0';
$table->cellstyle['captions_agent_row'][1] = 'width: 200px';
$table->cellstyle['captions_agent_row'][2] = 'width: 200px';
$table->data = [];
$table->rowspan = [];
$table->style[0] = 'font-weight: bold;';
$table->style[2] = 'font-weight: bold;';
$table->size = [];
$table->size[0] = '10%';
$table->size[1] = '20%';
$table->size[2] = '10%';
$table->size[3] = '5%';
$table->size[4] = '10%';
// Agent filter
$agent_status_arr = [];
$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 = [];
$row[] = __('Search group');
$row[] = html_print_input_text('search_group', $search_group, '', 25, 30, true);
if (is_metaconsole()) {
$row[] = __('Show not init modules');
$row[] = html_print_checkbox('show_not_init_modules', $show_not_init_modules, true, true);
}
$table->data[] = $row;
$row = [];
$row[] = __('Search agent');
$row[] = html_print_input_text('search_agent', $search_agent, '', 25, 30, true);
$row[] = __('Show not init agents');
$row[] = html_print_checkbox('show_not_init_agents', $show_not_init_agents, true, true);
if (is_metaconsole() === true) {
$table->data[] = $row;
$row = [];
}
$row[] = __('Show full hirearchy');
$row[] = html_print_checkbox('serach_hirearchy', $serach_hirearchy, false, true);
$row[] = __('Agent status');
$row[] = html_print_select($agent_status_arr, 'status_agent', $status_agent, '', '', 0, true, false, true, '', false, 'width:10em');
$row[] = html_print_input_hidden('show_not_init_modules_hidden', $show_not_init_modules, true);
// Button.
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,
[
'icon' => 'search',
'mode' => 'secondary mini',
],
true
);
$table->data[] = $row;
if (!is_metaconsole()) {
// Module filter
$module_status_arr = [];
$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 = [];
$row[] = __('Search module');
$row[] = html_print_input_text('search_module', $search_module, '', 25, 30, true);
$row[] = __('Show not init modules');
$row[] = html_print_checkbox('show_not_init_modules', $show_not_init_modules, true, true);
$row[] = '';
$row[] = '';
$row[] = __('Module status');
$row[] = html_print_select($module_status_arr, 'status_module', $status_module, '', '', 0, true);
$table->data[] = $row;
}
if (is_metaconsole()) {
$table->width = '96%';
$table->cellpadding = '0';
$table->cellspacing = '0';
@ -305,16 +210,96 @@ if (is_metaconsole()) {
$table->styleTable = 'padding:0px;margin-bottom:0px; ';
}
// Agent filter.
$agent_status_arr = [];
$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');
$table->data['captions_group_row'][] = __('Search group');
$table->data['inputs_group_row'][] = html_print_input_text('search_group', $search_group, '', 25, 30, true);
if (is_metaconsole() === true) {
$table->data['captions_group_row'][] = __('Show not init modules');
$table->data['inputs_group_row'][] = html_print_checkbox('show_not_init_modules', $show_not_init_modules, true, true);
}
$table->data['captions_agent_row'][] = __('Search agent');
$table->data['captions_agent_row'][] = __('Show not init agents');
$table->data['captions_agent_row'][] = __('Show full hirearchy');
$table->data['captions_agent_row'][] = __('Agent status');
$table->data['inputs_agent_row'][] = html_print_input_text('search_agent', $search_agent, '', 25, 30, true);
$table->data['inputs_agent_row'][] = html_print_checkbox_switch('show_not_init_agents', $show_not_init_agents, true, true);
$table->data['inputs_agent_row'][] = html_print_checkbox_switch('serach_hirearchy', $serach_hirearchy, false, true);
$table->data['inputs_agent_row'][] = html_print_select($agent_status_arr, 'status_agent', $status_agent, '', '', 0, true, false, true, '', false, 'width:10em').html_print_input_hidden('show_not_init_modules_hidden', $show_not_init_modules, true);
// Button.
if (is_metaconsole() === true) {
$table->data['captions_disabled_row'][] = __('Show only disabled');
$table->data['inputs_disabled_row'][] = html_print_checkbox('show_disabled', $show_disabled, false, true);
}
if (is_metaconsole() === false) {
// Module filter.
$module_status_arr = [];
$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');
$table->data['captions_last_row'][] = __('Search module');
$table->data['inputs_last_row'][] = html_print_input_text('search_module', $search_module, '', 25, 30, true);
$table->data['captions_last_row'][] = __('Show not init modules');
$table->data['inputs_last_row'][] = html_print_checkbox_switch('show_not_init_modules', $show_not_init_modules, true, true);
$table->data['captions_last_row'][] = __('Module status');
$table->data['inputs_last_row'][] = html_print_select($module_status_arr, 'status_module', $status_module, '', '', 0, true);
}
$table->data['inputs_last_row'][] = html_print_div(
[
'class' => 'action-buttons',
'content' => html_print_submit_button(
__('Filter'),
'uptbutton',
false,
[
'icon' => 'search',
'mode' => 'secondary mini',
],
true
),
],
true
);
$form_html = '<form id="tree_search" method="post" action="index.php?sec=monitoring&sec2=operation/tree&refr=0&tab='.$tab.'&pure='.$config['pure'].'">';
$form_html .= html_print_table($table, true);
$form_html .= '</form>';
if (is_metaconsole()) {
if (is_metaconsole() === true) {
echo "<div class='view_tree'>";
ui_toggle($form_html, __('Show Options'));
ui_toggle($form_html, '<span class="subsection_header_title">'.__('Show Options').'</span>');
echo '<br>';
} else {
// echo "<br>";
ui_toggle($form_html, __('Tree search'));
ui_toggle(
$form_html,
'<span class="subsection_header_title">'.__('Tree search').'</span>',
'tree_search',
false,
true,
false,
'box-shadow agent_details_col',
'white-box-content',
'mrgn_lft_20px mrgn_right_20px width_available'
);
}
html_print_input_hidden('group-id', $group_id);
@ -335,8 +320,12 @@ html_print_image(
]
);
echo "<div id='tree-controller-recipient'>";
echo '</div>';
html_print_div(
[
'id' => 'tree-controller-recipient',
'content' => '',
]
);
if (is_metaconsole() === true) {
echo '</div>';