diff options
author | Matija Čupić <matteeyah@gmail.com> | 2017-11-28 14:44:09 +0100 |
---|---|---|
committer | Matija Čupić <matteeyah@gmail.com> | 2017-11-28 14:44:42 +0100 |
commit | 3de1ba6cfae816a0bf8e985e2415ae2f09cbb080 (patch) | |
tree | a35f7eb8e2342e972b3213026ab713ce5b4c363c /app/controllers | |
parent | 899a80955ca694a119f52d8f717c1f86066e6880 (diff) | |
download | gitlab-ce-3de1ba6cfae816a0bf8e985e2415ae2f09cbb080.tar.gz |
Move cluster sourcing from before_action to #index
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/projects/clusters_controller.rb | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/app/controllers/projects/clusters_controller.rb b/app/controllers/projects/clusters_controller.rb index 078c1f62177..8205068ae42 100644 --- a/app/controllers/projects/clusters_controller.rb +++ b/app/controllers/projects/clusters_controller.rb @@ -1,6 +1,5 @@ class Projects::ClustersController < Projects::ApplicationController before_action :cluster, except: [:login, :index, :new, :new_gcp, :create] - before_action :clusters, only: [:index] before_action :authorize_read_cluster! before_action :authorize_create_cluster!, only: [:new, :new_gcp, :create] before_action :authorize_google_api, only: [:new_gcp, :create] @@ -8,8 +7,9 @@ class Projects::ClustersController < Projects::ApplicationController before_action :authorize_admin_cluster!, only: [:destroy] def index - @clusters = Kaminari.paginate_array(@clusters).page(params[:page]).per(20) @scope = params[:scope] + clusters = ClustersFinder.new(project, current_user, @scope).execute + @clusters = clusters.page(params[:page]).per(20) @active_count = project.clusters.enabled.count @inactive_count = project.clusters.disabled.count @all_count = @active_count + @inactive_count @@ -102,12 +102,6 @@ class Projects::ClustersController < Projects::ApplicationController @cluster ||= project.clusters.find_by(id: params[:id])&.present(current_user: current_user) || render_404 end - def clusters - @scope = params[:scope] || 'all' - scope = @scope&.to_sym - @clusters = ClustersFinder.new(project, current_user, scope).execute - end - def create_params params.require(:cluster).permit( :enabled, |