1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-24 15:59:41 +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:
pc 2018-10-29 12:49:35 +08:00 committed by Anthony Lapenna
parent a61654a35d
commit 8df64031e8
12 changed files with 39 additions and 15 deletions

View file

@ -5,6 +5,7 @@ angular.module('portainer.docker').component('logViewer', {
data: '=',
displayTimestamps: '=',
logCollectionChange: '<',
sinceTimestamp: '=',
lineCount: '='
}
});

View file

@ -35,6 +35,17 @@
</label>
</div>
</div>
<div class="form-group">
<label for="logs_since" class="col-sm-1 control-label text-left">
Fetch
</label>
<div class="col-sm-2">
<select class="form-control" ng-model="$ctrl.sinceTimestamp" id="logs_since">
<option selected value="">All logs</option>
<option ng-repeat="dt in $ctrl.state.availableSinceDatetime" ng-value="dt.value" title="{{ dt.value }}">{{ dt.desc }}</option>
</select>
</div>
</div>
<div class="form-group">
<label for="logs_search" class="col-sm-1 control-label text-left">
Search

View file

@ -3,6 +3,12 @@ angular.module('portainer.docker')
function (clipboard) {
this.state = {
availableSinceDatetime: [
{ desc: 'Last day', value: moment().subtract(1, 'days').format() },
{ desc: 'Last 4 hours', value: moment().subtract(4, 'hours').format() },
{ desc: 'Last hour', value: moment().subtract(1, 'hours').format() },
{ desc: 'Last 10 minutes', value: moment().subtract(10, 'minutes').format() }
],
copySupported: clipboard.supported,
logCollection: true,
autoScroll: true,