]> git.sur5r.net Git - bacula/bacula/commitdiff
bacula-web: Added last jobs in Backup Job report page
authorDavide Franco <bacula-dev@dflc.ch>
Fri, 25 Feb 2011 15:52:36 +0000 (16:52 +0100)
committerKern Sibbald <kern@sibbald.com>
Sat, 20 Apr 2013 12:43:39 +0000 (14:43 +0200)
 - Added last 10 job per Job name in this page

gui/bacula-web/backupjob-report.php
gui/bacula-web/templates/backupjob-report.tpl

index 653a4a0bb2d07328fe08c7b3a85a719cd3402a08..e8680143444ec03c0f622c3fec2220e562cff152 100644 (file)
   $graph->SetGraphSize( 400, 230 );
 
   $graph->Render();
-  $smarty->assign('graph_stored_files', $graph->Get_Image_file() );  
+  $smarty->assign('graph_stored_files', $graph->Get_Image_file() );
+
+  // Last 10 jobs
+  $query    = "SELECT JobId, Level, JobFiles, JobBytes, JobStatus, EndTime, Name ";  
+  $query   .= "FROM Job ";
+  $query   .= "WHERE Name = '$backupjob_name' ";
+  $query   .= "ORDER BY EndTime DESC ";
+  $query   .= "LIMIT 10 ";
+  
+  $jobs                = array();
+  $joblevel = array( 'I' => 'Incr', 'D' => 'Diff', 'F' => 'Full' );
+  $result      = $dbSql->db_link->query( $query );
+  
+  if( ! PEAR::isError( $result ) )
+  {
+       while( $job = $result->fetchRow( DB_FETCHMODE_ASSOC ) ) {
+               $job['Level'] = $joblevel[ $job['Level'] ];
+               array_push( $jobs, $job);
+       }
+               
+  }else
+       die( "Unable to get last jobs from catalog " . $result->getMessage() );
+    
+  $smarty->assign('jobs', $jobs );
   
   $smarty->assign('backupjob_name', $backupjob_name );
   $smarty->assign('backupjob_period', $backupjob_period );
index 972130a0fe915883e821fec5480a601274ce536a..8ae1b0c616cf0fa700f53d96536d008d25f192f2 100644 (file)
   <!-- Last jobs list -->
   <div class="box">
        <p class="title">Last jobs</p>
+       
+       <table>
+               <tr>
+                       <td class="tbl_header">Job Id</td>
+                       <td class="tbl_header">Level</td>
+                       <td class="tbl_header">Files</td>
+                       <td class="tbl_header">Bytes</td>
+                       <td class="tbl_header">End time</td>
+               </tr>
+               {foreach from=$jobs item=job}
+               <tr>
+                       <td>{$job.JobId}</td>
+                       <td>{$job.Level}</td>
+                       <td>{$job.JobFiles}</td>
+                       <td>{$job.JobBytes}</td>
+                       <td>{$job.EndTime}</td>
+               </tr>
+               {/foreach}
+       </table>
   </div> <!-- end div class=box -->
   
   <!-- Transfered Bytes graph -->