Commit d88ec344 authored by Clement Ho's avatar Clement Ho

Merge branch 'lm-create-new-issue-from-sentry' into 'master'

Add ability to create new issue from sentry error detail page

See merge request gitlab-org/gitlab!20337
parents 600a1a63 31be226a
...@@ -32,6 +32,10 @@ export default { ...@@ -32,6 +32,10 @@ export default {
type: String, type: String,
required: true, required: true,
}, },
issueProjectPath: {
type: String,
required: true,
},
}, },
computed: { computed: {
...mapState('details', ['error', 'loading', 'loadingStacktrace', 'stacktraceData']), ...mapState('details', ['error', 'loading', 'loadingStacktrace', 'stacktraceData']),
...@@ -82,9 +86,9 @@ export default { ...@@ -82,9 +86,9 @@ export default {
<div v-else-if="showDetails" class="error-details"> <div v-else-if="showDetails" class="error-details">
<div class="top-area align-items-center justify-content-between py-3"> <div class="top-area align-items-center justify-content-between py-3">
<span v-if="!loadingStacktrace && stacktrace" v-html="reported"></span> <span v-if="!loadingStacktrace && stacktrace" v-html="reported"></span>
<!-- <gl-button class="my-3 ml-auto" variant="success"> <gl-button variant="success" :href="issueProjectPath">
{{ __('Create Issue') }} {{ __('Create issue') }}
</gl-button>--> </gl-button>
</div> </div>
<div> <div>
<tooltip-on-truncate :title="error.title" truncate-target="child" placement="top"> <tooltip-on-truncate :title="error.title" truncate-target="child" placement="top">
......
...@@ -12,12 +12,13 @@ export default () => { ...@@ -12,12 +12,13 @@ export default () => {
store, store,
render(createElement) { render(createElement) {
const domEl = document.querySelector(this.$options.el); const domEl = document.querySelector(this.$options.el);
const { issueDetailsPath, issueStackTracePath } = domEl.dataset; const { issueDetailsPath, issueStackTracePath, issueProjectPath } = domEl.dataset;
return createElement('error-details', { return createElement('error-details', {
props: { props: {
issueDetailsPath, issueDetailsPath,
issueStackTracePath, issueStackTracePath,
issueProjectPath,
}, },
}); });
}, },
......
...@@ -18,6 +18,7 @@ module Projects::ErrorTrackingHelper ...@@ -18,6 +18,7 @@ module Projects::ErrorTrackingHelper
opts = [project, issue_id, { format: :json }] opts = [project, issue_id, { format: :json }]
{ {
'issue-project-path' => new_project_issue_path(project),
'issue-details-path' => details_project_error_tracking_index_path(*opts), 'issue-details-path' => details_project_error_tracking_index_path(*opts),
'issue-stack-trace-path' => stack_trace_project_error_tracking_index_path(*opts) 'issue-stack-trace-path' => stack_trace_project_error_tracking_index_path(*opts)
} }
......
---
title: Add ability to create new issue from sentry error detail page
merge_request: 20337
author:
type: added
...@@ -4892,6 +4892,9 @@ msgstr "" ...@@ -4892,6 +4892,9 @@ msgstr ""
msgid "Create group label" msgid "Create group label"
msgstr "" msgstr ""
msgid "Create issue"
msgstr ""
msgid "Create lists from labels. Issues with that label appear in that list." msgid "Create lists from labels. Issues with that label appear in that list."
msgstr "" msgstr ""
......
import { createLocalVue, shallowMount } from '@vue/test-utils'; import { createLocalVue, shallowMount } from '@vue/test-utils';
import Vuex from 'vuex'; import Vuex from 'vuex';
import { GlLoadingIcon, GlLink } from '@gitlab/ui'; import { GlButton, GlLoadingIcon, GlLink } from '@gitlab/ui';
import Stacktrace from '~/error_tracking/components/stacktrace.vue'; import Stacktrace from '~/error_tracking/components/stacktrace.vue';
import ErrorDetails from '~/error_tracking/components/error_details.vue'; import ErrorDetails from '~/error_tracking/components/error_details.vue';
...@@ -20,6 +20,7 @@ describe('ErrorDetails', () => { ...@@ -20,6 +20,7 @@ describe('ErrorDetails', () => {
propsData: { propsData: {
issueDetailsPath: '/123/details', issueDetailsPath: '/123/details',
issueStackTracePath: '/stacktrace', issueStackTracePath: '/stacktrace',
issueProjectPath: '/test-project/issues/new',
}, },
}); });
} }
...@@ -82,6 +83,15 @@ describe('ErrorDetails', () => { ...@@ -82,6 +83,15 @@ describe('ErrorDetails', () => {
expect(wrapper.find(Stacktrace).exists()).toBe(false); expect(wrapper.find(Stacktrace).exists()).toBe(false);
}); });
it('should allow a blank issue to be created', () => {
store.state.details.loading = false;
store.state.details.error.id = 1;
mountComponent();
const button = wrapper.find(GlButton);
expect(button.exists()).toBe(true);
expect(button.attributes().href).toBe(wrapper.props().issueProjectPath);
});
describe('Stacktrace', () => { describe('Stacktrace', () => {
it('should show stacktrace', () => { it('should show stacktrace', () => {
store.state.details.loading = false; store.state.details.loading = false;
......
...@@ -81,6 +81,7 @@ describe Projects::ErrorTrackingHelper do ...@@ -81,6 +81,7 @@ describe Projects::ErrorTrackingHelper do
let(:route_params) { [project.owner, project, issue_id, { format: :json }] } let(:route_params) { [project.owner, project, issue_id, { format: :json }] }
let(:details_path) { details_namespace_project_error_tracking_index_path(*route_params) } let(:details_path) { details_namespace_project_error_tracking_index_path(*route_params) }
let(:stack_trace_path) { stack_trace_namespace_project_error_tracking_index_path(*route_params) } let(:stack_trace_path) { stack_trace_namespace_project_error_tracking_index_path(*route_params) }
let(:issue_project_path) { new_project_issue_path(project) }
let(:result) { helper.error_details_data(project, issue_id) } let(:result) { helper.error_details_data(project, issue_id) }
...@@ -91,5 +92,9 @@ describe Projects::ErrorTrackingHelper do ...@@ -91,5 +92,9 @@ describe Projects::ErrorTrackingHelper do
it 'returns the correct stack trace path' do it 'returns the correct stack trace path' do
expect(result['issue-stack-trace-path']).to eq stack_trace_path expect(result['issue-stack-trace-path']).to eq stack_trace_path
end end
it 'returns the correct path for creating a new issue' do
expect(result['issue-project-path']).to eq issue_project_path
end
end end
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