Commit df643b2b authored by Phil Hughes's avatar Phil Hughes

Merge branch...

Merge branch '36540-pass-sentry-error-title-description-and-link-unstyled-to-newly-created-issue' into 'master'

Pass sentry error title, description and link (unstyled) to newly created issue

See merge request gitlab-org/gitlab!20334
parents f9c84077 80372d12
...@@ -62,6 +62,34 @@ export default { ...@@ -62,6 +62,34 @@ export default {
showStacktrace() { showStacktrace() {
return Boolean(!this.loadingStacktrace && this.stacktrace && this.stacktrace.length); return Boolean(!this.loadingStacktrace && this.stacktrace && this.stacktrace.length);
}, },
errorTitle() {
return `${this.error.title}`;
},
errorUrl() {
return sprintf(__('Sentry event: %{external_url}'), {
external_url: this.error.external_url,
});
},
errorFirstSeen() {
return sprintf(__('First seen: %{first_seen}'), { first_seen: this.error.first_seen });
},
errorLastSeen() {
return sprintf(__('Last seen: %{last_seen}'), { last_seen: this.error.last_seen });
},
errorCount() {
return sprintf(__('Events: %{count}'), { count: this.error.count });
},
errorUserCount() {
return sprintf(__('Users: %{user_count}'), { user_count: this.error.user_count });
},
issueLink() {
return `${this.issueProjectPath}?issue[title]=${encodeURIComponent(
this.errorTitle,
)}&issue[description]=${encodeURIComponent(this.issueDescription)}`;
},
issueDescription() {
return `${this.errorUrl}${this.errorFirstSeen}${this.errorLastSeen}${this.errorCount}${this.errorUserCount}`;
},
}, },
mounted() { mounted() {
this.startPollingDetails(this.issueDetailsPath); this.startPollingDetails(this.issueDetailsPath);
...@@ -86,7 +114,7 @@ export default { ...@@ -86,7 +114,7 @@ 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 variant="success" :href="issueProjectPath"> <gl-button variant="success" :href="issueLink">
{{ __('Create issue') }} {{ __('Create issue') }}
</gl-button> </gl-button>
</div> </div>
......
...@@ -6940,6 +6940,9 @@ msgstr "" ...@@ -6940,6 +6940,9 @@ msgstr ""
msgid "Events" msgid "Events"
msgstr "" msgstr ""
msgid "Events: %{count}"
msgstr ""
msgid "Every %{action} attempt has failed: %{job_error_message}. Please try again." msgid "Every %{action} attempt has failed: %{job_error_message}. Please try again."
msgstr "" msgstr ""
...@@ -7599,6 +7602,9 @@ msgstr "" ...@@ -7599,6 +7602,9 @@ msgstr ""
msgid "First seen" msgid "First seen"
msgstr "" msgstr ""
msgid "First seen: %{first_seen}"
msgstr ""
msgid "Fixed date" msgid "Fixed date"
msgstr "" msgstr ""
...@@ -10038,6 +10044,9 @@ msgstr "" ...@@ -10038,6 +10044,9 @@ msgstr ""
msgid "Last seen" msgid "Last seen"
msgstr "" msgstr ""
msgid "Last seen: %{last_seen}"
msgstr ""
msgid "Last successful update" msgid "Last successful update"
msgstr "" msgstr ""
...@@ -15510,6 +15519,9 @@ msgstr "" ...@@ -15510,6 +15519,9 @@ msgstr ""
msgid "Sentry event" msgid "Sentry event"
msgstr "" msgstr ""
msgid "Sentry event: %{external_url}"
msgstr ""
msgid "Sep" msgid "Sep"
msgstr "" msgstr ""
...@@ -19196,6 +19208,9 @@ msgstr "" ...@@ -19196,6 +19208,9 @@ msgstr ""
msgid "Users with a Guest role or those who don't belong to any projects or groups don't count towards seats in use." msgid "Users with a Guest role or those who don't belong to any projects or groups don't count towards seats in use."
msgstr "" msgstr ""
msgid "Users: %{user_count}"
msgstr ""
msgid "UsersSelect|%{name} + %{length} more" msgid "UsersSelect|%{name} + %{length} more"
msgstr "" msgstr ""
......
...@@ -83,13 +83,34 @@ describe('ErrorDetails', () => { ...@@ -83,13 +83,34 @@ 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', () => { it('should allow an issue to be created with title and description', () => {
store.state.details.loading = false; store.state.details.loading = false;
store.state.details.error.id = 1; store.state.details.error = {
id: 1,
title: 'Issue title',
external_url: 'http://sentry.gitlab.net/gitlab',
first_seen: '2017-05-26T13:32:48Z',
last_seen: '2018-05-26T13:32:48Z',
count: 12,
user_count: 2,
};
mountComponent(); mountComponent();
const button = wrapper.find(GlButton); const button = wrapper.find(GlButton);
const title = 'Issue title';
const url = 'Sentry event: http://sentry.gitlab.net/gitlab';
const firstSeen = 'First seen: 2017-05-26T13:32:48Z';
const lastSeen = 'Last seen: 2018-05-26T13:32:48Z';
const count = 'Events: 12';
const userCount = 'Users: 2';
const issueDescription = `${url}${firstSeen}${lastSeen}${count}${userCount}`;
const issueLink = `/test-project/issues/new?issue[title]=${encodeURIComponent(
title,
)}&issue[description]=${encodeURIComponent(issueDescription)}`;
expect(button.exists()).toBe(true); expect(button.exists()).toBe(true);
expect(button.attributes().href).toBe(wrapper.props().issueProjectPath); expect(button.attributes().href).toBe(issueLink);
}); });
describe('Stacktrace', () => { describe('Stacktrace', () => {
......
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