]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: improve logs 34770/head
authorSebastian Krah <skrah@suse.com>
Fri, 20 Mar 2020 09:27:08 +0000 (10:27 +0100)
committerSebastian Krah <skrah@suse.com>
Thu, 1 Oct 2020 06:33:02 +0000 (08:33 +0200)
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 <skrah@suse.com>
src/pybind/mgr/dashboard/controllers/logs.py
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/logs/logs.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/logs/logs.component.scss
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/logs/logs.component.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/log-priority.pipe.ts

index 63f7bfdb414efc6ec4b4980e7768b1f3aaf66cee..fbc1cd86be844725ea3267e1651c5ff12179991d 100644 (file)
@@ -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)
 
index d6e62620bfcd2945e34f885c4c16e6cc299ebce9..1f6aec722c95e03befad063e7543d33f819622f8 100644 (file)
@@ -18,8 +18,7 @@
               <span class="message">{{ line.message }}</span>
             </p>
 
-            <span *ngIf="contentData.clog.length === 0"
-                  i18n>No entries found</span>
+            <ng-container *ngIf="clog.length != 0 else noEntriesTpl"></ng-container>
           </div>
         </div>
       </ng-template>
@@ -37,8 +36,7 @@
               <span class="message">{{ line.message }}</span>
             </p>
 
-            <span *ngIf="contentData.audit_log.length === 0"
-                  i18n>No entries found</span>
+            <ng-container *ngIf="audit_log.length != 0 else noEntriesTpl"></ng-container>
           </div>
         </div>
       </ng-template>
@@ -96,6 +94,7 @@
                id="logs-date"
                placeholder="YYYY-MM-DD"
                ngbDatepicker
+               [maxDate]="maxDate"
                #d="ngbDatepicker"
                (click)="d.open()"
                [(ngModel)]="selectedDate"
     </div>
   </div>
 </ng-template>
+
+<ng-template #noEntriesTpl>
+  <span i18n>No log entries found. Please try to select different filter options.</span>
+  <span>&nbsp;</span>
+  <a href="#"
+     (click)="resetFilter()"
+     i18n>Reset filter.</a>
+</ng-template>
index b5b4cff0a465c2af64f49546f8d33c18758012f0..7638196c49dc9381d0a9f5ec43ebee8467dfc711 100644 (file)
@@ -37,6 +37,10 @@ p {
   .info {
     color: bd.$info;
   }
+
+  .debug {
+    color: bd.$gray-700;
+  }
 }
 
 ::ng-deep cd-logs ngb-timepicker input.ngb-tp-input {
index d69c07d33e132647c2826984cfd172ea94979202..a34e455e7e7b353b100111c21aaad447162e84e1 100644 (file)
@@ -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;
+  }
 }
index c7f5e50b5eeba95a8526a4cf142aa39d4dcaaab5..0c51c867b068fde19cb46e7073ebc88a65214cc6 100644 (file)
@@ -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';