Fix logs autoscroll
This commit is contained in:
committed by
Girish Ramakrishnan
parent
2420fef6b1
commit
1fd4e27d92
@@ -1,4 +1,4 @@
|
||||
<div class="logs-main">
|
||||
<!-- <div class="logs-main"> -->
|
||||
|
||||
<div class="logs-controls">
|
||||
<div class="col-md-10 col-md-offset-1">
|
||||
@@ -6,11 +6,11 @@
|
||||
<uib-tab index="0" heading="Logs" select="showLogs()"></uib-tab>
|
||||
<uib-tab index="1" heading="Terminal" select="showTerminal()"></uib-tab>
|
||||
</uib-tabset>
|
||||
<select class="form-control pull-right" ng-options="log.name for log in logs track by log.value" ng-model="selected"></select>
|
||||
<select class="form-control pull-right inline" ng-options="log.name for log in logs track by log.value" ng-model="selected"></select>
|
||||
<a class="btn btn-default pull-right" ng-href="{{ selected.url }}&format=short&lines=800" ng-hide="terminalVisible"><i class="fa fa-download"></i> Download </a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="logs-and-term-container"></div>
|
||||
|
||||
</div>
|
||||
<!-- </div> -->
|
||||
|
||||
@@ -69,14 +69,14 @@ angular.module('Application').controller('LogsController', ['$scope', '$location
|
||||
|
||||
// check if we want to auto scroll (this is before the appending, as that skews the check)
|
||||
var tmp = $('.logs-and-term-container');
|
||||
var autoScroll = tmp.scrollTop > (tmp.scrollTopMax - 24);
|
||||
var autoScroll = tmp[0].scrollTop > (tmp[0].scrollTopMax - 24);
|
||||
|
||||
var logLine = $('<div class="log-line">');
|
||||
var timeString = moment.utc(data.realtimeTimestamp/1000).format('MMM DD HH:mm:ss');
|
||||
logLine.html('<span class="time">' + timeString + ' </span>' + window.ansiToHTML(typeof data.message === 'string' ? data.message : ab2str(data.message)));
|
||||
tmp.append(logLine);
|
||||
|
||||
if (autoScroll) tmp.lastChild.scrollIntoView({ behavior: 'instant', block: 'end' });
|
||||
if (autoScroll) tmp[0].lastChild.scrollIntoView({ behavior: 'instant', block: 'end' });
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user