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

46 lines
1 KiB
JavaScript
Raw Normal View History

2020-04-22 19:07:51 +05:30
import Vue from 'vue';
2020-05-24 23:13:21 +05:30
import { parseBoolean } from '~/lib/utils/common_utils';
import App from './components/app.vue';
import createRouter from './router';
import createApolloProvider from './graphql';
2020-04-22 19:07:51 +05:30
const initStaticSiteEditor = el => {
2020-10-24 23:57:45 +05:30
const {
isSupportedContent,
path: sourcePath,
baseUrl,
namespace,
project,
mergeRequestsIllustrationPath,
} = el.dataset;
2020-05-24 23:13:21 +05:30
const { current_username: username } = window.gon;
const returnUrl = el.dataset.returnUrl || null;
2020-04-22 19:07:51 +05:30
2020-05-24 23:13:21 +05:30
const router = createRouter(baseUrl);
const apolloProvider = createApolloProvider({
isSupportedContent: parseBoolean(isSupportedContent),
project: `${namespace}/${project}`,
returnUrl,
sourcePath,
username,
2020-04-22 19:07:51 +05:30
});
return new Vue({
el,
2020-05-24 23:13:21 +05:30
router,
apolloProvider,
2020-04-22 19:07:51 +05:30
components: {
2020-05-24 23:13:21 +05:30
App,
2020-04-22 19:07:51 +05:30
},
render(createElement) {
2020-10-24 23:57:45 +05:30
return createElement('app', {
props: {
mergeRequestsIllustrationPath,
},
});
2020-04-22 19:07:51 +05:30
},
});
};
export default initStaticSiteEditor;