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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
import Vue from 'vue';
import VueRouter from 'vue-router';
// eslint-disable-next-line no-restricted-imports
import Vuex from 'vuex';
import VueApollo from 'vue-apollo';
import { GlToast } from '@gitlab/ui';
import PipelineTabs from 'ee_else_ce/ci/pipeline_details/tabs/pipeline_tabs.vue';
import { reportToSentry } from '~/ci/utils';
import { parseBoolean } from '~/lib/utils/common_utils';
import createTestReportsStore from './stores/test_reports';
import { getPipelineDefaultTab } from './utils';
Vue.use(GlToast);
Vue.use(VueApollo);
Vue.use(VueRouter);
Vue.use(Vuex);
export const createAppOptions = (selector, apolloProvider, router) => {
const el = document.querySelector(selector);
if (!el) return null;
const { dataset } = el;
const {
canGenerateCodequalityReports,
codequalityReportDownloadPath,
codequalityBlobPath,
codequalityProjectPath,
downloadablePathForReportType,
exposeSecurityDashboard,
exposeLicenseScanningData,
failedJobsCount,
projectPath,
graphqlResourceEtag,
pipelineIid,
pipelineProjectPath,
totalJobCount,
licenseManagementApiUrl,
licenseScanCount,
licensesApiPath,
canManageLicenses,
summaryEndpoint,
suiteEndpoint,
blobPath,
hasTestReport,
emptyDagSvgPath,
emptyStateImagePath,
artifactsExpiredImagePath,
isFullCodequalityReportAvailable,
securityPoliciesPath,
testsCount,
} = dataset;
const defaultTabValue = getPipelineDefaultTab(window.location.href);
return {
el,
components: {
PipelineTabs,
},
apolloProvider,
store: new Vuex.Store({
modules: {
testReports: createTestReportsStore({
blobPath,
summaryEndpoint,
suiteEndpoint,
}),
},
}),
router,
provide: {
canGenerateCodequalityReports: parseBoolean(canGenerateCodequalityReports),
codequalityReportDownloadPath,
codequalityBlobPath,
codequalityProjectPath,
isFullCodequalityReportAvailable: parseBoolean(isFullCodequalityReportAvailable),
projectPath,
defaultTabValue,
downloadablePathForReportType,
exposeSecurityDashboard: parseBoolean(exposeSecurityDashboard),
exposeLicenseScanningData: parseBoolean(exposeLicenseScanningData),
failedJobsCount,
graphqlResourceEtag,
pipelineIid,
pipelineProjectPath,
totalJobCount,
licenseManagementApiUrl,
licenseScanCount,
licensesApiPath,
canManageLicenses: parseBoolean(canManageLicenses),
summaryEndpoint,
suiteEndpoint,
blobPath,
hasTestReport,
emptyDagSvgPath,
emptyStateImagePath,
artifactsExpiredImagePath,
securityPoliciesPath,
testsCount,
},
errorCaptured(err, _vm, info) {
reportToSentry('pipeline_tabs', `error: ${err}, info: ${info}`);
},
render(createElement) {
return createElement(PipelineTabs);
},
};
};
export const createPipelineTabs = (options) => {
if (!options) return;
// eslint-disable-next-line no-new
new Vue(options);
};
|