Skip to content

Conversation

@konard
Copy link

@konard konard commented Jan 5, 2026

Summary

This PR adds pagination and search functionality to the templates list page, addressing issue #2847.

Features implemented:

  • Paginated template list (default 20 per page with page navigation)
  • Search/filter by template name
  • Sort by name, type, created date, or updated date

Changes

Backend

  • queries/templates.sql: Added new query-templates SQL query with:

    • COUNT(*) OVER() for total count
    • OFFSET and LIMIT for pagination
    • ILIKE search on name field
    • Dynamic ORDER BY substitution
  • models/templates.go: Added Templates slice type and Total field to Template struct for pagination support

  • models/queries.go: Added QueryTemplates query reference as string type

  • internal/core/core.go: Added templateQuerySortFields for allowed sort columns

  • internal/core/templates.go: Added QueryTemplates() function for paginated template retrieval

  • cmd/templates.go: Updated GetTemplates handler to support pagination parameters (page, query, order_by, order)

Frontend

  • frontend/src/api/index.js: Updated getTemplates to accept params

  • frontend/src/views/Templates.vue:

    • Added search input with submit
    • Added backend pagination with b-table pagination props
    • Added backend sorting support
    • Updated template count to use templates.total
  • i18n/en.json: Added templates.queryPlaceholder translation

Testing

  • Go code builds successfully
  • Frontend builds successfully
  • ESLint passes with no errors

Screenshots

The UI follows the same pattern as the existing Campaigns and Lists pages for consistency.

Fixes #2847


🤖 Generated with Claude Code

konard and others added 2 commits January 5, 2026 23:08
Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: knadh#2847
Implements pagination, search, and sorting functionality for the
templates list page, addressing issue knadh#2847.

Changes:
- Add query-templates SQL query with pagination, search and sorting
- Add QueryTemplates function to core/templates.go
- Update GetTemplates API handler to support pagination parameters
- Add Templates type and Total field to template model
- Update frontend Templates.vue with pagination and search UI
- Update API call to support pagination parameters
- Add i18n translation for search placeholder

The implementation follows the existing patterns used in campaigns
and lists pages for consistency.

Fixes knadh#2847

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@konard konard changed the title [WIP] Feature: Add pagination and search to templates page Feature: Add pagination and search to templates page Jan 5, 2026
@konard konard marked this pull request as ready for review January 5, 2026 22:20
@konard
Copy link
Author

konard commented Jan 5, 2026

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $6.936327 USD
  • Calculated by Anthropic: $4.812010 USD
  • Difference: $-2.124317 (-30.63%)
    📎 Log file uploaded as GitHub Gist (1258KB)
    🔗 View complete solution draft log

Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard
Copy link
Author

konard commented Jan 5, 2026

🔄 Auto-restart 1/3

Detected uncommitted changes from previous run. Starting new session to review and commit them.

Uncommitted files:

M frontend/yarn.lock
?? frontend/package-lock.json

Auto-restart will stop after changes are committed or after 2 more iterations. Please wait until working session will end and give your feedback.

@konard
Copy link
Author

konard commented Jan 5, 2026

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $1.601133 USD
  • Calculated by Anthropic: $0.890814 USD
  • Difference: $-0.710319 (-44.36%)
    📎 Log file uploaded as GitHub Gist (1488KB)
    🔗 View complete solution draft log

Now working session is ended, feel free to review and add any feedback on the solution draft.

return c.JSON(http.StatusOK, okResp{models.PageResults{Results: []models.Template{}}})
}

out := models.PageResults{
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This breaks backwards-compatibility by changing the current API response structure.

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.

Feature: Add pagination and search to templates page

2 participants