Changes for the merge

This commit is contained in:
Daniel Maya 2017-02-21 15:31:20 +01:00
parent e3205226e1
commit 76cb61f288
7 changed files with 47 additions and 33 deletions

View File

@ -37,6 +37,7 @@ function createXMLData($agent, $agentModule, $time, $data) {
$xml = sprintf($xmlTemplate, io_safe_output(get_os_name($agent['id_os'])),
io_safe_output($agent['os_version']), $agent['intervalo'],
io_safe_output($agent['agent_version']), $time,
io_safe_output($agent['nombre']),
io_safe_output($agent['alias']), $agent['timezone_offset'],
io_safe_output($agentModule['nombre']), io_safe_output($agentModule['descripcion']), modules_get_type_name($agentModule['id_tipo_modulo']), $data);
@ -62,6 +63,14 @@ function mainInsertData() {
$save = (bool)get_parameter('save', false);
$id_agent = (string)get_parameter('id_agent', '');
foreach ($_POST as $key => $value) {
if(strpos($key,"agent_autocomplete_idagent")!== false){
$id_agente = $value;
}
}
$id_agent_module = (int)get_parameter('id_agent_module', '');
$data = (string)get_parameter('data');
$date = (string) get_parameter('date', date(DATE_FORMAT));
@ -84,7 +93,8 @@ function mainInsertData() {
ui_print_error_message(__('You haven\'t privileges for insert data in the agent.'));
}
else {
$agent = db_get_row_filter('tagente', array('alias' => $id_agent));
$agent = db_get_row_filter('tagente', array('id_agente' => $id_agente));
$agentModule = db_get_row_filter('tagente_modulo', array('id_agente_modulo' => $id_agent_module));
$done = 0;
@ -117,14 +127,14 @@ function mainInsertData() {
}
if ($errors > 0) {
$msg = sprintf(__('Can\'t save agent (%s), module (%s) data xml.'), $agent['nombre'], $agentModule['nombre']);
$msg = sprintf(__('Can\'t save agent (%s), module (%s) data xml.'), $agent['alias'], $agentModule['nombre']);
if ($errors > 1) {
$msg .= " ($errors)";
}
ui_print_error_message($msg);
}
if ($done > 0) {
$msg = sprintf(__('Save agent (%s), module (%s) data xml.'), $agent['nombre'], $agentModule['nombre']);
$msg = sprintf(__('Save agent (%s), module (%s) data xml.'), $agent['alias'], $agentModule['nombre']);
if ($done > 1) {
$msg .= " ($done)";
}
@ -154,14 +164,19 @@ function mainInsertData() {
$params['javascript_is_function_select'] = true;
$params['javascript_name_function_select'] = 'custom_select_function';
$params['javascript_code_function_select'] = '';
$params['use_hidden_input_idagent'] = true;
$params['print_hidden_input_idagent'] = true;
$params['hidden_input_idagent_id'] = 'hidden-autocomplete_id_agent';
$table->data[0][1] = ui_print_agent_autocomplete_input($params);
$table->data[1][0] = __('Module');
$modules = array ();
if ($id_agent)
$modules = agents_get_modules ($id_agent, false, array("delete_pending" => 0));
if ($id_agente){
$modules = agents_get_modules ($id_agente, false, array("delete_pending" => 0));
}
$table->data[1][1] = html_print_select ($modules, 'id_agent_module', $id_agent_module, true,
__('Select'), 0, true, false, true, '', ($id_agent === ''));
__('Select'), 0, true, false, true, '', ($id_agente === ''));
$table->data[2][0] = __('Data');
$table->data[2][1] = html_print_input_text('data', $data, __('Data'), 40, 60, true);
$table->data[3][0] = __('Date');
@ -207,9 +222,10 @@ function mainInsertData() {
function custom_select_function(agent_name) {
$('#id_agent_module').empty ();
var inputs = [];
inputs.push ("agent_name=" + agent_name);
var id_agent = $('#hidden-autocomplete_id_agent').val();
inputs.push ("id_agent=" + id_agent);
inputs.push ("delete_pending=0");
inputs.push ("get_agent_modules_json=1");
inputs.push ("page=operation/agentes/ver_agente");

View File

@ -150,7 +150,7 @@ if (!empty($downtimes)) {
$affected_items = array();
$sql_agents = "SELECT tpda.id_agent AS agent_id, tpda.all_modules AS all_modules, ta.nombre AS agent_name
$sql_agents = "SELECT tpda.id_agent AS agent_id, tpda.all_modules AS all_modules, ta.nombre AS agent_name, ta.alias
FROM tplanned_downtime_agents tpda, tagente ta
WHERE tpda.id_downtime = $id
AND tpda.id_agent = ta.id_agente";
@ -159,8 +159,7 @@ if (!empty($downtimes)) {
if (!empty($downtime_agents)) {
foreach ($downtime_agents as $downtime_agent) {
$downtime_items = array();
$alias = db_get_value("alias","tagente","id_agente",$downtime_agent['agent_id']);
$downtime_items[] = $alias;
$downtime_items[] = $downtime_agent[alias];
if (!$downtime_agent['all_modules']) {
$agent_id = $downtime_agent['agent_id'];

View File

@ -41,7 +41,7 @@ if (isset ($_GET["get_agent"])) {
if ($editGraph) {
$graphRows = db_get_all_rows_sql("SELECT t1.*,
(SELECT t3.nombre
(SELECT t3.alias
FROM tagente t3
WHERE t3.id_agente =
(SELECT t2.id_agente
@ -98,8 +98,7 @@ if (count($module_array) > 0) {
$color = 1;
}
$alias = db_get_row ('tagente', 'nombre', $agent_array[$a]);
echo "<tr><td class='$tdcolor'>" . $alias['alias'] . "</td>";
echo "<tr><td class='$tdcolor'>" . $agent_array[$a] . "</td>";
echo "<td class='$tdcolor'>";
echo modules_get_agentmodule_name ($module_array[$a])."</td>";

View File

@ -1222,21 +1222,21 @@ function graphic_combined_module ($module_list, $weight_list, $period,
else {
$agent_name = io_safe_output(
modules_get_agentmodule_agent_name ($agent_module_id));
$alias = db_get_row ('tagente', 'nombre', $agent_name);
$alias = db_get_value ("alias","tagente","nombre",$agent_name);
$module_name = io_safe_output(
modules_get_agentmodule_name ($agent_module_id));
if ($flash_charts)
$module_name_list[$i] = '<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . $alias['alias'] . " / " . $module_name. '</span>';
$module_name_list[$i] = '<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . $alias . " / " . $module_name. '</span>';
else
$module_name_list[$i] = $alias['alias'] . " / " . $module_name;
$module_name_list[$i] = $alias . " / " . $module_name;
}
}
else {
//Get and process agent name
$agent_name = io_safe_output(
modules_get_agentmodule_agent_name ($agent_module_id));
$alias = db_get_row ('tagente', 'nombre', $agent_name);
$alias = db_get_value ("alias","tagente","nombre",$agent_name);
$agent_name = ui_print_truncate_text($agent_name, 'agent_small', false, true, false, '...', false);
$agent_id = agents_get_agent_id ($agent_name);
@ -1255,13 +1255,13 @@ function graphic_combined_module ($module_list, $weight_list, $period,
else
$module_name_list[$i] = '<span style=\"font-size:' .
($config['font_size']) . 'pt;font-family: smallfontFont;\" >' .
$alias['alias'] . ' / ' . $module_name . '</span>';
$alias . ' / ' . $module_name . '</span>';
}
else {
if ($labels[$agent_module_id] != '')
$module_name_list[$i] = $labels[$agent_module_id];
else
$module_name_list[$i] = $alias['alias'] . ' / ' . $module_name;
$module_name_list[$i] = $alias . ' / ' . $module_name;
}
}
@ -1528,8 +1528,8 @@ function graphic_combined_module ($module_list, $weight_list, $period,
if ( !empty($labels) && isset($labels[$module]) ){
$label = io_safe_input($labels[$module]);
}else{
$alias = db_get_row ("tagente","id_agente",$temp[$module]['id_agente']);
$label = $alias['alias'] . ': ' . $temp[$module]['nombre'];
$alias = db_get_value ("alias","tagente","id_agente",$temp[$module]['id_agente']);
$label = $alias . ': ' . $temp[$module]['nombre'];
}
@ -1597,8 +1597,8 @@ function graphic_combined_module ($module_list, $weight_list, $period,
if (!empty($labels) && isset($labels[$module]) ){
$label = $labels[$module];
}else {
$alias = db_get_row ("tagente","id_agente",$module_data['id_agente']);
$label = $alias['alias'] . " - " .$module_data['nombre'];
$alias = db_get_value ("alias","tagente","id_agente",$module_data['id_agente']);
$label = $alias . " - " .$module_data['nombre'];
}
$temp[$label]['g'] = round($temp_data,4);
@ -1657,8 +1657,8 @@ function graphic_combined_module ($module_list, $weight_list, $period,
if ( !empty($labels) && isset($labels[$module]) ){
$label = io_safe_output($labels[$module]);
}else {
$alias = db_get_row ("tagente","id_agente",$data_module['id_agente']);
$label = io_safe_output($alias['alias'] . ": " . $data_module['nombre']);
$alias = db_get_value ("alias","tagente","id_agente",$data_module['id_agente']);
$label = io_safe_output($alias . ": " . $data_module['nombre']);
}
$temp[$label] = array('value'=>$value,

View File

@ -787,7 +787,7 @@ function ui_format_alert_row ($alert, $agent = true, $url = '', $agent_style = f
// Get agent id
$id_agent = modules_get_agentmodule_agent ($alert['id_agent_module']);
$alias = db_get_row ('tagente', 'id_agente', $id_agent);
$agente = db_get_row ('tagente', 'id_agente', $id_agent);
$template = alerts_get_alert_template ($alert['id_alert_template']);
$description = io_safe_output($template['name']);
@ -848,10 +848,10 @@ function ui_format_alert_row ($alert, $agent = true, $url = '', $agent_style = f
}
else {
if ($agent_style !== false) {
$data[$index['agent_name']] .='<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agent.'"> <span style="font-size: 7pt;font-weight:bold" title ="' . $alias['nombre']. '">'.$alias["alias"].'</span></a>';
$data[$index['agent_name']] .='<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agent.'"> <span style="font-size: 7pt;font-weight:bold" title ="' . $agente['nombre']. '">'.$agente["alias"].'</span></a>';
}
else {
$data[$index['agent_name']] .= '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agent.'"> <span style="font-size: 7pt;font-weight:bold" title ="' . $alias['nombre']. '">'.$alias["alias"].'</span></a>';
$data[$index['agent_name']] .= '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agent.'"> <span style="font-size: 7pt;font-weight:bold" title ="' . $agente['nombre']. '">'.$agente["alias"].'</span></a>';
}
}

View File

@ -436,9 +436,9 @@ else {
}
}
else {
$alias = db_get_row ("tagente","id_agente",$event["id_agente"]);
$data[$i] .= '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=' . $event["id_agente"] . '" title='.$alias['nombre']. '>';
$data[$i] .= '<b>' . $alias['alias'] . '</a></b>';
$agent = db_get_row ("tagente","id_agente",$event["id_agente"]);
$data[$i] .= '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=' . $event["id_agente"] . '" title='.$agent['nombre']. '>';
$data[$i] .= '<b>' . $agent['alias'] . '</a></b>';
}
}
else {

View File

@ -82,7 +82,7 @@ CREATE TABLE IF NOT EXISTS `tagente` (
`fired_count` bigint(20) NOT NULL default '0',
`update_module_count` tinyint(1) NOT NULL default '0',
`update_alert_count` tinyint(1) NOT NULL default '0',
`alias` varchar(600) NOT NULL default '',
`alias` varchar(600) BINARY NOT NULL default '',
`transactional_agent` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`id_agente`),
KEY `nombre` (`nombre`(255)),