Remove cluster scope from ClustersController#index
This commit is contained in:
parent
8ff63039f1
commit
4882c79301
|
@ -8,11 +8,8 @@ class Projects::ClustersController < Projects::ApplicationController
|
|||
STATUS_POLLING_INTERVAL = 10_000
|
||||
|
||||
def index
|
||||
@scope = params[:scope] || 'all'
|
||||
@clusters = ClustersFinder.new(project, current_user, @scope).execute.page(params[:page])
|
||||
@active_count = ClustersFinder.new(project, current_user, :active).execute.count
|
||||
@inactive_count = ClustersFinder.new(project, current_user, :inactive).execute.count
|
||||
@all_count = @active_count + @inactive_count
|
||||
clusters = ClustersFinder.new(project, current_user, :all).execute
|
||||
@clusters = clusters.page(params[:page]).per(20)
|
||||
end
|
||||
|
||||
def new
|
||||
|
|
|
@ -27,13 +27,6 @@ describe Projects::ClustersController do
|
|||
expect(assigns(:clusters)).to match_array([enabled_cluster, disabled_cluster])
|
||||
end
|
||||
|
||||
it 'assigns counters to correct values' do
|
||||
go
|
||||
|
||||
expect(assigns(:active_count)).to eq(1)
|
||||
expect(assigns(:inactive_count)).to eq(1)
|
||||
end
|
||||
|
||||
context 'when page is specified' do
|
||||
let(:last_page) { project.clusters.page.total_pages }
|
||||
|
||||
|
@ -48,20 +41,6 @@ describe Projects::ClustersController do
|
|||
expect(assigns(:clusters).current_page).to eq(last_page)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when only enabled clusters are requested' do
|
||||
it 'returns only enabled clusters' do
|
||||
get :index, namespace_id: project.namespace, project_id: project, scope: 'active'
|
||||
expect(assigns(:clusters)).to all(have_attributes(enabled: true))
|
||||
end
|
||||
end
|
||||
|
||||
context 'when only disabled clusters are requested' do
|
||||
it 'returns only disabled clusters' do
|
||||
get :index, namespace_id: project.namespace, project_id: project, scope: 'inactive'
|
||||
expect(assigns(:clusters)).to all(have_attributes(enabled: false))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when project does not have a cluster' do
|
||||
|
@ -74,13 +53,6 @@ describe Projects::ClustersController do
|
|||
expect(response).to render_template(:index, partial: :empty_state)
|
||||
expect(assigns(:clusters)).to eq([])
|
||||
end
|
||||
|
||||
it 'assigns counters to zero' do
|
||||
go
|
||||
|
||||
expect(assigns(:active_count)).to eq(0)
|
||||
expect(assigns(:inactive_count)).to eq(0)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue