Skip to content

feat: sortable columns on jobs, failed jobs, and history#70

Merged
eclectic-coding merged 5 commits into
mainfrom
feat/sortable-columns
May 27, 2026
Merged

feat: sortable columns on jobs, failed jobs, and history#70
eclectic-coding merged 5 commits into
mainfrom
feat/sortable-columns

Conversation

@eclectic-coding
Copy link
Copy Markdown
Owner

Summary

  • Adds server-side ?sort= and ?direction= params to the Jobs, Failed Jobs, and History tables; click any column header to sort ascending or descending
  • Sort state is preserved across filter changes, status tab switches, period buttons, and discard redirects
  • Shared sort_header_th helper generates accessible <th> elements with aria-sort and ↑/↓ direction indicators

Refactors included

  • before_action :set_filters in JobsController eliminates duplicated param-normalization between index and destroy
  • job_scope private method extracts the filtered+sorted relation out of index
  • jobs_return_path private method de-duplicates the four identical redirect targets in destroy

Test plan

  • All 316 existing + new examples pass (bundle exec rake)
  • 100% line coverage maintained
  • New sort specs cover all valid columns and reject injection attempts (sort: "DROP TABLE")
  • Redirect URL expectations updated to include default sort/direction params

Closes #80

🤖 Generated with Claude Code

eclectic-coding and others added 5 commits May 27, 2026 15:58
Adds server-side ?sort=&direction= params to three queue list views.
Sort state is preserved across filter changes, tab switches, and period
buttons. A shared sort_header_th helper generates the <th> with
aria-sort and direction indicator from a URL proc.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Before: index set 6 params inline then built the scope inline — 18 lines
of mixed concerns. destroy duplicated 4 of those same assignments.

After: before_action :set_filters handles all param normalization for
both actions; job_scope builds the filtered+sorted relation; index drops
to 14 lines. priority_options query moved inside format.html so CSV
requests skip it.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The four identical jobs_path(...) calls in destroy are replaced with a
single private method, making each rescue and redirect a one-liner.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@eclectic-coding eclectic-coding merged commit 0343547 into main May 27, 2026
5 checks passed
@eclectic-coding eclectic-coding deleted the feat/sortable-columns branch May 27, 2026 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant