]> git.sur5r.net Git - bacula/bacula/blobdiff - gui/bacula-web/index.php
bacula-web: Add last used volumes to main dashboard
[bacula/bacula] / gui / bacula-web / index.php
index c4736bacd2effa564bf6610d57f489741e25ffd5..2ff9bbf832f5675432043e4cb1058bf0eec489cc 100644 (file)
@@ -95,18 +95,17 @@ $smarty->assign( 'total_name_jobs', $dbSql->Get_BackupJob_Names() );
 // Get volumes list (volumes.tpl)
 $smarty->assign('pools', $dbSql->GetVolumeList() );
 
-// Last 24 hours completed jobs number (last_run_report.tpl)
-//$completed_jobs = $dbSql->GetLastJobs();
-//$smarty->assign( 'completed_jobs', $completed_jobs['completed_jobs'] );
-
-// Last 24 hours completed jobs number (last_run_report.tpl)
+// Last 24 hours completed jobs number
 $smarty->assign( 'completed_jobs', $dbSql->CountJobs( LAST_DAY, 'completed' ) );
 
-// Last 24 hours failed jobs number (last_run_report.tpl)
+// Last 24 hours failed jobs number
 $smarty->assign( 'failed_jobs', $dbSql->CountJobs( LAST_DAY, 'failed' ) );
 
+// Last 24 hours waiting jobs number
+$smarty->assign( 'waiting_jobs', $dbSql->CountJobs( LAST_DAY, 'waiting' ) );
+
 // Last 24 hours elapsed time (last_run_report.tpl)
-$smarty->assign( 'elapsed_jobs', $dbSql->Get_ElapsedTime_Job() );
+//$smarty->assign( 'elapsed_jobs', $dbSql->Get_ElapsedTime_Job() );
 
 // Last 24 hours Job status graph
 $data   = array();  
@@ -147,7 +146,7 @@ $days  = array();
 
 // Get the last 7 days interval (start and end)
 for( $c = 6 ; $c >= 0 ; $c-- ) {
-       $today = ( mktime() - ($c * 86400) );
+       $today = ( mktime() - ($c * LAST_DAY) );
        array_push( $days, array( 'start' => date( "Y-m-d 00:00:00", $today ), 'end' => date( "Y-m-d 23:59:00", $today ) ) );
 }
 
@@ -163,8 +162,29 @@ $graph->SetGraphSize( 400, 230 );
 $graph->Render();
 $smarty->assign('graph_stored_bytes', $graph->Get_Image_file() );
 
-if ($_GET['Full_popup'] == "yes" || $_GET['pop_graph1'] == "yes" || $_GET['pop_graph2'] == "yes")
-        $smarty->display('full_popup.tpl');
-else
-        $smarty->display('index.tpl');
+// Last 15 used volumes
+$vol_list = array();
+
+$query  = "SELECT DISTINCT Media.Volumename, Media.VolStatus, Job.JobId FROM Job ";
+$query .= "LEFT JOIN JobMedia ON Job.JobId = JobMedia.JobId ";
+$query .= "LEFT JOIN Media ON JobMedia.MediaId = Media.MediaId ";
+$query .= "ORDER BY Job.JobId DESC ";
+$query .= "LIMIT 15 ";
+
+$result = $dbSql->db_link->query( $query );
+
+if ( PEAR::isError( $result ) )
+       die( "Unable to get last used volumes from catalog \n " . $result->getMessage() );
+else {
+       while ( $vol = $result->fetchRow( DB_FETCHMODE_ASSOC ) ) 
+               array_push( $vol_list, $vol );
+}
+$smarty->assign( 'volume_list', $vol_list );   
+
+//if ($_GET['Full_popup'] == "yes" || $_GET['pop_graph1'] == "yes" || $_GET['pop_graph2'] == "yes")
+//        $smarty->display('full_popup.tpl');
+//else
+
+// Render template
+$smarty->display('index.tpl');
 ?>