#10347 added modal in heatmap agent

This commit is contained in:
Daniel Cebrian 2023-03-02 11:10:37 +01:00
parent ea51399460
commit a4a5650a01
5 changed files with 100 additions and 19 deletions

View File

@ -160,7 +160,7 @@ ui_toggle(
echo '</td>';
echo '</tr>';
echo '</table>';
echo '<div id="modal-info-agent"></div>'
?>
<script type="text/javascript">

View File

@ -2464,7 +2464,6 @@ function groups_get_heat_map_agents(array $id_group, float $width=0, float $heig
$sql = 'SELECT * FROM tagente WHERE id_grupo IN('.implode(',', $id_group).')';
$all_agents = db_get_all_rows_sql($sql);
hd($sql, true);
if (empty($all_agents)) {
return null;
}
@ -2806,20 +2805,4 @@ function groups_get_stats_modules_status($id_groups, $graph_width=250, $graph_he
}
return $output;
}
function groups_get_agents_group($id_groups)
{
global $config;
if (is_array($id_groups) === false) {
$id_groups = [$id_groups];
}
if ($rows === false) {
$rows = [];
}
return $rows;
}

View File

@ -1 +1,18 @@
function showInfoAgent(id_agent) {}
/* global $ */
function showInfoAgent(id_agent) {
load_modal({
target: $("#modal-info-agent"),
url: "ajax.php",
modal: {
title: "Info agent",
cancel: "close"
},
onshow: {
page: "include/ajax/group",
method: "loadInfoAgent",
extradata: {
idAgent: id_agent
}
}
});
}

View File

@ -47,6 +47,7 @@ class Group extends Entity
'getGroupsForSelect',
'distributionBySoGraph',
'groupEventsByAgent',
'loadInfoAgent',
];
@ -505,4 +506,74 @@ class Group extends Entity
}
public static function loadInfoAgent()
{
$extradata = get_parameter('extradata', '');
echo '<div class="info-agent">';
if (empty($extradata) === false) {
$extradata = json_decode(io_safe_output($extradata), true);
$agent = agents_get_agent($extradata['idAgent']);
if (is_array($agent)) {
$status_img = agents_tree_view_status_img(
$agent['critical_count'],
$agent['warning_count'],
$agent['unknown_count'],
$agent['total_count'],
$agent['notinit_count']
);
$table = new \stdClass();
$table->class = 'table_modal_alternate';
$table->data = [
[
__('Id'),
$agent['id_agente'],
],
[
__('Agent name'),
'<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=main&id_agente='.$agent['id_agente'].'"><b>'.$agent['nombre'].'</b></a>',
],
[
__('Alias'),
$agent['alias'],
],
[
__('Ip Address'),
$agent['direccion'],
],
[
__('Status'),
$status_img,
],
[
__('Group'),
groups_get_name($agent['id_grupo']),
],
[
__('Interval'),
$agent['intervalo'],
],
[
__('Operative system'),
get_os_name($agent['id_os']),
],
[
__('Server name'),
$agent['server_name'],
],
[
__('Description'),
$agent['comentarios'],
],
];
html_print_table($table);
}
}
echo '</div>';
}
}

View File

@ -13,3 +13,13 @@
rect {
cursor: pointer;
}
.info-agent {
width: 100%;
max-height: 400px;
}
.info-agent table {
width: 100%;
}
#modal-info-agent {
display: none;
}