summaryrefslogtreecommitdiff
path: root/app/assets
diff options
context:
space:
mode:
authorFatih Acet <acetfatih@gmail.com>2016-12-12 17:44:10 +0000
committerFatih Acet <acetfatih@gmail.com>2016-12-12 17:44:10 +0000
commit407adb9e9529d4aa769dbd1fbb3932684e036c3a (patch)
treed365ae989e3ee58da711da1542877d358287d63a /app/assets
parent3445136b9b0b8367b151170509fabe613389a50d (diff)
parent52e0c4ba916d2cbc9bdb0fa0782c6b705c03c5a6 (diff)
downloadgitlab-ce-407adb9e9529d4aa769dbd1fbb3932684e036c3a.tar.gz
Merge branch '25483-broken-tabs' into 'master'
Fix TypeError: Cannot read property 'initTabs' ## What does this MR do? Adds a default value to the `options` argument in order to prevent errors when `Pipelines` is initialised without arguments. Adds tests to guarantee this does not happen again. Adds back removed pipeline class to make the pipeline graph visible, `js-pipeline-graph` ## Why was this MR needed? In the places where `Pipelines` is initialised without arguments it throws an error: `TypeError: Cannot read property 'initTabs'` ## Does this MR meet the acceptance criteria? - [x] [Changelog entry](https://docs.gitlab.com/ce/development/changelog.html) added - [ ] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md) - [ ] API support added - Tests - [x] Added for this feature/bug - [ ] All builds are passing - [x] Conform by the [merge request performance guides](http://docs.gitlab.com/ce/development/merge_request_performance_guidelines.html) - [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides) - [x] Branch has no merge conflicts with `master` (if it does - rebase it please) - [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits) ## What are the relevant issue numbers? Closes #25483 Closes #25493 See merge request !8009
Diffstat (limited to 'app/assets')
-rw-r--r--app/assets/javascripts/pipelines.js.es611
1 files changed, 7 insertions, 4 deletions
diff --git a/app/assets/javascripts/pipelines.js.es6 b/app/assets/javascripts/pipelines.js.es6
index 72c6c4a1fcd..fb95648e1c7 100644
--- a/app/assets/javascripts/pipelines.js.es6
+++ b/app/assets/javascripts/pipelines.js.es6
@@ -4,7 +4,7 @@
((global) => {
class Pipelines {
- constructor(options) {
+ constructor(options = {}) {
if (options.initTabs && options.tabsOptions) {
new global.LinkedTabs(options.tabsOptions);
@@ -14,9 +14,11 @@
}
addMarginToBuildColumns() {
- this.pipelineGraph = document.querySelector('.pipeline-graph');
- const secondChildBuildNodes = document.querySelector('.pipeline-graph').querySelectorAll('.build:nth-child(2)');
- for (buildNodeIndex in secondChildBuildNodes) {
+ 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;
@@ -28,6 +30,7 @@
const columnBuilds = previousColumn.querySelectorAll('.build');
if (columnBuilds.length === 1) previousColumn.classList.add('no-margin');
}
+
this.pipelineGraph.classList.remove('hidden');
}
}