mirror of
https://github.com/portainer/portainer.git
synced 2025-07-25 08:19:40 +02:00
feat(log-viewer): change line count default to 100 and add a since parameter (#2377)
* chore(log-viewer): add the ability to use`since` parameter #1942 https://github.com/portainer/portainer/issues/1942#issuecomment-430246378 * chore(log-viewer): change lineCount to 100 #1942 https://github.com/portainer/portainer/issues/1942#issuecomment-430246378 * fix(log-viewer): js syntax typo for `;` and `'` forget to lint the code, reported by codeclimate * fix(log-viewer): use mementjs to format timestamp 1. use moment lib instead of define a function in filter.js(not the right place for this function, removed) 2. set sinceTimestamp init value to `24 hours ago`, as we just need to focus on the relative latest logs after the log-viewer loading, not all the logs(to speedup the process) 3. use moment().unix() to convert the `sinceTimestamp` to local unix timestamp(not utc) * chore(log-viewer): add the ability to select the datetime for `since` * chore(log-viewer): add the ability to fetch logs from specific time
This commit is contained in:
parent
a61654a35d
commit
8df64031e8
12 changed files with 39 additions and 15 deletions
|
@ -3,7 +3,8 @@ angular.module('portainer.docker')
|
|||
function ($scope, $transition$, $interval, ContainerService, Notifications, HttpRequestHelper) {
|
||||
$scope.state = {
|
||||
refreshRate: 3,
|
||||
lineCount: 2000,
|
||||
lineCount: 100,
|
||||
sinceTimestamp: '',
|
||||
displayTimestamps: false
|
||||
};
|
||||
|
||||
|
@ -30,7 +31,7 @@ function ($scope, $transition$, $interval, ContainerService, Notifications, Http
|
|||
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, skipHeaders)
|
||||
ContainerService.logs($transition$.params().id, 1, 1, $scope.state.displayTimestamps ? 1 : 0, moment($scope.state.sinceTimestamp).unix(), $scope.state.lineCount, skipHeaders)
|
||||
.then(function success(data) {
|
||||
$scope.logs = data;
|
||||
})
|
||||
|
@ -42,7 +43,7 @@ function ($scope, $transition$, $interval, ContainerService, Notifications, Http
|
|||
}
|
||||
|
||||
function startLogPolling(skipHeaders) {
|
||||
ContainerService.logs($transition$.params().id, 1, 1, $scope.state.displayTimestamps ? 1 : 0, $scope.state.lineCount, skipHeaders)
|
||||
ContainerService.logs($transition$.params().id, 1, 1, $scope.state.displayTimestamps ? 1 : 0, moment($scope.state.sinceTimestamp).unix(), $scope.state.lineCount, skipHeaders)
|
||||
.then(function success(data) {
|
||||
$scope.logs = data;
|
||||
setUpdateRepeater(skipHeaders);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue