offset => $arg->{offset},
limit => $arg->{limit});
print "</td></tr></table></div>";
+} elsif ($action eq 'job_group') {
+
+ print "<div><table border='0'><tr><td valign='top'>\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 "</td><td valign='top'>";
+ $bweb->display_job_group(age => $arg->{age}, # last 7 days
+ limit => $arg->{limit});
+ print "</td></tr></table></div>";
} elsif ($action eq 'client_stats') {
foreach my $client (CGI::param('client')) {
</select>
</td>
</tr>
+<TMPL_UNLESS hide_status>
<tr>
<td valign='top'>
<h2>Estado</h2>
</select>
</td>
</tr>
+</TMPL_UNLESS>
+<TMPL_IF db_pools>
<tr>
<td valign='top'>
<h2>Pool</h2>
</select>
</td>
</tr>
+</TMPL_IF>
<tr>
<td valign='top'>
<h2>Tiempo</h2>
class='formulaire' size='4'>
</td>
</tr>
+<TMPL_UNLESS hide_type>
<tr>
<td valign='top'>
<h2>Tipo Job</h2>
</select>
</td>
</tr>
+</TMPL_UNLESS>
<TMPL_IF db_clients>
<tr>
<td valign='top'>
</tr>
-->
</table>
- <input type="image" name='action' value='job' src='/bweb/update.png'>
+ <input type="image" name='action'
+ value='<TMPL_IF action><TMPL_VAR action><TMPL_ELSE>job</TMPL_IF>'
+ src='/bweb/update.png'>
</form>
</div>
</select>
</td>
</tr>
+<TMPL_UNLESS hide_status>
<tr>
<td valign='top'>
<h2>Statut</h2>
</select>
</td>
</tr>
+</TMPL_UNLESS>
+<TMPL_IF db_pools>
<tr>
<td valign='top'>
<h2>Pool</h2>
</select>
</td>
</tr>
+</TMPL_IF>
<tr>
<td valign='top'>
<h2>Période</h2>
class='formulaire' size='4'>
</td>
</tr>
+<TMPL_UNLESS hide_type>
<tr>
<td valign='top'>
<h2>Type</h2>
</select>
</td>
</tr>
+</TMPL_UNLESS>
<TMPL_IF db_clients>
<tr>
<td valign='top'>
</tr>
</TMPL_IF>
</table>
- <input type="image" name='action' value='job' src='/bweb/update.png'>
+ <input type="image" name='action'
+ value='<TMPL_IF action><TMPL_VAR action><TMPL_ELSE>job</TMPL_IF>'
+ src='/bweb/update.png'>
</form>
</div>
$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) = @_ ;
</select>
</td>
</tr>
+<TMPL_UNLESS hide_status>
<tr>
<td valign='top'>
<h2>Status</h2>
</select>
</td>
</tr>
+</TMPL_UNLESS>
+<TMPL_IF db_pools>
<tr>
<td valign='top'>
<h2>Pool</h2>
</select>
</td>
</tr>
+</TMPL_IF>
<tr>
<td valign='top'>
<h2>Age</h2>
class='formulaire' size='4'>
</td>
</tr>
+<TMPL_UNLESS hide_type>
<tr>
<td valign='top'>
<h2>Job Type</h2>
</select>
</td>
</tr>
+</TMPL_UNLESS>
<TMPL_IF db_clients>
<tr>
<td valign='top'>
</tr>
-->
</table>
- <input type="image" name='action' value='job' src='/bweb/update.png'>
+ <input type="image" name='action'
+ value='<TMPL_IF action><TMPL_VAR action><TMPL_ELSE>job</TMPL_IF>'
+ src='/bweb/update.png'>
</form>
</div>