2014-02-11 Sergio Martin <sergio.martin@artica.es>

* mobile/operation/agent.php
	mobile/operation/events.php
	mobile/operation/home.php
	mobile/operation/modules.php
	mobile/operation/alerts.php
	mobile/include/style/main.css: Improve user feedback
	with warnings when no modules or events found, and
	drawing in the header the id user logged (only in home
	screen)



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@9427 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
zarzuelo 2014-02-11 10:37:30 +00:00
parent 732df03161
commit 50ab082782
7 changed files with 84 additions and 39 deletions

View File

@ -1,3 +1,15 @@
2014-02-11 Sergio Martin <sergio.martin@artica.es>
* mobile/operation/agent.php
mobile/operation/events.php
mobile/operation/home.php
mobile/operation/modules.php
mobile/operation/alerts.php
mobile/include/style/main.css: Improve user feedback
with warnings when no modules or events found, and
drawing in the header the id user logged (only in home
screen)
2014-02-10 Sergio Martin <sergio.martin@artica.es>
* mobile/include/style/main.css: Fix ugly close dialog

View File

@ -773,7 +773,7 @@ table.event_details td.cell_event_name {
font-weight: bold;
}
#list_Modules td {
#list_Modules td, #list_agent_Modules td {
height: 35px;
padding-top: 20px;
}
@ -782,6 +782,16 @@ table.event_details td.cell_event_name {
float: left;
}
#user_logged {
position: absolute;
font-size: 11px !important;
right: 10px;
top: 8px;
background: url(../../../images/header_user.png) no-repeat right;
padding-right: 20px;
line-height: 20px;
}
@media screen and (max-width: 25em) {
#list_agent_Modules .ui-table-cell-label,
#list_agent_Modules .cell_2,
@ -1187,6 +1197,7 @@ DIV.nodata_text {
display: table-cell;
vertical-align: middle;
text-align: left;
font-size: 14px !important;
}
DIV.nodata_container {
@ -1194,7 +1205,7 @@ DIV.nodata_container {
height:100px;
background-repeat:no-repeat;
background-position: center;
margin: auto auto;
margin: 15px auto;
display: table;
}
@ -1210,6 +1221,12 @@ DIV.nodata_container {
.ui-icon-delete {
margin-top: -3px !important;
}
.empty_advice {
color: #ff0000;
margin-top: 5px !important;
}
/* JQuery Mobile responsive hack to tables with */
.ui-table-reflow.ui-responsive {
display: table !important;

View File

@ -159,7 +159,9 @@ class Agent {
$graph_js = ob_get_clean();
$html = $graph_js . $html;
unset($this->agent['fired_count']);
$html .= '<span class="agents_tiny_stats agents_tiny_stats_tactical">' . reporting_tiny_stats($this->agent, true) . ' </span><br>';
if ($this->agent['total_count'] > 0) {
$html .= '<span class="agents_tiny_stats agents_tiny_stats_tactical">' . reporting_tiny_stats($this->agent, true) . ' </span><br>';
}
$html .= "<b>" . __('Events (24h)') . "</b><br /><br />";
$html .= '<div id="events_bar"></div>';
$html .= '<br>';
@ -246,6 +248,9 @@ class Agent {
postvars,
function (data) {
$('#events_bar').html(data);
if ($('.ui-block-a').css('float') != 'none') {
set_same_heigth();
}
},
\"html\");
}
@ -269,6 +274,10 @@ class Agent {
}
});
if ($('.ui-block-a').css('float') != 'none') {
set_same_heigth();
}
});
</script>");

View File

@ -275,7 +275,7 @@ class Alerts {
$ui = UI::getInstance();
if (empty($table)) {
$html = '<p style="color: #ff0000;">' . __('No alerts') . '</p>';
$html = '<p class="empty_advice">' . __('No alerts') . '</p>';
if (!$return) {
$ui->contentAddHtml($html);
}

View File

@ -95,7 +95,9 @@ class Events {
break;
}
if($event['criticity'] == EVENT_CRIT_WARNING || $event['criticity'] == EVENT_CRIT_MAINTENANCE ) {
if($event['criticity'] == EVENT_CRIT_WARNING ||
$event['criticity'] == EVENT_CRIT_MAINTENANCE ||
$event['criticity'] == EVENT_CRIT_MINOR) {
$img_st = str_replace("white.png", "dark.png", $img_st);
}
@ -742,42 +744,30 @@ class Events {
public function listEventsHtml($page = 0, $return = false, $id_table = 'list_events') {
$system = System::getInstance();
$listEvents = $this->getListEvents($page);
$events_db = $listEvents['events'];
$total_events = $listEvents['total'];
$ui = Ui::getInstance();
if (empty($events_db)) {
if (!$return) {
$ui->contentAddHtml('<p style="color: #ff0000;">' . __('No events') . '</p>');
}
else {
return '<p style="color: #ff0000;">' . __('No events') . '</p>';
}
// Create an empty table to be filled from ajax
$table = new Table();
$table->id = $id_table;
$no_events = '<p id="empty_advice_events" class="empty_advice" style="display: none;">' . __('No events') . '</p>';
if (!$return) {
$ui->contentAddHtml($table->getHTML());
$ui->contentAddHtml('<div id="loading_rows">' .
html_print_image('images/spinner.gif', true) .
' ' . __('Loading...') .
'</div>' . $no_events);
$this->addJavascriptAddBottom();
$this->addJavascriptDialog();
}
else {
// Create an empty table to be filled from ajax
$table = new Table();
$table->id = $id_table;
if (!$return) {
$ui->contentAddHtml($table->getHTML());
$ui->contentAddHtml('<div id="loading_rows">' .
html_print_image('images/spinner.gif', true) .
' ' . __('Loading...') .
'</div>');
$this->addJavascriptAddBottom();
$this->addJavascriptDialog();
}
else {
$this->addJavascriptAddBottom();
$this->addJavascriptAddBottom();
return array('table' => $table->getHTML(), 'data' => $events_db);
}
return array('table' => $table->getHTML() . $no_events, 'data' => $events_db);
}
$ui->contentAddLinkListener('list_events');
@ -983,6 +973,10 @@ class Events {
ajax_load_rows();
}
}
if (data.events.length == 0 && page == 1) {
$('#empty_advice_events').show();
}
},
\"json\");
}
@ -1001,6 +995,10 @@ class Events {
postvars,
function (data) {
add_rows(data, 'last_agent_events');
if (data.events.length == 0) {
$('#last_agent_events').css('visibility', 'hidden');
$('#empty_advice_events').show();
}
},
\"json\");
}

View File

@ -37,7 +37,13 @@ class Home {
'text' => __('Logout'),
'href' => 'index.php?action=logout'));
}
$ui->createHeader(__("Home"), $left_button);
$user_logged = '';
if (isset($config['id_user'])) {
$user_logged = '<span id="user_logged">' . $config['id_user'] . '</span>';
}
$ui->createHeader(__("Home") . $user_logged, $left_button);
$ui->showFooter(false);
$ui->beginContent();
$ui->beginForm("index.php?page=agents");

View File

@ -548,10 +548,13 @@ class Modules {
//$ui->debug($listModules, true);
if ($listModules['total'] == 0) {
$html = '<p style="color: #ff0000;">' . __('No modules') . '</p>';
$html = '<p class="empty_advice">' . __('No modules') . '</p>';
if (!$return) {
$ui->contentAddHtml($html);
}
else {
return $html;
}
}
else {
if (!$return) {