瀏覽代碼

HUE-947 [oozie] Sorting by modification date in Editor is wrong

Added data-sort-value and change sorting of datatables column to DOM attribute
Enrico Berti 13 年之前
父節點
當前提交
d40d62f

+ 3 - 2
apps/oozie/src/oozie/templates/editor/list_coordinators.mako

@@ -17,6 +17,7 @@
 <%!
   from desktop.views import commonheader, commonfooter
   from django.utils.translation import ugettext as _
+  import time as py_time
 %>
 
 <%namespace name="layout" file="../navigation-bar.mako" />
@@ -94,7 +95,7 @@ ${ layout.menubar(section='coordinators') }
           <td>
             <span class="label label-info">${ coordinator.status }</span>
           </td>
-          <td nowrap="nowrap">${ utils.format_date(coordinator.last_modified) }</td>
+          <td nowrap="nowrap" data-sort-value="${py_time.mktime(coordinator.last_modified.timetuple())}">${ utils.format_date(coordinator.last_modified) }</td>
           <td>${ coordinator.owner.username }</td>
         </tr>
       %endfor
@@ -215,7 +216,7 @@ ${ layout.menubar(section='coordinators') }
         null,
         null,
         null,
-        { "sType": "date" },
+        { "sSortDataType": "dom-sort-value", "sType": "numeric" },
         null
       ],
       "aaSorting": [[ 4, "desc" ]],

+ 3 - 2
apps/oozie/src/oozie/templates/editor/list_history.mako

@@ -18,6 +18,7 @@
 <%!
   from desktop.views import commonheader, commonfooter
   from django.utils.translation import ugettext as _
+  import time as py_time
 %>
 
 <%namespace name="layout" file="../navigation-bar.mako" />
@@ -49,7 +50,7 @@ ${ layout.menubar(section='history') }
     % for record in history:
       <tr>
         <td>
-          <a href="${ url('oozie:list_history_record', record_id=record.id) }" data-row-selector="true"></a>
+          <a href="${ url('oozie:list_history_record', record_id=record.id) }" data-row-selector="true" data-sort-value="${py_time.mktime(record.last_modified.timetuple())}"></a>
           ${ utils.format_date(record.submission_date) }
         </td>
         <td><a href="${ record.job.get_absolute_url() }">${ record.job.name }</a></td>
@@ -72,7 +73,7 @@ ${ layout.menubar(section='history') }
       "sPaginationType": "bootstrap",
       "sDom": "<'row'r>t<'row'<'span8'i><''p>>",
       "aoColumns": [
-        { "sType": "date" },
+        { "sSortDataType": "dom-sort-value", "sType": "numeric" },
         null,
         null,
         null,

+ 3 - 2
apps/oozie/src/oozie/templates/editor/list_workflows.mako

@@ -17,6 +17,7 @@
 <%!
   from desktop.views import commonheader, commonfooter
   from django.utils.translation import ugettext as _
+  import time as py_time
 %>
 
 <%namespace name="layout" file="../navigation-bar.mako" />
@@ -90,7 +91,7 @@ ${ layout.menubar(section='workflows') }
           </td>
           <td>${ workflow.description }</td>
 
-          <td nowrap="nowrap">${ utils.format_date(workflow.last_modified) }</td>
+          <td nowrap="nowrap" data-sort-value="${py_time.mktime(workflow.last_modified.timetuple())}">${ utils.format_date(workflow.last_modified) }</td>
           <td><span class="badge badge-info">${ workflow.actions.count() }</span></td>
           <td>
             <span class="label label-info">${ workflow.status }</span>
@@ -224,7 +225,7 @@ ${ layout.menubar(section='workflows') }
         null,
         null,
         null,
-        { "sType": "date" },
+        { "sSortDataType": "dom-sort-value", "sType": "numeric" },
         null,
         null
       ],