From: Marcin Haba Date: Mon, 8 Nov 2021 19:45:23 +0000 (+0100) Subject: baculum: Add option to enable/disable messages log window - idea proposed by Bill... X-Git-Tag: Release-11.0.6~42 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9ded664a90481e58d71bdf880d8b4825e80f7dce;p=thirdparty%2Fbacula.git baculum: Add option to enable/disable messages log window - idea proposed by Bill Arlofski --- diff --git a/gui/baculum/protected/Web/Class/WebConfig.php b/gui/baculum/protected/Web/Class/WebConfig.php index faaf5b547..8d9cd0557 100644 --- a/gui/baculum/protected/Web/Class/WebConfig.php +++ b/gui/baculum/protected/Web/Class/WebConfig.php @@ -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. diff --git a/gui/baculum/protected/Web/Lang/en/messages.mo b/gui/baculum/protected/Web/Lang/en/messages.mo index 4ea117565..48ac65606 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 f293d3ea6..9184c2e8e 100644 --- a/gui/baculum/protected/Web/Lang/en/messages.po +++ b/gui/baculum/protected/Web/Lang/en/messages.po @@ -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." diff --git a/gui/baculum/protected/Web/Lang/ja/messages.mo b/gui/baculum/protected/Web/Lang/ja/messages.mo index 6de456b0c..b8ef5cd3c 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 7ed22678e..c591bcf48 100644 --- a/gui/baculum/protected/Web/Lang/ja/messages.po +++ b/gui/baculum/protected/Web/Lang/ja/messages.po @@ -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." diff --git a/gui/baculum/protected/Web/Lang/pl/messages.mo b/gui/baculum/protected/Web/Lang/pl/messages.mo index 4cb83ff86..a81a1f97a 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 33167775c..fd4429486 100644 --- a/gui/baculum/protected/Web/Lang/pl/messages.po +++ b/gui/baculum/protected/Web/Lang/pl/messages.po @@ -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." diff --git a/gui/baculum/protected/Web/Lang/pt/messages.mo b/gui/baculum/protected/Web/Lang/pt/messages.mo index e17489201..3e6dc2610 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 92fc62190..f9f98bda9 100644 --- a/gui/baculum/protected/Web/Lang/pt/messages.po +++ b/gui/baculum/protected/Web/Lang/pt/messages.po @@ -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." diff --git a/gui/baculum/protected/Web/Lang/ru/messages.mo b/gui/baculum/protected/Web/Lang/ru/messages.mo index b7ce3261c..1eba14ae5 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 6987afdd6..4f68bea31 100644 --- a/gui/baculum/protected/Web/Lang/ru/messages.po +++ b/gui/baculum/protected/Web/Lang/ru/messages.po @@ -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." diff --git a/gui/baculum/protected/Web/Layouts/Main.tpl b/gui/baculum/protected/Web/Layouts/Main.tpl index 6efc661d5..11dc3d732 100644 --- a/gui/baculum/protected/Web/Layouts/Main.tpl +++ b/gui/baculum/protected/Web/Layouts/Main.tpl @@ -40,7 +40,7 @@ <%[ Running jobs: ]%> - + @@ -66,7 +66,7 @@
- + +
+
<%[ Enable Bacula messages log window: ]%>
+
+ + + +
+
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); } } diff --git a/gui/baculum/protected/Web/Pages/Monitor.php b/gui/baculum/protected/Web/Pages/Monitor.php index 35f060576..374ccec65 100644 --- a/gui/baculum/protected/Web/Pages/Monitor.php +++ b/gui/baculum/protected/Web/Pages/Monitor.php @@ -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 = []; diff --git a/gui/baculum/protected/Web/Pages/VolumeView.page b/gui/baculum/protected/Web/Pages/VolumeView.page index f4290f177..4cb2b6722 100644 --- a/gui/baculum/protected/Web/Pages/VolumeView.page +++ b/gui/baculum/protected/Web/Pages/VolumeView.page @@ -235,13 +235,13 @@ Display="Dynamic" HeaderText="<%[ There is not possible to run selected action because: ]%>" /> -
+
-
+
diff --git a/gui/baculum/protected/Web/Portlets/MsgEnvelope.php b/gui/baculum/protected/Web/Portlets/MsgEnvelope.php index eaf26bbc0..2537c9c1d 100644 --- a/gui/baculum/protected/Web/Portlets/MsgEnvelope.php +++ b/gui/baculum/protected/Web/Portlets/MsgEnvelope.php @@ -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();