8000 remove solid errors from non production enrivonments & fix add on nam… by czhu12 · Pull Request #191 · czhu12/canine · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

remove solid errors from non production enrivonments & fix add on nam… #191

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

Merged
merged 1 commit into from
Jun 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 5 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ group :test do
gem 'faker', '~> 3.5.1'
gem 'shoulda-matchers', '~> 6.0'
end

group :production do
gem "solid_errors", "~> 0.7.0"
end

gem "cssbundling-rails"
gem "devise", "~> 4.9"
gem "friendly 10000 _id", "~> 5.4"
Expand Down Expand Up @@ -116,5 +121,4 @@ gem "sentry-rails", "~> 5.23"

gem "sys-proctable", "~> 1.3"

gem "solid_errors", "~> 0.7.0"
gem "omniauth-gitlab", "~> 4.1"
4 changes: 3 additions & 1 deletion app/actions/add_ons/create.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ class AddOns::Create
add_on = context.add_on
apply_template_to_values(add_on)
fetch_package_details(context, add_on)
add_on.save
unless add_on.save
context.fail_and_return!("Failed to create add on")
end
end

def self.fetch_package_details(context, add_on)
Expand Down
18 changes: 10 additions & 8 deletions app/views/shared/_default_right_nav.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,16 @@
<% end %>
</div>
</li>
<li>
<div>
<%= link_to admin_solid_errors_path do %>
<iconify-icon icon="lucide:bug" height="16"></iconify-icon>
Errors
<% end %>
</div>
</li>
<% if Rails.env.production? %>
<li>
<div>
<%= link_to admin_solid_errors_path do %>
<iconify-icon icon="lucide:bug" height="16"></iconify-icon>
Errors
<% end %>
</div>
</li>
<% end %>
<% end %>
<hr class="-mx-2 my-1 border-base-content/10">
<li>
Expand Down
4 changes: 3 additions & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@
authenticate :user, lambda { |u| u.admin? } do
namespace :admin do
mount Sidekiq::Web => "/sidekiq"
mount SolidErrors::Engine, at: "/solid_errors"
if Rails.env.production?
mount SolidErrors::Engine, at: "/solid_errors"
end
end
end

Expand Down
10 changes: 10 additions & 0 deletions spec/actions/add_ons/create_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@
)
end

describe 'errors' do
context 'there is a project with the same name in the same cluster' do
let!(:project) { create(:project, name: add_on.name, cluster: add_on.cluster) }
it 'raises an error' do
result = described_class.execute(add_on:)
expect(result.failure?).to be_truthy
end
end
end

describe '#execute' do
it 'applies template and fetches package details' do
expect(add_on).to receive(:save)
Expand Down
0