Improved the visual style of the output of the functions that print the agent, module and alert detail views
This commit is contained in:
parent
1127737f83
commit
d7831dbb19
|
@ -55,55 +55,75 @@ function treeview_printModuleTable($id_module, $server_data = false) {
|
|||
return;
|
||||
}
|
||||
|
||||
echo '<div id="id_div3" width="450px">';
|
||||
echo '<table cellspacing="4" cellpadding="4" border="0" class="databox alternate" style="width:90%; min-width: 300px;">';
|
||||
$table = new StdClass();
|
||||
$table->width = "100%";
|
||||
$table->style = array();
|
||||
$table->style['title'] = 'font-weight: bold;';
|
||||
$table->head = array();
|
||||
$table->head[] = __('Module');
|
||||
$table->head_colspan[] = 2;
|
||||
$table->data = array();
|
||||
|
||||
//Module name
|
||||
echo '<tr><td class="datos"><b>'.__('Module name').'</b></td>';
|
||||
|
||||
if ($module["disabled"])
|
||||
$cellName = "<em>" . ui_print_truncate_text ($module["nombre"], GENERIC_SIZE_TEXT, true, true, true, '[…]',"text-transform: uppercase;") . ui_print_help_tip(__('Disabled'), true) . "<em>";
|
||||
else
|
||||
$cellName = ui_print_truncate_text ($module["nombre"], GENERIC_SIZE_TEXT, true, true, true, '[…]',"text-transform: uppercase;");
|
||||
|
||||
echo '<td class="datos"><b>'.$cellName.'</b></td>';
|
||||
$row = array();
|
||||
$row['title'] = __('Name');
|
||||
$row['data'] = "<b>".$cellName."</b>";
|
||||
$table->data['name'] = $row;
|
||||
|
||||
// Interval
|
||||
echo '<tr><td class="datos"><b>' . __('Interval') . '</b></td>';
|
||||
echo '<td class="datos" colspan="2">' . human_time_description_raw (modules_get_interval($module['id_agente_modulo']), true) . '</td></tr>';
|
||||
$row = array();
|
||||
$row['title'] = __('Interval');
|
||||
$row['data'] = human_time_description_raw (modules_get_interval($module['id_agente_modulo']), true);
|
||||
$table->data['interval'] = $row;
|
||||
|
||||
// Warning Min/Max
|
||||
echo '<tr><td class="datos"><b>' . __('Warning status') . '</b></td>';
|
||||
if (modules_is_string_type($module['id_tipo_modulo'])) {
|
||||
echo '<td class="datos" colspan="2">' . __('Str.') . ': ' . $module['str_warning'] . '</td></tr>';
|
||||
$warning_status_str = __('Str.') . ': ' . $module['str_warning'];
|
||||
}
|
||||
else {
|
||||
echo '<td class="datos" colspan="2">' . __('Min.') . ': ' . $module['min_warning'] . '<br>' . __('Max.') . ': ' . $module['max_warning'] . '</td></tr>';
|
||||
$warning_status_str = __('Min.') . ': ' . $module['min_warning'] . '<br>' . __('Max.') . ': ' . $module['max_warning'];
|
||||
}
|
||||
|
||||
$row = array();
|
||||
$row['title'] = __('Warning status');
|
||||
$row['data'] = $warning_status_str;
|
||||
$table->data['watning_status'] = $row;
|
||||
|
||||
// Critical Min/Max
|
||||
echo '<tr><td class="datos"><b>' . __('Critical status') . '</b></td>';
|
||||
if (modules_is_string_type($module['id_tipo_modulo'])) {
|
||||
echo '<td class="datos" colspan="2">' . __('Str.') . ': ' . $module['str_warning'] . '</td></tr>';
|
||||
$critical_status_str = __('Str.') . ': ' . $module['str_warning'];
|
||||
}
|
||||
else {
|
||||
echo '<td class="datos" colspan="2">' . __('Min.') . ': ' . $module['min_critical'] . '<br>' . __('Max.') . ': ' . $module['max_critical'] . '</td></tr>';
|
||||
$critical_status_str = __('Min.') . ': ' . $module['min_critical'] . '<br>' . __('Max.') . ': ' . $module['max_critical'];
|
||||
}
|
||||
$row = array();
|
||||
$row['title'] = __('Critical status');
|
||||
$row['data'] = $critical_status_str;
|
||||
$table->data['critical_status'] = $row;
|
||||
|
||||
// Module group
|
||||
echo '<tr><td class="datos2"><b>'.__('Module group').'</b></td>';
|
||||
echo '<td class="datos2" colspan="2">';
|
||||
$module_group = modules_get_modulegroup_name($module['id_module_group']);
|
||||
|
||||
|
||||
if ($module_group === false)
|
||||
echo __('Not assigned');
|
||||
$module_group = __('Not assigned');
|
||||
else
|
||||
echo __("$module_group");
|
||||
echo '</td></tr>';
|
||||
$module_group = __("$module_group");
|
||||
|
||||
$row = array();
|
||||
$row['title'] = __('Module group');
|
||||
$row['data'] = $module_group;
|
||||
$table->data['module_group'] = $row;
|
||||
|
||||
// Description
|
||||
echo '<tr><td class="datos"><b>'.__('Description').'</b></td>';
|
||||
echo '<td class="datos" colspan="2">'. ui_print_truncate_text ($module['descripcion'], 'description', true, true, true, '[…]') .'</td></tr>';
|
||||
$row = array();
|
||||
$row['title'] = __('Description');
|
||||
$row['data'] = ui_print_truncate_text ($module['descripcion'], 'description', true, true, true, '[…]');
|
||||
$table->data['description'] = $row;
|
||||
|
||||
// Tags
|
||||
$tags = tags_get_module_tags($module['id_agente_modulo']);
|
||||
|
@ -135,8 +155,10 @@ function treeview_printModuleTable($id_module, $server_data = false) {
|
|||
$tags = implode(', ' , $tags);
|
||||
}
|
||||
|
||||
echo '<tr><td class="datos"><b>'.__('Tags').'</b></td>';
|
||||
echo '<td class="datos" colspan="2">' . $tags . '</td></tr>';
|
||||
$row = array();
|
||||
$row['title'] = __('Tags');
|
||||
$row['data'] = $tags;
|
||||
$table->data['tags'] = $row;
|
||||
|
||||
// Data
|
||||
$last_data = db_get_row_filter ('tagente_estado', array('id_agente_modulo' => $module['id_agente_modulo'], 'order' => array('field' => 'id_agente_estado', 'order' => 'DESC')));
|
||||
|
@ -145,28 +167,28 @@ function treeview_printModuleTable($id_module, $server_data = false) {
|
|||
else
|
||||
$data = "<span title='" . $last_data["datos"] . "' style='white-space: nowrap;'>" . substr(io_safe_output($last_data['datos']),0,12) . "</span>";
|
||||
|
||||
echo '<tr><td class="datos"><b>'.__('Last data').'</b></td>';
|
||||
echo '<td class="datos" colspan="2">';
|
||||
|
||||
if (!empty($last_data['utimestamp'])) {
|
||||
echo $data;
|
||||
$last_data_str = $data;
|
||||
|
||||
if ($module['unit'] != '') {
|
||||
echo " ";
|
||||
echo '('.$module['unit'].')';
|
||||
$last_data_str .= " ";
|
||||
$last_data_str .= '('.$module['unit'].')';
|
||||
}
|
||||
|
||||
echo " ";
|
||||
html_print_image('images/clock2.png', false, array('title' => $last_data["timestamp"], 'width' => '18px'));
|
||||
$last_data_str .= " ";
|
||||
$last_data_str .= html_print_image('images/clock2.png', true, array('title' => $last_data["timestamp"], 'width' => '18px'));
|
||||
}
|
||||
else {
|
||||
echo '<i>' . __('No data') . '</i>';
|
||||
$last_data_str = '<i>' . __('No data') . '</i>';
|
||||
}
|
||||
|
||||
echo '</td></tr>';
|
||||
$row = array();
|
||||
$row['title'] = __('Last data');
|
||||
$row['data'] = $last_data_str;
|
||||
$table->data['last_data'] = $row;
|
||||
|
||||
//End of table
|
||||
echo '</table></div>';
|
||||
html_print_table($table);
|
||||
|
||||
$id_group = agents_get_agent_group($module['id_agente']);
|
||||
$group_name = db_get_value('nombre', 'tgrupo', 'id_grupo', $id_group);
|
||||
|
@ -174,10 +196,10 @@ function treeview_printModuleTable($id_module, $server_data = false) {
|
|||
|
||||
if (can_user_access_node () && check_acl ($config["id_user"], $id_group, 'AW')) {
|
||||
// Actions table
|
||||
echo '<div style="width:90%; text-align: right; min-width: 300px;">';
|
||||
echo '<form id="module_detail" method="post" action="' . $console_url . 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=' . $module['id_agente'] . '&tab=module&edit_module=1&id_agent_module=' . $module['id_agente_modulo'] . $url_hash . '">';
|
||||
echo '<div style="width:100%; text-align: right; min-width: 300px;">';
|
||||
echo '<a target=_blank href="' . $console_url . 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=' . $module['id_agente'] . '&tab=module&edit_module=1&id_agent_module=' . $module['id_agente_modulo'] . $url_hash . '">';
|
||||
html_print_submit_button (__('Go to module edition'), 'upd_button', false, 'class="sub config"');
|
||||
echo '</form>';
|
||||
echo '</a>';
|
||||
|
||||
echo '</div>';
|
||||
}
|
||||
|
@ -218,42 +240,53 @@ function treeview_printAlertsTable($id_module, $server_data = array()) {
|
|||
return;
|
||||
}
|
||||
|
||||
echo '<div id="id_div3" width="450px">';
|
||||
echo '<table cellspacing="4" cellpadding="4" border="0" class="databox alternate" style="width:90%; min-width: 300px;">';
|
||||
echo '<tr><th colspan=2 class="datos"><center>' . $module_name . '</center></th></tr>';
|
||||
|
||||
echo '<tr><th class="datos" style="background: #B3B3B3;"><b>'.__('Template').'</b></th>';
|
||||
echo '<th class="datos" style="background: #B3B3B3;"><b>'.__('Actions').'</b></th>';
|
||||
$table = new StdClass();
|
||||
$table->width = "100%";
|
||||
$table->style = array();
|
||||
$table->style['titles'] = 'font-weight: bold; background: #B3B3B3;';
|
||||
$table->head = array();
|
||||
$table->head[] = __('Alerts') . ": " . $module_name;
|
||||
$table->head_colspan[] = 2;
|
||||
$table->data = array();
|
||||
|
||||
$row = array();
|
||||
$row['template'] = __('Template');
|
||||
$row['actions'] = __('Actions');
|
||||
$table->data['titles'] = $row;
|
||||
|
||||
foreach($module_alerts as $module_alert) {
|
||||
//Template name
|
||||
echo '<tr>';
|
||||
$template_name = db_get_value('name','talert_templates','id',$module_alert['id_alert_template']);
|
||||
echo '<td class="datos">'.$template_name.'</td>';
|
||||
|
||||
$actions = alerts_get_alert_agent_module_actions($module_alert['id']);
|
||||
echo '<td class="datos">';
|
||||
|
||||
if (empty($actions)) {
|
||||
echo '<i>'.__('N/A').'</i>';
|
||||
$actions_list = '<i>'.__('N/A').'</i>';
|
||||
}
|
||||
else {
|
||||
echo '<ul>';
|
||||
foreach($actions as $act) {
|
||||
echo '<li>';
|
||||
echo $act['name'];
|
||||
echo '</li>';
|
||||
$actions_list = '<ul>';
|
||||
foreach($actions_list as $act) {
|
||||
$actions_list .= '<li>';
|
||||
$actions_list .= $act['name'];
|
||||
$actions_list .= '</li>';
|
||||
}
|
||||
echo '</ul>';
|
||||
$actions_list .= '</ul>';
|
||||
}
|
||||
echo '</td></tr>';
|
||||
|
||||
$row = array();
|
||||
$row['template'] = $template_name;
|
||||
$row['actions'] = $actions_list;
|
||||
$table->data['last_data'] = $row;
|
||||
}
|
||||
echo '</table>';
|
||||
|
||||
html_print_table($table);
|
||||
|
||||
if (can_user_access_node () && check_acl ($config["id_user"], $id_group, 'LW')) {
|
||||
// Actions table
|
||||
echo '<div style="width:90%; text-align: right; min-width: 300px;">';
|
||||
echo '<form id="agent_detail" method="post" action="' . $console_url . 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&search=1&module_name=' . $module_name . '&id_agente=' . $agent_id . $url_hash . '" target="_blank">';
|
||||
echo '<div style="width:100%; text-align: right; min-width: 300px;">';
|
||||
echo '<a target=_blank href="' . $console_url . 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&search=1&module_name=' . $module_name . '&id_agente=' . $agent_id . $url_hash . '" target="_blank">';
|
||||
html_print_submit_button (__('Go to alerts edition'), 'upd_button', false, 'class="sub search"');
|
||||
echo '</form>';
|
||||
echo '</a>';
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
|
@ -386,9 +419,9 @@ function treeview_printTable($id_agente, $server_data = array()) {
|
|||
|
||||
if (can_user_access_node () && check_acl ($config["id_user"], $agent["id_grupo"], "AW")) {
|
||||
$go_to_agent = '<div style="text-align: right;">';
|
||||
$go_to_agent .= '<form id="agent_detail" method="post" action="' . $console_url . 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.$url_hash.'">';
|
||||
$go_to_agent .= '<a target=_blank href="' . $console_url . 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.$url_hash.'">';
|
||||
$go_to_agent .= html_print_submit_button (__('Go to agent edition'), 'upd_button', false, 'class="sub config"', true);
|
||||
$go_to_agent .= '</form>';
|
||||
$go_to_agent .= '</a>';
|
||||
$go_to_agent .= '</div>';
|
||||
|
||||
$agent_table .= $go_to_agent;
|
||||
|
|
Loading…
Reference in New Issue