diff options
Diffstat (limited to 'app/assets/javascripts/jira_import')
-rw-r--r-- | app/assets/javascripts/jira_import/components/jira_import_form.vue | 27 | ||||
-rw-r--r-- | app/assets/javascripts/jira_import/queries/search_project_members.query.graphql | 13 |
2 files changed, 29 insertions, 11 deletions
diff --git a/app/assets/javascripts/jira_import/components/jira_import_form.vue b/app/assets/javascripts/jira_import/components/jira_import_form.vue index ab475c3c85a..6f2fb41ca15 100644 --- a/app/assets/javascripts/jira_import/components/jira_import_form.vue +++ b/app/assets/javascripts/jira_import/components/jira_import_form.vue @@ -15,10 +15,11 @@ import { GlTable, } from '@gitlab/ui'; import { debounce } from 'lodash'; -import axios from '~/lib/utils/axios_utils'; +import { getIdFromGraphQLId } from '~/graphql_shared/utils'; import { __ } from '~/locale'; import getJiraUserMappingMutation from '../queries/get_jira_user_mapping.mutation.graphql'; import initiateJiraImportMutation from '../queries/initiate_jira_import.mutation.graphql'; +import searchProjectMembersQuery from '../queries/search_project_members.query.graphql'; import { addInProgressImportToStore } from '../utils/cache_update'; import { debounceWait, @@ -155,19 +156,23 @@ export default { }); }, searchUsers() { - const params = { - active: true, - project_id: this.projectId, - search: this.searchTerm, - }; - this.isFetching = true; - return axios - .get('/-/autocomplete/users.json', { params }) + return this.$apollo + .query({ + query: searchProjectMembersQuery, + variables: { + fullPath: this.projectPath, + search: this.searchTerm, + }, + }) .then(({ data }) => { - this.users = data; - return data; + this.users = + data?.project?.projectMembers?.nodes?.map(({ user }) => ({ + ...user, + id: getIdFromGraphQLId(user.id), + })) || []; + return this.users; }) .finally(() => { this.isFetching = false; diff --git a/app/assets/javascripts/jira_import/queries/search_project_members.query.graphql b/app/assets/javascripts/jira_import/queries/search_project_members.query.graphql new file mode 100644 index 00000000000..06f119e75ed --- /dev/null +++ b/app/assets/javascripts/jira_import/queries/search_project_members.query.graphql @@ -0,0 +1,13 @@ +query searchProjectMembers($fullPath: ID!, $search: String) { + project(fullPath: $fullPath) { + projectMembers(search: $search) { + nodes { + user { + id + name + username + } + } + } + } +} |