Commit e0b8d5ec authored by Martin Wortschack's avatar Martin Wortschack

Merge branch 'cngo-fix-jira-importer-urls' into 'master'

Fix Jira importer URLs

See merge request gitlab-org/gitlab!30155
parents 6b0e6953 6b745056
...@@ -30,6 +30,10 @@ export default { ...@@ -30,6 +30,10 @@ export default {
type: String, type: String,
required: true, required: true,
}, },
jiraIntegrationPath: {
type: String,
required: true,
},
jiraProjects: { jiraProjects: {
type: Array, type: Array,
required: true, required: true,
...@@ -133,7 +137,11 @@ export default { ...@@ -133,7 +137,11 @@ export default {
{{ errorMessage }} {{ errorMessage }}
</gl-alert> </gl-alert>
<jira-import-setup v-if="!isJiraConfigured" :illustration="setupIllustration" /> <jira-import-setup
v-if="!isJiraConfigured"
:illustration="setupIllustration"
:jira-integration-path="jiraIntegrationPath"
/>
<gl-loading-icon v-else-if="$apollo.loading" size="md" class="mt-3" /> <gl-loading-icon v-else-if="$apollo.loading" size="md" class="mt-3" />
<jira-import-progress <jira-import-progress
v-else-if="isImportInProgress" v-else-if="isImportInProgress"
......
...@@ -46,6 +46,9 @@ export default { ...@@ -46,6 +46,9 @@ export default {
importTime: formatDate(this.importTime), importTime: formatDate(this.importTime),
}); });
}, },
issuesLink() {
return `${this.issuesPath}?search=${this.importProject}`;
},
}, },
}; };
</script> </script>
...@@ -55,7 +58,7 @@ export default { ...@@ -55,7 +58,7 @@ export default {
:svg-path="illustration" :svg-path="illustration"
:title="__('Import in progress')" :title="__('Import in progress')"
:primary-button-text="__('View issues')" :primary-button-text="__('View issues')"
:primary-button-link="issuesPath" :primary-button-link="issuesLink"
> >
<template #description> <template #description>
<p class="mb-0">{{ importInitiatorText }}</p> <p class="mb-0">{{ importInitiatorText }}</p>
......
...@@ -11,6 +11,10 @@ export default { ...@@ -11,6 +11,10 @@ export default {
type: String, type: String,
required: true, required: true,
}, },
jiraIntegrationPath: {
type: String,
required: true,
},
}, },
}; };
</script> </script>
...@@ -21,6 +25,6 @@ export default { ...@@ -21,6 +25,6 @@ export default {
title="" title=""
:description="__('You will first need to set up Jira Integration to use this feature.')" :description="__('You will first need to set up Jira Integration to use this feature.')"
:primary-button-text="__('Set up Jira Integration')" :primary-button-text="__('Set up Jira Integration')"
primary-button-link="../services/jira/edit" :primary-button-link="jiraIntegrationPath"
/> />
</template> </template>
...@@ -27,6 +27,7 @@ export default function mountJiraImportApp() { ...@@ -27,6 +27,7 @@ export default function mountJiraImportApp() {
inProgressIllustration: el.dataset.inProgressIllustration, inProgressIllustration: el.dataset.inProgressIllustration,
isJiraConfigured: parseBoolean(el.dataset.isJiraConfigured), isJiraConfigured: parseBoolean(el.dataset.isJiraConfigured),
issuesPath: el.dataset.issuesPath, issuesPath: el.dataset.issuesPath,
jiraIntegrationPath: el.dataset.jiraIntegrationPath,
jiraProjects: el.dataset.jiraProjects ? JSON.parse(el.dataset.jiraProjects) : [], jiraProjects: el.dataset.jiraProjects ? JSON.parse(el.dataset.jiraProjects) : [],
projectPath: el.dataset.projectPath, projectPath: el.dataset.projectPath,
setupIllustration: el.dataset.setupIllustration, setupIllustration: el.dataset.setupIllustration,
......
- if Feature.enabled?(:jira_issue_import_vue, @project, default_enabled: true) - if Feature.enabled?(:jira_issue_import_vue, @project, default_enabled: true)
.js-jira-import-root{ data: { project_path: @project.full_path, .js-jira-import-root{ data: { project_path: @project.full_path,
issues_path: project_issues_path(@project), issues_path: project_issues_path(@project),
jira_integration_path: edit_project_service_path(@project, :jira),
is_jira_configured: @project.jira_service.present?.to_s, is_jira_configured: @project.jira_service.present?.to_s,
jira_projects: @jira_projects.to_json, jira_projects: @jira_projects.to_json,
in_progress_illustration: image_path('illustrations/export-import.svg'), in_progress_illustration: image_path('illustrations/export-import.svg'),
......
---
title: Fix Jira importer URLs
merge_request: 30155
author:
type: added
...@@ -26,6 +26,7 @@ const mountComponent = ({ ...@@ -26,6 +26,7 @@ const mountComponent = ({
['My Second Jira Project', 'MSJP'], ['My Second Jira Project', 'MSJP'],
['Migrate to GitLab', 'MTG'], ['Migrate to GitLab', 'MTG'],
], ],
jiraIntegrationPath: 'gitlab-org/gitlab-test/-/services/jira/edit',
projectPath: 'gitlab-org/gitlab-test', projectPath: 'gitlab-org/gitlab-test',
setupIllustration: 'setup-illustration.svg', setupIllustration: 'setup-illustration.svg',
}, },
......
...@@ -2,6 +2,10 @@ import { GlEmptyState } from '@gitlab/ui'; ...@@ -2,6 +2,10 @@ import { GlEmptyState } from '@gitlab/ui';
import { mount, shallowMount } from '@vue/test-utils'; import { mount, shallowMount } from '@vue/test-utils';
import JiraImportProgress from '~/jira_import/components/jira_import_progress.vue'; import JiraImportProgress from '~/jira_import/components/jira_import_progress.vue';
const illustration = 'illustration.svg';
const importProject = 'JIRAPROJECT';
const issuesPath = 'gitlab-org/gitlab-test/-/issues';
describe('JiraImportProgress', () => { describe('JiraImportProgress', () => {
let wrapper; let wrapper;
...@@ -13,11 +17,11 @@ describe('JiraImportProgress', () => { ...@@ -13,11 +17,11 @@ describe('JiraImportProgress', () => {
const mountFunction = mountType === 'shallowMount' ? shallowMount : mount; const mountFunction = mountType === 'shallowMount' ? shallowMount : mount;
return mountFunction(JiraImportProgress, { return mountFunction(JiraImportProgress, {
propsData: { propsData: {
illustration: 'illustration.svg', illustration,
importInitiator: 'Jane Doe', importInitiator: 'Jane Doe',
importProject: 'JIRAPROJECT', importProject,
importTime: '2020-04-08T12:17:25+00:00', importTime: '2020-04-08T12:17:25+00:00',
issuesPath: 'gitlab-org/gitlab-test/-/issues', issuesPath,
}, },
}); });
}; };
...@@ -33,7 +37,7 @@ describe('JiraImportProgress', () => { ...@@ -33,7 +37,7 @@ describe('JiraImportProgress', () => {
}); });
it('contains illustration', () => { it('contains illustration', () => {
expect(getGlEmptyStateAttribute('svgpath')).toBe('illustration.svg'); expect(getGlEmptyStateAttribute('svgpath')).toBe(illustration);
}); });
it('contains a title', () => { it('contains a title', () => {
...@@ -46,7 +50,8 @@ describe('JiraImportProgress', () => { ...@@ -46,7 +50,8 @@ describe('JiraImportProgress', () => {
}); });
it('contains button url', () => { it('contains button url', () => {
expect(getGlEmptyStateAttribute('primarybuttonlink')).toBe('gitlab-org/gitlab-test/-/issues'); const expected = `${issuesPath}?search=${importProject}`;
expect(getGlEmptyStateAttribute('primarybuttonlink')).toBe(expected);
}); });
}); });
......
...@@ -2,6 +2,9 @@ import { GlEmptyState } from '@gitlab/ui'; ...@@ -2,6 +2,9 @@ import { GlEmptyState } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import JiraImportSetup from '~/jira_import/components/jira_import_setup.vue'; import JiraImportSetup from '~/jira_import/components/jira_import_setup.vue';
const illustration = 'illustration.svg';
const jiraIntegrationPath = 'gitlab-org/gitlab-test/-/services/jira/edit';
describe('JiraImportSetup', () => { describe('JiraImportSetup', () => {
let wrapper; let wrapper;
...@@ -10,7 +13,8 @@ describe('JiraImportSetup', () => { ...@@ -10,7 +13,8 @@ describe('JiraImportSetup', () => {
beforeEach(() => { beforeEach(() => {
wrapper = shallowMount(JiraImportSetup, { wrapper = shallowMount(JiraImportSetup, {
propsData: { propsData: {
illustration: 'illustration.svg', illustration,
jiraIntegrationPath,
}, },
}); });
}); });
...@@ -21,7 +25,7 @@ describe('JiraImportSetup', () => { ...@@ -21,7 +25,7 @@ describe('JiraImportSetup', () => {
}); });
it('contains illustration', () => { it('contains illustration', () => {
expect(getGlEmptyStateAttribute('svgpath')).toBe('illustration.svg'); expect(getGlEmptyStateAttribute('svgpath')).toBe(illustration);
}); });
it('contains a description', () => { it('contains a description', () => {
...@@ -32,4 +36,8 @@ describe('JiraImportSetup', () => { ...@@ -32,4 +36,8 @@ describe('JiraImportSetup', () => {
it('contains button text', () => { it('contains button text', () => {
expect(getGlEmptyStateAttribute('primarybuttontext')).toBe('Set up Jira Integration'); expect(getGlEmptyStateAttribute('primarybuttontext')).toBe('Set up Jira Integration');
}); });
it('contains button link', () => {
expect(getGlEmptyStateAttribute('primarybuttonlink')).toBe(jiraIntegrationPath);
});
}); });
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