Commit ad0b8187 authored by Kushal Pandya's avatar Kushal Pandya

Fix incorrect scroll button appearance in certain cases

parent 6fe5bb40
...@@ -81,6 +81,7 @@ ...@@ -81,6 +81,7 @@
}; };
Build.prototype.getInitialBuildTrace = function() { Build.prototype.getInitialBuildTrace = function() {
var _this = this;
var removeRefreshStatuses = ['success', 'failed', 'canceled', 'skipped'] var removeRefreshStatuses = ['success', 'failed', 'canceled', 'skipped']
return $.ajax({ return $.ajax({
...@@ -89,6 +90,7 @@ ...@@ -89,6 +90,7 @@
success: function(buildData) { success: function(buildData) {
$('.js-build-output').html(buildData.trace_html); $('.js-build-output').html(buildData.trace_html);
if (removeRefreshStatuses.indexOf(buildData.status) >= 0) { if (removeRefreshStatuses.indexOf(buildData.status) >= 0) {
_this.initScrollMonitor();
return $('.js-build-refresh').remove(); return $('.js-build-refresh').remove();
} }
} }
...@@ -123,11 +125,20 @@ ...@@ -123,11 +125,20 @@
if ($("#autoscroll-status").data("state") === "enabled") { if ($("#autoscroll-status").data("state") === "enabled") {
return $("html,body").scrollTop($("#build-trace").height()); 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() { Build.prototype.initScrollButtonAffix = function() {
// Hide everything initially
this.$scrollTopBtn.hide(); this.$scrollTopBtn.hide();
this.$scrollBottomBtn.show(); this.$scrollBottomBtn.hide();
this.$autoScrollContainer.hide(); this.$autoScrollContainer.hide();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment