-
Notifications
You must be signed in to change notification settings - Fork 6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23834 from DikshaGodbole/wip-feature-24571
mgr/dashboard: Move Cluster/Audit logs from front page to dedicated Logs page Reviewed-by: Alfonso Martínez <almartin@redhat.com> Reviewed-by: Tiago Melo <tmelo@suse.com> Reviewed-by: Volker Theile <vtheile@suse.com>
- Loading branch information
Showing
10 changed files
with
120 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/logs/logs.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<div *ngIf="contentData"> | ||
<tabset> | ||
<tab i18n-heading | ||
heading="Cluster Logs"> | ||
<div class="well"> | ||
<div *ngIf="contentData.clog"> | ||
<p *ngFor="let line of contentData.clog"> | ||
{{ line.stamp }} {{ line.priority }} | ||
<span [ngStyle]="line"> | ||
{{ line.message }} | ||
<br> | ||
</span> | ||
</p> | ||
</div> | ||
</div> | ||
</tab> | ||
|
||
<tab i18n-heading | ||
heading="Audit Logs"> | ||
<div class="well"> | ||
<div *ngIf="contentData.audit_log"> | ||
<p *ngFor="let line of contentData.audit_log"> | ||
{{ line.stamp }} {{ line.priority }} | ||
<span [ngStyle]="line"> | ||
<span style="font-weight: bold;"> | ||
{{ line.message }} | ||
</span> | ||
<br> | ||
</span> | ||
</p> | ||
</div> | ||
</div> | ||
</tab> | ||
</tabset> | ||
</div> |
4 changes: 4 additions & 0 deletions
4
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/logs/logs.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
p { | ||
font-family: monospace; | ||
color: black; | ||
} |
28 changes: 28 additions & 0 deletions
28
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/logs/logs.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { HttpClientTestingModule } from '@angular/common/http/testing'; | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { TabsModule } from 'ngx-bootstrap/tabs'; | ||
|
||
import { configureTestBed } from '../../../../testing/unit-test-helper'; | ||
import { SharedModule } from '../../../shared/shared.module'; | ||
import { LogsComponent } from './logs.component'; | ||
|
||
describe('LogsComponent', () => { | ||
let component: LogsComponent; | ||
let fixture: ComponentFixture<LogsComponent>; | ||
|
||
configureTestBed({ | ||
imports: [HttpClientTestingModule, TabsModule.forRoot(), SharedModule], | ||
declarations: [LogsComponent] | ||
}); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(LogsComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
32 changes: 32 additions & 0 deletions
32
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/logs/logs.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { Component, OnDestroy, OnInit } from '@angular/core'; | ||
|
||
import { DashboardService } from '../../../shared/api/dashboard.service'; | ||
|
||
@Component({ | ||
selector: 'cd-logs', | ||
templateUrl: './logs.component.html', | ||
styleUrls: ['./logs.component.scss'] | ||
}) | ||
export class LogsComponent implements OnInit, OnDestroy { | ||
contentData: any; | ||
interval: number; | ||
|
||
constructor(private dashboardService: DashboardService) {} | ||
|
||
ngOnInit() { | ||
this.getInfo(); | ||
this.interval = window.setInterval(() => { | ||
this.getInfo(); | ||
}, 5000); | ||
} | ||
|
||
ngOnDestroy() { | ||
clearInterval(this.interval); | ||
} | ||
|
||
getInfo() { | ||
this.dashboardService.getHealth().subscribe((data: any) => { | ||
this.contentData = data; | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters