gitlab-org--gitlab-foss/app/assets/javascripts/pipelines.js.es6
Filipa Lacerda cc4434a483 Fix after review
Adds require statement
2016-11-30 17:06:47 +00:00

37 lines
1.4 KiB
JavaScript

//= require lib/utils/bootstrap_linked_tabs
/* eslint-disable */
((global) => {
class Pipelines {
constructor(options) {
if (options.initTabs && options.tabsOptions) {
new window.gl.LinkedTabs(options.tabsOptions);
}
this.addMarginToBuildColumns();
}
addMarginToBuildColumns() {
this.pipelineGraph = document.querySelector('.pipeline-graph');
const secondChildBuildNodes = document.querySelector('.pipeline-graph').querySelectorAll('.build:nth-child(2)');
for (buildNodeIndex in secondChildBuildNodes) {
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');
}
this.pipelineGraph.classList.remove('hidden');
}
}
global.Pipelines = Pipelines;
})(window.gl || (window.gl = {}));