diff --git a/app/components/containerLogs/containerLogsController.js b/app/components/containerLogs/containerLogsController.js index 4241226e7..458c8b091 100644 --- a/app/components/containerLogs/containerLogsController.js +++ b/app/components/containerLogs/containerLogsController.js @@ -4,6 +4,7 @@ function($scope, $routeParams, $location, $anchorScroll, ContainerLogs, Containe $scope.stdout = ''; $scope.stderr = ''; $scope.showTimestamps = false; + $scope.tailLines = 2000; ViewSpinner.spin(); Container.get({id: $routeParams.id}, function(d) { @@ -19,21 +20,35 @@ function($scope, $routeParams, $location, $anchorScroll, ContainerLogs, Containe }); function getLogs() { - ContainerLogs.get($routeParams.id, {stdout: 1, stderr: 0, timestamps: $scope.showTimestamps}, function(data, status, headers, config) { + ViewSpinner.spin(); + ContainerLogs.get($routeParams.id, { + stdout: 1, + stderr: 0, + timestamps: $scope.showTimestamps, + tail: $scope.tailLines + }, function(data, status, headers, config) { // Replace carriage returns with newlines to clean up output data = data.replace(/[\r]/g, '\n') // Strip 8 byte header from each line of output data = data.substring(8); data = data.replace(/\n(.{8})/g, '\n'); $scope.stdout = data; + ViewSpinner.stop(); }); - ContainerLogs.get($routeParams.id, {stdout: 0, stderr: 1, timestamps: $scope.showTimestamps}, function(data, status, headers, config) { + + ContainerLogs.get($routeParams.id, { + stdout: 0, + stderr: 1, + timestamps: $scope.showTimestamps, + tail: $scope.tailLines + }, function(data, status, headers, config) { // Replace carriage returns with newlines to clean up output data = data.replace(/[\r]/g, '\n') // Strip 8 byte header from each line of output data = data.substring(8); data = data.replace(/\n(.{8})/g, '\n'); $scope.stderr = data; + ViewSpinner.stop(); }); } @@ -54,4 +69,8 @@ function($scope, $routeParams, $location, $anchorScroll, ContainerLogs, Containe $scope.toggleTimestamps = function() { getLogs(); }; + + $scope.toggleTail = function() { + getLogs(); + }; }]); diff --git a/app/components/containerLogs/containerlogs.html b/app/components/containerLogs/containerlogs.html index ea81ad08e..8dfa62b8a 100644 --- a/app/components/containerLogs/containerlogs.html +++ b/app/components/containerLogs/containerlogs.html @@ -5,9 +5,17 @@ -
- +
+
+ Reload logs + + +
+
+ +