debian-mirror-gitlab/app/assets/javascripts/pages/projects/pipelines/init_pipelines.js

34 lines
1.1 KiB
JavaScript
Raw Normal View History

2018-03-27 19:54:05 +05:30
import Pipelines from '~/pipelines';
export default () => {
2020-03-09 13:42:32 +05:30
const mergeRequestListToggle = document.querySelector('.js-toggle-mr-list');
const truncatedMergeRequestList = document.querySelector('.js-truncated-mr-list');
const fullMergeRequestList = document.querySelector('.js-full-mr-list');
if (mergeRequestListToggle) {
mergeRequestListToggle.addEventListener('click', e => {
e.preventDefault();
truncatedMergeRequestList.classList.toggle('hide');
fullMergeRequestList.classList.toggle('hide');
});
}
2020-04-08 14:13:33 +05:30
const pipelineTabLink = document.querySelector('.js-pipeline-tab-link a');
2018-03-27 19:54:05 +05:30
const { controllerAction } = document.querySelector('.js-pipeline-container').dataset;
2020-04-08 14:13:33 +05:30
if (pipelineTabLink) {
const pipelineStatusUrl = `${pipelineTabLink.getAttribute('href')}/status.json`;
// eslint-disable-next-line no-new
new Pipelines({
initTabs: true,
pipelineStatusUrl,
tabsOptions: {
action: controllerAction,
defaultAction: 'pipelines',
parentEl: '.pipelines-tabs',
},
});
}
2018-03-27 19:54:05 +05:30
};