Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mgr/dashboard: Added new logs component
Added new Logs component and created a cluster->logs menu item. Moved the logs from the dashboard home page to the dedicated logs page. Fixes: https://tracker.ceph.com/issues/24571 Signed-off-by: Diksha Godbole <diksha.godbole@gmail.com>
- Loading branch information
1 parent
7e1fa53
commit d41fd96
Showing
7 changed files
with
117 additions
and
2 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
41 changes: 41 additions & 0 deletions
41
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,41 @@ | ||
<div *ngIf="contentData"> | ||
<div class="row"> | ||
<div class="col-md-12"> | ||
<!-- LOGS --> | ||
<div class="well" | ||
*ngIf="contentData.clog || contentData.audit_log"> | ||
<fieldset> | ||
<legend i18n>Logs</legend> | ||
<tabset> | ||
<tab heading="Cluster log" | ||
class="text-monospace" | ||
*ngIf="contentData.clog" | ||
i18n-heading> | ||
<span *ngFor="let line of contentData.clog"> | ||
{{ line.stamp }} {{ line.priority }} | ||
<span [ngStyle]="line"> | ||
{{ line.message }} | ||
<br> | ||
</span> | ||
</span> | ||
</tab> | ||
<tab heading="Audit log" | ||
class="text-monospace" | ||
*ngIf="contentData.audit_log" | ||
i18n-heading> | ||
<span *ngFor="let line of contentData.audit_log"> | ||
{{ line.stamp }} {{ line.priority }} | ||
<span [ngStyle]="line"> | ||
<span style="font-weight: bold;"> | ||
{{ line.message }} | ||
</span> | ||
<br> | ||
</span> | ||
</span> | ||
</tab> | ||
</tabset> | ||
</fieldset> | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
Empty file.
24 changes: 24 additions & 0 deletions
24
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,24 @@ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { LogsComponent } from './logs.component'; | ||
|
||
describe('LogsComponent', () => { | ||
let component: LogsComponent; | ||
let fixture: ComponentFixture<LogsComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [LogsComponent] | ||
}).compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(LogsComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
34 changes: 34 additions & 0 deletions
34
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,34 @@ | ||
import { Component, OnDestroy, OnInit } from '@angular/core'; | ||
|
||
import * as _ from 'lodash'; | ||
|
||
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