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.

115 lines
3 KiB
JavaScript
Raw Normal View History

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,
2023-06-20 00:43:36 +05:30
projectPath,
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,
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,
2023-07-09 08:55:56 +05:30
securityPoliciesPath,
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
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,
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,
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,
2023-07-09 08:55:56 +05:30
securityPoliciesPath,
2022-08-27 11:52:29 +05:30
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);
};