From: Marcin Haba Date: Sun, 4 Jul 2021 19:50:25 +0000 (+0200) Subject: baculum: New director page with graphical/text status and with configure director... X-Git-Tag: Release-11.3.2~204 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0d7262d9176a5bf129026bc676aeb49bf0451940;p=thirdparty%2Fbacula.git baculum: New director page with graphical/text status and with configure director resources Changes: - new director page - add graphical and text director status - add to director page configure director resources - separate icons for running and created but not yet running jobs --- diff --git a/gui/baculum/protected/Web/JavaScript/misc.js b/gui/baculum/protected/Web/JavaScript/misc.js index 0984c22a3..d8d6c9e3c 100644 --- a/gui/baculum/protected/Web/JavaScript/misc.js +++ b/gui/baculum/protected/Web/JavaScript/misc.js @@ -401,7 +401,8 @@ var JobStatus = { warning: ['W'], error: ['E', 'e', 'f', 'I'], cancel: ['A'], - running: ['C', 'R'] + running: ['R'], + waiting: ['C'] }, is_ok: function(s) { @@ -419,14 +420,19 @@ var JobStatus = { is_running: function(s) { return (this.st.running.indexOf(s) !== -1); }, + is_waiting: function(s) { + return (this.st.waiting.indexOf(s) !== -1); + }, get_icon: function(s) { var css = 'fa '; if (this.is_ok(s)) { css += 'fa-check-square w3-text-green'; } else if (this.is_error(s)) { css += 'fa-exclamation-circle w3-text-red'; + } else if (this.is_waiting(s)) { + css += 'fa-hourglass-half w3-text-purple'; } else if (this.is_running(s)) { - css += 'fa-cogs w3-text-blue'; + css += 'fa-cog w3-text-blue w3-spin'; } else if (this.is_cancel(s)) { css += 'fa-minus-square w3-text-yellow'; } else if (this.is_warning(s)) { @@ -563,6 +569,29 @@ var JobType = { type = 'Unknown'; } return type; + }, + get_icon: function(t) { + var css = 'fas '; + if (t == 'B') { + css += 'fa-file-export'; + } else if (t == 'M' || t == 'g') { + css += 'fa-running'; + } else if (t == 'V') { + css += 'fa-tasks'; + } else if (t == 'R') { + css += 'fa-file-import'; + } else if (t == 'D') { + css += 'fa-tools'; + } else if (t == 'C' || t == 'c') { + css += 'fa-copy'; + } else { + css += 'fa-file'; + } + css += ' w3-large'; + var ret = document.createElement('I'); + ret.className = css; + ret.title = this.get_type(t); + return ret; } }; diff --git a/gui/baculum/protected/Web/Lang/en/messages.mo b/gui/baculum/protected/Web/Lang/en/messages.mo index 884b41259..9fcafd1a0 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 308c15b38..ccf56b638 100644 --- a/gui/baculum/protected/Web/Lang/en/messages.po +++ b/gui/baculum/protected/Web/Lang/en/messages.po @@ -3352,3 +3352,39 @@ msgstr "Job type" msgid "Restore time point" msgstr "Restore time point" + +msgid "Catalogs" +msgstr "Catalogs" + +msgid "Status director" +msgstr "Status director" + +msgid "Configure director" +msgstr "Configure director" + +msgid "Job" +msgstr "Job" + +msgid "Job status desc.:" +msgstr "Job status desc.:" + +msgid "Scheduled time:" +msgstr "Scheduled time:" + +msgid "Scheduled jobs" +msgstr "Scheduled jobs" + +msgid "No jobs scheduled" +msgstr "No jobs scheduled" + +msgid "No jobs terminated" +msgstr "No jobs terminated" + +msgid "Director details" +msgstr "Director details" + +msgid "Graphical director status is supported for Bacula directors version 9.0 and greater." +msgstr "Graphical director status is supported for Bacula directors version 9.0 and greater." + +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." diff --git a/gui/baculum/protected/Web/Lang/ja/messages.mo b/gui/baculum/protected/Web/Lang/ja/messages.mo index 19980bb27..2b9a12953 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 dfd6686ab..1ebb3f953 100644 --- a/gui/baculum/protected/Web/Lang/ja/messages.po +++ b/gui/baculum/protected/Web/Lang/ja/messages.po @@ -3438,3 +3438,39 @@ msgstr "Job type" msgid "Restore time point" msgstr "Restore time point" + +msgid "Catalogs" +msgstr "Catalogs" + +msgid "Status director" +msgstr "Status director" + +msgid "Configure director" +msgstr "Configure director" + +msgid "Job" +msgstr "Job" + +msgid "Job status desc.:" +msgstr "Job status desc.:" + +msgid "Scheduled time:" +msgstr "Scheduled time:" + +msgid "Scheduled jobs" +msgstr "Scheduled jobs" + +msgid "No jobs scheduled" +msgstr "No jobs scheduled" + +msgid "No jobs terminated" +msgstr "No jobs terminated" + +msgid "Director details" +msgstr "Director details" + +msgid "Graphical director status is supported for Bacula directors version 9.0 and greater." +msgstr "Graphical director status is supported for Bacula directors version 9.0 and greater." + +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." diff --git a/gui/baculum/protected/Web/Lang/pl/messages.mo b/gui/baculum/protected/Web/Lang/pl/messages.mo index f0351699c..ee25f0921 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 2b1802c1f..3d72a8a0f 100644 --- a/gui/baculum/protected/Web/Lang/pl/messages.po +++ b/gui/baculum/protected/Web/Lang/pl/messages.po @@ -3343,22 +3343,58 @@ msgid "Configure storage daemon" msgstr "Skonfiguruj storage daemon" msgid "# Directories:" -msgstr "# Directories:" +msgstr "# Katalogi:" msgid "# Files:" -msgstr "# Files:" +msgstr "# Pliki:" msgid "Search..." -msgstr "Search..." +msgstr "Szukaj..." msgid "case sensitive" -msgstr "case sensitive" +msgstr "rozróżniaj wielkość liter" msgid "Backup client" -msgstr "Backup client" +msgstr "Klient backupu" msgid "Job type" -msgstr "Job type" +msgstr "Typ zadania" msgid "Restore time point" -msgstr "Restore time point" +msgstr "Punkt przywracania" + +msgid "Catalogs" +msgstr "Katalogi" + +msgid "Status director" +msgstr "Status zarządcy" + +msgid "Configure director" +msgstr "Konfiguruj zarządcę" + +msgid "Job" +msgstr "Zadanie" + +msgid "Job status desc.:" +msgstr "Opis statusu zadania:" + +msgid "Scheduled time:" +msgstr "Zaplanowany czas uruchomienia:" + +msgid "Scheduled jobs" +msgstr "Zaplanowane zadania" + +msgid "No jobs scheduled" +msgstr "Brak zaplanowanych zadań" + +msgid "No jobs terminated" +msgstr "Brak zakończonych zadań" + +msgid "Director details" +msgstr "Szczegóły zarządcy" + +msgid "Graphical director status is supported for Bacula directors version 9.0 and greater." +msgstr "Graficzny status zarządcy jest wspierany od wersji zarządcy Bacula 9.0 i wyższych." + +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." diff --git a/gui/baculum/protected/Web/Lang/pt/messages.mo b/gui/baculum/protected/Web/Lang/pt/messages.mo index 137121083..0aa747f14 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 af889b101..59382ae33 100644 --- a/gui/baculum/protected/Web/Lang/pt/messages.po +++ b/gui/baculum/protected/Web/Lang/pt/messages.po @@ -3362,3 +3362,39 @@ msgstr "Job type" msgid "Restore time point" msgstr "Restore time point" + +msgid "Catalogs" +msgstr "Catalogs" + +msgid "Status director" +msgstr "Status director" + +msgid "Configure director" +msgstr "Configure director" + +msgid "Job" +msgstr "Job" + +msgid "Job status desc.:" +msgstr "Job status desc.:" + +msgid "Scheduled time:" +msgstr "Scheduled time:" + +msgid "Scheduled jobs" +msgstr "Scheduled jobs" + +msgid "No jobs scheduled" +msgstr "No jobs scheduled" + +msgid "No jobs terminated" +msgstr "No jobs terminated" + +msgid "Director details" +msgstr "Director details" + +msgid "Graphical director status is supported for Bacula directors version 9.0 and greater." +msgstr "Graphical director status is supported for Bacula directors version 9.0 and greater." + +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." diff --git a/gui/baculum/protected/Web/Lang/ru/messages.mo b/gui/baculum/protected/Web/Lang/ru/messages.mo index 08c4b15f3..7b534fa8c 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 4a0159148..b39d0db6c 100644 --- a/gui/baculum/protected/Web/Lang/ru/messages.po +++ b/gui/baculum/protected/Web/Lang/ru/messages.po @@ -3362,3 +3362,39 @@ msgstr "Job type" msgid "Restore time point" msgstr "Restore time point" + +msgid "Catalogs" +msgstr "Catalogs" + +msgid "Status director" +msgstr "Status director" + +msgid "Configure director" +msgstr "Configure director" + +msgid "Job" +msgstr "Job" + +msgid "Job status desc.:" +msgstr "Job status desc.:" + +msgid "Scheduled time:" +msgstr "Scheduled time:" + +msgid "Scheduled jobs" +msgstr "Scheduled jobs" + +msgid "No jobs scheduled" +msgstr "No jobs scheduled" + +msgid "No jobs terminated" +msgstr "No jobs terminated" + +msgid "Director details" +msgstr "Director details" + +msgid "Graphical director status is supported for Bacula directors version 9.0 and greater." +msgstr "Graphical director status is supported for Bacula directors version 9.0 and greater." + +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." diff --git a/gui/baculum/protected/Web/Pages/DirectorView.page b/gui/baculum/protected/Web/Pages/DirectorView.page new file mode 100644 index 000000000..00bfad746 --- /dev/null +++ b/gui/baculum/protected/Web/Pages/DirectorView.page @@ -0,0 +1,997 @@ +<%@ MasterClass="Application.Web.Layouts.Main" Theme="Baculum-v2"%> + + +
+
+ <%[ Director details ]%> +
+
+

<%[ Director: ]%> <%=$this->getDirectorName()%>

+
+ + +
+
+ + <%[ Status director ]%>   + + + + +
+ +
diff --git a/gui/baculum/protected/Web/Pages/DirectorView.php b/gui/baculum/protected/Web/Pages/DirectorView.php new file mode 100644 index 000000000..35c507cec --- /dev/null +++ b/gui/baculum/protected/Web/Pages/DirectorView.php @@ -0,0 +1,134 @@ + + * @category Page + * @package Baculum Web + */ +class DirectorView extends BaculumWebPage { + + const DIRECTOR_NAME = 'DirectorName'; + + public function onInit($param) { + parent::onInit($param); + if ($this->IsCallBack || $this->IsPostBack) { + return; + } + $director = $this->Request->contains('director') ? $this->Request['director'] : null; + $this->setDirectorName($director); + } + + public function loadDirectorConfig($sender, $param) { + $component_name = $this->getDirectorName(); + if (!is_null($component_name)) { + $this->DirDirectorConfig->setComponentName($component_name); + $this->DirDirectorConfig->setResourceName($component_name); + $this->DirDirectorConfig->setLoadValues(true); + $this->DirDirectorConfig->raiseEvent('OnDirectiveListLoad', $this, null); + } + } + + public function loadDirectorResourcesConfig($sender, $param) { + $resource_type = $param->getCallbackParameter(); + $this->DirDirectorConfig->unloadDirectives(); + $component_name = $this->getDirectorName(); + if (!is_null($component_name) && !empty($resource_type)) { + $this->DirectorResourcesConfig->setResourceType($resource_type); + $this->DirectorResourcesConfig->setComponentName($component_name); + $this->DirectorResourcesConfig->loadResourceListTable(); + } else { + $this->DirectorResourcesConfig->showError(true); + } + } + + /** + * Set director name. + * + * @return none; + */ + public function setDirectorName($client_name) { + $this->setViewState(self::DIRECTOR_NAME, $client_name); + } + + /** + * Get director name. + * + * @return string director name + */ + public function getDirectorName() { + return $this->getViewState(self::DIRECTOR_NAME); + } + + public function status($sender, $param) { + $raw_status = $this->getModule('api')->get( + [ + 'directors', + $this->getDirectorName(), + 'status' + ] + )->output; + $this->DirectorLog->Text = implode(PHP_EOL, $raw_status); + + $query_str = '?output=json'; + $graph_status = $this->getModule('api')->get( + [ + 'directors', + $this->getDirectorName(), + 'status', + $query_str + ] + ); + $client_status = [ + 'header' => [], + 'scheduled' => [], + 'running' => [], + 'terminated' => [], + 'version' => Params::getComponentVersion($raw_status) + ]; + if ($graph_status->error === 0) { + $client_status['header'] = count($graph_status->output->header) == 1 ? $graph_status->output->header[0] : []; + $client_status['scheduled'] = $graph_status->output->scheduled; + $client_status['running'] = $graph_status->output->running; + $client_status['terminated'] = $graph_status->output->terminated; + } + $show = $this->getModule('api')->get( + [ + 'directors', + $this->getDirectorName(), + 'show', + $query_str + ] + ); + if ($show->error === 0) { + $client_status['show'] = $show->output; + } + + $this->getCallbackClient()->callClientFunction('init_graphical_director_status', [$client_status]); + } +} +?> diff --git a/gui/baculum/protected/Web/Pages/JobHistoryList.page b/gui/baculum/protected/Web/Pages/JobHistoryList.page index 5e3d8cf3f..36110e23f 100644 --- a/gui/baculum/protected/Web/Pages/JobHistoryList.page +++ b/gui/baculum/protected/Web/Pages/JobHistoryList.page @@ -173,7 +173,7 @@ var oJobHistoryList = { validate: function(selected) { var running_jobs = []; selected.each(function(v, k) { - if (JobStatus.is_running(v.jobstatus)) { + if (JobStatus.is_running(v.jobstatus) || JobStatus.is_waiting(v.jobstatus)) { running_jobs.push(' - [' + v.jobid + '] ' + v.name); } }); diff --git a/gui/baculum/protected/Web/Portlets/MainSideBar.tpl b/gui/baculum/protected/Web/Portlets/MainSideBar.tpl index ecdc236bd..8da2bb4ed 100644 --- a/gui/baculum/protected/Web/Portlets/MainSideBar.tpl +++ b/gui/baculum/protected/Web/Portlets/MainSideBar.tpl @@ -47,6 +47,7 @@   <%[ Dashboard ]%>   <%[ Job history ]%>   <%[ Jobs ]%> +   <%[ Director ]%>   <%[ Clients ]%>   <%[ Storages ]%>   <%[ Pools ]%> diff --git a/gui/baculum/protected/Web/endpoints.xml b/gui/baculum/protected/Web/endpoints.xml index 4a43491be..395eeede6 100644 --- a/gui/baculum/protected/Web/endpoints.xml +++ b/gui/baculum/protected/Web/endpoints.xml @@ -7,6 +7,7 @@ + diff --git a/gui/baculum/themes/Baculum-v2/css/baculum.css b/gui/baculum/themes/Baculum-v2/css/baculum.css index 880f3a47e..4eb40e2d6 100644 --- a/gui/baculum/themes/Baculum-v2/css/baculum.css +++ b/gui/baculum/themes/Baculum-v2/css/baculum.css @@ -463,7 +463,7 @@ table.component td:nth-of-type(1) { left: 122px; } -.device_colinfo { +.device_colinfo, .job_colinfo { display: none; } @@ -516,7 +516,7 @@ table.component td:nth-of-type(1) { .device_columns { display: none; } - .device_colinfo { + .device_colinfo, .job_colinfo { display: inline; } } @@ -549,3 +549,14 @@ img.job_weather_icon { transform: translate(-50%, -50%); font-weight: bold; } + +/* STATUS type classes */ +.status_flex_row { + display: flex; + flex-flow: row wrap; +} + +.status_flex_row > div { + flex-basis: 140px; + height: 28px; +}