Skip to content

Enhance analytics dashboard and update dependencies - #446

Closed
rsmoke wants to merge 20 commits into
mainfrom
staging
Closed

Enhance analytics dashboard and update dependencies#446
rsmoke wants to merge 20 commits into
mainfrom
staging

Conversation

@rsmoke

@rsmoke rsmoke commented Jul 6, 2026

Copy link
Copy Markdown
Member

This pull request introduces several improvements and refactors to the analytics dashboard, room filters glossary, and file attachment handling. The main themes are analytics dashboard enhancements, glossary and filter improvements, and better file attachment UX. Below are the most important changes:

Analytics Dashboard Improvements

  • Refactored the time range selector on the analytics dashboard to use a Stimulus controller (analytics-range) for smoother, JavaScript-driven updates, replacing the form submit approach. [1] [2] [3]
  • Improved Chart.js integration with a Stimulus controller (analytics-chart) that properly tears down charts before Turbo snapshotting, preventing stale data from being displayed when navigating with Turbo. [1] [2]
  • Added browser cache prevention headers to the analytics dashboard to ensure users always see fresh data. [1] [2]
  • Updated SQL queries in analytics rollup models to use .all.group for clarity and to avoid potential query chaining issues. [1] [2]

Room Filters Glossary & Filter UI Enhancements

  • Refactored glossary data preparation: moved characteristic definitions into a cached helper method (room_characteristic_definitions) and streamlined the glossary view to group and anchor categories, improving navigation and maintainability. [1] [2] [3]
  • Added anchor links and improved accessibility for glossary categories and filters, including helper methods for generating anchor IDs. [1] [2]
  • Updated room filter checkboxes to show tooltips and info links for filter definitions, enhancing discoverability and user experience for signed-in users.

File Attachment Handling

  • Improved file attachment deletion: after purging a file, users are redirected to the associated record using a robust helper that handles various parent/child relationships, with better error handling and user feedback. [1] [2]
  • Updated the building image removal button to use button_to for better accessibility and compatibility with Turbo, and ensured the button is styled consistently.

Dependency Update

  • Updated the nokogiri gem from version 1.19.1 to 1.19.4 for security and bug fixes.

dependabot Bot and others added 20 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.
…egration

- Added a test to verify that hourly chart data is correctly scoped to the selected time range.
- Updated the analytics chart controller to handle Turbo caching by destroying the chart before caching.
- Modified the analytics dashboard view to prevent Turbo from restoring cached canvas data, ensuring fresh data is displayed on navigation.
…vention

- Added a new test to verify that the selected time range is reflected on the analytics dashboard and that caching is disabled.
- Updated the analytics dashboard view to display the selected time range and prevent browser caching.
- Modified the analytics dashboard controller to include a method for setting cache control headers.
…ashboard

- Added a new test to verify the use of a Stimulus controller for handling time range changes instead of inline JavaScript.
- Updated the analytics dashboard view to utilize data attributes for the Stimulus controller, enhancing maintainability and separation of concerns.
- Registered the new AnalyticsRangeController in the JavaScript controllers index.
Bumps the bundler group with 1 update in the / directory: [nokogiri](https://github.com/sparklemotion/nokogiri).


Updates `nokogiri` from 1.19.3 to 1.19.4
- [Release notes](https://github.com/sparklemotion/nokogiri/releases)
- [Changelog](https://github.com/sparklemotion/nokogiri/blob/main/CHANGELOG.md)
- [Commits](sparklemotion/nokogiri@v1.19.3...v1.19.4)

---
updated-dependencies:
- dependency-name: nokogiri
  dependency-version: 1.19.4
  dependency-type: direct:production
  dependency-group: bundler
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: rsmokeUM <rsmoke@umich.edu>
Bumps the bundler group with 2 updates in the / directory: [concurrent-ruby](https://github.com/ruby-concurrency/concurrent-ruby) and [faraday](https://github.com/lostisland/faraday).


Updates `concurrent-ruby` from 1.3.6 to 1.3.7
- [Release notes](https://github.com/ruby-concurrency/concurrent-ruby/releases)
- [Changelog](https://github.com/ruby-concurrency/concurrent-ruby/blob/master/CHANGELOG.md)
- [Commits](ruby-concurrency/concurrent-ruby@v1.3.6...v1.3.7)

Updates `faraday` from 2.14.2 to 2.14.3
- [Release notes](https://github.com/lostisland/faraday/releases)
- [Changelog](https://github.com/lostisland/faraday/blob/main/CHANGELOG.md)
- [Commits](lostisland/faraday@v2.14.2...v2.14.3)

---
updated-dependencies:
- dependency-name: concurrent-ruby
  dependency-version: 1.3.7
  dependency-type: indirect
  dependency-group: bundler
- dependency-name: faraday
  dependency-version: 2.14.3
  dependency-type: indirect
  dependency-group: bundler
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
- Removed the inline data attribute for the analytics range URL in the dashboard view.
- Updated the AnalyticsRangeController to construct the URL dynamically using the current window location, improving maintainability and flexibility in handling range changes.
…r label extraction

- Changed the selector for extracting chart labels in the analytics dashboard spec from a generic attribute to specific IDs for the 24-hour and 7-day charts.
- This improves the accuracy of the tests by ensuring they target the correct elements in the HTML response.
* Enhance file attachment management in ApplicationController

- Updated the delete_file_attachment method to redirect to the appropriate record page after purging an attachment, improving user experience.
- Added attachment_redirect_path and attachment_redirect_parent methods to handle redirection logic for different record types.
- Modified the building image removal button in the buildings show view to use button_to for better form handling and confirmation.
- Expanded attachment deletion specs to ensure correct redirection for building images and nested floor plans.

* Enhance room filters glossary functionality and UI

- Introduced caching for room characteristic definitions in the ApplicationController to improve performance.
- Updated the PagesController to streamline the room filters glossary, utilizing cached definitions and improving the display of categories and filters.
- Enhanced the room filters glossary view with improved navigation and layout, including links to definitions and better accessibility features.
- Modified the room characteristics partial to conditionally display definitions based on user context.
- Updated specs to ensure the glossary page renders correctly with the new features.

* Fix typo in room availability description and improve formatting in edit view

- Corrected the spelling of "availability" in the info panel.
- Adjusted formatting for better readability in the list of room management features.

* Improve formatting and clarity in room edit view

- Fixed list item formatting in the info panel for better readability.
- Updated HTML entities for proper display in the room management features list.

* Potential fix for pull request finding

fis typo in not-active

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Refine error handling in ApplicationController for file deletion

- Updated the delete_file_attachment method to handle ActiveRecord::RecordNotFound separately, improving robustness.
- Enhanced redirection logic in attachment_redirect_path to ensure proper fallback to rooms_path when parent record is not found.

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@rsmoke rsmoke closed this Jul 6, 2026
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