Create ClustersFinder
This commit is contained in:
parent
52bc826196
commit
0af5ae90cb
|
@ -0,0 +1,19 @@
|
|||
class ClustersFinder
|
||||
def initialize(project, user, scope)
|
||||
@project = project
|
||||
@user = user
|
||||
@scope = scope
|
||||
end
|
||||
|
||||
def execute
|
||||
clusters = case @scope
|
||||
when :all
|
||||
project.clusters
|
||||
when :disabled
|
||||
project.clusters.enabled
|
||||
when :enabled
|
||||
project.clusters.disabled
|
||||
end
|
||||
clusters.map { |cluster| cluster.present(current_user: @user) }
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue