]> git.sur5r.net Git - bacula/bacula/commitdiff
ebl Use OK status by default on graph screen
authorEric Bollengier <eric@eb.homelinux.org>
Sun, 9 Mar 2008 22:01:28 +0000 (22:01 +0000)
committerEric Bollengier <eric@eb.homelinux.org>
Sun, 9 Mar 2008 22:01:28 +0000 (22:01 +0000)
     Add progress bar to backup screen (on files and bytes)

git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@6570 91ce42f0-d328-0410-95d8-f526ca767f89

12 files changed:
gui/bweb/html/bweb.css
gui/bweb/html/bweb.js
gui/bweb/lang/en/tpl/client_job_status.tpl
gui/bweb/lang/en/tpl/graph.tpl
gui/bweb/lang/es/tpl/client_job_status.tpl
gui/bweb/lang/es/tpl/graph.tpl
gui/bweb/lang/fr/tpl/client_job_status.tpl
gui/bweb/lang/fr/tpl/graph.tpl
gui/bweb/lib/Bweb.pm
gui/bweb/technotes-2.3
gui/bweb/tpl/client_job_status.tpl
gui/bweb/tpl/graph.tpl

index d02a4ed965a57c0c836911ec5f64a841205b9441..0009dec5ab7e0166c074de911f7592638cc0e704 100644 (file)
@@ -23,6 +23,15 @@ td.joberr { background-color: red; color: white;}
   background-color: #E6E6E6;   
 }
 
+.pSliceFinished,.pSliceNotFinished
+ {
+  height: 9px;
+  margin-right: 1px;
+  margin-bottom: 1px;
+  border: solid 1px #CCCCCC;
+  background-color: #E6E6E6;   
+}
+
 .pSliceFull, .pSliceRead_Only,.pSliceArchive, .pSliceUsed, .pSliceDisabled,
 .pSliceCrit {
  border: solid 1px #BD0C10;
@@ -39,7 +48,7 @@ td.joberr { background-color: red; color: white;}
  background-color: #FFCE00;
 }
 
-.pSlicePurged, .pSliceRecycle, .pSliceOk {
+.pSliceFinished, .pSlicePurged, .pSliceRecycle, .pSliceOk {
  border: solid 1px #009900;
  background-color: #00FF00;
 }
index 1f8ae075621d8a974044acbc7ca7fb637f3c6830..c42fc3e6263afc80ac69acfc2f9fd7372cd6e0cd 100644 (file)
@@ -230,6 +230,31 @@ function percent_display(hash_values, parent)
   return parent;
 }
 
+function percent_finish(value, parent)
+{
+   var type;
+
+   var nb = parseInt(value*300/100, 10);
+   parent.title = parseInt(value*100,10)/100 + "% finished (approximate)";
+
+   var img=document.createElement('img');
+   img.className="pSliceFinished";
+   img.src="/bweb/pix.png";
+   img.width=nb;
+   parent.appendChild(img);
+
+   if (value >= 100) {
+      return;
+   }
+
+   nb = parseInt((100-value)*300/100, 10);
+   img=document.createElement('img');
+   img.className="pSliceNotFinished";
+   img.src="/bweb/pix.png";
+   img.width=nb;
+   parent.appendChild(img);       
+}
+
 function percent_usage(value, parent)
 {
    var nb_elt=percent_usage_nb_slice;
index ffc06147d0eb3e707a426799689187b53540c0c4..c209c994f9d3ff01563685971f63126f521eb6eb 100644 (file)
@@ -8,20 +8,28 @@
 
 <table>
  <tr>
-  <td> <b> Job Name: </b> <td> <td> <TMPL_VAR jobname> (<TMPL_VAR jobid>) <td> 
+  <td> <b> Job Name: </b> </td> <td> <TMPL_VAR jobname> (<TMPL_VAR jobid>) <td> 
  </tr>
  <tr>
-  <td> <b> Processing file: </b> <td> <td> <TMPL_VAR "processing file"> </td>
+  <td> <b> Processing file: </b> </td> <td> <TMPL_VAR "processing file"> </td>
  </tr>
  <tr>
-  <td> <b> Speed: </b> <td> <td> <TMPL_VAR "bytes/sec"> B/s</td>
+  <td> <b> Speed: </b> </td> <td> <TMPL_VAR "bytes/sec"> B/s</td>
  </tr>
  <tr>
-  <td> <b> Files Examined: </b> <td> <td> <TMPL_VAR "files examined"></td>
+  <td> <b> Files Examined: </b> </td> <td> <TMPL_VAR "files examined"></td>
  </tr>
  <tr>
-  <td> <b> Bytes: </b> <td> <td> <TMPL_VAR bytes></td>
+  <td> <b> Bytes: </b> </td> <td> <TMPL_VAR bytes></td>
  </tr>
+
+ <tr>
+  <td> <b> Bytes done </b> </td><td> <div id='progress1'><td>
+ </tr>
+ <tr>
+  <td> <b> Files done </b> </td><td> <div id='progress2'><td>
+ </tr>
+
 </table>
 <form name='form1' action='?' method='GET'>
 <button type="submit" class="bp" name='action' value='dsp_cur_job' 
  </div>
 
 <script type="text/javascript" language="JavaScript">
+<TMPL_IF last_jobbytes>
+  percent_finish(<TMPL_VAR jobfiles>*100/<TMPL_VAR last_jobfiles>, document.getElementById('progress1'));
+  percent_finish(<TMPL_VAR jobbytes>*100/<TMPL_VAR last_jobbytes>, document.getElementById('progress2'));
+</TMPL_IF>
   bweb_add_refresh();
 </script>
 
index 8ac27c3643b9a7b5ce0a17abfb37cb770532a353..c4d40bdd7bceab36114f2614661e3071843b3140 100644 (file)
   </td><td valign='top'>
     <h2>Status</h2>
     <select name='status' class='formulaire'>
-      <option id='status_Any' value='Any'>Any</option>
       <option id='status_T'   value='T'>Ok</option>
       <option id='status_f'   value='f'>Error</option>
       <option id='status_A'   value='A'>Canceled</option>
+      <option id='status_Any' value='Any'>Any</option>
     </select>   
   </td>
 </tr>
index b50a535f01c2f95b789557c59f1ccdabd816feb6..82f0f547326d0ae594750a9ee76bee1c7337a7ad 100644 (file)
@@ -8,20 +8,27 @@
 
 <table>
  <tr>
-  <td> <b> Nombre Job: </b> <td> <td> <TMPL_VAR jobname> (<TMPL_VAR jobid>) <td> 
+  <td> <b> Nombre Job: </b> </td> <td> <TMPL_VAR jobname> (<TMPL_VAR jobid>) <td> 
  </tr>
  <tr>
-  <td> <b> Archivo en proceso: </b> <td> <td> <TMPL_VAR "processing file"> </td>
+  <td> <b> Archivo en proceso: </b> </td> <td> <TMPL_VAR "processing file"> </td>
  </tr>
  <tr>
-  <td> <b> Velocidad: </b> <td> <td> <TMPL_VAR "bytes/sec"> B/s</td>
+  <td> <b> Velocidad: </b> </td> <td> <TMPL_VAR "bytes/sec"> B/s</td>
  </tr>
  <tr>
-  <td> <b> Archivos Examinados: </b> <td> <td> <TMPL_VAR "files examined"></td>
+  <td> <b> Archivos Examinados: </b> </td> <td> <TMPL_VAR "files examined"></td>
  </tr>
  <tr>
-  <td> <b> Bytes: </b> <td> <td> <TMPL_VAR bytes></td>
+  <td> <b> Bytes: </b> </td> <td> <TMPL_VAR bytes></td>
  </tr>
+ <tr>
+  <td> <b> Bytes done </b> </td><td> <div id='progress1'><td>
+ </tr>
+ <tr>
+  <td> <b> Files done </b> </td><td> <div id='progress2'><td>
+ </tr>
+
 </table>
 <form name='form1' action='?' method='GET'>
 <button type="submit" class="bp" name='action' value='dsp_cur_job' 
  </div>
 
 <script type="text/javascript" language="JavaScript">
+<TMPL_IF last_jobbytes>
+  percent_finish(<TMPL_VAR jobfiles>*100/<TMPL_VAR last_jobfiles>, document.getElementById('progress1'));
+  percent_finish(<TMPL_VAR jobbytes>*100/<TMPL_VAR last_jobbytes>, document.getElementById('progress2'));
+</TMPL_IF>
   bweb_add_refresh();
 </script>
 
index f30dbe0d0b292b8eabcedc961fb5fd3dfbb03bb1..719faa22e8b1ddff058b073629f85ccf253134b7 100644 (file)
   </td><td valign='top'>
     <h2>Estado</h2>
     <select name='status' class='formulaire'>
-      <option id='status_Any' value='Any'>Cualquiera</option>
       <option id='status_T'   value='T'>Ok</option>
       <option id='status_f'   value='f'>Error</option>
       <option id='status_A'   value='A'>Cancelado</option>
+      <option id='status_Any' value='Any'>Cualquiera</option>
     </select>   
   </td>
 </tr>
index 284e1948b3f0c681076955bb3ff5fba39d61046e..5741494aea9539f92df5009bf4d6caf6e797bae3 100644 (file)
@@ -8,20 +8,27 @@
 
 <table>
  <tr>
-  <td> <b> Nom du job : </b> <td> <td> <TMPL_VAR jobname> (<TMPL_VAR jobid>) <td> 
+  <td> <b> Nom du job : </b> </td> <td> <TMPL_VAR jobname> (<TMPL_VAR jobid>) <td> 
  </tr>
  <tr>
-  <td> <b> Fichier en cours : </b> <td> <td> <TMPL_VAR "processing file"> </td>
+  <td> <b> Fichier en cours : </b> </td> <td> <TMPL_VAR "processing file"> </td>
  </tr>
  <tr>
-  <td> <b> Vitesse : </b> <td> <td> <TMPL_VAR "bytes/sec"> B/s</td>
+  <td> <b> Vitesse : </b> </td> <td> <TMPL_VAR "bytes/sec"> B/s</td>
  </tr>
  <tr>
-  <td> <b> Fichiers vus : </b> <td> <td> <TMPL_VAR "files examined"></td>
+  <td> <b> Fichiers vus : </b> </td> <td> <TMPL_VAR "files examined"></td>
  </tr>
  <tr>
-  <td> <b> Taille : </b> <td> <td> <TMPL_VAR bytes></td>
+  <td> <b> Taille : </b> </td> <td> <TMPL_VAR bytes></td>
  </tr>
+ <tr>
+  <td> <b> Bytes done </b> </td><td> <div id='progress1'><td>
+ </tr>
+ <tr>
+  <td> <b> Files done </b> </td><td> <div id='progress2'><td>
+ </tr>
+
 </table>
 <form name='form1' action='?' method='GET'>
 <button type="submit" class="bp" name='action' value='dsp_cur_job' 
  </div>
 
 <script type="text/javascript" language="JavaScript">
+<TMPL_IF last_jobbytes>
+  percent_finish(<TMPL_VAR jobfiles>*100/<TMPL_VAR last_jobfiles>, document.getElementById('progress1'));
+  percent_finish(<TMPL_VAR jobbytes>*100/<TMPL_VAR last_jobbytes>, document.getElementById('progress2'));
+</TMPL_IF>
   bweb_add_refresh();
 </script>
 
index 345ee7180493f1aff02e0f088cb36be423ba248f..43d4c0c19d37c6d14478c4b190f43293933c9c3f 100644 (file)
   </td><td valign='top'>
     <h2>Statut</h2>
     <select name='status' class='formulaire'>
-      <option id='status_Any' value='Any'>Tous</option>
       <option id='status_T'   value='T'>Ok</option>
       <option id='status_f'   value='f'>Erreur</option>
       <option id='status_A'   value='A'>Annul&eacute;</option>
+      <option id='status_Any' value='Any'>Tous</option>
     </select>   
   </td>
 </tr>
index 7af3b5ad5966cf4a8745339d5c87ba9ee319e4c8..5ccee8ca92e8c44017068f41a208ef7737953962 100644 (file)
@@ -423,13 +423,19 @@ use base q/Bweb::Gui/;
 
 sub display_running_job
 {
-    my ($self, $conf, $jobid) = @_ ;
-
+    my ($self, $conf, $jobid, $last_jobfiles, $last_jobbytes) = @_ ;
     my $status = $self->status($conf);
 
     if ($jobid) {
        if ($status->{$jobid}) {
-           $self->display($status->{$jobid}, "client_job_status.tpl");
+           $status = $status->{$jobid};
+           $status->{last_jobbytes} = $last_jobbytes;
+           $status->{last_jobfiles} = $last_jobfiles;
+           $status->{jobbytes}=$status->{Bytes}; 
+           $status->{jobbytes} =~ s![, B/s]!!g;
+           $status->{jobfiles}=$status->{Files}; 
+           $status->{jobfiles} =~ s/,//g;
+           $self->display($status, "client_job_status.tpl");
        }
     } else {
        for my $id (keys %$status) {
@@ -3872,34 +3878,59 @@ sub display_running_job
     my ($self) = @_;
     return if $self->cant_do('r_view_running_job');
 
-    my $arg = $self->get_form('client', 'jobid');
+    my $arg = $self->get_form('jobid');
 
-    if (!$arg->{client} and $arg->{jobid}) {
-       # get security filter
-       my $filter = $self->get_client_filter();
+    return $self->error("Can't get jobid") unless ($arg->{jobid});
 
-       my $query = "
-SELECT Client.Name AS name
+    # get security filter
+    my $filter = $self->get_client_filter();
+
+    my $query = "
+SELECT Client.Name AS name, Job.Name AS jobname, 
+       Job.Level AS level
 FROM Job INNER JOIN Client USING (ClientId) $filter
 WHERE Job.JobId = $arg->{jobid}
 ";
 
-       my $row = $self->dbh_selectrow_hashref($query);
-
-       if ($row) {
-           $arg->{client} = $row->{name};
-           CGI::param('client', $arg->{client});
-       }
+    my $row = $self->dbh_selectrow_hashref($query);
+    
+    if ($row) {
+       $arg->{client} = $row->{name};
+    } else {
+       return $self->error("Can't get client");
     }
 
-    if ($arg->{client}) {
-       my $cli = new Bweb::Client(name => $arg->{client});
-       $cli->display_running_job($self->{info}, $arg->{jobid});
-       if ($arg->{jobid}) {
-           $self->get_job_log();
+    $query = "
+SELECT temp.jobname AS jobname, AVG(JobBytes) AS jobbytes,
+       AVG(JobFiles) AS jobfiles, COUNT(1) AS nb
+FROM (
+   SELECT Job.Name AS jobname, 
+          JobBytes AS jobbytes,
+          JobFiles AS jobfiles
+   FROM Job INNER JOIN Client USING (ClientId) $filter
+   WHERE Job.Name = '$row->{jobname}'
+     AND Job.Level = '$row->{level}'
+     AND Job.JobStatus = 'T'
+   ORDER BY StartTime DESC
+   LIMIT 4
+) AS temp GROUP BY temp.jobname
+";
+
+    $row = $self->dbh_selectrow_hashref($query);
+
+    if ($row) {
+       if ($row->{nb} >= 1) {
+           $arg->{jobbytes} = $row->{jobbytes};
+           $arg->{jobfiles} = $row->{jobfiles};
+       } else {
+           $arg->{jobbytes} = $arg->{jobfiles} = 0;
        }
-    } else {
-       $self->error("Can't get client or jobid");
+    }
+    my $cli = new Bweb::Client(name => $arg->{client});
+    $cli->display_running_job($self->{info}, $arg->{jobid}, 
+                             $arg->{jobfiles}, $arg->{jobbytes});
+    if ($arg->{jobid}) {
+       $self->get_job_log();
     }
 }
 
index 417c1c6e3f3ee7edf609e5598d8b80b2920d3129..1161a48a3df088f7b4cdb3a637a5ab6109ef55ce 100644 (file)
@@ -1,3 +1,6 @@
+09Mar08
+ebl  Add progress bar to backup screen (files and bytes estimation)
+
 07Mar08
 ebl  Fix btime.pl
 
index 2ccf5f0061650fb3c2988270aae2201b20535949..6624d2051d6d95a287a48229590c7e5494ba6954 100644 (file)
@@ -8,20 +8,27 @@
 
 <table>
  <tr>
-  <td> <b> __Job Name:__ </b> <td> <td> <TMPL_VAR jobname> (<TMPL_VAR jobid>) <td> 
+  <td> <b> __Job Name:__ </b> </td> <td> <TMPL_VAR jobname> (<TMPL_VAR jobid>) <td> 
  </tr>
  <tr>
-  <td> <b> __Processing file:__ </b> <td> <td> <TMPL_VAR "processing file"> </td>
+  <td> <b> __Processing file:__ </b> </td> <td> <TMPL_VAR "processing file"> </td>
  </tr>
  <tr>
-  <td> <b> __Speed:__ </b> <td> <td> <TMPL_VAR "bytes/sec"> B/s</td>
+  <td> <b> __Speed:__ </b> </td> <td> <TMPL_VAR "bytes/sec"> B/s</td>
  </tr>
  <tr>
-  <td> <b> __Files Examined:__ </b> <td> <td> <TMPL_VAR "files examined"></td>
+  <td> <b> __Files Examined:__ </b> </td> <td> <TMPL_VAR "files examined"></td>
  </tr>
  <tr>
-  <td> <b> __Bytes:__ </b> <td> <td> <TMPL_VAR bytes></td>
+  <td> <b> __Bytes:__ </b> </td> <td> <TMPL_VAR bytes></td>
  </tr>
+ <tr>
+  <td> <b> __Bytes done__ </b> </td><td> <div id='progress1'><td>
+ </tr>
+ <tr>
+  <td> <b> __Files done__ </b> </td><td> <div id='progress2'><td>
+ </tr>
+
 </table>
 <form name='form1' action='?' method='GET'>
 <button type="submit" class="bp" name='action' value='dsp_cur_job' 
  </div>
 
 <script type="text/javascript" language="JavaScript">
+<TMPL_IF last_jobbytes>
+  percent_finish(<TMPL_VAR jobfiles>*100/<TMPL_VAR last_jobfiles>, document.getElementById('progress1'));
+  percent_finish(<TMPL_VAR jobbytes>*100/<TMPL_VAR last_jobbytes>, document.getElementById('progress2'));
+</TMPL_IF>
   bweb_add_refresh();
 </script>
 
index ac875937a9a7c6458b6f07d208d3af9fa0337e0e..875db6b2d98a3e2892d941cd0c30908865a6a919 100644 (file)
   </td><td valign='top'>
     <h2>__Status__</h2>
     <select name='status' class='formulaire'>
-      <option id='status_Any' value='Any'>__Any__</option>
       <option id='status_T'   value='T'>__Ok__</option>
       <option id='status_f'   value='f'>__Error__</option>
       <option id='status_A'   value='A'>__Canceled__</option>
+      <option id='status_Any' value='Any'>__Any__</option>
     </select>   
   </td>
 </tr>