Skip to content

feat(dashboard): flow-based dashboard view and controller - #396

Closed
tomas-goncalves wants to merge 39 commits into
sc0v:masterfrom
tomas-goncalves:advanced-dashboard/dashboard
Closed

feat(dashboard): flow-based dashboard view and controller#396
tomas-goncalves wants to merge 39 commits into
sc0v:masterfrom
tomas-goncalves:advanced-dashboard/dashboard

Conversation

@tomas-goncalves

Copy link
Copy Markdown
Contributor

Summary

  • Adds a flow-based dashboard at /dashboard with multi-step flows for checkout, checkin, queue, lift, and lookup
  • Each button includes a short description line to guide operators through the flow
  • Dashboard action services and resource classes under the Dashboard:: namespace

Stack

Merge in order:

  1. feat(foundation): model helpers and config for advanced dashboard #374 advanced-dashboard/foundationmaster
  2. This PR advanced-dashboard/dashboardmaster
  3. advanced-dashboard/power-dashboard-backendmaster
  4. advanced-dashboard/autocompletemaster

To review only what this PR adds, compare against advanced-dashboard/foundation.

…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
merichar and others added 6 commits March 11, 2026 15:35
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
@tomas-goncalves
tomas-goncalves force-pushed the advanced-dashboard/dashboard branch from 3cb0b20 to cf378ae Compare March 25, 2026 08:10
- 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/dashboard branch from cf378ae to e060516 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
- Add DashboardController with flow state management
- Add Dashboard services: FlowDefinition, FlowState, FlowUpdater, PendingBuilder, ScanResolver, ShowContextBuilder
- Add dashboard views (show, confirm, result)
- Add DashboardHelper
- Add auto_submit Stimulus controller
- Add dashboard routes
- Add controller and unit tests
- Restore before_action :require_authentication in DashboardController
- Add power-dashboard shared styles and dashboard-flow styles to binder.css
- Excludes autocomplete and power-layout styles (deferred to later PRs)
Step names are already shown in the h1 via dashboard_h1. Remove
duplicate <p>Select ...</p> paragraphs above forms.
Use ::PowerDashboard:: to avoid Ruby resolving relative to
DashboardController. Guard action_requires_confirmation? so the
dashboard wizard works before PowerDashboard (PR C) is available.
Replace ::PowerDashboard:: references with Dashboard:: following the
rename of execution services in the action-services PR.
Moved from PowerDashboardHelper which is not yet available.
Used by the confirm view to render receipt lines.
Moved from PowerDashboardHelper. Uses Dashboard:: namespace for
QueueResource and ScissorLiftOverviewResource. Partials are deferred
to the Power Dashboard Frontend PR.
Move resource partials to shared/resources/ so they work in both
dashboard and power dashboard. Add lift_overview_* helpers to
DashboardHelper. Update current_resource_config to point to
shared/resources/ partials.
Autocomplete controller and route are deferred to the autocomplete PR.
Display each active queue the organization is in (electrical/structural)
with its position and message.
…ttons

Replace submit_tag with button_tag to support two-line button content,
adding a short description span beneath each label. Add .btn-description
CSS rule for smaller, lighter text styling.

Buttons updated: Checkout, Checkin, Queue, Lift, Lookup (flow selection);
Electrical, Structural (queue type); Add, Remove, View Current (queue action);
By User, By Org (queue source); Checkout Lift, Checkin Lift, Renew, View
Current (lift action).
- Replace is_checked_out? with checked_out? in views and services
- Rename find_by_query → lookup at all call sites (scan_resolver,
  resource_lookup); refactor resource_lookup to use || chain helper
- Refactor DashboardHelper: extract STEP_LABELS constant to replace
  case/when dispatch, extract apply_resource_display_config and
  receipt_list_html, compact lift_overview_* methods
- Refactor ScissorLiftOverviewResource#lifts using ternary for remaining
- Autocorrect Layout, Style, and Rails violations in flow_state,
  flow_updater, pending_builder, session_state, show_context_builder
@tomas-goncalves
tomas-goncalves force-pushed the advanced-dashboard/dashboard branch from e060516 to f25ad91 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