1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-25 08:19:40 +02:00

fix(log-viewer): strip headers in container logs when TTY is disabled (#1861)

This commit is contained in:
Anthony Lapenna 2018-05-04 09:45:05 +02:00 committed by GitHub
parent 1e55ada6af
commit e0cf088428
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 81 additions and 26 deletions

View file

@ -11,7 +11,7 @@ function ($scope, $transition$, $interval, ContainerService, Notifications) {
if (!logCollectionStatus) {
stopRepeater();
} else {
setUpdateRepeater();
setUpdateRepeater(!$scope.container.Config.Tty);
}
};
@ -31,10 +31,10 @@ function ($scope, $transition$, $interval, ContainerService, Notifications) {
$scope.logs = logs;
}
function setUpdateRepeater() {
function setUpdateRepeater(skipHeaders) {
var refreshRate = $scope.state.refreshRate;
$scope.repeater = $interval(function() {
ContainerService.logs($transition$.params().id, 1, 1, $scope.state.displayTimestamps ? 1 : 0, $scope.state.lineCount)
ContainerService.logs($transition$.params().id, 1, 1, $scope.state.displayTimestamps ? 1 : 0, $scope.state.lineCount, skipHeaders)
.then(function success(data) {
$scope.logs = data;
})
@ -45,11 +45,11 @@ function ($scope, $transition$, $interval, ContainerService, Notifications) {
}, refreshRate * 1000);
}
function startLogPolling() {
ContainerService.logs($transition$.params().id, 1, 1, $scope.state.displayTimestamps ? 1 : 0, $scope.state.lineCount)
function startLogPolling(skipHeaders) {
ContainerService.logs($transition$.params().id, 1, 1, $scope.state.displayTimestamps ? 1 : 0, $scope.state.lineCount, skipHeaders)
.then(function success(data) {
$scope.logs = data;
setUpdateRepeater();
setUpdateRepeater(skipHeaders);
})
.catch(function error(err) {
stopRepeater();
@ -60,8 +60,9 @@ function ($scope, $transition$, $interval, ContainerService, Notifications) {
function initView() {
ContainerService.container($transition$.params().id)
.then(function success(data) {
$scope.container = data;
startLogPolling();
var container = data;
$scope.container = container;
startLogPolling(!container.Config.Tty);
})
.catch(function error(err) {
Notifications.error('Failure', err, 'Unable to retrieve container information');