debian-mirror-gitlab/app/assets/javascripts/batch_comments/components/publish_button.vue

66 lines
1.3 KiB
Vue
Raw Normal View History

2020-06-23 00:09:42 +05:30
<script>
import { mapActions, mapState } from 'vuex';
2020-10-24 23:57:45 +05:30
import { GlButton } from '@gitlab/ui';
2020-06-23 00:09:42 +05:30
import { __ } from '~/locale';
import DraftsCount from './drafts_count.vue';
export default {
components: {
2020-10-24 23:57:45 +05:30
GlButton,
2020-06-23 00:09:42 +05:30
DraftsCount,
},
props: {
showCount: {
type: Boolean,
required: false,
default: false,
},
label: {
type: String,
required: false,
default: __('Finish review'),
},
2020-10-24 23:57:45 +05:30
category: {
type: String,
required: false,
default: 'primary',
},
variant: {
type: String,
required: false,
default: 'success',
},
2020-06-23 00:09:42 +05:30
shouldPublish: {
type: Boolean,
required: true,
},
},
computed: {
...mapState('batchComments', ['isPublishing']),
},
methods: {
...mapActions('batchComments', ['publishReview', 'toggleReviewDropdown']),
onClick() {
if (this.shouldPublish) {
this.publishReview();
} else {
this.toggleReviewDropdown();
}
},
},
};
</script>
<template>
2020-10-24 23:57:45 +05:30
<gl-button
2020-06-23 00:09:42 +05:30
:loading="isPublishing"
2020-10-24 23:57:45 +05:30
class="js-publish-draft-button qa-submit-review"
:category="category"
:variant="variant"
2020-06-23 00:09:42 +05:30
@click="onClick"
>
2020-10-24 23:57:45 +05:30
{{ label }}
<drafts-count v-if="showCount" />
</gl-button>
2020-06-23 00:09:42 +05:30
</template>