debian-mirror-gitlab/app/assets/javascripts/pages/projects/pipelines/init_pipelines.js
2020-03-09 13:42:32 +05:30

31 lines
994 B
JavaScript

import Pipelines from '~/pipelines';
export default () => {
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');
});
}
const { controllerAction } = document.querySelector('.js-pipeline-container').dataset;
const pipelineStatusUrl = `${document
.querySelector('.js-pipeline-tab-link a')
.getAttribute('href')}/status.json`;
// eslint-disable-next-line no-new
new Pipelines({
initTabs: true,
pipelineStatusUrl,
tabsOptions: {
action: controllerAction,
defaultAction: 'pipelines',
parentEl: '.pipelines-tabs',
},
});
};