From 50ab082782a88ec07295821457c811b3cc57e348 Mon Sep 17 00:00:00 2001 From: zarzuelo Date: Tue, 11 Feb 2014 10:37:30 +0000 Subject: [PATCH] 2014-02-11 Sergio Martin * 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 --- pandora_console/ChangeLog | 12 ++++ pandora_console/mobile/include/style/main.css | 21 +++++- pandora_console/mobile/operation/agent.php | 11 +++- pandora_console/mobile/operation/alerts.php | 2 +- pandora_console/mobile/operation/events.php | 64 +++++++++---------- pandora_console/mobile/operation/home.php | 8 ++- pandora_console/mobile/operation/modules.php | 5 +- 7 files changed, 84 insertions(+), 39 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 084bfc68f6..b5cccee9aa 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,15 @@ +2014-02-11 Sergio Martin + + * 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 * mobile/include/style/main.css: Fix ugly close dialog diff --git a/pandora_console/mobile/include/style/main.css b/pandora_console/mobile/include/style/main.css index 62a14ea3aa..44c7862d39 100644 --- a/pandora_console/mobile/include/style/main.css +++ b/pandora_console/mobile/include/style/main.css @@ -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; diff --git a/pandora_console/mobile/operation/agent.php b/pandora_console/mobile/operation/agent.php index 63509b6002..1d00ae110f 100644 --- a/pandora_console/mobile/operation/agent.php +++ b/pandora_console/mobile/operation/agent.php @@ -159,7 +159,9 @@ class Agent { $graph_js = ob_get_clean(); $html = $graph_js . $html; unset($this->agent['fired_count']); - $html .= '' . reporting_tiny_stats($this->agent, true) . '
'; + if ($this->agent['total_count'] > 0) { + $html .= '' . reporting_tiny_stats($this->agent, true) . '
'; + } $html .= "" . __('Events (24h)') . "

"; $html .= '
'; $html .= '
'; @@ -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(); + } }); "); diff --git a/pandora_console/mobile/operation/alerts.php b/pandora_console/mobile/operation/alerts.php index 3b85ad66d7..074afb73df 100644 --- a/pandora_console/mobile/operation/alerts.php +++ b/pandora_console/mobile/operation/alerts.php @@ -275,7 +275,7 @@ class Alerts { $ui = UI::getInstance(); if (empty($table)) { - $html = '

' . __('No alerts') . '

'; + $html = '

' . __('No alerts') . '

'; if (!$return) { $ui->contentAddHtml($html); } diff --git a/pandora_console/mobile/operation/events.php b/pandora_console/mobile/operation/events.php index ec5fcdf4eb..837292bb3f 100644 --- a/pandora_console/mobile/operation/events.php +++ b/pandora_console/mobile/operation/events.php @@ -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('

' . __('No events') . '

'); - } - else { - return '

' . __('No events') . '

'; - } + + // Create an empty table to be filled from ajax + $table = new Table(); + $table->id = $id_table; + + $no_events = ''; + + if (!$return) { + $ui->contentAddHtml($table->getHTML()); + + $ui->contentAddHtml('
' . + html_print_image('images/spinner.gif', true) . + ' ' . __('Loading...') . + '
' . $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('
' . - html_print_image('images/spinner.gif', true) . - ' ' . __('Loading...') . - '
'); - - $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\"); } diff --git a/pandora_console/mobile/operation/home.php b/pandora_console/mobile/operation/home.php index 351dcd43c3..34d3584f23 100644 --- a/pandora_console/mobile/operation/home.php +++ b/pandora_console/mobile/operation/home.php @@ -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 = '' . $config['id_user'] . ''; + } + + $ui->createHeader(__("Home") . $user_logged, $left_button); $ui->showFooter(false); $ui->beginContent(); $ui->beginForm("index.php?page=agents"); diff --git a/pandora_console/mobile/operation/modules.php b/pandora_console/mobile/operation/modules.php index 5a16fb5fd7..3506e05763 100644 --- a/pandora_console/mobile/operation/modules.php +++ b/pandora_console/mobile/operation/modules.php @@ -548,10 +548,13 @@ class Modules { //$ui->debug($listModules, true); if ($listModules['total'] == 0) { - $html = '

' . __('No modules') . '

'; + $html = '

' . __('No modules') . '

'; if (!$return) { $ui->contentAddHtml($html); } + else { + return $html; + } } else { if (!$return) {