]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/logs/logs.component.ts
import ceph quincy 17.2.4
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / ceph / cluster / logs / logs.component.ts
index 04375b1ef7c9606141f7b7fc966549ead13c9c28..ed8c721eaf3e1f6b3440d091c4c829dc01edf366 100644 (file)
@@ -2,7 +2,10 @@ import { DatePipe } from '@angular/common';
 import { Component, NgZone, OnDestroy, OnInit } from '@angular/core';
 
 import { NgbDateStruct } from '@ng-bootstrap/ng-bootstrap';
+import { Observable } from 'rxjs';
+import { map } from 'rxjs/operators';
 
+import { CephServiceService } from '~/app/shared/api/ceph-service.service';
 import { LogsService } from '~/app/shared/api/logs.service';
 import { Icons } from '~/app/shared/enum/icons.enum';
 
@@ -18,6 +21,8 @@ export class LogsComponent implements OnInit, OnDestroy {
   icons = Icons;
   clogText: string;
   auditLogText: string;
+  lokiServiceStatus$: Observable<boolean>;
+  promtailServiceStatus$: Observable<boolean>;
 
   interval: number;
   priorities: Array<{ name: string; value: string }> = [
@@ -40,6 +45,7 @@ export class LogsComponent implements OnInit, OnDestroy {
 
   constructor(
     private logsService: LogsService,
+    private cephService: CephServiceService,
     private datePipe: DatePipe,
     private ngZone: NgZone
   ) {}
@@ -47,6 +53,7 @@ export class LogsComponent implements OnInit, OnDestroy {
   ngOnInit() {
     this.getInfo();
     this.ngZone.runOutsideAngular(() => {
+      this.getDaemonDetails();
       this.interval = window.setInterval(() => {
         this.ngZone.run(() => {
           this.getInfo();
@@ -59,6 +66,19 @@ export class LogsComponent implements OnInit, OnDestroy {
     clearInterval(this.interval);
   }
 
+  getDaemonDetails() {
+    this.lokiServiceStatus$ = this.cephService.getDaemons('loki').pipe(
+      map((data: any) => {
+        return data.length > 0 && data[0].status === 1;
+      })
+    );
+    this.promtailServiceStatus$ = this.cephService.getDaemons('promtail').pipe(
+      map((data: any) => {
+        return data.length > 0 && data[0].status === 1;
+      })
+    );
+  }
+
   getInfo() {
     this.logsService.getLogs().subscribe((data: any) => {
       this.contentData = data;
@@ -70,8 +90,7 @@ export class LogsComponent implements OnInit, OnDestroy {
 
   abstractFilters(): any {
     const priority = this.priority;
-    const key = this.search.toLowerCase().replace(/,/g, '');
-
+    const key = this.search.toLowerCase();
     let yearMonthDay: string;
     if (this.selectedDate) {
       const m = this.selectedDate.month;