2018-05-09 12:01:36 +05:30
|
|
|
import Vue from 'vue';
|
2022-05-07 20:08:51 +05:30
|
|
|
import Vuex from 'vuex';
|
2021-06-08 01:23:25 +05:30
|
|
|
import VueApollo from 'vue-apollo';
|
2022-03-02 08:16:31 +05:30
|
|
|
import VueRouter from 'vue-router';
|
2021-09-04 01:27:46 +05:30
|
|
|
import TableOfContents from '~/blob/components/table_contents.vue';
|
2021-03-11 19:13:27 +05:30
|
|
|
import PipelineTourSuccessModal from '~/blob/pipeline_tour_success_modal.vue';
|
2021-10-27 15:23:28 +05:30
|
|
|
import { BlobViewer, initAuxiliaryViewer } from '~/blob/viewer/index';
|
2018-11-18 11:00:15 +05:30
|
|
|
import GpgBadges from '~/gpg_badges';
|
2021-06-08 01:23:25 +05:30
|
|
|
import createDefaultClient from '~/lib/graphql';
|
2021-03-11 19:13:27 +05:30
|
|
|
import initBlob from '~/pages/projects/init_blob';
|
2021-01-03 14:25:43 +05:30
|
|
|
import initWebIdeLink from '~/pages/projects/shared/web_ide_link';
|
2022-10-11 01:57:18 +05:30
|
|
|
import CommitPipelineStatus from '~/projects/tree/components/commit_pipeline_status_component.vue';
|
2021-04-29 21:17:54 +05:30
|
|
|
import BlobContentViewer from '~/repository/components/blob_content_viewer.vue';
|
2019-12-26 22:10:19 +05:30
|
|
|
import '~/sourcegraph/load';
|
2022-05-07 20:08:51 +05:30
|
|
|
import createStore from '~/code_navigation/store';
|
2020-11-24 15:15:51 +05:30
|
|
|
|
2022-05-07 20:08:51 +05:30
|
|
|
Vue.use(Vuex);
|
2021-06-08 01:23:25 +05:30
|
|
|
Vue.use(VueApollo);
|
2022-03-02 08:16:31 +05:30
|
|
|
Vue.use(VueRouter);
|
2021-06-08 01:23:25 +05:30
|
|
|
|
|
|
|
const apolloProvider = new VueApollo({
|
2021-12-11 22:18:48 +05:30
|
|
|
defaultClient: createDefaultClient(),
|
2021-06-08 01:23:25 +05:30
|
|
|
});
|
|
|
|
|
2022-03-02 08:16:31 +05:30
|
|
|
const router = new VueRouter({ mode: 'history' });
|
|
|
|
|
2021-04-29 21:17:54 +05:30
|
|
|
const viewBlobEl = document.querySelector('#js-view-blob-app');
|
|
|
|
|
|
|
|
if (viewBlobEl) {
|
2021-09-04 01:27:46 +05:30
|
|
|
const { blobPath, projectPath, targetBranch, originalBranch } = viewBlobEl.dataset;
|
2021-04-29 21:17:54 +05:30
|
|
|
|
|
|
|
// eslint-disable-next-line no-new
|
|
|
|
new Vue({
|
|
|
|
el: viewBlobEl,
|
2022-05-07 20:08:51 +05:30
|
|
|
store: createStore(),
|
2022-03-02 08:16:31 +05:30
|
|
|
router,
|
2021-06-08 01:23:25 +05:30
|
|
|
apolloProvider,
|
2021-09-04 01:27:46 +05:30
|
|
|
provide: {
|
|
|
|
targetBranch,
|
|
|
|
originalBranch,
|
|
|
|
},
|
2021-04-29 21:17:54 +05:30
|
|
|
render(createElement) {
|
|
|
|
return createElement(BlobContentViewer, {
|
|
|
|
props: {
|
|
|
|
path: blobPath,
|
2021-06-08 01:23:25 +05:30
|
|
|
projectPath,
|
2021-04-29 21:17:54 +05:30
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|
2021-10-27 15:23:28 +05:30
|
|
|
|
|
|
|
initAuxiliaryViewer();
|
2022-03-02 08:16:31 +05:30
|
|
|
initBlob();
|
2021-04-29 21:17:54 +05:30
|
|
|
} else {
|
|
|
|
new BlobViewer(); // eslint-disable-line no-new
|
|
|
|
initBlob();
|
|
|
|
}
|
2018-05-09 12:01:36 +05:30
|
|
|
|
2021-04-17 20:07:23 +05:30
|
|
|
const CommitPipelineStatusEl = document.querySelector('.js-commit-pipeline-status');
|
|
|
|
const statusLink = document.querySelector('.commit-actions .ci-status-link');
|
|
|
|
if (statusLink) {
|
|
|
|
statusLink.remove();
|
|
|
|
// eslint-disable-next-line no-new
|
|
|
|
new Vue({
|
|
|
|
el: CommitPipelineStatusEl,
|
|
|
|
components: {
|
2022-10-11 01:57:18 +05:30
|
|
|
CommitPipelineStatus,
|
2021-04-17 20:07:23 +05:30
|
|
|
},
|
|
|
|
render(createElement) {
|
|
|
|
return createElement('commit-pipeline-status', {
|
|
|
|
props: {
|
|
|
|
endpoint: CommitPipelineStatusEl.dataset.endpoint,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|
2018-11-18 11:00:15 +05:30
|
|
|
|
2021-04-17 20:07:23 +05:30
|
|
|
initWebIdeLink({ el: document.getElementById('js-blob-web-ide-link') });
|
2021-01-03 14:25:43 +05:30
|
|
|
|
2021-04-17 20:07:23 +05:30
|
|
|
GpgBadges.fetch();
|
2020-03-13 15:44:24 +05:30
|
|
|
|
2021-04-17 20:07:23 +05:30
|
|
|
const codeNavEl = document.getElementById('js-code-navigation');
|
2020-05-24 23:13:21 +05:30
|
|
|
|
2022-05-07 20:08:51 +05:30
|
|
|
if (codeNavEl && !viewBlobEl) {
|
2021-04-17 20:07:23 +05:30
|
|
|
const { codeNavigationPath, blobPath, definitionPathPrefix } = codeNavEl.dataset;
|
2020-04-22 19:07:51 +05:30
|
|
|
|
2021-04-17 20:07:23 +05:30
|
|
|
// eslint-disable-next-line promise/catch-or-return
|
|
|
|
import('~/code_navigation').then((m) =>
|
|
|
|
m.default({
|
|
|
|
blobs: [{ path: blobPath, codeNavigationPath }],
|
|
|
|
definitionPathPrefix,
|
|
|
|
}),
|
|
|
|
);
|
|
|
|
}
|
2020-04-08 14:13:33 +05:30
|
|
|
|
2021-04-17 20:07:23 +05:30
|
|
|
const successPipelineEl = document.querySelector('.js-success-pipeline-modal');
|
2020-11-24 15:15:51 +05:30
|
|
|
|
2021-04-17 20:07:23 +05:30
|
|
|
if (successPipelineEl) {
|
|
|
|
// eslint-disable-next-line no-new
|
|
|
|
new Vue({
|
|
|
|
el: successPipelineEl,
|
|
|
|
render(createElement) {
|
|
|
|
return createElement(PipelineTourSuccessModal, {
|
|
|
|
props: {
|
|
|
|
...successPipelineEl.dataset,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|
2021-09-04 01:27:46 +05:30
|
|
|
|
|
|
|
const tableContentsEl = document.querySelector('.js-table-contents');
|
|
|
|
|
|
|
|
if (tableContentsEl) {
|
|
|
|
// eslint-disable-next-line no-new
|
|
|
|
new Vue({
|
|
|
|
el: tableContentsEl,
|
|
|
|
render(h) {
|
|
|
|
return h(TableOfContents);
|
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|