Merge branch '26109-preserve-scroll-position-on-autoreload' into 'master'
Scroll to bottom on build completion if autoscroll was active Closes #26109 See merge request !8391
This commit is contained in:
commit
92ec284b2f
2 changed files with 17 additions and 2 deletions
|
@ -5,6 +5,7 @@
|
|||
(function() {
|
||||
var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
|
||||
var AUTO_SCROLL_OFFSET = 75;
|
||||
var DOWN_BUILD_TRACE = '#down-build-trace';
|
||||
|
||||
this.Build = (function() {
|
||||
Build.interval = null;
|
||||
|
@ -26,7 +27,7 @@
|
|||
this.$autoScrollStatus = $('#autoscroll-status');
|
||||
this.$autoScrollStatusText = this.$autoScrollStatus.find('.status-text');
|
||||
this.$upBuildTrace = $('#up-build-trace');
|
||||
this.$downBuildTrace = $('#down-build-trace');
|
||||
this.$downBuildTrace = $(DOWN_BUILD_TRACE);
|
||||
this.$scrollTopBtn = $('#scroll-top');
|
||||
this.$scrollBottomBtn = $('#scroll-bottom');
|
||||
this.$buildRefreshAnimation = $('.js-build-refresh');
|
||||
|
@ -91,6 +92,9 @@
|
|||
dataType: 'json',
|
||||
success: function(buildData) {
|
||||
$('.js-build-output').html(buildData.trace_html);
|
||||
if (window.location.hash === DOWN_BUILD_TRACE) {
|
||||
$("html,body").scrollTop(this.$buildTrace.height());
|
||||
}
|
||||
if (removeRefreshStatuses.indexOf(buildData.status) >= 0) {
|
||||
this.$buildRefreshAnimation.remove();
|
||||
return this.initScrollMonitor();
|
||||
|
@ -105,6 +109,8 @@
|
|||
dataType: "json",
|
||||
success: (function(_this) {
|
||||
return function(log) {
|
||||
var pageUrl;
|
||||
|
||||
if (log.state) {
|
||||
_this.state = log.state;
|
||||
}
|
||||
|
@ -116,7 +122,12 @@
|
|||
}
|
||||
return _this.checkAutoscroll();
|
||||
} else if (log.status !== _this.buildStatus) {
|
||||
return Turbolinks.visit(_this.pageUrl);
|
||||
pageUrl = _this.pageUrl;
|
||||
if (_this.$autoScrollStatus.data('state') === 'enabled') {
|
||||
pageUrl += DOWN_BUILD_TRACE;
|
||||
}
|
||||
|
||||
return Turbolinks.visit(pageUrl);
|
||||
}
|
||||
};
|
||||
})(this)
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
title: Scroll to bottom on build completion if autoscroll was active
|
||||
merge_request: 8391
|
||||
author:
|
Loading…
Reference in a new issue