Fix logs autoscroll
This commit is contained in:
committed by
Girish Ramakrishnan
parent
2420fef6b1
commit
1fd4e27d92
@@ -1089,40 +1089,8 @@ footer {
|
||||
// Logs
|
||||
// ----------------------------
|
||||
|
||||
.logs-main {
|
||||
text-align: left;
|
||||
width: 100%;
|
||||
flex-grow: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.logs-controls {
|
||||
margin-top: 25px;
|
||||
}
|
||||
|
||||
.log-line {
|
||||
line-height: 1.2;
|
||||
|
||||
&:hover {
|
||||
background-color: #333333;
|
||||
}
|
||||
|
||||
.time {
|
||||
color: #00FFFF;
|
||||
}
|
||||
}
|
||||
|
||||
.logs-and-term-container {
|
||||
flex-grow: 1;
|
||||
margin-left: calc(8.33% + 15px);
|
||||
margin-right: calc(8.33% + 15px);
|
||||
margin-bottom: 20px;
|
||||
background-color: black;
|
||||
color: white;
|
||||
overflow: auto;
|
||||
padding: 5px;
|
||||
font-family: monospace;
|
||||
}
|
||||
.logs-controls {
|
||||
margin-top: 25px;
|
||||
|
||||
.ng-isolate-scope {
|
||||
display: inline-block;
|
||||
@@ -1145,3 +1113,27 @@ footer {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.logs-and-term-container {
|
||||
flex-grow: 1;
|
||||
margin-left: calc(8.33% + 15px);
|
||||
margin-right: calc(8.33% + 15px);
|
||||
margin-bottom: 20px;
|
||||
background-color: black;
|
||||
color: white;
|
||||
overflow: auto;
|
||||
padding: 5px;
|
||||
font-family: monospace;
|
||||
|
||||
.log-line {
|
||||
line-height: 1.2;
|
||||
|
||||
&:hover {
|
||||
background-color: #333333;
|
||||
}
|
||||
|
||||
.time {
|
||||
color: #00FFFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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