debian-mirror-gitlab/app/assets/javascripts/pipelines/pipeline_tabs.js
2022-06-21 17:19:12 +05:30

44 lines
1.2 KiB
JavaScript

import Vue from 'vue';
import VueApollo from 'vue-apollo';
import PipelineTabs from 'ee_else_ce/pipelines/components/pipeline_tabs.vue';
import { reportToSentry } from './utils';
Vue.use(VueApollo);
const createPipelineTabs = (selector, apolloProvider) => {
const el = document.querySelector(selector);
if (!el) return;
const { dataset } = document.querySelector(selector);
const {
canGenerateCodequalityReports,
codequalityReportDownloadPath,
downloadablePathForReportType,
exposeSecurityDashboard,
exposeLicenseScanningData,
} = dataset;
// eslint-disable-next-line no-new
new Vue({
el: selector,
components: {
PipelineTabs,
},
apolloProvider,
provide: {
canGenerateCodequalityReports: JSON.parse(canGenerateCodequalityReports),
codequalityReportDownloadPath,
downloadablePathForReportType,
exposeSecurityDashboard: JSON.parse(exposeSecurityDashboard),
exposeLicenseScanningData: JSON.parse(exposeLicenseScanningData),
},
errorCaptured(err, _vm, info) {
reportToSentry('pipeline_tabs', `error: ${err}, info: ${info}`);
},
render(createElement) {
return createElement(PipelineTabs);
},
});
};
export { createPipelineTabs };