From 8e4f3bcbe728b3b5f794190d20e2c974198a8f87 Mon Sep 17 00:00:00 2001 From: Sebastian Krah Date: Fri, 20 Mar 2020 10:27:08 +0100 Subject: [PATCH] mgr/dashboard: improve logs Changes the text that is being displayed when no log entry was found. Also changes the log level to debug. User can no longer select a date in the future to filter log entries. Fixes: https://tracker.ceph.com/issues/42963 Signed-off-by: Sebastian Krah --- src/pybind/mgr/dashboard/controllers/logs.py | 2 +- .../app/ceph/cluster/logs/logs.component.html | 15 +++++++++++---- .../app/ceph/cluster/logs/logs.component.scss | 4 ++++ .../src/app/ceph/cluster/logs/logs.component.ts | 16 ++++++++++++++++ .../src/app/shared/pipes/log-priority.pipe.ts | 4 +++- 5 files changed, 35 insertions(+), 6 deletions(-) diff --git a/src/pybind/mgr/dashboard/controllers/logs.py b/src/pybind/mgr/dashboard/controllers/logs.py index 63f7bfdb414..fbc1cd86be8 100644 --- a/src/pybind/mgr/dashboard/controllers/logs.py +++ b/src/pybind/mgr/dashboard/controllers/logs.py @@ -49,7 +49,7 @@ class Logs(BaseController): def load_buffer(self, buf, channel_name): lines = CephService.send_command( - 'mon', 'log last', channel=channel_name, num=LOG_BUFFER_SIZE) + 'mon', 'log last', channel=channel_name, num=LOG_BUFFER_SIZE, level='debug') for l in lines: buf.appendleft(l) diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/logs/logs.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/logs/logs.component.html index d6e62620bfc..1f6aec722c9 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/logs/logs.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/logs/logs.component.html @@ -18,8 +18,7 @@ {{ line.message }}

- No entries found + @@ -37,8 +36,7 @@ {{ line.message }}

- No entries found + @@ -96,6 +94,7 @@ id="logs-date" placeholder="YYYY-MM-DD" ngbDatepicker + [maxDate]="maxDate" #d="ngbDatepicker" (click)="d.open()" [(ngModel)]="selectedDate" @@ -124,3 +123,11 @@ + + + No log entries found. Please try to select different filter options. +   + Reset filter. + diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/logs/logs.component.scss b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/logs/logs.component.scss index b5b4cff0a46..7638196c49d 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/logs/logs.component.scss +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/logs/logs.component.scss @@ -37,6 +37,10 @@ p { .info { color: bd.$info; } + + .debug { + color: bd.$gray-700; + } } ::ng-deep cd-logs ngb-timepicker input.ngb-tp-input { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/logs/logs.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/logs/logs.component.ts index d69c07d33e1..a34e455e7e7 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/logs/logs.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/logs/logs.component.ts @@ -19,6 +19,7 @@ export class LogsComponent implements OnInit, OnDestroy { interval: number; priorities: Array<{ name: string; value: string }> = [ + { name: 'Debug', value: '[DBG]' }, { name: 'Info', value: '[INF]' }, { name: 'Warning', value: '[WRN]' }, { name: 'Error', value: '[ERR]' }, @@ -29,6 +30,11 @@ export class LogsComponent implements OnInit, OnDestroy { selectedDate: NgbDateStruct; startTime = { hour: 0, minute: 0 }; endTime = { hour: 23, minute: 59 }; + maxDate = { + year: new Date().getFullYear(), + month: new Date().getMonth() + 1, + day: new Date().getDate() + }; constructor( private logsService: LogsService, @@ -120,4 +126,14 @@ export class LogsComponent implements OnInit, OnDestroy { this.selectedDate = null; this.filterLogs(); } + resetFilter() { + this.priority = 'All'; + this.search = ''; + this.selectedDate = null; + this.startTime = { hour: 0, minute: 0 }; + this.endTime = { hour: 23, minute: 59 }; + this.filterLogs(); + + return false; + } } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/log-priority.pipe.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/log-priority.pipe.ts index c7f5e50b5ee..0c51c867b06 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/log-priority.pipe.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/log-priority.pipe.ts @@ -5,7 +5,9 @@ import { Pipe, PipeTransform } from '@angular/core'; }) export class LogPriorityPipe implements PipeTransform { transform(value: any): any { - if (value === '[INF]') { + if (value === '[DBG]') { + return 'debug'; + } else if (value === '[INF]') { return 'info'; } else if (value === '[WRN]') { return 'warn';