From: Marcin Haba Date: Sun, 22 Nov 2020 08:10:47 +0000 (+0100) Subject: baculum: Implement graphical status storage X-Git-Tag: Release-11.3.2~1041 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2e4e8b0087bc6a18b27a4887f74eaaff4fdcccfc;p=thirdparty%2Fbacula.git baculum: Implement graphical status storage --- diff --git a/gui/baculum/protected/Common/Class/Params.php b/gui/baculum/protected/Common/Class/Params.php index 6f1758b860..831bca4720 100644 --- a/gui/baculum/protected/Common/Class/Params.php +++ b/gui/baculum/protected/Common/Class/Params.php @@ -3,7 +3,7 @@ * Bacula(R) - The Network Backup Solution * Baculum - Bacula web interface * - * Copyright (C) 2013-2019 Kern Sibbald + * Copyright (C) 2013-2020 Kern Sibbald * * The main author of Baculum is Marcin Haba. * The original author of Bacula is Kern Sibbald, with contributions @@ -148,5 +148,25 @@ class Params extends CommonModule { public static function getBoolValue($value) { return ($value ? 'yes' : 'no'); } + + /** + * Get component version basing on given output. + * The version string in output should be component status command compatible. + * + * @param array $output component status output + * @return array major, minor and release numbers. + */ + public static function getComponentVersion(array $output) { + $version = array('major' => 0, 'minor' => 0, 'release' => 0); + for ($i = 0; $i < count($output); $i++) { + if (preg_match('/^[\w\d\s:.\-]+Version:\s+(?P\d+)\.(?P\d+)\.(?P\d+)\s+\(/', $output[$i], $match) === 1) { + $version['major'] = intval($match['major']); + $version['minor'] = intval($match['minor']); + $version['release'] = intval($match['release']); + break; + } + } + return $version; + } } ?> diff --git a/gui/baculum/protected/Web/Lang/en/messages.mo b/gui/baculum/protected/Web/Lang/en/messages.mo index a833fb463e..ad8f9dd6da 100644 Binary files a/gui/baculum/protected/Web/Lang/en/messages.mo and b/gui/baculum/protected/Web/Lang/en/messages.mo differ diff --git a/gui/baculum/protected/Web/Lang/en/messages.po b/gui/baculum/protected/Web/Lang/en/messages.po index 3c74a4ae2d..fb6f0d2bc7 100644 --- a/gui/baculum/protected/Web/Lang/en/messages.po +++ b/gui/baculum/protected/Web/Lang/en/messages.po @@ -3080,3 +3080,120 @@ msgstr "Path (optional):" msgid "With the given path, the results narrow down to the files in the path only." msgstr "With the given path, the results narrow down to the files in the path only." +msgid "Storage Daemon:" +msgstr "Storage Daemon:" + +msgid "# Autochangers:" +msgstr "# Autochangers:" + +msgid "# Devices:" +msgstr "# Devices:" + +msgid "Devices" +msgstr "Devices" + +msgid "Archive device:" +msgstr "Archive device:" + +msgid "Device type:" +msgstr "Device type:" + +msgid "Media type:" +msgstr "Media type:" + +msgid "Device type" +msgstr "Device type" + +msgid "Media type" +msgstr "Media type" + +msgid "Maximum concurrent jobs:" +msgstr "Maximum concurrent jobs:" + +msgid "Maximum volume size:" +msgstr "Maximum volume size:" + +msgid "Mounted:" +msgstr "Mounted:" + +msgid "Opened:" +msgstr "Opened:" + +msgid "Waiting:" +msgstr "Waiting:" + +msgid "Blocked:" +msgstr "Blocked:" + +msgid "Blocked description:" +msgstr "Blocked description:" + +msgid "Read-only:" +msgstr "Read-only:" + +msgid "Last speed:" +msgstr "Last speed:" + +msgid "Write pool:" +msgstr "Write pool:" + +msgid "Write device:" +msgstr "Write device:" + +msgid "Write volume:" +msgstr "Write volume:" + +msgid "Read pool:" +msgstr "Read pool:" + +msgid "Read device:" +msgstr "Read device:" + +msgid "Read volume:" +msgstr "Read volume:" + +msgid "Used space:" +msgstr "Used space:" + +msgid "Status:" +msgstr "Status:" + +msgid "running" +msgstr "running" + +msgid "idle" +msgstr "idle" + +msgid "Autochanger:" +msgstr "Autochanger:" + +msgid "Single devices" +msgstr "Single devices" + +msgid "Start time:" +msgstr "Start time:" + +msgid "End time:" +msgstr "End time:" + +msgid "Terminated jobs" +msgstr "Terminated jobs" + +msgid "All devices" +msgstr "All devices" + +msgid "All device types" +msgstr "All device types" + +msgid "All media types" +msgstr "All media types" + +msgid "All statuses" +msgstr "All statuses" + +msgid "Graphical storage status is supported for Bacula storages version 9.0 and greater." +msgstr "Graphical storage status is supported for Bacula storages version 9.0 and greater." + +msgid "Status request timed out. The most probably the Bacula storage is not available or it is not running." +msgstr "Status request timed out. The most probably the Bacula storage is not available or it is not running." + diff --git a/gui/baculum/protected/Web/Lang/ja/messages.mo b/gui/baculum/protected/Web/Lang/ja/messages.mo index 3e765f7e89..0f09865cd0 100644 Binary files a/gui/baculum/protected/Web/Lang/ja/messages.mo and b/gui/baculum/protected/Web/Lang/ja/messages.mo differ diff --git a/gui/baculum/protected/Web/Lang/ja/messages.po b/gui/baculum/protected/Web/Lang/ja/messages.po index ced1b91a2c..b5b0730de5 100644 --- a/gui/baculum/protected/Web/Lang/ja/messages.po +++ b/gui/baculum/protected/Web/Lang/ja/messages.po @@ -3166,3 +3166,120 @@ msgstr "Path (optional):" msgid "With the given path, the results narrow down to the files in the path only." msgstr "With the given path, the results narrow down to the files in the path only." +msgid "Storage Daemon:" +msgstr "Storage Daemon:" + +msgid "# Autochangers:" +msgstr "# Autochangers:" + +msgid "# Devices:" +msgstr "# Devices:" + +msgid "Devices" +msgstr "Devices" + +msgid "Archive device:" +msgstr "Archive device:" + +msgid "Device type:" +msgstr "Device type:" + +msgid "Media type:" +msgstr "Media type:" + +msgid "Device type" +msgstr "Device type" + +msgid "Media type" +msgstr "Media type" + +msgid "Maximum concurrent jobs:" +msgstr "Maximum concurrent jobs:" + +msgid "Maximum volume size:" +msgstr "Maximum volume size:" + +msgid "Mounted:" +msgstr "Mounted:" + +msgid "Opened:" +msgstr "Opened:" + +msgid "Waiting:" +msgstr "Waiting:" + +msgid "Blocked:" +msgstr "Blocked:" + +msgid "Blocked description:" +msgstr "Blocked description:" + +msgid "Read-only:" +msgstr "Read-only:" + +msgid "Last speed:" +msgstr "Last speed:" + +msgid "Write pool:" +msgstr "Write pool:" + +msgid "Write device:" +msgstr "Write device:" + +msgid "Write volume:" +msgstr "Write volume:" + +msgid "Read pool:" +msgstr "Read pool:" + +msgid "Read device:" +msgstr "Read device:" + +msgid "Read volume:" +msgstr "Read volume:" + +msgid "Used space:" +msgstr "Used space:" + +msgid "Status:" +msgstr "Status:" + +msgid "running" +msgstr "running" + +msgid "idle" +msgstr "idle" + +msgid "Autochanger:" +msgstr "Autochanger:" + +msgid "Single devices" +msgstr "Single devices" + +msgid "Start time:" +msgstr "Start time:" + +msgid "End time:" +msgstr "End time:" + +msgid "Terminated jobs" +msgstr "Terminated jobs" + +msgid "All devices" +msgstr "All devices" + +msgid "All device types" +msgstr "All device types" + +msgid "All media types" +msgstr "All media types" + +msgid "All statuses" +msgstr "All statuses" + +msgid "Graphical storage status is supported for Bacula storages version 9.0 and greater." +msgstr "Graphical storage status is supported for Bacula storages version 9.0 and greater." + +msgid "Status request timed out. The most probably the Bacula storage is not available or it is not running." +msgstr "Status request timed out. The most probably the Bacula storage is not available or it is not running." + diff --git a/gui/baculum/protected/Web/Lang/pl/messages.mo b/gui/baculum/protected/Web/Lang/pl/messages.mo index 42cc53d09c..df7d08979c 100644 Binary files a/gui/baculum/protected/Web/Lang/pl/messages.mo and b/gui/baculum/protected/Web/Lang/pl/messages.mo differ diff --git a/gui/baculum/protected/Web/Lang/pl/messages.po b/gui/baculum/protected/Web/Lang/pl/messages.po index e2c8dd986a..aba90d09d1 100644 --- a/gui/baculum/protected/Web/Lang/pl/messages.po +++ b/gui/baculum/protected/Web/Lang/pl/messages.po @@ -3091,3 +3091,120 @@ msgstr "Ścieżka (opcjonalna):" msgid "With the given path, the results narrow down to the files in the path only." msgstr "Z podaną ścieżką wyniki zawężają się wyłącznie do plików w ścieżce." +msgid "Storage Daemon:" +msgstr "Magazyn danych:" + +msgid "# Autochangers:" +msgstr "# Urządzenia Autochanger:" + +msgid "# Devices:" +msgstr "# Urządzenia:" + +msgid "Devices" +msgstr "Urządzenia" + +msgid "Archive device:" +msgstr "Urządzenie archiwizujące:" + +msgid "Device type:" +msgstr "Typ urządzenia:" + +msgid "Media type:" +msgstr "Typ media:" + +msgid "Device type" +msgstr "Typ urządzenia" + +msgid "Media type" +msgstr "Typ media" + +msgid "Maximum concurrent jobs:" +msgstr "Maksymalna ilość jednoczesnych zadań:" + +msgid "Maximum volume size:" +msgstr "Maksymalny rozmiar wolumena:" + +msgid "Mounted:" +msgstr "Zamontowany:" + +msgid "Opened:" +msgstr "Otwarty:" + +msgid "Waiting:" +msgstr "Oczekujący:" + +msgid "Blocked:" +msgstr "Zablokowany:" + +msgid "Blocked description:" +msgstr "Opis zablokowania:" + +msgid "Read-only:" +msgstr "Tylko do odczytu:" + +msgid "Last speed:" +msgstr "Prędkość chwilowa:" + +msgid "Write pool:" +msgstr "Pula do zapisu:" + +msgid "Write device:" +msgstr "Urządzenie zapisujące:" + +msgid "Write volume:" +msgstr "Zapisywany wolumen:" + +msgid "Read pool:" +msgstr "Pula do odczytu:" + +msgid "Read device:" +msgstr "Urządzenie odczytujące:" + +msgid "Read volume:" +msgstr "Odczytywany wolumen:" + +msgid "Used space:" +msgstr "Użyte miejsce:" + +msgid "Status:" +msgstr "Status:" + +msgid "running" +msgstr "działający" + +msgid "idle" +msgstr "bezczynny" + +msgid "Autochanger:" +msgstr "Autochanger:" + +msgid "Single devices" +msgstr "Pojedyncze urządzenia" + +msgid "Start time:" +msgstr "Czas rozpoczęcia:" + +msgid "End time:" +msgstr "Czas zakończenia:" + +msgid "Terminated jobs" +msgstr "Zakończone zadania" + +msgid "All devices" +msgstr "Wszystkie urządzenia" + +msgid "All device types" +msgstr "Wszystkie typy urządzeń" + +msgid "All media types" +msgstr "Wszystkie typy media" + +msgid "All statuses" +msgstr "Wszystkie statusy" + +msgid "Graphical storage status is supported for Bacula storages version 9.0 and greater." +msgstr "Graficzny status magazynu jest wspierany dla magazynów Bacula w wersji 9.0 i większych." + +msgid "Status request timed out. The most probably the Bacula storage is not available or it is not running." +msgstr "Przekroczono limit czasu żądania statusu. Najprawdopodobniej magazyn Bacula jest niedostępny lub nie jest uruchomiony." + diff --git a/gui/baculum/protected/Web/Lang/pt/messages.mo b/gui/baculum/protected/Web/Lang/pt/messages.mo index 67c155c803..69d3a1ee29 100644 Binary files a/gui/baculum/protected/Web/Lang/pt/messages.mo and b/gui/baculum/protected/Web/Lang/pt/messages.mo differ diff --git a/gui/baculum/protected/Web/Lang/pt/messages.po b/gui/baculum/protected/Web/Lang/pt/messages.po index b93d08fe32..cc934fa429 100644 --- a/gui/baculum/protected/Web/Lang/pt/messages.po +++ b/gui/baculum/protected/Web/Lang/pt/messages.po @@ -3090,3 +3090,120 @@ msgstr "Path (optional):" msgid "With the given path, the results narrow down to the files in the path only." msgstr "With the given path, the results narrow down to the files in the path only." +msgid "Storage Daemon:" +msgstr "Storage Daemon:" + +msgid "# Autochangers:" +msgstr "# Autochangers:" + +msgid "# Devices:" +msgstr "# Devices:" + +msgid "Devices" +msgstr "Devices" + +msgid "Archive device:" +msgstr "Archive device:" + +msgid "Device type:" +msgstr "Device type:" + +msgid "Media type:" +msgstr "Media type:" + +msgid "Device type" +msgstr "Device type" + +msgid "Media type" +msgstr "Media type" + +msgid "Maximum concurrent jobs:" +msgstr "Maximum concurrent jobs:" + +msgid "Maximum volume size:" +msgstr "Maximum volume size:" + +msgid "Mounted:" +msgstr "Mounted:" + +msgid "Opened:" +msgstr "Opened:" + +msgid "Waiting:" +msgstr "Waiting:" + +msgid "Blocked:" +msgstr "Blocked:" + +msgid "Blocked description:" +msgstr "Blocked description:" + +msgid "Read-only:" +msgstr "Read-only:" + +msgid "Last speed:" +msgstr "Last speed:" + +msgid "Write pool:" +msgstr "Write pool:" + +msgid "Write device:" +msgstr "Write device:" + +msgid "Write volume:" +msgstr "Write volume:" + +msgid "Read pool:" +msgstr "Read pool:" + +msgid "Read device:" +msgstr "Read device:" + +msgid "Read volume:" +msgstr "Read volume:" + +msgid "Used space:" +msgstr "Used space:" + +msgid "Status:" +msgstr "Status:" + +msgid "running" +msgstr "running" + +msgid "idle" +msgstr "idle" + +msgid "Autochanger:" +msgstr "Autochanger:" + +msgid "Single devices" +msgstr "Single devices" + +msgid "Start time:" +msgstr "Start time:" + +msgid "End time:" +msgstr "End time:" + +msgid "Terminated jobs" +msgstr "Terminated jobs" + +msgid "All devices" +msgstr "All devices" + +msgid "All device types" +msgstr "All device types" + +msgid "All media types" +msgstr "All media types" + +msgid "All statuses" +msgstr "All statuses" + +msgid "Graphical storage status is supported for Bacula storages version 9.0 and greater." +msgstr "Graphical storage status is supported for Bacula storages version 9.0 and greater." + +msgid "Status request timed out. The most probably the Bacula storage is not available or it is not running." +msgstr "Status request timed out. The most probably the Bacula storage is not available or it is not running." + diff --git a/gui/baculum/protected/Web/Lang/ru/messages.mo b/gui/baculum/protected/Web/Lang/ru/messages.mo index 7ea98c190f..44dba88853 100644 Binary files a/gui/baculum/protected/Web/Lang/ru/messages.mo and b/gui/baculum/protected/Web/Lang/ru/messages.mo differ diff --git a/gui/baculum/protected/Web/Lang/ru/messages.po b/gui/baculum/protected/Web/Lang/ru/messages.po index 716ed5e19d..927e053fe1 100644 --- a/gui/baculum/protected/Web/Lang/ru/messages.po +++ b/gui/baculum/protected/Web/Lang/ru/messages.po @@ -3090,3 +3090,120 @@ msgstr "Path (optional):" msgid "With the given path, the results narrow down to the files in the path only." msgstr "With the given path, the results narrow down to the files in the path only." +msgid "Storage Daemon:" +msgstr "Storage Daemon:" + +msgid "# Autochangers:" +msgstr "# Autochangers:" + +msgid "# Devices:" +msgstr "# Devices:" + +msgid "Devices" +msgstr "Devices" + +msgid "Archive device:" +msgstr "Archive device:" + +msgid "Device type:" +msgstr "Device type:" + +msgid "Media type:" +msgstr "Media type:" + +msgid "Device type" +msgstr "Device type" + +msgid "Media type" +msgstr "Media type" + +msgid "Maximum concurrent jobs:" +msgstr "Maximum concurrent jobs:" + +msgid "Maximum volume size:" +msgstr "Maximum volume size:" + +msgid "Mounted:" +msgstr "Mounted:" + +msgid "Opened:" +msgstr "Opened:" + +msgid "Waiting:" +msgstr "Waiting:" + +msgid "Blocked:" +msgstr "Blocked:" + +msgid "Blocked description:" +msgstr "Blocked description:" + +msgid "Read-only:" +msgstr "Read-only:" + +msgid "Last speed:" +msgstr "Last speed:" + +msgid "Write pool:" +msgstr "Write pool:" + +msgid "Write device:" +msgstr "Write device:" + +msgid "Write volume:" +msgstr "Write volume:" + +msgid "Read pool:" +msgstr "Read pool:" + +msgid "Read device:" +msgstr "Read device:" + +msgid "Read volume:" +msgstr "Read volume:" + +msgid "Used space:" +msgstr "Used space:" + +msgid "Status:" +msgstr "Status:" + +msgid "running" +msgstr "running" + +msgid "idle" +msgstr "idle" + +msgid "Autochanger:" +msgstr "Autochanger:" + +msgid "Single devices" +msgstr "Single devices" + +msgid "Start time:" +msgstr "Start time:" + +msgid "End time:" +msgstr "End time:" + +msgid "Terminated jobs" +msgstr "Terminated jobs" + +msgid "All devices" +msgstr "All devices" + +msgid "All device types" +msgstr "All device types" + +msgid "All media types" +msgstr "All media types" + +msgid "All statuses" +msgstr "All statuses" + +msgid "Graphical storage status is supported for Bacula storages version 9.0 and greater." +msgstr "Graphical storage status is supported for Bacula storages version 9.0 and greater." + +msgid "Status request timed out. The most probably the Bacula storage is not available or it is not running." +msgstr "Status request timed out. The most probably the Bacula storage is not available or it is not running." + diff --git a/gui/baculum/protected/Web/Layouts/Main.tpl b/gui/baculum/protected/Web/Layouts/Main.tpl index 6a41a3e45d..7bf70b74e1 100644 --- a/gui/baculum/protected/Web/Layouts/Main.tpl +++ b/gui/baculum/protected/Web/Layouts/Main.tpl @@ -22,6 +22,7 @@ /> /> /> + />
diff --git a/gui/baculum/protected/Web/Pages/ClientView.page b/gui/baculum/protected/Web/Pages/ClientView.page index 79b28698cc..9ee14b6d9d 100644 --- a/gui/baculum/protected/Web/Pages/ClientView.page +++ b/gui/baculum/protected/Web/Pages/ClientView.page @@ -157,8 +157,7 @@ var oGraphicalClientStatus = { return el; }, started_epoch: function(value) { - var t = parseInt(value, 10) * 1000; - return (new Date(t)).toLocaleString(); + return Units.format_date(value); }, jobs_run: function(value) { return (this.data.hasOwnProperty('running') ? this.data.running.length : 0); diff --git a/gui/baculum/protected/Web/Pages/ClientView.php b/gui/baculum/protected/Web/Pages/ClientView.php index c1525596b0..bbd61990a8 100644 --- a/gui/baculum/protected/Web/Pages/ClientView.php +++ b/gui/baculum/protected/Web/Pages/ClientView.php @@ -3,7 +3,7 @@ * Bacula(R) - The Network Backup Solution * Baculum - Bacula web interface * - * Copyright (C) 2013-2019 Kern Sibbald + * Copyright (C) 2013-2020 Kern Sibbald * * The main author of Baculum is Marcin Haba. * The original author of Bacula is Kern Sibbald, with contributions @@ -24,6 +24,7 @@ Prado::using('System.Web.UI.ActiveControls.TActiveLabel'); Prado::using('System.Web.UI.ActiveControls.TActiveLinkButton'); Prado::using('System.Web.UI.ActiveControls.TCallback'); Prado::using('System.Web.UI.JuiControls.TJuiProgressbar'); +Prado::using('Application.Common.Class.Params'); Prado::using('Application.Web.Class.BaculumWebPage'); /** @@ -139,7 +140,7 @@ class ClientView extends BaculumWebPage { $client_status = array( 'header' => array(), 'running' => array(), - 'version' => $this->getClientVersion($raw_status) + 'version' => Params::getComponentVersion($raw_status) ); if ($graph_status->error === 0) { $client_status['header'] = $graph_status->output; @@ -178,18 +179,5 @@ class ClientView extends BaculumWebPage { $this->JobBandwidth->setJobUname($job_uname); } } - - private function getClientVersion($output) { - $version = array('major' => 0, 'minor' => 0, 'release' => 0); - for ($i = 0; $i < count($output); $i++) { - if (preg_match('/^[\w\d\s:.\-]+Version:\s+(?P\d+)\.(?P\d+)\.(?P\d+)\s+\(/', $output[$i], $match) === 1) { - $version['major'] = intval($match['major']); - $version['minor'] = intval($match['minor']); - $version['release'] = intval($match['release']); - break; - } - } - return $version; - } } ?> diff --git a/gui/baculum/protected/Web/Pages/StorageView.page b/gui/baculum/protected/Web/Pages/StorageView.page index 3c7d251b2d..ce24a2a4b9 100644 --- a/gui/baculum/protected/Web/Pages/StorageView.page +++ b/gui/baculum/protected/Web/Pages/StorageView.page @@ -46,8 +46,10 @@ OnClick="status" CssClass="w3-button w3-green w3-margin-bottom" CausesValidation="false" - ClientSide.OnLoading="$('#status_storage_loading').show();" - ClientSide.OnSuccess="$('#status_storage_loading').hide();" + ClientSide.OnLoading="$('#status_storage_loading').show();$('#status_storage_error').hide();" + ClientSide.OnSuccess="$('#status_storage_loading').hide(); $('#show_storage_container').hide();$('#status_storage_container').show();oGraphicalStorageStatus.set_refresh_timeout(document.getElementById('status_storage_refresh_interval').value);" + ClientSide.OnFailure="$('#status_storage_loading').hide();status_storage_show_error(parameter);" + Attributes.onclick="hide_action_text_output(event);" > <%=Prado::localize('Status storage')%>   @@ -58,7 +60,7 @@ ValidationGroup="AutoChangerGroup" CausesValidation="true" ClientSide.OnLoading="$('#status_storage_loading').show();" - ClientSide.OnSuccess="$('#status_storage_loading').hide();" + ClientSide.OnSuccess="$('#status_storage_loading').hide();$('#storage_action_text_output').slideDown();" > <%=Prado::localize('Mount')%>   @@ -69,7 +71,7 @@ ValidationGroup="AutoChangerGroup" CausesValidation="true" ClientSide.OnLoading="$('#status_storage_loading').show();" - ClientSide.OnSuccess="$('#status_storage_loading').hide();" + ClientSide.OnSuccess="$('#status_storage_loading').hide();$('#storage_action_text_output').slideDown();" > <%=Prado::localize('Release')%>   @@ -80,30 +82,1439 @@ ValidationGroup="AutoChangerGroup" CausesValidation="true" ClientSide.OnLoading="$('#status_storage_loading').show();" - ClientSide.OnSuccess="$('#status_storage_loading').hide();" + ClientSide.OnSuccess="$('#status_storage_loading').hide();$('#storage_action_text_output').slideDown();" > <%=Prado::localize('Umount')%>   - - -
-
+ + +
-
-
-
+
<%[ Slot number: ]%>
-
-
-
-
+ +
diff --git a/gui/baculum/protected/Web/Pages/StorageView.php b/gui/baculum/protected/Web/Pages/StorageView.php index 45bb7c71f6..e693b801a1 100644 --- a/gui/baculum/protected/Web/Pages/StorageView.php +++ b/gui/baculum/protected/Web/Pages/StorageView.php @@ -25,6 +25,7 @@ Prado::using('System.Web.UI.ActiveControls.TActivePanel'); Prado::using('System.Web.UI.ActiveControls.TActiveTextBox'); Prado::using('System.Web.UI.ActiveControls.TActiveRepeater'); Prado::using('System.Web.UI.ActiveControls.TActiveLinkButton'); +Prado::using('Application.Common.Class.Params'); Prado::using('Application.Web.Class.BaculumWebPage'); /** @@ -76,7 +77,7 @@ class StorageView extends BaculumWebPage { $storageshow = $this->Application->getModule('api')->get( array('storages', $storage->storageid, 'show') )->output; - $this->StorageLog->Text = implode(PHP_EOL, $storageshow); + $this->StorageActionLog->Text = implode(PHP_EOL, $storageshow); $this->setStorageDevice($storageshow); $this->setDevices(); } @@ -197,51 +198,113 @@ class StorageView extends BaculumWebPage { } public function status($sender, $param) { - $status = $this->getModule('api')->get( - array('storages', $this->getStorageId(), 'status') + $raw_status = $this->getModule('api')->get( + ['storages', $this->getStorageId(), 'status'] )->output; - $this->StorageLog->Text = implode(PHP_EOL, $status); + $this->StorageLog->Text = implode(PHP_EOL, $raw_status); + + $query_str = '?name=' . rawurlencode($this->getStorageName()) . '&type=header'; + $graph_status = $this->getModule('api')->get( + ['status', 'storage', $query_str] + ); + $storage_status = [ + 'header' => [], + 'devices' => [], + 'running' => [], + 'terminated' => [], + 'version' => Params::getComponentVersion($raw_status) + ]; + if ($graph_status->error === 0) { + $storage_status['header'] = $graph_status->output; + } + + // running + $query_str = '?name=' . rawurlencode($this->getStorageName()) . '&type=running'; + $graph_status = $this->getModule('api')->get( + array('status', 'storage', $query_str) + ); + if ($graph_status->error === 0) { + $storage_status['running'] = $graph_status->output; + } + + // terminated + $query_str = '?name=' . rawurlencode($this->getStorageName()) . '&type=terminated'; + $graph_status = $this->getModule('api')->get( + array('status', 'storage', $query_str) + ); + if ($graph_status->error === 0) { + $storage_status['terminated'] = $graph_status->output; + } + + // devices + $query_str = '?name=' . rawurlencode($this->getStorageName()) . '&type=devices'; + $graph_status = $this->getModule('api')->get( + array('status', 'storage', $query_str) + ); + if ($graph_status->error === 0) { + $storage_status['devices'] = $graph_status->output; + } + + // show + $query_str = '?output=json'; + $show = $this->getModule('api')->get( + array('storages', 'show', $query_str) + ); + if ($show->error === 0) { + $storage_status['show'] = $show->output; + } + + $this->getCallbackClient()->callClientFunction('init_graphical_storage_status', [$storage_status]); } public function mount($sender, $param) { $drive = $this->getIsAutochanger() ? intval($this->Drive->Text) : 0; $slot = $this->getIsAutochanger() ? intval($this->Slot->Text) : 0; - $query = '?drive=' . rawurlencode($drive); - $query .= 'slot=' . rawurlencode($slot); + $params = [ + 'drive' => $drive, + 'slot' => $slot + ]; + $query = '?' . http_build_query($params); $mount = $this->getModule('api')->get( array('storages', $this->getStorageId(), 'mount', $query) ); if ($mount->error === 0) { - $this->StorageLog->Text = implode(PHP_EOL, $mount->output); + $this->StorageActionLog->Text = implode(PHP_EOL, $mount->output); } else { - $this->StorageLog->Text = $mount->output; + $this->StorageActionLog->Text = $mount->output; } } public function umount($sender, $param) { $drive = $this->getIsAutochanger() ? intval($this->Drive->Text) : 0; - $query = '?drive=' . rawurlencode($drive); + $params = [ + 'drive' => $drive + ]; + $query = '?' . http_build_query($params); $umount = $this->getModule('api')->get( array('storages', $this->getStorageId(), 'umount', $query) ); if ($umount->error === 0) { - $this->StorageLog->Text = implode(PHP_EOL, $umount->output); + $this->StorageActionLog->Text = implode(PHP_EOL, $umount->output); } else { - $this->StorageLog->Text = $umount->output; + $this->StorageActionLog->Text = $umount->output; } } public function release($sender, $param) { $drive = $this->getIsAutochanger() ? intval($this->Drive->Text) : 0; - $query = '?drive=' . rawurlencode($drive); + $params = [ + 'drive' => $drive + ]; + $query = '?' . http_build_query($params); $release = $this->getModule('api')->get( array('storages', $this->getStorageId(), 'release', $query) ); if ($release->error === 0) { - $this->StorageLog->Text = implode(PHP_EOL, $release->output); + $this->StorageActionLog->Text = implode(PHP_EOL, $release->output); } else { - $this->StorageLog->Text = $release->output; + $this->StorageActionLog->Text = $release->output; } } diff --git a/gui/baculum/themes/Baculum-v2/css/baculum.css b/gui/baculum/themes/Baculum-v2/css/baculum.css index 74e617e4ca..14dd9635ee 100644 --- a/gui/baculum/themes/Baculum-v2/css/baculum.css +++ b/gui/baculum/themes/Baculum-v2/css/baculum.css @@ -446,3 +446,73 @@ table.component td:nth-of-type(1) { width: 420px; margin: 10px; } + +.gauge, .gauge_container { + width: 300px; + height: 150px; +} + +.gauge_label { + display: inline-block; + position: relative; + top: -44px; + left: 122px; +} + +.device_colinfo { + display: none; +} + +.status_header, .device_columns { + padding: 5px; + font-size: 17px; + margin: 3px 0; + display: flex; +} + +.device_columns > div { + text-align: center; + font-weight: bold; +} + + +.status_header { + cursor: pointer; + border: 1px solid #dddddd; +} + +.status_header:hover { + background-color: #e9e9e9; + border-radius: 3px; +} + +.status_header > div, .device_columns > div { + flex-basis: 385px; +} + +#status_storage_filters select { + width: 250px; + margin-left: 10px; + margin-top: 5px; +} + +@media only screen and (max-width: 670px) { + .gauge, .gauge_container { + width: 150px; + height: 75px; + } + + .gauge_label { + top: -19px; + left: 45px; + } + .status_header { + flex-wrap: wrap; + } + .device_columns { + display: none; + } + .device_colinfo { + display: inline; + } +}