]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Adds dynamic documentation link 23666/head
authorKanika Murarka <kmurarka@redhat.com>
Mon, 8 Oct 2018 09:29:31 +0000 (14:59 +0530)
committerKanika Murarka <kmurarka@redhat.com>
Mon, 8 Oct 2018 11:30:45 +0000 (17:00 +0530)
Fixes: https://tracker.ceph.com/issues/24999
Signed-off-by: Kanika Murarka <kmurarka@redhat.com>
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-list/pool-list.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-daemon-list/rgw-daemon-list.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/components/grafana/grafana.component.html
src/pybind/mgr/dashboard/frontend/src/app/shared/components/grafana/grafana.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/components/grafana/grafana.component.ts

index 30dba9a77beb2ddeeaedd905b299b1c5e31ceebc..b073f2ee9f5793cb0066dcd93fc013c12e8cc84b 100644 (file)
@@ -1,6 +1,7 @@
 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';
 
@@ -35,7 +36,8 @@ describe('OsdListComponent', () => {
       TabsModule.forRoot(),
       DataTableModule,
       ComponentsModule,
-      SharedModule
+      SharedModule,
+      RouterTestingModule
     ],
     declarations: [OsdListComponent, OsdDetailsComponent, OsdPerformanceHistogramComponent],
     providers: [
index 27db3d0d965294f9ef2a3dba8cd34ebbdb65cbe5..4eae55d21cf6a13d76361a31850b3b768b88a9f1 100644 (file)
@@ -1,5 +1,6 @@
 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';
 
@@ -13,7 +14,7 @@ describe('PoolListComponent', () => {
 
   configureTestBed({
     declarations: [PoolListComponent],
-    imports: [SharedModule, TabsModule.forRoot(), HttpClientTestingModule]
+    imports: [SharedModule, TabsModule.forRoot(), HttpClientTestingModule, RouterTestingModule]
   });
 
   beforeEach(() => {
index 34ca733aa12d6525a1444788ec4788c6184c7a11..5f4422c67492c50eb0bad89e505a290b1c6b8719 100644 (file)
@@ -1,5 +1,6 @@
 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';
 
@@ -15,7 +16,13 @@ describe('RgwDaemonListComponent', () => {
 
   configureTestBed({
     declarations: [RgwDaemonListComponent, RgwDaemonDetailsComponent],
-    imports: [HttpClientModule, TabsModule.forRoot(), PerformanceCounterModule, SharedModule]
+    imports: [
+      HttpClientModule,
+      TabsModule.forRoot(),
+      PerformanceCounterModule,
+      SharedModule,
+      RouterTestingModule
+    ]
   });
 
   beforeEach(() => {
index 34ff02c737a76c62c128b532adc8bee329c781eb..a96e4774645ec7e38bcf3e2c5698e961f1501edf 100644 (file)
@@ -5,7 +5,10 @@
 </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">
index 18ac00823a5987e9cc999485d92bc3d89986c0ec..0a77ece38f9d65bfb81c814a917c337de352180f 100644 (file)
@@ -1,11 +1,14 @@
 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';
@@ -16,8 +19,8 @@ describe('GrafanaComponent', () => {
 
   configureTestBed({
     declarations: [GrafanaComponent, InfoPanelComponent, LoadingPanelComponent],
-    imports: [AlertModule.forRoot(), HttpClientModule],
-    providers: [SettingsService]
+    imports: [AlertModule.forRoot(), HttpClientModule, RouterTestingModule],
+    providers: [CephReleaseNamePipe, SettingsService, SummaryService]
   });
 
   beforeEach(() => {
index d71c3780dac8873e88b2606e4f3fae08837717ce..47b80a08a02ba6141c9b19790464eb1cbdd66d52 100644 (file)
@@ -4,6 +4,8 @@ import { DomSanitizer } from '@angular/platform-browser';
 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',
@@ -31,8 +33,14 @@ export class GrafanaComponent implements OnInit, OnChanges {
   @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 = {
@@ -40,6 +48,20 @@ export class GrafanaComponent implements OnInit, OnChanges {
       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 === '') {