2016-12-13 22:01:05 -05:00
|
|
|
/* eslint-disable no-new, guard-for-in, no-restricted-syntax, no-continue, padded-blocks, no-param-reassign, max-len */
|
|
|
|
|
2016-11-24 11:43:54 -05:00
|
|
|
//= require lib/utils/bootstrap_linked_tabs
|
|
|
|
|
2016-09-29 17:24:37 -04:00
|
|
|
((global) => {
|
|
|
|
|
|
|
|
class Pipelines {
|
2016-12-09 09:37:41 -05:00
|
|
|
constructor(options = {}) {
|
2016-11-24 11:43:54 -05:00
|
|
|
|
|
|
|
if (options.initTabs && options.tabsOptions) {
|
2016-11-29 05:35:53 -05:00
|
|
|
new global.LinkedTabs(options.tabsOptions);
|
2016-11-24 11:43:54 -05:00
|
|
|
}
|
|
|
|
|
2016-10-06 16:20:25 -04:00
|
|
|
this.addMarginToBuildColumns();
|
2016-09-12 06:19:20 -04:00
|
|
|
}
|
|
|
|
|
2016-09-29 17:24:37 -04:00
|
|
|
addMarginToBuildColumns() {
|
2016-12-09 11:14:54 -05:00
|
|
|
this.pipelineGraph = document.querySelector('.js-pipeline-graph');
|
2016-12-09 11:16:14 -05:00
|
|
|
|
|
|
|
const secondChildBuildNodes = this.pipelineGraph.querySelectorAll('.build:nth-child(2)');
|
|
|
|
|
2016-12-09 10:13:20 -05:00
|
|
|
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
|
|
|
|
2016-10-17 15:06:56 -04:00
|
|
|
this.pipelineGraph.classList.remove('hidden');
|
2016-08-23 12:02:52 -04:00
|
|
|
}
|
2016-08-17 17:41:24 -04:00
|
|
|
}
|
2016-08-16 20:42:05 -04:00
|
|
|
|
2016-09-29 17:24:37 -04:00
|
|
|
global.Pipelines = Pipelines;
|
|
|
|
|
|
|
|
})(window.gl || (window.gl = {}));
|