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

43 lines
1.1 KiB
JavaScript
Raw Normal View History

2018-11-08 19:23:39 +05:30
import Vue from 'vue';
import { mapState } from 'vuex';
import diffsApp from './components/app.vue';
export default function initDiffsApp(store) {
return new Vue({
el: '#js-diffs-app',
name: 'MergeRequestDiffs',
components: {
diffsApp,
},
store,
data() {
const { dataset } = document.querySelector(this.$options.el);
return {
endpoint: dataset.endpoint,
projectPath: dataset.projectPath,
2019-02-13 22:33:31 +05:30
helpPagePath: dataset.helpPagePath,
currentUser: JSON.parse(dataset.currentUserData) || {},
changesEmptyStateIllustration: dataset.changesEmptyStateIllustration,
2018-11-08 19:23:39 +05:30
};
},
computed: {
...mapState({
activeTab: state => state.page.activeTab,
}),
},
render(createElement) {
return createElement('diffs-app', {
props: {
endpoint: this.endpoint,
currentUser: this.currentUser,
projectPath: this.projectPath,
2019-02-13 22:33:31 +05:30
helpPagePath: this.helpPagePath,
2018-11-08 19:23:39 +05:30
shouldShow: this.activeTab === 'diffs',
2019-02-13 22:33:31 +05:30
changesEmptyStateIllustration: this.changesEmptyStateIllustration,
2018-11-08 19:23:39 +05:30
},
});
},
});
}