gitlab-org--gitlab-foss/app/assets/javascripts/pipelines.js.es6

42 lines
1.5 KiB
JavaScript
Raw Normal View History

/* eslint-disable no-new, guard-for-in, no-restricted-syntax, no-continue, padded-blocks, no-param-reassign, max-len */
//= require lib/utils/bootstrap_linked_tabs
2016-09-29 17:24:37 -04:00
((global) => {
class Pipelines {
constructor(options = {}) {
if (options.initTabs && options.tabsOptions) {
2016-11-29 05:35:53 -05:00
new global.LinkedTabs(options.tabsOptions);
}
this.addMarginToBuildColumns();
}
2016-09-29 17:24:37 -04:00
addMarginToBuildColumns() {
this.pipelineGraph = document.querySelector('.js-pipeline-graph');
2016-12-09 11:16:14 -05:00
const secondChildBuildNodes = this.pipelineGraph.querySelectorAll('.build:nth-child(2)');
for (const buildNodeIndex in secondChildBuildNodes) {
2016-10-20 17:18:39 -04:00
const buildNode = secondChildBuildNodes[buildNodeIndex];
const firstChildBuildNode = buildNode.previousElementSibling;
if (!firstChildBuildNode || !firstChildBuildNode.matches('.build')) continue;
const multiBuildColumn = buildNode.closest('.stage-column');
const previousColumn = multiBuildColumn.previousElementSibling;
if (!previousColumn || !previousColumn.matches('.stage-column')) continue;
multiBuildColumn.classList.add('left-margin');
firstChildBuildNode.classList.add('left-connector');
const columnBuilds = previousColumn.querySelectorAll('.build');
if (columnBuilds.length === 1) previousColumn.classList.add('no-margin');
2016-09-29 17:24:37 -04:00
}
2016-12-09 11:16:14 -05:00
this.pipelineGraph.classList.remove('hidden');
}
2016-08-17 17:41:24 -04:00
}
2016-09-29 17:24:37 -04:00
global.Pipelines = Pipelines;
})(window.gl || (window.gl = {}));