From: Marcin Haba Date: Sun, 13 Dec 2015 12:50:08 +0000 (+0100) Subject: baculum: Fix sorting formatted values in tables X-Git-Tag: Release-7.4.0~136 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=809120d3a8108f00d024c4095712bd5d6e6abc0c;p=bacula%2Fbacula baculum: Fix sorting formatted values in tables --- diff --git a/gui/baculum/protected/JavaScript/slide-window.js b/gui/baculum/protected/JavaScript/slide-window.js index 03ac2f7d0b..41cf7c1b3d 100644 --- a/gui/baculum/protected/JavaScript/slide-window.js +++ b/gui/baculum/protected/JavaScript/slide-window.js @@ -304,9 +304,16 @@ var SlideWindowClass = Class.create({ var tb = table.tBodies[0], tr = Array.prototype.slice.call(tb.rows, 0), i; reverse = -((+reverse) || -1); tr = tr.sort(function (a, b) { - var val; - var val_a = a.cells[col].textContent.trim(); - var val_b = b.cells[col].textContent.trim(); + var val, val_a, val_b, el_a, el_b; + el_a = a.cells[col].childNodes[1]; + el_b = b.cells[col].childNodes[1]; + if (el_a && el_b && el_a.nodeType === 1 && el_b.nodeType === 1 && el_a.hasAttribute('rel') && el_b.hasAttribute('rel')) { + val_a = el_a.getAttribute('rel'); + val_b = el_b.getAttribute('rel'); + } else { + val_a = a.cells[col].textContent.trim(); + val_b = b.cells[col].textContent.trim(); + } if (!isNaN(parseFloat(val_a)) && isFinite(val_a) && !isNaN(parseFloat(val_b)) && isFinite(val_b)) { val = val_a - val_b } else { diff --git a/gui/baculum/protected/Portlets/ClientList.tpl b/gui/baculum/protected/Portlets/ClientList.tpl index 5ee46995ca..59388ab0a4 100644 --- a/gui/baculum/protected/Portlets/ClientList.tpl +++ b/gui/baculum/protected/Portlets/ClientList.tpl @@ -34,7 +34,7 @@ - <%=(integer)($this->getParent()->Data['fileretention'] / 3600 / 24)%> <%=$this->getParent()->Data['fileretention'] < 172800 ? Prado::localize('day') : Prado::localize('days')%> +
<%=(integer)($this->getParent()->Data['fileretention'] / 3600 / 24)%> <%=$this->getParent()->Data['fileretention'] < 172800 ? Prado::localize('day') : Prado::localize('days')%>
diff --git a/gui/baculum/protected/Portlets/JobList.tpl b/gui/baculum/protected/Portlets/JobList.tpl index 53c1fe5daa..66956b43d4 100644 --- a/gui/baculum/protected/Portlets/JobList.tpl +++ b/gui/baculum/protected/Portlets/JobList.tpl @@ -56,7 +56,7 @@ -
<%=$this->getParent()->Data['jobbytes']%>
+
<%=$this->getParent()->Data['jobbytes']%>
diff --git a/gui/baculum/protected/Portlets/PoolList.tpl b/gui/baculum/protected/Portlets/PoolList.tpl index d0193a1447..12bf5fb83a 100644 --- a/gui/baculum/protected/Portlets/PoolList.tpl +++ b/gui/baculum/protected/Portlets/PoolList.tpl @@ -36,7 +36,7 @@ /> - <%=(integer)($this->getParent()->Data['volretention'] / 3600 / 24)%> <%=$this->getParent()->Data['volretention'] < 172800 ? 'day' : 'days'%> +
<%=(integer)($this->getParent()->Data['volretention'] / 3600 / 24)%> <%=$this->getParent()->Data['volretention'] < 172800 ? 'day' : 'days'%>