Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] main from solidusio:main #390

Merged
merged 41 commits into from
Jan 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
29d6a81
Fix property destroy - use destroy instead of discard
tonxyx Dec 29, 2023
8411f05
Merge pull request #5577 from tonxyx/fix-property-destroy
elia Jan 2, 2024
7c5c12b
Fix top rounded borders on the ui/table component
elia Dec 28, 2023
784ae12
Let the admin alpha features preference setter not have a question mark
elia Dec 29, 2023
8a98d20
Reuse the sandbox Procfile.dev in the main Procfile.dev
elia Dec 29, 2023
a73abe8
Create ui/pages/index component
rainerdema Dec 18, 2023
455bdce
Use ui/pages/index component in products/index component
rainerdema Dec 18, 2023
f25b512
Use ui/pages/index component in orders/index component
rainerdema Dec 18, 2023
7ac8c84
Use ui/pages/index component in option_types/index component
rainerdema Dec 21, 2023
59d7e35
Use ui/pages/index component in zones/index component
rainerdema Dec 21, 2023
13e5d00
Use ui/pages/index component in users/index component
rainerdema Dec 21, 2023
2c32de6
Use ui/pages/index component in taxonomies/index component
rainerdema Dec 21, 2023
a9a15f1
Use ui/pages/index component in stores/index component
rainerdema Dec 21, 2023
6f264b4
Use ui/pages/index component in stock_items/index component
rainerdema Dec 21, 2023
7973173
Use ui/pages/index component in propertiies/index component
rainerdema Dec 21, 2023
5b29bc6
Use ui/pages/index component in promotions/index component
rainerdema Dec 21, 2023
81b3481
Use ui/pages/index component in promotion_categories/index component
rainerdema Dec 21, 2023
a042db7
Use ui/pages/index component in payment_methods/index component
rainerdema Dec 21, 2023
6d63008
Add support for inheritable translations
elia Dec 29, 2023
26074da
Extract common index pages translations to the super component
elia Dec 28, 2023
ed0c6cb
Use ui/pages/index component tabbed index components
elia Dec 29, 2023
c016d80
Add back styles to the preview layout
elia Jan 2, 2024
e5f001d
Merge pull request #5561 from nebulab/rainerd+elia/admin/index-component
elia Jan 3, 2024
ba60db3
Merge the coverage command and job
elia Jan 3, 2024
6948a97
Fix the admin/properties spec filename
elia Jan 3, 2024
811d3ba
Add coverage for editing stock items in the admin
elia Jan 3, 2024
dcab63a
Add a missing spec for the admin/tax_rates section
elia Jan 3, 2024
0025c04
Add spec coverage for missing translations handling
elia Jan 3, 2024
4465f02
Add coverage for importing backend menu items into the admin
elia Jan 3, 2024
80284f8
Manually set the Rails version accepting both version numbers and bra…
elia Jan 3, 2024
bdf29dc
Add Rails main branch to Circle CI test matrix
peterberkenbosch Aug 26, 2023
399922f
Remove unused YAML references
elia Dec 29, 2023
11a35d3
Get known rails branches from the git repo
elia Dec 29, 2023
d01b825
Merge pull request #5574 from solidusio/elia/restore-rails-main-specs
elia Jan 3, 2024
4c635fe
Merge pull request #5580 from solidusio/elia/restore-coverage-uploads
elia Jan 3, 2024
2b28f94
Release solidus_admin/v0.2.0
elia Jan 3, 2024
0b9ca18
Run each subframework's specs separately
elia Jan 5, 2024
be5fea9
Merge pull request #5583 from solidusio/elia/separate-subframeworks-c…
elia Jan 5, 2024
8f997be
Fix the check on select2 translations asset existence
elia Jan 5, 2024
5eeae45
Merge pull request #5582 from solidusio/elia/fix-select2-locales-load…
elia Jan 5, 2024
9d29194
Ensure draft releases name and tag-name are handled in release scripts
elia Jan 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 57 additions & 39 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,23 @@ commands:
test:
steps:
- run:
name: Run Tests
command: ./bin/build-ci
name: "Run Admin Tests"
command: ./bin/build-ci admin
- run:
name: "Run Api Tests"
command: ./bin/build-ci api
- run:
name: "Run Backend Tests"
command: ./bin/build-ci backend
- run:
name: "Run Backend JS Tests"
command: ./bin/build-ci "backend JS"
- run:
name: "Run Core Tests"
command: ./bin/build-ci core
- run:
name: "Run Sample Tests"
command: ./bin/build-ci sample

- store_artifacts:
path: /tmp/test-artifacts
Expand All @@ -114,30 +129,6 @@ commands:
- store_test_results:
path: /tmp/test-results

test_with_coverage:
# This command creates a dir to hold coverage data, run test suites with coverage enabled and
# generate the coverage report.
description: Run Tests With Coverage Enabled
steps:
- run:
name: Setup Coverage Env Vars
command: |
echo 'export COVERAGE_FILE=$COVERAGE_DIR/coverage.xml' >> $BASH_ENV
source $BASH_ENV
- run:
name: Verify Coverage Env Vars
command: |
echo $COVERAGE
echo $COVERAGE_DIR
echo $COVERAGE_FILE
- run:
name: Setup Coverage Directory
command: mkdir -p $COVERAGE_DIR
- test
- run:
name: Report Coverage
command: bundle exec rake solidus:coverage[cobertura]

libvips:
steps:
- run:
Expand Down Expand Up @@ -299,53 +290,77 @@ jobs:
default: '3.2'
rails:
type: string
default: "7.0"
default: "7.1"
paperclip:
type: boolean
default: true
executor:
name: << parameters.database >>
ruby: << parameters.ruby >>
parallelism: &parallelism 3
parallelism: 3
environment:
DISABLE_ACTIVE_STORAGE: << parameters.paperclip >>
RAILS_VERSION: "~> << parameters.rails >>"
BUILDKITE_ANALYTICS_EXECUTION_NAME_PREFIX: "(<< parameters.ruby >>:<< parameters.rails >>:<< parameters.database >>:<< parameters.paperclip >>)"
steps:
- checkout
- run:
name: "Set the RAILS_VERSION environment variable"
command: |
# If << parameters.rails >> is a kown branch name, use the latest version of that branch
# otherwise interpret it as a partial version number.
RAILS_VERSION=$(echo "<< parameters.rails >>" | grep -qE "(stable|main)" && echo "~> << parameters.rails >>.0" || echo "<< parameters.rails >>")
echo "RAILS_VERSION=$RAILS_VERSION" >> $BASH_ENV
source $BASH_ENV
- setup
- test

# This job creates a dir to hold coverage data, run test suites with coverage enabled and
# generate the coverage report.
test_solidus_with_coverage:
parameters:
database:
type: string
default: postgres
ruby:
type: string
default: '3.1'
default: '3.2'
executor:
name: << parameters.database >>
ruby: << parameters.ruby >>
parallelism: &parallelism 3
parallelism: 3
environment:
COVERAGE: 'true'
COVERAGE_DIR: /tmp/coverage
DISABLE_ACTIVE_STORAGE: false
steps:
- setup
- test_with_coverage
- run:
name: Setup Coverage Env Vars
command: |
echo 'export COVERAGE_FILE=/tmp/coverage/coverage.xml' >> $BASH_ENV
source $BASH_ENV
- run:
name: Verify Coverage Env Vars
command: |
echo $COVERAGE
echo /tmp/coverage
echo /tmp/coverage/coverage.xml
- run:
name: Setup Coverage Directory
command: mkdir -p /tmp/coverage
- test
- run:
name: Report Coverage
command: bundle exec rake solidus:coverage[cobertura]
- codecov/upload:
file: /tmp/coverage/coverage.xml

workflows:
build:
jobs:
- lint_code
- solidus_installer

# Only test with coverage support with the default versions
- test_solidus_with_coverage:
post-steps:
- codecov/upload:
file: $COVERAGE_FILE
- test_solidus_with_coverage # Only test with coverage support with the default versions

# Based on supported versions for the current Solidus release and recommended versions from
# https://www.fastruby.io/blog/ruby/rails/versions/compatibility-table.html.
Expand All @@ -357,4 +372,7 @@ workflows:
matrix: { parameters: { rails: ['7.0', '7.1'], ruby: ['3.1'], database: ['postgres'], paperclip: [false] } }
- test_solidus:
name: *name
matrix: { parameters: { rails: ['7.0', '7.1'], ruby: ['3.2'], database: ['sqlite'], paperclip: [false] } }
matrix: { parameters: { rails: ['7.0'], ruby: ['3.2'], database: ['sqlite'], paperclip: [false] } }
- test_solidus:
name: *name
matrix: { parameters: { rails: ['7.1', 'main'], ruby: ['3.3'], database: ['sqlite'], paperclip: [false] } }
2 changes: 1 addition & 1 deletion .github/workflows/update_release_draft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ jobs:
--update \
--branch ${{ github.ref_name }} \
${{ steps.pipeline_context.outputs.current_diff_source_tag }} \
${{ steps.pipeline_context.outputs.candidate_tag }} \
${{ steps.pipeline_context.outputs.candidate_tag }}
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ source 'https://rubygems.org'
gemspec require: false

# rubocop:disable Bundler/DuplicatedGem
if ENV['RAILS_VERSION'] == 'main'
gem 'rails', github: 'rails', require: false
if /(stable|main)/.match? ENV['RAILS_VERSION']
gem 'rails', github: 'rails', require: false, branch: ENV['RAILS_VERSION']
else
gem 'rails', ENV['RAILS_VERSION'] || '~> 7.1.0', require: false
end
Expand Down
5 changes: 2 additions & 3 deletions Procfile.dev
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
web: env RUBY_DEBUG_OPEN=true bin/rails server
css: bin/rails tailwindcss:watch
admin_tailwind: bundle exec rake -C admin tailwindcss:watch
sandbox: foreman start -d sandbox -f sandbox/Procfile.dev
admin: bundle exec rake -C admin tailwindcss:watch
2 changes: 1 addition & 1 deletion admin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ bin/rails admin g solidus_admin:component foo
## Releasing

1. Update the version in `lib/solidus_admin/version.rb`
2. Commit the changes with the message `Release v1.2.3`
2. Commit the changes with the message `Release solidus_admin/v1.2.3`
3. `cd admin; bundle exec rake release`
4. Manually release on GitHub

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
# frozen_string_literal: true

class SolidusAdmin::AdjustmentReasons::Index::Component < SolidusAdmin::BaseComponent
include SolidusAdmin::Layout::PageHelpers

def initialize(page:)
@page = page
class SolidusAdmin::AdjustmentReasons::Index::Component < SolidusAdmin::RefundsAndReturns::Component
def model_class
Spree::AdjustmentReason
end

def title
Spree::AdjustmentReason.model_name.human.pluralize
def search_url
solidus_admin.adjustment_reasons_path
end

def prev_page_path
solidus_admin.url_for(**request.params, page: @page.number - 1, only_path: true) unless @page.first?
def search_key
:name_or_code_cont
end

def next_page_path
solidus_admin.url_for(**request.params, page: @page.next_param, only_path: true) unless @page.last?
def row_url(adjustment_reason)
spree.edit_admin_adjustment_reason_path(adjustment_reason)
end

def batch_actions
Expand All @@ -30,14 +28,6 @@ def batch_actions
]
end

def scopes
[]
end

def filters
[]
end

def columns
[
:name,
Expand Down

This file was deleted.

30 changes: 29 additions & 1 deletion admin/app/components/solidus_admin/base_component.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# frozen_string_literal: true

require "view_component/version"
require "view_component/translatable"

module SolidusAdmin
# BaseComponent is the base class for all components in Solidus Admin.
class BaseComponent < ViewComponent::Base
Expand All @@ -10,12 +13,37 @@ def icon_tag(name, **attrs)
render component("ui/icon").new(name: name, **attrs)
end

module InheritableTranslations
def build_i18n_backend
return if compiled?

# We need to load the translations files from the ancestors so a component
# can inherit translations from its parent and is able to overwrite them.
translation_files = ancestors.reverse_each.with_object([]) do |ancestor, files|
if ancestor.is_a?(Class) && ancestor < ViewComponent::Base
files.concat(ancestor.sidecar_files(%w[yml yaml].freeze))
end
end

# In development it will become nil if the translations file is removed
self.i18n_backend = if translation_files.any?
ViewComponent::Translatable::I18nBackend.new(
i18n_scope: i18n_scope,
load_paths: translation_files
)
end
end
end

# Can be removed once https://github.com/ViewComponent/view_component/pull/1934 is released
extend InheritableTranslations unless Gem::Version.new(ViewComponent::VERSION::STRING) >= Gem::Version.new("3.9")

def missing_translation(key, options)
keys = I18n.normalize_keys(options[:locale] || I18n.locale, key, options[:scope])

logger.debug " [#{self.class}] Missing translation: #{keys.join('.')}"

if options[:locale] != :en
if (options[:locale] || I18n.default_locale) != :en
t(key, **options, locale: :en)
else
"translation missing: #{keys.join('.')}"
Expand Down

This file was deleted.

26 changes: 20 additions & 6 deletions admin/app/components/solidus_admin/option_types/index/component.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,28 @@
# frozen_string_literal: true

class SolidusAdmin::OptionTypes::Index::Component < SolidusAdmin::BaseComponent
include SolidusAdmin::Layout::PageHelpers
class SolidusAdmin::OptionTypes::Index::Component < SolidusAdmin::UI::Pages::Index::Component
def model_class
Spree::OptionType
end

def row_url(option_type)
spree.edit_admin_option_type_path(option_type)
end

def initialize(page:)
@page = page
def sortable_options
{
url: ->(option_type) { solidus_admin.move_option_type_path(option_type) },
param: 'position',
}
end

def title
Spree::OptionType.model_name.human.pluralize
def page_actions
render component("ui/button").new(
tag: :a,
text: t('.add'),
href: spree.new_admin_option_type_path,
icon: "add-line",
)
end

def prev_page_path
Expand Down
Loading
Loading