2019-07-06 16:15:13 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Gitlab
|
|
|
|
module CycleAnalytics
|
2019-07-18 10:07:36 -04:00
|
|
|
module GroupProjectsProvider
|
2019-07-06 16:15:13 -04:00
|
|
|
def projects
|
2019-07-18 10:07:36 -04:00
|
|
|
group ? projects_for_group : [project]
|
2019-07-06 16:15:13 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def group
|
|
|
|
@group ||= options.fetch(:group, nil)
|
|
|
|
end
|
|
|
|
|
|
|
|
def project
|
|
|
|
@project ||= options.fetch(:project, nil)
|
|
|
|
end
|
|
|
|
|
2019-07-18 10:07:36 -04:00
|
|
|
private
|
|
|
|
|
|
|
|
def projects_for_group
|
2019-07-06 16:15:13 -04:00
|
|
|
projects = Project.inside_path(group.full_path)
|
|
|
|
projects = projects.where(id: options[:projects]) if options[:projects]
|
|
|
|
projects
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|