<script type="text/javascript" language="JavaScript">
var table = document.getElementById('report');
-var nodate = new Array();
-var nb_col=1;
+var nodate = {};
var tr; var td; var img; var infos;
var all = new Array();
-var max_cel=0;
-var min_cel=200;
+var dates = {};
+var dates_pos = {};
<TMPL_LOOP items>
infos = new Array();
<TMPL_LOOP events>
- min_cel=(min_cel< <TMPL_VAR num>)?min_cel:<TMPL_VAR num>;
- infos[<TMPL_VAR num>] = new Array('<TMPL_VAR num>', '<TMPL_VAR status>',
- '<TMPL_VAR joberrors>', '<TMPL_VAR title>');
+ dates['<TMPL_VAR date>']='<TMPL_VAR num>';
+ infos['<TMPL_VAR date>'] = new Array('<TMPL_VAR num>', '<TMPL_VAR status>',
+ '<TMPL_VAR joberrors>', '<TMPL_VAR title>');
</TMPL_LOOP>
-max_cel=(max_cel>infos.length)?max_cel:infos.length;
all.push({ name: "<TMPL_VAR name>", values: infos});
</TMPL_LOOP>
//infos = new Array();
-//infos[1] = new Array('2007-10-01', 'T', 8);
-//infos[2] = new Array('2007-10-02', 'T', 8);
-//infos[5] = new Array('2007-10-05', 'R', 8);
+//infos['2007-10-01'] = new Array(1, 'T', 8, '2007-10-01');
+//infos['2007-10-02'] = new Array(2, 'T', 8, '2007-10-02');
+//infos['2007-10-05'] = new Array(3, 'R', 8, '2007-10-05');
//
-//max_cel=(max_cel>infos.length)?max_cel:infos.length;
//all.push({ name: "zog", values: infos});
function init_tab() // initialize the table
{
- for(var j=min_cel; j < max_cel ; j++) {
+ var i=0;
+ var step = new Array();
+ // common steps in milliseconds
+ step['day'] = 86400000;
+ step['week'] = 604800000;
+ step['month'] = 2678400000;
+ var last_date;
+ var current_date;
+
+ // javascript can't do foreach $j (sort keys %dates)
+ var keys = new Array();
+ for (var j in dates) {
+ console.log(j);
+ keys.push(j);
+ }
+ keys.sort();
+
+ for (var j in keys) {
+ j = keys[j]; // get real key
+ if (!last_date) { // do it once
+ last_date = new Date(j.substr(0, 10));
+ }
+ // current date
+ var current_date = new Date(j.substr(0, 10));
+
+ // Try to find days where we have nothing reported
+ if (step['<TMPL_VAR type>']) {
+ last_date.setTime( last_date.getTime() + step['<TMPL_VAR type>'] * 1.25);
+ while ( last_date < current_date ) {
+ // Insert gap between current_date and last_date
+ last_date.setTime( last_date.getTime() + step['<TMPL_VAR type>']);
+ var t=document.createElement("TD");
+ t.setAttribute("id", "day" + i++); // should not be used
+ t.appendChild(document.createTextNode('?'));
+ document.getElementById("days").appendChild(t);
+ }
+ }
+ last_date = current_date;
var t=document.createElement("TD");
- t.setAttribute("id", "day" + j);
+ t.setAttribute("id", "day" + i);
nodate[j]=1;
+ dates_pos[j]=i++; // position in the tab
document.getElementById("days").appendChild(t);
}
}
a.setAttribute("href", "?action=<TMPL_VAR action>" + name);
a.appendChild(document.createTextNode(name));
td.appendChild(a);
- var len = infos.length;
-
- for(var j=min_cel; j < max_cel ; j++) { // one img for each days
- td=document.createElement("TD");
- tr.appendChild(td);
- if (len > j && infos[j]) {
- if (nodate[j] == 1) { // put the date in the first row if empty
- var t = document.getElementById("day" + j);
- t.appendChild(document.createTextNode(infos[j][0]));
- nodate[j]=0;
- }
-// a=document.createElement("A"); // create a link to action=job
-// a.setAttribute('href', "?action=job;client_group=" + name);
- img=document.createElement("IMG");
- img.setAttribute("src", bweb_get_job_img(infos[j][1],infos[j][2], 'B'));
- img.setAttribute("title", infos[j][3]);
-// a.appendChild(img);
- td.appendChild(img);
- } else {
-// td.appendChild(document.createTextNode('N/A'));
+ var cur_pos=0;
+
+ for (var j in infos) { // one img for each days
+ while (cur_pos <= dates_pos[j]) { // create empty blocks
+ td=document.createElement("TD");
+ tr.appendChild(td);
+ cur_pos++;
+ }
+ if (nodate[j] == 1) { // put the date in the first row if empty
+ var t = document.getElementById("day" + dates_pos[j]);
+ t.appendChild(document.createTextNode(infos[j][0]));
+ nodate[j]=0;
}
+// a=document.createElement("A"); // create a link to action=job
+// a.setAttribute('href', "?action=job;client_group=" + name);
+ img=document.createElement("IMG");
+ img.setAttribute("src", bweb_get_job_img(infos[j][1],infos[j][2], 'B'));
+ img.setAttribute("title", infos[j][3]);
+// a.appendChild(img);
+ td.appendChild(img);
}
}
<script type="text/javascript" language="JavaScript">
var table = document.getElementById('report');
-var nodate = new Array();
-var nb_col=1;
+var nodate = {};
var tr; var td; var img; var infos;
var all = new Array();
-var max_cel=0;
-var min_cel=200;
+var dates = {};
+var dates_pos = {};
<TMPL_LOOP items>
infos = new Array();
<TMPL_LOOP events>
- min_cel=(min_cel< <TMPL_VAR num>)?min_cel:<TMPL_VAR num>;
- infos[<TMPL_VAR num>] = new Array('<TMPL_VAR num>', '<TMPL_VAR status>',
- '<TMPL_VAR joberrors>', '<TMPL_VAR title>');
+ dates['<TMPL_VAR date>']='<TMPL_VAR num>';
+ infos['<TMPL_VAR date>'] = new Array('<TMPL_VAR num>', '<TMPL_VAR status>',
+ '<TMPL_VAR joberrors>', '<TMPL_VAR title>');
</TMPL_LOOP>
-max_cel=(max_cel>infos.length)?max_cel:infos.length;
all.push({ name: "<TMPL_VAR name>", values: infos});
</TMPL_LOOP>
//infos = new Array();
-//infos[1] = new Array('2007-10-01', 'T', 8);
-//infos[2] = new Array('2007-10-02', 'T', 8);
-//infos[5] = new Array('2007-10-05', 'R', 8);
+//infos['2007-10-01'] = new Array(1, 'T', 8, '2007-10-01');
+//infos['2007-10-02'] = new Array(2, 'T', 8, '2007-10-02');
+//infos['2007-10-05'] = new Array(3, 'R', 8, '2007-10-05');
//
-//max_cel=(max_cel>infos.length)?max_cel:infos.length;
//all.push({ name: "zog", values: infos});
function init_tab() // initialize the table
{
- for(var j=min_cel; j < max_cel ; j++) {
+ var i=0;
+ var step = new Array();
+ // common steps in milliseconds
+ step['day'] = 86400000;
+ step['week'] = 604800000;
+ step['month'] = 2678400000;
+ var last_date;
+ var current_date;
+
+ // javascript can't do foreach $j (sort keys %dates)
+ var keys = new Array();
+ for (var j in dates) {
+ console.log(j);
+ keys.push(j);
+ }
+ keys.sort();
+
+ for (var j in keys) {
+ j = keys[j]; // get real key
+ if (!last_date) { // do it once
+ last_date = new Date(j.substr(0, 10));
+ }
+ // current date
+ var current_date = new Date(j.substr(0, 10));
+
+ // Try to find days where we have nothing reported
+ if (step['<TMPL_VAR type>']) {
+ last_date.setTime( last_date.getTime() + step['<TMPL_VAR type>'] * 1.25);
+ while ( last_date < current_date ) {
+ // Insert gap between current_date and last_date
+ last_date.setTime( last_date.getTime() + step['<TMPL_VAR type>']);
+ var t=document.createElement("TD");
+ t.setAttribute("id", "day" + i++); // should not be used
+ t.appendChild(document.createTextNode('?'));
+ document.getElementById("days").appendChild(t);
+ }
+ }
+ last_date = current_date;
var t=document.createElement("TD");
- t.setAttribute("id", "day" + j);
+ t.setAttribute("id", "day" + i);
nodate[j]=1;
+ dates_pos[j]=i++; // position in the tab
document.getElementById("days").appendChild(t);
}
}
a.setAttribute("href", "?action=<TMPL_VAR action>" + name);
a.appendChild(document.createTextNode(name));
td.appendChild(a);
- var len = infos.length;
-
- for(var j=min_cel; j < max_cel ; j++) { // one img for each days
- td=document.createElement("TD");
- tr.appendChild(td);
- if (len > j && infos[j]) {
- if (nodate[j] == 1) { // put the date in the first row if empty
- var t = document.getElementById("day" + j);
- t.appendChild(document.createTextNode(infos[j][0]));
- nodate[j]=0;
- }
-// a=document.createElement("A"); // create a link to action=job
-// a.setAttribute('href', "?action=job;client_group=" + name);
- img=document.createElement("IMG");
- img.setAttribute("src", bweb_get_job_img(infos[j][1],infos[j][2], 'B'));
- img.setAttribute("title", infos[j][3]);
-// a.appendChild(img);
- td.appendChild(img);
- } else {
-// td.appendChild(document.createTextNode('N/A'));
+ var cur_pos=0;
+
+ for (var j in infos) { // one img for each days
+ while (cur_pos <= dates_pos[j]) { // create empty blocks
+ td=document.createElement("TD");
+ tr.appendChild(td);
+ cur_pos++;
+ }
+ if (nodate[j] == 1) { // put the date in the first row if empty
+ var t = document.getElementById("day" + dates_pos[j]);
+ t.appendChild(document.createTextNode(infos[j][0]));
+ nodate[j]=0;
}
+// a=document.createElement("A"); // create a link to action=job
+// a.setAttribute('href', "?action=job;client_group=" + name);
+ img=document.createElement("IMG");
+ img.setAttribute("src", bweb_get_job_img(infos[j][1],infos[j][2], 'B'));
+ img.setAttribute("title", infos[j][3]);
+// a.appendChild(img);
+ td.appendChild(img);
}
}
<script type="text/javascript" language="JavaScript">
var table = document.getElementById('report');
-var nodate = new Array();
-var nb_col=1;
+var nodate = {};
var tr; var td; var img; var infos;
var all = new Array();
-var max_cel=0;
-var min_cel=200;
+var dates = {};
+var dates_pos = {};
<TMPL_LOOP items>
infos = new Array();
<TMPL_LOOP events>
- min_cel=(min_cel< <TMPL_VAR num>)?min_cel:<TMPL_VAR num>;
- infos[<TMPL_VAR num>] = new Array('<TMPL_VAR num>', '<TMPL_VAR status>',
- '<TMPL_VAR joberrors>', '<TMPL_VAR title>');
+ dates['<TMPL_VAR date>']='<TMPL_VAR num>';
+ infos['<TMPL_VAR date>'] = new Array('<TMPL_VAR num>', '<TMPL_VAR status>',
+ '<TMPL_VAR joberrors>', '<TMPL_VAR title>');
</TMPL_LOOP>
-max_cel=(max_cel>infos.length)?max_cel:infos.length;
all.push({ name: "<TMPL_VAR name>", values: infos});
</TMPL_LOOP>
//infos = new Array();
-//infos[1] = new Array('2007-10-01', 'T', 8);
-//infos[2] = new Array('2007-10-02', 'T', 8);
-//infos[5] = new Array('2007-10-05', 'R', 8);
+//infos['2007-10-01'] = new Array(1, 'T', 8, '2007-10-01');
+//infos['2007-10-02'] = new Array(2, 'T', 8, '2007-10-02');
+//infos['2007-10-05'] = new Array(3, 'R', 8, '2007-10-05');
//
-//max_cel=(max_cel>infos.length)?max_cel:infos.length;
//all.push({ name: "zog", values: infos});
function init_tab() // initialize the table
{
- for(var j=min_cel; j < max_cel ; j++) {
+ var i=0;
+ var step = new Array();
+ // common steps in milliseconds
+ step['day'] = 86400000;
+ step['week'] = 604800000;
+ step['month'] = 2678400000;
+ var last_date;
+ var current_date;
+
+ // javascript can't do foreach $j (sort keys %dates)
+ var keys = new Array();
+ for (var j in dates) {
+ console.log(j);
+ keys.push(j);
+ }
+ keys.sort();
+
+ for (var j in keys) {
+ j = keys[j]; // get real key
+ if (!last_date) { // do it once
+ last_date = new Date(j.substr(0, 10));
+ }
+ // current date
+ var current_date = new Date(j.substr(0, 10));
+
+ // Try to find days where we have nothing reported
+ if (step['<TMPL_VAR type>']) {
+ last_date.setTime( last_date.getTime() + step['<TMPL_VAR type>'] * 1.25);
+ while ( last_date < current_date ) {
+ // Insert gap between current_date and last_date
+ last_date.setTime( last_date.getTime() + step['<TMPL_VAR type>']);
+ var t=document.createElement("TD");
+ t.setAttribute("id", "day" + i++); // should not be used
+ t.appendChild(document.createTextNode('?'));
+ document.getElementById("days").appendChild(t);
+ }
+ }
+ last_date = current_date;
var t=document.createElement("TD");
- t.setAttribute("id", "day" + j);
+ t.setAttribute("id", "day" + i);
nodate[j]=1;
+ dates_pos[j]=i++; // position in the tab
document.getElementById("days").appendChild(t);
}
}
a.setAttribute("href", "?action=<TMPL_VAR action>" + name);
a.appendChild(document.createTextNode(name));
td.appendChild(a);
- var len = infos.length;
-
- for(var j=min_cel; j < max_cel ; j++) { // one img for each days
- td=document.createElement("TD");
- tr.appendChild(td);
- if (len > j && infos[j]) {
- if (nodate[j] == 1) { // put the date in the first row if empty
- var t = document.getElementById("day" + j);
- t.appendChild(document.createTextNode(infos[j][0]));
- nodate[j]=0;
- }
-// a=document.createElement("A"); // create a link to action=job
-// a.setAttribute('href', "?action=job;client_group=" + name);
- img=document.createElement("IMG");
- img.setAttribute("src", bweb_get_job_img(infos[j][1],infos[j][2], 'B'));
- img.setAttribute("title", infos[j][3]);
-// a.appendChild(img);
- td.appendChild(img);
- } else {
-// td.appendChild(document.createTextNode('N/A'));
+ var cur_pos=0;
+
+ for (var j in infos) { // one img for each days
+ while (cur_pos <= dates_pos[j]) { // create empty blocks
+ td=document.createElement("TD");
+ tr.appendChild(td);
+ cur_pos++;
+ }
+ if (nodate[j] == 1) { // put the date in the first row if empty
+ var t = document.getElementById("day" + dates_pos[j]);
+ t.appendChild(document.createTextNode(infos[j][0]));
+ nodate[j]=0;
}
+// a=document.createElement("A"); // create a link to action=job
+// a.setAttribute('href', "?action=job;client_group=" + name);
+ img=document.createElement("IMG");
+ img.setAttribute("src", bweb_get_job_img(infos[j][1],infos[j][2], 'B'));
+ img.setAttribute("title", infos[j][3]);
+// a.appendChild(img);
+ td.appendChild(img);
}
}
$cur_name = $elt->[0];
push @$events,
{ num => $elt->[1], status => $elt->[2],
- joberrors => $elt->[3], title => "$elt->[4] jobs"};
+ joberrors => $elt->[3], title => "$elt->[4] jobs", date => $elt->[5]};
}
push @items, { name => $cur_name, events => $events};
return \@items;
$type = 'DAY';
}
my $jobt = $self->get_stat_table();
- my $stime1 = $self->{sql}->{"STARTTIME_P" . $type}; # get 1,2,3
+ my $stime1 = $self->{sql}->{"STARTTIME_P" . $type}; # get 1, 2, 3, 4
$stime1 =~ s/Job.StartTime/date/;
my $stime2 = $self->{sql}->{"STARTTIME_" . $type}; # get 2007-01-03, 2007-01-23
$self->can_do('r_view_stat');
my $arg = $self->get_form(qw/jclient_groups age since type level/);
+ $arg->{type} = $arg->{type} || 'day';
if (!$arg->{jclient_groups}) {
return $self->error("Can't get client_group selection");
my $filter = $self->get_client_filter();
my $q = "
SELECT name, $stime1 AS num,
- JobStatus AS value, joberrors, nb_job
+ JobStatus AS value, joberrors, nb_job, date
FROM (
SELECT $stime2 AS date,
Client.Name AS name,
";
my $items = $self->make_overview_tab($q);
$self->display({label => $label,
+ type => $arg->{type},
action => "job;since=$arg->{since};level=$arg->{level};type=$arg->{type};age=$arg->{age};client=",
items => $items}, "overview.tpl");
}
$self->can_do('r_view_stat');
my $arg = $self->get_form(qw/jclient_groups age since type level/);
+ $arg->{type} = $arg->{type} || 'day';
my ($filter2, undef) = $self->get_param(qw/client_groups level jobtype/);
my $filter3 = $self->get_client_group_filter();
my ($stime1, $stime2, $filter1, $label, $jobt) = $self->get_time_overview($arg);
my $q = "
SELECT name, $stime1 AS num,
- JobStatus AS value, joberrors, nb_job
+ JobStatus AS value, joberrors, nb_job, date
FROM (
SELECT $stime2 AS date,
client_group_name AS name,
";
my $items = $self->make_overview_tab($q);
$self->display({label=>$label,
+ type => $arg->{type},
action => "overview_zoom;since=$arg->{since};level=$arg->{level};type=$arg->{type};age=$arg->{age};client_group=",
items => $items}, "overview.tpl");
<script type="text/javascript" language="JavaScript">
var table = document.getElementById('report');
-var nodate = new Array();
-var nb_col=1;
+var nodate = {};
var tr; var td; var img; var infos;
var all = new Array();
-var max_cel=0;
-var min_cel=200;
+var dates = {};
+var dates_pos = {};
<TMPL_LOOP items>
infos = new Array();
<TMPL_LOOP events>
- min_cel=(min_cel< <TMPL_VAR num>)?min_cel:<TMPL_VAR num>;
- infos[<TMPL_VAR num>] = new Array('<TMPL_VAR num>', '<TMPL_VAR status>',
- '<TMPL_VAR joberrors>', '<TMPL_VAR title>');
+ dates['<TMPL_VAR date>']='<TMPL_VAR num>';
+ infos['<TMPL_VAR date>'] = new Array('<TMPL_VAR num>', '<TMPL_VAR status>',
+ '<TMPL_VAR joberrors>', '<TMPL_VAR title>');
</TMPL_LOOP>
-max_cel=(max_cel>infos.length)?max_cel:infos.length;
all.push({ name: "<TMPL_VAR name>", values: infos});
</TMPL_LOOP>
//infos = new Array();
-//infos[1] = new Array('2007-10-01', 'T', 8);
-//infos[2] = new Array('2007-10-02', 'T', 8);
-//infos[5] = new Array('2007-10-05', 'R', 8);
+//infos['2007-10-01'] = new Array(1, 'T', 8, '2007-10-01');
+//infos['2007-10-02'] = new Array(2, 'T', 8, '2007-10-02');
+//infos['2007-10-05'] = new Array(3, 'R', 8, '2007-10-05');
//
-//max_cel=(max_cel>infos.length)?max_cel:infos.length;
//all.push({ name: "zog", values: infos});
function init_tab() // initialize the table
{
- for(var j=min_cel; j < max_cel ; j++) {
+ var i=0;
+ var step = new Array();
+ // common steps in milliseconds
+ step['day'] = 86400000;
+ step['week'] = 604800000;
+ step['month'] = 2678400000;
+ var last_date;
+ var current_date;
+
+ // javascript can't do foreach $j (sort keys %dates)
+ var keys = new Array();
+ for (var j in dates) {
+ console.log(j);
+ keys.push(j);
+ }
+ keys.sort();
+
+ for (var j in keys) {
+ j = keys[j]; // get real key
+ if (!last_date) { // do it once
+ last_date = new Date(j.substr(0, 10));
+ }
+ // current date
+ var current_date = new Date(j.substr(0, 10));
+
+ // Try to find days where we have nothing reported
+ if (step['<TMPL_VAR type>']) {
+ last_date.setTime( last_date.getTime() + step['<TMPL_VAR type>'] * 1.25);
+ while ( last_date < current_date ) {
+ // Insert gap between current_date and last_date
+ last_date.setTime( last_date.getTime() + step['<TMPL_VAR type>']);
+ var t=document.createElement("TD");
+ t.setAttribute("id", "day" + i++); // should not be used
+ t.appendChild(document.createTextNode('?'));
+ document.getElementById("days").appendChild(t);
+ }
+ }
+ last_date = current_date;
var t=document.createElement("TD");
- t.setAttribute("id", "day" + j);
+ t.setAttribute("id", "day" + i);
nodate[j]=1;
+ dates_pos[j]=i++; // position in the tab
document.getElementById("days").appendChild(t);
}
}
a.setAttribute("href", "?action=<TMPL_VAR action>" + name);
a.appendChild(document.createTextNode(name));
td.appendChild(a);
- var len = infos.length;
-
- for(var j=min_cel; j < max_cel ; j++) { // one img for each days
- td=document.createElement("TD");
- tr.appendChild(td);
- if (len > j && infos[j]) {
- if (nodate[j] == 1) { // put the date in the first row if empty
- var t = document.getElementById("day" + j);
- t.appendChild(document.createTextNode(infos[j][0]));
- nodate[j]=0;
- }
-// a=document.createElement("A"); // create a link to action=job
-// a.setAttribute('href', "?action=job;client_group=" + name);
- img=document.createElement("IMG");
- img.setAttribute("src", bweb_get_job_img(infos[j][1],infos[j][2], 'B'));
- img.setAttribute("title", infos[j][3]);
-// a.appendChild(img);
- td.appendChild(img);
- } else {
-// td.appendChild(document.createTextNode('N/A'));
+ var cur_pos=0;
+
+ for (var j in infos) { // one img for each days
+ while (cur_pos <= dates_pos[j]) { // create empty blocks
+ td=document.createElement("TD");
+ tr.appendChild(td);
+ cur_pos++;
+ }
+ if (nodate[j] == 1) { // put the date in the first row if empty
+ var t = document.getElementById("day" + dates_pos[j]);
+ t.appendChild(document.createTextNode(infos[j][0]));
+ nodate[j]=0;
}
+// a=document.createElement("A"); // create a link to action=job
+// a.setAttribute('href', "?action=job;client_group=" + name);
+ img=document.createElement("IMG");
+ img.setAttribute("src", bweb_get_job_img(infos[j][1],infos[j][2], 'B'));
+ img.setAttribute("title", infos[j][3]);
+// a.appendChild(img);
+ td.appendChild(img);
}
}