Commit f3fe254f authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'mg-replace-loading-spinner' into 'master'

Replace fa-spinner with SVG spinner in "merge" button

See merge request gitlab-org/gitlab!20887
parents 472a116b 4248cb0c
<script> <script>
import _ from 'underscore'; import _ from 'underscore';
import { GlIcon } from '@gitlab/ui'; import { GlIcon, GlButton } from '@gitlab/ui';
import successSvg from 'icons/_icon_status_success.svg'; import successSvg from 'icons/_icon_status_success.svg';
import warningSvg from 'icons/_icon_status_warning.svg'; import warningSvg from 'icons/_icon_status_warning.svg';
import readyToMergeMixin from 'ee_else_ce/vue_merge_request_widget/mixins/ready_to_merge'; import readyToMergeMixin from 'ee_else_ce/vue_merge_request_widget/mixins/ready_to_merge';
...@@ -26,6 +26,7 @@ export default { ...@@ -26,6 +26,7 @@ export default {
CommitEdit, CommitEdit,
CommitMessageDropdown, CommitMessageDropdown,
GlIcon, GlIcon,
GlButton,
MergeImmediatelyConfirmationDialog: () => MergeImmediatelyConfirmationDialog: () =>
import( import(
'ee_component/vue_merge_request_widget/components/merge_immediately_confirmation_dialog.vue' 'ee_component/vue_merge_request_widget/components/merge_immediately_confirmation_dialog.vue'
...@@ -67,18 +68,13 @@ export default { ...@@ -67,18 +68,13 @@ export default {
return 'success'; return 'success';
}, },
mergeButtonClass() { mergeButtonVariant() {
const defaultClass = 'btn btn-sm btn-success accept-merge-request';
const failedClass = `${defaultClass} btn-danger`;
const inActionClass = `${defaultClass} btn-info`;
if (this.status === 'failed') { if (this.status === 'failed') {
return failedClass; return 'danger';
} else if (this.status === 'pending') { } else if (this.status === 'pending') {
return inActionClass; return 'info';
} }
return 'success';
return defaultClass;
}, },
iconClass() { iconClass() {
if ( if (
...@@ -267,16 +263,16 @@ export default { ...@@ -267,16 +263,16 @@ export default {
<div class="media-body"> <div class="media-body">
<div class="mr-widget-body-controls media space-children"> <div class="mr-widget-body-controls media space-children">
<span class="btn-group"> <span class="btn-group">
<button <gl-button
size="sm"
class="qa-merge-button accept-merge-request"
:variant="mergeButtonVariant"
:disabled="isMergeButtonDisabled" :disabled="isMergeButtonDisabled"
:class="mergeButtonClass" :loading="isMakingRequest"
type="button"
class="qa-merge-button"
@click="handleMergeButtonClick(isAutoMergeAvailable)" @click="handleMergeButtonClick(isAutoMergeAvailable)"
> >
<i v-if="isMakingRequest" class="fa fa-spinner fa-spin" aria-hidden="true"></i>
{{ mergeButtonText }} {{ mergeButtonText }}
</button> </gl-button>
<button <button
v-if="shouldShowMergeImmediatelyDropdown" v-if="shouldShowMergeImmediatelyDropdown"
:disabled="isMergeButtonDisabled" :disabled="isMergeButtonDisabled"
......
...@@ -269,7 +269,7 @@ describe('ReadyToMerge', () => { ...@@ -269,7 +269,7 @@ describe('ReadyToMerge', () => {
const button = findMergeButton(); const button = findMergeButton();
expect(button.exists()).toBe(true); expect(button.exists()).toBe(true);
expect(button.attributes('disabled')).toBe('disabled'); expect(button.attributes('disabled')).toBe('true');
}); });
}); });
}); });
......
...@@ -145,34 +145,30 @@ describe('ReadyToMerge', () => { ...@@ -145,34 +145,30 @@ describe('ReadyToMerge', () => {
}); });
}); });
describe('mergeButtonClass', () => { describe('mergeButtonVariant', () => {
const defaultClass = 'btn btn-sm btn-success accept-merge-request';
const failedClass = `${defaultClass} btn-danger`;
const inActionClass = `${defaultClass} btn-info`;
it('defaults to success class', () => { it('defaults to success class', () => {
Vue.set(vm.mr, 'availableAutoMergeStrategies', []); Vue.set(vm.mr, 'availableAutoMergeStrategies', []);
expect(vm.mergeButtonClass).toEqual(defaultClass); expect(vm.mergeButtonVariant).toEqual('success');
}); });
it('returns success class for success status', () => { it('returns success class for success status', () => {
Vue.set(vm.mr, 'availableAutoMergeStrategies', []); Vue.set(vm.mr, 'availableAutoMergeStrategies', []);
Vue.set(vm.mr, 'pipeline', true); Vue.set(vm.mr, 'pipeline', true);
expect(vm.mergeButtonClass).toEqual(defaultClass); expect(vm.mergeButtonVariant).toEqual('success');
}); });
it('returns info class for pending status', () => { it('returns info class for pending status', () => {
Vue.set(vm.mr, 'availableAutoMergeStrategies', [MTWPS_MERGE_STRATEGY]); Vue.set(vm.mr, 'availableAutoMergeStrategies', [MTWPS_MERGE_STRATEGY]);
expect(vm.mergeButtonClass).toEqual(inActionClass); expect(vm.mergeButtonVariant).toEqual('info');
}); });
it('returns failed class for failed status', () => { it('returns danger class for failed status', () => {
vm.mr.hasCI = true; vm.mr.hasCI = true;
expect(vm.mergeButtonClass).toEqual(failedClass); expect(vm.mergeButtonVariant).toEqual('danger');
}); });
}); });
......
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