]> git.sur5r.net Git - bacula/bacula/commitdiff
ebl Add media list to bresto
authorEric Bollengier <eric@eb.homelinux.org>
Mon, 26 Nov 2007 22:35:22 +0000 (22:35 +0000)
committerEric Bollengier <eric@eb.homelinux.org>
Mon, 26 Nov 2007 22:35:22 +0000 (22:35 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@5992 91ce42f0-d328-0410-95d8-f526ca767f89

gui/bweb/cgi/bresto.pl
gui/bweb/html/bresto.html
gui/bweb/html/bresto.js
gui/bweb/technotes-2.3

index 9071a9e768740997f36a7137eea7d1c1824d94cd..26724402bdf0eff8880ba85999da1eed08cdee01 100755 (executable)
@@ -964,7 +964,7 @@ if ($action eq 'list_files') {
 } elsif ($action eq 'get_media') {
 
     my $jobid = join(',', @jobid);
-    my $fileid = join(',', grep { /^\d+$/ } CGI::param('fileid'));
+    my $fileid = join(',', grep { /^\d+(,\d+)*$/ } CGI::param('fileid'));
 
     my $q="
  SELECT DISTINCT VolumeName, Enabled, InChanger
@@ -974,7 +974,7 @@ if ($action eq 'list_files') {
              VolumeName, Enabled, Inchanger
         FROM JobMedia JOIN Media USING (MediaId)
        WHERE JobId IN ($jobid)
-       GROUP BY VolumeName, InChanger
+       GROUP BY VolumeName,Enabled,InChanger
     ) AS allmedia
   WHERE File.FileId IN ($fileid)
     AND File.FileIndex >= allmedia.FirstIndex
@@ -982,7 +982,7 @@ if ($action eq 'list_files') {
 ";
     my $lst = $bvfs->dbh_selectall_arrayref($q);
     print "[";
-    print join(',', map { "['$_->[0]',$_->[1]],$_->[2]]" } @$lst);
+    print join(',', map { "['$_->[0]',$_->[1],$_->[2]]" } @$lst);
     print "]\n";
 
 }
index a996ee0312fd4b50e15431d03208942ff54d9b65..b4f3cc588fb4fa15fc36395cf55e5f670437473a 100644 (file)
@@ -27,6 +27,7 @@
 
 <div id="div-resto-dlg" style="visibility:hidden;">
 <div id="div-resto-form" >
+<div id="div-media"      ></div>
 <div id="div-resto-form-bp1"></div> <div id="div-resto-form-bp2"></div> 
 </div>
 </div>
index c5561eb2e07501d2647e18ff051eaf35772484c7..ae50afd27dd1432307951b41e87a321d300778c9 100644 (file)
@@ -690,23 +690,85 @@ function ext_init()
             selectOnFocus:true,
             width:190
         });
+////////////////////////////////////////////////////////////////
+  var media_store = new Ext.data.Store({
+        proxy: new Ext.data.HttpProxy({
+            url: '/cgi-bin/bweb/bresto.pl',
+            method: 'GET',
+            params:{offset:0, limit:50 }
+        }),
+
+        reader: new Ext.data.ArrayReader({
+        }, Ext.data.Record.create([
+   {name: 'volumename'},
+   {name: 'enabled'   },
+   {name: 'inchanger' }
+        ]))
+   });
+
+   var media_cm = new Ext.grid.ColumnModel([{
+           header:    "InChanger",
+           dataIndex: 'inchanger',
+           width:     60,
+           renderer:  rd_vol_is_online
+        }, {
+           header:    "Volume",
+           id:        'volumename', 
+           dataIndex: 'volumename',
+          width:     140
+        }
+   ]);
+
+    // create the grid
+   var media_grid = new Ext.grid.Grid('div-media', {
+        ds: media_store,
+        cm: media_cm,
+        enableDrag: false,
+        enableDrop: false,
+        loadMask: true,
+       width: 200,
+        enableColLock:false        
+    });
+
+    media_grid.render();
+
+    var items = file_selection_store.data.items;
+    var tab_fileid=new Array();
+    var tab_jobid=new Array();
+    for(var i=0;i<items.length;i++) {
+       if (items[i].data['fileid']) {
+          tab_fileid.push(items[i].data['fileid']);
+       }
+       tab_jobid.push(items[i].data['jobid']);
+    }
+    var res = tab_fileid.join(",");
+    var res2 = tab_jobid.join(",");
+
+    media_store.baseParams = init_params({action: 'get_media', jobid: res2, fileid: res});
+    media_store.reload();
+
+////////////////////////////////////////////////////////////////
+    fs.fieldset(
+        {legend:'Media needed'},
+        media_grid
+    );
     fs.fieldset(
         {legend:'Restore job'},
-//        new Ext.form.ComboBox({
-//            fieldLabel: 'Replace',
-//            hiddenName:'replace',
-//            store: new Ext.data.SimpleStore({
-//              fields: ['replace'],
-//              data : [['always'],['never'],['if newer']]
-//         }),
-//            displayField:'replace',
-//            typeAhead: true,
-//            mode: 'local',
-//            triggerAction: 'all',
-//            emptyText:'never',
-//            selectOnFocus:true,
-//            width:190
-//        }),
+        new Ext.form.ComboBox({
+            fieldLabel: 'Replace',
+            hiddenName:'replace',
+            store: new Ext.data.SimpleStore({
+                fields: ['replace'],
+                data : [['always'],['never'],['if newer']]
+           }),
+            displayField:'replace',
+            typeAhead: true,
+            mode: 'local',
+            triggerAction: 'all',
+            emptyText:'never',
+            selectOnFocus:true,
+            width:190
+        }),
 //
 //        new Ext.form.ComboBox({
 //            fieldLabel: 'job',
@@ -754,22 +816,23 @@ function ext_init()
        var res4 = ';client=' + rclient_combo.getValue() + ';storage=' + storage_combo.getValue() + ';where=' + where_text.getValue();
 
        window.location='/cgi-bin/bweb/bresto.pl?action=restore' + res + res2 + res3 + res4;
+    } // end launch_restore
+
+    var dialog = Ext.brestore.dlglaunch;
+    dialog.addKeyListener(27, dialog.hide, dialog);
+    dialog.addButton('Submit', launch_restore);
+    dialog.addButton('Close', dialog.hide, dialog);
+    
+    var layout = dialog.getLayout();
+    layout.beginUpdate();
+    layout.add('center', new Ext.ContentPanel('div-resto-form', {
+                                autoCreate:true, title: 'Third Tab', closable:true, background:true}));
+    layout.endUpdate();
+    dialog.show();
+
     }
-       var dialog = Ext.brestore.dlglaunch;
-        dialog.addKeyListener(27, dialog.hide, dialog);
-        dialog.addButton('Submit', launch_restore);
-        dialog.addButton('Close', dialog.hide, dialog);
-
-        var layout = dialog.getLayout();
-        layout.beginUpdate();
-       layout.add('center', new Ext.ContentPanel('div-resto-form', {
-                                    autoCreate:true, title: 'Third Tab', closable:true, background:true}));
-       layout.endUpdate();
-       dialog.show();
-
-           }
-       }
-    ]);
+  }
+ ]);
 
 ////////////////////////////////////////////////////////////////
 
index 6a97d305006d35258c6305a25be09dfc7f81fa34..41421e8c4fac5ea674163d1491daf08e1500e42f 100644 (file)
@@ -2,6 +2,7 @@
 ebl  Fix overview to works with mysql
 ebl  Add date support to bresto
 ebl  Make bresto works with mysql (no DISTINCT ON (c1,c2))
+ebl  Add the list of media that will be needed for resto
 
 25Nov07
 ebl  Use a automatic rediction when launching a new job