summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKushal Pandya <kushal@gitlab.com>2016-12-09 20:34:19 +0530
committerKushal Pandya <kushal@gitlab.com>2016-12-21 13:16:17 +0530
commitad0b81872a52e984f240f229c3de03bae4d44c7e (patch)
tree7eb25cec86a16cdf2fced377f303336400227839
parent6fe5bb40b6dde14b3594a37b008265e1f9083296 (diff)
downloadgitlab-ce-ad0b81872a52e984f240f229c3de03bae4d44c7e.tar.gz
Fix incorrect scroll button appearance in certain cases
-rw-r--r--app/assets/javascripts/build.js13
1 files changed, 12 insertions, 1 deletions
diff --git a/app/assets/javascripts/build.js b/app/assets/javascripts/build.js
index 56b48b2cd60..b4e1d3d9346 100644
--- a/app/assets/javascripts/build.js
+++ b/app/assets/javascripts/build.js
@@ -81,6 +81,7 @@
};
Build.prototype.getInitialBuildTrace = function() {
+ var _this = this;
var removeRefreshStatuses = ['success', 'failed', 'canceled', 'skipped']
return $.ajax({
@@ -89,6 +90,7 @@
success: function(buildData) {
$('.js-build-output').html(buildData.trace_html);
if (removeRefreshStatuses.indexOf(buildData.status) >= 0) {
+ _this.initScrollMonitor();
return $('.js-build-refresh').remove();
}
}
@@ -123,11 +125,20 @@
if ($("#autoscroll-status").data("state") === "enabled") {
return $("html,body").scrollTop($("#build-trace").height());
}
+
+ // Handle a situation where user started new build
+ // but never scrolled a page
+ if (!this.$scrollTopBtn.is(':visible') &&
+ !this.$scrollBottomBtn.is(':visible') &&
+ !gl.utils.isInViewport(this.$downBuildTrace[0])) {
+ this.$scrollBottomBtn.show();
+ }
};
Build.prototype.initScrollButtonAffix = function() {
+ // Hide everything initially
this.$scrollTopBtn.hide();
- this.$scrollBottomBtn.show();
+ this.$scrollBottomBtn.hide();
this.$autoScrollContainer.hide();
}