2020-05-07 08:09:46 -04:00
|
|
|
import Vue from 'vue';
|
2021-07-20 05:08:43 -04:00
|
|
|
import { DESIGN_MARK_APP_START, DESIGN_MEASURE_BEFORE_APP } from '~/performance/constants';
|
|
|
|
import { performanceMarkAndMeasure } from '~/performance/utils';
|
2020-05-07 08:09:46 -04:00
|
|
|
import App from './components/app.vue';
|
|
|
|
import apolloProvider from './graphql';
|
2021-03-24 17:09:02 -04:00
|
|
|
import activeDiscussionQuery from './graphql/queries/active_discussion.query.graphql';
|
2021-02-14 13:09:20 -05:00
|
|
|
import createRouter from './router';
|
2020-05-07 08:09:46 -04:00
|
|
|
|
|
|
|
export default () => {
|
2020-09-02 17:10:43 -04:00
|
|
|
const el = document.querySelector('.js-design-management');
|
2022-01-07 13:16:06 -05:00
|
|
|
const { issueIid, projectPath, issuePath, registerPath, signInPath } = el.dataset;
|
2020-05-07 08:09:46 -04:00
|
|
|
const router = createRouter(issuePath);
|
|
|
|
|
2021-03-24 17:09:02 -04:00
|
|
|
apolloProvider.clients.defaultClient.cache.writeQuery({
|
|
|
|
query: activeDiscussionQuery,
|
2020-05-07 08:09:46 -04:00
|
|
|
data: {
|
2020-05-15 02:08:40 -04:00
|
|
|
activeDiscussion: {
|
|
|
|
__typename: 'ActiveDiscussion',
|
|
|
|
id: null,
|
|
|
|
source: null,
|
|
|
|
},
|
2020-05-07 08:09:46 -04:00
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
return new Vue({
|
|
|
|
el,
|
2022-02-16 01:12:24 -05:00
|
|
|
name: 'DesignRoot',
|
2020-05-07 08:09:46 -04:00
|
|
|
router,
|
|
|
|
apolloProvider,
|
2020-07-28 08:09:49 -04:00
|
|
|
provide: {
|
|
|
|
projectPath,
|
|
|
|
issueIid,
|
2022-01-07 13:16:06 -05:00
|
|
|
registerPath,
|
|
|
|
signInPath,
|
2020-07-28 08:09:49 -04:00
|
|
|
},
|
2021-07-20 05:08:43 -04:00
|
|
|
mounted() {
|
|
|
|
performanceMarkAndMeasure({
|
|
|
|
mark: DESIGN_MARK_APP_START,
|
|
|
|
measures: [
|
|
|
|
{
|
|
|
|
name: DESIGN_MEASURE_BEFORE_APP,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
});
|
|
|
|
},
|
2020-05-07 08:09:46 -04:00
|
|
|
render(createElement) {
|
|
|
|
return createElement(App);
|
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|