2022-06-21 17:19:12 +05:30
|
|
|
import Vue from 'vue';
|
2023-01-13 00:05:48 +05:30
|
|
|
import VueRouter from 'vue-router';
|
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';
|
2023-05-27 22:25:52 +05:30
|
|
|
import { GlToast } from '@gitlab/ui';
|
2022-06-21 17:19:12 +05:30
|
|
|
import PipelineTabs from 'ee_else_ce/pipelines/components/pipeline_tabs.vue';
|
2022-07-16 23:28:13 +05:30
|
|
|
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
|
|
|
|
2023-05-27 22:25:52 +05:30
|
|
|
Vue.use(GlToast);
|
2022-06-21 17:19:12 +05:30
|
|
|
Vue.use(VueApollo);
|
2023-01-13 00:05:48 +05:30
|
|
|
Vue.use(VueRouter);
|
2022-08-13 15:12:31 +05:30
|
|
|
Vue.use(Vuex);
|
2022-06-21 17:19:12 +05:30
|
|
|
|
2023-01-13 00:05:48 +05:30
|
|
|
export const createAppOptions = (selector, apolloProvider, router) => {
|
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,
|
2023-04-23 21:23:45 +05:30
|
|
|
licenseScanCount,
|
2022-08-27 11:52:29 +05:30
|
|
|
licensesApiPath,
|
|
|
|
canManageLicenses,
|
|
|
|
summaryEndpoint,
|
|
|
|
suiteEndpoint,
|
|
|
|
blobPath,
|
|
|
|
hasTestReport,
|
2023-01-13 00:05:48 +05:30
|
|
|
emptyDagSvgPath,
|
2022-08-27 11:52:29 +05:30
|
|
|
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,
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
}),
|
2023-01-13 00:05:48 +05:30
|
|
|
router,
|
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,
|
2023-04-23 21:23:45 +05:30
|
|
|
licenseScanCount,
|
2022-08-27 11:52:29 +05:30
|
|
|
licensesApiPath,
|
|
|
|
canManageLicenses: parseBoolean(canManageLicenses),
|
|
|
|
summaryEndpoint,
|
|
|
|
suiteEndpoint,
|
|
|
|
blobPath,
|
|
|
|
hasTestReport,
|
2023-01-13 00:05:48 +05:30
|
|
|
emptyDagSvgPath,
|
2022-08-27 11:52:29 +05:30
|
|
|
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;
|
|
|
|
|
|
|
|
// eslint-disable-next-line no-new
|
|
|
|
new Vue(options);
|
|
|
|
};
|