debian-mirror-gitlab/app/assets/javascripts/pipelines/pipeline_tabs.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

76 lines
2 KiB
JavaScript
Raw Normal View History

2022-06-21 17:19:12 +05:30
import Vue from 'vue';
import VueApollo from 'vue-apollo';
import PipelineTabs from 'ee_else_ce/pipelines/components/pipeline_tabs.vue';
2022-07-16 23:28:13 +05:30
import { removeParams, updateHistory } from '~/lib/utils/url_utility';
import { TAB_QUERY_PARAM } from '~/pipelines/constants';
import { parseBoolean } from '~/lib/utils/common_utils';
import { getPipelineDefaultTab, reportToSentry } from './utils';
2022-06-21 17:19:12 +05:30
Vue.use(VueApollo);
2022-07-23 23:45:48 +05:30
export const createAppOptions = (selector, apolloProvider) => {
2022-06-21 17:19:12 +05:30
const el = document.querySelector(selector);
2022-07-23 23:45:48 +05:30
if (!el) return null;
2022-06-21 17:19:12 +05:30
2022-07-23 23:45:48 +05:30
const { dataset } = el;
2022-06-21 17:19:12 +05:30
const {
canGenerateCodequalityReports,
codequalityReportDownloadPath,
downloadablePathForReportType,
exposeSecurityDashboard,
exposeLicenseScanningData,
2022-07-23 23:45:48 +05:30
failedJobsCount,
failedJobsSummary,
fullPath,
2022-07-16 23:28:13 +05:30
graphqlResourceEtag,
pipelineIid,
pipelineProjectPath,
2022-07-23 23:45:48 +05:30
totalJobCount,
2022-06-21 17:19:12 +05:30
} = dataset;
2022-07-16 23:28:13 +05:30
const defaultTabValue = getPipelineDefaultTab(window.location.href);
2022-07-23 23:45:48 +05:30
return {
el,
2022-06-21 17:19:12 +05:30
components: {
PipelineTabs,
},
apolloProvider,
provide: {
2022-07-16 23:28:13 +05:30
canGenerateCodequalityReports: parseBoolean(canGenerateCodequalityReports),
2022-06-21 17:19:12 +05:30
codequalityReportDownloadPath,
2022-07-16 23:28:13 +05:30
defaultTabValue,
2022-06-21 17:19:12 +05:30
downloadablePathForReportType,
2022-07-16 23:28:13 +05:30
exposeSecurityDashboard: parseBoolean(exposeSecurityDashboard),
exposeLicenseScanningData: parseBoolean(exposeLicenseScanningData),
2022-07-23 23:45:48 +05:30
failedJobsCount,
failedJobsSummary: JSON.parse(failedJobsSummary),
fullPath,
2022-07-16 23:28:13 +05:30
graphqlResourceEtag,
pipelineIid,
pipelineProjectPath,
2022-07-23 23:45:48 +05:30
totalJobCount,
2022-06-21 17:19:12 +05:30
},
errorCaptured(err, _vm, info) {
reportToSentry('pipeline_tabs', `error: ${err}, info: ${info}`);
},
render(createElement) {
return createElement(PipelineTabs);
},
2022-07-23 23:45:48 +05:30
};
2022-06-21 17:19:12 +05:30
};
2022-07-23 23:45:48 +05:30
export const createPipelineTabs = (options) => {
if (!options) return;
updateHistory({
url: removeParams([TAB_QUERY_PARAM]),
title: document.title,
replace: true,
});
// eslint-disable-next-line no-new
new Vue(options);
};