diff --git a/app/avo/resources/audit.rb b/app/avo/resources/audit.rb index dd15c73ae73..656eb52df15 100644 --- a/app/avo/resources/audit.rb +++ b/app/avo/resources/audit.rb @@ -7,33 +7,41 @@ class Avo::Resources::Audit < Avo::BaseResource def fields field :action, as: :text - panel do - sidebar do - field :admin_github_user, as: :belongs_to - field :created_at, as: :date_time - field :comment, as: :text + if defined?(Avo::Pro) + panel do + sidebar do + panel_sidebar_contents + end + end + else + panel_sidebar_contents + end - field :auditable, as: :belongs_to, - polymorphic_as: :auditable, - types: [::User, ::WebHook], - name: "Edited Record" + field :audited_changes, as: :audited_changes, except_on: :index + end - field :action_details, as: :heading + def panel_sidebar_contents + field :admin_github_user, as: :belongs_to + field :created_at, as: :date_time + field :comment, as: :text - field :audited_changes_arguments, as: :json_viewer, only_on: :show do |_model| - record.audited_changes["arguments"] - end - field :audited_changes_fields, as: :json_viewer, only_on: :show do |_model| - record.audited_changes["fields"] - end - field :audited_changes_models, as: :text, as_html: true, only_on: :show do - record.audited_changes["models"] - end + field :auditable, as: :belongs_to, + polymorphic_as: :auditable, + types: [::User, ::WebHook], + name: "Edited Record" - field :id, as: :id - end + field :action_details, as: :heading + + field :audited_changes_arguments, as: :json_viewer, only_on: :show do |_model| + record.audited_changes["arguments"] + end + field :audited_changes_fields, as: :json_viewer, only_on: :show do |_model| + record.audited_changes["fields"] + end + field :audited_changes_models, as: :text, as_html: true, only_on: :show do + record.audited_changes["models"] end - field :audited_changes, as: :audited_changes, except_on: :index + field :id, as: :id end end diff --git a/config/initializers/avo.rb b/config/initializers/avo.rb index 94112cd6a55..0f688112d2d 100644 --- a/config/initializers/avo.rb +++ b/config/initializers/avo.rb @@ -4,7 +4,7 @@ config.root_path = '/admin' # Where should the user be redirected when visting the `/avo` url - config.home_path = "/admin/dashboards/dashy" + config.home_path = "/admin/dashboards/dashy" if defined?(Avo::Pro) ## == Licensing == config.license_key = ENV['AVO_LICENSE_KEY'] diff --git a/test/integration/avo/gem_name_reservations_controller_test.rb b/test/integration/avo/gem_name_reservations_controller_test.rb index 58abc37dacb..7b1e6f3b1e5 100644 --- a/test/integration/avo/gem_name_reservations_controller_test.rb +++ b/test/integration/avo/gem_name_reservations_controller_test.rb @@ -10,8 +10,14 @@ class Avo::GemNameReservationsControllerTest < ActionDispatch::IntegrationTest get avo.resources_gem_name_reservations_path assert_response :success + end + + test "resource search_query scope" do + skip "avo-pro needed to run this test" unless defined?(Avo::Pro) + + admin_sign_in_as create(:admin_github_user, :is_admin) + create(:gem_name_reservation, name: "hello") - # test resource search_query scope get avo.avo_api_search_path(q: "hello") assert_response :success