@@ -57,6 +57,8 @@ <h3 class="has-filters">
5757 < div class ="clearfix "> {% include "dojo/paging_snippet.html" with page=findings page_size=True %}</ div >
5858 {% if not product_tab or product_tab and product_tab.product|has_object_permission:"Finding_Edit" %}
5959 < div class ="dropdown hidden " style ="padding-bottom: 5px; " id ="bulk_edit_menu ">
60+ {{ bulk_edit_form.media.css }}
61+ {{ bulk_edit_form.media.js }}
6062 {% if not product_tab or product_tab and product_tab.product|has_object_permission:"Finding_Edit" %}
6163 < button class ="btn btn-info btn-sm btn-primary dropdown-toggle "
6264 type ="button "
@@ -242,18 +244,8 @@ <h3 class="has-filters">
242244 < br />
243245 {% endif %}
244246 < label style ="display: block "> {% trans "Notes" %}</ label >
245- {% comment %}
246- Quick hack to make bulk edit work without refactoring the whole bulk edit form
247- {{ bulk_edit_form.media.css }}
248- {{ bulk_edit_form.media.js }}
249- {% endcomment %}
250247 {{ bulk_edit_form.notes }}
251248 < label style ="display: block "> {% trans "Tags" %}</ label >
252- {% comment %}
253- Quick hack to make bulk edit work without refactoring the whole bulk edit form
254- {{ bulk_edit_form.media.css }}
255- {{ bulk_edit_form.media.js }}
256- {% endcomment %}
257249 {{ bulk_edit_form.tags }}
258250 {% if bulk_edit_form.disclaimer %}
259251 < div style ="background-color:#DADCE2; border:1px #003333; padding:.3em; margin:.1em; ">
@@ -318,14 +310,14 @@ <h3 class="has-filters">
318310 {% endif %}
319311 < th > </ th >
320312 < th class ="nowrap centered severity-sort " scope ="col ">
321- {% trans " Severity" %}
313+ {% dojo_sort request ' Severity' 'numerical_severity' %}
322314 </ th >
323315 < th class ="nowrap " scope ="col ">
324316 {% comment %} The display field is translated in the function. No need to translate here as well{% endcomment %}
325317 {% dojo_sort request 'Name' 'title' %}
326318 </ th >
327319 < th scope ="col ">
328- {% trans " CWE" %}
320+ {% dojo_sort request ' CWE' 'cwe' %}
329321 </ th >
330322 < th scope ="col ">
331323 {% trans "Vulnerability Id" %}
@@ -355,11 +347,11 @@ <h3 class="has-filters">
355347 {% endif %}
356348 </ th >
357349 < th class ="nowrap " scope ="col ">
358- {% trans " Age" %}
350+ {% dojo_sort request ' Age' 'date' %}
359351 </ th >
360352 {% if system_settings.enable_finding_sla %}
361353 < th scope ="col ">
362- {% trans " SLA" %}
354+ {% dojo_sort request ' SLA' 'sla_age_days' %}
363355 </ th >
364356 {% endif %}
365357 < th scope ="col ">
@@ -396,10 +388,10 @@ <h3 class="has-filters">
396388 </ th >
397389 {% endif %}
398390 < th scope ="col ">
399- {% trans " Service" %}
391+ {% dojo_sort request ' Service' 'service' %}
400392 </ th >
401- < th scope ="col ">
402- {% trans " Planned Remediation" %}
393+ < th scope ="col ">
394+ {% dojo_sort request ' Planned Remediation' 'planned_remediation_date' %}
403395 </ th >
404396 {% if filter_name != 'Closed' %}
405397 < th scope ="col ">
@@ -800,7 +792,7 @@ <h3 class="has-filters">
800792 return data ;
801793 } } ,
802794 { "data" : "finding_age" } ,
803- { % if system_settings . enable_finding_sla % }
795+ { % if system_settings . enable_finding_sla % }
804796 { "data" : "finding_sla" , "type" : "num" , render : function ( data , type , row , meta ) {
805797 if ( type === 'sort' ) {
806798 var api = new $ . fn . dataTable . Api ( meta . settings ) ;
@@ -867,6 +859,25 @@ <h3 class="has-filters">
867859 var fileDated = 'Findings_List_' + date ;
868860 var columns = datatables_columns ;
869861
862+ // Determine columns that should be server-sorted via dojo_sort (disable client sorting for these)
863+ var serverSortDataKeys = new Set ( [
864+ 'severity' ,
865+ 'finding' ,
866+ 'cwe' ,
867+ 'found_date' ,
868+ 'finding_age' ,
869+ 'finding_sla' ,
870+ 'product' ,
871+ 'service' ,
872+ 'planned_remediation_date'
873+ ] ) ;
874+ var serverSortTargets = [ ] ;
875+ for ( var i = 0 ; i < columns . length ; i ++ ) {
876+ if ( serverSortDataKeys . has ( columns [ i ] [ "data" ] ) ) {
877+ serverSortTargets . push ( i ) ;
878+ }
879+ }
880+
870881 // Filter the list of items to display based on what is shown.
871882 var disallowed_entries = new Set ( [ "checkbox" , "action" ] ) ;
872883 var data_column_list = [ ] ;
@@ -899,8 +910,13 @@ <h3 class="has-filters">
899910 } ,
900911 colReorder : true ,
901912 "columns" : columns ,
913+ ordering : true ,
902914 order : [ ] ,
903915 columnDefs : [
916+ {
917+ orderable : false ,
918+ targets : serverSortTargets
919+ } ,
904920 {
905921 "orderable" : false ,
906922 "targets" : [ 0 , 1 ]
0 commit comments