diff options
Diffstat (limited to 'app/assets/javascripts/batch_comments/components/publish_button.vue')
-rw-r--r-- | app/assets/javascripts/batch_comments/components/publish_button.vue | 55 |
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> |