From a20f81a3ad226f1de074f210bdbbd1ebec1b692b Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Wed, 16 Aug 2006 17:36:14 +0000 Subject: [PATCH] ebl Add pool graphic view git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@3288 91ce42f0-d328-0410-95d8-f526ca767f89 --- gui/bweb/lib/Bweb.pm | 24 ++++++++++++++---- gui/bweb/tpl/display_pool.tpl | 48 ++++++++++++++++++++++++----------- 2 files changed, 52 insertions(+), 20 deletions(-) diff --git a/gui/bweb/lib/Bweb.pm b/gui/bweb/lib/Bweb.pm index 2bb7748e6f..f9a95905e6 100644 --- a/gui/bweb/lib/Bweb.pm +++ b/gui/bweb/lib/Bweb.pm @@ -2360,7 +2360,8 @@ SELECT Pool.Name AS name, Pool.VolUseDuration AS voluseduration, Pool.MaxVolJobs AS maxvoljobs, Pool.MaxVolFiles AS maxvolfiles, - Pool.MaxVolBytes AS maxvolbytes, + Pool.MaxVolBytes AS maxvolbytes, + Pool.PoolId AS poolid, (SELECT count(Media.MediaId) FROM Media WHERE Media.PoolId = Pool.PoolId @@ -2369,12 +2370,25 @@ SELECT Pool.Name AS name, "; my $all = $self->dbh_selectall_hashref($query, 'name') ; - foreach (values %$all) { - $_->{maxvolbytes} = human_size($_->{maxvolbytes}) ; - $_->{volretention} = human_sec($_->{volretention}) ; - $_->{voluseduration} = human_sec($_->{voluseduration}) ; + foreach my $p (values %$all) { + $p->{maxvolbytes} = human_size($p->{maxvolbytes}) ; + $p->{volretention} = human_sec($p->{volretention}) ; + $p->{voluseduration} = human_sec($p->{voluseduration}) ; + + $query = " + SELECT VolStatus AS volstatus, count(MediaId) AS nb + FROM Media + WHERE PoolId=$p->{poolid} +GROUP BY VolStatus +"; + + my $content = $self->dbh_selectall_hashref($query, 'volstatus'); + foreach my $t (values %$content) { + $p->{"nb_" . $t->{volstatus}} = $t->{nb} ; + } } + $self->debug($all); $self->display({ ID => $cur_id++, Pools => [ values %$all ]}, "display_pool.tpl"); diff --git a/gui/bweb/tpl/display_pool.tpl b/gui/bweb/tpl/display_pool.tpl index a657c5f404..3240d86e57 100644 --- a/gui/bweb/tpl/display_pool.tpl +++ b/gui/bweb/tpl/display_pool.tpl @@ -4,7 +4,7 @@
-
+
@@ -18,26 +18,44 @@ var header = new Array("Name","Recycle","Retention","Use Duration", "Max job per volume","Max file per volume", - "Max volume size","Nb volumes", "Select"); + "Max volume size","Nb volumes", "Usage", "Select"); var data = new Array(); var chkbox; +var img; +var d; + + +d = document.createElement('DIV'); + +img = percent_display(d, [ +{ name: "Recycle", nb: }, + { name: "Purged", nb: }, + { name: "Append", nb: }, + { name: "Full", nb: }, + { name: "Disabled", nb: }, + { name: "Error", nb: }, +{ name: "Archive", nb: }, + { name: "Used", nb: }, + { name: "Read-Only", nb: }, +{} +]); - chkbox = document.createElement('INPUT'); chkbox.type = 'radio'; -chkbox.value = ''; +chkbox.value = ''; chkbox.name = 'pool'; data.push( new Array( -"", -"", -"", -"", -"", -"", -"", -"", +"", +"", +"", +"", +"", +"", +"", +"", +d, chkbox ) ); @@ -45,7 +63,7 @@ chkbox nrsTable.setup( { - table_name: "id", + table_name: "id", table_header: header, table_data: data, up_icon: up_icon, @@ -60,8 +78,8 @@ nrsTable.setup( header_color: header_color, page_nav: true, padding: 3, - rows_per_page: rows_per_page, -// disable_sorting: new Array(5,6) +// disable_sorting: new Array(5,6), + rows_per_page: rows_per_page } ); -- 2.39.5