]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
baculum: Add option to enable/disable messages log window - idea proposed by Bill...
authorMarcin Haba <marcin.haba@bacula.pl>
Mon, 8 Nov 2021 19:45:23 +0000 (20:45 +0100)
committerEric Bollengier <eric@baculasystems.com>
Thu, 24 Mar 2022 08:03:27 +0000 (09:03 +0100)
17 files changed:
gui/baculum/protected/Web/Class/WebConfig.php
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/Layouts/Main.tpl
gui/baculum/protected/Web/Pages/ApplicationSettings.page
gui/baculum/protected/Web/Pages/ApplicationSettings.php
gui/baculum/protected/Web/Pages/Monitor.php
gui/baculum/protected/Web/Pages/VolumeView.page
gui/baculum/protected/Web/Portlets/MsgEnvelope.php

index faaf5b547965c9022791e786b28954ef88d6465e..8d9cd0557688b65ce228e8f96cab451d321f9228 100644 (file)
@@ -63,6 +63,10 @@ class WebConfig extends ConfigFileModule {
         */
        const DEF_TIME_IN_JOB_LOG = 0;
 
+       /**
+        * Default value for enabling messages log.
+        */
+       const DEF_ENABLE_MESSAGES_LOG = 1;
 
        /**
         * Default date and time format.
@@ -179,7 +183,8 @@ class WebConfig extends ConfigFileModule {
                        'max_jobs' => self::DEF_MAX_JOBS,
                        'size_values_unit' => self::DEF_SIZE_VAL_UNIT,
                        'time_in_job_log' => self::DEF_TIME_IN_JOB_LOG,
-                       'date_time_format' => self::DEF_DATE_TIME_FORMAT
+                       'date_time_format' => self::DEF_DATE_TIME_FORMAT,
+                       'enable_messages_log' => self::DEF_ENABLE_MESSAGES_LOG
                ];
                if (key_exists('baculum', $config)) {
                        $config['baculum'] = array_merge($baculum, $config['baculum']);
@@ -296,6 +301,20 @@ class WebConfig extends ConfigFileModule {
                return (isset($config['security']['def_access']) && $config['security']['def_access'] === self::DEF_ACCESS_DEFAULT_SETTINGS);
        }
 
+       /**
+        * Check if messages log is enabled.
+        *
+        * @return boolean true if is messages log enabled, otherwise false
+        */
+       public function isMessagesLogEnabled() {
+               $enabled = self::DEF_ENABLE_MESSAGES_LOG;
+               $config = $this->getConfig();
+               if (isset($config['baculum']['enable_messages_log'])) {
+                       $enabled = $config['baculum']['enable_messages_log'];
+               }
+               return (intval($enabled) == 1);
+       }
+
        /**
         * Set culture for whole page.
         * Uses currently set language settings.
index 4ea1175659eb9a70ca1bf0507579d2dc71292367..48ac656068bfe673631db3c1c35379f1914abc53 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 f293d3ea648ec4af081c434bd27b55b6e1bddb61..9184c2e8e03580c68927e7ed8f8986ad6b7444b7 100644 (file)
@@ -3880,3 +3880,9 @@ msgstr "Add MailOnSuccess directive"
 
 msgid "Add Operator directive"
 msgstr "Add Operator directive"
+
+msgid "Enable Bacula messages log window:"
+msgstr "Enable Bacula messages log window:"
+
+msgid "The messages log window enables to review Bacula logs in one place available from almost every part on the interface. To collect logs is used the bconsole 'messages' command. The messages log window is displayed after clicking on the envelope icon at the top right side of the interface. This function is enabled by default. If enabled, it is available only for users with the Administrator role assigned."
+msgstr "The messages log window enables to review Bacula logs in one place available from almost every part on the interface. To collect logs is used the bconsole 'messages' command. The messages log window is displayed after clicking on the envelope icon at the top right side of the interface. This function is enabled by default. If enabled, it is available only for users with the Administrator role assigned."
index 6de456b0c05ec1bbee47ce0774218c03984b6eea..b8ef5cd3c320c634cbe920a2dd9f19cdee971710 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 7ed22678ecd514e05345b3aaebf48355363401ec..c591bcf4830f9b1d8425d030986b1e29e649c9ef 100644 (file)
@@ -3966,3 +3966,9 @@ msgstr "Add MailOnSuccess directive"
 
 msgid "Add Operator directive"
 msgstr "Add Operator directive"
+
+msgid "Enable Bacula messages log window:"
+msgstr "Enable Bacula messages log window:"
+
+msgid "The messages log window enables to review Bacula logs in one place available from almost every part on the interface. To collect logs is used the bconsole 'messages' command. The messages log window is displayed after clicking on the envelope icon at the top right side of the interface. This function is enabled by default. If enabled, it is available only for users with the Administrator role assigned."
+msgstr "The messages log window enables to review Bacula logs in one place available from almost every part on the interface. To collect logs is used the bconsole 'messages' command. The messages log window is displayed after clicking on the envelope icon at the top right side of the interface. This function is enabled by default. If enabled, it is available only for users with the Administrator role assigned."
index 4cb83ff863f68a1476a7e8e75ea37dc335574704..a81a1f97a32047a92a10b857a7caf5577d2d0fe0 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 33167775c952d75938d20caa8f594fa38508d627..fd4429486b2a97435c39ac324236e488a988f27b 100644 (file)
@@ -3890,3 +3890,9 @@ msgstr "Add MailOnSuccess directive"
 
 msgid "Add Operator directive"
 msgstr "Add Operator directive"
+
+msgid "Enable Bacula messages log window:"
+msgstr "Enable Bacula messages log window:"
+
+msgid "The messages log window enables to review Bacula logs in one place available from almost every part on the interface. To collect logs is used the bconsole 'messages' command. The messages log window is displayed after clicking on the envelope icon at the top right side of the interface. This function is enabled by default. If enabled, it is available only for users with the Administrator role assigned."
+msgstr "The messages log window enables to review Bacula logs in one place available from almost every part on the interface. To collect logs is used the bconsole 'messages' command. The messages log window is displayed after clicking on the envelope icon at the top right side of the interface. This function is enabled by default. If enabled, it is available only for users with the Administrator role assigned."
index e1748920125b751f03a69838356cc930994477e6..3e6dc26106991ddd54184009b9cf38daa07e085a 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 92fc62190a2c095b1709f9fbe6b0d0ce6bb3ebb6..f9f98bda9217eacc2e213aff436b2d6c135a0720 100644 (file)
@@ -3891,3 +3891,9 @@ msgstr "Add MailOnSuccess directive"
 
 msgid "Add Operator directive"
 msgstr "Add Operator directive"
+
+msgid "Enable Bacula messages log window:"
+msgstr "Enable Bacula messages log window:"
+
+msgid "The messages log window enables to review Bacula logs in one place available from almost every part on the interface. To collect logs is used the bconsole 'messages' command. The messages log window is displayed after clicking on the envelope icon at the top right side of the interface. This function is enabled by default. If enabled, it is available only for users with the Administrator role assigned."
+msgstr "The messages log window enables to review Bacula logs in one place available from almost every part on the interface. To collect logs is used the bconsole 'messages' command. The messages log window is displayed after clicking on the envelope icon at the top right side of the interface. This function is enabled by default. If enabled, it is available only for users with the Administrator role assigned."
index b7ce3261cc15c99951b5a09fc844d19933d3dcec..1eba14ae58f0e42698ff5ad249ddf970a039ab36 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 6987afdd689e7d4ab8bc5e51cbc322912cf00131..4f68bea31b34f335e0e1c77b7599d1b8f8461fa3 100644 (file)
@@ -3891,3 +3891,9 @@ msgstr "Add MailOnSuccess directive"
 
 msgid "Add Operator directive"
 msgstr "Add Operator directive"
+
+msgid "Enable Bacula messages log window:"
+msgstr "Enable Bacula messages log window:"
+
+msgid "The messages log window enables to review Bacula logs in one place available from almost every part on the interface. To collect logs is used the bconsole 'messages' command. The messages log window is displayed after clicking on the envelope icon at the top right side of the interface. This function is enabled by default. If enabled, it is available only for users with the Administrator role assigned."
+msgstr "The messages log window enables to review Bacula logs in one place available from almost every part on the interface. To collect logs is used the bconsole 'messages' command. The messages log window is displayed after clicking on the envelope icon at the top right side of the interface. This function is enabled by default. If enabled, it is available only for users with the Administrator role assigned."
index 6efc661d5185e3530b83d13437d98b4058521a7e..11dc3d732a90e521b9247e047f4c969894c3ea20 100644 (file)
@@ -40,7 +40,7 @@
                                <span class="w3-tag w3-large w3-purple w3-right w3-padding-small w3-margin-top w3-margin-right">
                                        <i class="fa fa-cogs w3-large"></i> <%[ Running jobs: ]%> <span id="running_jobs"></span>
                                </span>
-                               <span id="msg_envelope" class="w3-tag w3-large w3-green w3-text-white w3-right w3-padding-small w3-margin-top w3-margin-right" style="cursor: pointer;<%=$this->User->isInRole(WebUserRoles::ADMIN) === false ? 'display: none' : ''%>" title="<%[ Display messages log window ]%>">
+                               <span id="msg_envelope" class="w3-tag w3-large w3-green w3-text-white w3-right w3-padding-small w3-margin-top w3-margin-right" style="cursor: pointer;<%=((!$this->Application->getModule('web_config')->isMessagesLogEnabled() || !$this->User->isInRole(WebUserRoles::ADMIN)) ? 'display: none' : '')%>" title="<%[ Display messages log window ]%>">
                                        <i class="fas fa-envelope w3-large"></i>
                                </span>
                                <com:TLabel ID="UserAPIHostsContainter"CssClass="w3-right w3-margin-top w3-margin-right">
@@ -66,7 +66,7 @@
                <div id="small" class="w3-hide-large"></div>
 <com:Application.Web.Portlets.ErrorMessageBox />
 <com:Application.Web.Portlets.ResourceMonitor />
-<com:Application.Web.Portlets.MsgEnvelope Visible="<%=$this->User->isInRole(WebUserRoles::ADMIN)%>" />
+<com:Application.Web.Portlets.MsgEnvelope Visible="<%=($this->Application->getModule('web_config')->isMessagesLogEnabled() && $this->User->isInRole(WebUserRoles::ADMIN))%>" />
 <script>
 var is_small = $('#small').is(':visible');
 $(function() {
index 28dc69414a75efff4bebf9d3d5de7750c5ae0da7..8f195b4dbe95b8bd822090bcc6b1d10abfc56bb1 100644 (file)
                        });
                </script>
        </div>
+       <div class="w3-container w3-row w3-padding">
+               <div class="w3-third w3-col"><%[ Enable Bacula messages log window: ]%></div>
+               <div class="w3-third w3-col">
+                       <com:TCheckBox
+                               ID="EnableMessagesLog"
+                               CssClass="w3-check"
+                       />
+                       <i class="fas fa-info-circle help_icon w3-text-green" onclick="$(this).next().slideToggle('fast');"></i>
+                       <div class="directive_help" style="display: none">
+                               <dd><%[ The messages log window enables to review Bacula logs in one place available from almost every part on the interface. To collect logs is used the bconsole 'messages' command. The messages log window is displayed after clicking on the envelope icon at the top right side of the interface. This function is enabled by default. If enabled, it is available only for users with the Administrator role assigned. ]%></dd>
+                       </div>
+               </div>
+       </div>
        <div class="w3-center">
                <com:TActiveLinkButton
                        CssClass="w3-button w3-green"
index 87a82cab5e9ddf69003459c0019fc53736db9b8d..76fbc34cc7107c736ea6bf8f2690a75f9aa03756 100644 (file)
@@ -51,6 +51,7 @@ class ApplicationSettings extends BaculumWebPage {
                        } else {
                                $this->DateTimeFormat->Text = WebConfig::DEF_DATE_TIME_FORMAT;
                        }
+                       $this->EnableMessagesLog->Checked = $this->getModule('web_config')->isMessagesLogEnabled();
                }
        }
 
@@ -63,6 +64,7 @@ class ApplicationSettings extends BaculumWebPage {
                        $this->web_config['baculum']['size_values_unit'] = $this->BinaryBytes->Checked ? 'binary' : 'decimal';
                        $this->web_config['baculum']['time_in_job_log'] = ($this->TimeInJobLog->Checked === true) ? 1 : 0;
                        $this->web_config['baculum']['date_time_format'] = $this->DateTimeFormat->Text;
+                       $this->web_config['baculum']['enable_messages_log'] = ($this->EnableMessagesLog->Checked === true) ? 1 : 0;
                        $this->getModule('web_config')->setConfig($this->web_config);
                }
        }
index 35f0605763b4b82aa8d0662dd3902b9a3aaafb44..374ccec656c7bcb663c020ddcccda1a8cc681f6e 100644 (file)
@@ -128,7 +128,7 @@ class Monitor extends BaculumPage {
                                $error = $result;
                        }
                }
-               if (!$error && $this->User->isInRole(WebUserRoles::ADMIN)) {
+               if (!$error && $this->getModule('web_config')->isMessagesLogEnabled() && $this->User->isInRole(WebUserRoles::ADMIN)) {
                        $result = $this->getModule('api')->get(['joblog', 'messages']);
                        if ($result->error === 0) {
                                $ml = [];
index f4290f17734b51b2bbdc828359cb957d4b3edde3..4cb2b67222ee7b4073e17ef526acc24543d20939 100644 (file)
                        Display="Dynamic"
                        HeaderText="<%[ There is not possible to run selected action because: ]%>"
                />
-               <div class="w3-row w3-section">
+               <div class="w3-row w3-section directive_field">
                        <div class="w3-col w3-quarter"><com:TLabel ForControl="VolumeStatus" Text="<%[ Volume status: ]%>" /></div>
                        <div class="w3-half">
                                <com:TActiveDropDownList ID="VolumeStatus" AutoPostBack="false" CssClass="w3-select w3-border" />
                        </div>
                </div>
-               <div class="w3-row w3-section">
+               <div class="w3-row w3-section directive_field">
                        <div class="w3-col w3-quarter"><com:TLabel ForControl="Pool" Text="<%[ Pool: ]%>" /></div>
                        <div class="w3-half">
                                <com:TActiveDropDownList ID="Pool" AutoPostBack="false" CssClass="w3-select w3-border" />
index eaf26bbc0a257de3a5d86cbd22fc28ce31b3fca5..2537c9c1ddaf941f581e107dd48274c716b96fe4 100644 (file)
@@ -35,7 +35,7 @@ Prado::using('Application.Web.Portlets.Portlets');
 class MsgEnvelope extends Portlets {
 
        public function truncate() {
-               if (!$this->User->isInRole(WebUserRoles::ADMIN)) {
+               if (!$this->getModule('web_config')->isMessagesLogEnabled() || !$this->User->isInRole(WebUserRoles::ADMIN)) {
                        return;
                }
                $this->getModule('messages_log')->truncate();