diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-14 18:08:04 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-14 18:08:04 +0300 |
commit | 8c4225a66b12683bcf1bba9bb9328fcf65395b6d (patch) | |
tree | d3b583abd26fcbbcbf0db828aee2b940414e1649 /app/assets/javascripts/pipelines | |
parent | 075c890053f626018ba680e4da21a93743acb244 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/pipelines')
6 files changed, 11 insertions, 241 deletions
diff --git a/app/assets/javascripts/pipelines/pipeline_details_bundle.js b/app/assets/javascripts/pipelines/pipeline_details_bundle.js index 1bbdd3625be..f00378733fc 100644 --- a/app/assets/javascripts/pipelines/pipeline_details_bundle.js +++ b/app/assets/javascripts/pipelines/pipeline_details_bundle.js @@ -1,36 +1,33 @@ 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 { __ } from '~/locale'; 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); + const { dataset: headerDataset } = document.querySelector(SELECTORS.PIPELINE_HEADER); try { - createPipelineHeaderApp(SELECTORS.PIPELINE_HEADER, apolloProvider, dataset.graphqlResourceEtag); + createPipelineHeaderApp( + SELECTORS.PIPELINE_HEADER, + apolloProvider, + headerDataset.graphqlResourceEtag, + ); } catch { createAlert({ message: __('An error occurred while loading a section of this page.'), }); } - if (gon.features?.pipelineTabsVue) { + const tabsEl = document.querySelector(SELECTORS.PIPELINE_TABS); + + if (tabsEl) { + const { dataset } = tabsEl; 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'); @@ -49,45 +46,5 @@ export default async function initPipelineDetailsBundle() { 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.'), - }); - } } } diff --git a/app/assets/javascripts/pipelines/pipeline_details_dag.js b/app/assets/javascripts/pipelines/pipeline_details_dag.js deleted file mode 100644 index b2cb0457c4d..00000000000 --- a/app/assets/javascripts/pipelines/pipeline_details_dag.js +++ /dev/null @@ -1,42 +0,0 @@ -import Vue from 'vue'; -import VueApollo from 'vue-apollo'; -import Dag from './components/dag/dag.vue'; - -Vue.use(VueApollo); - -const createDagApp = (apolloProvider) => { - const el = document.querySelector('#js-pipeline-dag-vue'); - - if (!el) { - return; - } - - const { - aboutDagDocPath, - dagDocPath, - emptySvgPath, - pipelineProjectPath, - pipelineIid, - } = el.dataset; - - // eslint-disable-next-line no-new - new Vue({ - el, - components: { - Dag, - }, - apolloProvider, - provide: { - aboutDagDocPath, - dagDocPath, - emptySvgPath, - pipelineProjectPath, - pipelineIid, - }, - render(createElement) { - return createElement('dag', {}); - }, - }); -}; - -export default createDagApp; diff --git a/app/assets/javascripts/pipelines/pipeline_details_failed_jobs.js b/app/assets/javascripts/pipelines/pipeline_details_failed_jobs.js deleted file mode 100644 index 7bf3b64bf47..00000000000 --- a/app/assets/javascripts/pipelines/pipeline_details_failed_jobs.js +++ /dev/null @@ -1,36 +0,0 @@ -import Vue from 'vue'; -import VueApollo from 'vue-apollo'; -import createDefaultClient from '~/lib/graphql'; -import FailedJobsApp from './components/jobs/failed_jobs_app.vue'; - -Vue.use(VueApollo); - -const apolloProvider = new VueApollo({ - defaultClient: createDefaultClient(), -}); - -export const createPipelineFailedJobsApp = (selector) => { - const containerEl = document.querySelector(selector); - - if (!containerEl) { - return false; - } - - const { fullPath, pipelineIid, failedJobsSummaryData } = containerEl.dataset; - - return new Vue({ - el: containerEl, - apolloProvider, - provide: { - fullPath, - pipelineIid, - }, - render(createElement) { - return createElement(FailedJobsApp, { - props: { - failedJobsSummary: JSON.parse(failedJobsSummaryData), - }, - }); - }, - }); -}; diff --git a/app/assets/javascripts/pipelines/pipeline_details_graph.js b/app/assets/javascripts/pipelines/pipeline_details_graph.js deleted file mode 100644 index 9dd5cd7b281..00000000000 --- a/app/assets/javascripts/pipelines/pipeline_details_graph.js +++ /dev/null @@ -1,35 +0,0 @@ -import Vue from 'vue'; -import VueApollo from 'vue-apollo'; -import PipelineGraphWrapper from './components/graph/graph_component_wrapper.vue'; -import { reportToSentry } from './utils'; - -Vue.use(VueApollo); - -const createPipelinesDetailApp = ( - selector, - apolloProvider, - { pipelineProjectPath, pipelineIid, metricsPath, graphqlResourceEtag } = {}, -) => { - // eslint-disable-next-line no-new - new Vue({ - el: selector, - components: { - PipelineGraphWrapper, - }, - apolloProvider, - provide: { - metricsPath, - pipelineProjectPath, - pipelineIid, - graphqlResourceEtag, - }, - errorCaptured(err, _vm, info) { - reportToSentry('pipeline_details_graph', `error: ${err}, info: ${info}`); - }, - render(createElement) { - return createElement(PipelineGraphWrapper); - }, - }); -}; - -export { createPipelinesDetailApp }; diff --git a/app/assets/javascripts/pipelines/pipeline_details_jobs.js b/app/assets/javascripts/pipelines/pipeline_details_jobs.js deleted file mode 100644 index a1294a484f0..00000000000 --- a/app/assets/javascripts/pipelines/pipeline_details_jobs.js +++ /dev/null @@ -1,34 +0,0 @@ -import { GlToast } from '@gitlab/ui'; -import Vue from 'vue'; -import VueApollo from 'vue-apollo'; -import createDefaultClient from '~/lib/graphql'; -import JobsApp from './components/jobs/jobs_app.vue'; - -Vue.use(VueApollo); -Vue.use(GlToast); - -const apolloProvider = new VueApollo({ - defaultClient: createDefaultClient(), -}); - -export const createPipelineJobsApp = (selector) => { - const containerEl = document.querySelector(selector); - - if (!containerEl) { - return false; - } - - const { fullPath, pipelineIid } = containerEl.dataset; - - return new Vue({ - el: containerEl, - apolloProvider, - provide: { - fullPath, - pipelineIid, - }, - render(createElement) { - return createElement(JobsApp); - }, - }); -}; diff --git a/app/assets/javascripts/pipelines/pipeline_test_details.js b/app/assets/javascripts/pipelines/pipeline_test_details.js deleted file mode 100644 index fe4ca8e9529..00000000000 --- a/app/assets/javascripts/pipelines/pipeline_test_details.js +++ /dev/null @@ -1,40 +0,0 @@ -import Vue from 'vue'; -import Vuex from 'vuex'; -import { parseBoolean } from '~/lib/utils/common_utils'; -import Translate from '~/vue_shared/translate'; -import TestReports from './components/test_reports/test_reports.vue'; - -Vue.use(Vuex); -Vue.use(Translate); - -export const createTestDetails = (selector) => { - const el = document.querySelector(selector); - const { - blobPath, - emptyStateImagePath, - hasTestReport, - summaryEndpoint, - suiteEndpoint, - artifactsExpiredImagePath, - } = el?.dataset || {}; - - // eslint-disable-next-line no-new - new Vue({ - el, - components: { - TestReports, - }, - provide: { - emptyStateImagePath, - artifactsExpiredImagePath, - hasTestReport: parseBoolean(hasTestReport), - blobPath, - summaryEndpoint, - suiteEndpoint, - }, - store: new Vuex.Store(), - render(createElement) { - return createElement('test-reports'); - }, - }); -}; |