]> git.sur5r.net Git - bacula/bacula/commitdiff
ebl Add bascic device managment
authorEric Bollengier <eric@eb.homelinux.org>
Sat, 5 Jan 2008 18:29:54 +0000 (18:29 +0000)
committerEric Bollengier <eric@eb.homelinux.org>
Sat, 5 Jan 2008 18:29:54 +0000 (18:29 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@6237 91ce42f0-d328-0410-95d8-f526ca767f89

12 files changed:
gui/bweb/cgi/bweb.pl
gui/bweb/lang/en/tpl/begin.tpl
gui/bweb/lang/en/tpl/cmd_storage.tpl [new file with mode: 0644]
gui/bweb/lang/es/tpl/begin.tpl
gui/bweb/lang/es/tpl/cmd_storage.tpl [new file with mode: 0644]
gui/bweb/lang/fr/tpl/begin.tpl
gui/bweb/lang/fr/tpl/cmd_storage.tpl [new file with mode: 0644]
gui/bweb/lib/Bweb.pm
gui/bweb/technotes-2.3
gui/bweb/tpl/about.tpl
gui/bweb/tpl/begin.tpl
gui/bweb/tpl/cmd_storage.tpl [new file with mode: 0644]

index 54805a151a3d34cef2811327b17e6dfcc63f17ac..e8e704e7cec13ec2ab60065f9bb032af55ad4711 100755 (executable)
@@ -128,6 +128,9 @@ if ($action eq 'begin') {           # main display
 } elsif ($action eq 'location_del') {
     $bweb->location_del();
 
+} elsif ($action eq 'cmd_storage') {
+    $bweb->cmd_storage();
+
 } elsif ($action eq 'media') {
     $bweb->can_do('r_view_media');
 
index d8934435c0d2561d4c13e96d8e881df106583651..50565b5ecea50538a5b90bcc7838d94202d6a14c 100644 (file)
@@ -52,16 +52,21 @@ if ('Main' == ('_' + '_Main_' + '_')) {
      <li><a href="bweb.pl?action=intern_media">Load Media</a> </li>
   </ul>
  </li>
-<TMPL_IF achs>
- <li style="padding: 0.25em 2em;">Autochanger
+ <li style="padding: 0.25em 2em;">Storages
   <ul>
+   <li><a href="bweb.pl?action=cmd_storage">Manage Device</a><TMPL_IF achs><hr></TMPL_IF></li>
 <TMPL_LOOP achs>
    <li><a href="bweb.pl?action=ach_view;ach=<TMPL_VAR name>"><TMPL_VAR name></a></li>
 </TMPL_LOOP>
   </ul>
  </li>
-</TMPL_IF> 
- <li><a href="bweb.pl?action=graph"> Statistics </a></li>
+ <li><a href="bweb.pl?action=graph"> Statistics </a>
+  <ul>
+    <li><a href="bweb.pl?action=graph"> Statistics </a>
+    <li><a href="btime.pl"> Backup Timing </a>
+    <!-- <li><a href="bperf.pl"> Perfs </a> -->
+  </ul>
+ </li>
  <li> <a href="bweb.pl?action=view_conf"> Configuration </a> 
 <TMPL_IF enable_security>
   <ul> <li> <a href="bweb.pl?action=view_conf"> Configuration </a> 
diff --git a/gui/bweb/lang/en/tpl/cmd_storage.tpl b/gui/bweb/lang/en/tpl/cmd_storage.tpl
new file mode 100644 (file)
index 0000000..227388a
--- /dev/null
@@ -0,0 +1,36 @@
+
+<div class='titlediv'>
+  <h1 class='newstitle'> Manage Storage device</h1>
+</div>
+<div class='bodydiv'>
+   <form action="?" method='get'>
+   <input type='hidden' name='action' value='cmd_storage'>
+    <table>
+     <tr><td>Storage device:</td>
+         <td> 
+            <select name='storage' size='5' class='formulaire'>
+            <TMPL_LOOP storage>
+            <option><TMPL_VAR name></option>
+            </TMPL_LOOP>
+            </select>
+         </td>
+     </tr>
+     <tr><td>Drive number (if any):</td> 
+         <td><input size='3' type='text' name='drive' value='0' class='formulaire'></td>
+     </tr>
+     <tr><td>Action:</td> 
+         <td>
+<button type="submit" class="bp" name='storage_cmd' value='mount'
+ title='mount drive'> <img src='/bweb/load.png' alt=''>Mount</button>
+<button type="submit" class="bp" name='storage_cmd' value='umount'
+ title='umount drive'> <img src='/bweb/unload.png' alt=''>Umount</button>
+<button type="submit" class="bp" name='storage_cmd' value='release'
+ title='release drive'> <img src='/bweb/unload.png' alt=''>Release</button>
+<button type="submit" class="bp" name='storage_cmd' value='status'
+ title='status drive'> <img src='/bweb/zoom.png' alt=''>Status</button>
+         </td>
+     </tr>
+    </table>
+   </form>
+</div>
+
index 4b8631e5416b534c40542610c280074baae659bd..b5b3fd83d3f90eee826d6b4b332642f607f8a92d 100644 (file)
@@ -52,16 +52,25 @@ if ('Principal' == ('_' + '_Main_' + '_')) {
      <li><a href="bweb.pl?action=intern_media">Cargar Medio</a> </li>
   </ul>
  </li>
-<TMPL_IF achs>
- <li style="padding: 0.25em 2em;">Autochanger
+ <li style="padding: 0.25em 2em;">Storage
   <ul>
+   <li><a href="bweb.pl?action=cmd_storage">Manage Device</a></li>
+<TMPL_IF achs>
+<li><hr></li>
+</TMPL_IF>
 <TMPL_LOOP achs>
    <li><a href="bweb.pl?action=ach_view;ach=<TMPL_VAR name>"><TMPL_VAR name></a></li>
 </TMPL_LOOP>
   </ul>
  </li>
 </TMPL_IF> 
- <li><a href="bweb.pl?action=graph"> Estadísticas </a></li>
+ <li><a href="bweb.pl?action=graph"> Estadísticas </a>
+  <ul>
+    <li><a href="bweb.pl?action=graph"> Estadísticas </a>
+    <li><a href="btime.pl"> Backup Timing </a>
+    <!-- <li><a href="bperf.pl"> Perfs </a> -->
+  </ul>
+ </li>
  <li> <a href="bweb.pl?action=view_conf"> Configuración </a> 
 <TMPL_IF enable_security>
   <ul> <li> <a href="bweb.pl?action=view_conf"> Configuración </a> 
diff --git a/gui/bweb/lang/es/tpl/cmd_storage.tpl b/gui/bweb/lang/es/tpl/cmd_storage.tpl
new file mode 100644 (file)
index 0000000..675733a
--- /dev/null
@@ -0,0 +1,36 @@
+
+<div class='titlediv'>
+  <h1 class='newstitle'> Manage Storage device</h1>
+</div>
+<div class='bodydiv'>
+   <form action="?" method='get'>
+   <input type='hidden' name='action' value='cmd_storage'>
+    <table>
+     <tr><td>Storage device:</td>
+         <td> 
+            <select name='storage' size='5' class='formulaire'>
+            <TMPL_LOOP storage>
+            <option><TMPL_VAR name></option>
+            </TMPL_LOOP>
+            </select>
+         </td>
+     </tr>
+     <tr><td>Drive number (if any):</td> 
+         <td><input size='3' type='text' name='drive' value='0' class='formulaire'></td>
+     </tr>
+     <tr><td>Action:</td> 
+         <td>
+<button type="submit" class="bp" name='storage_cmd' value='mount'
+ title='mount drive'> <img src='/bweb/load.png' alt=''>Mount</button>
+<button type="submit" class="bp" name='storage_cmd' value='umount'
+ title='umount drive'> <img src='/bweb/unload.png' alt=''>Umount</button>
+<button type="submit" class="bp" name='storage_cmd' value='release'
+ title='release drive'> <img src='/bweb/unload.png' alt=''>Release</button>
+<button type="submit" class="bp" name='storage_cmd' value='status'
+ title='status drive'> <img src='/bweb/zoom.png' alt=''>Estado</button>
+         </td>
+     </tr>
+    </table>
+   </form>
+</div>
+
index 558404315032f05c002595e6e341330842369ca8..e64a3e880df7a21bcedfcf964d19196cc2559b48 100644 (file)
@@ -52,16 +52,25 @@ if ('Accueil' == ('_' + '_Main_' + '_')) {
      <li><a href="bweb.pl?action=intern_media">Internaliser</a> </li>
   </ul>
  </li>
-<TMPL_IF achs>
- <li style="padding: 0.25em 2em;">Autochanger
+ <li style="padding: 0.25em 2em;">Storage
   <ul>
+   <li><a href="bweb.pl?action=cmd_storage">Manage Device</a></li>
+<TMPL_IF achs>
+<li><hr></li>
+</TMPL_IF>
 <TMPL_LOOP achs>
    <li><a href="bweb.pl?action=ach_view;ach=<TMPL_VAR name>"><TMPL_VAR name></a></li>
 </TMPL_LOOP>
   </ul>
  </li>
 </TMPL_IF> 
- <li><a href="bweb.pl?action=graph"> Statistiques </a></li>
+ <li><a href="bweb.pl?action=graph"> Statistiques </a>
+  <ul>
+    <li><a href="bweb.pl?action=graph"> Statistiques </a>
+    <li><a href="btime.pl"> Backup Timing </a>
+    <!-- <li><a href="bperf.pl"> Perfs </a> -->
+  </ul>
+ </li>
  <li> <a href="bweb.pl?action=view_conf"> Configuration </a> 
 <TMPL_IF enable_security>
   <ul> <li> <a href="bweb.pl?action=view_conf"> Configuration </a> 
diff --git a/gui/bweb/lang/fr/tpl/cmd_storage.tpl b/gui/bweb/lang/fr/tpl/cmd_storage.tpl
new file mode 100644 (file)
index 0000000..bbea83d
--- /dev/null
@@ -0,0 +1,36 @@
+
+<div class='titlediv'>
+  <h1 class='newstitle'> Manage Storage device</h1>
+</div>
+<div class='bodydiv'>
+   <form action="?" method='get'>
+   <input type='hidden' name='action' value='cmd_storage'>
+    <table>
+     <tr><td>Storage device:</td>
+         <td> 
+            <select name='storage' size='5' class='formulaire'>
+            <TMPL_LOOP storage>
+            <option><TMPL_VAR name></option>
+            </TMPL_LOOP>
+            </select>
+         </td>
+     </tr>
+     <tr><td>Drive number (if any):</td> 
+         <td><input size='3' type='text' name='drive' value='0' class='formulaire'></td>
+     </tr>
+     <tr><td>Action:</td> 
+         <td>
+<button type="submit" class="bp" name='storage_cmd' value='mount'
+ title='Charger un lecteur'> <img src='/bweb/load.png' alt=''>Mount</button>
+<button type="submit" class="bp" name='storage_cmd' value='umount'
+ title='Décharger un lecteur'> <img src='/bweb/unload.png' alt=''>Umount</button>
+<button type="submit" class="bp" name='storage_cmd' value='release'
+ title='release drive'> <img src='/bweb/unload.png' alt=''>Release</button>
+<button type="submit" class="bp" name='storage_cmd' value='status'
+ title='status drive'> <img src='/bweb/zoom.png' alt=''>Statut</button>
+         </td>
+     </tr>
+    </table>
+   </form>
+</div>
+
index 92520c08172a90bd6a6ab99353145846cfc0ef21..d0d994c4f311bfb979bcd0aeb27d9c12af6d7b86 100644 (file)
@@ -1716,6 +1716,7 @@ sub get_form
                 enabled => 1,
                  username => 1,
                  rolename => 1,
+                storage_cmd => 1,
                  );
     my %opt_p = (              # option with path
                 fileset=> 1,
@@ -1790,6 +1791,12 @@ sub get_form
        }
     }
 
+    if ($what{storage_cmd}) {
+       if (!grep {/^$ret{storage_cmd}$/} ('mount', 'umount', 'release','status')) {
+           delete $ret{storage_cmd};
+       }
+    }
+
     if ($what{slots}) {
        foreach my $s (CGI::param('slot')) {
            if ($s =~ /^(\d+)$/) {
@@ -4473,6 +4480,28 @@ sub get_bconsole
     return new Bconsole(pref => $self->{info});
 }
 
+sub cmd_storage
+{
+    my ($self) = @_;
+    $self->can_do('r_storage_mgnt');
+    my $arg = $self->get_form(qw/storage storage_cmd drive/);
+    my $b = $self->get_bconsole();
+
+    if ($arg->{storage} and $arg->{storage_cmd}) {
+       my $cmd = "$arg->{storage_cmd} storage=\"$arg->{storage}\" drive=$arg->{drive}";
+       my $ret = $b->send_cmd($cmd);
+
+       $self->display({
+           content => $ret,
+           title => "Storage ",
+           name => $cmd,
+       }, "command.tpl");              
+    } else {
+       my $storages= [ map { { name => $_ } } $b->list_storage()];
+       $self->display({ storage => $storages}, "cmd_storage.tpl");
+    }
+}
+
 sub run_job_select
 {
     my ($self) = @_;
index 82112c056a55c954adae278daaccbea1264a1fc3..54388c9a1d2418a13a430c5339b6185dc6607bf2 100644 (file)
@@ -1,3 +1,6 @@
+05Jan08
+ebl  Add basic Device managment (mount, umount, release, status)
+
 02Jan08
 ebl  Fix a couple of bug in btime module
 ebl  Keep level param between overview pages
index 41e8a4bcde21371f6984f65b3cdb40bc024e0662..c77237cb04509d84596eefa416c268bd6af4a249 100644 (file)
@@ -7,7 +7,7 @@
    Bweb - A Bacula web interface
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2000-2006 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2008 Free Software Foundation Europe e.V.
 
    The main author of Bweb is Eric Bollengier.
    The main author of Bacula is Kern Sibbald, with contributions from
index c094f917d27b84079b43b7da6f594e2dd19e31f6..4d20ecc1e69396b0688ac6628929cf4b3ffd86ce 100644 (file)
@@ -52,15 +52,14 @@ if ('__Main__' == ('_' + '_Main_' + '_')) {
      <li><a href="bweb.pl?action=intern_media">__Load Media__</a> </li>
   </ul>
  </li>
-<TMPL_IF achs>
- <li style="padding: 0.25em 2em;">__Autochanger__
+ <li style="padding: 0.25em 2em;">__Storages__
   <ul>
+   <li><a href="bweb.pl?action=cmd_storage">__Manage Device__</a><TMPL_IF achs><hr></TMPL_IF></li>
 <TMPL_LOOP achs>
    <li><a href="bweb.pl?action=ach_view;ach=<TMPL_VAR name>"><TMPL_VAR name></a></li>
 </TMPL_LOOP>
   </ul>
  </li>
-</TMPL_IF> 
  <li><a href="bweb.pl?action=graph"> __Statistics__ </a>
   <ul>
     <li><a href="bweb.pl?action=graph"> __Statistics__ </a>
diff --git a/gui/bweb/tpl/cmd_storage.tpl b/gui/bweb/tpl/cmd_storage.tpl
new file mode 100644 (file)
index 0000000..566f3ec
--- /dev/null
@@ -0,0 +1,36 @@
+
+<div class='titlediv'>
+  <h1 class='newstitle'> __Manage Storage device__</h1>
+</div>
+<div class='bodydiv'>
+   <form action="?" method='get'>
+   <input type='hidden' name='action' value='cmd_storage'>
+    <table>
+     <tr><td>__Storage device:__</td>
+         <td> 
+            <select name='storage' size='5' class='formulaire'>
+            <TMPL_LOOP storage>
+            <option><TMPL_VAR name></option>
+            </TMPL_LOOP>
+            </select>
+         </td>
+     </tr>
+     <tr><td>__Drive number (if any):__</td> 
+         <td><input size='3' type='text' name='drive' value='0' class='formulaire'></td>
+     </tr>
+     <tr><td>__Action:__</td> 
+         <td>
+<button type="submit" class="bp" name='storage_cmd' value='mount'
+ title='__mount drive__'> <img src='/bweb/load.png' alt=''>__Mount__</button>
+<button type="submit" class="bp" name='storage_cmd' value='umount'
+ title='__umount drive__'> <img src='/bweb/unload.png' alt=''>__Umount__</button>
+<button type="submit" class="bp" name='storage_cmd' value='release'
+ title='__release drive__'> <img src='/bweb/unload.png' alt=''>__Release__</button>
+<button type="submit" class="bp" name='storage_cmd' value='status'
+ title='__status drive__'> <img src='/bweb/zoom.png' alt=''>__Status__</button>
+         </td>
+     </tr>
+    </table>
+   </form>
+</div>
+