Skip to content

Commit

Permalink
Update avo to 2.42.1
Browse files Browse the repository at this point in the history
Fix the incompatibilities caused by 2.36
  • Loading branch information
segiddins authored and simi committed Oct 17, 2023
1 parent e13a6cb commit b56629f
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ gem "maintenance_tasks", "~> 2.1"
gem "strong_migrations", "~> 1.6"

# Admin dashboard
gem "avo", "~> 2.28", "< 2.36" # 2.36+ requires to fix test failures
gem "avo", "~> 2.42"
gem "view_component", "~> 2.0"
gem "pundit", "~> 2.3"
gem "chartkick", "~> 5.0"
Expand Down
12 changes: 6 additions & 6 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ GEM
attr_required (1.0.1)
autoprefixer-rails (10.4.15.0)
execjs (~> 2)
avo (2.35.0)
avo (2.42.1)
actionview (>= 6.0)
active_link_to
activerecord (>= 6.0)
Expand Down Expand Up @@ -357,8 +357,8 @@ GEM
marcel (1.0.2)
matrix (0.4.2)
memory_profiler (1.0.1)
meta-tags (2.18.0)
actionpack (>= 3.2.0, < 7.1)
meta-tags (2.19.0)
actionpack (>= 3.2.0, < 7.2)
method_source (1.0.0)
mini_histogram (0.3.1)
mini_mime (1.1.5)
Expand Down Expand Up @@ -438,7 +438,7 @@ GEM
openssl-signature_algorithm (1.3.0)
openssl (> 2.0)
optimist (3.0.1)
pagy (6.0.4)
pagy (6.1.0)
parallel (1.22.1)
parser (3.2.1.1)
ast (~> 2.4.1)
Expand Down Expand Up @@ -638,7 +638,7 @@ GEM
bindata (~> 2.4)
openssl (> 2.0)
openssl-signature_algorithm (~> 1.0)
turbo-rails (1.4.0)
turbo-rails (1.5.0)
actionpack (>= 6.0.0)
activejob (>= 6.0.0)
railties (>= 6.0.0)
Expand Down Expand Up @@ -697,7 +697,7 @@ DEPENDENCIES
aggregate_assertions (~> 0.2.0)
amazing_print (~> 1.4)
autoprefixer-rails (~> 10.4)
avo (~> 2.28, < 2.36)
avo (~> 2.42)
aws-sdk-s3 (~> 1.119)
aws-sdk-sqs (~> 1.53)
bcrypt (~> 3.1, >= 3.1.18)
Expand Down
2 changes: 1 addition & 1 deletion app/avo/actions/base_action.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class BaseAction < Avo::BaseAction
def self.inherited(base)
super
base.items_holder = Avo::ItemsHolder.new
base.items_holder.items.replace items_holder.items.deep_dup
base.items_holder.instance_variable_get(:@items).replace items_holder.instance_variable_get(:@items).deep_dup
base.items_holder.invalid_fields.replace items_holder.invalid_fields.deep_dup
end

Expand Down
2 changes: 1 addition & 1 deletion app/avo/fields/nested_field.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def initialize(name, stacked: true, **args, &block)
end

def fields(**_kwargs)
@items_holder.items.grep Avo::Fields::BaseField
@items_holder.instance_variable_get(:@items).grep Avo::Fields::BaseField
end

def field(name, **kwargs, &)
Expand Down
6 changes: 3 additions & 3 deletions app/avo/resources/admin_github_user_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ class AdminGitHubUserResource < Avo::BaseResource
field :is_admin, as: :boolean, readonly: true
field :login, as: :text, readonly: true,
as_html: true,
format_using: ->(value) { link_to value, "https://github.com/#{value}" }
format_using: -> { link_to value, "https://github.com/#{value}" }
field :avatar_url, as: :external_image, name: "Avatar", readonly: true
field :github_id, as: :text, readonly: true
field :oauth_token, as: :text, visible: ->(resource:) { false } # rubocop:disable Lint/UnusedBlockArgument

heading "Details"

field :teams, as: :tags, readonly: true, format_using: ->(teams) { teams.pluck(:slug) }
field :teams, as: :tags, readonly: true, format_using: -> { value.pluck(:slug) }

field :info_data,
as: :code, readonly: true, language: :javascript,
format_using: ->(info_data) { JSON.pretty_generate info_data }
format_using: -> { JSON.pretty_generate value }

field :audits, as: :has_many
end
2 changes: 1 addition & 1 deletion app/avo/resources/concerns/avo_auditable_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Concerns::AvoAuditableResource
def inherited(base)
super
base.items_holder = Avo::ItemsHolder.new
base.items_holder.items.replace items_holder.items.deep_dup
base.items_holder.instance_variable_get(:@items).replace items_holder.instance_variable_get(:@items).deep_dup
base.items_holder.invalid_fields.replace items_holder.invalid_fields.deep_dup
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/avo/resources/gem_download_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class SpecificityFilter < ScopeBooleanFilter; end

field :rubygem, as: :belongs_to
field :version, as: :belongs_to
field :count, as: :number, sortable: true, index_text_align: :right, format_using: ->(value) { value.to_fs(:delimited) }, default: 0
field :count, as: :number, sortable: true, index_text_align: :right, format_using: -> { value.to_fs(:delimited) }, default: 0

field :id, as: :id, hide_on: :index
end
2 changes: 1 addition & 1 deletion app/avo/resources/linkset_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ class LinksetResource < Avo::BaseResource
field :rubygem, as: :belongs_to

Linkset::LINKS.each do |link|
field link, as: :text, format_using: ->(value) { link_to value, value if value.present? }
field link, as: :text, format_using: -> { link_to value, value if value.present? }
end
end
2 changes: 1 addition & 1 deletion app/avo/resources/oidc_api_key_role_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class OIDCApiKeyRoleResource < Avo::BaseResource
field :provider, as: :belongs_to
field :user, as: :belongs_to, searchable: true
field :api_key_permissions, as: :nested do
field :valid_for, as: :text, format_using: :iso8601
field :valid_for, as: :text, format_using: -> { value&.iso8601 }
field :scopes, as: :tags, suggestions: ApiKey::API_SCOPES.map { { label: _1, value: _1 } }, enforce_suggestions: true
field :gems, as: :tags, suggestions: -> { Rubygem.limit(10).pluck(:name).map { { value: _1, label: _1 } } }
end
Expand Down
2 changes: 1 addition & 1 deletion app/avo/resources/user_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class UserResource < Avo::BaseResource
field :email_reset, as: :boolean
field :handle, as: :text
field :public_email, as: :boolean
field :twitter_username, as: :text, as_html: true, format_using: ->(value) { link_to value, "https://twitter.com/#{value}", target: :_blank, rel: :noopener if value.present? }
field :twitter_username, as: :text, as_html: true, format_using: -> { link_to value, "https://twitter.com/#{value}", target: :_blank, rel: :noopener if value.present? }
field :unconfirmed_email, as: :text

field :mail_fails, as: :number
Expand Down
4 changes: 2 additions & 2 deletions test/system/avo/oidc_api_key_roles_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def sign_in_as(user)
user = create(:user)

visit avo.resources_oidc_api_key_roles_path
click_on "Create new oidc api key role"
click_on "Create new OIDC api key role"

select provider.issuer, from: "oidc_api_key_role_oidc_provider_id"
find_field(id: "oidc_api_key_role_user_id").click
Expand All @@ -50,7 +50,7 @@ def sign_in_as(user)
assert_field "oidc_api_key_role_oidc_provider_id", with: provider.id
assert_field "oidc_api_key_role_user_id", with: user.display_handle
assert_field "Name", with: "Role"
assert_field "Valid for", with: "900"
assert_field "Valid for", with: "PT15M"

find("div[data-field-id='scopes'] tags").click
send_keys "push_rubygem", :enter
Expand Down

0 comments on commit b56629f

Please sign in to comment.