debian-mirror-gitlab/app/assets/javascripts/batch_comments/components/review_bar.vue
2022-07-29 14:03:07 +02:00

50 lines
1.3 KiB
Vue

<script>
import { mapActions, mapGetters } from 'vuex';
import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import { REVIEW_BAR_VISIBLE_CLASS_NAME } from '../constants';
import PreviewDropdown from './preview_dropdown.vue';
import PublishButton from './publish_button.vue';
import SubmitDropdown from './submit_dropdown.vue';
export default {
components: {
PreviewDropdown,
PublishButton,
SubmitDropdown,
},
mixins: [glFeatureFlagMixin()],
computed: {
...mapGetters(['isNotesFetched']),
},
watch: {
isNotesFetched() {
if (this.isNotesFetched) {
this.expandAllDiscussions();
}
},
},
mounted() {
document.body.classList.add(REVIEW_BAR_VISIBLE_CLASS_NAME);
},
beforeDestroy() {
document.body.classList.remove(REVIEW_BAR_VISIBLE_CLASS_NAME);
},
methods: {
...mapActions('batchComments', ['expandAllDiscussions']),
},
};
</script>
<template>
<div>
<nav class="review-bar-component" data-testid="review_bar_component">
<div
class="review-bar-content d-flex gl-justify-content-end"
data-qa-selector="review_bar_content"
>
<preview-dropdown />
<publish-button v-if="!glFeatures.mrReviewSubmitComment" class="gl-ml-3" show-count />
<submit-dropdown v-else />
</div>
</nav>
</div>
</template>