Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-08-12 18:10:02 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-08-12 18:10:02 +0300
commitf6a3028be7c20cd509685258ba7e50d9d6a68114 (patch)
tree82960188ccaca3f08a3b3e45b33010ad523230cc /app/assets/javascripts/jira_import
parent999f47e9e6da399de9dc1de404f073f7dd30af0d (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/jira_import')
-rw-r--r--app/assets/javascripts/jira_import/components/jira_import_app.vue31
-rw-r--r--app/assets/javascripts/jira_import/components/jira_import_form.vue87
-rw-r--r--app/assets/javascripts/jira_import/utils/constants.js29
3 files changed, 78 insertions, 69 deletions
diff --git a/app/assets/javascripts/jira_import/components/jira_import_app.vue b/app/assets/javascripts/jira_import/components/jira_import_app.vue
index 60ddacd49dd..a1b1fec9c8b 100644
--- a/app/assets/javascripts/jira_import/components/jira_import_app.vue
+++ b/app/assets/javascripts/jira_import/components/jira_import_app.vue
@@ -1,5 +1,5 @@
<script>
-import { GlAlert, GlLoadingIcon, GlSprintf } from '@gitlab/ui';
+import { GlAlert, GlLoadingIcon } from '@gitlab/ui';
import { last } from 'lodash';
import { __ } from '~/locale';
import getJiraImportDetailsQuery from '../queries/get_jira_import_details.query.graphql';
@@ -16,7 +16,6 @@ export default {
components: {
GlAlert,
GlLoadingIcon,
- GlSprintf,
JiraImportForm,
JiraImportProgress,
JiraImportSetup,
@@ -55,7 +54,6 @@ export default {
return {
isSubmitting: false,
jiraImportDetails: {},
- selectedProject: undefined,
userMappings: [],
errorMessage: '',
showAlert: false,
@@ -80,22 +78,6 @@ export default {
},
},
},
- computed: {
- numberOfPreviousImports() {
- return this.jiraImportDetails.imports?.reduce?.(
- (acc, jiraProject) => (jiraProject.jiraProjectKey === this.selectedProject ? acc + 1 : acc),
- 0,
- );
- },
- hasPreviousImports() {
- return this.numberOfPreviousImports > 0;
- },
- importLabel() {
- return this.selectedProject
- ? `jira-import::${this.selectedProject}-${this.numberOfPreviousImports + 1}`
- : 'jira-import::KEY-1';
- },
- },
mounted() {
if (this.isJiraConfigured) {
this.$apollo
@@ -168,9 +150,6 @@ export default {
this.showAlert = false;
},
},
- previousImportsMessage: __(
- 'You have imported from this project %{numberOfPreviousImports} times before. Each new import will create duplicate issues.',
- ),
};
</script>
@@ -179,11 +158,6 @@ export default {
<gl-alert v-if="showAlert" variant="danger" @dismiss="dismissAlert">
{{ errorMessage }}
</gl-alert>
- <gl-alert v-if="hasPreviousImports" variant="warning" :dismissible="false">
- <gl-sprintf :message="$options.previousImportsMessage">
- <template #numberOfPreviousImports>{{ numberOfPreviousImports }}</template>
- </gl-sprintf>
- </gl-alert>
<jira-import-setup
v-if="!isJiraConfigured"
@@ -201,10 +175,9 @@ export default {
/>
<jira-import-form
v-else
- v-model="selectedProject"
- :import-label="importLabel"
:is-submitting="isSubmitting"
:issues-path="issuesPath"
+ :jira-imports="jiraImportDetails.imports"
:jira-projects="jiraImportDetails.projects"
:project-id="projectId"
:user-mappings="userMappings"
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 eb72e8581e8..db3b295642a 100644
--- a/app/assets/javascripts/jira_import/components/jira_import_form.vue
+++ b/app/assets/javascripts/jira_import/components/jira_import_form.vue
@@ -1,5 +1,6 @@
<script>
import {
+ GlAlert,
GlButton,
GlNewDropdown,
GlNewDropdownItem,
@@ -10,15 +11,23 @@ import {
GlLabel,
GlLoadingIcon,
GlSearchBoxByType,
+ GlSprintf,
GlTable,
} from '@gitlab/ui';
import { debounce } from 'lodash';
import axios from '~/lib/utils/axios_utils';
-import { __ } from '~/locale';
+import {
+ debounceWait,
+ dropdownLabel,
+ previousImportsMessage,
+ tableConfig,
+ userMappingMessage,
+} from '../utils/constants';
export default {
name: 'JiraImportForm',
components: {
+ GlAlert,
GlButton,
GlNewDropdown,
GlNewDropdownItem,
@@ -29,29 +38,15 @@ export default {
GlLabel,
GlLoadingIcon,
GlSearchBoxByType,
+ GlSprintf,
GlTable,
},
currentUsername: gon.current_username,
- dropdownLabel: __('The GitLab user to which the Jira user %{jiraDisplayName} will be mapped'),
- tableConfig: [
- {
- key: 'jiraDisplayName',
- label: __('Jira display name'),
- },
- {
- key: 'arrow',
- label: '',
- },
- {
- key: 'gitlabUsername',
- label: __('GitLab username'),
- },
- ],
+ dropdownLabel,
+ previousImportsMessage,
+ tableConfig,
+ userMappingMessage,
props: {
- importLabel: {
- type: String,
- required: true,
- },
isSubmitting: {
type: Boolean,
required: true,
@@ -60,6 +55,10 @@ export default {
type: String,
required: true,
},
+ jiraImports: {
+ type: Array,
+ required: true,
+ },
jiraProjects: {
type: Array,
required: true,
@@ -72,16 +71,12 @@ export default {
type: Array,
required: true,
},
- value: {
- type: String,
- required: false,
- default: undefined,
- },
},
data() {
return {
isFetching: false,
searchTerm: '',
+ selectedProject: undefined,
selectState: null,
users: [],
};
@@ -90,11 +85,25 @@ export default {
shouldShowNoMatchesFoundText() {
return !this.isFetching && this.users.length === 0;
},
+ numberOfPreviousImports() {
+ return this.jiraImports?.reduce?.(
+ (acc, jiraProject) => (jiraProject.jiraProjectKey === this.selectedProject ? acc + 1 : acc),
+ 0,
+ );
+ },
+ hasPreviousImports() {
+ return this.numberOfPreviousImports > 0;
+ },
+ importLabel() {
+ return this.selectedProject
+ ? `jira-import::${this.selectedProject}-${this.numberOfPreviousImports + 1}`
+ : 'jira-import::KEY-1';
+ },
},
watch: {
searchTerm: debounce(function debouncedUserSearch() {
this.searchUsers();
- }, 500),
+ }, debounceWait),
},
mounted() {
this.searchUsers()
@@ -129,9 +138,9 @@ export default {
},
initiateJiraImport(event) {
event.preventDefault();
- if (this.value) {
+ if (this.selectedProject) {
this.hideValidationError();
- this.$emit('initiateJiraImport', this.value);
+ this.$emit('initiateJiraImport', this.selectedProject);
} else {
this.showValidationError();
}
@@ -148,8 +157,16 @@ export default {
<template>
<div>
+ <gl-alert v-if="hasPreviousImports" variant="warning" :dismissible="false">
+ <gl-sprintf :message="$options.previousImportsMessage">
+ <template #numberOfPreviousImports>{{ numberOfPreviousImports }}</template>
+ </gl-sprintf>
+ </gl-alert>
+
<h3 class="page-title">{{ __('New Jira import') }}</h3>
+
<hr />
+
<form @submit="initiateJiraImport">
<gl-form-group
class="row align-items-center"
@@ -160,12 +177,11 @@ export default {
>
<gl-form-select
id="jira-project-select"
+ v-model="selectedProject"
data-qa-selector="jira_project_dropdown"
class="mb-2"
:options="jiraProjects"
:state="selectState"
- :value="value"
- @change="$emit('input', $event)"
/>
</gl-form-group>
@@ -186,16 +202,7 @@ export default {
<h4 class="gl-mb-4">{{ __('Jira-GitLab user mapping template') }}</h4>
- <p>
- {{
- __(
- `Jira users have been imported from the configured Jira instance.
- They can be mapped by selecting a GitLab user from the dropdown in the "GitLab
- username" column.
- When the form appears, the dropdown defaults to the user conducting the import.`,
- )
- }}
- </p>
+ <p>{{ $options.userMappingMessage }}</p>
<gl-table :fields="$options.tableConfig" :items="userMappings" fixed>
<template #cell(arrow)>
diff --git a/app/assets/javascripts/jira_import/utils/constants.js b/app/assets/javascripts/jira_import/utils/constants.js
new file mode 100644
index 00000000000..6adc3e5306c
--- /dev/null
+++ b/app/assets/javascripts/jira_import/utils/constants.js
@@ -0,0 +1,29 @@
+import { __ } from '~/locale';
+
+export const debounceWait = 500;
+
+export const dropdownLabel = __(
+ 'The GitLab user to which the Jira user %{jiraDisplayName} will be mapped',
+);
+
+export const previousImportsMessage = __(`You have imported from this project
+ %{numberOfPreviousImports} times before. Each new import will create duplicate issues.`);
+
+export const tableConfig = [
+ {
+ key: 'jiraDisplayName',
+ label: __('Jira display name'),
+ },
+ {
+ key: 'arrow',
+ label: '',
+ },
+ {
+ key: 'gitlabUsername',
+ label: __('GitLab username'),
+ },
+];
+
+export const userMappingMessage = __(`Jira users have been imported from the configured Jira
+ instance. They can be mapped by selecting a GitLab user from the dropdown in the "GitLab username"
+ column. When the form appears, the dropdown defaults to the user conducting the import.`);