Prechádzať zdrojové kódy

[oozie,beeswax,jobsub,jobbrowser] Replace table sorting 'type' customization with 'source' customizations

abec 13 rokov pred
rodič
commit
7cc9c44eb6

+ 2 - 4
apps/beeswax/src/beeswax/templates/list_designs.mako

@@ -69,9 +69,7 @@ ${layout.menubar(section='saved queries')}
                         ${_('Query')}
                     % endif
                 </td>
-                    <td>
-                        <span alt="${time.mktime(design.mtime.timetuple())}">${ timesince(design.mtime) } ${_('ago')}</span>
-                    </td>
+                <td data-sort-value="${time.mktime(design.mtime.timetuple())}">${ timesince(design.mtime) } ${_('ago')}</td>
                 <td>
                 <div class="btn-group">
                     <a href="#" data-toggle="dropdown" class="btn dropdown-toggle">
@@ -129,7 +127,7 @@ ${layout.menubar(section='saved queries')}
                 null,
                 null,
                 null,
-                { "sType": "alt-numeric" },
+                { "sSortDataType": "dom-sort-value", "sType": "numeric" },
                 { "bSortable": false }
             ]
         });

+ 2 - 2
apps/beeswax/src/beeswax/templates/list_history.mako

@@ -114,7 +114,7 @@ ${layout.menubar(section='history')}
 			  pass
 		      %>
 		      <tr class="histRow">
-                <td><span alt="${time.mktime(query.submission_date.timetuple())}">${query.submission_date.strftime("%x %X")}</span></td>
+                <td data-sort-value="${time.mktime(query.submission_date.timetuple())}">${query.submission_date.strftime("%x %X")}</td>
 		        <td>${show_saved_query(design, query)}</td>
 		        <td>
 		          <p>
@@ -151,7 +151,7 @@ ${layout.menubar(section='history')}
             "bInfo": false,
             "bFilter": false,
             "aoColumns": [
-                { "sType": "alt-numeric" },
+                { "sSortDataType": "dom-sort-value", "sType": "numeric" },
                 null,
                 null,
                 null,

+ 4 - 6
apps/beeswax/src/beeswax/templates/my_queries.mako

@@ -85,9 +85,7 @@ ${layout.menubar(section='my queries')}
                               ${_('Query')}
                             % endif
                           </td>
-                          <td>
-                              <span alt="${time.mktime(design.mtime.timetuple())}">${ timesince(design.mtime) } ${_('ago')}</span>
-                          </td>
+                          <td data-sort-value="${time.mktime(design.mtime.timetuple())}">${ timesince(design.mtime) } ${_('ago')}</td>
                           <td>
                             <div class="btn-group">
                                 <a href="#" data-toggle="dropdown" class="btn dropdown-toggle">
@@ -140,7 +138,7 @@ ${layout.menubar(section='my queries')}
                       pass
                     %>
                     <tr>
-                      <td><span alt="${time.mktime(query.submission_date.timetuple())}">${query.submission_date.strftime("%x %X")}</span></td>
+                      <td data-sort-value="${time.mktime(query.submission_date.timetuple())}">${query.submission_date.strftime("%x %X")}</td>
                       ## TODO (bc): Only showing HQL (not REPORT)
                       <td><a href="${ url('beeswax.views.execute_query', design_id=design.id) }" data-row-selector="true">${design.name}</a></td>
                       <td>
@@ -195,7 +193,7 @@ ${layout.menubar(section='my queries')}
                 null,
                 null,
                 null,
-                { "sType": "alt-numeric"},
+                { "sSortDataType": "dom-sort-value", "sType": "numeric" },
                 { "bSortable": false }
             ]
         });
@@ -206,7 +204,7 @@ ${layout.menubar(section='my queries')}
             "bLengthChange": false,
             "bInfo": false,
             "aoColumns": [
-                { "sType": "alt-numeric"},
+                { "sSortDataType": "dom-sort-value", "sType": "numeric" },
                 null,
                 null,
                 null,

+ 23 - 29
apps/jobbrowser/src/jobbrowser/templates/jobs.mako

@@ -108,36 +108,30 @@ ${commonheader(_('Job Browser'), "jobbrowser")}
             <td class="center">
                 <a href="${url('jobbrowser.views.jobs')}?${get_state_link(request, 'user', job.user.lower())}" title="${_('Show only %(status)s jobs') % dict(status=job.user.lower())}">${job.user}</a>
             </td>
-            <td>
-                <span alt="${job.maps_percent_complete}">
-                    % if job.is_retired:
-                        <div class="center">${_('N/A')}</div>
-                    % else:
-                    ${comps.mr_graph_maps(job)}
-                    % endif
-                 </span>
+            <td data-sort-value="${job.maps_percent_complete}">
+                % if job.is_retired:
+                    <div class="center">${_('N/A')}</div>
+                % else:
+                ${comps.mr_graph_maps(job)}
+                % endif
             </td>
-            <td>
-                <span alt="${job.reduces_percent_complete}">
-                    % if job.is_retired:
-                        <div class="center">${_('N/A')}</div>
-                    % else:
-                        ${comps.mr_graph_reduces(job)}
-                    % endif
-                </span>
+            <td data-sort-value="${job.reduces_percent_complete}">
+                % if job.is_retired:
+                    <div class="center">${_('N/A')}</div>
+                % else:
+                    ${comps.mr_graph_reduces(job)}
+                % endif
             </td>
             <td class="center">${job.queueName}</td>
             <td class="center">${job.priority.lower()}</td>
-            <td class="center" data-row-selector-exclude="true">
-                <span alt="${job.durationInMillis}">
-                    % if job.is_retired:
-                        ${_('N/A')}
-                    % else:
-                        ${job.durationFormatted}
-                    % endif
-                </span>
+            <td class="center" data-sort-value="${job.durationInMillis}" data-row-selector-exclude="true">
+                % if job.is_retired:
+                    ${_('N/A')}
+                % else:
+                    ${job.durationFormatted}
+                % endif
             </td>
-            <td><span alt="${job.startTimeMs}">${job.startTimeFormatted}</span></td>
+            <td data-sort-value="${job.startTimeMs}">${job.startTimeFormatted}</td>
             <td>
                 % if job.status.lower() == 'running' or job.status.lower() == 'pending':
                 % if request.user.is_superuser or request.user.username == job.user:
@@ -198,12 +192,12 @@ ${commonheader(_('Job Browser'), "jobbrowser")}
                 null,
                 null,
                 null,
-                { "sType": "alt-numeric", "sWidth": "60px" },
-                { "sType": "alt-numeric", "sWidth": "60px" },
+                { "sSortDataType": "dom-sort-value", "sType": "numeric", "sWidth": "60px" },
+                { "sSortDataType": "dom-sort-value", "sType": "numeric", "sWidth": "60px" },
                 null,
                 null,
-                { "sType": "alt-numeric" },
-                { "sType": "alt-numeric" },
+                { "sSortDataType": "dom-sort-value", "sType": "numeric" },
+                { "sSortDataType": "dom-sort-value", "sType": "numeric" },
                 {"bSortable":false}
             ]
         });

+ 2 - 2
apps/jobsub/src/jobsub/templates/list_designs.mako

@@ -65,7 +65,7 @@ ${layout.menubar(section='designs')}
                     <td>${design.name}</td>
                     <td>${design.root_action.action_type}</td>
                     <td>${design.description}</td>
-                    <td nowrap="nowrap"><span alt="${py_time.mktime(design.last_modified.timetuple())}">${date(design.last_modified)} ${time(design.last_modified).replace("p.m.","PM").replace("a.m.","AM")}</span></td>
+                    <td nowrap="nowrap" data-sort-value="${py_time.mktime(design.last_modified.timetuple())}">${date(design.last_modified)} ${time(design.last_modified).replace("p.m.","PM").replace("a.m.","AM")}</td>
                 <td nowrap="nowrap" class="right">
                 %if currentuser.username == design.owner.username:
                     <a title="${_('Submit %(name)s to the cluster') % dict(name=design.name)}" class="btn small submitConfirmation"
@@ -199,7 +199,7 @@ ${layout.menubar(section='designs')}
                 null,
                 null,
                 null,
-                { "sType": "alt-numeric" },
+                { "sSortDataType": "dom-sort-value", "sType": "numeric" },
                 { "bSortable": false }
             ],
             "aaSorting": [[ 4, "desc" ]],

+ 2 - 2
apps/jobsub/src/jobsub/templates/list_history.mako

@@ -57,7 +57,7 @@ ${layout.menubar(section='history')}
                     <td>${design.name}</td>
                     <td>${design.root_action.action_type}</td>
                     <td>${design.description}</td>
-                    <td><span alt="${py_time.mktime(design.last_modified.timetuple())}">${date(record.submission_date)} ${time(record.submission_date).replace("p.m.","PM").replace("a.m.","AM")}</span></td>
+                    <td data-sort-value="${py_time.mktime(record.submission_date.timetuple())}">${date(record.submission_date)} ${time(record.submission_date).replace("p.m.","PM").replace("a.m.","AM")}</td>
                 </tr>
                 %endfor
         </tbody>
@@ -76,7 +76,7 @@ ${layout.menubar(section='history')}
                 null,
                 null,
                 null,
-                { "sType": "alt-numeric" }
+                { "sSortDataType": "dom-sort-value", "sType": "numeric" }
             ],
             "aaSorting": [[ 5, "desc" ]],
             "oLanguage": {

+ 2 - 2
apps/oozie/src/oozie/templates/dashboard/list_oozie_coordinators.mako

@@ -163,7 +163,7 @@ ${layout.menubar(section='dashboard')}
         { "sType": "date" },
         null,
         null,
-        { "sSortDataType": "dom-sort-value", "sType": "alt-numeric" },
+        { "sSortDataType": "dom-sort-value", "sType": "numeric" },
         null,
         null,
         { "bSortable": false }
@@ -180,7 +180,7 @@ ${layout.menubar(section='dashboard')}
         { "sType": "date" },
         null,
         null,
-        { "sSortDataType": "dom-sort-value", "sType": "alt-numeric" },
+        { "sSortDataType": "dom-sort-value", "sType": "numeric" },
         null,
         null
       ],

+ 2 - 2
apps/oozie/src/oozie/templates/dashboard/list_oozie_workflows.mako

@@ -164,7 +164,7 @@ ${ layout.menubar(section='dashboard') }
            { "sType": "date" },
             null,
             null,
-            { "sSortDataType": "dom-sort-value", "sType": "alt-numeric" },
+            { "sSortDataType": "dom-sort-value", "sType": "numeric" },
             null,
             null,
             { "bSortable": false }
@@ -181,7 +181,7 @@ ${ layout.menubar(section='dashboard') }
             { "sType": "date" },
             null,
             null,
-            { "sSortDataType": "dom-sort-value", "sType": "alt-numeric" },
+            { "sSortDataType": "dom-sort-value", "sType": "numeric" },
             null,
             null
         ],

+ 2 - 17
desktop/core/static/js/Source/jHue/jquery.datatables.sorting.js

@@ -17,22 +17,7 @@
 $.fn.dataTableExt.afnSortData['dom-sort-value'] = function (oSettings, iColumn) {
   var aData = [];
   $( 'td:eq('+iColumn+')', oSettings.oApi._fnGetTrNodes(oSettings) ).each( function () {
-    aData.push( parseFloat($(this).attr('data-sort-value')) );
+    aData.push( $(this).attr('data-sort-value') );
   } );
   return aData;
-};
-
-jQuery.extend(jQuery.fn.dataTableExt.oSort, {
-  "alt-numeric-pre": function (a) {
-    var x = a.match(/title="*(-?[0-9\.]+)/)[1];
-    return parseFloat(x);
-  },
-
-  "alt-numeric-asc":function (a, b) {
-    return ((a < b) ? -1 : ((a > b) ? 1 : 0));
-  },
-
-  "alt-numeric-desc":function (a, b) {
-    return ((a < b) ? 1 : ((a > b) ? -1 : 0));
-  }
-});
+};