2022-06-21 17:19:12 +05:30
|
|
|
import Vue from 'vue';
|
2022-08-13 15:12:31 +05:30
|
|
|
import Vuex from 'vuex';
|
2022-06-21 17:19:12 +05:30
|
|
|
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';
|
2022-08-27 11:52:29 +05:30
|
|
|
import createTestReportsStore from './stores/test_reports';
|
2022-07-16 23:28:13 +05:30
|
|
|
import { getPipelineDefaultTab, reportToSentry } from './utils';
|
2022-06-21 17:19:12 +05:30
|
|
|
|
|
|
|
Vue.use(VueApollo);
|
2022-08-13 15:12:31 +05:30
|
|
|
Vue.use(Vuex);
|
2022-06-21 17:19:12 +05:30
|
|
|
|
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,
|
2022-10-11 01:57:18 +05:30
|
|
|
codequalityBlobPath,
|
|
|
|
codequalityProjectPath,
|
2022-06-21 17:19:12 +05:30
|
|
|
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-08-27 11:52:29 +05:30
|
|
|
licenseManagementApiUrl,
|
|
|
|
licenseManagementSettingsPath,
|
|
|
|
licensesApiPath,
|
|
|
|
canManageLicenses,
|
|
|
|
summaryEndpoint,
|
|
|
|
suiteEndpoint,
|
|
|
|
blobPath,
|
|
|
|
hasTestReport,
|
|
|
|
emptyStateImagePath,
|
|
|
|
artifactsExpiredImagePath,
|
2022-10-11 01:57:18 +05:30
|
|
|
isFullCodequalityReportAvailable,
|
2022-08-27 11:52:29 +05:30
|
|
|
testsCount,
|
2022-06-21 17:19:12 +05:30
|
|
|
} = dataset;
|
2022-07-16 23:28:13 +05:30
|
|
|
|
2022-10-11 01:57:18 +05:30
|
|
|
// TODO remove projectPath variable once https://gitlab.com/gitlab-org/gitlab/-/issues/371641 is resolved
|
|
|
|
const projectPath = fullPath;
|
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,
|
2022-08-27 11:52:29 +05:30
|
|
|
store: new Vuex.Store({
|
|
|
|
modules: {
|
|
|
|
testReports: createTestReportsStore({
|
|
|
|
blobPath,
|
|
|
|
summaryEndpoint,
|
|
|
|
suiteEndpoint,
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
}),
|
2022-06-21 17:19:12 +05:30
|
|
|
provide: {
|
2022-07-16 23:28:13 +05:30
|
|
|
canGenerateCodequalityReports: parseBoolean(canGenerateCodequalityReports),
|
2022-06-21 17:19:12 +05:30
|
|
|
codequalityReportDownloadPath,
|
2022-10-11 01:57:18 +05:30
|
|
|
codequalityBlobPath,
|
|
|
|
codequalityProjectPath,
|
|
|
|
isFullCodequalityReportAvailable: parseBoolean(isFullCodequalityReportAvailable),
|
|
|
|
projectPath,
|
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-08-27 11:52:29 +05:30
|
|
|
licenseManagementApiUrl,
|
|
|
|
licenseManagementSettingsPath,
|
|
|
|
licensesApiPath,
|
|
|
|
canManageLicenses: parseBoolean(canManageLicenses),
|
|
|
|
summaryEndpoint,
|
|
|
|
suiteEndpoint,
|
|
|
|
blobPath,
|
|
|
|
hasTestReport,
|
|
|
|
emptyStateImagePath,
|
|
|
|
artifactsExpiredImagePath,
|
|
|
|
testsCount,
|
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);
|
|
|
|
};
|