Skip to content

feat: implement pagination in Web UI (Fixes #86) - #325

Open
Diyoncrz18 wants to merge 3 commits into
gosom:mainfrom
Diyoncrz18:main
Open

feat: implement pagination in Web UI (Fixes #86)#325
Diyoncrz18 wants to merge 3 commits into
gosom:mainfrom
Diyoncrz18:main

Conversation

@Diyoncrz18

Copy link
Copy Markdown

Description

This PR resolves Issue #86 by adding proper pagination to the Web UI jobs list.

Implementation Details

  • Backend: Server-side pagination has been introduced. JobRepository now supports Count, and SelectParams includes an Offset. Service has a new ListJobs method, while All remains untouched to maintain backward compatibility for external API consumers.
  • Frontend: The /jobs page was updated to parse the ?page= query parameter. The HTML templates were adjusted to return HTMX <tbody id="job-tbody" hx-swap="outerHTML"> bundled with out-of-band updates <div id="pagination-container" hx-swap-oob="true"> for seamless pagination controls.

Validation

  • Validated that ?page=0 or invalid pages correctly default to page 1.
  • Ensured existing filters and states are preserved.
  • Existing tests compile and pass. Run go test ./... yields success.

- Added Count method to JobRepository and Offset to SelectParams
- Updated sqlite implementation to support offset and count calculations
- Added ListJobs function to Service, keeping All intact for API backward compatibility
- Updated getJobs to parse ?page query param and return JobRowsData
- Updated HTML templates to support HTMX outerHTML replacements with out-of-band updates
…osom#86)

- index.html: initial tbody uses hx-trigger='load' only (fires once)
- job_rows.html: returned tbody uses hx-trigger='every 10s' only (no load)
  This eliminates the outerHTML reload loop where the inserted element
  immediately fires 'load' again before the 10s timer.
- Remove pr_body.md and results.csv (local artifacts, not part of gosom#86)
- Add TestGetJobsHTMXTriggerIsPollingOnly to assert the fix is permanent
- Service.All remains unchanged for existing callers
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