]> git.sur5r.net Git - bacula/bacula/commitdiff
baculum: Add jobbytes and jobfiles columns in job list
authorMarcin Haba <marcin.haba@bacula.pl>
Sun, 13 Dec 2015 10:34:47 +0000 (11:34 +0100)
committerMarcin Haba <marcin.haba@bacula.pl>
Sun, 13 Dec 2015 10:34:47 +0000 (11:34 +0100)
gui/baculum/protected/Class/Miscellaneous.php
gui/baculum/protected/JavaScript/misc.js [new file with mode: 0644]
gui/baculum/protected/JavaScript/slide-window.js
gui/baculum/protected/Lang/en/messages.mo
gui/baculum/protected/Lang/en/messages.po
gui/baculum/protected/Lang/pl/messages.mo
gui/baculum/protected/Lang/pl/messages.po
gui/baculum/protected/Layouts/Main.tpl
gui/baculum/protected/Portlets/JobList.php
gui/baculum/protected/Portlets/JobList.tpl

index bb8a7170f67e94ecd3c1dde26e2114bbab4a6330..58fd5d6a50b4475e1c0edf58991f8c6f5ba8642e 100644 (file)
@@ -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 (file)
index 0000000..7cadf6f
--- /dev/null
@@ -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);
+                               }
+                       }
+               }
+       }
+}
index 5fe8041d3eab4166ee08aa6bac0bb554b688a01b..03ac2f7d0b31b5641384b811f4673a197ff51d57 100644 (file)
@@ -285,6 +285,7 @@ var SlideWindowClass = Class.create({
                                set_callback_parameter(tr);
                        }.bind(this, tr));
                }.bind(this));
+               Formatters.set_formatters();
        },
 
        isConfigurationOpen: function() {
index d36075ad158bded119dd0fa4be2eeb8a0f1b355f..6932c35a98845fbb382e407c6dabed0158993a9c 100644 (file)
Binary files a/gui/baculum/protected/Lang/en/messages.mo and b/gui/baculum/protected/Lang/en/messages.mo differ
index 12f0a347f5ab24c5ff0d5f787320b36a59d798fa..9ad4847bf2dcb04861e372084c60e50668232078 100644 (file)
@@ -1013,3 +1013,6 @@ msgstr "Add"
 msgid "Actions"
 msgstr "Actions"
 
+msgid "Size"
+msgstr "Size"
+
index 8d8211a1000066412d0404eff131330903b7c924..c80b8320a99a3260ed8066ca11bd3e0cabbd6a1a 100644 (file)
Binary files a/gui/baculum/protected/Lang/pl/messages.mo and b/gui/baculum/protected/Lang/pl/messages.mo differ
index f228ef9daae3eb925de3aa283f29eb149694b2c0..462bdea2fa8471869eeb1ef60094725bd409ef25 100644 (file)
@@ -1014,3 +1014,6 @@ msgstr "Dodaj"
 msgid "Actions"
 msgstr "Akcje"
 
+msgid "Size"
+msgstr "Rozmiar"
+
index d6cc077a4270963f6ca4cffb790f097a85b221cf..74fbdaca87ee5684003fbe24491d834e74d7590f 100644 (file)
@@ -12,6 +12,7 @@
                        <com:TClientScript ScriptUrl=<%~ ../JavaScript/panel-window.js %> />
                        <com:TClientScript ScriptUrl=<%~ ../JavaScript/flotr2.js %> />
                        <com:TClientScript ScriptUrl=<%~ ../JavaScript/graph.js %> />
+                       <com:TClientScript ScriptUrl=<%~ ../JavaScript/misc.js %> />
                        <com:TContentPlaceHolder ID="Main" />
                </com:TForm>
        </body>
index 3e5e7994ac0f41f76b0b3d04731e73a22f96a57e..93b85b1c58eaa1b8542d3bbae021673374b4a9d9 100644 (file)
@@ -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;
+       }
 }
 ?>
index 9c181e4857c0f47dc993c5e53c49d14ab0a29612..53c1fe5daa08ad4a78ea8ac95967b4394599c7ff 100644 (file)
@@ -35,7 +35,7 @@
                />
                <com:TActiveTemplateColumn HeaderText="<%[ Job name ]%>" SortExpression="name">
                        <prop:ItemTemplate>
-                               <div><%=$this->getParent()->Data['name']%></div>
+                               <div title="<%=$this->getParent()->Data['name']%>"><%=$this->getPage()->JobWindow->formatJobName($this->getParent()->Data['name'])%></div>
                                 <input type="hidden" name="<%=$this->getParent()->ClientID%>" value="<%=$this->getParent()->Data['jobid']%>" />
                        </prop:ItemTemplate>
                </com:TActiveTemplateColumn>
                                <div class="job-status-<%=isset($this->getParent()->Data['jobstatus']) ? $this->getParent()->Data['jobstatus'] : ''%>" title="<%=isset($this->getPage()->JobWindow->jobStates[$this->getParent()->Data['jobstatus']]['description']) ? $this->getPage()->JobWindow->jobStates[$this->getParent()->Data['jobstatus']]['description'] : ''%>"><%=isset($this->getPage()->JobWindow->jobStates[$this->getParent()->Data['jobstatus']]['value']) ? $this->getPage()->JobWindow->jobStates[$this->getParent()->Data['jobstatus']]['value'] : ''%></div>
                        </prop:ItemTemplate>
                </com:TActiveTemplateColumn>
+               <com:TActiveTemplateColumn HeaderText="<%[ Size ]%>" SortExpression="jobbytes">
+                       <prop:ItemTemplate>
+                               <div class="size"><%=$this->getParent()->Data['jobbytes']%></div>
+                       </prop:ItemTemplate>
+               </com:TActiveTemplateColumn>
+               <com:TActiveBoundColumn SortExpression="jobfiles" HeaderText="<%[ Files ]%>" DataField="jobfiles" />
                <com:TActiveTemplateColumn HeaderText="<%[ End time ]%>" SortExpression="endtime">
                        <prop:ItemTemplate>
                                <%=$this->getParent()->Data['endtime']%>