You have to remove "<!-- Remove this to activate bfileview" and "-->" from
tpl/en/display_job_zoom.tpl.
+Add (or configure) a writable location to the parameters in bweb.conf
+ 'fv_write_path' => '/var/spool/bweb',
+
You MUST use brestore.pl -b to initialize the database, and
you CAN use bfileview.pl mode=batch jobid=xxx where=/ to compute tree size.
unless ($jobid) {
$bweb->error("Can't get where or jobid");
+ $bweb->display_end();
exit 0;
}
unless ($base_fich and -w $base_fich) {
$bweb->error("fv_write_path ($base_fich) is not writable." .
" See Bweb configuration.");
+ $bweb->display_end();
exit 0;
}
exit 0;
}
+my $r = $bweb->dbh_selectrow_hashref("SELECT PurgedFiles AS ok FROM Job WHERE JobId = $jobid");
+if (!$r || $r->{ok}) {
+ $bweb->error("File information for job $jobid has been pruned from catalog");
+ $bweb->display_end();
+ exit 0;
+}
+
+$r = $bweb->dbh_selectrow_hashref("SELECT JobId AS ok FROM brestore_knownjobid WHERE JobId = $jobid");
+if (!$r || !$r->{ok}) { # TODO: compute information
+ $bweb->error("Path information for job $jobid has not been updated in the catalog");
+ $bweb->display_end();
+ exit 0;
+}
# if it's a file, display it
if ($fnid and $pathid)
{
my ($jobid, $full_name) = @_;
- my $filename = $bweb->dbh_quote(basename($full_name));
- my $path = $bweb->dbh_quote(dirname($full_name) . "/");
+ # default to /
+ my $path = "'/'";
+ my $filename = "''";
+
+ if ($full_name ne '/') {
+ $filename = $bweb->dbh_quote(basename($full_name));
+ $path = $bweb->dbh_quote(dirname($full_name) . "/");
+ }
my $attr = $bweb->dbh_selectrow_hashref("
SELECT 1 AS found,
base64_decode_lstat(12, LStat) AS mtime,
base64_decode_lstat(13, LStat) AS ctime
- FROM File INNER JOIN Filename USING (FilenameId)
- INNER JOIN Path USING (PathId)
+ FROM File JOIN Filename USING (FilenameId)
+ JOIN Path USING (PathId)
WHERE Name = $filename
AND Path = $path
AND JobId = $jobid
}
my $groupf=''; # from clause
-my $groupq=''; # whre clause
+my $groupq=''; # where clause
if ($arg->{jclient_groups}) {
$groupf = " JOIN client_group_member ON (Client.ClientId = client_group_member.clientid)
JOIN client_group USING (client_group_id)";
my $ret = {};
foreach my $row (@$all_row) {
+ # Todo, add Level to label if option is set ->[4]
my $label = $row->[1] . "/" . $row->[2] ; # client/backup name
$ret->{date}->[$i] = $row->[0];
UNIX_TIMESTAMP(Job.StartTime) AS starttime,
Client.Name AS clientname,
Job.Name AS jobname,
- Job.JobBytes AS jobbytes
+ Job.JobBytes AS jobbytes,
+ Job.Level AS joblevel
FROM $jobt AS Job, FileSet, Client $filter $groupf
WHERE Job.ClientId = Client.ClientId
AND Job.FileSetId = FileSet.FileSetId
UNIX_TIMESTAMP(Job.StartTime) AS starttime,
Client.Name AS clientname,
Job.Name AS jobname,
- Job.JobFiles AS jobfiles
+ Job.JobFiles AS jobfiles,
+ Job.Level AS joblevel
FROM $jobt AS Job, FileSet, Client $filter $groupf
WHERE Job.ClientId = Client.ClientId
AND Job.FileSetId = FileSet.FileSetId
SELECT UNIX_TIMESTAMP(Job.StartTime) AS starttime,
Client.Name AS client,
Job.Name AS jobname,
- base64_decode_lstat(8,LStat) AS lstat
+ base64_decode_lstat(8,LStat) AS lstat,
+ Job.Level AS joblevel
FROM Job, FileSet, Filename, Path, File, Client $filter
WHERE Job.ClientId = Client.ClientId
SELECT UNIX_TIMESTAMP(Job.StartTime) AS starttime,
Client.Name AS client,
Job.Name AS jobname,
- brestore_pathvisibility.size AS size
+ brestore_pathvisibility.size AS size,
+ Job.Level AS joblevel
FROM Job, Client $filter, FileSet, Path, brestore_pathvisibility
WHERE Job.ClientId = Client.ClientId
($bweb->{sql}->{SEC_TO_INT}(
$bweb->{sql}->{UNIX_TIMESTAMP}(EndTime)
- $bweb->{sql}->{UNIX_TIMESTAMP}(StartTime)) + 0.01)
- AS rate
+ AS rate,
+ Job.Level AS joblevel
FROM $jobt AS Job, FileSet, Client $filter $groupf
WHERE Job.ClientId = Client.ClientId
Job.Name AS jobname,
$bweb->{sql}->{SEC_TO_INT}( $bweb->{sql}->{UNIX_TIMESTAMP}(EndTime)
- $bweb->{sql}->{UNIX_TIMESTAMP}(StartTime))
- AS duration
+ AS duration,
+ Job.Level AS joblevel
+
FROM $jobt AS Job, FileSet, Client $filter $groupf
WHERE Job.ClientId = Client.ClientId
AND Job.FileSetId = FileSet.FileSetId
button.bp { border: 0px; background-color: transparent; }
td.joberr { background-color: red; color: white;}
+.joberr a:link { color: white; }
+.joberr a:visited { color: #ffe0c0; }
.pSlice, .pSliceFull, .pSliceError, .pSliceAppend, .pSlicePurged, .pSliceRecycle,
.pSliceArchive, .pSliceUsed, .pSliceRead_Only, .pSliceDisabled,
display_log_time => qr!^(on)?$!,
enable_security => qr/^(on)?$/,
enable_security_acl => qr/^(on)?$/,
+ default_age => qr/^(?:\d+(?:[ywdhms]\s*)?)+\s*$/,
);
=head1 FUNCTION
return $self->error("If you update from an old bweb install, your must reload this page and if it's fail again, you have to configure bweb again...") ;
}
+ # set default values
+ $self->{default_age} = '7d';
+
foreach my $k (keys %$VAR1) {
$self->{$k} = $VAR1->{$k};
}
use POSIX qw/strftime/;
our $config_file='/etc/bacula/bweb.conf';
-
our $cur_id=0;
=head1 VARIABLE
return sprintf($format, $val, $unit[$i]);
}
+sub human_sec_unit
+{
+ my $val = shift;
+ my $orig = $val;
+ if ($val =~ /^(?:\d+(?:[ywdhms]\s*)?)+\s*$/) {
+ for ($val) {
+ s/y/*52w/g;
+ s/w/*7d/g;
+ s/d/*24h/g;
+ s/h/*60m/g;
+ s/m/*60s/g;
+ s/s(\d)/+$1/g;
+ s/s//;
+ }
+ $val = eval $val;
+ }
+ return int($val);
+}
+
# display Day, Hour, Year
sub human_sec
{
slot => 0,
drive => 0,
priority => 10,
- age => 60*60*24*7,
+ age => $self->{info}->{default_age},
days => 1,
maxvoljobs => 0,
maxvolbytes => 0,
my $value = CGI::param($i) || $opt_i{$i} ;
if ($value =~ /^(\d+)$/) {
$ret{$i} = $1;
+ } elsif ($value eq 'age' && # can have unit
+ $i =~ /^(?:\d+(?:[ywdhms]\s*)?)+\s*$/) # 2y1h2m34s
+ {
+ $ret{$i} = human_sec_unit($i);
}
} elsif ($opt_s{$i}) { # simple string param
my $value = CGI::param($i) || '';
$row->{db_size} = human_size($row->{db_size});
$row->{label} = $label;
+ $row->{age} = $arg{age};
$self->display($row, "general.tpl");
}
$row->{ID} = $cur_id++;
$row->{label} = $label;
$row->{grapharg} = "client";
+ $row->{age} = $arg{age};
$self->display($row, "display_client_stats.tpl");
}
+21Sep08
+ebl
+ bfileview:
+ - Add error message for pruned of uncomputed jobs
+ - Bugfix for looking /
+ Bweb.pm
+ - Add support for age=1w2d40m
+ - Add new configuration variable to modify default age
+ general.tpl
+ - Add hyperlink to failed job count
+ TODO: add C.png (with something like zzZZzzz)
+
25Aug08
ebl Fix #1132 about typo in directory creation in install_bweb
<option id='lang_es' value='es'>__Spanish__</option>
</select>
</td></tr>
+ <tr><td>__default_age:__</td>
+ <td> <input class="formulaire" type='text' value='<TMPL_VAR default_age>' title='24h15m' size='64' name='default_age'>
+ </td></tr>
<tr><td>display_log_time:</td>
<td> <input class="formulaire" title="__Display log timestamp__" type='checkbox' name='display_log_time' <TMPL_IF display_log_time> checked='checked' value='on' </TMPL_IF> >
</td></tr>
<tr><td title="__use a wiki for jobs documentation?__">wiki_url:</td> <td> <TMPL_VAR wiki_url> </td></tr>
<tr><td title="/path/to/your/template_dir">template_dir:</td> <td> <TMPL_VAR template_dir> </td></tr>
<tr><td title="__Default language__">__language:__</td> <td> <TMPL_VAR lang> </td></tr>
+ <tr><td title="__Default Age__">__default_age:__</td> <td> <TMPL_VAR default_age> </td></tr>
<tr><td title="__display timestamp in job log__">display_log_time:</td> <td> <TMPL_VAR display_log_time> </td></tr>
<tr><td title="__user managment__">__security:__</td> <td> <TMPL_VAR enable_security> </td></tr>
<tr><td title="__user filter__">__security acl:__</td> <td> <TMPL_VAR enable_security_acl> </td></tr>
<div class='bodydiv'>
<form action='?'>
<table id='id<TMPL_VAR ID>'></table>
- <img src="bgraph.pl?<TMPL_VAR grapharg>=<TMPL_VAR clientname>;graph=job_duration;age=2592000;width=420;height=200" alt='Not enough data' >
- <img src="bgraph.pl?<TMPL_VAR grapharg>=<TMPL_VAR clientname>;graph=job_rate;age=2592000;width=420;height=200" alt='Not enough data'>
- <img src="bgraph.pl?<TMPL_VAR grapharg>=<TMPL_VAR clientname>;graph=job_size;age=2592000;width=420;height=200" alt='Not enough data'>
+ <img src="bgraph.pl?<TMPL_VAR grapharg>=<TMPL_VAR clientname>;graph=job_duration;age=<TMPL_VAR age>;width=420;height=200" alt='Not enough data' >
+ <img src="bgraph.pl?<TMPL_VAR grapharg>=<TMPL_VAR clientname>;graph=job_rate;age=<TMPL_VAR age>;width=420;height=200" alt='Not enough data'>
+ <img src="bgraph.pl?<TMPL_VAR grapharg>=<TMPL_VAR clientname>;graph=job_size;age=<TMPL_VAR age>;width=420;height=200" alt='Not enough data'>
<!-- <div class="otherboxtitle">
__Actions__
</div>
<tr><td>__Job failed__ (<TMPL_VAR label>):</td>
<td <TMPL_IF nb_err> class='joberr' </TMPL_IF>>
+ <a href="?action=job;level=Any;status=f;age=<TMPL_VAR age>;jobtype=B">
<TMPL_VAR nb_err>
+ </a>
</td>
<td></td> <td></td>
<td></td> <td></td>