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