From aead1fcc2953c48de4a128fe1f8dd334f67d746e Mon Sep 17 00:00:00 2001 From: jonny64 Date: Thu, 5 Feb 2015 19:23:57 +0000 Subject: [PATCH 1/5] 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 @@
- + + + + + + + +
From 53041efaf1c59598b5b1307bf8fe8d1de24119d2 Mon Sep 17 00:00:00 2001 From: jonny64 Date: Mon, 16 Feb 2015 17:42:02 +0000 Subject: [PATCH 2/5] logs: tail also STDERR --- app/components/containerLogs/containerLogsController.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/components/containerLogs/containerLogsController.js b/app/components/containerLogs/containerLogsController.js index 883eedf55..cfbcdae6a 100644 --- a/app/components/containerLogs/containerLogsController.js +++ b/app/components/containerLogs/containerLogsController.js @@ -30,7 +30,12 @@ function($scope, $routeParams, $location, $anchorScroll, ContainerLogs, Containe // Replace carriage returns twith newlines to clean up output $scope.stdout = data.replace(/[\r]/g, '\n'); }); - 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) { $scope.stderr = data.replace(/[\r]/g, '\n'); }); } From df5e7bc867707434cce5dea6e7ed01d8b17ce92a Mon Sep 17 00:00:00 2001 From: jonny64 Date: Mon, 16 Feb 2015 18:18:34 +0000 Subject: [PATCH 3/5] logs: removed debugging --- app/components/containerLogs/containerLogsController.js | 1 - 1 file changed, 1 deletion(-) diff --git a/app/components/containerLogs/containerLogsController.js b/app/components/containerLogs/containerLogsController.js index cfbcdae6a..ff8330a98 100644 --- a/app/components/containerLogs/containerLogsController.js +++ b/app/components/containerLogs/containerLogsController.js @@ -20,7 +20,6 @@ function($scope, $routeParams, $location, $anchorScroll, ContainerLogs, Containe }); function getLogs() { - console.log($scope.tailLines); ContainerLogs.get($routeParams.id, { stdout: 1, stderr: 0, From b25721619427226c7b1401c1f8640e5dc5403b0d Mon Sep 17 00:00:00 2001 From: jonny64 Date: Mon, 16 Feb 2015 18:42:08 +0000 Subject: [PATCH 4/5] logs: reload button --- app/components/containerLogs/containerlogs.html | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/components/containerLogs/containerlogs.html b/app/components/containerLogs/containerlogs.html index 46dfacb1d..8dfa62b8a 100644 --- a/app/components/containerLogs/containerlogs.html +++ b/app/components/containerLogs/containerlogs.html @@ -5,17 +5,17 @@ -
- - - +
+ Reload logs + - - +
+
- + ng-change="toggleTimestamps()"/> +
From 66ba60c475b20095fb8e3a49f386d4a1de6f4e0d Mon Sep 17 00:00:00 2001 From: jonny64 Date: Sat, 21 Feb 2015 18:09:12 +0000 Subject: [PATCH 5/5] logs: added spinner during refresh --- app/components/containerLogs/containerLogsController.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/components/containerLogs/containerLogsController.js b/app/components/containerLogs/containerLogsController.js index ff8330a98..97db2a5b9 100644 --- a/app/components/containerLogs/containerLogsController.js +++ b/app/components/containerLogs/containerLogsController.js @@ -20,6 +20,7 @@ function($scope, $routeParams, $location, $anchorScroll, ContainerLogs, Containe }); function getLogs() { + ViewSpinner.spin(); ContainerLogs.get($routeParams.id, { stdout: 1, stderr: 0, @@ -28,7 +29,9 @@ function($scope, $routeParams, $location, $anchorScroll, ContainerLogs, Containe }, function(data, status, headers, config) { // Replace carriage returns twith newlines to clean up output $scope.stdout = data.replace(/[\r]/g, '\n'); + ViewSpinner.stop(); }); + ContainerLogs.get($routeParams.id, { stdout: 0, stderr: 1, @@ -36,6 +39,7 @@ function($scope, $routeParams, $location, $anchorScroll, ContainerLogs, Containe tail: $scope.tailLines }, function(data, status, headers, config) { $scope.stderr = data.replace(/[\r]/g, '\n'); + ViewSpinner.stop(); }); }