Commit 0c3bca67 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'mg-update-resolve-wip-button' into 'master'

Update loading indicator in "Resolve Status" button

See merge request gitlab-org/gitlab!25958
parents f3fe254f 16756d86
<script> <script>
import $ from 'jquery'; import $ from 'jquery';
import { __ } from '~/locale'; import { GlButton } from '@gitlab/ui';
import { __, s__ } from '~/locale';
import createFlash from '~/flash'; import createFlash from '~/flash';
import statusIcon from '../mr_widget_status_icon.vue'; import StatusIcon from '../mr_widget_status_icon.vue';
import tooltip from '../../../vue_shared/directives/tooltip'; import tooltip from '../../../vue_shared/directives/tooltip';
import eventHub from '../../event_hub'; import eventHub from '../../event_hub';
export default { export default {
name: 'WorkInProgress', name: 'WorkInProgress',
components: { components: {
statusIcon, StatusIcon,
GlButton,
}, },
directives: { directives: {
tooltip, tooltip,
...@@ -23,8 +25,15 @@ export default { ...@@ -23,8 +25,15 @@ export default {
isMakingRequest: false, isMakingRequest: false,
}; };
}, },
computed: {
wipInfoTooltip() {
return s__(
'mrWidget|When this merge request is ready, remove the WIP: prefix from the title to allow it to be merged',
);
},
},
methods: { methods: {
removeWIP() { handleRemoveWIP() {
this.isMakingRequest = true; this.isMakingRequest = true;
this.service this.service
.removeWIP() .removeWIP()
...@@ -52,29 +61,22 @@ export default { ...@@ -52,29 +61,22 @@ export default {
<i <i
v-tooltip v-tooltip
class="fa fa-question-circle" class="fa fa-question-circle"
:title=" :title="wipInfoTooltip"
s__( :aria-label="wipInfoTooltip"
'mrWidget|When this merge request is ready, remove the WIP: prefix from the title to allow it to be merged',
)
"
:aria-label="
s__(
'mrWidget|When this merge request is ready, remove the WIP: prefix from the title to allow it to be merged',
)
"
> >
</i> </i>
</span> </span>
<button <gl-button
v-if="mr.removeWIPPath" v-if="mr.removeWIPPath"
size="sm"
variant="default"
:disabled="isMakingRequest" :disabled="isMakingRequest"
type="button" :loading="isMakingRequest"
class="btn btn-default btn-sm js-remove-wip" class="js-remove-wip"
@click="removeWIP" @click="handleRemoveWIP"
> >
<i v-if="isMakingRequest" class="fa fa-spinner fa-spin" aria-hidden="true"> </i>
{{ s__('mrWidget|Resolve WIP status') }} {{ s__('mrWidget|Resolve WIP status') }}
</button> </gl-button>
</div> </div>
</div> </div>
</template> </template>
...@@ -43,7 +43,7 @@ describe('Wip', () => { ...@@ -43,7 +43,7 @@ describe('Wip', () => {
is_new_mr_data: true, is_new_mr_data: true,
}; };
describe('removeWIP', () => { describe('handleRemoveWIP', () => {
it('should make a request to service and handle response', done => { it('should make a request to service and handle response', done => {
const vm = createComponent(); const vm = createComponent();
...@@ -57,7 +57,7 @@ describe('Wip', () => { ...@@ -57,7 +57,7 @@ describe('Wip', () => {
}), }),
); );
vm.removeWIP(); vm.handleRemoveWIP();
setTimeout(() => { setTimeout(() => {
expect(vm.isMakingRequest).toBeTruthy(); expect(vm.isMakingRequest).toBeTruthy();
expect(eventHub.$emit).toHaveBeenCalledWith('UpdateWidgetData', mrObj); expect(eventHub.$emit).toHaveBeenCalledWith('UpdateWidgetData', mrObj);
......
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