debian-mirror-gitlab/app/assets/javascripts/vue_merge_request_widget/components/states/work_in_progress.vue

81 lines
2.2 KiB
Vue
Raw Normal View History

2018-10-15 14:42:47 +05:30
<script>
2018-05-09 12:01:36 +05:30
import $ from 'jquery';
2019-12-21 20:55:43 +05:30
import { __ } from '~/locale';
import createFlash from '~/flash';
2018-03-17 18:26:18 +05:30
import statusIcon from '../mr_widget_status_icon.vue';
2017-09-10 17:25:29 +05:30
import tooltip from '../../../vue_shared/directives/tooltip';
2017-08-17 22:00:37 +05:30
import eventHub from '../../event_hub';
export default {
2018-10-15 14:42:47 +05:30
name: 'WorkInProgress',
components: {
statusIcon,
2017-08-17 22:00:37 +05:30
},
2017-09-10 17:25:29 +05:30
directives: {
tooltip,
},
2018-10-15 14:42:47 +05:30
props: {
mr: { type: Object, required: true },
service: { type: Object, required: true },
},
2017-08-17 22:00:37 +05:30
data() {
return {
isMakingRequest: false,
};
},
methods: {
removeWIP() {
this.isMakingRequest = true;
2018-12-13 13:39:08 +05:30
this.service
.removeWIP()
2018-03-17 18:26:18 +05:30
.then(res => res.data)
2018-12-13 13:39:08 +05:30
.then(data => {
2018-03-17 18:26:18 +05:30
eventHub.$emit('UpdateWidgetData', data);
2019-12-21 20:55:43 +05:30
createFlash(__('The merge request can now be merged.'), 'notice');
2017-08-17 22:00:37 +05:30
$('.merge-request .detail-page-description .title').text(this.mr.title);
})
.catch(() => {
this.isMakingRequest = false;
2019-12-21 20:55:43 +05:30
createFlash(__('Something went wrong. Please try again.'));
2017-08-17 22:00:37 +05:30
});
},
},
};
2018-10-15 14:42:47 +05:30
</script>
<template>
<div class="mr-widget-body media">
2019-02-15 15:39:39 +05:30
<status-icon :show-disabled-button="Boolean(mr.removeWIPPath)" status="warning" />
2018-10-15 14:42:47 +05:30
<div class="media-body space-children">
<span class="bold">
2019-09-30 21:07:59 +05:30
{{ __('This is a Work in Progress') }}
2018-10-15 14:42:47 +05:30
<i
v-tooltip
class="fa fa-question-circle"
2019-09-30 21:07:59 +05:30
:title="
s__(
'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',
)
"
2019-02-15 15:39:39 +05:30
>
2018-10-15 14:42:47 +05:30
</i>
</span>
<button
v-if="mr.removeWIPPath"
:disabled="isMakingRequest"
type="button"
2018-11-08 19:23:39 +05:30
class="btn btn-default btn-sm js-remove-wip"
2019-02-15 15:39:39 +05:30
@click="removeWIP"
>
2019-09-30 21:07:59 +05:30
<i v-if="isMakingRequest" class="fa fa-spinner fa-spin" aria-hidden="true"> </i>
{{ s__('mrWidget|Resolve WIP status') }}
2018-10-15 14:42:47 +05:30
</button>
</div>
</div>
</template>