From: Davide Franco Date: Mon, 13 Dec 2010 13:49:32 +0000 (+0100) Subject: bacula-web: Improved stored bytes graph and modified dashboard design X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=8795a3d8a3c25800c6905ae1bded417cda28c121;p=bacula%2Fbacula bacula-web: Improved stored bytes graph and modified dashboard design - Improved GetStoredBytesByInterval function returning day (dd/mm) and 0 if no value returned from SQL query - Revert order of Last 7 days stored bytes (older to newer) - No legends for bars graph in bgraph.inc.php - Moved link to last 24 hours Jobs in main layout - New link to Pools and Volumes in main layout --- diff --git a/gui/bacula-web/bgraph.inc.php b/gui/bacula-web/bgraph.inc.php index ddb8e25d30..11c88d55ad 100644 --- a/gui/bacula-web/bgraph.inc.php +++ b/gui/bacula-web/bgraph.inc.php @@ -98,16 +98,19 @@ class BGraph{ // Graph title $this->plot->SetTitle( $this->title ); - //$this->plot->SetLegend(array('Engineering', 'Manufacturing', 'Administration')); // Setting up legends - $legends = array(); - foreach( $this->data as $key => $legend ) { - $this->plot->SetLegend( implode(': ',$legend) ); + if( $this->type != 'bars' ) { + $legends = array(); + foreach( $this->data as $key => $legend ) { + $this->plot->SetLegend( implode(': ',$legend) ); + } } # Turn off X tick labels and ticks because they don't apply here: $this->plot->SetXTickLabelPos('none'); $this->plot->SetXTickPos('none'); + $this->plot->SetPlotAreaWorld(NULL, 0, NULL, NULL); + $this->plot->DrawGraph(); } // end function Render() diff --git a/gui/bacula-web/bweb.inc.php b/gui/bacula-web/bweb.inc.php index d943d95552..2b544a5c8c 100644 --- a/gui/bacula-web/bweb.inc.php +++ b/gui/bacula-web/bweb.inc.php @@ -593,8 +593,15 @@ class Bweb extends DB { if( PEAR::isError( $result ) ) { die( "Unable to get Job Bytes from catalog" ); }else{ + $stored_bytes = 0; $tmp = $result->fetchRow( DB_FETCHMODE_ASSOC ); - return array( $tmp['EndTime'], $tmp['stored_bytes'] ); + + $day = date( "d/m", strtotime($end_date) ); + + if( isset( $tmp['stored_bytes'] ) ) + $stored_bytes = $tmp['stored_bytes']; + + return array( $day, $stored_bytes ); } } } // end class Bweb diff --git a/gui/bacula-web/index.php b/gui/bacula-web/index.php index 31562cab77..1c8b01dd57 100644 --- a/gui/bacula-web/index.php +++ b/gui/bacula-web/index.php @@ -220,23 +220,19 @@ foreach( $pools as $pool ) { array_push( $data, $dbSql->GetPoolsStatistics( $pool ) ); } -echo '
';
-var_dump( $data );
-echo '
'; - $graph->SetData( $data, 'pie', 'text-data-single' ); $graph->SetGraphSize( 400, 230 ); $graph->Render(); $smarty->assign('graph_pools', $graph->Get_Image_file() ); -// Stored Bytes last 7 days +// Last 7 days stored Bytes graph $data = array(); $graph = new BGraph( "graph2.png" ); $days = array(); // Get the last 7 days interval (start and end) -for( $c = 0 ; $c < 7 ; $c++ ) { +for( $c = 6 ; $c >= 0 ; $c-- ) { $today = ( mktime() - ($c * 86400) ); array_push( $days, array( 'start' => date( "Y-m-d 00:00:00", $today ), 'end' => date( "Y-m-d 23:59:00", $today ) ) ); } @@ -247,14 +243,6 @@ foreach( $days as $day ) { array_push( $days_stored_bytes, $dbSql->GetStoredBytesByInterval( $day['start'], $day['end'] ) ); } -//echo '
';
-//var_dump( $days );
-//echo '
'; - -echo '
';
-var_dump( $days_stored_bytes );
-echo '
'; - $graph->SetData( $days_stored_bytes, 'bars', 'text-data' ); $graph->SetGraphSize( 400, 230 ); diff --git a/gui/bacula-web/templates/index.tpl b/gui/bacula-web/templates/index.tpl index ccb6c1059d..95820a5318 100644 --- a/gui/bacula-web/templates/index.tpl +++ b/gui/bacula-web/templates/index.tpl @@ -41,6 +41,9 @@

Pools and volumes status

+
+ Pools and Volumes status +

@@ -92,6 +95,9 @@

Job Status Report (last 24 hours)

+
+ Show last jobs status +

diff --git a/gui/bacula-web/templates/last_run_report.tpl b/gui/bacula-web/templates/last_run_report.tpl index dff638e2de..3a6718faa3 100644 --- a/gui/bacula-web/templates/last_run_report.tpl +++ b/gui/bacula-web/templates/last_run_report.tpl @@ -84,12 +84,15 @@
- + + + {t}Show details{/t}Show last jobs status +-->
{t}Last month, bytes transferred{/t}