debian-mirror-gitlab/app/assets/javascripts/pages/projects/blob/show/index.js

71 lines
2.1 KiB
JavaScript
Raw Normal View History

2018-05-09 12:01:36 +05:30
import Vue from 'vue';
import commitPipelineStatus from '~/projects/tree/components/commit_pipeline_status_component.vue';
2018-03-17 18:26:18 +05:30
import BlobViewer from '~/blob/viewer/index';
import initBlob from '~/pages/projects/init_blob';
2018-11-18 11:00:15 +05:30
import GpgBadges from '~/gpg_badges';
2019-12-26 22:10:19 +05:30
import '~/sourcegraph/load';
2020-04-08 14:13:33 +05:30
import PipelineTourSuccessModal from '~/blob/pipeline_tour_success_modal.vue';
2018-03-17 18:26:18 +05:30
2018-03-27 19:54:05 +05:30
document.addEventListener('DOMContentLoaded', () => {
2018-03-17 18:26:18 +05:30
new BlobViewer(); // eslint-disable-line no-new
initBlob();
2018-05-09 12:01:36 +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: {
commitPipelineStatus,
},
render(createElement) {
return createElement('commit-pipeline-status', {
props: {
endpoint: CommitPipelineStatusEl.dataset.endpoint,
},
});
},
});
}
2018-11-18 11:00:15 +05:30
GpgBadges.fetch();
2020-03-13 15:44:24 +05:30
2020-05-24 23:13:21 +05:30
const codeNavEl = document.getElementById('js-code-navigation');
if (gon.features?.codeNavigation && codeNavEl) {
const { codeNavigationPath, blobPath, definitionPathPrefix } = codeNavEl.dataset;
2020-04-22 19:07:51 +05:30
2020-03-13 15:44:24 +05:30
// eslint-disable-next-line promise/catch-or-return
2020-04-22 19:07:51 +05:30
import('~/code_navigation').then(m =>
m.default({
blobs: [{ path: blobPath, codeNavigationPath }],
definitionPathPrefix,
}),
);
2020-03-13 15:44:24 +05:30
}
2020-04-08 14:13:33 +05:30
if (gon.features?.suggestPipeline) {
const successPipelineEl = document.querySelector('.js-success-pipeline-modal');
if (successPipelineEl) {
// eslint-disable-next-line no-new
new Vue({
el: successPipelineEl,
render(createElement) {
2020-04-22 19:07:51 +05:30
const { commitCookie, goToPipelinesPath, humanAccess } = this.$el.dataset;
2020-04-08 14:13:33 +05:30
return createElement(PipelineTourSuccessModal, {
props: {
goToPipelinesPath,
commitCookie,
2020-04-22 19:07:51 +05:30
humanAccess,
2020-04-08 14:13:33 +05:30
},
});
},
});
}
}
2018-03-27 19:54:05 +05:30
});