debian-mirror-gitlab/app/assets/javascripts/pipelines/pipeline_details_bundle.js

71 lines
2 KiB
JavaScript
Raw Normal View History

2017-09-10 17:25:29 +05:30
import Vue from 'vue';
2021-09-30 23:02:18 +05:30
import createFlash from '~/flash';
2021-06-08 01:23:25 +05:30
import { parseBoolean } from '~/lib/utils/common_utils';
2018-03-27 19:54:05 +05:30
import { __ } from '~/locale';
2021-03-11 19:13:27 +05:30
import Translate from '~/vue_shared/translate';
2019-12-26 22:10:19 +05:30
import TestReports from './components/test_reports/test_reports.vue';
2021-03-11 19:13:27 +05:30
import createDagApp from './pipeline_details_dag';
2021-04-29 21:17:54 +05:30
import { createPipelinesDetailApp } from './pipeline_details_graph';
import { createPipelineHeaderApp } from './pipeline_details_header';
import { apolloProvider } from './pipeline_shared_client';
2020-07-28 23:09:34 +05:30
import createTestReportsStore from './stores/test_reports';
2017-09-10 17:25:29 +05:30
2018-03-27 19:54:05 +05:30
Vue.use(Translate);
2020-11-24 15:15:51 +05:30
const SELECTORS = {
PIPELINE_DETAILS: '.js-pipeline-details-vue',
PIPELINE_GRAPH: '#js-pipeline-graph-vue',
PIPELINE_HEADER: '#js-pipeline-header-vue',
PIPELINE_TESTS: '#js-pipeline-tests-detail',
};
2020-07-28 23:09:34 +05:30
const createTestDetails = () => {
2020-11-24 15:15:51 +05:30
const el = document.querySelector(SELECTORS.PIPELINE_TESTS);
2021-06-08 01:23:25 +05:30
const { blobPath, emptyStateImagePath, hasTestReport, summaryEndpoint, suiteEndpoint } =
el?.dataset || {};
2020-07-28 23:09:34 +05:30
const testReportsStore = createTestReportsStore({
2021-03-11 19:13:27 +05:30
blobPath,
2020-10-24 23:57:45 +05:30
summaryEndpoint,
suiteEndpoint,
2020-07-28 23:09:34 +05:30
});
2020-05-24 23:13:21 +05:30
// eslint-disable-next-line no-new
new Vue({
2020-07-28 23:09:34 +05:30
el,
2020-05-24 23:13:21 +05:30
components: {
TestReports,
},
2021-06-08 01:23:25 +05:30
provide: {
emptyStateImagePath,
hasTestReport: parseBoolean(hasTestReport),
},
2020-07-28 23:09:34 +05:30
store: testReportsStore,
2020-05-24 23:13:21 +05:30
render(createElement) {
return createElement('test-reports');
},
});
};
2021-03-11 19:13:27 +05:30
export default async function initPipelineDetailsBundle() {
const { dataset } = document.querySelector(SELECTORS.PIPELINE_DETAILS);
2020-05-24 23:13:21 +05:30
2021-04-29 21:17:54 +05:30
try {
createPipelineHeaderApp(SELECTORS.PIPELINE_HEADER, apolloProvider, dataset.graphqlResourceEtag);
} catch {
2021-09-30 23:02:18 +05:30
createFlash({
message: __('An error occurred while loading a section of this page.'),
});
2021-04-29 21:17:54 +05:30
}
2021-10-27 15:23:28 +05:30
try {
createPipelinesDetailApp(SELECTORS.PIPELINE_GRAPH, apolloProvider, dataset);
} catch {
createFlash({
message: __('An error occurred while loading the pipeline.'),
});
2021-01-29 00:20:46 +05:30
}
2021-01-03 14:25:43 +05:30
2021-04-29 21:17:54 +05:30
createDagApp(apolloProvider);
createTestDetails();
2021-01-29 00:20:46 +05:30
}