gui: Scroll to bottom by clicking message in log viewer (#9128)

This commit is contained in:
d-volution 2023-09-25 21:42:27 +02:00 committed by GitHub
parent 80a577b025
commit 9940c91ebf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -9,7 +9,7 @@
<div id="log-viewer-log" class="tab-pane in active">
<label translate ng-if="logging.logEntries.length == 0">Loading...</label>
<textarea id="logViewerText" class="form-control" rows="20" ng-if="logging.logEntries.length != 0" readonly style="font-family: Consolas, monospace; font-size: 11px; overflow: auto;">{{ logging.content() }}</textarea>
<p translate class="help-block" ng-style="{'visibility': logging.paused ? 'visible' : 'hidden'}">Log tailing paused. Scroll to the bottom to continue.</p>
<a href="" translate class="help-block" ng-style="{'visibility': logging.paused ? 'visible' : 'hidden'}" ng-click="logging.scrollToBottom()" style="text-decoration: none">Log tailing paused. Scroll to the bottom to continue.</a>
</div>
<div id="log-viewer-facilities" class="tab-pane">

View File

@ -1430,6 +1430,11 @@ angular.module('syncthing.core')
// Browser events do not cause redraw, trigger manually.
$scope.$apply();
},
scrollToBottom: function () {
var textArea = $('#logViewerText');
var scrollHeight = textArea.prop('scrollHeight');
textArea.prop('scrollTop', scrollHeight);
},
timer: null,
entries: [],
paused: false,