Commit 46e370af authored by Tristan Read's avatar Tristan Read Committed by Clement Ho

Add View Issue button

Adds a view issue button to the Error Tracking details page
when a GitLab issue link is found.
parent cd7a2f67
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
import { mapActions, mapGetters, mapState } from 'vuex'; import { mapActions, mapGetters, mapState } from 'vuex';
import dateFormat from 'dateformat'; import dateFormat from 'dateformat';
import createFlash from '~/flash'; import createFlash from '~/flash';
import { GlFormInput, GlLink, GlLoadingIcon, GlBadge } from '@gitlab/ui'; import { GlButton, GlFormInput, GlLink, GlLoadingIcon, GlBadge } from '@gitlab/ui';
import { __, sprintf, n__ } from '~/locale'; import { __, sprintf, n__ } from '~/locale';
import LoadingButton from '~/vue_shared/components/loading_button.vue'; import LoadingButton from '~/vue_shared/components/loading_button.vue';
import Icon from '~/vue_shared/components/icon.vue'; import Icon from '~/vue_shared/components/icon.vue';
...@@ -17,6 +17,7 @@ import query from '../queries/details.query.graphql'; ...@@ -17,6 +17,7 @@ import query from '../queries/details.query.graphql';
export default { export default {
components: { components: {
LoadingButton, LoadingButton,
GlButton,
GlFormInput, GlFormInput,
GlLink, GlLink,
GlLoadingIcon, GlLoadingIcon,
...@@ -188,6 +189,15 @@ export default { ...@@ -188,6 +189,15 @@ export default {
:loading="updatingResolveStatus" :loading="updatingResolveStatus"
@click="updateIssueStatus('resolved')" @click="updateIssueStatus('resolved')"
/> />
<gl-button
v-if="error.gitlab_issue"
class="ml-2"
data-qa-selector="view_issue_button"
:href="error.gitlab_issue"
variant="success"
>
{{ __('View issue') }}
</gl-button>
<form <form
ref="sentryIssueForm" ref="sentryIssueForm"
:action="projectIssuesPath" :action="projectIssuesPath"
......
---
title: Add View Issue button to error tracking details page
merge_request: 22862
author:
type: added
...@@ -20480,6 +20480,9 @@ msgstr "" ...@@ -20480,6 +20480,9 @@ msgstr ""
msgid "View group labels" msgid "View group labels"
msgstr "" msgstr ""
msgid "View issue"
msgstr ""
msgid "View it on GitLab" msgid "View it on GitLab"
msgstr "" msgstr ""
......
...@@ -198,6 +198,7 @@ describe('ErrorDetails', () => { ...@@ -198,6 +198,7 @@ describe('ErrorDetails', () => {
const gitlabIssue = 'https://gitlab.example.com/issues/1'; const gitlabIssue = 'https://gitlab.example.com/issues/1';
const findGitLabLink = () => wrapper.find(`[href="${gitlabIssue}"]`); const findGitLabLink = () => wrapper.find(`[href="${gitlabIssue}"]`);
const findCreateIssueButton = () => wrapper.find('[data-qa-selector="create_issue_button"]'); const findCreateIssueButton = () => wrapper.find('[data-qa-selector="create_issue_button"]');
const findViewIssueButton = () => wrapper.find('[data-qa-selector="view_issue_button"]');
describe('is present', () => { describe('is present', () => {
beforeEach(() => { beforeEach(() => {
...@@ -209,6 +210,10 @@ describe('ErrorDetails', () => { ...@@ -209,6 +210,10 @@ describe('ErrorDetails', () => {
mountComponent(); mountComponent();
}); });
it('should display the View issue button', () => {
expect(findViewIssueButton().exists()).toBe(true);
});
it('should display the issue link', () => { it('should display the issue link', () => {
expect(findGitLabLink().exists()).toBe(true); expect(findGitLabLink().exists()).toBe(true);
}); });
...@@ -228,9 +233,14 @@ describe('ErrorDetails', () => { ...@@ -228,9 +233,14 @@ describe('ErrorDetails', () => {
mountComponent(); mountComponent();
}); });
it('should not display the View issue button', () => {
expect(findViewIssueButton().exists()).toBe(false);
});
it('should not display an issue link', () => { it('should not display an issue link', () => {
expect(findGitLabLink().exists()).toBe(false); expect(findGitLabLink().exists()).toBe(false);
}); });
it('should display the create issue button', () => { it('should display the create issue button', () => {
expect(findCreateIssueButton().exists()).toBe(true); expect(findCreateIssueButton().exists()).toBe(true);
}); });
......
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