From: Marcin Haba Date: Tue, 20 Apr 2021 04:52:00 +0000 (+0200) Subject: baculum: Add component action (start/stop/restart) buttons to client and storage... X-Git-Tag: Release-11.0.3~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fb1c89ada9156eb3c91996b926d3041a53d86b02;p=thirdparty%2Fbacula.git baculum: Add component action (start/stop/restart) buttons to client and storage pages --- diff --git a/gui/baculum/protected/Web/Pages/ClientView.page b/gui/baculum/protected/Web/Pages/ClientView.page index 4a1d24ea5..d6b79bf77 100644 --- a/gui/baculum/protected/Web/Pages/ClientView.page +++ b/gui/baculum/protected/Web/Pages/ClientView.page @@ -42,6 +42,10 @@ > <%=Prado::localize('Status client')%>   +
diff --git a/gui/baculum/protected/Web/Pages/ClientView.php b/gui/baculum/protected/Web/Pages/ClientView.php index bd627383e..087b8100e 100644 --- a/gui/baculum/protected/Web/Pages/ClientView.php +++ b/gui/baculum/protected/Web/Pages/ClientView.php @@ -103,6 +103,13 @@ class ClientView extends BaculumWebPage { } } $this->setAPIHosts(); + + // Set component actions + $fd_api_host = $this->getFDAPIHost(); + if ($fd_api_host) { + $this->CompActions->setHost($fd_api_host); + $this->CompActions->setComponentType('fd'); + } } public function setDIRClientConfig($sender, $param) { @@ -138,6 +145,15 @@ class ClientView extends BaculumWebPage { } } + private function getFDAPIHost() { + if (!$this->User->isUserAPIHost($this->UserAPIHosts->SelectedValue)) { + // Validation error. Somebody manually modified select values + return false; + } + return $this->UserAPIHosts->SelectedValue; + } + + private function getFDName() { $fdname = null; if (!$this->User->isUserAPIHost($this->UserAPIHosts->SelectedValue)) { diff --git a/gui/baculum/protected/Web/Pages/StorageView.page b/gui/baculum/protected/Web/Pages/StorageView.page index f37824910..7589d00c0 100644 --- a/gui/baculum/protected/Web/Pages/StorageView.page +++ b/gui/baculum/protected/Web/Pages/StorageView.page @@ -55,7 +55,7 @@ ClientSide.OnFailure="$('#status_storage_loading').hide();status_storage_show_error(parameter);" Attributes.onclick="hide_first_tab_containers(event);" > - <%=Prado::localize('Status storage')%>   +  <%=Prado::localize('Status storage')%> - <%=Prado::localize('Mount')%>   +  <%=Prado::localize('Mount')%> - <%=Prado::localize('Release')%>   +  <%=Prado::localize('Release')%> - <%=Prado::localize('Umount')%>   +  <%=Prado::localize('Umount')%> + diff --git a/gui/baculum/protected/Web/Pages/StorageView.php b/gui/baculum/protected/Web/Pages/StorageView.php index df39ab4d1..05eb71e74 100644 --- a/gui/baculum/protected/Web/Pages/StorageView.php +++ b/gui/baculum/protected/Web/Pages/StorageView.php @@ -99,6 +99,13 @@ class StorageView extends BaculumWebPage { } } $this->setAPIHosts(); + + // Set component actions + $sd_api_host = $this->getSDAPIHost(); + if ($sd_api_host) { + $this->CompActions->setHost($sd_api_host); + $this->CompActions->setComponentType('sd'); + } } private function setAPIHosts() { diff --git a/gui/baculum/protected/Web/Portlets/ComponentActionsMenu.php b/gui/baculum/protected/Web/Portlets/ComponentActionsMenu.php index 68baf413d..72b557d4d 100644 --- a/gui/baculum/protected/Web/Portlets/ComponentActionsMenu.php +++ b/gui/baculum/protected/Web/Portlets/ComponentActionsMenu.php @@ -3,7 +3,7 @@ * Bacula(R) - The Network Backup Solution * Baculum - Bacula web interface * - * Copyright (C) 2013-2019 Kern Sibbald + * Copyright (C) 2013-2021 Kern Sibbald * * The main author of Baculum is Marcin Haba. * The original author of Bacula is Kern Sibbald, with contributions @@ -33,6 +33,8 @@ Prado::using('Application.Web.Portlets.DirectiveListTemplate'); */ class ComponentActionsMenu extends DirectiveListTemplate { + const BIG_BUTTONS = 'BigButtons'; + /** * Allowed actions to do with components. */ @@ -61,4 +63,13 @@ class ComponentActionsMenu extends DirectiveListTemplate { ); } } + + public function setBigButtons($big_buttons) { + $big_buttons = TPropertyValue::ensureBoolean($big_buttons); + $this->setViewState(self::BIG_BUTTONS, $big_buttons); + } + + public function getBigButtons() { + return $this->getViewState(self::BIG_BUTTONS, false); + } } diff --git a/gui/baculum/protected/Web/Portlets/ComponentActionsMenu.tpl b/gui/baculum/protected/Web/Portlets/ComponentActionsMenu.tpl index e5d8c5f8a..de5d30255 100644 --- a/gui/baculum/protected/Web/Portlets/ComponentActionsMenu.tpl +++ b/gui/baculum/protected/Web/Portlets/ComponentActionsMenu.tpl @@ -1,4 +1,6 @@ - + + + + + +  <%[ Start ]%> + + +  <%[ Stop ]%> + + +  <%[ Restart ]%> + + +