debian-mirror-gitlab/app/assets/javascripts/pipelines/pipeline_details_bundle.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

86 lines
2.6 KiB
JavaScript
Raw Normal View History

2022-11-25 23:54:43 +05:30
import { createAlert } from '~/flash';
2022-07-16 23:28:13 +05:30
import { __, s__ } from '~/locale';
2021-03-11 19:13:27 +05:30
import createDagApp from './pipeline_details_dag';
2021-04-29 21:17:54 +05:30
import { createPipelinesDetailApp } from './pipeline_details_graph';
import { createPipelineHeaderApp } from './pipeline_details_header';
2022-01-26 12:08:38 +05:30
import { createPipelineJobsApp } from './pipeline_details_jobs';
2022-07-16 23:28:13 +05:30
import { createPipelineFailedJobsApp } from './pipeline_details_failed_jobs';
2021-04-29 21:17:54 +05:30
import { apolloProvider } from './pipeline_shared_client';
2021-11-11 11:23:49 +05:30
import { createTestDetails } from './pipeline_test_details';
2018-03-27 19:54:05 +05:30
2020-11-24 15:15:51 +05:30
const SELECTORS = {
PIPELINE_DETAILS: '.js-pipeline-details-vue',
PIPELINE_GRAPH: '#js-pipeline-graph-vue',
PIPELINE_HEADER: '#js-pipeline-header-vue',
2022-06-21 17:19:12 +05:30
PIPELINE_TABS: '#js-pipeline-tabs',
2020-11-24 15:15:51 +05:30
PIPELINE_TESTS: '#js-pipeline-tests-detail',
2022-01-26 12:08:38 +05:30
PIPELINE_JOBS: '#js-pipeline-jobs-vue',
2022-07-16 23:28:13 +05:30
PIPELINE_FAILED_JOBS: '#js-pipeline-failed-jobs-vue',
2020-11-24 15:15:51 +05:30
};
2021-03-11 19:13:27 +05:30
export default async function initPipelineDetailsBundle() {
const { dataset } = document.querySelector(SELECTORS.PIPELINE_DETAILS);
2020-05-24 23:13:21 +05:30
2021-04-29 21:17:54 +05:30
try {
createPipelineHeaderApp(SELECTORS.PIPELINE_HEADER, apolloProvider, dataset.graphqlResourceEtag);
} catch {
2022-11-25 23:54:43 +05:30
createAlert({
2021-09-30 23:02:18 +05:30
message: __('An error occurred while loading a section of this page.'),
});
2021-04-29 21:17:54 +05:30
}
2022-06-21 17:19:12 +05:30
if (gon.features?.pipelineTabsVue) {
2022-07-23 23:45:48 +05:30
const { createAppOptions } = await import('ee_else_ce/pipelines/pipeline_tabs');
2022-06-21 17:19:12 +05:30
const { createPipelineTabs } = await import('./pipeline_tabs');
2021-11-11 11:23:49 +05:30
2022-06-21 17:19:12 +05:30
try {
2022-07-23 23:45:48 +05:30
const appOptions = createAppOptions(SELECTORS.PIPELINE_TABS, apolloProvider);
createPipelineTabs(appOptions);
2022-06-21 17:19:12 +05:30
} catch {
2022-11-25 23:54:43 +05:30
createAlert({
2022-06-21 17:19:12 +05:30
message: __('An error occurred while loading a section of this page.'),
});
}
} else {
try {
createPipelinesDetailApp(SELECTORS.PIPELINE_GRAPH, apolloProvider, dataset);
} catch {
2022-11-25 23:54:43 +05:30
createAlert({
2022-06-21 17:19:12 +05:30
message: __('An error occurred while loading the pipeline.'),
});
}
2022-01-26 12:08:38 +05:30
2022-06-21 17:19:12 +05:30
try {
createDagApp(apolloProvider);
} catch {
2022-11-25 23:54:43 +05:30
createAlert({
2022-06-21 17:19:12 +05:30
message: __('An error occurred while loading the Needs tab.'),
});
}
try {
createTestDetails(SELECTORS.PIPELINE_TESTS);
} catch {
2022-11-25 23:54:43 +05:30
createAlert({
2022-06-21 17:19:12 +05:30
message: __('An error occurred while loading the Test Reports tab.'),
});
}
try {
createPipelineJobsApp(SELECTORS.PIPELINE_JOBS);
} catch {
2022-11-25 23:54:43 +05:30
createAlert({
2022-06-21 17:19:12 +05:30
message: __('An error occurred while loading the Jobs tab.'),
});
}
2022-07-16 23:28:13 +05:30
2022-07-23 23:45:48 +05:30
try {
createPipelineFailedJobsApp(SELECTORS.PIPELINE_FAILED_JOBS);
} catch {
2022-11-25 23:54:43 +05:30
createAlert({
2022-07-23 23:45:48 +05:30
message: s__('Jobs|An error occurred while loading the Failed Jobs tab.'),
});
2022-07-16 23:28:13 +05:30
}
2022-01-26 12:08:38 +05:30
}
2021-01-29 00:20:46 +05:30
}