diff --git a/Web/JavaScript/misc.js b/Web/JavaScript/misc.js index da49a00..4156118 100644 --- a/Web/JavaScript/misc.js +++ b/Web/JavaScript/misc.js @@ -1188,6 +1188,25 @@ var Weather = { ], get_weather_icon(idx) { return this.icons[idx]; + }, + get_job_weather: function(jobs, last_jobs) { + const job_weather = {}; + const jobs_len = jobs.length; + for (let i = 0; i < jobs_len; i++) { + if (!job_weather.hasOwnProperty(jobs[i].name)) { + job_weather[jobs[i].name] = {count: 0, cancel: 0, error: 0}; + } + if (typeof(last_jobs) == 'number' && job_weather[jobs[i].name].count >= last_jobs) { + continue; + } + job_weather[jobs[i].name].count++; + if (JobStatus.is_error(jobs[i].jobstatus)) { + job_weather[jobs[i].name].error++; + } else if (JobStatus.is_cancel(jobs[i].jobstatus)) { + job_weather[jobs[i].name].cancel++; + } + } + return job_weather; } }; diff --git a/Web/Lang/en/messages.mo b/Web/Lang/en/messages.mo index 4805bd5..2db5437 100644 Binary files a/Web/Lang/en/messages.mo and b/Web/Lang/en/messages.mo differ diff --git a/Web/Lang/en/messages.po b/Web/Lang/en/messages.po index 5d5b345..53134db 100644 --- a/Web/Lang/en/messages.po +++ b/Web/Lang/en/messages.po @@ -4112,3 +4112,50 @@ msgstr "Set age for jobs to display the job summary pie graph on the dashboard p msgid "last %time %unit" msgstr "last %time %unit" +msgid "Job %jobname details" +msgstr "Job %jobname details" + +msgid "Reports" +msgstr "Reports" + +msgid "Job history report" +msgstr "Job history report" + +msgid "Date:" +msgstr "Date:" + +msgid "All jobs" +msgstr "All jobs" + +msgid "All issues" +msgstr "All issues" + +msgid "Only errors" +msgstr "Only errors" + +msgid "%count job(s) finished successfully." +msgstr "%count job(s) finished successfully." + +msgid "Job report with errors and warnings" +msgstr "Job report with errors and warnings" + +msgid "Job report with errors but not warnings" +msgstr "Job report with errors but not warnings" + +msgid "all X jobs finished successfully (no X means one job)" +msgstr "all X jobs finished successfully (no X means one job)" + +msgid "X jobs with at least one job finished successfully" +msgstr "X jobs with at least one job finished successfully" + +msgid "all X jobs finished with error or cancelled" +msgstr "all X jobs finished with error or cancelled" + +msgid "All %count jobs finished with error or cancelled." +msgstr "All %count jobs finished with error or cancelled." + +msgid "%errors/%count jobs finished with error or cancelled." +msgstr "%errors/%count jobs finished with error or cancelled." + +msgid "No job" +msgstr "No job" diff --git a/Web/Lang/ja/messages.mo b/Web/Lang/ja/messages.mo index b7db941..02b224b 100644 Binary files a/Web/Lang/ja/messages.mo and b/Web/Lang/ja/messages.mo differ diff --git a/Web/Lang/ja/messages.po b/Web/Lang/ja/messages.po index 70d801b..8883e44 100644 --- a/Web/Lang/ja/messages.po +++ b/Web/Lang/ja/messages.po @@ -4198,3 +4198,50 @@ msgstr "Set age for jobs to display the job summary pie graph on the dashboard p msgid "last %time %unit" msgstr "last %time %unit" +msgid "Job %jobname details" +msgstr "Job %jobname details" + +msgid "Reports" +msgstr "Reports" + +msgid "Job history report" +msgstr "Job history report" + +msgid "Date:" +msgstr "Date:" + +msgid "All jobs" +msgstr "All jobs" + +msgid "All issues" +msgstr "All issues" + +msgid "Only errors" +msgstr "Only errors" + +msgid "%count job(s) finished successfully." +msgstr "%count job(s) finished successfully." + +msgid "Job report with errors and warnings" +msgstr "Job report with errors and warnings" + +msgid "Job report with errors but not warnings" +msgstr "Job report with errors but not warnings" + +msgid "all X jobs finished successfully (no X means one job)" +msgstr "all X jobs finished successfully (no X means one job)" + +msgid "X jobs with at least one job finished successfully" +msgstr "X jobs with at least one job finished successfully" + +msgid "all X jobs finished with error or cancelled" +msgstr "all X jobs finished with error or cancelled" + +msgid "All %count jobs finished with error or cancelled." +msgstr "All %count jobs finished with error or cancelled." + +msgid "%errors/%count jobs finished with error or cancelled." +msgstr "%errors/%count jobs finished with error or cancelled." + +msgid "No job" +msgstr "No job" diff --git a/Web/Lang/pl/messages.mo b/Web/Lang/pl/messages.mo index dc59721..c8f416b 100644 Binary files a/Web/Lang/pl/messages.mo and b/Web/Lang/pl/messages.mo differ diff --git a/Web/Lang/pl/messages.po b/Web/Lang/pl/messages.po index 089d53e..bae5b27 100644 --- a/Web/Lang/pl/messages.po +++ b/Web/Lang/pl/messages.po @@ -4122,3 +4122,50 @@ msgstr "Ustaw maksymalny wiek dla zadań do wyświetlenia na wykresie statusu za msgid "last %time %unit" msgstr "ostatni %time %unit" +msgid "Job %jobname details" +msgstr "Job %jobname details" + +msgid "Reports" +msgstr "Reports" + +msgid "Job history report" +msgstr "Job history report" + +msgid "Date:" +msgstr "Date:" + +msgid "All jobs" +msgstr "All jobs" + +msgid "All issues" +msgstr "All issues" + +msgid "Only errors" +msgstr "Only errors" + +msgid "%count job(s) finished successfully." +msgstr "%count job(s) finished successfully." + +msgid "Job report with errors and warnings" +msgstr "Job report with errors and warnings" + +msgid "Job report with errors but not warnings" +msgstr "Job report with errors but not warnings" + +msgid "all X jobs finished successfully (no X means one job)" +msgstr "all X jobs finished successfully (no X means one job)" + +msgid "X jobs with at least one job finished successfully" +msgstr "X jobs with at least one job finished successfully" + +msgid "all X jobs finished with error or cancelled" +msgstr "all X jobs finished with error or cancelled" + +msgid "All %count jobs finished with error or cancelled." +msgstr "All %count jobs finished with error or cancelled." + +msgid "%errors/%count jobs finished with error or cancelled." +msgstr "%errors/%count jobs finished with error or cancelled." + +msgid "No job" +msgstr "No job" diff --git a/Web/Lang/pt/messages.mo b/Web/Lang/pt/messages.mo index efd71bd..bc982cd 100644 Binary files a/Web/Lang/pt/messages.mo and b/Web/Lang/pt/messages.mo differ diff --git a/Web/Lang/pt/messages.po b/Web/Lang/pt/messages.po index 64db0f5..61219e1 100644 --- a/Web/Lang/pt/messages.po +++ b/Web/Lang/pt/messages.po @@ -4123,3 +4123,50 @@ msgstr "Set age for jobs to display the job summary pie graph on the dashboard p msgid "last %time %unit" msgstr "last %time %unit" +msgid "Job %jobname details" +msgstr "Job %jobname details" + +msgid "Reports" +msgstr "Reports" + +msgid "Job history report" +msgstr "Job history report" + +msgid "Date:" +msgstr "Date:" + +msgid "All jobs" +msgstr "All jobs" + +msgid "All issues" +msgstr "All issues" + +msgid "Only errors" +msgstr "Only errors" + +msgid "%count job(s) finished successfully." +msgstr "%count job(s) finished successfully." + +msgid "Job report with errors and warnings" +msgstr "Job report with errors and warnings" + +msgid "Job report with errors but not warnings" +msgstr "Job report with errors but not warnings" + +msgid "all X jobs finished successfully (no X means one job)" +msgstr "all X jobs finished successfully (no X means one job)" + +msgid "X jobs with at least one job finished successfully" +msgstr "X jobs with at least one job finished successfully" + +msgid "all X jobs finished with error or cancelled" +msgstr "all X jobs finished with error or cancelled" + +msgid "All %count jobs finished with error or cancelled." +msgstr "All %count jobs finished with error or cancelled." + +msgid "%errors/%count jobs finished with error or cancelled." +msgstr "%errors/%count jobs finished with error or cancelled." + +msgid "No job" +msgstr "No job" diff --git a/Web/Lang/ru/messages.mo b/Web/Lang/ru/messages.mo index 1355fa0..11634b2 100644 Binary files a/Web/Lang/ru/messages.mo and b/Web/Lang/ru/messages.mo differ diff --git a/Web/Lang/ru/messages.po b/Web/Lang/ru/messages.po index 3267b5e..9e18793 100644 --- a/Web/Lang/ru/messages.po +++ b/Web/Lang/ru/messages.po @@ -4122,3 +4122,50 @@ msgstr "Set age for jobs to display the job summary pie graph on the dashboard p msgid "last %time %unit" msgstr "last %time %unit" +msgid "Job %jobname details" +msgstr "Job %jobname details" + +msgid "Reports" +msgstr "Reports" + +msgid "Job history report" +msgstr "Job history report" + +msgid "Date:" +msgstr "Date:" + +msgid "All jobs" +msgstr "All jobs" + +msgid "All issues" +msgstr "All issues" + +msgid "Only errors" +msgstr "Only errors" + +msgid "%count job(s) finished successfully." +msgstr "%count job(s) finished successfully." + +msgid "Job report with errors and warnings" +msgstr "Job report with errors and warnings" + +msgid "Job report with errors but not warnings" +msgstr "Job report with errors but not warnings" + +msgid "all X jobs finished successfully (no X means one job)" +msgstr "all X jobs finished successfully (no X means one job)" + +msgid "X jobs with at least one job finished successfully" +msgstr "X jobs with at least one job finished successfully" + +msgid "all X jobs finished with error or cancelled" +msgstr "all X jobs finished with error or cancelled" + +msgid "All %count jobs finished with error or cancelled." +msgstr "All %count jobs finished with error or cancelled." + +msgid "%errors/%count jobs finished with error or cancelled." +msgstr "%errors/%count jobs finished with error or cancelled." + +msgid "No job" +msgstr "No job" diff --git a/Web/Pages/JobList.page b/Web/Pages/JobList.page index 43eb9c1..1d35538 100644 --- a/Web/Pages/JobList.page +++ b/Web/Pages/JobList.page @@ -28,6 +28,9 @@ <%[ Jobs ]%> + + <%[ Reports ]%> + @@ -876,32 +879,739 @@ var oJobList = { }); }, set_weather: function() { - var jobs = oData.terminated_jobs; - var jobs_len = jobs.length; - for (var i = 0; i < jobs_len; i++) { - if (!this.job_weather.hasOwnProperty(jobs[i].name)) { - this.job_weather[jobs[i].name] = {count: 0, error: 0}; + this.job_weather = Weather.get_job_weather(oData.terminated_jobs, 5); + this.table.rows().invalidate('data').draw(false); + } +}; +oJobList.init(); + + +
+ - diff --git a/Web/Pages/JobList.php b/Web/Pages/JobList.php index 14483ae..353412a 100644 --- a/Web/Pages/JobList.php +++ b/Web/Pages/JobList.php @@ -2,7 +2,7 @@ /* * Bacularis - Bacula web interface * - * Copyright (C) 2021 Marcin Haba + * Copyright (C) 2021-2022 Marcin Haba * * The main author of Bacularis is Marcin Haba, with contributors, whose * full list can be found in the AUTHORS file. @@ -184,4 +184,35 @@ public function deleteJobs($sender, $param) { } $this->getCallbackClient()->update($this->BulkActions->BulkActionsOutput, implode(PHP_EOL, $result)); } + + /** + * Load job log. + * + * @param TCallback $sender callback object + * @param TCallbackEventPrameter $param event parameter + * @return none + */ + public function loadJobLog($sender, $param) { + $jobid = intval($param->getCallbackParameter()); + if ($jobid == 0) { + return; + } + + $params = ['joblog', $jobid]; + + // add time to log if defiend in configuration + if (key_exists('time_in_job_log', $this->web_config['baculum'])) { + $query_params = [ + 'show_time' => $this->web_config['baculum']['time_in_job_log'] + ]; + $params[] = '?' . http_build_query($query_params); + } + $result = $this->getModule('api')->get($params); + + $log = ''; + if ($result->error === 0) { + $log = implode(PHP_EOL, $result->output); + } + $this->getCallbackClient()->update('job_history_report_details_joblog_' . $jobid, $log); + } }