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';
icons = Icons;
clogText: string;
auditLogText: string;
+ lokiServiceStatus$: Observable<boolean>;
+ promtailServiceStatus$: Observable<boolean>;
interval: number;
priorities: Array<{ name: string; value: string }> = [
constructor(
private logsService: LogsService,
+ private cephService: CephServiceService,
private datePipe: DatePipe,
private ngZone: NgZone
) {}
ngOnInit() {
this.getInfo();
this.ngZone.runOutsideAngular(() => {
+ this.getDaemonDetails();
this.interval = window.setInterval(() => {
this.ngZone.run(() => {
this.getInfo();
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;
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;