Commit c9a7145a authored by Tiago Botelho's avatar Tiago Botelho

Remove GET empty from EnvironmentsController

parent dd467d6c
...@@ -120,21 +120,14 @@ class Projects::EnvironmentsController < Projects::ApplicationController ...@@ -120,21 +120,14 @@ class Projects::EnvironmentsController < Projects::ApplicationController
end end
end end
def empty
render :empty
end
def metrics_redirect def metrics_redirect
environment = project.environments.with_state(:available).first environment = project.environments.with_state(:available).first
path = if environment
if environment redirect_to environment_metrics_path(environment)
environment_metrics_path(environment) else
else render :empty
empty_project_environments_path(project) end
end
redirect_to path
end end
def metrics def metrics
......
...@@ -210,7 +210,7 @@ ...@@ -210,7 +210,7 @@
%li.divider.fly-out-top-item %li.divider.fly-out-top-item
- if project_nav_tab? :environments - if project_nav_tab? :environments
= nav_link(controller: :environments, action: [:metrics, :empty]) do = nav_link(controller: :environments, action: [:metrics, :metrics_redirect]) do
= link_to metrics_project_environments_path(@project), title: 'Metrics', class: 'shortcuts-metrics' do = link_to metrics_project_environments_path(@project), title: 'Metrics', class: 'shortcuts-metrics' do
%span %span
= _('Metrics') = _('Metrics')
......
...@@ -236,7 +236,6 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do ...@@ -236,7 +236,6 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
collection do collection do
get :metrics, action: :metrics_redirect get :metrics, action: :metrics_redirect
get :empty
get :folder, path: 'folders/*id', constraints: { format: /(html|json)/ } get :folder, path: 'folders/*id', constraints: { format: /(html|json)/ }
end end
......
...@@ -277,16 +277,6 @@ describe Projects::EnvironmentsController do ...@@ -277,16 +277,6 @@ describe Projects::EnvironmentsController do
end end
end end
describe 'GET #empty' do
it 'responds with HTML' do
get :empty, namespace_id: project.namespace,
project_id: project
expect(response).to be_ok
expect(response).to render_template 'empty'
end
end
describe 'GET #metrics_redirect' do describe 'GET #metrics_redirect' do
let(:project) { create(:project) } let(:project) { create(:project) }
...@@ -301,7 +291,8 @@ describe Projects::EnvironmentsController do ...@@ -301,7 +291,8 @@ describe Projects::EnvironmentsController do
it 'redirects to empty page if no environment exists' do it 'redirects to empty page if no environment exists' do
get :metrics_redirect, environment_params get :metrics_redirect, environment_params
expect(response).to redirect_to(empty_project_environments_path(project)) expect(response).to be_ok
expect(response).to render_template 'empty'
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment