Skip to content

Commit

Permalink
[webui] Fix sorting in job history table
Browse files Browse the repository at this point in the history
- Disable sorting in first (Revision) and last column.
- Enable sorting by default with "Time" column, descending.
- Fix sorting by "Time" column.
- Also fix sorting in "Build time" column.
- Prevent searching for the introduced hidden columns with no formatted
data.

This should fix #3986.
  • Loading branch information
eduardoj committed Nov 12, 2017
1 parent d9e0803 commit 639e946
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/api/app/assets/javascripts/webui/application/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,12 @@ $( document ).ready(function() {
});

$('#jobhistory-table').dataTable({
order: [[0, 'desc']]
columnDefs: [
{ orderable: false, targets: [0, 8] },
{ visible: false, searchable: false, targets: [1, 5] },
{ orderData: 1, targets: 2 },
{ orderData: 5, targets: 6 },
],
order: [[2, 'desc']]
});
});
6 changes: 6 additions & 0 deletions src/api/app/views/webui/packages/job_history/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
%table#jobhistory-table
%thead
%th Revision
%th Time (not formatted)
%th Time
%th Reason
%th Status Code
%th Build Time (not formatted)
%th Build Time
%th Worker
%th
Expand All @@ -23,6 +25,8 @@
%tr
%td
= jobhistory.revision
%td
= jobhistory.ready_time
%td
= time_tag(Time.at(jobhistory.ready_time))
%td
Expand All @@ -32,6 +36,8 @@
= jobhistory.reason
%td{ class: "status_#{jobhistory.code}" }
= jobhistory.code
%td
= jobhistory.total_time
%td
= humanize_time(jobhistory.total_time)
%td
Expand Down

0 comments on commit 639e946

Please sign in to comment.