From aead1fcc2953c48de4a128fe1f8dd334f67d746e Mon Sep 17 00:00:00 2001 From: jonny64 Date: Thu, 5 Feb 2015 19:23:57 +0000 Subject: [PATCH] logs page: slow on huge logs - 'show last lines' option --- .../containerLogs/containerLogsController.js | 13 ++++++++++++- app/components/containerLogs/containerlogs.html | 12 ++++++++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/app/components/containerLogs/containerLogsController.js b/app/components/containerLogs/containerLogsController.js index ddd614d79..fbbee45c3 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,7 +20,13 @@ 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) { + console.log($scope.tailLines); + ContainerLogs.get($routeParams.id, { + stdout: 1, + stderr: 0, + timestamps: $scope.showTimestamps, + tail: $scope.tailLines + }, function(data, status, headers, config) { // Replace carriage returns twith newlines to clean up output $scope.stdout = data.replace(/[\r]/g, '\n'); }); @@ -45,4 +52,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..46dfacb1d 100644 --- a/app/components/containerLogs/containerlogs.html +++ b/app/components/containerLogs/containerlogs.html @@ -6,8 +6,16 @@
- + + + + + + + +