debian-mirror-gitlab/app/assets/javascripts/batch_comments/index.js

31 lines
696 B
JavaScript
Raw Normal View History

2020-06-23 00:09:42 +05:30
import Vue from 'vue';
2021-11-11 11:23:49 +05:30
import { mapActions, mapGetters } from 'vuex';
2020-06-23 00:09:42 +05:30
import store from '~/mr_notes/stores';
export const initReviewBar = () => {
const el = document.getElementById('js-review-bar');
// eslint-disable-next-line no-new
new Vue({
el,
store,
2021-11-11 11:23:49 +05:30
components: {
ReviewBar: () => import('./components/review_bar.vue'),
},
computed: {
...mapGetters('batchComments', ['draftsCount']),
},
2020-06-23 00:09:42 +05:30
mounted() {
this.fetchDrafts();
},
methods: {
...mapActions('batchComments', ['fetchDrafts']),
},
render(createElement) {
2021-11-11 11:23:49 +05:30
if (this.draftsCount === 0) return null;
return createElement('review-bar');
2020-06-23 00:09:42 +05:30
},
});
};