fix(ui): stop client/server sort flash on asset & finding-group lists#15084
Open
skywalke34 wants to merge 1 commit into
Open
fix(ui): stop client/server sort flash on asset & finding-group lists#15084skywalke34 wants to merge 1 commit into
skywalke34 wants to merge 1 commit into
Conversation
Sortable column headers on the Asset list (/asset) and the open Finding Groups list rendered BOTH a server-side dojo_sort link (?o=, full reload) AND a client-side DataTables sort handler. A single header click fired both: DataTables instantly re-sorted the visible rows, then the server reload redrew them -- a visible 'flash'. Long-standing client-vs-server sort conflict from issue DefectDojo#1811. Disable DataTables client-side ordering on the columns that sort server-side via dojo_sort, so a header click triggers only the server reload. Non-server columns stay client-sortable. Mirrors the existing fix in findings_list_snippet.html. Both UI trees (templates/ and templates_classic/): - product.html: orderable:false on product/findings/product_type - finding_groups_list_snippet.html: serverSortTargets columnDef Authored by T. Walker - DefectDojo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Sortable column headers on the Asset list (
/asset) and the open Finding Groups list (/finding_group/open) each rendered BOTH:dojo_sortlink (?o=…, full page reload), andA single header click fired both: DataTables instantly re-sorted the currently displayed rows, then the server reload redrew them with the server-sorted set — a visible "flash". This is the long-standing client-vs-server sort conflict from #1811.
Fix
Disable DataTables' client-side ordering on the columns that already sort server-side via
dojo_sort, so a header click triggers only the server reload. Columns without adojo_sortlink stay client-sortable (e.g. Tags, Criticality, Severity), and the custom Severity sort is untouched.This mirrors the fix already merged in
findings_list_snippet.html.Both UI trees:
product.html(new + classic):orderable: falseon theproduct/findings/product_typecolumns.finding_groups_list_snippet.html(new + classic): aserverSortTargetscolumnDef(same pattern asfindings_list_snippet.html), keyed by columndataso it is immune to the conditional Jira/GitHub column shifting.Scope / completeness
The conflict requires a table to have both a
.DataTable()init anddojo_sortheaders. That intersection is exactly six templates:findings_list_snippet.html(already fixed), andproduct.html+finding_groups_list_snippet.html(fixed here) — across both UI trees. Other DataTables pages use plain (client-only) headers, and otherdojo_sortpages have no DataTables, so neither flashes.Testing
Verified in-browser on both UIs (Tailwind + classic), on
/assetand/finding_group/open:dojo_sortcolumns are no longer client-orderable (no double-sort);dojo_sortheader produces no client-side reorder — only the server?o=reload;dojo_sortcolumns remain client-sortable, including the custom Severity sort.