]> git.sur5r.net Git - bacula/bacula/commitdiff
ebl Add a synthetic display_job_by_group view
authorEric Bollengier <eric@eb.homelinux.org>
Thu, 21 Jun 2007 20:58:45 +0000 (20:58 +0000)
committerEric Bollengier <eric@eb.homelinux.org>
Thu, 21 Jun 2007 20:58:45 +0000 (20:58 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@5058 91ce42f0-d328-0410-95d8-f526ca767f89

gui/bweb/cgi/bweb.pl
gui/bweb/lang/es/tpl/display_form_job.tpl
gui/bweb/lang/fr/tpl/display_form_job.tpl
gui/bweb/lib/Bweb.pm
gui/bweb/tpl/display_form_job.tpl

index 443b82f347d793657ca607c47af089a38bbe3df0..b6d1e97dfa99c86cc2c279f736b6ce7d35e4ecf8 100755 (executable)
@@ -306,6 +306,22 @@ if ($action eq 'begin') {          # main display
                       offset => $arg->{offset},
                       limit => $arg->{limit});
     print "</td></tr></table></div>";
+} elsif ($action eq 'job_group') {
+
+    print "<div><table border='0'><tr><td valign='top'>\n";
+    my $fields = $bweb->get_form(qw/limit level age 
+                                    db_client_groups qclient_groups/); # drop this to hide 
+
+    $fields->{hide_status} = 1;
+    $fields->{hide_type} = 1;
+    $fields->{action} = 'job_group';
+
+    $bweb->display($fields, "display_form_job.tpl");
+
+    print "</td><td valign='top'>";
+    $bweb->display_job_group(age => $arg->{age},  # last 7 days
+                            limit => $arg->{limit});
+    print "</td></tr></table></div>";
 } elsif ($action eq 'client_stats') {
 
     foreach my $client (CGI::param('client')) {
index 4d8c8a0628a763c16f6656d9ba2674b31db79282..fa49a45d48a3f5a0ff9e78ccf3f311b303abfdda 100644 (file)
@@ -16,6 +16,7 @@
     </select>     
   </td>
 </tr>
+<TMPL_UNLESS hide_status>
 <tr>
  <td valign='top'>
     <h2>Estado</h2>
@@ -28,6 +29,8 @@
     </select>     
   </td>
 </tr>
+</TMPL_UNLESS>
+<TMPL_IF db_pools>
 <tr>
  <td valign='top'>
     <h2>Pool</h2>
@@ -39,6 +42,7 @@
     </select>
   </td>
 </tr>
+</TMPL_IF>
 <tr>
   <td valign='top'>
     <h2>Tiempo</h2>
@@ -56,6 +60,7 @@
        class='formulaire' size='4'>
   </td>
 </tr>
+<TMPL_UNLESS hide_type>
 <tr>
   <td valign='top'> 
     <h2>Tipo Job</h2>
@@ -66,6 +71,7 @@
     </select>
   </td>
 </tr>
+</TMPL_UNLESS>
 <TMPL_IF db_clients>
 <tr>
   <td valign='top'> 
 </tr>
 -->
 </table>
-  <input type="image" name='action' value='job' src='/bweb/update.png'>
+  <input type="image" name='action'
+         value='<TMPL_IF action><TMPL_VAR action><TMPL_ELSE>job</TMPL_IF>'
+         src='/bweb/update.png'>
 
 </form>
 </div>
index a75ba9f584e3d16128393df5ff5a1876af8ccd46..d4bd3981b668fecf348098d188ac394610921e6b 100644 (file)
@@ -16,6 +16,7 @@
     </select>     
   </td>
 </tr>
+<TMPL_UNLESS hide_status>
 <tr>
  <td valign='top'>
     <h2>Statut</h2>
@@ -28,6 +29,8 @@
     </select>     
   </td>
 </tr>
+</TMPL_UNLESS>
+<TMPL_IF db_pools>
 <tr>
  <td valign='top'>
     <h2>Pool</h2>
@@ -39,6 +42,7 @@
     </select>
   </td>
 </tr>
+</TMPL_IF>
 <tr>
   <td valign='top'>
     <h2>P&eacute;riode</h2>
@@ -57,6 +61,7 @@
        class='formulaire' size='4'>
   </td>
 </tr>
+<TMPL_UNLESS hide_type>
 <tr>
   <td valign='top'> 
     <h2>Type</h2>
@@ -67,6 +72,7 @@
     </select>
   </td>
 </tr>
+</TMPL_UNLESS>
 <TMPL_IF db_clients>
 <tr>
   <td valign='top'> 
@@ -92,7 +98,9 @@
 </tr>
 </TMPL_IF>
 </table>
-  <input type="image" name='action' value='job' src='/bweb/update.png'>
+  <input type="image" name='action'
+         value='<TMPL_IF action><TMPL_VAR action><TMPL_ELSE>job</TMPL_IF>'
+         src='/bweb/update.png'>
 
 </form>
 </div>
index 96c6d119709f11dbed906016279bec7acfaa7846..e9c4bdf0826d17c97339b136113f325f0e758d07 100644 (file)
@@ -2068,6 +2068,59 @@ WHERE Job.JobId = $jobid
     $self->display($row, "display_job_zoom.tpl");
 }
 
+sub display_job_group
+{
+    my ($self, %arg) = @_;
+
+    my ($limit, $label) = $self->get_limit(groupby => 'client_group_name',  %arg);
+
+    my ($where, undef) = $self->get_param('client_groups',
+                                         'level',
+                                         'pools');
+    
+    my $query = 
+"
+SELECT client_group_name AS client_group_name,
+       jobok.jobfiles  + joberr.jobfiles  AS jobfiles,
+       jobok.jobbytes  + joberr.jobbytes  AS jobbytes,
+       jobok.joberrors + joberr.joberrors AS joberrors,
+       jobok.nbjobs  AS nbjobok,
+       joberr.nbjobs AS nbjoberr
+
+FROM (
+    SELECT client_group_name AS client_group_name, COUNT(1) AS nbjobs, 
+           SUM(JobFiles) AS jobfiles, SUM(JobBytes) AS jobbytes, 
+           SUM(JobErrors) AS joberrors
+    FROM Job JOIN client_group_member ON (Job.ClientId = client_group_member.ClientId)
+             JOIN client_group USING (client_group_id)
+    
+    WHERE JobStatus = 'T'
+    $where
+    $limit
+) AS jobok LEFT JOIN
+
+(
+    SELECT client_group_name AS client_group_name, COUNT(1) AS nbjobs, 
+           SUM(JobFiles) AS jobfiles, SUM(JobBytes) AS jobbytes, 
+           SUM(JobErrors) AS joberrors
+    FROM Job JOIN client_group_member ON (Job.ClientId = client_group_member.ClientId)
+             JOIN client_group USING (client_group_id)
+    
+    WHERE JobStatus IN ('f','E', 'A')
+    $where
+    $limit
+) AS joberr USING (client_group_name)
+
+    ";
+
+    my $all = $self->dbh_selectall_hashref($query, 'client_group_name');
+
+    my $rep = { groups => [ values %$all ], age => $arg{age} };
+                
+    $self->debug($rep);
+    $self->display($rep, "display_job_group.tpl");
+}
+
 sub display_media
 {
     my ($self, %arg) = @_ ;
index 7947819419bcbf81eea9fade15567ab153fcb5d3..857796b8cf23eb4bc0b062a9e678efa36ef7cc9c 100644 (file)
@@ -16,6 +16,7 @@
     </select>     
   </td>
 </tr>
+<TMPL_UNLESS hide_status>
 <tr>
  <td valign='top'>
     <h2>Status</h2>
@@ -28,6 +29,8 @@
     </select>     
   </td>
 </tr>
+</TMPL_UNLESS>
+<TMPL_IF db_pools>
 <tr>
  <td valign='top'>
     <h2>Pool</h2>
@@ -39,6 +42,7 @@
     </select>
   </td>
 </tr>
+</TMPL_IF>
 <tr>
   <td valign='top'>
     <h2>Age</h2>
@@ -56,6 +60,7 @@
        class='formulaire' size='4'>
   </td>
 </tr>
+<TMPL_UNLESS hide_type>
 <tr>
   <td valign='top'> 
     <h2>Job Type</h2>
@@ -66,6 +71,7 @@
     </select>
   </td>
 </tr>
+</TMPL_UNLESS>
 <TMPL_IF db_clients>
 <tr>
   <td valign='top'> 
 </tr>
 -->
 </table>
-  <input type="image" name='action' value='job' src='/bweb/update.png'>
+  <input type="image" name='action' 
+         value='<TMPL_IF action><TMPL_VAR action><TMPL_ELSE>job</TMPL_IF>'
+         src='/bweb/update.png'>
 
 </form>
 </div>