2021-06-20 23:10:27 -04:00
|
|
|
import createFlash from '~/flash';
|
2018-02-16 07:07:04 -05:00
|
|
|
import { __ } from '~/locale';
|
2021-02-14 13:09:20 -05:00
|
|
|
import createDagApp from './pipeline_details_dag';
|
2021-04-13 05:11:10 -04:00
|
|
|
import { createPipelinesDetailApp } from './pipeline_details_graph';
|
|
|
|
import { createPipelineHeaderApp } from './pipeline_details_header';
|
2022-01-21 13:12:45 -05:00
|
|
|
import { createPipelineNotificationApp } from './pipeline_details_notification';
|
2021-12-17 10:13:39 -05:00
|
|
|
import { createPipelineJobsApp } from './pipeline_details_jobs';
|
2021-03-16 05:11:17 -04:00
|
|
|
import { apolloProvider } from './pipeline_shared_client';
|
2021-08-23 14:11:07 -04:00
|
|
|
import { createTestDetails } from './pipeline_test_details';
|
2018-02-16 07:07:04 -05:00
|
|
|
|
2020-09-07 08:08:27 -04:00
|
|
|
const SELECTORS = {
|
|
|
|
PIPELINE_DETAILS: '.js-pipeline-details-vue',
|
|
|
|
PIPELINE_GRAPH: '#js-pipeline-graph-vue',
|
|
|
|
PIPELINE_HEADER: '#js-pipeline-header-vue',
|
2022-01-21 13:12:45 -05:00
|
|
|
PIPELINE_NOTIFICATION: '#js-pipeline-notification',
|
2022-03-23 11:08:38 -04:00
|
|
|
PIPELINE_TABS: '#js-pipeline-tabs',
|
2020-09-07 08:08:27 -04:00
|
|
|
PIPELINE_TESTS: '#js-pipeline-tests-detail',
|
2021-12-17 10:13:39 -05:00
|
|
|
PIPELINE_JOBS: '#js-pipeline-jobs-vue',
|
2020-09-07 08:08:27 -04:00
|
|
|
};
|
|
|
|
|
2021-02-05 07:09:31 -05:00
|
|
|
export default async function initPipelineDetailsBundle() {
|
2020-09-07 08:08:27 -04:00
|
|
|
const { dataset } = document.querySelector(SELECTORS.PIPELINE_DETAILS);
|
2020-05-19 14:08:11 -04:00
|
|
|
|
2021-04-13 05:11:10 -04:00
|
|
|
try {
|
|
|
|
createPipelineHeaderApp(SELECTORS.PIPELINE_HEADER, apolloProvider, dataset.graphqlResourceEtag);
|
|
|
|
} catch {
|
2021-06-20 23:10:27 -04:00
|
|
|
createFlash({
|
|
|
|
message: __('An error occurred while loading a section of this page.'),
|
|
|
|
});
|
2021-04-13 05:11:10 -04:00
|
|
|
}
|
|
|
|
|
2022-01-21 13:12:45 -05:00
|
|
|
try {
|
|
|
|
createPipelineNotificationApp(SELECTORS.PIPELINE_NOTIFICATION, apolloProvider);
|
|
|
|
} catch {
|
|
|
|
createFlash({
|
|
|
|
message: __('An error occurred while loading a section of this page.'),
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2022-03-23 11:08:38 -04:00
|
|
|
if (gon.features?.pipelineTabsVue) {
|
|
|
|
const { createPipelineTabs } = await import('./pipeline_tabs');
|
2021-08-23 14:11:07 -04:00
|
|
|
|
2022-03-23 11:08:38 -04:00
|
|
|
try {
|
|
|
|
createPipelineTabs(SELECTORS.PIPELINE_TABS, apolloProvider);
|
|
|
|
} catch {
|
|
|
|
createFlash({
|
|
|
|
message: __('An error occurred while loading a section of this page.'),
|
|
|
|
});
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
try {
|
|
|
|
createPipelinesDetailApp(SELECTORS.PIPELINE_GRAPH, apolloProvider, dataset);
|
|
|
|
} catch {
|
|
|
|
createFlash({
|
|
|
|
message: __('An error occurred while loading the pipeline.'),
|
|
|
|
});
|
|
|
|
}
|
2021-12-17 10:13:39 -05:00
|
|
|
|
2022-03-23 11:08:38 -04:00
|
|
|
try {
|
|
|
|
createDagApp(apolloProvider);
|
|
|
|
} catch {
|
|
|
|
createFlash({
|
|
|
|
message: __('An error occurred while loading the Needs tab.'),
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
createTestDetails(SELECTORS.PIPELINE_TESTS);
|
|
|
|
} catch {
|
|
|
|
createFlash({
|
|
|
|
message: __('An error occurred while loading the Test Reports tab.'),
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
createPipelineJobsApp(SELECTORS.PIPELINE_JOBS);
|
|
|
|
} catch {
|
|
|
|
createFlash({
|
|
|
|
message: __('An error occurred while loading the Jobs tab.'),
|
|
|
|
});
|
|
|
|
}
|
2021-12-17 10:13:39 -05:00
|
|
|
}
|
2020-11-12 13:09:26 -05:00
|
|
|
}
|