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

48 lines
1.2 KiB
JavaScript
Raw Normal View History

2020-05-24 23:13:21 +05:30
import Vue from 'vue';
2021-10-27 15:23:28 +05:30
import { DESIGN_MARK_APP_START, DESIGN_MEASURE_BEFORE_APP } from '~/performance/constants';
import { performanceMarkAndMeasure } from '~/performance/utils';
2020-05-24 23:13:21 +05:30
import App from './components/app.vue';
import apolloProvider from './graphql';
2021-04-29 21:17:54 +05:30
import activeDiscussionQuery from './graphql/queries/active_discussion.query.graphql';
2021-03-11 19:13:27 +05:30
import createRouter from './router';
2020-05-24 23:13:21 +05:30
export default () => {
2020-11-24 15:15:51 +05:30
const el = document.querySelector('.js-design-management');
2020-05-24 23:13:21 +05:30
const { issueIid, projectPath, issuePath } = el.dataset;
const router = createRouter(issuePath);
2021-04-29 21:17:54 +05:30
apolloProvider.clients.defaultClient.cache.writeQuery({
query: activeDiscussionQuery,
2020-05-24 23:13:21 +05:30
data: {
activeDiscussion: {
__typename: 'ActiveDiscussion',
id: null,
source: null,
},
},
});
return new Vue({
el,
router,
apolloProvider,
2020-10-24 23:57:45 +05:30
provide: {
projectPath,
issueIid,
},
2021-10-27 15:23:28 +05:30
mounted() {
performanceMarkAndMeasure({
mark: DESIGN_MARK_APP_START,
measures: [
{
name: DESIGN_MEASURE_BEFORE_APP,
},
],
});
},
2020-05-24 23:13:21 +05:30
render(createElement) {
return createElement(App);
},
});
};