X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=gui%2Fbacula-web%2Findex.php;h=a6e2b069401c2125edfd3f14f78875dd5eaf562a;hb=b04629b12ad3ea176b7c3fc02e8a012d76340672;hp=6bb00269845d555c2686ba7458223a89c0f4b72e;hpb=f840586aaa9ebe388e5a1f428dd7955aaace61fa;p=bacula%2Fbacula diff --git a/gui/bacula-web/index.php b/gui/bacula-web/index.php index 6bb0026984..a6e2b06940 100644 --- a/gui/bacula-web/index.php +++ b/gui/bacula-web/index.php @@ -1,7 +1,8 @@ compile_check = true; -$smarty->debugging = false; -$smarty->force_compile = true; - -$smarty->template_dir = "./templates"; -$smarty->compile_dir = "./templates_c"; -$smarty->config_dir = "./configs"; - -/* -$smarty->config_load("bacula.conf"); // Load config file -$mode = $smarty->get_config_vars("mode"); -*/ // Lite o Extend? - -// Getting mode from config file -$mode = $dbSql->get_config_param("mode"); -if( $mode == false ) - $mode = "Lite"; - -$smarty->assign( "mode", $mode ); - -// Determine which template to show -$indexreport = $dbSql->get_config_param( "IndexReport" ); - -if( $indexreport == 0 ) { - $smarty->assign( "last_report", "last_run_report.tpl" ); -}else { - $smarty->assign( "last_report", "report_select.tpl" ); -} - // Assign to template catalogs number -$smarty->assign( "dbs", $dbSql->Get_Nb_Catalogs() ); - -//Assign dbs +//$dbSql->tpl->assign( "dbs", $dbSql->bwcfg->Count_Catalogs() ); +// Assign dbs /* if ( count($dbSql->dbs) >1 ) { $smarty->assign("dbs", $dbSql->dbs); $smarty->assign("dbs_now", $_SESSION['DATABASE']); } */ - -// generaldata.tpl & last_run_report.tpl ( Last 24 hours report ) -$last24bytes = ""; -$query = ""; +// Catalog count +$catalog_nb = $dbSql->catalog_nb; +$dbSql->tpl->assign( 'catalog_nb', $catalog_nb ); // Stored files number -$totalfiles = $dbSql->GetStoredFiles(); -$smarty->assign('files_totales',$totalfiles); +$totalfiles = $dbSql->GetStoredFiles( ALL ); +$dbSql->tpl->assign('stored_files',$totalfiles); // Database size -$smarty->assign('database_size', $dbSql->GetDbSize()); +$dbSql->tpl->assign('database_size', $dbSql->GetDbSize()); // Overall stored bytes $result = $dbSql->GetStoredBytes( ALL ); -$smarty->assign('stored_bytes', $dbSql->human_file_size($result['stored_bytes']) ); +$dbSql->tpl->assign('stored_bytes', $dbSql->human_file_size($result['stored_bytes']) ); // Total stored bytes since last 24 hours $result = $dbSql->GetStoredBytes( LAST_DAY ); -$smarty->assign('bytes_totales', $dbSql->human_file_size($result['stored_bytes']) ); +$dbSql->tpl->assign('bytes_last', $dbSql->human_file_size($result['stored_bytes']) ); + +// Total stored files since last 24 hours +$files_last = $dbSql->GetStoredFiles( LAST_DAY ); +$dbSql->tpl->assign('files_last', $files_last ); + // Number of clients $nb_clients = $dbSql->Get_Nb_Clients(); -$smarty->assign('clientes_totales',$nb_clients["nb_client"] ); +$dbSql->tpl->assign('clientes_totales',$nb_clients["nb_client"] ); // Backup Job list for report.tpl and last_run_report.tpl -$smarty->assign( 'total_name_jobs', $dbSql->Get_BackupJob_Names() ); +$dbSql->tpl->assign( 'jobs_list', $dbSql->Get_BackupJob_Names() ); // Get volumes list (volumes.tpl) -$smarty->assign('pools', $dbSql->GetVolumeList() ); +$dbSql->tpl->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 +$dbSql->tpl->assign( 'completed_jobs', $dbSql->CountJobs( LAST_DAY, 'completed' ) ); -// Last 24 hours completed jobs number (last_run_report.tpl) -$smarty->assign( 'completed_jobs', $dbSql->CountJobs( LAST_DAY, 'completed' ) ); +// Last 24 hours failed jobs number +$dbSql->tpl->assign( 'failed_jobs', $dbSql->CountJobs( LAST_DAY, 'failed' ) ); -// Last 24 hours failed jobs number (last_run_report.tpl) -$smarty->assign( 'failed_jobs', $dbSql->CountJobs( LAST_DAY, 'failed' ) ); +// Last 24 hours waiting jobs number +$dbSql->tpl->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 Levels +$dbSql->tpl->assign( 'incr_jobs', $dbSql->CountJobsbyLevel( LAST_DAY, 'I') ); +$dbSql->tpl->assign( 'diff_jobs', $dbSql->CountJobsbyLevel( LAST_DAY, 'D') ); +$dbSql->tpl->assign( 'full_jobs', $dbSql->CountJobsbyLevel( LAST_DAY, 'F') ); // Last 24 hours Job status graph $data = array(); @@ -121,7 +93,7 @@ $graph->SetData( $data, 'pie', 'text-data-single' ); $graph->SetGraphSize( 400, 230 ); $graph->Render(); -$smarty->assign('graph_jobs', $graph->Get_Image_file() ); +$dbSql->tpl->assign('graph_jobs', $graph->Get_Image_file() ); unset($graph); // Pool and volumes graph @@ -131,14 +103,14 @@ $graph = new BGraph( "graph1.png" ); $pools = $dbSql->Get_Pools_List(); foreach( $pools as $pool ) { - array_push( $data, $dbSql->GetPoolsStatistics( $pool ) ); + array_push( $data, $dbSql->CountVolumesByPool( $pool ) ); } $graph->SetData( $data, 'pie', 'text-data-single' ); $graph->SetGraphSize( 400, 230 ); $graph->Render(); -$smarty->assign('graph_pools', $graph->Get_Image_file() ); +$dbSql->tpl->assign('graph_pools', $graph->Get_Image_file() ); // Last 7 days stored Bytes graph $data = array(); @@ -161,10 +133,31 @@ $graph->SetData( $days_stored_bytes, 'bars', 'text-data' ); $graph->SetGraphSize( 400, 230 ); $graph->Render(); -$smarty->assign('graph_stored_bytes', $graph->Get_Image_file() ); +$dbSql->tpl->assign('graph_stored_bytes', $graph->Get_Image_file() ); + +// Last 15 used volumes +$vol_list = array(); + +$query = "SELECT DISTINCT Media.Volumename, Media.Lastwritten, 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 10 "; + +$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 ); +} +$dbSql->tpl->assign( 'volume_list', $vol_list ); + +//if ($_GET['Full_popup'] == "yes" || $_GET['pop_graph1'] == "yes" || $_GET['pop_graph2'] == "yes") +// $smarty->display('full_popup.tpl'); +//else -if ($_GET['Full_popup'] == "yes" || $_GET['pop_graph1'] == "yes" || $_GET['pop_graph2'] == "yes") - $smarty->display('full_popup.tpl'); -else - $smarty->display('index.tpl'); +// Render template +$dbSql->tpl->display('index.tpl'); ?>