Skip to content

feat(action-services): shared action execution infrastructure for dashboard - #407

Closed
tomas-goncalves wants to merge 22 commits into
sc0v:masterfrom
tomas-goncalves:advanced-dashboard/action-services
Closed

feat(action-services): shared action execution infrastructure for dashboard#407
tomas-goncalves wants to merge 22 commits into
sc0v:masterfrom
tomas-goncalves:advanced-dashboard/action-services

Conversation

@tomas-goncalves

Copy link
Copy Markdown
Contributor

Summary

  • Add shared action execution infrastructure (Dashboard::ActionRegistry, action services)
  • Add resource lookup and translations for action services
  • Unified checkout/checkin flow with auto-add
  • Remove forfeit option for scissor lifts
  • Replace checkout_batch with direct ScissorLiftCheckout instantiation

Stack

Part of the advanced dashboard series. Stacks on #374 (advanced-dashboard/foundation).

tomas-goncalves and others added 12 commits February 24, 2026 19:47
…tion. Improve error logging for batch checkout
- Remove debug Rails.logger.debug calls from Checkout#participant_belongs_to_org
- Use .blank? instead of .nil? in PPECollectionController
- Make return_hardhat private in PPECollectionController
- Use find_by instead of find in PPEDistributionController to avoid RecordNotFound exceptions
- Simplify checkout condition in Tools::CheckoutsController#checkin
- Add can? authorization checks to checkout/checkin actions
- Add find_by_query to Organization, Participant, ScissorLift, and Tool models
- Add scissor_lift_certified? helper to Participant
- Add current_checkout helper to ScissorLift, refactor dependent methods to use it
- Expand ScissorLiftCheckout with associations and methods
- Update Checkout model with additional logic for dashboard use
- Add dashboard and power_dashboard routes
- Expand en.yml locale strings for new dashboard UI
- Update application config and test helper
fix(ppe-collection): extract hardcoded strings to i18n and fix blank barcode in notice
- Add find_by_query to Organization, Participant, ScissorLift, and Tool models
- Add scissor_lift_certified? helper to Participant
- Add current_checkout helper to ScissorLift, refactor dependent methods to use it
- Expand ScissorLiftCheckout with associations and methods
- Update Checkout model with additional logic for dashboard use
- Add dashboard and power_dashboard routes
- Expand en.yml locale strings for new dashboard UI
- Update application config and test helper
…op offenses

- Extract Checkout.checkout_batch / checkin_batch and all private helpers
  into CheckoutBatchOperations concern (fixes Metrics/ClassLength)
- Use module ClassMethods instead of class_methods do to avoid Metrics/BlockLength
- Refactor Tools::CheckoutsController: add before_action for checkin auth/resource
  loading, extract process_checkout_batch and flash helpers (fixes AbcSize,
  CyclomaticComplexity, PerceivedComplexity)
- Rename Participant#is_booth_chair? -> booth_chair? (fixes Naming/PredicatePrefix)
- Extract hardcoded flash strings to i18n in ppe_collection, ppe_distribution,
  and checkouts controllers (fixes Rails/I18nLocaleTexts)
- Inline single-use wrappers empty_checkout_result and missing_tool_result
  in CheckoutBatchOperations
- Merge apply_checkout_error and error_checkout_for_exception into one method
- Rename Participant.find_by_search -> search to avoid Rails/DynamicFindBy
- Fix Participant.find_by_query and find_or_create_by_search to call
  Participant.search instead of find_by(search:) (nonexistent column)
- Fix Tools::CheckoutsController#store_borrower_in_session same bug
- Add explicit `gem 'csv'` (Ruby 3.4 no longer bundles csv)
- Include Application::BreadcrumbsHelper, DocumentTitleHelper, and
  NavigationHelper in ApplicationHelper (were defined but never included)
- Rename Model.find_by_query → Model.lookup on Tool, Participant,
  Organization, and ScissorLift to satisfy Rails/DynamicFindBy
- Update db/schema.rb to reflect resolved duplicate tool_type migration
@tomas-goncalves
tomas-goncalves force-pushed the advanced-dashboard/action-services branch from dac6685 to 456aea7 Compare March 25, 2026 20:33
Prettier/rubocop reformat commits in this branch's history had drifted
these files from master, breaking the YouTube player (javascript_include_tag
lost its <%= tag). Restore all four files to their master state.
Adds the execution services shared by DashboardController and
PowerDashboardController under the Dashboard:: namespace:
- ActionExecutor, ActionRegistry, ReceiptBuilder, SessionState
- QueueResource, ScissorLiftOverviewResource
- All 19 action handler classes (Dashboard::Actions::*)

Tests for these services are covered by dashboard_controller_test.rb
(via the complete/execute actions) and will be further validated by
power_dashboard_actions_test.rb in the PowerDashboard Backend PR.
Adds en.locale keys used by Dashboard::Actions::* classes:
resources.labels, resources.receipts, resources.tool,
resources.scissor_lift, resources.queue, resources.session, etc.
Used by ScanResolver for the lookup flow target. Depends only on
model find_by_query methods from the foundation PR.
- auto_add_tools? now defaults to true (session opt-out instead of opt-in)
- checkin/checkout resolve context automatically without keyword qualifiers:
    lift selected → lift action
    cart has items → cart action
    tool selected → single-resource action
  Explicit keywords (lift, cart) still override context.
- New Dashboard::Actions::ToolDirectCheckout for checking out the current
  tool directly when no cart items are present
- Pass current_ability object instead of method(:can?) so action classes
  can call ability.can? directly (cleaner than .call)
- Prefix all unused keyword arguments with _ across action classes
- Use anonymous keyword forwarding (**) on Base#t
- Autocorrect Layout, Style, and Rails violations across all action files
@tomas-goncalves
tomas-goncalves force-pushed the advanced-dashboard/action-services branch from 456aea7 to 52ae040 Compare March 25, 2026 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants