import { HttpClientModule } from '@angular/common/http';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
+import { RouterTestingModule } from '@angular/router/testing';
import { TabsModule } from 'ngx-bootstrap/tabs';
TabsModule.forRoot(),
DataTableModule,
ComponentsModule,
- SharedModule
+ SharedModule,
+ RouterTestingModule
],
declarations: [OsdListComponent, OsdDetailsComponent, OsdPerformanceHistogramComponent],
providers: [
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
+import { RouterTestingModule } from '@angular/router/testing';
import { TabsModule } from 'ngx-bootstrap/tabs/tabs.module';
configureTestBed({
declarations: [PoolListComponent],
- imports: [SharedModule, TabsModule.forRoot(), HttpClientTestingModule]
+ imports: [SharedModule, TabsModule.forRoot(), HttpClientTestingModule, RouterTestingModule]
});
beforeEach(() => {
import { HttpClientModule } from '@angular/common/http';
import { ComponentFixture, TestBed } from '@angular/core/testing';
+import { RouterTestingModule } from '@angular/router/testing';
import { TabsModule } from 'ngx-bootstrap/tabs';
configureTestBed({
declarations: [RgwDaemonListComponent, RgwDaemonDetailsComponent],
- imports: [HttpClientModule, TabsModule.forRoot(), PerformanceCounterModule, SharedModule]
+ imports: [
+ HttpClientModule,
+ TabsModule.forRoot(),
+ PerformanceCounterModule,
+ SharedModule,
+ RouterTestingModule
+ ]
});
beforeEach(() => {
</cd-loading-panel>
<cd-info-panel *ngIf="!grafanaExist">
<ng-container i18n>
- Please consult the <a href="http://docs.ceph.com/docs/luminous/mgr/dashboard/" target="_blank">documentation</a> on how to configure and enable the monitoring functionality.
+ Please consult the
+ <a href="{{ docsUrl }}"
+ target="_blank">documentation
+ </a> on how to configure and enable the monitoring functionality.
</ng-container>
</cd-info-panel>
<div class="row" *ngIf="grafanaExist">
import { HttpClientModule } from '@angular/common/http';
import { ComponentFixture, TestBed } from '@angular/core/testing';
+import { RouterTestingModule } from '@angular/router/testing';
import { AlertModule } from 'ngx-bootstrap';
import { configureTestBed } from '../../../../testing/unit-test-helper';
import { SettingsService } from '../../../shared/api/settings.service';
+import { SummaryService } from '../../../shared/services/summary.service';
+import { CephReleaseNamePipe } from '../../pipes/ceph-release-name.pipe';
import { InfoPanelComponent } from '../info-panel/info-panel.component';
import { LoadingPanelComponent } from '../loading-panel/loading-panel.component';
import { GrafanaComponent } from './grafana.component';
configureTestBed({
declarations: [GrafanaComponent, InfoPanelComponent, LoadingPanelComponent],
- imports: [AlertModule.forRoot(), HttpClientModule],
- providers: [SettingsService]
+ imports: [AlertModule.forRoot(), HttpClientModule, RouterTestingModule],
+ providers: [CephReleaseNamePipe, SettingsService, SummaryService]
});
beforeEach(() => {
import { SafeUrl } from '@angular/platform-browser';
import { SettingsService } from '../../../shared/api/settings.service';
+import { CephReleaseNamePipe } from '../../../shared/pipes/ceph-release-name.pipe';
+import { SummaryService } from '../../../shared/services/summary.service';
@Component({
selector: 'cd-grafana',
@Input()
grafanaStyle: string;
grafanaUrl: any;
+ docsUrl: string;
- constructor(private sanitizer: DomSanitizer, private settingsService: SettingsService) {}
+ constructor(
+ private summaryService: SummaryService,
+ private sanitizer: DomSanitizer,
+ private settingsService: SettingsService,
+ private cephReleaseNamePipe: CephReleaseNamePipe
+ ) {}
ngOnInit() {
this.styles = {
two: 'grafana_two',
three: 'grafana_three'
};
+
+ const subs = this.summaryService.subscribe((summary: any) => {
+ if (!summary) {
+ return;
+ }
+
+ const releaseName = this.cephReleaseNamePipe.transform(summary.version);
+ this.docsUrl = `http://docs.ceph.com/docs/${releaseName}/mgr/dashboard/`;
+
+ setTimeout(() => {
+ subs.unsubscribe();
+ }, 0);
+ });
+
this.settingsService.getGrafanaApiUrl().subscribe((data: any) => {
this.grafanaUrl = data.value;
if (this.grafanaUrl === '') {