Skip to content

Commit

Permalink
Fixes #36869 - Redirect /hosts to /new/hosts in index
Browse files Browse the repository at this point in the history
Also removed logic in the hosts controller and application helper to
rewrite the URL. Decided to go with the redirect on index approach
instead since we want this redirect to happen only on get requests.
  • Loading branch information
parthaa committed Oct 26, 2023
1 parent 405808d commit bfac923
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 16 deletions.
12 changes: 4 additions & 8 deletions app/controllers/hosts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ def index(title = nil)
end
respond_to do |format|
format.html do
if Setting[:new_hosts_page]
redirect_to(new_hosts_index_page_path)
next
end
@hosts = search.includes(included_associations).paginate(:page => params[:page], :per_page => params[:per_page])
# SQL optimization
preload_reports
Expand Down Expand Up @@ -684,14 +688,6 @@ def statuses
render :json => statuses
end

def hosts_path(*args)
if Setting[:new_hosts_page]
new_hosts_index_page_path(*args)
else
super
end
end

private

def preload_reports
Expand Down
8 changes: 0 additions & 8 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -422,12 +422,4 @@ def ui_settings
def current_host_details_path(host)
Setting['host_details_ui'] ? host_details_page_path(host) : host_path(host)
end

def hosts_path(*args)
if Setting[:new_hosts_page]
new_hosts_index_page_path(*args)
else
super
end
end
end

0 comments on commit bfac923

Please sign in to comment.