From 16ac263ec6e200dde99cf43f8fdceed8dc2df82a Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Sat, 5 Jan 2008 18:29:54 +0000 Subject: [PATCH] ebl Add bascic device managment git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@6237 91ce42f0-d328-0410-95d8-f526ca767f89 --- gui/bweb/cgi/bweb.pl | 3 +++ gui/bweb/lang/en/tpl/begin.tpl | 13 ++++++---- gui/bweb/lang/en/tpl/cmd_storage.tpl | 36 ++++++++++++++++++++++++++++ gui/bweb/lang/es/tpl/begin.tpl | 15 +++++++++--- gui/bweb/lang/es/tpl/cmd_storage.tpl | 36 ++++++++++++++++++++++++++++ gui/bweb/lang/fr/tpl/begin.tpl | 15 +++++++++--- gui/bweb/lang/fr/tpl/cmd_storage.tpl | 36 ++++++++++++++++++++++++++++ gui/bweb/lib/Bweb.pm | 29 ++++++++++++++++++++++ gui/bweb/technotes-2.3 | 3 +++ gui/bweb/tpl/about.tpl | 2 +- gui/bweb/tpl/begin.tpl | 5 ++-- gui/bweb/tpl/cmd_storage.tpl | 36 ++++++++++++++++++++++++++++ 12 files changed, 215 insertions(+), 14 deletions(-) create mode 100644 gui/bweb/lang/en/tpl/cmd_storage.tpl create mode 100644 gui/bweb/lang/es/tpl/cmd_storage.tpl create mode 100644 gui/bweb/lang/fr/tpl/cmd_storage.tpl create mode 100644 gui/bweb/tpl/cmd_storage.tpl diff --git a/gui/bweb/cgi/bweb.pl b/gui/bweb/cgi/bweb.pl index 54805a151a..e8e704e7ce 100755 --- a/gui/bweb/cgi/bweb.pl +++ b/gui/bweb/cgi/bweb.pl @@ -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'); diff --git a/gui/bweb/lang/en/tpl/begin.tpl b/gui/bweb/lang/en/tpl/begin.tpl index d8934435c0..50565b5ece 100644 --- a/gui/bweb/lang/en/tpl/begin.tpl +++ b/gui/bweb/lang/en/tpl/begin.tpl @@ -52,16 +52,21 @@ if ('Main' == ('_' + '_Main_' + '_')) {
  • Load Media
  • - -
  • Autochanger +
  • Storages
  • -
    -
  • Statistics
  • +
  • Statistics + +
  • Configuration
    • Configuration diff --git a/gui/bweb/lang/en/tpl/cmd_storage.tpl b/gui/bweb/lang/en/tpl/cmd_storage.tpl new file mode 100644 index 0000000000..227388a675 --- /dev/null +++ b/gui/bweb/lang/en/tpl/cmd_storage.tpl @@ -0,0 +1,36 @@ + +
      +

      Manage Storage device

      +
      +
      +
      + + + + + + + + + + + +
      Storage device: + +
      Drive number (if any):
      Action: + + + + +
      +
      +
      + diff --git a/gui/bweb/lang/es/tpl/begin.tpl b/gui/bweb/lang/es/tpl/begin.tpl index 4b8631e541..b5b3fd83d3 100644 --- a/gui/bweb/lang/es/tpl/begin.tpl +++ b/gui/bweb/lang/es/tpl/begin.tpl @@ -52,16 +52,25 @@ if ('Principal' == ('_' + '_Main_' + '_')) {
    • Cargar Medio
  • - -
  • Autochanger +
  • Storage
  • -
  • Estadísticas
  • +
  • Estadísticas + +
  • Configuración
    • Configuración diff --git a/gui/bweb/lang/es/tpl/cmd_storage.tpl b/gui/bweb/lang/es/tpl/cmd_storage.tpl new file mode 100644 index 0000000000..675733aed9 --- /dev/null +++ b/gui/bweb/lang/es/tpl/cmd_storage.tpl @@ -0,0 +1,36 @@ + +
      +

      Manage Storage device

      +
      +
      +
      + + + + + + + + + + + +
      Storage device: + +
      Drive number (if any):
      Action: + + + + +
      +
      +
      + diff --git a/gui/bweb/lang/fr/tpl/begin.tpl b/gui/bweb/lang/fr/tpl/begin.tpl index 5584043150..e64a3e880d 100644 --- a/gui/bweb/lang/fr/tpl/begin.tpl +++ b/gui/bweb/lang/fr/tpl/begin.tpl @@ -52,16 +52,25 @@ if ('Accueil' == ('_' + '_Main_' + '_')) {
    • Internaliser
  • - -
  • Autochanger +
  • Storage
  • -
  • Statistiques
  • +
  • Statistiques + +
  • Configuration
    • Configuration diff --git a/gui/bweb/lang/fr/tpl/cmd_storage.tpl b/gui/bweb/lang/fr/tpl/cmd_storage.tpl new file mode 100644 index 0000000000..bbea83d044 --- /dev/null +++ b/gui/bweb/lang/fr/tpl/cmd_storage.tpl @@ -0,0 +1,36 @@ + +
      +

      Manage Storage device

      +
      +
      +
      + + + + + + + + + + + +
      Storage device: + +
      Drive number (if any):
      Action: + + + + +
      +
      +
      + diff --git a/gui/bweb/lib/Bweb.pm b/gui/bweb/lib/Bweb.pm index 92520c0817..d0d994c4f3 100644 --- a/gui/bweb/lib/Bweb.pm +++ b/gui/bweb/lib/Bweb.pm @@ -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) = @_; diff --git a/gui/bweb/technotes-2.3 b/gui/bweb/technotes-2.3 index 82112c056a..54388c9a1d 100644 --- a/gui/bweb/technotes-2.3 +++ b/gui/bweb/technotes-2.3 @@ -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 diff --git a/gui/bweb/tpl/about.tpl b/gui/bweb/tpl/about.tpl index 41e8a4bcde..c77237cb04 100644 --- a/gui/bweb/tpl/about.tpl +++ b/gui/bweb/tpl/about.tpl @@ -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 diff --git a/gui/bweb/tpl/begin.tpl b/gui/bweb/tpl/begin.tpl index c094f917d2..4d20ecc1e6 100644 --- a/gui/bweb/tpl/begin.tpl +++ b/gui/bweb/tpl/begin.tpl @@ -52,15 +52,14 @@ if ('__Main__' == ('_' + '_Main_' + '_')) {
    • __Load Media__
  • - -
  • __Autochanger__ +
  • __Storages__
  • -
  • __Statistics__