8 |
use CGI::Carp qw(fatalsToBrowser); |
use CGI::Carp qw(fatalsToBrowser); |
9 |
use POSIX qw(strftime); |
use POSIX qw(strftime); |
10 |
|
|
11 |
my $debug = 0; |
my $debug = 1; |
12 |
|
|
13 |
my $width = 600; # width of bar |
my $width = 600; # width of bar |
14 |
my $height = 19; # height of bar |
my $height = 19; # height of bar |
17 |
# status colors |
# status colors |
18 |
my %cols = ( |
my %cols = ( |
19 |
'In Progress' => '0,255,0', |
'In Progress' => '0,255,0', |
20 |
'In Progress/Failure' => '255,64,255', |
'In Progress/Failures' => '192,64,192', |
21 |
'In Progress/Errors' => '255,64,0', |
'In Progress/Errors' => '255,128,128', |
22 |
'Queuing' => '255,255,0', |
'Queuing' => '255,255,0', |
23 |
'Aborted' => '255,0,0', |
'Aborted' => '255,0,0', |
24 |
'Failed' => '255,0,0', |
'Failed' => '255,0,0', |
127 |
print "<tr><td align=right><small>hour grid</small></td><td colspan=2>"; |
print "<tr><td align=right><small>hour grid</small></td><td colspan=2>"; |
128 |
my @c = ("255,255,128","255,192,128"); |
my @c = ("255,255,128","255,192,128"); |
129 |
my $hr=strftime("%H",localtime ($from_t)); |
my $hr=strftime("%H",localtime ($from_t)); |
130 |
my $min_l=1; |
sub hour_bar { |
131 |
print color_bar(3600 - $from_t % 3600,$c[0],sprintf("%02d",$hr++ % 24)); |
my ($t,$c,$hr) = @_; |
132 |
|
my $clock_hr = $hr % 24; |
133 |
|
my $alt = sprintf("%02d:00",$clock_hr); |
134 |
|
if ($clock_hr == 0) { |
135 |
|
my $pix_hr = int(1 / $width); |
136 |
|
print color_bar($pix_hr,"0,0,0",strftime("%Y-%m-%d", localtime($from_t + $hr*3600))); |
137 |
|
print color_bar($t-$pix_hr,$c,$alt); |
138 |
|
} else { |
139 |
|
print color_bar($t,$c,$alt); |
140 |
|
} |
141 |
|
} |
142 |
|
hour_bar(3600 - $from_t % 3600,$c[0],$hr++); |
143 |
for (my $i=1; $i<int(($to_t-$from_t)/3600); $i++) { |
for (my $i=1; $i<int(($to_t-$from_t)/3600); $i++) { |
144 |
print color_bar(3600,$c[1],sprintf("%02d",$hr++ % 24)); |
hour_bar(3600,$c[1],$hr++); |
145 |
push @c, shift @c; |
push @c, shift @c; |
146 |
} |
} |
147 |
print color_bar($from_t % 3600,$c[1],sprintf("%02d",$hr % 24)); |
hour_bar($from_t % 3600,$c[1],$hr); |
148 |
print "</td></tr>\n"; |
print "</td></tr>\n"; |
149 |
} |
} |
150 |
|
|
220 |
from gantt |
from gantt |
221 |
where (start < '$from' and finish > '$from') or |
where (start < '$from' and finish > '$from') or |
222 |
(start > '$from' and start < '$to') |
(start > '$from' and start < '$to') |
223 |
order by device,specification |
order by device,specification,start |
224 |
"; |
" |
225 |
|
|
226 |
my $sth = $dbh->prepare($sql) || die "sql: $sql ".$dbh->errstr; |
my $sth = $dbh->prepare($sql) || die "sql: $sql ".$dbh->errstr; |
227 |
|
|
289 |
$alt .= $row->{type}." <b>".$row->{status}."</b><br>". |
$alt .= $row->{type}." <b>".$row->{status}."</b><br>". |
290 |
$row->{user_group_host}." <i>".$row->{sessionid}."</i><br>". |
$row->{user_group_host}." <i>".$row->{sessionid}."</i><br>". |
291 |
$row->{device}." on ".$row->{host}; |
$row->{device}." on ".$row->{host}; |
292 |
|
$alt .= "-- ".$row->{specification}; |
293 |
print bar($len,$row->{status},$alt); |
print bar($len,$row->{status},$alt); |
294 |
|
|
295 |
$curr_t += $len; |
$curr_t += $len; |