Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/batch_comments/components/publish_button.vue')
-rw-r--r--app/assets/javascripts/batch_comments/components/publish_button.vue55
1 files changed, 55 insertions, 0 deletions
diff --git a/app/assets/javascripts/batch_comments/components/publish_button.vue b/app/assets/javascripts/batch_comments/components/publish_button.vue
new file mode 100644
index 00000000000..f4dc0f04dc3
--- /dev/null
+++ b/app/assets/javascripts/batch_comments/components/publish_button.vue
@@ -0,0 +1,55 @@
+<script>
+import { mapActions, mapState } from 'vuex';
+import { __ } from '~/locale';
+import LoadingButton from '~/vue_shared/components/loading_button.vue';
+import DraftsCount from './drafts_count.vue';
+
+export default {
+ components: {
+ LoadingButton,
+ DraftsCount,
+ },
+ props: {
+ showCount: {
+ type: Boolean,
+ required: false,
+ default: false,
+ },
+ label: {
+ type: String,
+ required: false,
+ default: __('Finish review'),
+ },
+ 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>
+ <loading-button
+ :loading="isPublishing"
+ container-class="btn btn-success js-publish-draft-button qa-submit-review"
+ @click="onClick"
+ >
+ <span>
+ {{ label }}
+ <drafts-count v-if="showCount" />
+ </span>
+ </loading-button>
+</template>