2023-01-13 00:05:48 +05:30
|
|
|
import VueRouter from 'vue-router';
|
2022-11-25 23:54:43 +05:30
|
|
|
import { createAlert } from '~/flash';
|
2023-03-04 22:38:38 +05:30
|
|
|
import { __ } from '~/locale';
|
2021-04-29 21:17:54 +05:30
|
|
|
import { createPipelineHeaderApp } from './pipeline_details_header';
|
|
|
|
import { apolloProvider } from './pipeline_shared_client';
|
2018-03-27 19:54:05 +05:30
|
|
|
|
2020-11-24 15:15:51 +05:30
|
|
|
const SELECTORS = {
|
|
|
|
PIPELINE_HEADER: '#js-pipeline-header-vue',
|
2022-06-21 17:19:12 +05:30
|
|
|
PIPELINE_TABS: '#js-pipeline-tabs',
|
2020-11-24 15:15:51 +05:30
|
|
|
};
|
|
|
|
|
2021-03-11 19:13:27 +05:30
|
|
|
export default async function initPipelineDetailsBundle() {
|
2023-03-04 22:38:38 +05:30
|
|
|
const { dataset: headerDataset } = document.querySelector(SELECTORS.PIPELINE_HEADER);
|
2020-05-24 23:13:21 +05:30
|
|
|
|
2021-04-29 21:17:54 +05:30
|
|
|
try {
|
2023-03-04 22:38:38 +05:30
|
|
|
createPipelineHeaderApp(
|
|
|
|
SELECTORS.PIPELINE_HEADER,
|
|
|
|
apolloProvider,
|
|
|
|
headerDataset.graphqlResourceEtag,
|
|
|
|
);
|
2021-04-29 21:17:54 +05:30
|
|
|
} catch {
|
2022-11-25 23:54:43 +05:30
|
|
|
createAlert({
|
2021-09-30 23:02:18 +05:30
|
|
|
message: __('An error occurred while loading a section of this page.'),
|
|
|
|
});
|
2021-04-29 21:17:54 +05:30
|
|
|
}
|
|
|
|
|
2023-03-04 22:38:38 +05:30
|
|
|
const tabsEl = document.querySelector(SELECTORS.PIPELINE_TABS);
|
|
|
|
|
|
|
|
if (tabsEl) {
|
|
|
|
const { dataset } = tabsEl;
|
2022-07-23 23:45:48 +05:30
|
|
|
const { createAppOptions } = await import('ee_else_ce/pipelines/pipeline_tabs');
|
2022-06-21 17:19:12 +05:30
|
|
|
const { createPipelineTabs } = await import('./pipeline_tabs');
|
2023-01-13 00:05:48 +05:30
|
|
|
const { routes } = await import('ee_else_ce/pipelines/routes');
|
|
|
|
|
|
|
|
const router = new VueRouter({
|
|
|
|
mode: 'history',
|
|
|
|
base: dataset.pipelinePath,
|
|
|
|
routes,
|
|
|
|
});
|
2021-11-11 11:23:49 +05:30
|
|
|
|
2022-06-21 17:19:12 +05:30
|
|
|
try {
|
2023-01-13 00:05:48 +05:30
|
|
|
const appOptions = createAppOptions(SELECTORS.PIPELINE_TABS, apolloProvider, router);
|
2022-07-23 23:45:48 +05:30
|
|
|
createPipelineTabs(appOptions);
|
2022-06-21 17:19:12 +05:30
|
|
|
} catch {
|
2022-11-25 23:54:43 +05:30
|
|
|
createAlert({
|
2022-06-21 17:19:12 +05:30
|
|
|
message: __('An error occurred while loading a section of this page.'),
|
|
|
|
});
|
|
|
|
}
|
2022-01-26 12:08:38 +05:30
|
|
|
}
|
2021-01-29 00:20:46 +05:30
|
|
|
}
|