]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
baculum: Add console page to configure consoles
authorMarcin Haba <marcin.haba@bacula.pl>
Mon, 5 Jul 2021 18:07:07 +0000 (20:07 +0200)
committerEric Bollengier <eric@baculasystems.com>
Thu, 24 Mar 2022 08:03:25 +0000 (09:03 +0100)
15 files changed:
gui/baculum/protected/Web/Data/data_desc.json
gui/baculum/protected/Web/Lang/en/messages.mo
gui/baculum/protected/Web/Lang/en/messages.po
gui/baculum/protected/Web/Lang/ja/messages.mo
gui/baculum/protected/Web/Lang/ja/messages.po
gui/baculum/protected/Web/Lang/pl/messages.mo
gui/baculum/protected/Web/Lang/pl/messages.po
gui/baculum/protected/Web/Lang/pt/messages.mo
gui/baculum/protected/Web/Lang/pt/messages.po
gui/baculum/protected/Web/Lang/ru/messages.mo
gui/baculum/protected/Web/Lang/ru/messages.po
gui/baculum/protected/Web/Pages/ConsoleView.page [new file with mode: 0644]
gui/baculum/protected/Web/Pages/ConsoleView.php [new file with mode: 0644]
gui/baculum/protected/Web/Portlets/MainSideBar.tpl
gui/baculum/protected/Web/endpoints.xml

index 25af95d416d36f59b9f4955721a344fc1eacbb5e..8700370f978c9936490c317a8f638d56ff514dc1 100644 (file)
                        },
                        "Director": {
                                "Required": false,
-                               "ValueType": "str",
+                               "ValueType": "res",
                                "DefaultValue": 0,
-                               "FieldType": "TextBox",
+                               "FieldType": "ComboBox",
+                               "Resource": "Director",
                                "Section": "General"
                        },
                        "CommCompression": {
index 9fcafd1a01698f3f06096f039694ccb7adbfb8f4..aedf50ac247098fc0ab4b84192f24238da51267a 100644 (file)
Binary files a/gui/baculum/protected/Web/Lang/en/messages.mo and b/gui/baculum/protected/Web/Lang/en/messages.mo differ
index ccf56b63843bab584e9882a19e9f59f3d92e6b91..0932befe9730a32a768b12cc53133421dac31bc0 100644 (file)
@@ -3388,3 +3388,12 @@ msgstr "Graphical director status is supported for Bacula directors version 9.0
 
 msgid "Status request timed out. The most probably the Bacula director is not available or it is not running."
 msgstr "Status request timed out. The most probably the Bacula director is not available or it is not running."
+
+msgid "To use the console page please configure bbconsjson binary file path on the API side."
+msgstr "To use the console page please configure bbconsjson binary file path on the API side."
+
+msgid "Console details"
+msgstr "Console details"
+
+msgid "Configure console"
+msgstr "Configure console"
index 2b9a1295371f1ba68e28de6a7b539dbff75df45d..e3c3064bc97c9331bee5fb2999e7ef701cfb4003 100644 (file)
Binary files a/gui/baculum/protected/Web/Lang/ja/messages.mo and b/gui/baculum/protected/Web/Lang/ja/messages.mo differ
index 1ebb3f953f5ac87c9c69312a9fe603b4db41c008..d639c1fa6df2de9bba40be5a53957ddb9cace3d7 100644 (file)
@@ -3474,3 +3474,12 @@ msgstr "Graphical director status is supported for Bacula directors version 9.0
 
 msgid "Status request timed out. The most probably the Bacula director is not available or it is not running."
 msgstr "Status request timed out. The most probably the Bacula director is not available or it is not running."
+
+msgid "To use the console page please configure bbconsjson binary file path on the API side."
+msgstr "To use the console page please configure bbconsjson binary file path on the API side."
+
+msgid "Console details"
+msgstr "Console details"
+
+msgid "Configure console"
+msgstr "Configure console"
index ee25f0921097ec23ad74fd6eaefbf07be36d0595..d236c6683624f836e4a40923739af9bcb3657df5 100644 (file)
Binary files a/gui/baculum/protected/Web/Lang/pl/messages.mo and b/gui/baculum/protected/Web/Lang/pl/messages.mo differ
index 3d72a8a0f8be968f6d5c9b6e553bc82109c8fc17..8ad4d3ca671f3b75250ef346d03b98af6cdd7395 100644 (file)
@@ -3398,3 +3398,12 @@ msgstr "Graficzny status zarządcy jest wspierany od wersji zarządcy Bacula 9.0
 
 msgid "Status request timed out. The most probably the Bacula director is not available or it is not running."
 msgstr "Upłynął limit czasu żądania statusu. Najprawdopodobniej zarządca Bacula nie jest dostępny lub nie jest uruchomiony."
+
+msgid "To use the console page please configure bbconsjson binary file path on the API side."
+msgstr "Aby używać tej strony konsoli, proszę skonfigurować po stronie API lokalizację pliku binarnego bbconsjson."
+
+msgid "Console details"
+msgstr "Szczegóły konsoli"
+
+msgid "Configure console"
+msgstr "Konfiguruj konsolę"
index 0aa747f144d60278898a5dbf511ec19377b6e30a..50cea213aeb6a0d2407ab9cf4743d2ceca2c2b86 100644 (file)
Binary files a/gui/baculum/protected/Web/Lang/pt/messages.mo and b/gui/baculum/protected/Web/Lang/pt/messages.mo differ
index 59382ae3315440b2564e30fb2e5a36e694764a78..2fb7b7ca65a37a2368468bc1953da723aa63d10a 100644 (file)
@@ -3398,3 +3398,12 @@ msgstr "Graphical director status is supported for Bacula directors version 9.0
 
 msgid "Status request timed out. The most probably the Bacula director is not available or it is not running."
 msgstr "Status request timed out. The most probably the Bacula director is not available or it is not running."
+
+msgid "To use the console page please configure bbconsjson binary file path on the API side."
+msgstr "To use the console page please configure bbconsjson binary file path on the API side."
+
+msgid "Console details"
+msgstr "Console details"
+
+msgid "Configure console"
+msgstr "Configure console"
index 410cbb1d5c12d6932c7423055b07fc3dcb8025ef..3067275e172c501aee31b5811e889546f4c6ac4e 100644 (file)
Binary files a/gui/baculum/protected/Web/Lang/ru/messages.mo and b/gui/baculum/protected/Web/Lang/ru/messages.mo differ
index 052587ccc227bfefe407f1fcac30e9086b733d53..a33cdada75a1390a98edde059912c945048af0ab 100644 (file)
@@ -3398,3 +3398,12 @@ msgstr "Graphical director status is supported for Bacula directors version 9.0
 
 msgid "Status request timed out. The most probably the Bacula director is not available or it is not running."
 msgstr "Status request timed out. The most probably the Bacula director is not available or it is not running."
+
+msgid "To use the console page please configure bbconsjson binary file path on the API side."
+msgstr "To use the console page please configure bbconsjson binary file path on the API side."
+
+msgid "Console details"
+msgstr "Console details"
+
+msgid "Configure console"
+msgstr "Configure console"
diff --git a/gui/baculum/protected/Web/Pages/ConsoleView.page b/gui/baculum/protected/Web/Pages/ConsoleView.page
new file mode 100644 (file)
index 0000000..5141717
--- /dev/null
@@ -0,0 +1,45 @@
+<%@ MasterClass="Application.Web.Layouts.Main" Theme="Baculum-v2"%>
+<com:TContent ID="Main">
+       <!-- Header -->
+       <header class="w3-container">
+               <h5>
+                       <b><i class="fa fa-laptop-code"></i> <%[ Console details ]%></b>
+               </h5>
+       </header>
+       <div class="w3-bar w3-green w3-margin-bottom">
+               <a id="btn_console_config" href="javascript:void(0)" class="w3-bar-item w3-button tab_btn w3-gray" onclick="load_cons_res_config('Director'); W3Tabs.open(this.id, 'console_config');"<%=empty($_SESSION['bcons']) ? ' style="display: none"': ''%>>
+                       <%[ Configure console ]%>
+               </a>
+       </div>
+       <p class="info"<%=!empty($_SESSION['bcons']) ? ' style="display: none"': ''%>><%[ To use the console page please configure bbconsjson binary file path on the API side. ]%></p>
+       <div class="w3-container tab_item" id="console_config"<%=empty($_SESSION['bcons']) ? ' style="display: none"': ''%>>
+               <com:TCallback ID="LoadConsoleResourcesConfig" OnCallback="loadConsoleResourcesConfig" />
+               <script>
+function load_cons_res_config(resource) {
+       var cb = <%=$this->LoadConsoleResourcesConfig->ActiveControl->Javascript%>;
+       cb.setCallbackParameter(resource);
+       cb.dispatch();
+}
+               </script>
+               <div class="w3-row w3-margin-bottom">
+                       <a href="javascript:void(0)" onclick="load_cons_res_config('Director'); W3SubTabs.open('console_director_config_btn', 'console_resources_config_form', 'console_config');">
+                               <div id="console_director_config_btn" class="subtab_btn w3-col m1 w3-bottombar w3-hover-light-grey w3-padding w3-border-red">Director</div>
+                       </a>
+                       <a href="javascript:void(0)" onclick="load_cons_res_config('Console'); W3SubTabs.open('console_console_config_btn', 'console_resources_config_form', 'console_config');">
+                               <div id="console_console_config_btn" class="subtab_btn w3-col m1 w3-bottombar w3-hover-light-grey w3-padding">Console</div>
+                       </a>
+               </div>
+               <div id="console_resources_config_form" class="subtab_item"<%=empty($_SESSION['bcons']) ? ' style="display: none"': ''%>>
+                       <com:Application.Web.Portlets.BaculaConfigResourceList
+                               ID="ConsoleResourcesConfig"
+                               ComponentType="bcons"
+                               ResourceList="<%=[[ 'name' => 'Name', 'label' => 'Name' ]]%>"
+                       />
+               </div>
+       </div>
+<script>
+$(function() {
+       <%=!empty($_SESSION['bcons']) ? 'load_cons_res_config("Director");': ''%>
+});
+</script>
+</com:TContent>
diff --git a/gui/baculum/protected/Web/Pages/ConsoleView.php b/gui/baculum/protected/Web/Pages/ConsoleView.php
new file mode 100644 (file)
index 0000000..dbb6676
--- /dev/null
@@ -0,0 +1,57 @@
+<?php
+/*
+ * Bacula(R) - The Network Backup Solution
+ * Baculum   - Bacula web interface
+ *
+ * Copyright (C) 2013-2021 Kern Sibbald
+ *
+ * The main author of Baculum is Marcin Haba.
+ * The original author of Bacula is Kern Sibbald, with contributions
+ * from many others, a complete list can be found in the file AUTHORS.
+ *
+ * You may use this file and others of this release according to the
+ * license defined in the LICENSE file, which includes the Affero General
+ * Public License, v3.0 ("AGPLv3") and some additional permissions and
+ * terms pursuant to its AGPLv3 Section 7.
+ *
+ * This notice must be preserved when any source code is
+ * conveyed and/or propagated.
+ *
+ * Bacula(R) is a registered trademark of Kern Sibbald.
+ */
+
+Prado::using('System.Web.UI.ActiveControls.TCallback');
+Prado::using('Application.Web.Class.BaculumWebPage');
+
+/**
+ * Console view page.
+ *
+ * @author Marcin Haba <marcin.haba@bacula.pl>
+ * @category Page
+ * @package Baculum Web
+ */
+class ConsoleView extends BaculumWebPage {
+
+       public function onInit($param) {
+               parent::onInit($param);
+               if ($this->IsCallBack || $this->IsPostBack) {
+                       return;
+               }
+               /**
+                * NOTE: component name is not used here, set only for compatibility
+                * with BaculaConfigDirectives.
+                */
+               $this->ConsoleResourcesConfig->setComponentName($_SESSION['director']);
+       }
+
+       public function loadConsoleResourcesConfig($sender, $param) {
+               $resource_type = $param->getCallbackParameter();
+               if (!empty($resource_type)) {
+                       $this->ConsoleResourcesConfig->setResourceType($resource_type);
+                       $this->ConsoleResourcesConfig->loadResourceListTable();
+               } else {
+                       $this->ConsoleResourcesConfig->showError(true);
+               }
+       }
+}
+?>
index 8da2bb4ed14fb61c0ac3f74fe225b8df864b6a89..12b17d802aca344b5420bcbd99428318ef97fadd 100644 (file)
@@ -54,7 +54,7 @@
                <a href="<%=$this->Service->constructUrl('VolumeList')%>" class="w3-bar-item w3-button w3-padding<%=in_array($this->Service->getRequestedPagePath(), array('VolumeList', 'VolumeView')) ? ' w3-blue': ''%><%=$this->getModule('users')->isPageAllowed($this->User, 'VolumeList') ? '' : ' hide'%>"><i class="fa fa-hdd fa-fw"></i>  <%[ Volumes ]%></a>
                <a href="<%=$this->Service->constructUrl('FileSetList')%>" class="w3-bar-item w3-button w3-padding<%=in_array($this->Service->getRequestedPagePath(), array('FileSetList', 'FileSetView')) ? ' w3-blue': ''%><%=$this->getModule('users')->isPageAllowed($this->User, 'FileSetList') ? '' : ' hide'%>"><i class="fa fa-copy fa-fw"></i>  <%[ FileSets ]%></a>
                <a href="<%=$this->Service->constructUrl('ScheduleList')%>" class="w3-bar-item w3-button w3-padding<%=in_array($this->Service->getRequestedPagePath(), array('ScheduleList', 'ScheduleView')) ? ' w3-blue': ''%><%=$this->getModule('users')->isPageAllowed($this->User, 'ScheduleList') ? '' : ' hide'%>"><i class="fa fa-clock fa-fw"></i>  <%[ Schedules ]%></a>
-               <a href="<%=$this->Service->constructUrl('ConfigureHosts')%>" class="w3-bar-item w3-button w3-padding<%=$this->Service->getRequestedPagePath() == 'ConfigureHosts' ? ' w3-blue': ''%><%=$this->getModule('users')->isPageAllowed($this->User, 'ConfigureHosts') ? '' : ' hide'%>"><i class="fa fa-cog fa-fw"></i>  <%[ Configure ]%></a>
+               <a href="<%=$this->Service->constructUrl('ConsoleView')%>" class="w3-bar-item w3-button w3-padding<%=$this->Service->getRequestedPagePath() == 'ConsoleView' ? ' w3-blue': ''%><%=$this->getModule('users')->isPageAllowed($this->User, 'ConsoleView') ? '' : ' hide'%>"><i class="fa fa-laptop-code fa-fw"></i>  <%[ Console ]%></a>
                <a href="<%=$this->Service->constructUrl('RestoreWizard')%>" class="w3-bar-item w3-button w3-padding<%=$this->Service->getRequestedPagePath() == 'RestoreWizard' ? ' w3-blue': ''%><%=$this->getModule('users')->isPageAllowed($this->User, 'RestoreWizard') ? '' : ' hide'%>"><i class="fa fa-reply fa-fw"></i>  <%[ Restore wizard ]%></a>
                <a href="<%=$this->Service->constructUrl('Graphs')%>" class="w3-bar-item w3-button w3-padding<%=$this->Service->getRequestedPagePath() == 'Graphs' ? ' w3-blue': ''%><%=$this->getModule('users')->isPageAllowed($this->User, 'Graphs') ? '' : ' hide'%>"><i class="fa fa-chart-pie fa-fw"></i>  <%[ Graphs ]%></a>
                <a href="<%=$this->Service->constructUrl('StatisticsList')%>" class="w3-bar-item w3-button w3-padding<%=in_array($this->Service->getRequestedPagePath(), array('StatisticsList', 'StatisticsView')) ? ' w3-blue': ''%><%=$this->getModule('users')->isPageAllowed($this->User, 'StatisticsList') ? '' : ' hide'%>"><i class="fas fa-chart-line fa-fw"></i>  <%[ Statistics ]%></a>
index 395eeede6883816ce2f059b0ea57076d78c3d03e..1e218c639f23d6b98510a3898be168d762ff926a 100644 (file)
        <url ServiceParameter="ScheduleStatusList" pattern="web/schedule/status/" />
        <url ServiceParameter="ScheduleView" pattern="web/schedule/{schedule}/" parameters.schedule="[a-zA-Z0-9:.\-_ ]+" />
        <url ServiceParameter="Graphs" pattern="web/graphs/" />
-       <url ServiceParameter="Console" pattern="web/console/" />
+       <url ServiceParameter="Console" pattern="web/webconsole/" />
        <url ServiceParameter="ApplicationSettings" pattern="web/settings/" />
        <url ServiceParameter="Security" pattern="web/security/" />
-       <url ServiceParameter="ConfigureHosts" pattern="web/configure/" />
+       <url ServiceParameter="ConsoleView" pattern="web/console/" />
        <url ServiceParameter="NewResource" pattern="web/new/{component_type}/{component_name}/{resource_type}/" parameters.component_type="\w+" parameters.component_name="[a-zA-Z0-9:.\-_ ]+" parameters.resource_type="\w+" />
        <url ServiceParameter="NewResource" pattern="web/new/{host}/{component_type}/{component_name}/{resource_type}/" parameters.host="[a-zA-Z0-9:.\-_ ]+" parameters.component_type="\w+" parameters.component_name="[a-zA-Z0-9:.\-_ ]+" parameters.resource_type="\w+" />
        <url ServiceParameter="WebConfigWizard" pattern="web/config/" />