From 1dbaa6385df6bd0d776cb2f692a7aae875f80fc5 Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Mon, 21 Aug 2006 15:52:43 +0000 Subject: [PATCH] ebl Replace FileSet by JobName in bgraph git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@3325 91ce42f0-d328-0410-95d8-f526ca767f89 --- gui/bweb/cgi/bgraph.pl | 2 +- gui/bweb/cgi/bweb.pl | 12 ++++++++---- gui/bweb/lib/Bweb.pm | 25 ++++++++++++++++++++++--- gui/bweb/tpl/display_job_zoom.tpl | 11 +++++++++++ gui/bweb/tpl/graph.tpl | 22 ++++++++++++++++------ 5 files changed, 58 insertions(+), 14 deletions(-) diff --git a/gui/bweb/cgi/bgraph.pl b/gui/bweb/cgi/bgraph.pl index 0e8f6328ae..63750b530e 100755 --- a/gui/bweb/cgi/bgraph.pl +++ b/gui/bweb/cgi/bgraph.pl @@ -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; diff --git a/gui/bweb/cgi/bweb.pl b/gui/bweb/cgi/bweb.pl index 80919d18a5..ee0b59af77 100755 --- a/gui/bweb/cgi/bweb.pl +++ b/gui/bweb/cgi/bweb.pl @@ -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 "
\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 "
\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 "
\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 "
\n"; } else { diff --git a/gui/bweb/lib/Bweb.pm b/gui/bweb/lib/Bweb.pm index 2e40950b2c..15172036c8 100644 --- a/gui/bweb/lib/Bweb.pm +++ b/gui/bweb/lib/Bweb.pm @@ -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 "

This command can take long time, be patient...

"; print "
" ;
diff --git a/gui/bweb/tpl/display_job_zoom.tpl b/gui/bweb/tpl/display_job_zoom.tpl
index a3501cf292..4349fc155f 100644
--- a/gui/bweb/tpl/display_job_zoom.tpl
+++ b/gui/bweb/tpl/display_job_zoom.tpl
@@ -30,6 +30,17 @@
   
  
  
+ 
+ 
+ + + + +
+ diff --git a/gui/bweb/tpl/graph.tpl b/gui/bweb/tpl/graph.tpl index ee957c8f01..8455e244e7 100644 --- a/gui/bweb/tpl/graph.tpl +++ b/gui/bweb/tpl/graph.tpl @@ -57,10 +57,10 @@ -

File Set

- + + @@ -128,9 +128,9 @@ document.getElementById('age_').selected=true; - + for (var i=0; i < document.form1.fileset.length; ++i) { - + if (document.form1.fileset[i].value == ) { document.form1.fileset[i].selected = true; } @@ -138,6 +138,16 @@ } + + for (var i=0; i < document.form1.jobname.length; ++i) { + + if (document.form1.jobname[i].value == ) { + document.form1.jobname[i].selected = true; + } + + } + + document.getElementById('').selected=true; -- 2.39.5