summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Schatz <jschatz@gitlab.com>2016-09-20 03:33:52 +0000
committerJacob Schatz <jschatz@gitlab.com>2016-09-20 03:33:52 +0000
commit3be079c2eaf21efb93bcfdb80332091321b66451 (patch)
tree903b184055e893c1e0d007f26bdf99ff3ab2d02c
parentb9712c811ba7e0063e45d69c6239d59e42586b52 (diff)
parentf162dde69f339895d8cea44af3670fe197fe2414 (diff)
downloadgitlab-ce-3be079c2eaf21efb93bcfdb80332091321b66451.tar.gz
Merge branch 'fix-build-trace-anchors' into 'master'
Improve build trace scroll controls ## What does this MR do? The trace step buttons now correctly scroll to the top or bottom of the build trace, rather than jumping inconsistently and never full reaching the top due to the fixed position of the header/navigation area. ## Are there points in the code the reviewer needs to double check? ## Why was this MR needed? Build trace UX ## Screenshots (if relevant) ![2016-09-09_20.04.32](/uploads/efee5145fb505f8c9ae2a4cf24d842d3/2016-09-09_20.04.32.gif) ## Does this MR meet the acceptance criteria? - [ ] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added - [ ] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md) - [ ] API support added - Tests - [ ] Added for this feature/bug - [ ] All builds are passing - [ ] Conform by the [merge request performance guides](http://docs.gitlab.com/ce/development/merge_request_performance_guidelines.html) - [ ] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides) - [ ] Branch has no merge conflicts with `master` (if you do - rebase it please) - [ ] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits) ## What are the relevant issue numbers? Contributes to #21832. See merge request !6288
-rw-r--r--app/assets/javascripts/build.js13
1 files changed, 11 insertions, 2 deletions
diff --git a/app/assets/javascripts/build.js b/app/assets/javascripts/build.js
index 10abeb50f4b..78d21c0552a 100644
--- a/app/assets/javascripts/build.js
+++ b/app/assets/javascripts/build.js
@@ -27,10 +27,11 @@
$(document).off('click', '.js-sidebar-build-toggle').on('click', '.js-sidebar-build-toggle', this.toggleSidebar);
$(window).off('resize.build').on('resize.build', this.hideSidebar);
$(document).off('click', '.stage-item').on('click', '.stage-item', this.updateDropdown);
+ $('#js-build-scroll > a').off('click').on('click', this.stepTrace);
this.updateArtifactRemoveDate();
if ($('#build-trace').length) {
this.getInitialBuildTrace();
- this.initScrollButtonAffix();
+ this.initScrollButtons();
}
if (this.build_status === "running" || this.build_status === "pending") {
$('#autoscroll-button').on('click', function() {
@@ -106,7 +107,7 @@
}
};
- Build.prototype.initScrollButtonAffix = function() {
+ Build.prototype.initScrollButtons = function() {
var $body, $buildScroll, $buildTrace;
$buildScroll = $('#js-build-scroll');
$body = $('body');
@@ -165,6 +166,14 @@
this.populateJobs(stage);
};
+ Build.prototype.stepTrace = function(e) {
+ e.preventDefault();
+ $currentTarget = $(e.currentTarget);
+ $.scrollTo($currentTarget.attr('href'), {
+ offset: -($('.navbar-gitlab').outerHeight() + $('.layout-nav').outerHeight())
+ });
+ };
+
return Build;
})();