Welcome to mirror list, hosted at ThFree Co, Russian Federation.

pipeline_details_bundle.js « pipelines « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1bbdd3625be5d68c6ee165ddd9047e2f44815864 (plain)
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
87
88
89
90
91
92
93
import VueRouter from 'vue-router';
import { createAlert } 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 {
    createAlert({
      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');
    const { routes } = await import('ee_else_ce/pipelines/routes');

    const router = new VueRouter({
      mode: 'history',
      base: dataset.pipelinePath,
      routes,
    });

    try {
      const appOptions = createAppOptions(SELECTORS.PIPELINE_TABS, apolloProvider, router);
      createPipelineTabs(appOptions);
    } catch {
      createAlert({
        message: __('An error occurred while loading a section of this page.'),
      });
    }
  } else {
    try {
      createPipelinesDetailApp(SELECTORS.PIPELINE_GRAPH, apolloProvider, dataset);
    } catch {
      createAlert({
        message: __('An error occurred while loading the pipeline.'),
      });
    }

    try {
      createDagApp(apolloProvider);
    } catch {
      createAlert({
        message: __('An error occurred while loading the Needs tab.'),
      });
    }

    try {
      createTestDetails(SELECTORS.PIPELINE_TESTS);
    } catch {
      createAlert({
        message: __('An error occurred while loading the Test Reports tab.'),
      });
    }

    try {
      createPipelineJobsApp(SELECTORS.PIPELINE_JOBS);
    } catch {
      createAlert({
        message: __('An error occurred while loading the Jobs tab.'),
      });
    }

    try {
      createPipelineFailedJobsApp(SELECTORS.PIPELINE_FAILED_JOBS);
    } catch {
      createAlert({
        message: s__('Jobs|An error occurred while loading the Failed Jobs tab.'),
      });
    }
  }
}