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

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

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                                                                                                                                                                 
import createFlash from '~/flash';
import { __ } from '~/locale';
import createDagApp from './pipeline_details_dag';
import { createPipelinesDetailApp } from './pipeline_details_graph';
import { createPipelineHeaderApp } from './pipeline_details_header';
import { createPipelineNotificationApp } from './pipeline_details_notification';
import { createPipelineJobsApp } from './pipeline_details_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_NOTIFICATION: '#js-pipeline-notification',
  PIPELINE_TESTS: '#js-pipeline-tests-detail',
  PIPELINE_JOBS: '#js-pipeline-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.'),
    });
  }
 
  try {
    createPipelinesDetailApp(SELECTORS.PIPELINE_GRAPH, apolloProvider, dataset);
  } catch {
    createFlash({
      message: __('An error occurred while loading the pipeline.'),
    });
  }
 
  try {
    createPipelineHeaderApp(SELECTORS.PIPELINE_HEADER, apolloProvider, dataset.graphqlResourceEtag);
  } catch {
    createFlash({
      message: __('An error occurred while loading a section of this page.'),
    });
  }
 
  try {
    createPipelineNotificationApp(SELECTORS.PIPELINE_NOTIFICATION, apolloProvider);
  } catch {
    createFlash({
      message: __('An error occurred while loading a section of this page.'),
    });
  }
 
  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 {
    if (gon.features?.jobsTabVue) {
      createPipelineJobsApp(SELECTORS.PIPELINE_JOBS);
    }
  } catch {
    createFlash({
      message: __('An error occurred while loading the Jobs tab.'),
    });
  }
}