1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
import Vue from 'vue';
import VueApollo from 'vue-apollo';
import PipelineTabs from 'ee_else_ce/pipelines/components/pipeline_tabs.vue';
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';
Vue.use(VueApollo);
export const createAppOptions = (selector, apolloProvider) => {
const el = document.querySelector(selector);
if (!el) return null;
const { dataset } = el;
const {
canGenerateCodequalityReports,
codequalityReportDownloadPath,
downloadablePathForReportType,
exposeSecurityDashboard,
exposeLicenseScanningData,
fullPath,
graphqlResourceEtag,
pipelineIid,
pipelineProjectPath,
totalJobCount,
} = dataset;
const defaultTabValue = getPipelineDefaultTab(window.location.href);
return {
el,
components: {
PipelineTabs,
},
apolloProvider,
provide: {
canGenerateCodequalityReports: parseBoolean(canGenerateCodequalityReports),
codequalityReportDownloadPath,
defaultTabValue,
downloadablePathForReportType,
exposeSecurityDashboard: parseBoolean(exposeSecurityDashboard),
exposeLicenseScanningData: parseBoolean(exposeLicenseScanningData),
fullPath,
graphqlResourceEtag,
pipelineIid,
pipelineProjectPath,
totalJobCount,
},
errorCaptured(err, _vm, info) {
reportToSentry('pipeline_tabs', `error: ${err}, info: ${info}`);
},
render(createElement) {
return createElement(PipelineTabs);
},
};
};
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);
};
|