From 91a0f1a7469dceef6a10b3422d440d5c1f5e48b4 Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Thu, 21 Jun 2007 20:58:45 +0000 Subject: [PATCH] ebl Add a synthetic display_job_by_group view git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@5058 91ce42f0-d328-0410-95d8-f526ca767f89 --- gui/bweb/cgi/bweb.pl | 16 +++++++ gui/bweb/lang/es/tpl/display_form_job.tpl | 10 ++++- gui/bweb/lang/fr/tpl/display_form_job.tpl | 10 ++++- gui/bweb/lib/Bweb.pm | 53 +++++++++++++++++++++++ gui/bweb/tpl/display_form_job.tpl | 10 ++++- 5 files changed, 96 insertions(+), 3 deletions(-) diff --git a/gui/bweb/cgi/bweb.pl b/gui/bweb/cgi/bweb.pl index 443b82f347..b6d1e97dfa 100755 --- a/gui/bweb/cgi/bweb.pl +++ b/gui/bweb/cgi/bweb.pl @@ -306,6 +306,22 @@ if ($action eq 'begin') { # main display offset => $arg->{offset}, limit => $arg->{limit}); print ""; +} elsif ($action eq 'job_group') { + + print "
\n"; + my $fields = $bweb->get_form(qw/limit level age + db_client_groups qclient_groups/); # drop this to hide + + $fields->{hide_status} = 1; + $fields->{hide_type} = 1; + $fields->{action} = 'job_group'; + + $bweb->display($fields, "display_form_job.tpl"); + + print ""; + $bweb->display_job_group(age => $arg->{age}, # last 7 days + limit => $arg->{limit}); + print "
"; } elsif ($action eq 'client_stats') { foreach my $client (CGI::param('client')) { diff --git a/gui/bweb/lang/es/tpl/display_form_job.tpl b/gui/bweb/lang/es/tpl/display_form_job.tpl index 4d8c8a0628..fa49a45d48 100644 --- a/gui/bweb/lang/es/tpl/display_form_job.tpl +++ b/gui/bweb/lang/es/tpl/display_form_job.tpl @@ -16,6 +16,7 @@ +

Estado

@@ -28,6 +29,8 @@ +
+

Pool

@@ -39,6 +42,7 @@ +

Tiempo

@@ -56,6 +60,7 @@ class='formulaire' size='4'> +

Tipo Job

@@ -66,6 +71,7 @@ +
@@ -103,7 +109,9 @@ --> - + diff --git a/gui/bweb/lang/fr/tpl/display_form_job.tpl b/gui/bweb/lang/fr/tpl/display_form_job.tpl index a75ba9f584..d4bd3981b6 100644 --- a/gui/bweb/lang/fr/tpl/display_form_job.tpl +++ b/gui/bweb/lang/fr/tpl/display_form_job.tpl @@ -16,6 +16,7 @@ +

Statut

@@ -28,6 +29,8 @@ +
+

Pool

@@ -39,6 +42,7 @@ +

Période

@@ -57,6 +61,7 @@ class='formulaire' size='4'> +

Type

@@ -67,6 +72,7 @@ +
@@ -92,7 +98,9 @@ - + diff --git a/gui/bweb/lib/Bweb.pm b/gui/bweb/lib/Bweb.pm index 96c6d11970..e9c4bdf082 100644 --- a/gui/bweb/lib/Bweb.pm +++ b/gui/bweb/lib/Bweb.pm @@ -2068,6 +2068,59 @@ WHERE Job.JobId = $jobid $self->display($row, "display_job_zoom.tpl"); } +sub display_job_group +{ + my ($self, %arg) = @_; + + my ($limit, $label) = $self->get_limit(groupby => 'client_group_name', %arg); + + my ($where, undef) = $self->get_param('client_groups', + 'level', + 'pools'); + + my $query = +" +SELECT client_group_name AS client_group_name, + jobok.jobfiles + joberr.jobfiles AS jobfiles, + jobok.jobbytes + joberr.jobbytes AS jobbytes, + jobok.joberrors + joberr.joberrors AS joberrors, + jobok.nbjobs AS nbjobok, + joberr.nbjobs AS nbjoberr + +FROM ( + SELECT client_group_name AS client_group_name, COUNT(1) AS nbjobs, + SUM(JobFiles) AS jobfiles, SUM(JobBytes) AS jobbytes, + SUM(JobErrors) AS joberrors + FROM Job JOIN client_group_member ON (Job.ClientId = client_group_member.ClientId) + JOIN client_group USING (client_group_id) + + WHERE JobStatus = 'T' + $where + $limit +) AS jobok LEFT JOIN + +( + SELECT client_group_name AS client_group_name, COUNT(1) AS nbjobs, + SUM(JobFiles) AS jobfiles, SUM(JobBytes) AS jobbytes, + SUM(JobErrors) AS joberrors + FROM Job JOIN client_group_member ON (Job.ClientId = client_group_member.ClientId) + JOIN client_group USING (client_group_id) + + WHERE JobStatus IN ('f','E', 'A') + $where + $limit +) AS joberr USING (client_group_name) + + "; + + my $all = $self->dbh_selectall_hashref($query, 'client_group_name'); + + my $rep = { groups => [ values %$all ], age => $arg{age} }; + + $self->debug($rep); + $self->display($rep, "display_job_group.tpl"); +} + sub display_media { my ($self, %arg) = @_ ; diff --git a/gui/bweb/tpl/display_form_job.tpl b/gui/bweb/tpl/display_form_job.tpl index 7947819419..857796b8cf 100644 --- a/gui/bweb/tpl/display_form_job.tpl +++ b/gui/bweb/tpl/display_form_job.tpl @@ -16,6 +16,7 @@ +

Status

@@ -28,6 +29,8 @@ +
+

Pool

@@ -39,6 +42,7 @@ +

Age

@@ -56,6 +60,7 @@ class='formulaire' size='4'> +

Job Type

@@ -66,6 +71,7 @@ +
@@ -103,7 +109,9 @@ --> - + -- 2.39.5