Skip to content

Conversation

@jirivrany
Copy link
Collaborator

No description provided.

* Refactor get_ip_rules into type specific functions with optional pagination
* Introduce pagination parameters page and per_page for Flowspec4, Flowspec6, RTBH, and Whitelist queries
* Update dashboard view to handle pagination and per page selection
* Add pagination controls to dashboard templates
* Preserve backward compatibility for non paginated queries
Bump version to 1.1.8b1

Extract dashboard search form into shared template

Implement unified search across all rule types with result counters

Add in-memory pagination for search results via paginate_list()

Introduce /clear-search route to reset stored queries

Include search_helpers.js and enhance UI feedback for active searches

Simplify layout templates and refactor redundant search form code
@jirivrany jirivrany requested a review from Copilot October 20, 2025 10:01
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements version 1.1.8 with enhancements to dashboard pagination, search functionality, and user interface improvements. The main focus is on adding pagination support for "Expired" and "All" dashboard states, improving search capabilities with quick clear functionality, and fixing group operations.

  • Added comprehensive pagination system with database-level and in-memory pagination for search results
  • Enhanced search functionality with quick clear buttons and ESC key support
  • Refactored template structure to use shared search form components and pagination macros

Reviewed Changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
pyproject.toml Removed email addresses from some authors
flowapp/views/dashboard.py Major pagination implementation with enhanced search handling and new clear_search endpoint
flowapp/utils/app_factory.py Added locale parameter to datetime formatting
flowapp/templates/pagination_macro.html New pagination component with Bootstrap styling and per-page options
flowapp/templates/pages/submenu_dashboard_view.html Refactored to use shared search form component
flowapp/templates/pages/submenu_dashboard.html Added search result indicators and shared search form
flowapp/templates/pages/dashboard_view.html Integrated pagination macro
flowapp/templates/pages/dashboard_search_form.html New shared search form component with clear functionality
flowapp/templates/pages/dashboard_admin.html Added pagination support
flowapp/templates/layouts/default.html Added search helper JavaScript
flowapp/static/js/search_helpers.js New JavaScript for search clear functionality
flowapp/static/js/check_all.js New JavaScript for checkbox toggle functionality
flowapp/models/utils.py Refactored rule retrieval with pagination support
flowapp/about.py Version bump to 1.1.8
config.example.py Added Babel locale configuration
CHANGELOG.md Updated with version 1.1.8 changes

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

return redirect(url_for("dashboard.index", rtype=rtype, rstate=rstate, sort=sort_key, order=sort_order))


## Helper functions
Copy link

Copilot AI Oct 20, 2025

Choose a reason for hiding this comment

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

Corrected comment header format - should use single # for consistency with Python conventions.

Suggested change
## Helper functions
# Helper functions

Copilot uses AI. Check for mistakes.
Comment on lines 247 to 248
class Pagination:
pass
Copy link

Copilot AI Oct 20, 2025

Choose a reason for hiding this comment

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

Using an empty class with dynamic attribute assignment is not a best practice. Consider using a dataclass or NamedTuple for better type safety and clarity.

Copilot uses AI. Check for mistakes.
full_text = " ".join("{}".format(c) for c in rule.values())
if get_search_query.lower() in full_text.lower():
# Create a full text string from all values
full_text = " ".join(str(c) for c in rule.values())
Copy link

Copilot AI Oct 20, 2025

Choose a reason for hiding this comment

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

[nitpick] The variable name 'c' is ambiguous in this context. Consider renaming to 'value' for better readability.

Suggested change
full_text = " ".join(str(c) for c in rule.values())
full_text = " ".join(str(value) for value in rule.values())

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,96 @@
{#
Pagination macro for dashboard tables
Usage: {{ render_pagination(pagination, rtype, rstate, sort_key, sort_order, search_query, per_page, per_page_options) }}
Copy link

Copilot AI Oct 20, 2025

Choose a reason for hiding this comment

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

The macro documentation should include parameter descriptions for better maintainability, especially for the complex parameter list.

Suggested change
Usage: {{ render_pagination(pagination, rtype, rstate, sort_key, sort_order, search_query, per_page, per_page_options) }}
Usage: {{ render_pagination(pagination, rtype, rstate, sort_key, sort_order, search_query, per_page, per_page_options) }}
Parameters:
pagination - Pagination object containing page info (required)
rtype - Rule type filter (string, required)
rstate - Rule state filter (string, required)
sort_key - Key to sort by (string, required)
sort_order - Sort order, e.g. 'asc' or 'desc' (string, required)
search_query - Search query string (string, optional, default: '')
per_page - Number of items per page (integer, optional, default: 50)
per_page_options - List of selectable items per page (list of integers, optional, default: [25, 50, 100, 200])

Copilot uses AI. Check for mistakes.
@jirivrany jirivrany merged commit 68230f7 into main Oct 20, 2025
9 checks passed
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.

2 participants