Commit cc16a144 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'lm-update-button-tech-debt' into 'master'

Replaces loading_button with gl-button

See merge request gitlab-org/gitlab!26035
parents 33896830 e8142784
...@@ -15,7 +15,6 @@ import { ...@@ -15,7 +15,6 @@ import {
GlDropdownDivider, GlDropdownDivider,
} from '@gitlab/ui'; } from '@gitlab/ui';
import { __, sprintf, n__ } from '~/locale'; import { __, sprintf, n__ } from '~/locale';
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';
import TooltipOnTruncate from '~/vue_shared/components/tooltip_on_truncate.vue'; import TooltipOnTruncate from '~/vue_shared/components/tooltip_on_truncate.vue';
import Stacktrace from './stacktrace.vue'; import Stacktrace from './stacktrace.vue';
...@@ -28,7 +27,6 @@ import query from '../queries/details.query.graphql'; ...@@ -28,7 +27,6 @@ import query from '../queries/details.query.graphql';
export default { export default {
components: { components: {
LoadingButton,
GlButton, GlButton,
GlFormInput, GlFormInput,
GlLink, GlLink,
...@@ -234,19 +232,21 @@ export default { ...@@ -234,19 +232,21 @@ export default {
</div> </div>
<div class="error-details-actions"> <div class="error-details-actions">
<div class="d-inline-flex bv-d-sm-down-none"> <div class="d-inline-flex bv-d-sm-down-none">
<loading-button <gl-button
:label="ignoreBtnLabel"
:loading="updatingIgnoreStatus" :loading="updatingIgnoreStatus"
data-qa-selector="update_ignore_status_button" data-qa-selector="update_ignore_status_button"
@click="onIgnoreStatusUpdate" @click="onIgnoreStatusUpdate"
/> >
<loading-button {{ ignoreBtnLabel }}
</gl-button>
<gl-button
class="btn-outline-info ml-2" class="btn-outline-info ml-2"
:label="resolveBtnLabel"
:loading="updatingResolveStatus" :loading="updatingResolveStatus"
data-qa-selector="update_resolve_status_button" data-qa-selector="update_resolve_status_button"
@click="onResolveStatusUpdate" @click="onResolveStatusUpdate"
/> >
{{ resolveBtnLabel }}
</gl-button>
<gl-button <gl-button
v-if="error.gitlabIssuePath" v-if="error.gitlabIssuePath"
class="ml-2" class="ml-2"
...@@ -270,14 +270,15 @@ export default { ...@@ -270,14 +270,15 @@ export default {
name="issue[sentry_issue_attributes][sentry_issue_identifier]" name="issue[sentry_issue_attributes][sentry_issue_identifier]"
/> />
<gl-form-input :value="csrfToken" class="hidden" name="authenticity_token" /> <gl-form-input :value="csrfToken" class="hidden" name="authenticity_token" />
<loading-button <gl-button
v-if="!error.gitlabIssuePath" v-if="!error.gitlabIssuePath"
class="btn-success" class="btn-success"
:label="__('Create issue')"
:loading="issueCreationInProgress" :loading="issueCreationInProgress"
data-qa-selector="create_issue_button" data-qa-selector="create_issue_button"
@click="createIssue" @click="createIssue"
/> >
{{ __('Create issue') }}
</gl-button>
</form> </form>
</div> </div>
<gl-dropdown <gl-dropdown
......
import { createLocalVue, shallowMount } from '@vue/test-utils'; import { createLocalVue, shallowMount } from '@vue/test-utils';
import Vuex from 'vuex'; import Vuex from 'vuex';
import { __ } from '~/locale'; import { __ } from '~/locale';
import { GlLoadingIcon, GlLink, GlBadge, GlFormInput, GlAlert, GlSprintf } from '@gitlab/ui'; import {
import LoadingButton from '~/vue_shared/components/loading_button.vue'; GlButton,
GlLoadingIcon,
GlLink,
GlBadge,
GlFormInput,
GlAlert,
GlSprintf,
} 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';
import { import {
...@@ -28,7 +35,7 @@ describe('ErrorDetails', () => { ...@@ -28,7 +35,7 @@ describe('ErrorDetails', () => {
function mountComponent() { function mountComponent() {
wrapper = shallowMount(ErrorDetails, { wrapper = shallowMount(ErrorDetails, {
stubs: { LoadingButton, GlSprintf }, stubs: { GlButton, GlSprintf },
localVue, localVue,
store, store,
mocks, mocks,
...@@ -127,7 +134,7 @@ describe('ErrorDetails', () => { ...@@ -127,7 +134,7 @@ describe('ErrorDetails', () => {
expect(wrapper.find(GlLoadingIcon).exists()).toBe(true); expect(wrapper.find(GlLoadingIcon).exists()).toBe(true);
expect(wrapper.find(Stacktrace).exists()).toBe(false); expect(wrapper.find(Stacktrace).exists()).toBe(false);
expect(wrapper.find(GlBadge).exists()).toBe(false); expect(wrapper.find(GlBadge).exists()).toBe(false);
expect(wrapper.findAll('button').length).toBe(3); expect(wrapper.findAll(GlButton).length).toBe(3);
}); });
describe('Badges', () => { describe('Badges', () => {
...@@ -226,7 +233,7 @@ describe('ErrorDetails', () => { ...@@ -226,7 +233,7 @@ describe('ErrorDetails', () => {
it('should submit the form', () => { it('should submit the form', () => {
window.HTMLFormElement.prototype.submit = () => {}; window.HTMLFormElement.prototype.submit = () => {};
const submitSpy = jest.spyOn(wrapper.vm.$refs.sentryIssueForm, 'submit'); const submitSpy = jest.spyOn(wrapper.vm.$refs.sentryIssueForm, 'submit');
wrapper.find('[data-qa-selector="create_issue_button"]').trigger('click'); wrapper.find('[data-qa-selector="create_issue_button"]').vm.$emit('click');
expect(submitSpy).toHaveBeenCalled(); expect(submitSpy).toHaveBeenCalled();
submitSpy.mockRestore(); submitSpy.mockRestore();
}); });
...@@ -255,14 +262,14 @@ describe('ErrorDetails', () => { ...@@ -255,14 +262,14 @@ describe('ErrorDetails', () => {
}); });
it('marks error as ignored when ignore button is clicked', () => { it('marks error as ignored when ignore button is clicked', () => {
findUpdateIgnoreStatusButton().trigger('click'); findUpdateIgnoreStatusButton().vm.$emit('click');
expect(actions.updateIgnoreStatus.mock.calls[0][1]).toEqual( expect(actions.updateIgnoreStatus.mock.calls[0][1]).toEqual(
expect.objectContaining({ status: errorStatus.IGNORED }), expect.objectContaining({ status: errorStatus.IGNORED }),
); );
}); });
it('marks error as resolved when resolve button is clicked', () => { it('marks error as resolved when resolve button is clicked', () => {
findUpdateResolveStatusButton().trigger('click'); findUpdateResolveStatusButton().vm.$emit('click');
expect(actions.updateResolveStatus.mock.calls[0][1]).toEqual( expect(actions.updateResolveStatus.mock.calls[0][1]).toEqual(
expect.objectContaining({ status: errorStatus.RESOLVED }), expect.objectContaining({ status: errorStatus.RESOLVED }),
); );
...@@ -281,14 +288,14 @@ describe('ErrorDetails', () => { ...@@ -281,14 +288,14 @@ describe('ErrorDetails', () => {
}); });
it('marks error as unresolved when ignore button is clicked', () => { it('marks error as unresolved when ignore button is clicked', () => {
findUpdateIgnoreStatusButton().trigger('click'); findUpdateIgnoreStatusButton().vm.$emit('click');
expect(actions.updateIgnoreStatus.mock.calls[0][1]).toEqual( expect(actions.updateIgnoreStatus.mock.calls[0][1]).toEqual(
expect.objectContaining({ status: errorStatus.UNRESOLVED }), expect.objectContaining({ status: errorStatus.UNRESOLVED }),
); );
}); });
it('marks error as resolved when resolve button is clicked', () => { it('marks error as resolved when resolve button is clicked', () => {
findUpdateResolveStatusButton().trigger('click'); findUpdateResolveStatusButton().vm.$emit('click');
expect(actions.updateResolveStatus.mock.calls[0][1]).toEqual( expect(actions.updateResolveStatus.mock.calls[0][1]).toEqual(
expect.objectContaining({ status: errorStatus.RESOLVED }), expect.objectContaining({ status: errorStatus.RESOLVED }),
); );
...@@ -307,14 +314,14 @@ describe('ErrorDetails', () => { ...@@ -307,14 +314,14 @@ describe('ErrorDetails', () => {
}); });
it('marks error as ignored when ignore button is clicked', () => { it('marks error as ignored when ignore button is clicked', () => {
findUpdateIgnoreStatusButton().trigger('click'); findUpdateIgnoreStatusButton().vm.$emit('click');
expect(actions.updateIgnoreStatus.mock.calls[0][1]).toEqual( expect(actions.updateIgnoreStatus.mock.calls[0][1]).toEqual(
expect.objectContaining({ status: errorStatus.IGNORED }), expect.objectContaining({ status: errorStatus.IGNORED }),
); );
}); });
it('marks error as unresolved when unresolve button is clicked', () => { it('marks error as unresolved when unresolve button is clicked', () => {
findUpdateResolveStatusButton().trigger('click'); findUpdateResolveStatusButton().vm.$emit('click');
expect(actions.updateResolveStatus.mock.calls[0][1]).toEqual( expect(actions.updateResolveStatus.mock.calls[0][1]).toEqual(
expect.objectContaining({ status: errorStatus.UNRESOLVED }), expect.objectContaining({ status: errorStatus.UNRESOLVED }),
); );
......
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