2014-01-31 Sergio Martin <sergio.martin@artica.es>
* mobile/operation/agent.php mobile/operation/events.php mobile/operation/modules.php mobile/operation/alerts.php mobile/include/style/main.css include/functions.php: Fixed last 10 events on agent view and improve usability and styles git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@9392 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
246e02a0f2
commit
3520e697a9
|
@ -1,3 +1,19 @@
|
|||
2014-01-31 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* mobile/operation/agent.php
|
||||
mobile/operation/events.php
|
||||
mobile/operation/modules.php
|
||||
mobile/operation/alerts.php
|
||||
mobile/include/style/main.css
|
||||
include/functions.php: Fixed last 10 events on
|
||||
agent view and improve usability and styles
|
||||
|
||||
2014-01-30 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* include/languages/es.po
|
||||
include/languages/es.mo: Update some spanish
|
||||
bad translations
|
||||
|
||||
2014-01-30 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* operation/gis_maps/ajax.php: Fixed broken agent
|
||||
|
|
|
@ -1821,7 +1821,7 @@ function get_periods ($custom = true, $show_default = true) {
|
|||
if ($custom) {
|
||||
$periods[-1] = __('custom');
|
||||
}
|
||||
|
||||
|
||||
if (empty($config['interval_values'])) {
|
||||
if ($show_default) {
|
||||
$periods[SECONDS_5MINUTES] = sprintf(__('%s minutes'), '5');
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
* {
|
||||
text-decoration: none !important;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
body {
|
||||
|
@ -8,7 +9,6 @@ body {
|
|||
direction: ltr;
|
||||
display: block;
|
||||
font-family: Arial,Helvetica,sans-serif;
|
||||
font-size: 12px;
|
||||
margin: 0;
|
||||
text-align: left;
|
||||
vertical-align: top;
|
||||
|
@ -27,12 +27,14 @@ body {
|
|||
}
|
||||
|
||||
/*INIT----------Tactical styles-----------------------------------------*/
|
||||
/* Common */
|
||||
#tactical1 *, #tactical2 * {
|
||||
font-size: 12px !important;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#tactical1 a, #tactical2 a {
|
||||
font-size: 18px !important;
|
||||
font-weight: bold;
|
||||
color: #222;
|
||||
}
|
||||
|
||||
legend {
|
||||
|
@ -47,6 +49,24 @@ legend {
|
|||
font-weight: normal !important;
|
||||
text-shadow: none !important;
|
||||
}
|
||||
|
||||
/* For mobiles */
|
||||
@media screen and (max-width: 750px)
|
||||
{
|
||||
#tactical1 *, #tactical2 * {
|
||||
font-size: 12px;
|
||||
}
|
||||
#tactical1 a, #tactical2 a {
|
||||
font-size: 18px;
|
||||
}
|
||||
}
|
||||
/* For tablets */
|
||||
@media screen and (min-width: 750px)
|
||||
{
|
||||
#tactical1 a, #tactical2 a {
|
||||
font-size: 25px !important;
|
||||
}
|
||||
}
|
||||
/*END-----------Tactical styles-----------------------------------------*/
|
||||
|
||||
#status_pie {
|
||||
|
@ -250,6 +270,14 @@ table#list_events th {
|
|||
border: 0px;
|
||||
}
|
||||
|
||||
div.graph {
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.tickLabels * {
|
||||
font-size: 10px !important;
|
||||
}
|
||||
|
||||
table.alternate tr:nth-child(odd) td, table.alternate tr:nth-child(odd) th{
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
@ -457,6 +485,15 @@ table.event_details td.cell_event_name {
|
|||
font-size: 12px !important;
|
||||
}
|
||||
|
||||
.agent_details {
|
||||
line-height: 25px;
|
||||
}
|
||||
|
||||
.agent_name {
|
||||
font-weight: bold;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 25em) {
|
||||
#list_agents .cell_2 .ui-table-cell-label,
|
||||
#list_agents .cell_3 .ui-table-cell-label,
|
||||
|
@ -573,6 +610,11 @@ table.event_details td.cell_event_name {
|
|||
color: #000000 !important;
|
||||
}
|
||||
|
||||
#list_Modules .module_name {
|
||||
font-size: 15px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 25em) {
|
||||
#list_Modules_Embedded .cell_1 .ui-table-cell-label,
|
||||
#list_Modules_Embedded .cell_4 .ui-table-cell-label {
|
||||
|
@ -827,7 +869,11 @@ li.ui-btn {
|
|||
}
|
||||
|
||||
* {
|
||||
font-size: 18px;
|
||||
font-size: 18px !important;
|
||||
}
|
||||
|
||||
.event_name {
|
||||
font-size: 18px !important;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -837,9 +883,9 @@ li.ui-btn {
|
|||
max-width: 300px;
|
||||
}
|
||||
|
||||
#logout_dialog-button_close {
|
||||
display: block;
|
||||
margin: 15px auto;
|
||||
.event_name {
|
||||
font-size: 15px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#login_container #login_btn-container {
|
||||
|
|
|
@ -65,6 +65,7 @@ class Agent {
|
|||
$system = System::getInstance();
|
||||
|
||||
$ui->createPage();
|
||||
|
||||
if ($this->id != 0) {
|
||||
$agent_name = (string) agents_get_name ($this->id);
|
||||
|
||||
|
@ -109,20 +110,22 @@ class Agent {
|
|||
if (!empty($addresses)) {
|
||||
$ip .= ui_print_help_tip(__('Other IP addresses').': <br>'.implode('<br>',$addresses), true);
|
||||
}
|
||||
$ip .= '<br />';
|
||||
|
||||
$last_contant = '<b>' . __('Last contact') . ' / ' . __('Remote') . '</b> '
|
||||
.ui_print_timestamp ($this->agent["ultimo_contacto"], true);
|
||||
$last_contact = __('Last contact') . ' / ' . __('Remote') . '<b>: '
|
||||
.ui_print_timestamp ($this->agent["ultimo_contacto"], true) . '</b><br />';
|
||||
|
||||
$description =
|
||||
empty($agent["comentarios"]) ? '<em>' . __('N/A') . '</em>' : $this->agent["comentarios"];
|
||||
empty($agent["comentarios"]) ? '' : $this->agent["comentarios"] . '<br />';
|
||||
|
||||
|
||||
|
||||
$html = ui_print_group_icon ($this->agent["id_grupo"], true) . ' ';
|
||||
$html .= $agent_name . '<br />';
|
||||
$html .= $ip . '<br />';
|
||||
$html .= $last_contant . '<br />';
|
||||
$html .= $description . '<br />';
|
||||
$html = '<div class="agent_details">';
|
||||
$html .= ui_print_group_icon ($this->agent["id_grupo"], true) . ' ';
|
||||
$html .= '<span class="agent_name">' . $agent_name . '</span><br />';
|
||||
$html .= $ip;
|
||||
$html .= $last_contact;
|
||||
$html .= $description;
|
||||
$html .= '</div>';
|
||||
|
||||
$ui->contentGridAddCell($html);
|
||||
ob_start();
|
||||
|
@ -132,6 +135,7 @@ class Agent {
|
|||
$html .= "<b>" . __('Events (24h)') . "</b><br />";
|
||||
$html .= graph_graphic_agentevents(
|
||||
$this->id, 250, 15, 86400, ui_get_full_url(false), true);
|
||||
$html .= '<br><br>';
|
||||
$ui->contentGridAddCell($html);
|
||||
$ui->contentEndGrid();
|
||||
|
||||
|
@ -153,12 +157,10 @@ class Agent {
|
|||
$ui->contentEndCollapsible();
|
||||
|
||||
$events = new Events();
|
||||
$filters = array('id_agent' => $this->id);
|
||||
$events->setFilters($filters);
|
||||
$events->disabledColumns(array('agent'));
|
||||
$events->setReadOnly();
|
||||
$ui->contentBeginCollapsible(sprintf(__('Last %s Events'), $system->getPageSize()));
|
||||
$ui->contentCollapsibleAddItem($events->listEventsHtml(0, true));
|
||||
$tabledata = $events->listEventsHtml(0, true, 'last_agent_events');
|
||||
$ui->contentCollapsibleAddItem($tabledata['table']);
|
||||
$ui->contentCollapsibleAddItem($events->putEventsTableJS($this->id));
|
||||
$ui->contentEndCollapsible();
|
||||
}
|
||||
$ui->endContent();
|
||||
|
|
|
@ -258,7 +258,7 @@ class Alerts {
|
|||
}
|
||||
|
||||
$row = array();
|
||||
if ($this->columns['agent']) {
|
||||
if (isset($this->columns['agent']) && $this->columns['agent']) {
|
||||
$row[__('Agent')] = sprintf($disabled_style,
|
||||
'<a class="ui-link" data-ajax="false" href="index.php?page=agent&id=' . $alert['id_agente'] . '">' . io_safe_output($alert['agent_name'])) . '</a>';
|
||||
}
|
||||
|
|
|
@ -59,7 +59,17 @@ class Events {
|
|||
else {
|
||||
switch ($parameter2) {
|
||||
case 'get_events':
|
||||
$this->eventsGetFilters();
|
||||
if ($system->getRequest('agent_events', '0') == 1) {
|
||||
$this->disabledColumns(array('agent'));
|
||||
$filters = array('id_agent' => $system->getRequest('id_agent', 0));
|
||||
$this->setFilters($filters);
|
||||
$this->setReadOnly();
|
||||
$this->eventsGetFilters();
|
||||
}
|
||||
else {
|
||||
$this->eventsGetFilters();
|
||||
}
|
||||
|
||||
$page = $system->getRequest('page', 0);
|
||||
|
||||
$system = System::getInstance();
|
||||
|
@ -85,7 +95,7 @@ class Events {
|
|||
break;
|
||||
}
|
||||
|
||||
if($event['criticity'] == EVENT_CRIT_WARNING) {
|
||||
if($event['criticity'] == EVENT_CRIT_WARNING || $event['criticity'] == EVENT_CRIT_MAINTENANCE ) {
|
||||
$img_st = str_replace("white.png", "dark.png", $img_st);
|
||||
}
|
||||
|
||||
|
@ -100,7 +110,7 @@ class Events {
|
|||
}
|
||||
|
||||
$row = array();
|
||||
$row[] = $open_link . '<b class="ui-table-cell-label">' . __('Event Name') . '</b>' . io_safe_output($event['evento']) . $close_link;
|
||||
$row[] = $open_link . '<b class="ui-table-cell-label">' . __('Event Name') . '</b><div class="event_name">' . io_safe_output($event['evento']) . '</div>' . $close_link;
|
||||
|
||||
if ($event["id_agente"] == 0) {
|
||||
$agent_name = __('System');
|
||||
|
@ -365,12 +375,15 @@ class Events {
|
|||
if ($this->filter > 0) {
|
||||
$this->loadPresetFilter();
|
||||
}
|
||||
|
||||
$this->limit = $system->getRequest('limit', -1);
|
||||
}
|
||||
|
||||
public function setFilters($filters) {
|
||||
if (isset($filters['id_agent'])) {
|
||||
$this->id_agent = $filters['id_agent'];
|
||||
}
|
||||
|
||||
if (isset($filters['all_events'])) {
|
||||
$this->all_events = $filters['all_events'];
|
||||
}
|
||||
|
@ -700,10 +713,17 @@ class Events {
|
|||
}
|
||||
//--------------------------------------------------------------
|
||||
|
||||
|
||||
if (isset($this->limit) && $this->limit != -1) {
|
||||
$offset = 0;
|
||||
$pagination = $this->limit;
|
||||
}
|
||||
else {
|
||||
$offset = $page * $system->getPageSize();
|
||||
$pagination = $system->getPageSize();
|
||||
}
|
||||
|
||||
$events_db = events_get_events_grouped($sql_post,
|
||||
$page * $system->getPageSize(), $system->getPageSize(), false, false);
|
||||
$offset, $pagination, false, false);
|
||||
if (empty($events_db)) {
|
||||
$events_db = array();
|
||||
}
|
||||
|
@ -713,7 +733,7 @@ class Events {
|
|||
return array('events' => $events_db, 'total' => $total_events);
|
||||
}
|
||||
|
||||
public function listEventsHtml($page = 0, $return = false) {
|
||||
public function listEventsHtml($page = 0, $return = false, $id_table = 'list_events') {
|
||||
$system = System::getInstance();
|
||||
|
||||
$listEvents = $this->getListEvents($page);
|
||||
|
@ -732,7 +752,7 @@ class Events {
|
|||
else {
|
||||
// Create an empty table to be filled from ajax
|
||||
$table = new Table();
|
||||
$table->id = 'list_events';
|
||||
$table->id = $id_table;
|
||||
|
||||
if (!$return) {
|
||||
$ui->contentAddHtml($table->getHTML());
|
||||
|
@ -747,11 +767,19 @@ class Events {
|
|||
$this->addJavascriptDialog();
|
||||
}
|
||||
else {
|
||||
return $table->getHTML();
|
||||
$this->addJavascriptAddBottom();
|
||||
|
||||
return array('table' => $table->getHTML(), 'data' => $events_db);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function putEventsTableJS($id_agent) {
|
||||
return "<script type=\"text/javascript\">
|
||||
ajax_load_latest_agent_events(" . $id_agent . ", 10);
|
||||
</script>";
|
||||
}
|
||||
|
||||
private function addJavascriptDialog() {
|
||||
$ui = Ui::getInstance();
|
||||
|
||||
|
@ -891,14 +919,13 @@ class Events {
|
|||
$ui->contentAddHtml("<script type=\"text/javascript\">
|
||||
var load_more_rows = 1;
|
||||
var page = 0;
|
||||
|
||||
function add_rows(data) {
|
||||
function add_rows(data, table_id) {
|
||||
if (data.end) {
|
||||
$(\"#loading_rows\").hide();
|
||||
}
|
||||
else {
|
||||
$.each(data.events, function(key, event) {
|
||||
$(\"table#list_events tbody\").append(
|
||||
$(\"table#\"+table_id+\" tbody\").append(
|
||||
\"<tr class='events \" + event[2] + \"'>\" +
|
||||
\"<td class='cell_0'>\" +
|
||||
event[0] +
|
||||
|
@ -917,7 +944,6 @@ class Events {
|
|||
|
||||
function ajax_load_rows() {
|
||||
if (load_more_rows) {
|
||||
|
||||
load_more_rows = 0;
|
||||
|
||||
postvars = {};
|
||||
|
@ -937,30 +963,48 @@ class Events {
|
|||
$.post(\"index.php\",
|
||||
postvars,
|
||||
function (data) {
|
||||
add_rows(data);
|
||||
|
||||
//For large screens load the new events
|
||||
//Check if the end of the event list tables is in the client limits
|
||||
var table_end = $('#list_events').offset().top + $('#list_events').height();
|
||||
if (table_end < document.documentElement.clientHeight) {
|
||||
ajax_load_rows();
|
||||
add_rows(data, 'list_events');
|
||||
|
||||
if($('#list_events').offset() != undefined) {
|
||||
//For large screens load the new events
|
||||
//Check if the end of the event list tables is in the client limits
|
||||
var table_end = $('#list_events').offset().top + $('#list_events').height();
|
||||
if (table_end < document.documentElement.clientHeight) {
|
||||
ajax_load_rows();
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
\"json\");
|
||||
}
|
||||
}
|
||||
|
||||
function ajax_load_latest_agent_events(id_agent, limit) {
|
||||
postvars = {};
|
||||
postvars[\"action\"] = \"ajax\";
|
||||
postvars[\"parameter1\"] = \"events\";
|
||||
postvars[\"parameter2\"] = \"get_events\";
|
||||
postvars[\"agent_events\"] = \"1\";
|
||||
postvars[\"id_agent\"] = id_agent;
|
||||
postvars[\"limit\"] = limit;
|
||||
|
||||
$.post(\"index.php\",
|
||||
postvars,
|
||||
function (data) {
|
||||
add_rows(data, 'last_agent_events');
|
||||
},
|
||||
\"json\");
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
ajax_load_rows();
|
||||
|
||||
$(window).bind(\"scroll\", function () {
|
||||
custom_scroll();
|
||||
});
|
||||
|
||||
$(window).on(\"touchmove\", function(event) {
|
||||
custom_scroll();
|
||||
});
|
||||
ajax_load_rows();
|
||||
|
||||
$(window).bind(\"scroll\", function () {
|
||||
custom_scroll();
|
||||
});
|
||||
|
||||
$(window).on(\"touchmove\", function(event) {
|
||||
custom_scroll();
|
||||
});
|
||||
});
|
||||
|
||||
function custom_scroll() {
|
||||
|
|
|
@ -407,12 +407,12 @@ class Modules {
|
|||
$row = array();
|
||||
|
||||
$row[0] = $row[__('Module name')] =
|
||||
'<span class="data">'.$module['module_name']."</span>";
|
||||
'<span class="data module_name">'.ui_print_truncate_text($module['module_name'], 30, false)."</span>";
|
||||
|
||||
if ($this->columns['agent']) {
|
||||
$row[1] = $row[__('Agent name')] =
|
||||
'<span class="data"><span class="show_collapside" style="display: none; font-weight: bolder;">' . __('Agent') . ' </span>' .
|
||||
'<a class="ui-link" data-ajax="false" href="index.php?page=agent&id=' . $module["id_agent"] . '">' . $module['agent_name'] . '</a>' .
|
||||
'<a class="ui-link" data-ajax="false" href="index.php?page=agent&id=' . $module["id_agent"] . '">' . ui_print_truncate_text($module['agent_name'], 50, false) . '</a>' .
|
||||
'</span>';
|
||||
}
|
||||
if ($module['utimestamp'] == 0 && (($module['module_type'] < 21 ||
|
||||
|
@ -454,8 +454,8 @@ class Modules {
|
|||
}
|
||||
}
|
||||
|
||||
$row[4] = $row[__('Interval')] =
|
||||
($module['module_interval'] == 0) ? human_time_description_raw($module['agent_interval']) : human_time_description_raw($module['module_interval']);
|
||||
$row[__('Interval')] =
|
||||
($module['module_interval'] == 0) ? human_time_description_raw($module['agent_interval'], false, 'tiny') : human_time_description_raw($module['module_interval'], false, 'tiny');
|
||||
|
||||
$row[4] = $row[__('Interval')] = '<span class="data"><span class="show_collapside" style="display: none; font-weight: bolder;">' . __('Interval.') . ' </span>' .
|
||||
$row[__('Interval')] .
|
||||
|
@ -463,8 +463,8 @@ class Modules {
|
|||
|
||||
|
||||
$row[6] = $row[__('Timestamp')] =
|
||||
'<span class="data"><span class="show_collapside" style="display: none; font-weight: bolder;"> ' . __('Last update.') . ' </span>' .
|
||||
ui_print_timestamp($module["utimestamp"], true) . '</span>';
|
||||
'<span class="data"><span class="show_collapside" style="display: none; font-weight: bolder;">' . __('Last update.') . ' </span>' .
|
||||
ui_print_timestamp($module["utimestamp"], true, array('units' => 'tiny')) . '</span>';
|
||||
if (is_numeric($module["datos"])) {
|
||||
$output = format_numeric($module["datos"]);
|
||||
|
||||
|
@ -624,7 +624,7 @@ class Modules {
|
|||
$(\"table#list_Modules tbody\").append(\"<tr>\" +
|
||||
\"<th class='head_vertical'></th>\" +
|
||||
\"<td class='cell_1'><b class='ui-table-cell-label'>" . __('Module name') . "</b>\" + module[0] + \"</td>\" +
|
||||
\"<td class='cell_0'><b class='ui-table-cell-label'>" . __('Agent name') . "</b>\" + module[2] + \"</td>\" +
|
||||
\"<td class='cell_0'><b class='ui-table-cell-label'>" . __('Agent name') . "</b>\" + module[1] + \"</td>\" +
|
||||
\"<td class='cell_2'><b class='ui-table-cell-label'>" . __('Status') . "</b>\" + module[5] + \"</td>\" +
|
||||
\"<td class='cell_3'><b class='ui-table-cell-label'>" . __('Interval') . "</b>\" + module[4] + \"</td>\" +
|
||||
\"<td class='cell_4'><b class='ui-table-cell-label'>" . __('Timestamp') . "</b>\" + module[6] + \"</td>\" +
|
||||
|
|
Loading…
Reference in New Issue