Skip to content

Conversation

@chaimann
Copy link
Contributor

@chaimann chaimann commented Apr 30, 2025

Summary

Closes #6155

Introduces new UI for zones creation and modification.

Other new stuff:

  • states_controller - new resource to return states, responds with JSON by default;
  • state_blueprint - for JSON representation of the states to return, uses Blueprinter
  • gem "db-query-matchers" - for N+1 testing
  • few helpers for common buttons
  • helpers for stimulus data attributes

Showcase

Screen.Recording.2025-04-30.at.13.05.21.mov

Checklist

@chaimann chaimann self-assigned this Apr 30, 2025
@github-actions github-actions bot added changelog:solidus_core Changes to the solidus_core gem changelog:solidus_admin labels Apr 30, 2025
@chaimann chaimann removed this from Solidus Admin Apr 30, 2025
@codecov
Copy link

codecov bot commented Apr 30, 2025

Codecov Report

Attention: Patch coverage is 98.16514% with 2 lines in your changes missing coverage. Please review.

Project coverage is 88.86%. Comparing base (f60d39d) to head (9b7e333).
Report is 23 commits behind head on main.

Files with missing lines Patch % Lines
core/app/models/spree/state.rb 33.33% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6224      +/-   ##
==========================================
+ Coverage   88.82%   88.86%   +0.04%     
==========================================
  Files         851      857       +6     
  Lines       18348    18415      +67     
==========================================
+ Hits        16298    16365      +67     
  Misses       2050     2050              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jarednorman
Copy link
Member

If you used Canada in the video in an effort to get me to pay attention to this video, it worked. 🙂

@chaimann chaimann force-pushed the admin-zones-add-edit branch 2 times, most recently from 987a16e to a443fca Compare April 30, 2025 18:06
@chaimann chaimann marked this pull request as ready for review April 30, 2025 18:37
@chaimann chaimann requested a review from a team as a code owner April 30, 2025 18:37
@tvdeyen tvdeyen force-pushed the admin-zones-add-edit branch from a443fca to 603ca9b Compare May 28, 2025 15:15
Copy link
Member

@tvdeyen tvdeyen left a comment

Choose a reason for hiding this comment

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

Works great

@tvdeyen
Copy link
Member

tvdeyen commented May 28, 2025

@chaimann do you mind to run rubocop -a ?

@github-actions github-actions bot added changelog:solidus_api Changes to the solidus_api gem changelog:solidus_legacy_promotions Changes to the solidus_legacy_promotions gem labels May 28, 2025
@chaimann
Copy link
Contributor Author

@tvdeyen done, though there are 11 unsafe autocorrections which i have not run. Guess we'll just wait for #6240 to be released?

@chaimann chaimann force-pushed the admin-zones-add-edit branch from 32c4493 to 5b39007 Compare May 30, 2025 21:38
chaimann added 12 commits June 2, 2025 20:57
Extend `AllowedNames` to include `on`.
To avoid lag when rendering states options for zone form, use "src"
attribute that will point "solidus-select" to the resource that contains
all states.

Installed:
- blueprinter - for object serialization;

Introduced:
- state_blueprint - simple serializer with a "state_with_country" view
for zones states select;
- states_controller - resource with states;
- states_with_country now caches the result, as states/countries are not
going to be updated regularly, so we can save on preloading countries on each
 request, allowing the values to be cached over time;
- resources_controller#index - added ability to respond to json format
chaimann added 10 commits June 2, 2025 20:57
No need to pass `value` argument to forms/field component,
as value is being calculated when calling `#select`.
Shorter way to get the value from object
Installed "db-query-matchers" for N+1 tests
There's some bug with Rubocop that even though `on` is
specified as allowed parameter name, rubocop still complains
TIL yaml treats true, on and yes as boolean values. So there was no
Rubocop bug, but rather `on` was not treated as a string literal.
@tvdeyen tvdeyen force-pushed the admin-zones-add-edit branch from 5b39007 to 9b7e333 Compare June 2, 2025 18:57
@tvdeyen tvdeyen moved this to Review in Solidus Admin Jun 2, 2025
@tvdeyen tvdeyen enabled auto-merge June 2, 2025 18:58
@tvdeyen tvdeyen merged commit 2aed8c3 into solidusio:main Jun 2, 2025
22 of 23 checks passed
@github-project-automation github-project-automation bot moved this from Review to Done in Solidus Admin Jun 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog:solidus_admin changelog:solidus_api Changes to the solidus_api gem changelog:solidus_core Changes to the solidus_core gem changelog:solidus_legacy_promotions Changes to the solidus_legacy_promotions gem

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Admin][Settings] Introduce zone creation and modification capability

3 participants