summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/pipelines.js
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2017-05-06 19:02:06 +0200
committerKamil Trzcinski <ayufan@ayufan.eu>2017-05-06 19:04:48 +0200
commitaa440eb1c0947d2dc551c61abbd9d271b9002050 (patch)
tree907f60233034d904edd1b5d8ea4c9d6df9278ec5 /app/assets/javascripts/pipelines.js
parentc17e6a6c68b0412b3433632802b852db474a7b30 (diff)
downloadgitlab-ce-aa440eb1c0947d2dc551c61abbd9d271b9002050.tar.gz
Single commit squash of all changes for https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/10878
It's needed due to https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/10777 being merged with squash.
Diffstat (limited to 'app/assets/javascripts/pipelines.js')
-rw-r--r--app/assets/javascripts/pipelines.js46
1 files changed, 9 insertions, 37 deletions
diff --git a/app/assets/javascripts/pipelines.js b/app/assets/javascripts/pipelines.js
index 4252b615887..26a36ad54d1 100644
--- a/app/assets/javascripts/pipelines.js
+++ b/app/assets/javascripts/pipelines.js
@@ -1,42 +1,14 @@
-/* eslint-disable no-new, guard-for-in, no-restricted-syntax, no-continue, no-param-reassign, max-len */
+import LinkedTabs from './lib/utils/bootstrap_linked_tabs';
-require('./lib/utils/bootstrap_linked_tabs');
-
-((global) => {
- class Pipelines {
- constructor(options = {}) {
- if (options.initTabs && options.tabsOptions) {
- new global.LinkedTabs(options.tabsOptions);
- }
-
- if (options.pipelineStatusUrl) {
- gl.utils.setCiStatusFavicon(options.pipelineStatusUrl);
- }
-
- this.addMarginToBuildColumns();
+export default class Pipelines {
+ constructor(options = {}) {
+ if (options.initTabs && options.tabsOptions) {
+ // eslint-disable-next-line no-new
+ new LinkedTabs(options.tabsOptions);
}
- addMarginToBuildColumns() {
- this.pipelineGraph = document.querySelector('.js-pipeline-graph');
-
- const secondChildBuildNodes = this.pipelineGraph.querySelectorAll('.build:nth-child(2)');
-
- for (const 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');
+ if (options.pipelineStatusUrl) {
+ gl.utils.setCiStatusFavicon(options.pipelineStatusUrl);
}
}
-
- global.Pipelines = Pipelines;
-})(window.gl || (window.gl = {}));
+}