]> git.sur5r.net Git - bacula/bacula/commitdiff
ebl Add pool graphic view
authorEric Bollengier <eric@eb.homelinux.org>
Wed, 16 Aug 2006 17:36:14 +0000 (17:36 +0000)
committerEric Bollengier <eric@eb.homelinux.org>
Wed, 16 Aug 2006 17:36:14 +0000 (17:36 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@3288 91ce42f0-d328-0410-95d8-f526ca767f89

gui/bweb/lib/Bweb.pm
gui/bweb/tpl/display_pool.tpl

index 2bb7748e6f0ca3b93df9aa03d4062ec07ab27ef7..f9a95905e64374627ecb917173819de7afa05e0d 100644 (file)
@@ -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");
index a657c5f404487d2273441f1ec8fc15644639ed37..3240d86e5774e82ff151a88bcafc0595de9036e0 100644 (file)
@@ -4,7 +4,7 @@
  </div>
  <div class="bodydiv">
    <form action='?' method='get'>
-    <table id='id<TMPL_VAR NAME=ID>'></table>
+    <table id='id<TMPL_VAR ID>'></table>
     <button class='formulaire' type='submit' name='action' value='media' title='Show content'>
      <img src='/bweb/zoom.png'>
     </button>
 
 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;
+
+<TMPL_LOOP Pools>
+d = document.createElement('DIV');
+
+img = percent_display(d, [
+<TMPL_IF nb_recycle>{ name: "Recycle", nb: <TMPL_VAR nb_recycle> },</TMPL_IF>
+<TMPL_IF nb_purged> { name: "Purged", nb: <TMPL_VAR nb_purged> },</TMPL_IF>
+<TMPL_IF nb_append> { name: "Append", nb: <TMPL_VAR nb_append> },</TMPL_IF>
+<TMPL_IF nb_full>   { name: "Full", nb: <TMPL_VAR nb_full> },    </TMPL_IF>
+<TMPL_IF nb_disabled>   { name: "Disabled", nb: <TMPL_VAR nb_disabled> },    </TMPL_IF>
+<TMPL_IF nb_error>  { name: "Error", nb: <TMPL_VAR nb_error> },  </TMPL_IF>
+<TMPL_IF nb_archive>{ name: "Archive", nb: <TMPL_VAR nb_archive> },</TMPL_IF>
+<TMPL_IF nb_used>   { name: "Used", nb: <TMPL_VAR nb_used> },    </TMPL_IF>
+<TMPL_IF NAME='nb_read-only'> { name: "Read-Only", nb: <TMPL_VAR NAME='nb_read-only'> }, </TMPL_IF>
+{}
+]);
 
-<TMPL_LOOP NAME=Pools>
 chkbox = document.createElement('INPUT');
 chkbox.type  = 'radio';
-chkbox.value = '<TMPL_VAR NAME=Name>';
+chkbox.value = '<TMPL_VAR Name>';
 chkbox.name  = 'pool';
 
 data.push( new Array(
-"<TMPL_VAR NAME=Name>",
-"<TMPL_VAR NAME=Recycle>",
-"<TMPL_VAR NAME=VolRetention>",
-"<TMPL_VAR NAME=VolUseDuration>",
-"<TMPL_VAR NAME=MaxVolJobs>",
-"<TMPL_VAR NAME=MaxVolFiles>",
-"<TMPL_VAR NAME=MaxVolBytes>",
-"<TMPL_VAR NAME=VolNum>",
+"<TMPL_VAR Name>",
+"<TMPL_VAR Recycle>",
+"<TMPL_VAR VolRetention>",
+"<TMPL_VAR VolUseDuration>",
+"<TMPL_VAR MaxVolJobs>",
+"<TMPL_VAR MaxVolFiles>",
+"<TMPL_VAR MaxVolBytes>",
+"<TMPL_VAR VolNum>",
+d,
 chkbox
  )
 );
@@ -45,7 +63,7 @@ chkbox
 
 nrsTable.setup(
 {
- table_name:     "id<TMPL_VAR NAME=ID>",
+ table_name:     "id<TMPL_VAR 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
 }
 );
 </script>