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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

39 lines
923 B
JavaScript
Raw Normal View History

2020-06-23 00:09:42 +05:30
import Vue from 'vue';
2023-05-27 22:25:52 +05:30
import VueApollo from 'vue-apollo';
2021-11-11 11:23:49 +05:30
import { mapActions, mapGetters } from 'vuex';
2023-05-27 22:25:52 +05:30
import { apolloProvider } from '~/graphql_shared/issuable_client';
2020-06-23 00:09:42 +05:30
import store from '~/mr_notes/stores';
export const initReviewBar = () => {
const el = document.getElementById('js-review-bar');
2023-05-27 22:25:52 +05:30
Vue.use(VueApollo);
2020-06-23 00:09:42 +05:30
// eslint-disable-next-line no-new
new Vue({
el,
store,
2023-05-27 22:25:52 +05:30
apolloProvider,
2021-11-11 11:23:49 +05:30
components: {
ReviewBar: () => import('./components/review_bar.vue'),
},
2023-05-27 22:25:52 +05:30
provide: {
newSavedRepliesPath: el.dataset.savedRepliesNewPath,
},
2021-11-11 11:23:49 +05:30
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
},
});
};