Limit projects to just one cluster
This commit is contained in:
parent
cc0c611555
commit
1a9cef7962
1 changed files with 10 additions and 0 deletions
|
@ -5,6 +5,8 @@ module Clusters
|
|||
def execute(access_token)
|
||||
@access_token = access_token
|
||||
|
||||
return unless can_create_cluster?
|
||||
|
||||
create_cluster.tap do |cluster|
|
||||
ClusterProvisionWorker.perform_async(cluster.id) if cluster.persisted?
|
||||
end
|
||||
|
@ -25,5 +27,13 @@ module Clusters
|
|||
|
||||
@cluster_params = params.merge(user: current_user, projects: [project])
|
||||
end
|
||||
|
||||
def can_create_cluster?
|
||||
if project.clusters.empty?
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue