]> git.sur5r.net Git - bacula/bacula/commitdiff
bacula-web: Improved stored bytes graph and modified dashboard design
authorDavide Franco <bacula-dev@dflc.ch>
Mon, 13 Dec 2010 13:49:32 +0000 (14:49 +0100)
committerKern Sibbald <kern@sibbald.com>
Sat, 20 Apr 2013 12:43:32 +0000 (14:43 +0200)
 - 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

gui/bacula-web/bgraph.inc.php
gui/bacula-web/bweb.inc.php
gui/bacula-web/index.php
gui/bacula-web/templates/index.tpl
gui/bacula-web/templates/last_run_report.tpl

index ddb8e25d302a30ee528f32bc730dee13bc6ef446..11c88d55adb8a486ab2ad4a5d41a2cb69c3619f1 100644 (file)
@@ -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()
index d943d955527d9c651c180455104125e57551579a..2b544a5c8cc538c73042fd3400b9be211198e813 100644 (file)
@@ -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
index 31562cab77c37baf609fb28ad8fe599ab401beb6..1c8b01dd57176b0c18058789cbbb3c3b070dfd7d 100644 (file)
@@ -220,23 +220,19 @@ foreach( $pools as $pool ) {
        array_push( $data, $dbSql->GetPoolsStatistics( $pool ) );
 }
 
-echo '<pre>';
-var_dump( $data );
-echo '</pre>';
-
 $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 '<pre>';
-//var_dump( $days );
-//echo '</pre>';
-
-echo '<pre>';
-var_dump( $days_stored_bytes );
-echo '</pre>';
-
 $graph->SetData( $days_stored_bytes, 'bars', 'text-data' );
 $graph->SetGraphSize( 400, 230 );
 
index ccb6c1059d957391f9dda6d7c257cf5ade5f160d..95820a5318ed0f92826dcc4e10ef5d7b07cbacee 100644 (file)
@@ -41,6 +41,9 @@
   <div class="box">
        <p class="title">Pools and volumes status</p>
          <img src="{$graph_pools}" alt="" />
+         <br />
+         <a href="pools.php" title="Show pools and volumes status">Pools and Volumes status</a>
+         <br /> <br />
   </div> <!-- end div box -->
   
   <div class="box">
@@ -92,6 +95,9 @@
   <div class="box">
        <p class="title">Job Status Report (last 24 hours)</p>
          <img src="{$graph_jobs}" alt="" />
+       <br />
+       <a href="jobs.php" title="Show last 24 hours jobs status">Show last jobs status</a>
+       <br /> <br />
   </div> <!-- end div box -->
   
 
index dff638e2de01cdcff0d9ce9c2ac8be94378fae32..3a6718faa32aaa0cf134c619653a407fca77409c 100644 (file)
  
  <form method="get" action="report.php" target="_blank">
    <table width="100%" cellpadding="0" cellspacing="3" border="0">
-         <tr>
+
+<!-- 
+<tr>
                <td colspan=2 align=center>
-                       <!-- <a href="javascript:OpenWin('index.php?Full_popup=yes','490','350')">{t}Show details{/t}</a> -->
+                       <a href="javascript:OpenWin('index.php?Full_popup=yes','490','350')">{t}Show details{/t}</a> 
                        <a href="jobs.php" title="Show last jobs details">Show last jobs status</a>
                </td>
          </tr>   
+-->
          <tr>
                <td colspan=2 align=center>
                  <a href="javascript:OpenWin('index.php?pop_graph1=yes','600','400')">{t}Last month, bytes transferred{/t}</a>