Release Notes for bweb 2.2
+2007/11/08
+ - Add Prev/Next on job log output
2007/10/31
- Add a error filter to Job zoom view
+++ /dev/null
-<br/>
- <div class='titlediv'>
- <h1 class='newstitle'> ültimos jobs de <TMPL_VAR clientname> (<TMPL_VAR Filter>)
- </h1>
- </div>
- <div class='bodydiv'>
-
- <table id='id<TMPL_VAR ID>'></table>
-
-<a href="bgraph.pl?client=<TMPL_VAR clientname>;action=job_size;status=T">
- <img src="/bweb/chart.png" alt="backup size" title="backup size evolution"/>
- </a>
-<a href="bgraph.pl?client=<TMPL_VAR clientname>;action=job_duration;status=T">
- <img src="/bweb/chart.png" alt="backup duration" title="backup time evolution"/>
- </a>
-<a href="bgraph.pl?client=<TMPL_VAR clientname>;action=job_rate;status=T">
- <img src="/bweb/chart.png" alt="backup rate" title="backup rate evolution"/>
- </a>
- </div>
-
-
-<script type="text/javascript" language="JavaScript">
-var header = new Array("IdJob", "Nombre Job", "File Set", "Nivel", "Tiempo Inicio",
- "Archivos Job", "Bytes Job", "Errors");
-
-var data = new Array();
-
-<TMPL_LOOP Jobs>
-data.push( new Array(
-"<TMPL_VAR JobId>",
-"<TMPL_VAR JobName>",
-"<TMPL_VAR FileSet>",
-"<TMPL_VAR Level>",
-"<TMPL_VAR StartTime>",
-"<TMPL_VAR JobFiles>",
-human_size(<TMPL_VAR JobBytes>),
-"<TMPL_VAR JobErrors>"
- )
-);
-</TMPL_LOOP>
-
-nrsTable.setup(
-{
- table_name: "id<TMPL_VAR ID>",
- table_header: header,
- table_data: data,
- up_icon: up_icon,
- down_icon: down_icon,
- prev_icon: prev_icon,
- next_icon: next_icon,
- rew_icon: rew_icon,
- fwd_icon: fwd_icon,
-// natural_compare: true,
- even_cell_color: even_cell_color,
- odd_cell_color: odd_cell_color,
- header_color: header_color,
- page_nav: true,
- rows_per_page: rows_per_page,
- disable_sorting: new Array(5,6)
-}
-);
-
-// get newest job first
-nrsTables['id<TMPL_VAR ID>'].fieldSort(0);
-</script>
<pre id='log'>
<TMPL_VAR lines>
</pre>
+
+<a id='prev'><img border='0' src='/bweb/prev.png'></a>
+<a id='next'><img border='0' src='/bweb/next.png'></a>
</div>
+<script type="text/javascript" language='JavaScript'>
+
+var url='<TMPL_VAR thisurl>';
+var urlprev=url;
+var urlnext=url;
+
+var reoff = new RegExp('offset=[0-9]+', "");
+var relim = new RegExp('limit=[0-9]+', "");
+
+var offset=0;
+var limit=1000;
+var nbline=0;
+<TMPL_IF offset>
+offset = <TMPL_VAR offset>;
+</TMPL_IF>
+<TMPL_IF limit>
+limit = <TMPL_VAR limit>;
+</TMPL_IF>
+<TMPL_IF nbline>
+nbline=<TMPL_VAR nbline>;
+</TMPL_IF>
+
+if (nbline == limit) {
+ var offset_next = offset + limit;
+
+ if (url.match(reoff)) {
+ urlnext = urlnext.replace(reoff, 'offset=' + offset_next);
+ } else {
+ urlnext = urlnext + ';offset=' + offset_next;
+ }
+
+ if (url.match(relim)) {
+ urlnext = urlnext.replace(relim, 'limit=' + limit);
+ } else {
+ urlnext = urlnext + ';limit=' + limit;
+ }
+
+ document.getElementById('next').href = urlnext;
+
+} else {
+ document.getElementById('next').style.visibility="hidden";
+}
+
+if (offset > 0) {
+ var offset_prev = offset - limit;
+ if (offset_prev < 0) {
+ offset_prev=0;
+ }
+ if (url.match(reoff)) {
+ urlprev = urlprev.replace(reoff, 'offset=' + offset_prev);
+ } else {
+ urlprev = urlprev + ';offset=' + offset_prev ;
+ }
+ if (url.match(relim)) {
+ urlprev = urlprev.replace(relim, 'limit=' + limit);
+ } else {
+ urlprev = urlprev + ';limit=' + limit;
+ }
+
+ if (offset_prev >= 0) {
+ document.getElementById('prev').href = urlprev;
+ } else {
+ document.getElementById('prev').style.visibility="hidden";
+ }
+} else {
+ document.getElementById('prev').style.visibility="hidden";
+}
+</script>
+++ /dev/null
-<br/>
- <div class='titlediv'>
- <h1 class='newstitle'> Historique de <TMPL_VAR clientname> (<TMPL_VAR Filter>)
- </h1>
- </div>
- <div class='bodydiv'>
-
- <table id='id<TMPL_VAR ID>'></table>
-
-<a href="bgraph.pl?client=<TMPL_VAR clientname>;action=job_size;status=T">
- <img src="/bweb/chart.png" alt="taille des sauvegardes" title="évolution de la taille des sauvegardes"/>
- </a>
-<a href="bgraph.pl?client=<TMPL_VAR clientname>;action=job_duration;status=T">
- <img src="/bweb/chart.png" alt="durée des sauvegardes" title="évolution de la durée des sauvegardes"/>
- </a>
-<a href="bgraph.pl?client=<TMPL_VAR clientname>;action=job_rate;status=T">
- <img src="/bweb/chart.png" alt="vitesse des sauvegardes" title="évolution de la vitesse des sauvegardes"/>
- </a>
- </div>
-
-
-<script type="text/javascript" language="JavaScript">
-var header = new Array("JobId", "Nom du Job", "File Set", "Niveau", "Début",
- "Nb fichiers", "Taille", "Erreurs");
-
-var data = new Array();
-
-<TMPL_LOOP Jobs>
-data.push( new Array(
-"<TMPL_VAR JobId>",
-"<TMPL_VAR JobName>",
-"<TMPL_VAR FileSet>",
-"<TMPL_VAR Level>",
-"<TMPL_VAR StartTime>",
-"<TMPL_VAR JobFiles>",
-human_size(<TMPL_VAR JobBytes>),
-"<TMPL_VAR JobErrors>"
- )
-);
-</TMPL_LOOP>
-
-nrsTable.setup(
-{
- table_name: "id<TMPL_VAR ID>",
- table_header: header,
- table_data: data,
- up_icon: up_icon,
- down_icon: down_icon,
- prev_icon: prev_icon,
- next_icon: next_icon,
- rew_icon: rew_icon,
- fwd_icon: fwd_icon,
-// natural_compare: true,
- even_cell_color: even_cell_color,
- odd_cell_color: odd_cell_color,
- header_color: header_color,
- page_nav: true,
- rows_per_page: rows_per_page,
- disable_sorting: new Array(5,6)
-}
-);
-
-// get newest job first
-nrsTables['id<TMPL_VAR ID>'].fieldSort(0);
-</script>
<pre id='log'>
<TMPL_VAR lines>
</pre>
+
+<a id='prev'><img border='0' src='/bweb/prev.png'></a>
+<a id='next'><img border='0' src='/bweb/next.png'></a>
</div>
+<script type="text/javascript" language='JavaScript'>
+
+var url='<TMPL_VAR thisurl>';
+var urlprev=url;
+var urlnext=url;
+
+var reoff = new RegExp('offset=[0-9]+', "");
+var relim = new RegExp('limit=[0-9]+', "");
+
+var offset=0;
+var limit=1000;
+var nbline=0;
+<TMPL_IF offset>
+offset = <TMPL_VAR offset>;
+</TMPL_IF>
+<TMPL_IF limit>
+limit = <TMPL_VAR limit>;
+</TMPL_IF>
+<TMPL_IF nbline>
+nbline=<TMPL_VAR nbline>;
+</TMPL_IF>
+
+if (nbline == limit) {
+ var offset_next = offset + limit;
+
+ if (url.match(reoff)) {
+ urlnext = urlnext.replace(reoff, 'offset=' + offset_next);
+ } else {
+ urlnext = urlnext + ';offset=' + offset_next;
+ }
+
+ if (url.match(relim)) {
+ urlnext = urlnext.replace(relim, 'limit=' + limit);
+ } else {
+ urlnext = urlnext + ';limit=' + limit;
+ }
+
+ document.getElementById('next').href = urlnext;
+
+} else {
+ document.getElementById('next').style.visibility="hidden";
+}
+
+if (offset > 0) {
+ var offset_prev = offset - limit;
+ if (offset_prev < 0) {
+ offset_prev=0;
+ }
+ if (url.match(reoff)) {
+ urlprev = urlprev.replace(reoff, 'offset=' + offset_prev);
+ } else {
+ urlprev = urlprev + ';offset=' + offset_prev ;
+ }
+ if (url.match(relim)) {
+ urlprev = urlprev.replace(relim, 'limit=' + limit);
+ } else {
+ urlprev = urlprev + ';limit=' + limit;
+ }
+
+ if (offset_prev >= 0) {
+ document.getElementById('prev').href = urlprev;
+ } else {
+ document.getElementById('prev').style.visibility="hidden";
+ }
+} else {
+ document.getElementById('prev').style.visibility="hidden";
+}
+</script>
if ($arg->{limit} == 100) {
$arg->{limit} = 1000;
}
-
- my $t = CGI::param('time') || $self->{info}->{display_log_time} || '';
-
- # display only Error and Warning messages
- my $filter = '';
- if (CGI::param('error')) {
- $filter = " AND LogText $self->{sql}->{MATCH} 'Error|Warning' ";
- }
-
# get security filter
- $filter .= $self->get_client_filter();
+ my $filter = $self->get_client_filter();
my $query = "
SELECT Job.Name as name, Client.Name as clientname
return $self->error("Can't find $arg->{jobid} in catalog");
}
+ # display only Error and Warning messages
+ $filter = '';
+ if (CGI::param('error')) {
+ $filter = " AND LogText $self->{sql}->{MATCH} 'Error|Warning' ";
+ }
+
+ my $logtext;
+ if (CGI::param('time') || $self->{info}->{display_log_time}) {
+ $logtext = 'LogText';
+ } else {
+ $logtext = $self->dbh_strcat('Time', ' ', 'LogText')
+ }
+
$query = "
-SELECT Time AS time, LogText AS log
- FROM Log
- WHERE ( Log.JobId = $arg->{jobid}
- OR (Log.JobId = 0 AND Time >= (SELECT StartTime FROM Job WHERE JobId=$arg->{jobid})
+SELECT count(1) AS nbline, JobId AS jobid, group_concat($logtext) AS lines
+ FROM (
+ SELECT JobId, Time, LogText
+ FROM Log
+ WHERE ( Log.JobId = $arg->{jobid}
+ OR (Log.JobId = 0 AND Time >= (SELECT StartTime FROM Job WHERE JobId=$arg->{jobid})
AND Time <= (SELECT COALESCE(EndTime,NOW()) FROM Job WHERE JobId=$arg->{jobid})
)
) $filter
ORDER BY LogId
LIMIT $arg->{limit}
OFFSET $arg->{offset}
+ ) AS temp
+ GROUP BY JobId
+
";
- my $log = $self->dbh_selectall_arrayref($query);
+ my $log = $self->dbh_selectrow_hashref($query);
unless ($log) {
return $self->error("Can't get log for jobid $arg->{jobid}");
}
- my $logtxt;
- if ($t) {
- # log contains \n
- $logtxt = join("", map { ($_->[0] . ' ' . $_->[1]) } @$log ) ;
- } else {
- $logtxt = join("", map { $_->[1] } @$log ) ;
- }
-
- $self->display({ lines=> $logtxt,
+ $self->display({ lines=> $log->{lines},
+ nbline => $log->{nbline},
jobid => $arg->{jobid},
name => $row->{name},
client => $row->{clientname},
-- --------------------------------------------------
-- Upgrade from 2.2
-- --------------------------------------------------
+
+CREATE FUNCTION concat (text, text) RETURNS text AS '
+DECLARE
+result text;
+BEGIN
+IF $1 is not null THEN
+result := $1 || $2;
+END IF;
+
+RETURN result;
+END;
+' LANGUAGE plpgsql;
+
+CREATE AGGREGATE group_concat(
+sfunc = concat,
+basetype = text,
+stype = text,
+initcond = ''
+);
+
BEGIN;
CREATE TABLE bweb_user
(
-- Upgrade from 2.2
-- --------------------------------------------------
+CREATE FUNCTION concat (text, text) RETURNS text AS '
+DECLARE
+result text;
+BEGIN
+IF $1 is not null THEN
+result := $1 || $2;
+END IF;
+
+RETURN result;
+END;
+' LANGUAGE plpgsql;
+
+CREATE AGGREGATE group_concat(
+sfunc = concat,
+basetype = text,
+stype = text,
+initcond = ''
+);
+
BEGIN;
CREATE TABLE bweb_user
(
+++ /dev/null
-<br/>
- <div class='titlediv'>
- <h1 class='newstitle'> Last jobs for <TMPL_VAR clientname> (<TMPL_VAR Filter>)
- </h1>
- </div>
- <div class='bodydiv'>
-
- <table id='id<TMPL_VAR ID>'></table>
-
-<a href="bgraph.pl?client=<TMPL_VAR clientname>;action=job_size;status=T">
- <img src="/bweb/chart.png" alt="backup size" title="backup size evolution"/>
- </a>
-<a href="bgraph.pl?client=<TMPL_VAR clientname>;action=job_duration;status=T">
- <img src="/bweb/chart.png" alt="backup duration" title="backup time evolution"/>
- </a>
-<a href="bgraph.pl?client=<TMPL_VAR clientname>;action=job_rate;status=T">
- <img src="/bweb/chart.png" alt="backup rate" title="backup rate evolution"/>
- </a>
- </div>
-
-
-<script type="text/javascript" language="JavaScript">
-var header = new Array("JobId", "Job Name", "File Set", "Level", "Start Time",
- "Job Files", "Job Bytes", "Errors");
-
-var data = new Array();
-
-<TMPL_LOOP Jobs>
-data.push( new Array(
-"<TMPL_VAR JobId>",
-"<TMPL_VAR JobName>",
-"<TMPL_VAR FileSet>",
-"<TMPL_VAR Level>",
-"<TMPL_VAR StartTime>",
-"<TMPL_VAR JobFiles>",
-human_size(<TMPL_VAR JobBytes>),
-"<TMPL_VAR JobErrors>"
- )
-);
-</TMPL_LOOP>
-
-nrsTable.setup(
-{
- table_name: "id<TMPL_VAR ID>",
- table_header: header,
- table_data: data,
- up_icon: up_icon,
- down_icon: down_icon,
- prev_icon: prev_icon,
- next_icon: next_icon,
- rew_icon: rew_icon,
- fwd_icon: fwd_icon,
-// natural_compare: true,
- even_cell_color: even_cell_color,
- odd_cell_color: odd_cell_color,
- header_color: header_color,
- page_nav: true,
- rows_per_page: rows_per_page,
- disable_sorting: new Array(5,6)
-}
-);
-
-// get newest job first
-nrsTables['id<TMPL_VAR ID>'].fieldSort(0);
-</script>
<pre id='log'>
<TMPL_VAR lines>
</pre>
+
+<a id='prev'><img border='0' src='/bweb/prev.png'></a>
+<a id='next'><img border='0' src='/bweb/next.png'></a>
</div>
+<script type="text/javascript" language='JavaScript'>
+
+var url='<TMPL_VAR thisurl>';
+var urlprev=url;
+var urlnext=url;
+
+var reoff = new RegExp('offset=[0-9]+', "");
+var relim = new RegExp('limit=[0-9]+', "");
+
+var offset=0;
+var limit=1000;
+var nbline=0;
+<TMPL_IF offset>
+offset = <TMPL_VAR offset>;
+</TMPL_IF>
+<TMPL_IF limit>
+limit = <TMPL_VAR limit>;
+</TMPL_IF>
+<TMPL_IF nbline>
+nbline=<TMPL_VAR nbline>;
+</TMPL_IF>
+
+if (nbline == limit) {
+ var offset_next = offset + limit;
+
+ if (url.match(reoff)) {
+ urlnext = urlnext.replace(reoff, 'offset=' + offset_next);
+ } else {
+ urlnext = urlnext + ';offset=' + offset_next;
+ }
+
+ if (url.match(relim)) {
+ urlnext = urlnext.replace(relim, 'limit=' + limit);
+ } else {
+ urlnext = urlnext + ';limit=' + limit;
+ }
+
+ document.getElementById('next').href = urlnext;
+
+} else {
+ document.getElementById('next').style.visibility="hidden";
+}
+
+if (offset > 0) {
+ var offset_prev = offset - limit;
+ if (offset_prev < 0) {
+ offset_prev=0;
+ }
+ if (url.match(reoff)) {
+ urlprev = urlprev.replace(reoff, 'offset=' + offset_prev);
+ } else {
+ urlprev = urlprev + ';offset=' + offset_prev ;
+ }
+ if (url.match(relim)) {
+ urlprev = urlprev.replace(relim, 'limit=' + limit);
+ } else {
+ urlprev = urlprev + ';limit=' + limit;
+ }
+
+ if (offset_prev >= 0) {
+ document.getElementById('prev').href = urlprev;
+ } else {
+ document.getElementById('prev').style.visibility="hidden";
+ }
+} else {
+ document.getElementById('prev').style.visibility="hidden";
+}
+</script>
bweb (2.2.6-1) stable; urgency=low
* Replace VolStatus by Enabled in volume location
* Add Enabled in volume update and zoom
+ * Add Prev/Next on job log output
* Add a error filter to Job zoom view
-- Eric Bollengier <eric@eb.homelinux.org> Tue, 30 Oct 2007 22:15:47 +0000