Răsfoiți Sursa

HUE-1170 [beeswax] Smarter sorting for queries

Default sorting by Last Modified desc on Saved Queries
The table sorting is persisted on the client side
Enrico Berti 13 ani în urmă
părinte
comite
830ad94b23

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

@@ -126,7 +126,7 @@ ${layout.menubar(section='saved queries')}
       "bLengthChange":false,
       "bLengthChange":false,
       "bInfo":false,
       "bInfo":false,
       "aaSorting":[
       "aaSorting":[
-        [1, 'asc']
+        [4, 'desc']
       ],
       ],
       "aoColumns":[
       "aoColumns":[
         {"bSortable":false, "sWidth":"1%" },
         {"bSortable":false, "sWidth":"1%" },
@@ -138,7 +138,8 @@ ${layout.menubar(section='saved queries')}
       "oLanguage":{
       "oLanguage":{
         "sEmptyTable":"${_('No data available')}",
         "sEmptyTable":"${_('No data available')}",
         "sZeroRecords":"${_('No matching records')}",
         "sZeroRecords":"${_('No matching records')}",
-      }
+      },
+      "bStateSave": true
     });
     });
 
 
     $("#filterInput").keyup(function () {
     $("#filterInput").keyup(function () {

+ 34 - 31
apps/beeswax/src/beeswax/templates/list_history.mako

@@ -134,38 +134,41 @@ ${ layout.menubar(section='history') }
 </div>
 </div>
 
 
 <script type="text/javascript" charset="utf-8">
 <script type="text/javascript" charset="utf-8">
-    $(document).ready(function(){
-        $(".datatables").dataTable({
-            "bPaginate": false,
-            "bLengthChange": false,
-            "bInfo": false,
-            "bFilter": false,
-            "aoColumns": [
-                { "sSortDataType": "dom-sort-value", "sType": "numeric" },
-                null,
-                null,
-                null,
-                null,
-                { "bSortable": false }
-            ],
-            "aaSorting": [[0, 'desc']],
-            "oLanguage": {
-                "sEmptyTable":     "${_('No data available')}",
-                "sInfo":           "${_('Showing _START_ to _END_ of _TOTAL_ entries')}",
-                "sInfoEmpty":      "${_('Showing 0 to 0 of 0 entries')}",
-                "sInfoFiltered":   "${_('(filtered from _MAX_ total entries)')}",
-                "sZeroRecords":    "${_('No matching records')}",
-                "oPaginate": {
-                    "sFirst":    "${_('First')}",
-                    "sLast":     "${_('Last')}",
-                    "sNext":     "${_('Next')}",
-                    "sPrevious": "${_('Previous')}"
-                }
-            }
-        });
-
-        $("a[data-row-selector='true']").jHueRowSelector();
+  $(document).ready(function () {
+    $(".datatables").dataTable({
+      "bPaginate": false,
+      "bLengthChange": false,
+      "bInfo": false,
+      "bFilter": false,
+      "aoColumns": [
+        { "sSortDataType": "dom-sort-value", "sType": "numeric" },
+        null,
+        null,
+        null,
+        null,
+        { "bSortable": false }
+      ],
+      "aaSorting": [
+        [0, 'desc']
+      ],
+      "oLanguage": {
+        "sEmptyTable": "${_('No data available')}",
+        "sInfo": "${_('Showing _START_ to _END_ of _TOTAL_ entries')}",
+        "sInfoEmpty": "${_('Showing 0 to 0 of 0 entries')}",
+        "sInfoFiltered": "${_('(filtered from _MAX_ total entries)')}",
+        "sZeroRecords": "${_('No matching records')}",
+        "oPaginate": {
+          "sFirst": "${_('First')}",
+          "sLast": "${_('Last')}",
+          "sNext": "${_('Next')}",
+          "sPrevious": "${_('Previous')}"
+        }
+      },
+      "bStateSave": true
     });
     });
+
+    $("a[data-row-selector='true']").jHueRowSelector();
+  });
 </script>
 </script>
 
 
 ${ commonfooter(messages) | n,unicode }
 ${ commonfooter(messages) | n,unicode }

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

@@ -189,7 +189,8 @@ ${layout.menubar(section='my queries')}
       "oLanguage":{
       "oLanguage":{
         "sEmptyTable":"${_('No data available')}",
         "sEmptyTable":"${_('No data available')}",
         "sZeroRecords":"${_('No matching records')}"
         "sZeroRecords":"${_('No matching records')}"
-      }
+      },
+      "bStateSave": true
     });
     });
 
 
     var recentRunQueries = $("#recentRunQueriesTable").dataTable({
     var recentRunQueries = $("#recentRunQueriesTable").dataTable({
@@ -210,7 +211,8 @@ ${layout.menubar(section='my queries')}
       "oLanguage":{
       "oLanguage":{
         "sEmptyTable":"${_('No data available')}",
         "sEmptyTable":"${_('No data available')}",
         "sZeroRecords":"${_('No matching records')}"
         "sZeroRecords":"${_('No matching records')}"
-      }
+      },
+      "bStateSave": true
     });
     });
 
 
     $("#filterInput").keyup(function () {
     $("#filterInput").keyup(function () {