Skip to content

Commit

Permalink
Merge branch 'main' into chore/remove-unwanted-runtime-deps
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianthedev authored Sep 17, 2024
2 parents c501176 + a645e9a commit ed8bc0f
Show file tree
Hide file tree
Showing 31 changed files with 919 additions and 364 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/feature-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@v1
Expand All @@ -62,7 +62,7 @@ jobs:
bundler: default
ruby-version: ${{ matrix.ruby }}

- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: vendor/bundle
key: ${{ runner.os }}-test-gems-${{ hashFiles('**/Gemfile.lock') }}
Expand All @@ -78,9 +78,9 @@ jobs:
- name: Get yarn cache directory path
id: test-yarn-cache-dir-path
run: echo "name=dir::$(yarn cache dir)" >> $GITHUB_OUTPUT
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
- uses: actions/cache@v4
id: test-yarn-cache
with:
path: ${{ steps.test-yarn-cache-dir-path.outputs.dir }}
Expand Down Expand Up @@ -109,12 +109,12 @@ jobs:
id: run_tests
run: bundle exec rspec spec/features

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: coverage_features_${{ matrix.rails }}_ruby_${{ matrix.ruby }}
path: coverage/.resultset.json

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: always() && steps.run_tests.outcome == 'failure'
with:
name: rspec_failed_screenshots_rails_${{ matrix.rails }}_ruby_${{ matrix.ruby }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/i18n-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@v1
Expand All @@ -59,7 +59,7 @@ jobs:
bundler: default
ruby-version: ${{ matrix.ruby }}

- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: vendor/bundle
key: ${{ runner.os }}-test-gems-${{ hashFiles('**/Gemfile.lock') }}
Expand All @@ -75,9 +75,9 @@ jobs:
- name: Get yarn cache directory path
id: test-yarn-cache-dir-path
run: echo "name=dir::$(yarn cache dir)" >> $GITHUB_OUTPUT
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
- uses: actions/cache@v4
id: test-yarn-cache
with:
path: ${{ steps.test-yarn-cache-dir-path.outputs.dir }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/system-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@v1
Expand All @@ -61,7 +61,7 @@ jobs:
bundler: default
ruby-version: ${{ matrix.ruby }}

- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: vendor/bundle
key: ${{ runner.os }}-test-gems-${{ hashFiles('**/Gemfile.lock') }}
Expand All @@ -77,9 +77,9 @@ jobs:
- name: Get yarn cache directory path
id: test-yarn-cache-dir-path
run: echo "name=dir::$(yarn cache dir)" >> $GITHUB_OUTPUT
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
- uses: actions/cache@v4
id: test-yarn-cache
with:
path: ${{ steps.test-yarn-cache-dir-path.outputs.dir }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-tailwindcss-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
with:
repository: avo-hq/avo_tailwindcss_test_repo

- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: vendor/bundle
key: ${{ runner.os }}-test-gems-${{ hashFiles('**/Gemfile.lock') }}
Expand Down
59 changes: 30 additions & 29 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ GIT

GIT
remote: https://github.com/rails/rails.git
revision: c692e75d96f572f3fe518f06bec0dfd12b548429
revision: 281a00a46e0d629fea3bce3ca2bd89fa4e860171
branch: main
specs:
actioncable (8.0.0.alpha)
Expand Down Expand Up @@ -70,6 +70,7 @@ GIT
marcel (~> 1.0)
activesupport (8.0.0.alpha)
base64
benchmark (>= 0.3)
bigdecimal
concurrent-ruby (~> 1.0, >= 1.3.1)
connection_pool (>= 2.2.5)
Expand All @@ -79,6 +80,7 @@ GIT
minitest (>= 5.1)
securerandom (>= 0.3)
tzinfo (~> 2.0, >= 2.0.5)
uri (>= 0.13.1)
rails (8.0.0.alpha)
actioncable (= 8.0.0.alpha)
actionmailbox (= 8.0.0.alpha)
Expand Down Expand Up @@ -137,7 +139,7 @@ GEM
acts_as_list (1.2.2)
activerecord (>= 6.1)
activesupport (>= 6.1)
actual_db_schema (0.7.8)
actual_db_schema (0.7.9)
activerecord
activesupport
csv
Expand All @@ -156,17 +158,17 @@ GEM
money-rails (~> 1.12)
avo-record_link_field (0.0.1)
aws-eventstream (1.3.0)
aws-partitions (1.969.0)
aws-sdk-core (3.202.0)
aws-partitions (1.974.0)
aws-sdk-core (3.205.0)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.9)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.88.0)
aws-sdk-core (~> 3, >= 3.201.0)
aws-sdk-kms (1.91.0)
aws-sdk-core (~> 3, >= 3.205.0)
aws-sigv4 (~> 1.5)
aws-sdk-s3 (1.159.0)
aws-sdk-core (~> 3, >= 3.201.0)
aws-sdk-s3 (1.162.0)
aws-sdk-core (~> 3, >= 3.205.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.5)
aws-sigv4 (1.9.1)
Expand Down Expand Up @@ -296,7 +298,7 @@ GEM
rubocop (>= 1)
smart_properties
erubi (1.13.0)
factory_bot (6.4.6)
factory_bot (6.5.0)
activesupport (>= 5.0.0)
factory_bot_rails (6.4.3)
factory_bot (~> 6.4)
Expand Down Expand Up @@ -363,7 +365,7 @@ GEM
image_processing (1.13.0)
mini_magick (>= 4.9.5, < 5)
ruby-vips (>= 2.0.17, < 3)
inline_svg (1.9.0)
inline_svg (1.10.0)
activesupport (>= 3.0)
nokogiri (>= 1.6)
io-console (0.7.2)
Expand All @@ -390,7 +392,7 @@ GEM
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
literal (0.2.1)
logger (1.6.0)
logger (1.6.1)
loofah (2.22.0)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
Expand Down Expand Up @@ -421,7 +423,7 @@ GEM
money (~> 6.13)
railties (>= 3.0)
msgpack (1.7.2)
net-imap (0.4.15)
net-imap (0.4.16)
date
net-protocol
net-pop (0.1.2)
Expand All @@ -437,13 +439,13 @@ GEM
nokogiri (1.16.7-x86_64-linux)
racc (~> 1.4)
orm_adapter (0.5.0)
pagy (9.0.6)
pagy (9.0.9)
parallel (1.26.3)
parser (3.3.4.2)
parser (3.3.5.0)
ast (~> 2.4.1)
racc
path_expander (1.1.2)
pg (1.5.7)
path_expander (1.1.3)
pg (1.5.8)
prefixed_ids (1.8.1)
hashids (>= 1.0.0, < 2.0.0)
rails (>= 6.0.0)
Expand Down Expand Up @@ -498,25 +500,24 @@ GEM
rainbow (>= 2.0, < 4.0)
rexml (~> 3.1)
regexp_parser (2.9.2)
reline (0.5.9)
reline (0.5.10)
io-console (~> 0.5)
responders (3.1.1)
actionpack (>= 5.2)
railties (>= 5.2)
reverse_markdown (2.1.1)
nokogiri
rexml (3.3.6)
strscan
rexml (3.3.7)
ripper-tags (1.0.2)
rspec-core (3.13.0)
rspec-core (3.13.1)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.2)
rspec-expectations (3.13.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-rails (6.1.4)
rspec-rails (6.1.5)
actionpack (>= 6.1)
activesupport (>= 6.1)
railties (>= 6.1)
Expand All @@ -538,7 +539,7 @@ GEM
rubocop-ast (>= 1.31.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.32.1)
rubocop-ast (1.32.3)
parser (>= 3.3.1.0)
rubocop-performance (1.21.1)
rubocop (>= 1.48.1, < 2.0)
Expand Down Expand Up @@ -574,7 +575,7 @@ GEM
simplecov-cobertura (2.1.0)
rexml
simplecov (~> 0.19)
simplecov-html (0.12.3)
simplecov-html (0.13.1)
simplecov-lcov (0.8.0)
simplecov_json_formatter (0.1.4)
smart_properties (1.17.0)
Expand Down Expand Up @@ -620,13 +621,12 @@ GEM
lint_roller (~> 1.1)
rubocop-performance (~> 1.21.0)
stringio (3.1.1)
strscan (3.1.0)
syntax_tree (6.2.0)
prettier_print (>= 1.2.0)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
test-prof (1.4.1)
thor (1.3.1)
test-prof (1.4.2)
thor (1.3.2)
thread_safe (0.3.6)
tilt (2.4.0)
timeout (0.4.1)
Expand All @@ -641,6 +641,7 @@ GEM
concurrent-ruby (~> 1.0)
unaccent (0.4.0)
unicode-display_width (2.5.0)
uri (0.13.1)
useragent (0.16.10)
view_component (3.14.0)
activesupport (>= 5.2.0, < 8.0)
Expand All @@ -667,8 +668,8 @@ GEM
websocket-extensions (0.1.5)
xpath (3.2.0)
nokogiri (~> 1.8)
yard (0.9.36)
zeitwerk (2.6.17)
yard (0.9.37)
zeitwerk (2.6.18)

PLATFORMS
ruby
Expand Down
4 changes: 2 additions & 2 deletions app/components/avo/base_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
class Avo::BaseComponent < ViewComponent::Base
extend Literal::Properties
include Turbo::FramesHelper
include Avo::Concerns::FindAssociationField

def has_with_trial(ability)
Avo.license.has_with_trial(ability)
Expand All @@ -12,8 +13,7 @@ def has_with_trial(ability)

# Use the @parent_resource to fetch the field using the @reflection name.
def field
reflection_name = params[:related_name]&.to_sym || @reflection.name
@parent_resource.get_field(reflection_name)
find_association_field(resource: @parent_resource, association: params[:related_name] || @reflection.name)
rescue
nil
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Avo::Fields::Common::Files::ControlsComponent < Avo::BaseComponent
delegate :id, to: :@field

prop :field, Avo::Fields::BaseField
prop :file, ActiveStorage::Attachment
prop :file, _Any
prop :resource, Avo::BaseResource

def destroy_path
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
class Avo::Fields::Common::Files::ViewType::GridItemComponent < Avo::BaseComponent
prop :field, Avo::Fields::BaseField
prop :resource, Avo::BaseResource
prop :file, _Nilable(ActiveStorage::Attachment)
prop :file, _Nilable(_Any)
prop :extra_classes, _Nilable(String)

def id
Expand Down
10 changes: 1 addition & 9 deletions app/components/avo/index/resource_controls_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

class Avo::Index::ResourceControlsComponent < Avo::ResourceComponent
include Avo::ApplicationHelper
include Avo::Concerns::ChecksShowAuthorization

prop :resource, _Nilable(Avo::BaseResource)
prop :reflection, _Nilable(ActiveRecord::Reflection::AbstractReflection)
Expand All @@ -20,15 +21,6 @@ def can_edit?
@resource.authorization.authorize_action(:edit, raise_exception: false)
end

def can_view?
return false if Avo.configuration.resource_default_view.edit?

return authorize_association_for(:show) if @reflection.present?

# Even if there's a @reflection object present, for show we're going to fallback to the original policy.
@resource.authorization.authorize_action(:show, raise_exception: false)
end

def show_path
helpers.resource_show_path(resource: @resource, parent_or_child_resource: parent_or_child_resource, parent_resource: parent_resource, parent_record: @parent_record)
end
Expand Down
5 changes: 4 additions & 1 deletion app/components/avo/index/table_row_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

class Avo::Index::TableRowComponent < Avo::BaseComponent
include Avo::ResourcesHelper
include Avo::Concerns::ChecksShowAuthorization

attr_writer :header_fields

Expand All @@ -24,5 +25,7 @@ def resource_controls_component
)
end

def click_row_to_view_record = Avo.configuration.click_row_to_view_record
def click_row_to_view_record
Avo.configuration.click_row_to_view_record && can_view?
end
end
2 changes: 1 addition & 1 deletion app/components/avo/profile_item_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Avo::ProfileItemComponent < Avo::BaseComponent
value&.to_sym
end
prop :title, _Nilable(String), reader: :public
prop :method, _Nilable(String), reader: :public
prop :method, _Nilable(_Union(_String, _Symbol)), reader: :public
prop :params, _Nilable(Hash), default: {}.freeze, reader: :public
prop :classes, String, default: "", reader: :public

Expand Down
Loading

0 comments on commit ed8bc0f

Please sign in to comment.