2016-09-29 17:24:37 -04:00
|
|
|
((global) => {
|
|
|
|
|
|
|
|
class Pipelines {
|
|
|
|
constructor() {
|
|
|
|
$(document).off('click', '.toggle-pipeline-btn').on('click', '.toggle-pipeline-btn', this.toggleGraph);
|
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
|
|
|
toggleGraph() {
|
|
|
|
const $pipelineBtn = $(this).closest('.toggle-pipeline-btn');
|
|
|
|
const $pipelineGraph = $(this).closest('.row-content-block').next('.pipeline-graph');
|
|
|
|
const $btnText = $(this).find('.toggle-btn-text');
|
2016-10-07 07:23:00 -04:00
|
|
|
const graphCollapsed = $pipelineGraph.hasClass('graph-collapsed');
|
2016-08-16 20:42:05 -04:00
|
|
|
|
2016-09-29 17:24:37 -04:00
|
|
|
$($pipelineBtn).add($pipelineGraph).toggleClass('graph-collapsed');
|
2016-08-17 11:06:10 -04:00
|
|
|
|
2016-08-16 20:42:05 -04:00
|
|
|
|
2016-10-14 13:13:03 -04:00
|
|
|
graphCollapsed ? $btnText.text('Hide') : $btnText.text('Expand')
|
2016-09-29 17:24:37 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
addMarginToBuildColumns() {
|
|
|
|
const $secondChildBuildNode = $('.build:nth-child(2)');
|
|
|
|
if ($secondChildBuildNode.length) {
|
|
|
|
const $firstChildBuildNode = $secondChildBuildNode.prev('.build');
|
|
|
|
const $multiBuildColumn = $secondChildBuildNode.closest('.stage-column');
|
|
|
|
const $previousColumn = $multiBuildColumn.prev('.stage-column');
|
|
|
|
$multiBuildColumn.addClass('left-margin');
|
|
|
|
$firstChildBuildNode.addClass('left-connector');
|
|
|
|
$previousColumn.each(function() {
|
|
|
|
$this = $(this);
|
|
|
|
if ($('.build', $this).length === 1) $this.addClass('no-margin');
|
|
|
|
});
|
|
|
|
}
|
2016-10-04 14:59:57 -04:00
|
|
|
$('.pipeline-graph').removeClass('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 = {}));
|