Changed the agent name by its alias in the mobile console

This commit is contained in:
Alejandro Gallardo Escobar 2017-02-22 13:50:06 +01:00
parent dc6c024611
commit beb38c70ce
4 changed files with 21 additions and 22 deletions

View File

@ -89,7 +89,7 @@ class Agent {
exit; exit;
} }
} }
} }
private function show_agent() { private function show_agent() {
$ui = Ui::getInstance(); $ui = Ui::getInstance();
@ -98,10 +98,10 @@ class Agent {
$ui->createPage(); $ui->createPage();
if ($this->id != 0) { if ($this->id != 0) {
$agent_name = (string) $this->agent['nombre']; $agent_alias = (string) $this->agent['alias'];
$ui->createDefaultHeader( $ui->createDefaultHeader(
sprintf('%s', $agent_name), sprintf('%s', $agent_alias),
$ui->createHeaderButton( $ui->createHeaderButton(
array('icon' => 'back', array('icon' => 'back',
'pos' => 'left', 'pos' => 'left',
@ -120,17 +120,14 @@ class Agent {
else { else {
$ui->contentBeginGrid(); $ui->contentBeginGrid();
if ($this->agent['disabled']) { if ($this->agent['disabled']) {
$agent_name = "<em>" . $agent_name . "</em>" . $agent_alias = "<em>" . $agent_alias . "</em>" .
ui_print_help_tip(__('Disabled'), true); ui_print_help_tip(__('Disabled'), true);
} }
else if ($this->agent['quiet']) { else if ($this->agent['quiet']) {
$agent_name = "<em>" . $agent_name . "&nbsp;" . $agent_alias = "<em>" . $agent_alias . "&nbsp;" .
html_print_image("images/dot_green.disabled.png", html_print_image("images/dot_green.disabled.png",
true, array("border" => '0', "title" => __('Quiet'), "alt" => "")) . "</em>"; true, array("border" => '0', "title" => __('Quiet'), "alt" => "")) . "</em>";
} }
else {
$agent_name = $agent_name;
}
if ($system->getConfig('metaconsole')) { if ($system->getConfig('metaconsole')) {
@ -174,7 +171,7 @@ class Agent {
} }
$html = '<div class="agent_details" style:"float:left;">'; $html = '<div class="agent_details" style:"float:left;">';
$html .= '<span class="agent_name">' . $agent_name . $html .= '<span class="agent_name">' . $agent_alias .
'</span>'; '</span>';
$html .= '</div>'; $html .= '</div>';
$html .= '<div class="agent_os">' . ui_print_os_icon ($this->agent["id_os"], false, true, $html .= '<div class="agent_os">' . ui_print_os_icon ($this->agent["id_os"], false, true,

View File

@ -218,7 +218,8 @@ class Agents {
$search_sql = ''; $search_sql = '';
if (!empty($this->free_search)) { if (!empty($this->free_search)) {
$search_sql = " AND ( $search_sql = " AND (
nombre COLLATE utf8_general_ci LIKE '%" . $this->free_search . "%' alias COLLATE utf8_general_ci LIKE '%" . $this->free_search . "%'
OR nombre COLLATE utf8_general_ci LIKE '%" . $this->free_search . "%'
OR direccion LIKE '%" . $this->free_search . "%' OR direccion LIKE '%" . $this->free_search . "%'
OR comentarios LIKE '%" . $this->free_search . "%') "; OR comentarios LIKE '%" . $this->free_search . "%') ";
} }
@ -241,7 +242,7 @@ class Agents {
} }
$total = isset($total[0]['total']) ? $total[0]['total'] : 0; $total = isset($total[0]['total']) ? $total[0]['total'] : 0;
$order = array('field' => 'nombre COLLATE utf8_general_ci', $order = array('field' => 'alias COLLATE utf8_general_ci',
'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'ASC'); 'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'ASC');
if (!$system->getConfig('metaconsole')) { if (!$system->getConfig('metaconsole')) {
$agents_db = agents_get_agents(array( $agents_db = agents_get_agents(array(
@ -254,7 +255,7 @@ class Agents {
array ('id_agente', array ('id_agente',
'id_grupo', 'id_grupo',
'id_os', 'id_os',
'nombre', 'alias',
'ultimo_contacto', 'ultimo_contacto',
'intervalo', 'intervalo',
'comentarios description', 'comentarios description',
@ -279,7 +280,7 @@ class Agents {
array ('id_agente', array ('id_agente',
'id_grupo', 'id_grupo',
'id_os', 'id_os',
'nombre', 'alias',
'ultimo_contacto', 'ultimo_contacto',
'intervalo', 'intervalo',
'comentarios description', 'comentarios description',
@ -307,7 +308,7 @@ class Agents {
$row[0] = $row[__('Agent')] = '<span class="tiny" style="margin-right: 5px;">' . $img_status . '</span>' . $row[0] = $row[__('Agent')] = '<span class="tiny" style="margin-right: 5px;">' . $img_status . '</span>' .
'<a class="ui-link" data-ajax="false" href="index.php?page=agent&id=' . $agent['id_agente'] . '">' . ui_print_truncate_text(io_safe_output($agent['nombre']), 30, false) . '</a>'; '<a class="ui-link" data-ajax="false" href="index.php?page=agent&id=' . $agent['id_agente'] . '">' . ui_print_truncate_text(io_safe_output($agent['alias']), 30, false) . '</a>';
//~ $row[1] = $row[__('Description')] = '<span class="small">' . //~ $row[1] = $row[__('Description')] = '<span class="small">' .
//~ ui_print_truncate_text($agent["description"], 'description', false, true) . //~ ui_print_truncate_text($agent["description"], 'description', false, true) .
//~ '</span>'; //~ '</span>';

View File

@ -353,7 +353,7 @@ class ModuleGraph {
} }
private function showModuleGraph() { private function showModuleGraph() {
$agent_name = agents_get_name($this->module['id_agente']); $agent_alias = agents_get_alias($this->module['id_agente']);
$ui = Ui::getInstance(); $ui = Ui::getInstance();
@ -384,7 +384,7 @@ class ModuleGraph {
'value' => $this->id, 'value' => $this->id,
'type' => 'hidden' 'type' => 'hidden'
))); )));
$title = sprintf(__('Options for %s : %s'), $agent_name, $this->module["nombre"]); $title = sprintf(__('Options for %s : %s'), $agent_alias, $this->module["nombre"]);
$ui->contentBeginCollapsible($title); $ui->contentBeginCollapsible($title);
$ui->beginForm("index.php?page=module_graph&id=" . $this->id); $ui->beginForm("index.php?page=module_graph&id=" . $this->id);
$options = array( $options = array(

View File

@ -371,15 +371,16 @@ class Modules {
AS tags, AS tags,
tagente_modulo.id_agente_modulo, tagente_modulo.id_agente_modulo,
tagente.intervalo AS agent_interval, tagente.intervalo AS agent_interval,
tagente.nombre AS agent_name, tagente.nombre AS agent_name,
tagente.alias AS agent_alias,
tagente_modulo.nombre AS module_name, tagente_modulo.nombre AS module_name,
tagente_modulo.history_data, tagente_modulo.history_data,
tagente_modulo.flag AS flag, tagente_modulo.flag AS flag,
tagente.id_grupo AS id_group, tagente.id_grupo AS id_group,
tagente.id_agente AS id_agent, tagente.id_agente AS id_agent,
tagente_modulo.id_tipo_modulo AS module_type, tagente_modulo.id_tipo_modulo AS module_type,
tagente_modulo.module_interval, tagente_modulo.module_interval,
tagente_estado.datos, tagente_estado.datos,
tagente_estado.estado, tagente_estado.estado,
tagente_modulo.min_warning, tagente_modulo.min_warning,
tagente_modulo.max_warning, tagente_modulo.max_warning,
@ -493,7 +494,7 @@ class Modules {
if ($this->columns['agent']) { if ($this->columns['agent']) {
$row[1] = $row[__('Agent name')] = $row[1] = $row[__('Agent name')] =
'<span class="data"><span class="show_collapside" style="display: none; font-weight: bolder;">' . __('Agent') . ' </span>' . '<span class="data"><span class="show_collapside" style="display: none; font-weight: bolder;">' . __('Agent') . ' </span>' .
ui_print_truncate_text($module['agent_name'], 50, false) . ui_print_truncate_text($module['agent_alias'], 50, false) .
'</span>'; '</span>';
} }