Styles review

This commit is contained in:
fbsanchez 2019-05-27 19:00:48 +02:00
parent f0fb6d7fd9
commit 5be124f315
22 changed files with 1028 additions and 374 deletions

View File

@ -1,17 +1,32 @@
<?php
/**
* Extension to schedule tasks on Pandora FMS Console
*
* @category Agent editor/ builder.
* @package Pandora FMS
* @subpackage Classic agent management view.
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2019 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
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2010 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
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global vars
// Begin.
enterprise_include('godmode/agentes/agent_manager.php');
require_once 'include/functions_clippy.php';
@ -30,23 +45,19 @@ if (is_ajax()) {
$id_agent = (int) get_parameter('id_agent');
$string = (string) get_parameter('q');
// q is what autocomplete plugin gives
// Field q is what autocomplete plugin gives.
$filter = [];
switch ($config['dbtype']) {
case 'mysql':
case 'postgresql':
$filter[] = '(nombre COLLATE utf8_general_ci LIKE "%'.$string.'%" OR direccion LIKE "%'.$string.'%" OR comentarios LIKE "%'.$string.'%" OR alias LIKE "%'.$string.'%")';
break;
case 'oracle':
$filter[] = '(upper(nombre) LIKE upper(\'%'.$string.'%\') OR upper(direccion) LIKE upper(\'%'.$string.'%\') OR upper(comentarios) LIKE upper(\'%'.$string.'%\') OR upper(alias) LIKE upper(\'%'.$string.'%\'))';
break;
}
$filter[] = '(nombre COLLATE utf8_general_ci LIKE "%'.$string.'%" OR direccion LIKE "%'.$string.'%" OR comentarios LIKE "%'.$string.'%" OR alias LIKE "%'.$string.'%")';
$filter[] = 'id_agente != '.$id_agent;
$agents = agents_get_agents($filter, ['id_agente', 'nombre', 'direccion']);
$agents = agents_get_agents(
$filter,
[
'id_agente',
'nombre',
'direccion',
]
);
if ($agents === false) {
$agents = [];
}
@ -768,6 +779,7 @@ $table->head = [];
$table->style = [];
$table->style[0] = 'font-weight: bold;';
$table->data = [];
$table->rowstyle = [];
$fields = db_get_all_fields_in_table('tagent_custom_fields');
@ -775,6 +787,7 @@ if ($fields === false) {
$fields = [];
}
$i = 0;
foreach ($fields as $field) {
$id_custom_field = $field['id_field'];
@ -806,6 +819,10 @@ foreach ($fields as $field) {
$custom_value = '';
}
if (!empty($custom_value)) {
$table->rowstyle[($i + 1)] = 'display: table-row;';
}
if ($field['is_password_type']) {
$data_field[1] = html_print_input_text_extended(
'customvalue_'.$field['id_field'],
@ -853,16 +870,24 @@ foreach ($fields as $field) {
);
};
$table->rowid[] = 'name_field-'.$id_custom_field;
array_push($table->data, $data);
$table->rowid[] = 'name_field-'.$i;
$table->data[] = $data;
$table->rowid[] = 'field-'.$id_custom_field;
array_push($table->data, $data_field);
$table->rowid[] = 'field-'.($i + 1);
$table->data[] = $data_field;
$i += 2;
}
if (!empty($fields)) {
echo '<div class="ui_toggle">';
ui_toggle(html_print_table($table, true), __('Custom fields'), '', true, false, 'white_box white_box_opened');
ui_toggle(
html_print_table($table, true),
__('Custom fields'),
'',
true,
false,
'white_box white_box_opened'
);
echo '</div>';
}

View File

@ -575,20 +575,24 @@ if ($id_agente) {
}
$help_header = '';
$tab_name = '';
// This add information to the header.
switch ($tab) {
case 'main':
$tab_description = '- '.__('Setup');
$help_header = 'main_tab';
$tab_name = 'Setup';
break;
case 'collection':
$tab_description = '- '.__('Collection');
$tab_name = 'Collection';
break;
case 'inventory':
$tab_description = '- '.__('Inventory');
$help_header = 'inventory_tab';
$tab_name = 'Inventory';
break;
case 'plugins':
@ -599,6 +603,7 @@ if ($id_agente) {
case 'module':
$type_module_t = get_parameter('moduletype', '');
$tab_description = '- '.__('Modules');
$tab_name = 'Modules';
if ($type_module_t == 'webux') {
$help_header = 'wux_console';
} else {
@ -609,10 +614,12 @@ if ($id_agente) {
case 'alert':
$tab_description = '- '.__('Alert');
$help_header = 'manage_alert_list';
$tab_name = 'Alerts';
break;
case 'template':
$tab_description = '- '.__('Templates');
$tab_name = 'Module templates';
break;
case 'gis':
@ -633,16 +640,19 @@ if ($id_agente) {
case 'snmp_explorer':
$tab_description = '- '.__('SNMP Wizard');
$help_header = 'agent_snmp_explorer_tab';
$tab_name = 'SNMP Wizard';
break;
case 'snmp_interfaces_explorer':
$tab_description = '- '.__('SNMP Interfaces wizard');
$help_header = 'agent_snmp_interfaces_explorer_tab';
$tab_name = 'SNMP Interfaces wizard';
break;
case 'wmi_explorer':
$tab_description = '- '.__('WMI Wizard');
$help_header = 'agent_snmp_wmi_explorer_tab';
$tab_name = 'WMI Wizard';
break;
default:
@ -682,7 +692,7 @@ if ($id_agente) {
'',
$config['item_title_size_text'],
'',
''
__('Resources').ui_print_breadcrums($tab_name)
);
} else {
// Create agent.
@ -691,7 +701,13 @@ if ($id_agente) {
'images/bricks.png',
false,
'create_agent',
true
true,
'',
false,
'',
GENERIC_SIZE_TEXT,
'',
__('Resources').ui_print_breadcrums('Create agent')
);
}
@ -1222,7 +1238,6 @@ if ($update_module || $create_module) {
// Get macros.
$macros = (string) get_parameter('macros');
$macros_names = (array) get_parameter('macro_name', []);
if (!empty($macros)) {
$macros = json_decode(base64_decode($macros), true);
@ -1233,18 +1248,10 @@ if ($update_module || $create_module) {
$m_hide = $m['hide'];
}
if ($update_module) {
if ($m_hide == '1') {
$macros[$k]['value'] = io_input_password(get_parameter($m['macro'], ''));
} else {
$macros[$k]['value'] = get_parameter($m['macro'], '');
}
if ($m_hide == '1') {
$macros[$k]['value'] = io_input_password(get_parameter($m['macro'], ''));
} else {
if ($m_hide == '1') {
$macros[$k]['value'] = io_input_password($macros_names[$k]);
} else {
$macros[$k]['value'] = $macros_names[$k];
}
$macros[$k]['value'] = get_parameter($m['macro'], '');
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 311 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 251 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 251 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 251 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 B

View File

@ -964,7 +964,7 @@ if (check_login()) {
$title
);
$data[5] = ui_print_status_image($status, $title, true);
$data[5] = ui_print_status_image($status, $title, true, false, false, true);
if (!$show_context_help_first_time) {
$show_context_help_first_time = true;

View File

@ -2479,7 +2479,7 @@ function truncate_negatives(&$element)
* @param bool return or echo flag
* @param bool show_not_init flag
*/
function graph_agent_status($id_agent=false, $width=300, $height=200, $return=false, $show_not_init=false, $data_agents=false)
function graph_agent_status($id_agent=false, $width=300, $height=200, $return=false, $show_not_init=false, $data_agents=false, $donut_narrow_graph=false)
{
global $config;
@ -2545,25 +2545,37 @@ function graph_agent_status($id_agent=false, $width=300, $height=200, $return=fa
$data = [];
}
$out = pie_graph(
$data,
$width,
$height,
__('other'),
ui_get_full_url(false, false, false, false),
'',
$config['fontpath'],
$config['font_size'],
1,
'hidden',
$colors,
0
);
if ($return) {
if ($donut_narrow_graph == true) {
$data_total = array_sum($data);
$out = print_donut_narrow_graph(
$colors,
$width,
$height,
$data,
$data_total
);
return $out;
} else {
echo $out;
$out = pie_graph(
$data,
$width,
$height,
__('other'),
ui_get_full_url(false, false, false, false),
'',
$config['fontpath'],
$config['font_size'],
1,
'hidden',
$colors,
0
);
if ($return) {
return $out;
} else {
echo $out;
}
}
}

View File

@ -2322,7 +2322,7 @@ function modules_get_status($id_agent_module, $db_status, $data, &$status, &$tit
$status = STATUS_MODULE_OK;
$title = __('NORMAL');
} else if ($db_status == AGENT_MODULE_STATUS_UNKNOWN) {
$status = STATUS_AGENT_DOWN;
$status = STATUS_MODULE_UNKNOWN;
$last_status = modules_get_agentmodule_last_status($id_agent_module);
switch ($last_status) {
case AGENT_STATUS_NORMAL:

View File

@ -2844,6 +2844,7 @@ function reporting_event_report_agent(
if ($label != '') {
$label = reporting_label_macro($content, $label);
}
$return['label'] = $label;
if ($event_graph_by_user_validator) {
@ -9627,32 +9628,39 @@ function reporting_tiny_stats($counts_info, $return=false, $type='agent', $separ
$total_count = 0;
}
$out .= '<b>'.'<span id="total_count_'.$uniq_id.'" class="forced_title" style="font-size: 7pt">'.$total_count.'</span>';
$out .= '<div id="bullets_modules">';
// $out .='<span id="total_count_'.$uniq_id.'" class="forced_title" style="font-size: 13pt">'.$total_count.$separator.'</span>';
if (isset($fired_count) && $fired_count > 0) {
$out .= ' '.$separator.' <span class="orange forced_title" id="fired_count_'.$uniq_id.'" style="font-size: 7pt">'.$fired_count.'</span>';
$out .= '<div><div class="bullet_modules orange_background"></div>';
$out .= '<span class="forced_title" id="fired_count_'.$uniq_id.'" style="font-size: 12pt">'.$fired_count.'</span></div>';
}
if (isset($critical_count) && $critical_count > 0) {
$out .= ' '.$separator.' <span class="red forced_title" id="critical_count_'.$uniq_id.'" style="font-size: 7pt">'.$critical_count.'</span>';
$out .= '<div><div class="bullet_modules red_background"></div>';
$out .= '<span class="forced_title" id="critical_count_'.$uniq_id.'" style="font-size: 12pt">'.$critical_count.'</span></div>';
}
if (isset($warning_count) && $warning_count > 0) {
$out .= ' '.$separator.' <span class="yellow forced_title" id="warning_count_'.$uniq_id.'" style="font-size: 7pt">'.$warning_count.'</span>';
$out .= '<div><div class="bullet_modules yellow_background"></div>';
$out .= '<span class="forced_title" id="warning_count_'.$uniq_id.'" style="font-size: 12pt">'.$warning_count.'</span></div>';
}
if (isset($unknown_count) && $unknown_count > 0) {
$out .= ' '.$separator.' <span class="grey forced_title" id="unknown_count_'.$uniq_id.'" style="font-size: 7pt">'.$unknown_count.'</span>';
$out .= '<div><div class="bullet_modules grey_background"></div>';
$out .= '<span class="forced_title" id="unknown_count_'.$uniq_id.'" style="font-size: 12pt">'.$unknown_count.'</span></div>';
}
if (isset($not_init_count) && $not_init_count > 0) {
$out .= ' '.$separator.' <span class="blue forced_title" id="not_init_count_'.$uniq_id.'" style="font-size: 7pt">'.$not_init_count.'</span>';
$out .= '<div><div class="bullet_modules blue_background"></div>';
$out .= '<span class="forced_title" id="not_init_count_'.$uniq_id.'" style="font-size: 12pt">'.$not_init_count.'</span></div>';
}
if (isset($normal_count) && $normal_count > 0) {
$out .= ' '.$separator.' <span class="green forced_title" id="normal_count_'.$uniq_id.'" style="font-size: 7pt">'.$normal_count.'</span>';
$out .= '<div><div class="bullet_modules green_background"></div>';
$out .= '<span class="forced_title" id="normal_count_'.$uniq_id.'" style="font-size: 12pt">'.$normal_count.'</span></div>';
}
$out .= '</b>';
$out .= '</div>';
if ($return) {
return $out;

View File

@ -2408,8 +2408,37 @@ function ui_get_status_images_path()
*
* @return string HTML code if return parameter is true.
*/
function ui_print_status_image($type, $title='', $return=false, $options=false, $path=false)
function ui_print_status_image($type, $title='', $return=false, $options=false, $path=false, $rounded_image=false)
{
// This is for the List of Modules in Agent View
if ($rounded_image === true) {
switch ($type) {
case 'module_ok.png':
$type = 'module_ok_rounded.png';
break;
case 'module_critical.png':
$type = 'module_critical_rounded.png';
break;
case 'module_warning.png':
$type = 'module_warning_rounded.png';
break;
case 'module_no_data.png':
$type = 'module_no_data_rounded.png';
break;
case 'module_unknown.png':
$type = 'module_unknown_rounded.png';
break;
default:
$type = $type;
break;
}
}
if ($path === false) {
$imagepath_array = ui_get_status_images_path();
$imagepath = $imagepath_array[0];
@ -2750,16 +2779,21 @@ function ui_get_full_url($url='', $no_proxy=false, $add_name_php_file=false, $me
/**
* Return a standard page header (Pandora FMS 3.1 version)
*
* @param string Title
* @param string Icon path
* @param boolean Return (false will print using a echo)
* @param boolean help (Help ID to print the Help link)
* @param boolean Godmode (false = operation mode).
* @param string Options (HTML code for make tabs or just a brief info string
* @param string $title Title.
* @param string $icon Icon path.
* @param boolean $return Return (false will print using a echo).
* @param boolean $help Help (Help ID to print the Help link).
* @param boolean $godmode Godmode (false = operation mode).
* @param string $options Options (HTML code for make tabs or just a brief
* info string.
* @param mixed $modal Modal.
* @param mixed $message Message.
* @param mixed $numChars NumChars.
* @param mixed $alias Alias.
* @param mixed $breadcrumbs Breadcrumbs.
*
* @return string Header HTML
*/
function ui_print_page_header(
$title,
$icon='',
@ -2795,31 +2829,8 @@ function ui_print_page_header(
$buffer = '<div id="'.$type2.'" style="">';
if (!empty($breadcrumbs)) {
if (is_array($breadcrumbs)) {
$bc = [];
$i = 0;
foreach ($breadcrumbs as $content) {
if ($content['selected'] == 1) {
$class = 'selected';
} else {
$class = '';
}
$bc[$i] = '';
$bc[$i] .= '<span><a class="breadcrumb_link '.$class.'" href="'.$content['link'].'">';
$bc[$i] .= $content['label'];
$bc[$i] .= '</a>';
$bc[$i] .= '</span>';
$i++;
}
$buffer .= implode(
'<span class="breadcrumb_link">&nbsp/&nbsp</span>',
$this->breadcrum
);
} else {
$buffer .= '<div class="breadcrumbs_container">'.$breadcrumbs.'</div>';
}
$buffer .= '<div class="menu_tab_left_bc">';
$buffer .= '<div class="breadcrumbs_container">'.$breadcrumbs.'</div>';
}
$buffer .= '<div id="menu_tab_left">';
@ -2859,6 +2870,10 @@ function ui_print_page_header(
$buffer .= '</li></ul></div>';
if (!empty($breadcrumbs)) {
$buffer .= '</div>';
}
if (is_array($options)) {
$buffer .= '<div id="menu_tab"><ul class="mn">';
foreach ($options as $key => $option) {
@ -4482,3 +4497,20 @@ function ui_get_sorting_arrows($url_up, $url_down, $selectUp, $selectDown)
<a href="'.$url_down.'">'.html_print_image($arrow_down, true, ['alt' => 'down']).'</a>
</span>';
}
/**
* Show breadcrums in the page titles
*
* @return string HTML anchor with the name of the section.
*/
function ui_print_breadcrums($tab_name)
{
if ($tab_name != '') {
$section = str_replace('_', ' ', $tab_name);
$section = ucwords($section);
$section = ' / <span class="breadcrumb_active">'.___($section).'</span>';
}
return $section;
}

View File

@ -720,3 +720,35 @@ function print_clock_digital_1($time_format, $timezone, $clock_animation, $width
return $output;
}
function print_donut_narrow_graph($colors, $width, $height, $data, $data_total)
{
if (empty($data)) {
return graph_nodata_image($width, $height, 'pie');
}
$data = json_encode($data);
$data = json_decode(json_encode($data));
$colors = json_encode($colors);
$colors = json_decode(json_encode($colors));
$series = count($data);
if (($series != count($colors)) || ($series == 0)) {
return;
}
$graph_id = uniqid('graph_');
$out = "<div id='$graph_id'></div>";
$out .= include_javascript_d3(true);
$out .= "<script type='text/javascript'>
donutNarrowGraph($colors, $width, $height, $data_total)
.donutbody(d3.select($graph_id))
.data($data)
.render();
</script>";
return $out;
}

View File

@ -344,9 +344,9 @@ function drawRating($rating, $width, $height, $font, $out_of_lim_str, $mode, $fo
$image = imagecreate($width, $height);
// colors
$back = imagecolorallocate($image, 255, 255, 255);
$back = imagecolorallocate($image, 241, 241, 241);
$bordercolor = imagecolorallocate($image, 174, 174, 174);
$bordercolor = imagecolorallocate($image, 241, 241, 241);
$text = imagecolorallocate($image, 74, 74, 74);
$red = imagecolorallocate($image, 255, 60, 75);
$green = imagecolorallocate($image, 50, 205, 50);
@ -483,7 +483,7 @@ function gd_progress_bar($width, $height, $progress, $title, $font, $out_of_lim_
break;
case 1:
drawRating($progress, $width, $height, $font, $out_of_lim_str, $mode, 6, $value_text, $color);
drawRating($progress, $width, $height, $font, $out_of_lim_str, $mode, 9, $value_text, $color);
break;

View File

@ -2113,8 +2113,7 @@ function print_circular_progress_bar(
var progress = startPercent;
if (transition == 0)
updateProgress(endPercent);
if (transition == 0) updateProgress(endPercent);
else {
(function loops() {
updateProgress(progress);
@ -2762,3 +2761,224 @@ function valueToBytes(value) {
// This will actually do the rounding and the decimals.
return value.toFixed(2) + shorts[pos] + "B";
}
function donutNarrowGraph(colores, width, height, total) {
// Default settings
var donutbody = d3.select("body");
var data = {};
// var showTitle = true;
if (width == "") {
width = 180;
}
if (height == "") {
height = 180;
}
var radius = Math.min(width, height) / 2;
var currentVal;
//var color = d3.scale.category20();
var colores_index = [];
var colores_value = [];
$.each(colores, function(index, value) {
colores_index.push(index);
colores_value.push(value);
});
var color = d3.scale
.ordinal()
.domain(colores_index)
.range(colores_value);
var pie = d3.layout
.pie()
.sort(null)
.value(function(d) {
return d.value;
});
var svg, g, arc;
var object = {};
// Method for render/refresh graph
object.render = function() {
if (!svg) {
// Show normal status by default. This variable must be initialized here, before clearing data.
var normal_status = data.Normal;
// Don't draw 0 or invalid values. console.log(data);
var data_map = $.map(data, function(value, index) {
if (value == 0 || isNaN(value)) {
return index;
}
});
$.each(data_map, function(i, val) {
delete data[val];
});
//New data: console.log(data);
arc = d3.svg
.arc()
.outerRadius(radius)
.innerRadius(radius - radius / 2.5);
svg = donutbody
.append("svg")
.attr("width", width)
.attr("height", height)
.append("g")
.attr("transform", "translate(" + width / 2 + "," + height / 2 + ")");
g = svg
.selectAll(".arc")
.data(pie(d3.entries(data)))
.enter()
.append("g")
.attr("class", "arc");
g.append("path")
// Attach current value to g so that we can use it for animation
.each(function(d) {
this._current = d;
})
.attr("d", arc)
.attr("stroke", "white")
.style("stroke-width", 2)
.style("fill", function(d) {
return color(d.data.key);
});
// This is to show labels on the graph
/* g.append("text")
.attr("transform", function(d) {
return "translate(" + arc.centroid(d) + ")";
})
.attr("dy", ".35em")
.style("text-anchor", "middle");
g.select("text").text(function(d) {
return d.data.key;
});*/
// Show normal status by default.
var percentage_normal;
svg
.append("text")
.datum(data)
.attr("x", 0)
.attr("y", 0 + radius / 10)
.attr("class", "text-tooltip")
.style("text-anchor", "middle")
.attr("font-weight", "bold")
.style("font-family", "Arial, Verdana")
//.attr("fill", "#82b92e")
.style("font-size", function(d) {
if (normal_status) {
percentage_normal = (normal_status * 100) / total;
if (Number.isInteger(percentage_normal)) {
percentage_normal = percentage_normal.toFixed(0);
return radius / 3 + "px";
} else {
percentage_normal = percentage_normal.toFixed(1);
return radius / 3.5 + "px";
}
}
})
.text(function(d) {
if (normal_status) {
return percentage_normal + "%";
} else {
return "0%";
}
});
g.on("mouseover", function(obj) {
//console.log(obj);
var percentage;
svg
.select("text.text-tooltip")
// This is to paint the text of the corresponding color.
/* .attr("fill", function(d) {
return color(obj.data.key);
})*/
.style("font-size", function(d) {
percentage = (d[obj.data.key] * 100) / total;
if (Number.isInteger(percentage)) {
percentage = percentage.toFixed(0);
return radius / 3 + "px";
} else {
percentage = percentage.toFixed(1);
return radius / 3.5 + "px";
}
})
.text(percentage + "%");
});
g.on("mouseout", function(obj) {
svg.select("text.text-tooltip").text(function(d) {
if (normal_status) {
return percentage_normal + "%";
} else {
return "0%";
}
});
// .attr("fill", "#82b92e");
});
} else {
g.data(pie(d3.entries(data)))
.exit()
.remove();
g.select("path")
.transition()
.duration(200)
.attrTween("d", function(a) {
var i = d3.interpolate(this._current, a);
this._current = i(0);
return function(t) {
return arc(i(t));
};
});
g.select("text").attr("transform", function(d) {
return "translate(" + arc.centroid(d) + ")";
});
svg.select("text.text-tooltip").datum(data);
}
return object;
};
// Getter and setter methods
object.data = function(value) {
if (!arguments.length) return data;
data = value;
return object;
};
object.donutbody = function(value) {
if (!arguments.length) return donutbody;
donutbody = value;
return object;
};
object.width = function(value) {
if (!arguments.length) return width;
width = value;
radius = Math.min(width, height) / 2;
return object;
};
object.height = function(value) {
if (!arguments.length) return height;
height = value;
radius = Math.min(width, height) / 2;
return object;
};
return object;
}

View File

@ -125,7 +125,6 @@ div.arrow_box:before {
border-top-right-radius: 7px;
border-top-left-radius: 7px;
box-shadow: 0px 0px 2px rgba(0, 0, 0, 0.1);
flex-direction: column;
}
#menu_tab_frame_view_bc .breadcrumbs_container {

View File

@ -1302,7 +1302,8 @@ div.title_line {
* ---------------------------------------------------------------------
*/
#menu_tab_frame,
#menu_tab_frame_view {
#menu_tab_frame_view,
#menu_tab_frame_view_bc {
display: flex;
align-items: flex-end;
justify-content: space-between;
@ -1320,8 +1321,43 @@ div.title_line {
box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.1);
}
/* Breadcrum */
#menu_tab_frame_view_bc {
min-height: 55px;
align-items: unset;
}
#menu_tab_frame_view_bc .breadcrumbs_container {
align-self: flex-start;
}
.menu_tab_left_bc {
flex-direction: column;
display: flex;
justify-content: space-between;
margin-right: 20px;
overflow: hidden;
}
.breadcrumbs_container {
padding-left: 10px;
padding-top: 4px;
text-indent: 0.25em;
color: #848484;
font-size: 10pt !important;
font-family: "lato-bolder", "Open Sans", sans-serif !important;
}
.breadcrumb_active {
color: #82b92e;
font-size: 10pt !important;
font-family: "lato-bolder", "Open Sans", sans-serif !important;
}
/* End - Breadcrum */
#menu_tab {
margin-right: 10px;
min-width: 510px;
}
#menu_tab .mn,
@ -1446,9 +1482,9 @@ div#agent_wizard_subtabs {
#menu_tab_left li.view {
margin-left: 0px !important;
overflow-y: hidden;
padding-left: 10px;
padding-bottom: 4px;
white-space: nowrap;
}
#menu_tab_left li.view img.bottom {
@ -3320,13 +3356,18 @@ div.div_groups_status {
#menu_tab li.nomn_high {
padding-right: 8px;
padding-left: 8px;
padding-top: 6px;
font-weight: bold;
text-decoration: none;
font-size: 14px;
margin-top: 0;
min-width: 30px;
height: 40px;
min-height: 50px;
max-height: 53px;
}
#menu_tab_frame_view_bc #menu_tab li.nomn,
#menu_tab_frame_view_bc #menu_tab li.nomn_high {
min-height: 53px;
}
#menu_tab li:hover {
@ -3342,7 +3383,7 @@ div.div_groups_status {
#menu_tab li.nomn img,
#menu_tab li img {
margin-top: 3px;
margin-top: 10px;
margin-left: 3px;
}
@ -3698,7 +3739,7 @@ ul.events_tabs:after {
ul.events_tabs > li {
margin: 0 !important;
width: 20%;
width: 100%;
text-align: center;
float: none !important;
outline-width: 0;
@ -3707,7 +3748,7 @@ ul.events_tabs > li {
ul.events_tabs > li.ui-state-default {
background: #fff !important;
border: none !important;
border-bottom: 2px solid black !important;
border-bottom: 2px solid #cacaca !important;
}
ul.events_tabs > li a {
@ -4877,7 +4918,7 @@ input:checked + .p-slider:before {
/* New white rounded boxes */
.white_box {
background-color: #fff;
border: 1px solid #f3f3f3;
border: 1px solid #e1e1e1;
border-radius: 5px;
padding: 20px 50px;
}
@ -5569,10 +5610,6 @@ table.info_table.policy_sub_table {
flex-wrap: wrap;
}
.label_simple_items a.tip > img {
margin-bottom: 0px;
}
.label_simple_items > * {
margin-right: 5px;
}
@ -5582,8 +5619,6 @@ table.info_table.policy_sub_table {
font-weight: bold;
padding-right: 10px;
margin: 0px 0px 5px 0px;
padding-top: 0.5em;
padding-bottom: 0.5em;
}
.input_label_simple {
@ -5655,7 +5690,6 @@ table.info_table.policy_sub_table {
.agent_options_column_right {
width: 50%;
box-sizing: border-box;
min-width: 400px;
}
.agent_options_column_left {
@ -5802,7 +5836,7 @@ a#qr_code_agent_view {
.ui_toggle > a:first-child {
background-color: #fff;
border: 1px solid #f3f3f3;
border: 1px solid #e1e1e1;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
margin-bottom: -1px;
@ -5904,3 +5938,201 @@ a#qr_code_agent_view {
padding: 15px;
border-top: none;
}
/*
* ---------------------------------------------------------------------
* - AGENT VIEW
* ---------------------------------------------------------------------
*/
/* First row in agent view */
#agent_details_first_row {
display: flex;
margin-bottom: 20px;
width: 100%;
}
.agent_details_col {
display: table-cell;
background-color: #fff;
border: 1px solid #e2e2e2;
border-radius: 5px;
}
.agent_details_col_left {
width: 38%;
}
.agent_details_col_right {
width: 62%;
margin-left: 20px;
}
.buttons_agent_view {
display: flex;
justify-content: flex-end;
}
.buttons_agent_view a img {
border: 1px solid #dcdcdc;
border-radius: 4px;
padding: 1px;
box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.1);
max-width: 21px;
margin-left: 5px;
}
/* Agent details in agent view */
.agent_details_header {
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: 1px solid #e2e2e2;
padding: 6px 20px;
}
.agent_details_content {
display: flex;
align-items: center;
padding: 20px;
}
.agent_details_agent_name {
display: flex;
align-items: center;
}
.agent_details_graph {
width: 205px;
text-align: center;
}
.agent_details_info {
display: flex;
justify-content: space-around;
}
.agent_details_info p {
display: flex;
align-items: center;
padding-left: 5px;
padding-right: 5px;
}
.agent_details_info img {
padding-right: 5px;
}
.agent_details_bullets #bullets_modules {
display: flex;
flex-direction: column;
align-items: flex-start;
}
.agent_details_bullets #bullets_modules > div {
display: flex;
align-items: center;
padding-bottom: 20px;
}
.agent_details_bullets #bullets_modules > div:last-child {
padding-bottom: 0px;
}
#agent_contact_main tr td img {
max-width: 100%;
}
/* White tables to show graphs */
.white_table_graph {
margin-bottom: 20px;
display: grid;
grid-template-rows: max-content;
}
.white_table_graph_header {
padding: 10px 20px;
background-color: #fff;
color: #000;
border: 1px solid #e2e2e2;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
font-weight: bold;
}
.white_table_graph_header img,
.white_table_graph_header span {
vertical-align: middle;
}
.white_table_graph_header span {
padding-left: 10px;
}
.white_table_graph_content {
border: 1px solid #e2e2e2;
border-top: none;
background-color: #fff;
padding: 20px;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
display: flex;
align-items: center;
}
/* White tables */
.white_table,
.white_table tr:first-child > th {
background-color: #fff;
color: #000;
}
.white_table {
border: 1px solid #e2e2e2;
border-radius: 4px;
margin-bottom: 20px;
}
.white_table thead tr:first-child > th {
border-top-left-radius: 4px;
border-top-right-radius: 4px;
}
.white_table tbody tr:first-child > td {
border-top: 1px solid #e2e2e2;
}
.white_table tbody tr:first-child td {
padding-top: 25px;
}
.white_table tbody tr:last-child td {
padding-bottom: 25px;
}
.white_table tr td:first-child,
.white_table tr th:first-child {
padding-left: 50px;
}
.white_table tr td:last-child,
.white_table tr th:last-child {
padding-right: 50px;
}
.white_table th,
.white_table td {
padding: 10px 20px;
}
.white_table_droppable > thead > tr > th > img {
vertical-align: middle;
}
.white_table_droppable tr th:first-child {
padding-left: 20px;
}
.white_table_no_border {
border: none !important;
}

View File

@ -60,18 +60,6 @@ if (! check_acl_one_of_groups($config['id_user'], $all_groups, 'AR') && ! check_
}
// START: TABLE AGENT BUILD
$table_agent = new stdClass();
$table_agent->id = 'agent_details_main';
$table_agent->width = '95%';
$table_agent->cellspacing = 0;
$table_agent->cellpadding = 0;
$table_agent->class = 'databox filters';
$table_agent->style[0] = 'width: 16px; text-align:center; padding: 0px;';
$table_agent->style[5] = 'width: 16px; text-align:center; padding: 0px;';
$table_agent->styleTable = 'padding:0px;';
$table_agent->data = [];
$data = [];
$agent_name = ui_print_agent_name($agent['id_agente'], true, 500, 'font-size: medium;font-weight:bold', true);
$in_planned_downtime = db_get_sql(
'SELECT executed FROM tplanned_downtime
@ -103,19 +91,13 @@ if ($in_planned_downtime && !$agent['disabled'] && !$agent['quiet']) {
$agent_name .= '&nbsp;'.ui_print_help_tip(__('Agent in planned downtime'), true, 'images/minireloj-16.png').'</em>';
}
$table_agent_header = '<div class="agent_details_agent_name">';
if (!$config['show_group_name']) {
$data[0] = ui_print_group_icon($agent['id_grupo'], true);
} else {
$data[0] = '';
$table_agent_header .= ui_print_group_icon($agent['id_grupo'], true, 'groups_small', 'padding-right: 6px;');
}
$table_agent->cellstyle[count($table_agent->data)][0] = 'width: 16px; text-align:center; padding: 0px;';
$data[2] = $agent_name;
$table_agent->colspan[count($table_agent->data)][2] = 3;
$table_agent->cellstyle[count($table_agent->data)][2] = 'width: 100px; word-break: break-all;';
$table_agent_header .= $agent_name;
$table_agent_header .= '</div>';
$status_img = agents_detail_view_status_img(
$agent['critical_count'],
@ -124,39 +106,19 @@ $status_img = agents_detail_view_status_img(
$agent['total_count'],
$agent['notinit_count']
);
$data[2] .= '&nbsp;&nbsp;'.$status_img;
$table_agent->data[] = $data;
$table_agent->rowclass[] = '';
$table_agent_header .= '<div class="icono_right">'.$status_img.'</div>';
$data = [];
// $data[0] = reporting_tiny_stats ($agent, true, 'agent', '<div style="height: 5px;"></div>');
// $table_agent->rowspan[count($table_agent->data)][0] = 6;
// Fixed width non interactive charts
$status_chart_width = 150;
$graph_width = 150;
$status_chart_width = 180;
$graph_width = 180;
$data[0] = '<div style="margin: 0 auto 6px auto; width: 150px;">';
$data[0] .= '<div id="status_pie" style="margin: auto; width: '.$status_chart_width.'px;">';
$data[0] .= graph_agent_status($id_agente, $graph_width, 120, true);
$data[0] .= '</div>';
$data[0] .= '<br>'.reporting_tiny_stats($agent, true);
$data[0] .= ui_print_help_tip(__('Agent statuses are re-calculated by the server, they are not shown in real time.'), true);
$data[0] .= '</div>';
$table_agent->rowspan[count($table_agent->data)][0] = 6;
$table_agent->colspan[count($table_agent->data)][0] = 2;
$table_agent->cellstyle[count($table_agent->data)][0] = 'width: 150px; text-align:center; padding: 0px; vertical-align: top;';
$table_agent_graph = '<div id="status_pie" style="width: '.$status_chart_width.'px;">';
$table_agent_graph .= graph_agent_status($id_agente, $graph_width, $graph_width, true, false, false, true);
$table_agent_graph .= '</div>';
$data[2] = ui_print_os_icon($agent['id_os'], false, true, true, false, false, false, ['title' => __('OS').': '.get_os_name($agent['id_os'])]);
$table_agent->cellstyle[count($table_agent->data)][2] = 'width: 16px; text-align: right; padding: 0px;';
$data[3] = empty($agent['os_version']) ? get_os_name((int) $agent['id_os']) : $agent['os_version'];
$table_agent->colspan[count($table_agent->data)][3] = 2;
$table_agent->data[] = $data;
$table_agent->rowclass[] = '';
$table_agent_os = '<p>'.ui_print_os_icon($agent['id_os'], false, true, true, false, false, false, ['title' => __('OS').': '.get_os_name($agent['id_os'])]);
$table_agent_os .= empty($agent['os_version']) ? get_os_name((int) $agent['id_os']) : $agent['os_version'].'</p>';
$addresses = agents_get_addresses($id_agente);
$address = agents_get_address($id_agente);
@ -168,42 +130,34 @@ foreach ($addresses as $k => $add) {
}
if (!empty($address)) {
$data = [];
$data[2] = html_print_image('images/world.png', true, ['title' => __('IP address')]);
$table_agent->cellstyle[count($table_agent->data)][2] = 'width: 16px; text-align: right; padding: 0px;';
$data[3] = '<span style="vertical-align:top; display: inline-block;">';
$data[3] .= empty($address) ? '<em>'.__('N/A').'</em>' : $address;
$data[3] .= '</span>';
$table_agent->colspan[count($table_agent->data)][3] = 2;
$table_agent->data[] = $data;
$table_agent->rowclass[] = '';
$table_agent_ip = '<p>'.html_print_image('images/world.png', true, ['title' => __('IP address')]);
$table_agent_ip .= '<span style="vertical-align:top; display: inline-block;">';
$table_agent_ip .= empty($address) ? '<em>'.__('N/A').'</em>' : $address;
$table_agent_ip .= '</span></p>';
}
$data = [];
$data[2] = html_print_image('images/version.png', true, ['title' => __('Agent Version')]);
$table_agent->cellstyle[count($table_agent->data)][2] = 'width: 16px; text-align: right; padding: 0px;';
$data[3] = '<span style="vertical-align:top; display: inline-block;">';
$data[3] .= empty($agent['agent_version']) ? '<i>'.__('N/A').'</i>' : $agent['agent_version'];
$data[3] .= '</span>';
$table_agent->colspan[count($table_agent->data)][3] = 2;
$table_agent->data[] = $data;
$table_agent->rowclass[] = '';
$table_agent_version = '<p>'.html_print_image('images/version.png', true, ['title' => __('Agent Version')]);
$table_agent_version .= '<span style="vertical-align:top; display: inline-block;">';
$table_agent_version .= empty($agent['agent_version']) ? '<i>'.__('N/A').'</i>' : $agent['agent_version'];
$table_agent_version .= '</span></p>';
$data = [];
$data[2] = html_print_image(
$table_agent_description = '<p>'.html_print_image(
'images/default_list.png',
true,
['title' => __('Description')]
);
$table_agent->cellstyle[count($table_agent->data)][2] = 'width: 16px; text-align: right; padding: 0px;';
$data[3] = '<span style="vertical-align:top; display: inline-block;">';
$data[3] .= empty($agent['comentarios']) ? '<em>'.__('N/A').'</em>' : $agent['comentarios'];
$data[3] .= '</span>';
$table_agent->colspan[count($table_agent->data)][3] = 2;
$table_agent->data[] = $data;
$table_agent->rowclass[] = '';
$table_agent_description .= '<span style="vertical-align:top; display: inline-block;">';
$table_agent_description .= empty($agent['comentarios']) ? '<em>'.__('N/A').'</em>' : $agent['comentarios'];
$table_agent_description .= '</span></p>';
$table_agent_count_modules = reporting_tiny_stats($agent, true);
// $table_agent_count_modules .= ui_print_help_tip(__('Agent statuses are re-calculated by the server, they are not shown in real time.'), true);
$table_agent = '<div class="agent_details_header">'.$table_agent_header.'</div>
<div class="agent_details_content">
<div class="agent_details_graph">'.$table_agent_graph.'</div>
<div class="agent_details_bullets">'.$table_agent_count_modules.'</div>
</div>
<div class="agent_details_info">'.$table_agent_os.$table_agent_ip.$table_agent_version.$table_agent_description.'</div>';
// END: TABLE AGENT BUILD
// START: TABLE CONTACT BUILD
$table_contact = new stdClass();
@ -211,12 +165,22 @@ $table_contact->id = 'agent_contact_main';
$table_contact->width = '100%';
$table_contact->cellspacing = 0;
$table_contact->cellpadding = 0;
$table_contact->class = 'databox data';
$table_contact->style[0] = 'width: 30%;height:30px;';
$table_contact->class = 'white_table white_table_no_border';
$table_contact->style[0] = 'width: 30%;';
$table_contact->style[1] = 'width: 70%;';
$table_contact->headstyle[1] = 'padding-top:6px; padding-bottom:6px';
$table_contact->head[0] = ' <span>'.__('Agent contact').'</span>';
$table_contact->head_colspan[0] = 2;
$buttons_refresh_agent_view = '<div class="buttons_agent_view">';
$buttons_refresh_agent_view .= '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$id_agente.'&amp;refr=60">'.html_print_image('images/refresh.png', true, ['title' => __('Refresh data'), 'alt' => '']).'</a><br>';
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
$buttons_refresh_agent_view .= '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;flag_agent=1&amp;id_agente='.$id_agente.'">'.html_print_image('images/target.png', true, ['title' => __('Force remote checks'), 'alt' => '']).'</a>';
}
$buttons_refresh_agent_view .= '</div>';
$table_contact->head[1] = $buttons_refresh_agent_view;
$data = [];
$data[0] = '<b>'.__('Interval').'</b>';
@ -236,12 +200,41 @@ if ($agent['ultimo_contacto_remoto'] == '01-01-1970 00:00:00') {
$table_contact->data[] = $data;
$data = [];
$table_contact->colspan[2][0] = 2;
$data[0] = '<b>'.__('Next contact').'</b>';
$progress = agents_get_next_contact($id_agente);
$data[1] = progress_bar($progress, 200, 20, '', 1, false, '#666666');
$table_contact->data[] = $data;
$data = [];
$table_contact->colspan[3][0] = 2;
$data[0] = progress_bar($progress, 500, 30, '', 1, false, '#82b92e');
// modo 1 para que muestre texto
if ($progress > 100) {
$data[1] .= clippy_context_help('agent_out_of_limits');
$data[0] .= clippy_context_help('agent_out_of_limits');
}
$table_contact->data[] = $data;
$data = [];
$data[0] = '<b>'.__('Group').'</b>';
$data[1] = '<a href="index.php?sec=estado&amp;sec2=operation/agentes/estado_agente&amp;refr=60&amp;group_id='.$agent['id_grupo'].'">'.groups_get_name($agent['id_grupo']).'</a>';
$table_contact->data[] = $data;
$data = [];
$data[0] = '<b>'.__('Secondary groups').'</b>';
$secondary_groups = enterprise_hook('agents_get_secondary_groups', [$id_agente]);
if (!$secondary_groups) {
$data[1] = '<em>'.__('N/A').'</em>';
} else {
$secondary_links = [];
foreach ($secondary_groups['for_select'] as $id => $name) {
$secondary_links[] = '<a href="index.php?sec=estado&amp;sec2=operation/agentes/estado_agente&amp;refr=60&amp;group_id='.$id.'">'.$name.'</a>';
}
$data[1] = implode(', ', $secondary_links);
}
$table_contact->data[] = $data;
@ -251,124 +244,101 @@ $table_contact->data[] = $data;
$table_data = new stdClass();
$table_data->id = 'agent_data_main';
$table_data->width = '100%';
$table_data->styleTable = 'height:180px';
$table_data->cellspacing = 0;
$table_data->cellpadding = 0;
$table_data->class = 'databox data';
$table_data->style[0] = 'width: 30%;';
$table_data->style[1] = 'width: 40%;';
$table_data->class = 'white_table white_table_droppable';
$table_data->style = array_fill(0, 3, 'width: 25%;');
$table_data->head[0] = ' <span>'.__('Agent info').'</span>';
$table_data->head_colspan[0] = 3;
$data = [];
$data[0] = '<b>'.__('Group').'</b>';
$data[1] = '<a href="index.php?sec=estado&amp;sec2=operation/agentes/estado_agente&amp;refr=60&amp;group_id='.$agent['id_grupo'].'">'.groups_get_name($agent['id_grupo']).'</a>';
// ACCESS RATE GRAPH
$access_agent = db_get_value_sql(
'SELECT COUNT(id_agent)
FROM tagent_access
WHERE id_agent = '.$id_agente
);
if ($config['agentaccess'] && $access_agent > 0) {
$data[2] = '<fieldset width=99% class="databox agente" style="">
<legend>'.__('Agent access rate (24h)').'</legend>'.graphic_agentaccess($id_agente, '95%', 100, SECONDS_1DAY, true).'</fieldset>';
$table_data->style[0] = 'width: 20%;';
$table_data->style[1] = 'width: 30%;';
$table_data->style[2] = 'width: 50%;';
$table_data->rowspan[0][2] = 5;
}
$table_data->data[] = $data;
if (!empty($addresses)) {
$data = [];
$data[0] = '<b>'.__('Other IP addresses').'</b>';
$data[1] = '<div style="max-height: 45px; overflow-y: scroll; height:45px;">'.implode('<br>', $addresses).'</div>';
$table_data->data[] = $data;
}
$data = [];
$data[0] = '<b>'.__('Parent').'</b>';
if ($agent['id_parent'] == 0) {
$data[1] = '<em>'.__('N/A').'</em>';
} else {
$data[1] = '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$agent['id_parent'].'">'.agents_get_alias($agent['id_parent']).'</a>';
}
$table_data->data[] = $data;
$table_data->head[0] = html_print_image('images/arrow_down_green.png', true, $options);
$table_data->head[0] .= ' <span style="vertical-align: middle; font-weight:bold; padding-left:20px">'.__('Agent info').'</span>';
$table_data->head_colspan[0] = 4;
$has_remote_conf = enterprise_hook('config_agents_has_remote_configuration', [$agent['id_agente']]);
if (enterprise_installed()) {
$data = [];
$data[0] = '<b>'.__('Remote configuration').'</b>';
if (!$has_remote_conf) {
$data[1] = __('Disabled');
} else {
$data[1] = __('Enabled');
}
$table_data->data[] = $data;
$data = [];
$data[0] = '<b>'.__('Secondary groups').'</b>';
$secondary_groups = enterprise_hook('agents_get_secondary_groups', [$id_agente]);
if (!$secondary_groups) {
$data[0] = '<b>'.__('Parent').'</b>';
if ($agent['id_parent'] == 0) {
$data[1] = '<em>'.__('N/A').'</em>';
} else {
$secondary_links = [];
foreach ($secondary_groups['for_select'] as $id => $name) {
$secondary_links[] = '<a href="index.php?sec=estado&amp;sec2=operation/agentes/estado_agente&amp;refr=60&amp;group_id='.$id.'">'.$name.'</a>';
}
$data[1] = '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$agent['id_parent'].'">'.agents_get_alias($agent['id_parent']).'</a>';
}
$data[1] = implode(', ', $secondary_links);
$data[2] = '<b>'.__('Remote configuration').'</b>';
if (!$has_remote_conf) {
$data[3] = __('Disabled');
} else {
$data[3] = __('Enabled');
}
$table_data->data[] = $data;
}
if ($config['activate_gis'] || $agent['url_address'] != '') {
$data = [];
// Position Information
if ($config['activate_gis']) {
// Gis and url address
$data_opcional = [];
// Position Information
if ($config['activate_gis']) {
$data_opcional[] = '<b>'.__('Position (Long, Lat)').'</b>';
$dataPositionAgent = gis_get_data_last_position_agent($agent['id_agente']);
$data[0] = '<b>'.__('Position (Long, Lat)').'</b>';
if ($dataPositionAgent === false) {
$data[1] = __('There is no GIS data.');
if ($dataPositionAgent === false) {
$data_opcional[] = __('There is no GIS data.');
} else {
$data_opcional[] = '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;tab=gis&amp;id_agente='.$id_agente.'">';
if ($dataPositionAgent['description'] != '') {
$data_opcional[] .= $dataPositionAgent['description'];
} else {
$data[1] = '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;tab=gis&amp;id_agente='.$id_agente.'">';
if ($dataPositionAgent['description'] != '') {
$data[1] .= $dataPositionAgent['description'];
} else {
$data[1] .= $dataPositionAgent['stored_longitude'].', '.$dataPositionAgent['stored_latitude'];
}
$data[1] .= '</a>';
$data_opcional[] .= $dataPositionAgent['stored_longitude'].', '.$dataPositionAgent['stored_latitude'];
}
$table_data->data[] = $data;
$data_opcional[] .= '</a>';
}
// If the url description is setted
array_push($data_opcional);
}
// If the url description is setted
if ($agent['url_address'] != '') {
// $data_opcional = [];
$data_opcional[] = '<b>'.__('Url address').'</b>';
if ($agent['url_address'] != '') {
$data = [];
$data[0] = '<b>'.__('Url address').'</b>';
$data[1] = '<a href='.$agent['url_address'].'>'.$agent['url_address'].'</a>';
$table_data->data[] = $data;
$data_opcional[] = '<a href='.$agent['url_address'].'>'.$agent['url_address'].'</a>';
}
array_push($data_opcional);
}
// Other IP address and timezone offset
if (!empty($addresses)) {
// $data_opcional = [];
$data_opcional[] = '<b>'.__('Other IP addresses').'</b>';
if (!empty($addresses)) {
$data_opcional[] = '<div style="max-height: 30px; overflow-y: scroll; height:30px;">'.implode('<br>', $addresses).'</div>';
}
array_push($data_opcional);
}
// Timezone Offset
if ($agent['timezone_offset'] != 0) {
$data = [];
$data[0] = '<b>'.__('Timezone Offset').'</b>';
$data[1] = $agent['timezone_offset'];
$table->data[] = $data;
$data_opcional[] = '<b>'.__('Timezone Offset').'</b>';
if ($agent['timezone_offset'] != 0) {
$data_opcional[] = $agent['timezone_offset'];
}
array_push($data_opcional);
}
$data_opcional = array_chunk($data_opcional, 4);
foreach ($data_opcional as $key => $value) {
$table_data->data[] = $data_opcional[$key];
}
// Custom fields
$fields = db_get_all_rows_filter(
'tagent_custom_fields',
@ -378,6 +348,7 @@ if ($fields === false) {
$fields = [];
}
$custom_fields = [];
foreach ($fields as $field) {
$data = [];
$data[0] = '<b>'.$field['name'].ui_print_help_tip(__('Custom field'), true).'</b>';
@ -398,10 +369,44 @@ foreach ($fields as $field) {
$data[1] = $custom_value[0]['description'];
}
$table_data->data[] = $data;
$custom_fields[] = $data;
}
$custom_fields_count = count($custom_fields);
for ($i = 0; $i <= $custom_fields_count; $i++) {
$first_column = $custom_fields[$i];
$j = ($i + 1);
$second_column = $custom_fields[$j];
if (is_array($second_column)) {
$columns = array_merge($first_column, $second_column);
} else {
$columns = $first_column;
$filas = count($table_data->data);
$table_data->colspan[$filas][1] = 3;
}
$table_data->data[] = $columns;
$i++;
}
// END: TABLE DATA BUILD
// START: ACCESS RATE GRAPH
$access_agent = db_get_value_sql(
'SELECT COUNT(id_agent)
FROM tagent_access
WHERE id_agent = '.$id_agente
);
if ($config['agentaccess'] && $access_agent > 0) {
$table_access_rate = '<div class="white_table_graph" id="table_access_rate">
<div class="white_table_graph_header">'.html_print_image('images/arrow_down_green.png', true).'<span>'.__('Agent access rate (24h)').'</span></div>
<div class="white_table_graph_content">'.graphic_agentaccess($id_agente, '95%', 100, SECONDS_1DAY, true).'</div>
</div>';
}
// END: ACCESS RATE GRAPH
// START: TABLE INCIDENTS
$last_incident = db_get_row_sql(
"
@ -416,31 +421,24 @@ if ($last_incident != false) {
$table_incident->width = '100%';
$table_incident->cellspacing = 0;
$table_incident->cellpadding = 0;
$table_incident->class = 'databox';
$table_incident->style[0] = 'width: 30%;';
$table_incident->style[1] = 'width: 70%;';
$table_incident->class = 'white_table';
$table_incident->style = array_fill(0, 3, 'width: 25%;');
$table_incident->head[0] = ' <span>'.'<a href="index.php?sec=incidencias&amp;sec2=operation/incidents/incident_detail&amp;id='.$last_incident['id_incidencia'].'">'.__('Active incident on this agent').'</a>'.'</span>';
$table_incident->head_colspan[0] = 2;
$table_incident->head[0] = ' <span><a href="index.php?sec=incidencias&amp;sec2=operation/incidents/incident_detail&amp;id='.$last_incident['id_incidencia'].'">'.__('Active incident on this agent').'</a>'.'</span>';
$table_incident->head_colspan[0] = 4;
$data = [];
$data[0] = '<b>'.__('Author').'</b>';
$data[1] = $last_incident['id_creator'];
$data[2] = '<b>'.__('Timestamp').'</b>';
$data[3] = $last_incident['inicio'];
$table_incident->data[] = $data;
$data = [];
$data[0] = '<b>'.__('Title').'</b>';
$data[1] = '<a href="index.php?sec=incidencias&amp;sec2=operation/incidents/incident_detail&amp;id='.$last_incident['id_incidencia'].'">'.$last_incident['titulo'].'</a>';
$table_incident->data[] = $data;
$data = [];
$data[0] = '<b>'.__('Timestamp').'</b>';
$data[1] = $last_incident['inicio'];
$table_incident->data[] = $data;
$data = [];
$data[0] = '<b>'.__('Priority').'</b>';
$data[1] = incidents_print_priority_img($last_incident['prioridad'], true);
$data[2] = '<b>'.__('Priority').'</b>';
$data[3] = incidents_print_priority_img($last_incident['prioridad'], true);
$table_incident->data[] = $data;
}
@ -456,8 +454,8 @@ if (!empty($network_interfaces_by_agents) && !empty($network_interfaces_by_agent
if (!empty($network_interfaces)) {
$table_interface = new stdClass();
$table_interface->id = 'agent_interface_info';
$table_interface->class = 'databox data';
$table_interface->width = '98%';
$table_interface->class = 'info_table';
$table_interface->width = '100%';
$table_interface->style = [];
$table_interface->style['interface_status'] = 'width: 30px;padding-top:0px;padding-bottom:0px;';
$table_interface->style['interface_graph'] = 'width: 20px;padding-top:0px;padding-bottom:0px;';
@ -476,10 +474,10 @@ if (!empty($network_interfaces)) {
$table_interface->head = [];
$options = [
'class' => 'closed',
'style' => 'vertical-align:righ; cursor:pointer;',
'style' => 'cursor:pointer;',
];
$table_interface->head[0] = html_print_image('images/graphmenu_arrow.png', true, $options).'&nbsp;&nbsp;';
$table_interface->head[0] .= '<span style="vertical-align: middle;">'.__('Interface information').' (SNMP)</span>';
$table_interface->head[0] = html_print_image('images/arrow_down_green.png', true, $options).'&nbsp;&nbsp;';
$table_interface->head[0] .= '<span style="vertical-align: middle; font-weight:bold;">'.__('Interface information').' (SNMP)</span>';
$table_interface->head_colspan = [];
$table_interface->head_colspan[0] = 8;
$table_interface->data = [];
@ -600,69 +598,80 @@ if (!empty($network_interfaces)) {
$table_interface->data[] = $data;
}
}
// END: TABLE INTERFACES
// This javascript piece of code is used to make expandible the body of the table
?>
?>
<script type="text/javascript">
$(document).ready (function () {
$("#agent_interface_info").find("tbody").hide();
$("#agent_interface_info").find("thead").click (function () {
var arrow = $("#agent_interface_info").find("thead").find("img");
if (arrow.hasClass("closed")) {
arrow.removeClass("closed");
arrow.prop("src", "images/arrow-down-white.png");
$("#agent_interface_info").find("tbody").show();
} else {
arrow.addClass("closed");
arrow.prop("src", "images/graphmenu_arrow.png");
$("#agent_interface_info").find("tbody").hide();
}
})
.css('cursor', 'pointer');
close_table('#agent_interface_info');
})
.css('cursor', 'pointer');
$("#agent_data_main").find("thead").click (function () {
close_table('#agent_data_main');
})
.css('cursor', 'pointer');
$("#table_events").find(".white_table_graph_header").click (function () {
close_table_white('#table_events');
})
.css('cursor', 'pointer');
$("#table_access_rate").find(".white_table_graph_header").click (function () {
close_table_white('#table_access_rate');
})
.css('cursor', 'pointer');
function close_table(id){
var arrow = $(id).find("thead").find("img");
if (arrow.hasClass("closed")) {
arrow.removeClass("closed");
arrow.prop("src", "images/arrow_down_green.png");
$(id).find("tbody").show();
} else {
arrow.addClass("closed");
arrow.prop("src", "images/arrow_right_green.png");
$(id).find("tbody").hide();
}
}
function close_table_white(id){
var arrow = $(id).find(".white_table_graph_header").find("img");
if (arrow.hasClass("closed")) {
arrow.removeClass("closed");
arrow.prop("src", "images/arrow_down_green.png");
$(id).find(".white_table_graph_content").show();
} else {
arrow.addClass("closed");
arrow.prop("src", "images/arrow_right_green.png");
$(id).find(".white_table_graph_content").hide();
}
}
});
</script>
<?php
}
$table_events = '<div class="white_table_graph" id="table_events">
<div class="white_table_graph_header">'.html_print_image('images/arrow_down_green.png', true).'<span>'.__('Events (24h)').'</span></div>
<div class="white_table_graph_content">'.graph_graphic_agentevents($id_agente, 100, 45, SECONDS_1DAY, '', true, true).'</div>
</div>';
// END: TABLE INTERFACES
$table = new stdClass();
$table->id = 'agent_details';
$table->width = '100%';
$table->cellspacing = 0;
$table->cellpadding = 0;
$table->class = 'agents';
$table->style = array_fill(0, 3, 'vertical-align: top;');
$data = [];
$data[0][0] = html_print_table($table_agent, true);
$data[0][0] .= '<br /> <table width=95% class="databox agente" style="">
<tr><th>'.__('Events (24h)').'</th></tr>'.'<tr><td style="text-align:center;padding-left:20px;padding-right:20px;"><br />'.graph_graphic_agentevents($id_agente, 100, 45, SECONDS_1DAY, '', true, true).'<br /></td></tr>'.'</table>';
$agent_contact = html_print_table($table_contact, true);
$table->style[0] = 'width:40%; vertical-align:top;';
$data[0][1] = html_print_table($table_contact, true);
$data[0][1] .= empty($table_data->data) ? '' : '<br>'.html_print_table($table_data, true);
$data[0][1] .= !isset($table_incident) ? '' : '<br>'.html_print_table($table_incident, true);
$agent_info = empty($table_data->data) ? '' : html_print_table($table_data, true);
$table->rowspan[1][0] = 0;
$agent_incidents = !isset($table_incident) ? '' : html_print_table($table_incident, true);
$data[0][2] = '<div style="width:100%; text-align:right">';
$data[0][2] .= '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$id_agente.'&amp;refr=60">'.html_print_image('images/refresh.png', true, ['border' => '0', 'title' => __('Refresh data'), 'alt' => '']).'</a><br>';
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
$data[0][2] .= '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;flag_agent=1&amp;id_agente='.$id_agente.'">'.html_print_image('images/target.png', true, ['border' => '0', 'title' => __('Force remote checks'), 'alt' => '']).'</a>';
}
$data[0][2] .= '</div>';
$table->data = $data;
$table->rowclass[] = '';
$table->cellstyle[1][0] = 'text-align:center;';
html_print_table($table);
$data2[1][0] = !isset($table_interface) ? '' : html_print_table($table_interface, true);
$table->data = $data2;
$table->styleTable = '';
html_print_table($table);
unset($table);
echo '<div id="agent_details_first_row">
<div class="agent_details_col agent_details_col_left">'.$table_agent.'</div>
<div class="agent_details_col agent_details_col_right">'.$agent_contact.'</div>
</div>'.$agent_info.'<div style="display:grid; grid-template-columns: 1fr 1fr; grid-column-gap: 20px;">'.$table_access_rate.$table_events.'</div>'.$agent_incidents;
if (isset($table_interface)) {
echo html_print_table($table_interface, true);
}

View File

@ -1331,6 +1331,7 @@ if (isset($ehorus_tab) && !empty($ehorus_tab)) {
}
// Tabs for extensions.
$tab_name_extensions = '';
foreach ($config['extensions'] as $extension) {
if (isset($extension['extension_ope_tab']) && !isset($extension['extension_god_tab'])) {
if (check_acl_one_of_groups($config['id_user'], $all_groups, $extension['extension_ope_tab']['acl'])) {
@ -1373,6 +1374,7 @@ foreach ($config['extensions'] as $extension) {
$image = $extension['extension_ope_tab']['icon'];
$name = $extension['extension_ope_tab']['name'];
$id = $extension['extension_ope_tab']['id'];
$tab_name_extensions = $name;
$id_extension = get_parameter('id_extension', '');
@ -1395,15 +1397,82 @@ foreach ($config['extensions'] as $extension) {
}
switch ($tab) {
case 'wux_console_tab':
$help_header = 'wux_console_tab';
case 'custom_fields':
$tab_name = 'Custom fields';
break;
case 'gis':
$tab_name = 'GIS data';
break;
case 'manage':
$tab_name = 'Manage';
break;
case 'main':
$tab_name = 'Main';
$help_header = 'agent_'.$tab.'_tab';
break;
case 'data_view':
$tab_name = '';
break;
case 'alert':
$tab_name = 'Alerts';
break;
case 'inventory':
$tab_name = 'Inventory';
break;
case 'collection':
$tab_name = 'Collection';
break;
case 'policy':
$tab_name = 'Policies';
break;
case 'ux_console_tab':
$tab_name = 'UX Console';
break;
case 'wux_console_tab':
$tab_name = 'WUX Console';
$help_header = 'wux_console_tab';
break;
case 'url_route_analyzer_tab':
$tab_name = 'URL Route Analyzer';
break;
case 'graphs';
$tab_name = 'Graphs';
break;
case 'incident':
$tab_name = 'Incidents';
break;
case 'url_address':
$tab_name = 'Url address';
break;
case 'log_viewer':
$tab_name = 'Log viewer';
break;
case 'ehorus':
$tab_name = 'eHorus';
break;
case 'extension':
$tab_name = $tab_name_extensions;
break;
default:
$tab_name = '';
$help_header = '';
break;
}
@ -1417,7 +1486,9 @@ ui_print_page_header(
$onheader,
false,
'',
$config['item_title_size_text']
$config['item_title_size_text'],
'',
__('Resources').ui_print_breadcrums($tab_name)
);

View File

@ -99,10 +99,12 @@ if (is_metaconsole()) {
).'</a>',
],
];
$tab_name = 'User Management';
$helpers = '';
if ($_GET['sec2'] === 'operation/users/user_edit_notifications') {
$helpers = 'user_edit_notifications';
$tab_name = 'User Notifications';
}
ui_print_page_header(
@ -111,6 +113,11 @@ if (is_metaconsole()) {
false,
$helpers,
false,
$buttons
$buttons,
false,
'',
GENERIC_SIZE_TEXT,
'',
__('Workspace').ui_print_breadcrums($tab_name)
);
}