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

51 lines
1.3 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');
2022-03-02 08:16:31 +05:30
const { issueIid, projectPath, issuePath, registerPath, signInPath } = el.dataset;
2020-05-24 23:13:21 +05:30
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,
2022-04-04 11:22:00 +05:30
name: 'DesignRoot',
2020-05-24 23:13:21 +05:30
router,
apolloProvider,
2020-10-24 23:57:45 +05:30
provide: {
projectPath,
issueIid,
2022-03-02 08:16:31 +05:30
registerPath,
signInPath,
2020-10-24 23:57:45 +05:30
},
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);
},
});
};