Skip to content

Update net-imap and enhance analytics dashboard functionality - #441

Merged
rsmoke merged 8 commits into
mainfrom
staging
Jun 17, 2026
Merged

Update net-imap and enhance analytics dashboard functionality#441
rsmoke merged 8 commits into
mainfrom
staging

Conversation

@rsmoke

@rsmoke rsmoke commented Jun 17, 2026

Copy link
Copy Markdown
Member

This pull request introduces a comprehensive page view analytics system, including backend data collection, aggregation, and a new analytics dashboard for admins. It adds models and jobs for tracking and rolling up page view data, a controller and policy for the dashboard, and frontend components for visualizing analytics. It also removes HAML dependencies from the codebase.

Analytics Tracking and Aggregation:

  • Introduced a Trackable concern for automatic page view tracking, which enqueues TrackPageViewJob to record page views with relevant metadata, while excluding bots and non-HTML requests (app/controllers/concerns/trackable.rb, app/controllers/application_controller.rb, app/jobs/track_page_view_job.rb) [1] [2] [3].
  • Added PageView model for storing raw page view data and methods for rolling up data hourly/daily, pruning old records, and generating live stats and top pages (app/models/page_view.rb).
  • Added AnalyticsHourlyRollup and AnalyticsDailyRollup models for storing aggregated analytics, with scopes and methods for summarizing and retrieving top pages (app/models/analytics_hourly_rollup.rb, app/models/analytics_daily_rollup.rb) [1] [2].
  • Implemented AnalyticsRollupJob to aggregate raw page views into hourly and daily rollup tables, and prune old data (app/jobs/analytics_rollup_job.rb).

Analytics Dashboard:

  • Added AnalyticsDashboardController for displaying analytics charts, top pages, and summary stats, with support for refreshing rollups on demand (app/controllers/analytics_dashboard_controller.rb).
  • Added AnalyticsDashboardPolicy to restrict dashboard access and refresh actions to admins (app/policies/analytics_dashboard_policy.rb).
  • Created a stat card partial for displaying summary metrics (app/views/analytics_dashboard/_stat_card.html.erb).

Frontend Integration:

  • Added a custom AnalyticsChartController Stimulus controller for rendering charts using Chart.js, and registered it in the Stimulus application (app/javascript/controllers/analytics_chart_controller.js, app/javascript/controllers/index.js) [1] [2] [3].

Dependency Cleanup:

  • Removed HAML and related gems (haml-rails, erb2haml) from the Gemfile, indicating a move away from HAML templates (Gemfile) [1] [2].

dependabot Bot and others added 8 commits June 15, 2026 15:21
Bumps the bundler group with 1 update in the / directory: [net-imap](https://github.com/ruby/net-imap).


Updates `net-imap` from 0.6.4 to 0.6.4.1
- [Release notes](https://github.com/ruby/net-imap/releases)
- [Commits](ruby/net-imap@v0.6.4...v0.6.4.1)

---
updated-dependencies:
- dependency-name: net-imap
  dependency-version: 0.6.4.1
  dependency-type: indirect
  dependency-group: bundler
...

Signed-off-by: dependabot[bot] <support@github.com>
- Included Trackable module in ApplicationController for tracking purposes.
- Added new analytics jobs in recurring.yml for hourly, daily rollup, and pruning.
- Updated queue.yml to configure analytics queue with specific threading and polling settings.
- Defined route for analytics dashboard in routes.rb.
- Enhanced layout views to include links to the analytics dashboard for authorized users.
- Added Chart.js to importmap for data visualization support.
- Created tables for analytics_daily_rollups and analytics_hourly_rollups with relevant columns for tracking user interactions.
- Added sequences for both tables to manage primary key generation.
- Established primary key constraints and unique indexes to ensure data integrity and optimize query performance.
- Included additional table for page_views with corresponding sequence and constraints for comprehensive analytics tracking.
- Implemented a refresh action in the AnalyticsDashboardController to trigger rollup jobs synchronously, allowing immediate chart updates.
- Updated the analytics dashboard view to include a refresh button and a notice for stale data.
- Modified the analytics policy to authorize the refresh action for admin users.
- Adjusted routes to include a POST endpoint for refreshing analytics data.
- Enhanced the PageView model with live summary and top pages methods to provide real-time analytics data.
- Improved data handling in the controller to ensure top pages and summary stats reflect current data without waiting for rollup jobs.
- Modified the properties layer in tailwind.css to enhance support for various CSS features.
- Updated theme and base layers to ensure consistent styling and improved layout handling.
- Adjusted spacing and color variables for better design flexibility and responsiveness.
- Converted analytics dashboard views from HAML to ERB format for consistency.
- Added new partials for stat cards and building rows to enhance modularity.
- Updated Gemfile to remove HAML-related gems and dependencies.
- Adjusted importmap to include Chart.js for improved data visualization.
- Enhanced the .gitignore to exclude .OLD files and HAML files.
- Changed the schedule format for the AnalyticsRollupJob from "every week on Sunday at 02:30" to "at 2:30am every Sunday" for improved clarity and consistency.
@rsmoke

rsmoke commented Jun 17, 2026

Copy link
Copy Markdown
Member Author

Add first-party analytics and remove HAML views

Track page views via Solid Queue, aggregate into hourly/daily rollups,
and expose an admin-only analytics dashboard. Migrate remaining HAML
views to ERB and fix the analytics_prune recurring schedule for
Solid Queue.

@rsmoke
rsmoke merged commit b2501ae into main Jun 17, 2026
3 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.

1 participant