From: Eric Bollengier Date: Wed, 2 Apr 2008 13:45:01 +0000 (+0000) Subject: ebl Add group stats X-Git-Tag: Release-3.0.0~1624 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=a77289f88d6b36432b8eda1ba8b032029d85dc7d;p=bacula%2Fbacula ebl Add group stats git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@6721 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/gui/bweb/cgi/bconsole.pl b/gui/bweb/cgi/bconsole.pl index a169dd730c..c66843c3e9 100755 --- a/gui/bweb/cgi/bconsole.pl +++ b/gui/bweb/cgi/bconsole.pl @@ -108,7 +108,7 @@ for my $a (@action) fileset => $arg->{fileset}, where => $arg->{where}, regexwhere => $arg->{regexwhere}, - replace => $arg->{replace}, +# replace => $arg->{replace}, priority => $arg->{priority}, bootstrap => $filename); diff --git a/gui/bweb/cgi/bresto.pl b/gui/bweb/cgi/bresto.pl index 616e42e159..845c497a01 100755 --- a/gui/bweb/cgi/bresto.pl +++ b/gui/bweb/cgi/bresto.pl @@ -895,10 +895,13 @@ SELECT btemp.JobId, btemp.FileIndex, btemp.FilenameId, btemp.PathId )"); } else { # postgresql have distinct with more than one criteria... $bvfs->dbh_do("CREATE TABLE b2$$ AS ( -SELECT DISTINCT ON (PathId, FilenameId) JobId, FileIndex - FROM btemp - ORDER BY PathId, FilenameId, JobId DESC - HAVING FileIndex > 0 +SELECT JobId, FileIndex +FROM ( + SELECT DISTINCT ON (PathId, FilenameId) JobId, FileIndex + FROM btemp + ORDER BY PathId, FilenameId, JobId DESC + ) AS T + WHERE FileIndex > 0 )"); } diff --git a/gui/bweb/cgi/bweb.pl b/gui/bweb/cgi/bweb.pl index 55a68d1148..1f0eab14e4 100755 --- a/gui/bweb/cgi/bweb.pl +++ b/gui/bweb/cgi/bweb.pl @@ -378,6 +378,8 @@ if ($action eq 'begin') { # main display age => $arg->{age}); } } +} elsif ($action eq 'group_stats') { + $bweb->display_group_stats(); } elsif ($action eq 'group_stats') { $bweb->display_group_stats(age => $arg->{age}); diff --git a/gui/bweb/lang/en/tpl/begin.tpl b/gui/bweb/lang/en/tpl/begin.tpl index 50565b5ece..716d0e9389 100644 --- a/gui/bweb/lang/en/tpl/begin.tpl +++ b/gui/bweb/lang/en/tpl/begin.tpl @@ -64,6 +64,7 @@ if ('Main' == ('_' + '_Main_' + '_')) { diff --git a/gui/bweb/lang/en/tpl/display_stats.tpl b/gui/bweb/lang/en/tpl/display_stats.tpl new file mode 100644 index 0000000000..2077a31d52 --- /dev/null +++ b/gui/bweb/lang/en/tpl/display_stats.tpl @@ -0,0 +1,47 @@ +
+
+

Statistics ()

+
+
+
+
+
+
+ + diff --git a/gui/bweb/lang/es/tpl/begin.tpl b/gui/bweb/lang/es/tpl/begin.tpl index 22a2e393a1..0118c2959c 100644 --- a/gui/bweb/lang/es/tpl/begin.tpl +++ b/gui/bweb/lang/es/tpl/begin.tpl @@ -35,10 +35,10 @@ if ('Principal' == ('_' + '_Main_' + '_')) {
  • Jobs by group
  • Jobs overview
  • Missing Jobs -
  • Últimos Jobs
  • -
  • Jobs en Ejecución -
  • Próximos Jobs
  • -
  • Recuperación
  • +
  • Últimos Jobs
  • +
  • Jobs en Ejecución +
  • Próximos Jobs
  • +
  • Recuperación
  • Web Restore
  • @@ -60,16 +60,17 @@ if ('Principal' == ('_' + '_Main_' + '_')) { -
  • Estadísticas +
  • Estadísticas
  • -
  • Configuración +
  • Configuración -
    • Configuración + diff --git a/gui/bweb/lang/es/tpl/display_stats.tpl b/gui/bweb/lang/es/tpl/display_stats.tpl new file mode 100644 index 0000000000..7f5fa801bd --- /dev/null +++ b/gui/bweb/lang/es/tpl/display_stats.tpl @@ -0,0 +1,47 @@ +
      +
      +

      Estadísticas ()

      +
      +
      +
      +
      +
      +
      + + diff --git a/gui/bweb/lang/fr/tpl/begin.tpl b/gui/bweb/lang/fr/tpl/begin.tpl index afd99c59a7..94502c3682 100644 --- a/gui/bweb/lang/fr/tpl/begin.tpl +++ b/gui/bweb/lang/fr/tpl/begin.tpl @@ -14,7 +14,7 @@ diff --git a/gui/bweb/lib/Bweb.pm b/gui/bweb/lib/Bweb.pm index 7e8b707de5..0041285033 100644 --- a/gui/bweb/lib/Bweb.pm +++ b/gui/bweb/lib/Bweb.pm @@ -3608,7 +3608,7 @@ GROUP BY Client.Name } -sub display_group_stats +sub _display_group_stats { my ($self, %arg) = @_ ; @@ -4009,6 +4009,49 @@ WHERE "running_job.tpl") ; } +sub display_group_stats +{ + my ($self) = @_; + my $arg = $self->get_form('age', 'since'); + return if $self->cant_do('r_view_stat'); + my $filter = $self->get_client_group_filter(); + + my ($limit, $label) = $self->get_limit(%$arg); + + my $query = " +SELECT client_group_name AS name, nb_byte, nb_file, nb_job, nb_resto + FROM ( + + SELECT sum(JobBytes) AS nb_byte, + sum(JobFiles) AS nb_file, + count(1) AS nb_job, client_group_name + FROM job_old JOIN client_group_member USING (ClientId) + JOIN client_group USING (client_group_id) $filter + WHERE JobStatus = 'T' AND Type IN ('M', 'B', 'g') + $limit + GROUP BY client_group_name ORDER BY client_group_name + + ) AS T1 LEFT JOIN ( + + SELECT count(1) AS nb_resto, client_group_name + FROM job_old JOIN client_group_member USING (ClientId) + JOIN client_group USING (client_group_id) + WHERE JobStatus = 'T' AND Type = 'R' + $limit + GROUP BY client_group_name ORDER BY client_group_name + + ) AS T2 USING (client_group_name) +"; + $self->debug($query); + my $all = $self->dbh_selectall_hashref($query, 'name') ; + $self->debug($all); + + $self->display({ ID => $cur_id++, + label => $label, + Stats => [ values %$all ]}, + "display_stats.tpl") ; +} + # return the autochanger list to update sub eject_media { diff --git a/gui/bweb/technotes-2.3 b/gui/bweb/technotes-2.3 index 645781efb0..8efc4fbcf0 100644 --- a/gui/bweb/technotes-2.3 +++ b/gui/bweb/technotes-2.3 @@ -1,3 +1,6 @@ +02Apr08 +ebl Add group statistics page + 10Mar08 ebl Use lineal regression to guess backup progress (postgresql) diff --git a/gui/bweb/tpl/begin.tpl b/gui/bweb/tpl/begin.tpl index 4d20ecc1e6..25d6981f09 100644 --- a/gui/bweb/tpl/begin.tpl +++ b/gui/bweb/tpl/begin.tpl @@ -64,6 +64,7 @@ if ('__Main__' == ('_' + '_Main_' + '_')) {
    • diff --git a/gui/bweb/tpl/display_stats.tpl b/gui/bweb/tpl/display_stats.tpl new file mode 100644 index 0000000000..1481bd73ed --- /dev/null +++ b/gui/bweb/tpl/display_stats.tpl @@ -0,0 +1,47 @@ +
      +
      +

      __Statistics__ ()

      +
      +
      +
      +
      +
      +
      + +