diff options
author | Bob Van Landuyt <bob@vanlanduyt.co> | 2018-06-26 19:31:05 +0300 |
---|---|---|
committer | Bob Van Landuyt <bob@vanlanduyt.co> | 2018-07-04 11:53:39 +0300 |
commit | 04b046587fe609cd889f3fa518f08299abc61267 (patch) | |
tree | 634fc7d5e2a416950868700a82c171ff4f54239b /app/graphql/resolvers/concerns/resolves_pipelines.rb | |
parent | cd5789415b6e561564073693243e890e79596ed2 (diff) |
Add pipeline lists to GraphQL
This adds Keyset pagination to GraphQL lists. PoC for that is
pipelines on merge requests and projects.
When paginating a list, the base-64 encoded id of the ordering
field (in most cases the primary key) can be passed in the `before` or
`after` GraphQL argument.
Diffstat (limited to 'app/graphql/resolvers/concerns/resolves_pipelines.rb')
-rw-r--r-- | app/graphql/resolvers/concerns/resolves_pipelines.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/app/graphql/resolvers/concerns/resolves_pipelines.rb b/app/graphql/resolvers/concerns/resolves_pipelines.rb new file mode 100644 index 00000000000..9ec45378d8e --- /dev/null +++ b/app/graphql/resolvers/concerns/resolves_pipelines.rb @@ -0,0 +1,23 @@ +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 + + def resolve_pipelines(project, params = {}) + PipelinesFinder.new(project, context[:current_user], params).execute + end +end |