All files / app/assets/javascripts/pipelines pipeline_details_bundle.js

0% Statements 0/27
0% Branches 0/2
0% Functions 0/1
0% Lines 0/27

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86                                                                                                                                                                           
import createFlash from '~/flash';
import { __, s__ } from '~/locale';
import createDagApp from './pipeline_details_dag';
import { createPipelinesDetailApp } from './pipeline_details_graph';
import { createPipelineHeaderApp } from './pipeline_details_header';
import { createPipelineJobsApp } from './pipeline_details_jobs';
import { createPipelineFailedJobsApp } from './pipeline_details_failed_jobs';
import { apolloProvider } from './pipeline_shared_client';
import { createTestDetails } from './pipeline_test_details';
 
const SELECTORS = {
  PIPELINE_DETAILS: '.js-pipeline-details-vue',
  PIPELINE_GRAPH: '#js-pipeline-graph-vue',
  PIPELINE_HEADER: '#js-pipeline-header-vue',
  PIPELINE_TABS: '#js-pipeline-tabs',
  PIPELINE_TESTS: '#js-pipeline-tests-detail',
  PIPELINE_JOBS: '#js-pipeline-jobs-vue',
  PIPELINE_FAILED_JOBS: '#js-pipeline-failed-jobs-vue',
};
 
export default async function initPipelineDetailsBundle() {
  const { dataset } = document.querySelector(SELECTORS.PIPELINE_DETAILS);
 
  try {
    createPipelineHeaderApp(SELECTORS.PIPELINE_HEADER, apolloProvider, dataset.graphqlResourceEtag);
  } catch {
    createFlash({
      message: __('An error occurred while loading a section of this page.'),
    });
  }
 
  if (gon.features?.pipelineTabsVue) {
    const { createAppOptions } = await import('ee_else_ce/pipelines/pipeline_tabs');
    const { createPipelineTabs } = await import('./pipeline_tabs');
 
    try {
      const appOptions = createAppOptions(SELECTORS.PIPELINE_TABS, apolloProvider);
      createPipelineTabs(appOptions);
    } 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.'),
      });
    }
 
    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.'),
      });
    }
 
    try {
      createPipelineFailedJobsApp(SELECTORS.PIPELINE_FAILED_JOBS);
    } catch {
      createFlash({
        message: s__('Jobs|An error occurred while loading the Failed Jobs tab.'),
      });
    }
  }
}