From: Marcin Haba Date: Sun, 13 Dec 2015 10:34:47 +0000 (+0100) Subject: baculum: Add jobbytes and jobfiles columns in job list X-Git-Tag: Release-7.4.0~140 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=67689438db5a7b1f126c53e769edbfa7c5e7634b;p=bacula%2Fbacula baculum: Add jobbytes and jobfiles columns in job list --- diff --git a/gui/baculum/protected/Class/Miscellaneous.php b/gui/baculum/protected/Class/Miscellaneous.php index bb8a7170f6..58fd5d6a50 100644 --- a/gui/baculum/protected/Class/Miscellaneous.php +++ b/gui/baculum/protected/Class/Miscellaneous.php @@ -57,7 +57,7 @@ class Miscellaneous extends TModule { 'e' => array('value' => 'Non-fatal error', 'description' =>'Non-fatal error'), 'f' => array('value' => 'Fatal error', 'description' =>'Fatal error'), 'D' => array('value' => 'Verify Diff.', 'description' =>'Verify Differences'), - 'A' => array('value' => 'Canceled by user', 'description' =>'Canceled by the user'), + 'A' => array('value' => 'Canceled', 'description' =>'Canceled by the user'), 'I' => array('value' => 'Incomplete', 'description' =>'Incomplete Job'), 'F' => array('value' => 'Waiting on FD', 'description' =>'Waiting on the File daemon'), 'S' => array('value' => 'Waiting on SD', 'description' =>'Waiting on the Storage daemon'), diff --git a/gui/baculum/protected/JavaScript/misc.js b/gui/baculum/protected/JavaScript/misc.js new file mode 100644 index 0000000000..7cadf6faf7 --- /dev/null +++ b/gui/baculum/protected/JavaScript/misc.js @@ -0,0 +1,35 @@ +var Units = { + get_decimal_size: function(size) { + var size_unit = 'B'; + var units = ['K', 'M', 'G', 'T', 'P']; + var unit; + var dec_size = size.toString() + ((size > 0 ) ? size_unit : ''); + while(size > 1000) { + size /= 1000; + unit = units.shift(units); + } + if (unit) { + dec_size = size.toFixed(1) + unit + size_unit; + } + return dec_size; + } +} + +var Formatters = { + formatter: [ + {css_class: 'size', format_func: Units.get_decimal_size} + ], + set_formatters: function() { + var elements, formatter, txt; + for (var i = 0; i < this.formatter.length; i++) { + elements = document.getElementsByClassName(this.formatter[i].css_class); + formatter = this.formatter[i].format_func; + for (var i = 0; i < elements.length; i++) { + txt = elements[i].firstChild; + if (txt.nodeType === 3) { + txt.nodeValue = formatter(txt.nodeValue); + } + } + } + } +} diff --git a/gui/baculum/protected/JavaScript/slide-window.js b/gui/baculum/protected/JavaScript/slide-window.js index 5fe8041d3e..03ac2f7d0b 100644 --- a/gui/baculum/protected/JavaScript/slide-window.js +++ b/gui/baculum/protected/JavaScript/slide-window.js @@ -285,6 +285,7 @@ var SlideWindowClass = Class.create({ set_callback_parameter(tr); }.bind(this, tr)); }.bind(this)); + Formatters.set_formatters(); }, isConfigurationOpen: function() { diff --git a/gui/baculum/protected/Lang/en/messages.mo b/gui/baculum/protected/Lang/en/messages.mo index d36075ad15..6932c35a98 100644 Binary files a/gui/baculum/protected/Lang/en/messages.mo and b/gui/baculum/protected/Lang/en/messages.mo differ diff --git a/gui/baculum/protected/Lang/en/messages.po b/gui/baculum/protected/Lang/en/messages.po index 12f0a347f5..9ad4847bf2 100644 --- a/gui/baculum/protected/Lang/en/messages.po +++ b/gui/baculum/protected/Lang/en/messages.po @@ -1013,3 +1013,6 @@ msgstr "Add" msgid "Actions" msgstr "Actions" +msgid "Size" +msgstr "Size" + diff --git a/gui/baculum/protected/Lang/pl/messages.mo b/gui/baculum/protected/Lang/pl/messages.mo index 8d8211a100..c80b8320a9 100644 Binary files a/gui/baculum/protected/Lang/pl/messages.mo and b/gui/baculum/protected/Lang/pl/messages.mo differ diff --git a/gui/baculum/protected/Lang/pl/messages.po b/gui/baculum/protected/Lang/pl/messages.po index f228ef9daa..462bdea2fa 100644 --- a/gui/baculum/protected/Lang/pl/messages.po +++ b/gui/baculum/protected/Lang/pl/messages.po @@ -1014,3 +1014,6 @@ msgstr "Dodaj" msgid "Actions" msgstr "Akcje" +msgid "Size" +msgstr "Rozmiar" + diff --git a/gui/baculum/protected/Layouts/Main.tpl b/gui/baculum/protected/Layouts/Main.tpl index d6cc077a42..74fbdaca87 100644 --- a/gui/baculum/protected/Layouts/Main.tpl +++ b/gui/baculum/protected/Layouts/Main.tpl @@ -12,6 +12,7 @@ /> /> /> + /> diff --git a/gui/baculum/protected/Portlets/JobList.php b/gui/baculum/protected/Portlets/JobList.php index 3e5e7994ac..93b85b1c58 100644 --- a/gui/baculum/protected/Portlets/JobList.php +++ b/gui/baculum/protected/Portlets/JobList.php @@ -137,5 +137,12 @@ class JobList extends Portlets implements ISlideWindow { } $this->CheckedValues->Value = ""; } + + public function formatJobName($name) { + if (strlen($name) > 25) { + $name = substr($name, 0, 10) . '...' . substr($name, -13); + } + return $name; + } } ?> diff --git a/gui/baculum/protected/Portlets/JobList.tpl b/gui/baculum/protected/Portlets/JobList.tpl index 9c181e4857..53c1fe5daa 100644 --- a/gui/baculum/protected/Portlets/JobList.tpl +++ b/gui/baculum/protected/Portlets/JobList.tpl @@ -35,7 +35,7 @@ /> -
<%=$this->getParent()->Data['name']%>
+
<%=$this->getPage()->JobWindow->formatJobName($this->getParent()->Data['name'])%>
@@ -54,6 +54,12 @@
<%=isset($this->getPage()->JobWindow->jobStates[$this->getParent()->Data['jobstatus']]['value']) ? $this->getPage()->JobWindow->jobStates[$this->getParent()->Data['jobstatus']]['value'] : ''%>
+ + +
<%=$this->getParent()->Data['jobbytes']%>
+
+
+ <%=$this->getParent()->Data['endtime']%>