]> git.sur5r.net Git - bacula/bacula/commitdiff
ebl Replace FileSet by JobName in bgraph
authorEric Bollengier <eric@eb.homelinux.org>
Mon, 21 Aug 2006 15:52:43 +0000 (15:52 +0000)
committerEric Bollengier <eric@eb.homelinux.org>
Mon, 21 Aug 2006 15:52:43 +0000 (15:52 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@3325 91ce42f0-d328-0410-95d8-f526ca767f89

gui/bweb/cgi/bgraph.pl
gui/bweb/cgi/bweb.pl
gui/bweb/lib/Bweb.pm
gui/bweb/tpl/display_job_zoom.tpl
gui/bweb/tpl/graph.tpl

index 0e8f6328ae65de8e257dcfc73773889f64a85cd3..63750b530e6731e4016fbab36a419d07e3c05778 100755 (executable)
@@ -41,7 +41,7 @@ $bweb->connect_db();
 my $dbh = $bweb->{dbh};
 my $debug = $bweb->{debug};
 
-my $graph = CGI::param('graph') || 'begin';
+my $graph = CGI::param('graph') || 'job_size';
 my $legend = CGI::param('legend') || 'on' ;
 $legend = ($legend eq 'on')?1:0;
 
index 80919d18a526c68ebadc65c6cb5f5f347ce6693a..ee0b59af77a731e6febdea7c5d2711f112a94a53 100755 (executable)
@@ -149,10 +149,11 @@ if ($action eq 'begin') {         # main display
 
     if (defined $arg->{ach} and defined $arg->{drive} and defined $arg->{slot})
     {
-       my $b = new Bconsole(pref => $conf, log_stdout => 1) ;
+       my $a = Bweb::Autochanger::get('S1_L80', $bweb);
+       my $b = new Bconsole(pref => $conf, timeout => 300, log_stdout => 1) ;
        # TODO : use template here
        print "<pre>\n";
-       $b->send_cmd_with_drive("mount slot=$arg->{slot} storage='$arg->{ach}'",
+       $b->send_cmd_with_drive("mount slot=$arg->{slot} storage=\"" . $a->get_drive_name($arg->{drive}) . '"',
                                $arg->{drive});
        print "</pre>\n";
     } else {
@@ -161,13 +162,16 @@ if ($action eq 'begin') {         # main display
     
 } elsif ($action eq 'ach_unload') {
     my $arg = $bweb->get_form('drive', 'slot', 'ach');
+
     if (defined $arg->{ach} and defined $arg->{drive} and defined $arg->{slot})
     {
-       my $b = new Bconsole(pref => $conf, log_stdout => 1) ;
+       my $a = Bweb::Autochanger::get('S1_L80', $bweb);
+       my $b = new Bconsole(pref => $conf, timeout => 300, log_stdout => 1) ;
        # TODO : use template here
        print "<pre>\n";
-       $b->send_cmd_with_drive("umount storage='$arg->{ach}'",
+       $b->send_cmd_with_drive("umount storage=\"" . $a->get_drive_name($arg->{drive}) . '"',
                                $arg->{drive});
+
        print "</pre>\n";
 
     } else {
index 2e40950b2c56c82beddab9b77bee555e184a8f0f..15172036c8d92823831895ac7b3c002b41c572bb 100644 (file)
@@ -832,6 +832,12 @@ sub transfer
     }
 }
 
+sub get_drive_name
+{
+    my ($self, $index) = @_;
+    return $self->{drive_name}->[$index];
+}
+
 # TODO : do a tapeinfo request to get informations
 sub tapeinfo
 {
@@ -1270,7 +1276,7 @@ sub get_form
                 height => 480,
                 jobid  =>   0,
                 slot   =>   0,
-                drive  =>   undef,
+                drive  =>   0,
                 priority => 10,
                 age    => 60*60*24*7,
                 days   => 1,
@@ -1377,6 +1383,19 @@ FROM FileSet
 
     }
 
+    if ($what{db_jobnames}) {
+       my $query = "
+SELECT DISTINCT Job.Name AS jobname 
+FROM Job
+";
+
+       my $jobnames = $self->dbh_selectall_hashref($query, 'jobname');
+
+       $ret{db_jobnames} = [sort {lc($a->{jobname}) cmp lc($b->{jobname}) } 
+                              values %$jobnames] ;
+
+    }
+
     return \%ret;
 }
 
@@ -1386,7 +1405,7 @@ sub display_graph
 
     my $fields = $self->get_form(qw/age level status clients filesets 
                                   db_clients limit db_filesets width height
-                                  qclients qfilesets/);
+                                  qclients qfilesets qjobnames db_jobnames/);
                                
 
     my $url = CGI::url(-full => 0,
@@ -2656,7 +2675,7 @@ sub label_barcodes
        $slots = join(",", @{ $arg->{slots} });
     }
 
-    my $t = 60*scalar( @{ $arg->{slots} });
+    my $t = 60*scalar( @{ $arg->{slots} }) + 300 ;
     my $b = new Bconsole(pref => $self->{info}, timeout => $t,log_stdout => 1);
     print "<h1>This command can take long time, be patient...</h1>";
     print "<pre>" ;
index a3501cf2923660d403b08ce3a69d4b968d642b66..4349fc155f1b6ca30561243f7269ef6119092360 100644 (file)
   </button>
  </form>
  </td>
+ <td>
+ <form action='?'>
+  <input type='hidden' name='age' value='2678400'>
+  <input type='hidden' name='client' value='<TMPL_VAR Client>'>
+  <input type='hidden' name='jobname' value='<TMPL_VAR jobname>'>
+  <button class='formulaire' name='action' value='graph' title='view trends'>
+     View stats<br/>
+     <img src='/bweb/chart.png'>
+  </button>
+ </form>
+ </td>
  </table>
 </div>
 
index ee957c8f011c27ae7c78d0e76f7be51b2f517fc9..8455e244e73254b02d9367c4ba43dff0d4109ed2 100644 (file)
     </select>
   </td>
   <td valign='top'> 
-    <h2>File Set</h2>
-    <select name='fileset' size='15' class='formulaire' multiple>
-<TMPL_LOOP NAME=db_filesets>
-      <option><TMPL_VAR NAME=fileset></option>
+    <h2>Job Name</h2>
+    <select name='jobname' size='15' class='formulaire' multiple>
+<TMPL_LOOP NAME=db_jobnames>
+      <option><TMPL_VAR NAME=jobname></option>
 </TMPL_LOOP>
     </select>
   </td>
      document.getElementById('age_<TMPL_VAR age>').selected=true;
   </TMPL_IF>
 
-<TMPL_IF selfilesets>
+<TMPL_IF qfilesets>
   for (var i=0; i < document.form1.fileset.length; ++i) {
-  <TMPL_LOOP selfilesets>
+  <TMPL_LOOP qfilesets>
      if (document.form1.fileset[i].value == <TMPL_VAR name>) {
         document.form1.fileset[i].selected = true;
      }
   }
 </TMPL_IF>
 
+<TMPL_IF qjobnames>
+  for (var i=0; i < document.form1.jobname.length; ++i) {
+  <TMPL_LOOP qjobnames>
+     if (document.form1.jobname[i].value == <TMPL_VAR name>) {
+        document.form1.jobname[i].selected = true;
+     }
+  </TMPL_LOOP>
+  }
+</TMPL_IF>
+
   <TMPL_IF graph>
      document.getElementById('<TMPL_VAR graph>').selected=true;
   </TMPL_IF>