Commit dccce268 authored by James Lopez's avatar James Lopez

Merge branch '217366-expose-jira-successfully-imported-issues-count-in-graphql' into 'master'

Expose Jira imported issues count in GraphQL

See merge request gitlab-org/gitlab!32580
parents cac8d499 57925b0d
......@@ -15,6 +15,12 @@ module Types
description: 'User that started the Jira import'
field :jira_project_key, GraphQL::STRING_TYPE, null: false,
description: 'Project key for the imported Jira project'
field :imported_issues_count, GraphQL::INT_TYPE, null: false,
description: 'Count of issues that were successfully imported'
field :failed_to_import_count, GraphQL::INT_TYPE, null: false,
description: 'Count of issues that failed to import'
field :total_issue_count, GraphQL::INT_TYPE, null: false,
description: 'Total count of issues that were attempted to import'
end
# rubocop: enable Graphql/AuthorizeTypes
end
---
title: Expose Jira imported issues count in GraphQL
merge_request: 32580
author:
type: added
......@@ -5420,6 +5420,16 @@ type JiraImport {
"""
createdAt: Time
"""
Count of issues that failed to import
"""
failedToImportCount: Int!
"""
Count of issues that were successfully imported
"""
importedIssuesCount: Int!
"""
Project key for the imported Jira project
"""
......@@ -5434,6 +5444,11 @@ type JiraImport {
User that started the Jira import
"""
scheduledBy: User
"""
Total count of issues that were attempted to import
"""
totalIssueCount: Int!
}
"""
......
......@@ -15028,6 +15028,42 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "failedToImportCount",
"description": "Count of issues that failed to import",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "importedIssuesCount",
"description": "Count of issues that were successfully imported",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "jiraProjectKey",
"description": "Project key for the imported Jira project",
......@@ -15073,6 +15109,24 @@
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "totalIssueCount",
"description": "Total count of issues that were attempted to import",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
}
],
"inputFields": null,
......@@ -801,9 +801,12 @@ Represents an iteration object.
| Name | Type | Description |
| --- | ---- | ---------- |
| `createdAt` | Time | Timestamp of when the Jira import was created |
| `failedToImportCount` | Int! | Count of issues that failed to import |
| `importedIssuesCount` | Int! | Count of issues that were successfully imported |
| `jiraProjectKey` | String! | Project key for the imported Jira project |
| `scheduledAt` | Time | Timestamp of when the Jira import was scheduled |
| `scheduledBy` | User | User that started the Jira import |
| `totalIssueCount` | Int! | Total count of issues that were attempted to import |
## JiraImportStartPayload
......
......@@ -6,6 +6,9 @@ describe GitlabSchema.types['JiraImport'] do
specify { expect(described_class.graphql_name).to eq('JiraImport') }
it 'has the expected fields' do
expect(described_class).to have_graphql_fields(:jira_project_key, :createdAt, :scheduled_at, :scheduled_by)
expect(described_class).to have_graphql_fields(
:jira_project_key, :created_at, :scheduled_at, :scheduled_by,
:failed_to_import_count, :imported_issues_count, :total_issue_count
)
end
end
......@@ -7,9 +7,30 @@ describe 'query Jira import data' do
let_it_be(:current_user) { create(:user) }
let_it_be(:project) { create(:project, :private, :import_started, import_type: 'jira') }
let_it_be(:jira_import1) { create(:jira_import_state, :finished, project: project, jira_project_key: 'AA', user: current_user, created_at: 2.days.ago) }
let_it_be(:jira_import2) { create(:jira_import_state, :finished, project: project, jira_project_key: 'BB', user: current_user, created_at: 5.days.ago) }
let_it_be(:jira_import1) do
create(
:jira_import_state, :finished,
project: project,
jira_project_key: 'AA',
user: current_user,
created_at: 2.days.ago,
failed_to_import_count: 2,
imported_issues_count: 2,
total_issue_count: 4
)
end
let_it_be(:jira_import2) do
create(
:jira_import_state, :finished,
project: project,
jira_project_key: 'BB',
user: current_user,
created_at: 5.days.ago,
failed_to_import_count: 1,
imported_issues_count: 2,
total_issue_count: 3
)
end
let(:query) do
%(
query {
......@@ -23,6 +44,9 @@ describe 'query Jira import data' do
scheduledBy {
username
}
importedIssuesCount
failedToImportCount
totalIssueCount
}
}
}
......@@ -64,10 +88,16 @@ describe 'query Jira import data' do
it 'retuns list of jira imports' do
jira_proket_keys = jira_imports.map {|ji| ji['jiraProjectKey']}
usernames = jira_imports.map {|ji| ji.dig('scheduledBy', 'username')}
imported_issues_count = jira_imports.map {|ji| ji.dig('importedIssuesCount')}
failed_issues_count = jira_imports.map {|ji| ji.dig('failedToImportCount')}
total_issue_count = jira_imports.map {|ji| ji.dig('totalIssueCount')}
expect(jira_imports.size).to eq 2
expect(jira_proket_keys).to eq %w(BB AA)
expect(usernames).to eq [current_user.username, current_user.username]
expect(imported_issues_count).to eq [2, 2]
expect(failed_issues_count).to eq [1, 2]
expect(total_issue_count).to eq [3, 4]
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment