From 242358bb7b8e031b9b975340750be33b19015cfa Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Fri, 4 Sep 2020 03:16:09 +0000 Subject: Add latest changes from gitlab-org/gitlab@13-3-stable-ee --- .../jira_import/components/jira_import_form.vue | 74 ++++++++++++++++------ .../javascripts/jira_import/utils/constants.js | 3 + .../concerns/authenticates_with_two_factor.rb | 6 +- app/models/application_setting.rb | 18 ++++++ app/services/git/process_ref_changes_service.rb | 8 ++- app/services/jira_import/users_mapper_service.rb | 1 + 6 files changed, 85 insertions(+), 25 deletions(-) (limited to 'app') 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 b5d17398f3a..5bf98682f92 100644 --- a/app/assets/javascripts/jira_import/components/jira_import_form.vue +++ b/app/assets/javascripts/jira_import/components/jira_import_form.vue @@ -23,6 +23,7 @@ import { addInProgressImportToStore } from '../utils/cache_update'; import { debounceWait, dropdownLabel, + userMappingsPageSize, previousImportsMessage, tableConfig, userMappingMessage, @@ -74,12 +75,15 @@ export default { }, data() { return { + hasMoreUsers: false, isFetching: false, + isLoadingMoreUsers: false, isSubmitting: false, searchTerm: '', selectedProject: undefined, selectState: null, userMappings: [], + userMappingsStartAt: 0, users: [], }; }, @@ -101,6 +105,9 @@ export default { ? `jira-import::${this.selectedProject}-${this.numberOfPreviousImports + 1}` : 'jira-import::KEY-1'; }, + isInitialLoadingState() { + return this.isLoadingMoreUsers && !this.hasMoreUsers; + }, }, watch: { searchTerm: debounce(function debouncedUserSearch() { @@ -108,23 +115,7 @@ export default { }, debounceWait), }, mounted() { - this.$apollo - .mutate({ - mutation: getJiraUserMappingMutation, - variables: { - input: { - projectPath: this.projectPath, - }, - }, - }) - .then(({ data }) => { - if (data.jiraImportUsers.errors.length) { - this.$emit('error', data.jiraImportUsers.errors.join('. ')); - } else { - this.userMappings = data.jiraImportUsers.jiraUsers; - } - }) - .catch(() => this.$emit('error', __('There was an error retrieving the Jira users.'))); + this.getJiraUserMapping(); this.searchUsers() .then(data => { @@ -133,6 +124,36 @@ export default { .catch(() => {}); }, methods: { + getJiraUserMapping() { + this.isLoadingMoreUsers = true; + + this.$apollo + .mutate({ + mutation: getJiraUserMappingMutation, + variables: { + input: { + projectPath: this.projectPath, + startAt: this.userMappingsStartAt, + }, + }, + }) + .then(({ data }) => { + if (data.jiraImportUsers.errors.length) { + this.$emit('error', data.jiraImportUsers.errors.join('. ')); + return; + } + + this.userMappings = this.userMappings.concat(data.jiraImportUsers.jiraUsers); + this.hasMoreUsers = data.jiraImportUsers.jiraUsers.length === userMappingsPageSize; + this.userMappingsStartAt += userMappingsPageSize; + }) + .catch(() => { + this.$emit('error', __('There was an error retrieving the Jira users.')); + }) + .finally(() => { + this.isLoadingMoreUsers = false; + }); + }, searchUsers() { const params = { active: true, @@ -187,7 +208,9 @@ export default { this.selectedProject = undefined; } }) - .catch(() => this.$emit('error', __('There was an error importing the Jira project.'))) + .catch(() => { + this.$emit('error', __('There was an error importing the Jira project.')); + }) .finally(() => { this.isSubmitting = false; }); @@ -280,9 +303,7 @@ export default { > -
- -
+ + + + + {{ __('Load more users') }} + +