From: Marcin Haba Date: Sun, 18 Aug 2019 06:36:56 +0000 (+0200) Subject: baculum: Add progress bars to backup jobs displaying on status client page X-Git-Tag: Release-9.6.0~135 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1d16db05b2230b73d1034e03f0fc20a017c9d1b6;p=thirdparty%2Fbacula.git baculum: Add progress bars to backup jobs displaying on status client page --- diff --git a/gui/baculum/protected/Web/JavaScript/misc.js b/gui/baculum/protected/Web/JavaScript/misc.js index 408528b90..866828114 100644 --- a/gui/baculum/protected/Web/JavaScript/misc.js +++ b/gui/baculum/protected/Web/JavaScript/misc.js @@ -842,7 +842,44 @@ W3SubTabs = { open: function(btn_id, item_id) { W3TabsCommon.open.call(this, btn_id, item_id); } -} +}; + +function estimate_job(jobs, job, level) { + var bytes = 0; + var files = 0; + var time = 0; + var bytes_xy = 0; + var files_xy = 0; + var x2 = 0; + var counter = 0; + for (var i = 0; i < jobs.length; i++) { + if (jobs[i].name === job && jobs[i].level === level) { + if (jobs[i].jobbytes === 0 || jobs[i].jobfies === 0 || jobs[i].jobstatus !== 'T') { + continue; + } + if (counter === 20) { + break; + } + time += jobs[i].jobtdate; + bytes += jobs[i].jobbytes; + files += jobs[i].jobfiles; + bytes_xy += jobs[i].jobtdate * jobs[i].jobbytes; + files_xy += jobs[i].jobtdate * jobs[i].jobfiles; + x2 += Math.pow(jobs[i].jobtdate, 2); + counter++; + } + } + var bytes_slope = ((counter * bytes_xy) - (time * bytes)) / (counter * x2 - Math.pow(time, 2)); + var files_slope = ((counter * files_xy) - (time * files)) / (counter * x2 - Math.pow(time, 2)); + var bytes_intercept = (bytes / counter) - (bytes_slope * (time / counter)); + var files_intercept = (files / counter) - (files_slope * (time / counter)); + var est_bytes = bytes_intercept + (bytes_slope * parseInt((new Date).getTime() / 1000, 10)); + var est_files = files_intercept + (files_slope * parseInt((new Date).getTime() / 1000, 10)); + return { + est_bytes: est_bytes, + est_files: est_files + }; +}; function get_url_param (name) { var url = window.location.href; diff --git a/gui/baculum/protected/Web/Lang/en/messages.mo b/gui/baculum/protected/Web/Lang/en/messages.mo index 117c15440..8d30002ae 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 e2c11a04c..049f87f07 100644 --- a/gui/baculum/protected/Web/Lang/en/messages.po +++ b/gui/baculum/protected/Web/Lang/en/messages.po @@ -2228,8 +2228,8 @@ msgstr "Go to job %job" msgid "Graphical status" msgstr "Graphical status" -msgid "Text status" -msgstr "Text status" +msgid "Raw status" +msgstr "Raw status" msgid "Uname:" msgstr "Uname:" @@ -2338,3 +2338,24 @@ msgstr "Set job bandwidth limit" msgid "Here you can set bandwidth limit for job. This change is applied on running job." msgstr "Here you can set bandwidth limit for job. This change is applied on running job." + +msgid "est." +msgstr "est." + +msgid "Progress bar displays estimated values" +msgstr "Progress bar displays estimated values" + +msgid "Byte progress bar:" +msgstr "Byte progress bar:" + +msgid "File progress bar:" +msgstr "File progress bar:" + +msgid "Running job status" +msgstr "Running job status" + +msgid "Raw job log" +msgstr "Raw job log" + +msgid "Not available" +msgstr "Not available" diff --git a/gui/baculum/protected/Web/Lang/ja/messages.mo b/gui/baculum/protected/Web/Lang/ja/messages.mo index b9922366d..609319933 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 5f7741106..09ef8e794 100644 --- a/gui/baculum/protected/Web/Lang/ja/messages.po +++ b/gui/baculum/protected/Web/Lang/ja/messages.po @@ -2314,8 +2314,8 @@ msgstr "Go to job %job" msgid "Graphical status" msgstr "Graphical status" -msgid "Text status" -msgstr "Text status" +msgid "Raw status" +msgstr "Raw status" msgid "Uname:" msgstr "Uname:" @@ -2424,3 +2424,24 @@ msgstr "Set job bandwidth limit" msgid "Here you can set bandwidth limit for job. This change is applied on running job." msgstr "Here you can set bandwidth limit for job. This change is applied on running job." + +msgid "est." +msgstr "est." + +msgid "Progress bar displays estimated values" +msgstr "Progress bar displays estimated values" + +msgid "Byte progress bar:" +msgstr "Byte progress bar:" + +msgid "File progress bar:" +msgstr "File progress bar:" + +msgid "Running job status" +msgstr "Running job status" + +msgid "Raw job log" +msgstr "Raw job log" + +msgid "Not available" +msgstr "Not available" diff --git a/gui/baculum/protected/Web/Lang/pl/messages.mo b/gui/baculum/protected/Web/Lang/pl/messages.mo index 4209f147a..ef64e6a17 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 5ec9a4b95..aaffb3206 100644 --- a/gui/baculum/protected/Web/Lang/pl/messages.po +++ b/gui/baculum/protected/Web/Lang/pl/messages.po @@ -2235,7 +2235,7 @@ msgstr "Przejdź do zadania %job" msgid "Graphical status" msgstr "Status graficzny" -msgid "Text status" +msgid "Raw status" msgstr "Status tekstowy" msgid "Uname:" @@ -2345,3 +2345,24 @@ msgstr "Ustaw limit transferu dla zadania" msgid "Here you can set bandwidth limit for job. This change is applied on running job." msgstr "Tutaj możesz ustawić limit transferu dla zadania. Ta zmiana jest stosowana do uruchomionego zadania." + +msgid "est." +msgstr "est." + +msgid "Progress bar displays estimated values" +msgstr "Pasek postępu wyświetla szacunkowe wartości" + +msgid "Byte progress bar:" +msgstr "Pasek postępu bajtów:" + +msgid "File progress bar:" +msgstr "Pasek postępu plików:" + +msgid "Running job status" +msgstr "Status uruchomionego zadania" + +msgid "Raw job log" +msgstr "Surowy dziennik zadania" + +msgid "Not available" +msgstr "Niedostępny" diff --git a/gui/baculum/protected/Web/Lang/pt/messages.mo b/gui/baculum/protected/Web/Lang/pt/messages.mo index a7339727d..70994e237 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 84126853e..4df9ba859 100644 --- a/gui/baculum/protected/Web/Lang/pt/messages.po +++ b/gui/baculum/protected/Web/Lang/pt/messages.po @@ -2243,8 +2243,8 @@ msgstr "Go to job %job" msgid "Graphical status" msgstr "Graphical status" -msgid "Text status" -msgstr "Text status" +msgid "Raw status" +msgstr "Raw status" msgid "Uname:" msgstr "Uname:" @@ -2353,3 +2353,24 @@ msgstr "Set job bandwidth limit" msgid "Here you can set bandwidth limit for job. This change is applied on running job." msgstr "Here you can set bandwidth limit for job. This change is applied on running job." + +msgid "est." +msgstr "est." + +msgid "Progress bar displays estimated values" +msgstr "Progress bar displays estimated values" + +msgid "Byte progress bar:" +msgstr "Byte progress bar:" + +msgid "File progress bar:" +msgstr "File progress bar:" + +msgid "Running job status" +msgstr "Running job status" + +msgid "Raw job log" +msgstr "Raw job log" + +msgid "Not available" +msgstr "Not available" diff --git a/gui/baculum/protected/Web/Pages/ClientView.page b/gui/baculum/protected/Web/Pages/ClientView.page index 00ce35eed..e90297273 100644 --- a/gui/baculum/protected/Web/Pages/ClientView.page +++ b/gui/baculum/protected/Web/Pages/ClientView.page @@ -46,7 +46,7 @@
<%[ Graphical status ]%>
-
<%[ Text status ]%>
+
<%[ Raw status ]%>
@@ -98,6 +98,7 @@ OnCallback="setBandwidthControl" ClientSide.OnComplete="oJobBandwidthLimit.open_popup();" /> +