List multiple clusters on ClustersController#index
Also: * Stub out index view * Adds the clusters before_action that returns all clusters
This commit is contained in:
parent
9809e1d404
commit
b0a8840369
|
|
@ -1,5 +1,6 @@
|
||||||
class Projects::ClustersController < Projects::ApplicationController
|
class Projects::ClustersController < Projects::ApplicationController
|
||||||
before_action :cluster, except: [:login, :index, :new, :new_gcp, :create]
|
before_action :cluster, except: [:login, :index, :new, :new_gcp, :create]
|
||||||
|
before_action :clusters, only: [:index]
|
||||||
before_action :authorize_read_cluster!
|
before_action :authorize_read_cluster!
|
||||||
before_action :authorize_create_cluster!, only: [:new, :new_gcp, :create]
|
before_action :authorize_create_cluster!, only: [:new, :new_gcp, :create]
|
||||||
before_action :authorize_google_api, only: [:new_gcp, :create]
|
before_action :authorize_google_api, only: [:new_gcp, :create]
|
||||||
|
|
@ -7,11 +8,6 @@ class Projects::ClustersController < Projects::ApplicationController
|
||||||
before_action :authorize_admin_cluster!, only: [:destroy]
|
before_action :authorize_admin_cluster!, only: [:destroy]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
if project.cluster
|
|
||||||
redirect_to project_cluster_path(project, project.cluster)
|
|
||||||
else
|
|
||||||
redirect_to new_project_cluster_path(project)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def login
|
def login
|
||||||
|
|
@ -91,6 +87,10 @@ class Projects::ClustersController < Projects::ApplicationController
|
||||||
@cluster ||= project.clusters.find_by(id: params[:id])&.present(current_user: current_user) || render_404
|
@cluster ||= project.clusters.find_by(id: params[:id])&.present(current_user: current_user) || render_404
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def clusters
|
||||||
|
@clusters ||= project.clusters.map { |cluster| cluster.present(current_user: current_user) }
|
||||||
|
end
|
||||||
|
|
||||||
def create_params
|
def create_params
|
||||||
params.require(:cluster).permit(
|
params.require(:cluster).permit(
|
||||||
:enabled,
|
:enabled,
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
Hello World!
|
||||||
Loading…
Reference in New Issue