2018-12-05 23:21:45 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
module ResolvesPipelines
|
|
|
|
extend ActiveSupport::Concern
|
|
|
|
|
|
|
|
included do
|
|
|
|
type [Types::Ci::PipelineType], null: false
|
|
|
|
argument :status,
|
|
|
|
Types::Ci::PipelineStatusEnum,
|
|
|
|
required: false,
|
|
|
|
description: "Filter pipelines by their status"
|
|
|
|
argument :ref,
|
|
|
|
GraphQL::STRING_TYPE,
|
|
|
|
required: false,
|
|
|
|
description: "Filter pipelines by the ref they are run for"
|
|
|
|
argument :sha,
|
|
|
|
GraphQL::STRING_TYPE,
|
|
|
|
required: false,
|
|
|
|
description: "Filter pipelines by the sha of the commit they are run for"
|
|
|
|
end
|
|
|
|
|
2019-07-31 22:56:46 +05:30
|
|
|
class_methods do
|
|
|
|
def resolver_complexity(args)
|
|
|
|
complexity = super
|
|
|
|
complexity += 2 if args[:sha]
|
|
|
|
complexity += 2 if args[:ref]
|
|
|
|
|
|
|
|
complexity
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
def resolve_pipelines(project, params = {})
|
|
|
|
PipelinesFinder.new(project, context[:current_user], params).execute
|
|
|
|
end
|
|
|
|
end
|