]> git.apps.os.sepia.ceph.com Git - ceph.git/blob
366522c3883269ba2ea0e524020a43ad629d57f4
[ceph.git] /
1 import { Component, OnInit, ViewChild } from '@angular/core';
2
3 import { BsModalRef, BsModalService } from 'ngx-bootstrap/modal';
4
5 import { CephReleaseNamePipe } from '../../../shared/pipes/ceph-release-name.pipe';
6 import { SummaryService } from '../../../shared/services/summary.service';
7 import { AboutComponent } from '../about/about.component';
8
9 @Component({
10   selector: 'cd-dashboard-help',
11   templateUrl: './dashboard-help.component.html',
12   styleUrls: ['./dashboard-help.component.scss']
13 })
14 export class DashboardHelpComponent implements OnInit {
15   @ViewChild('docsForm')
16   docsFormElement;
17   docsUrl: string;
18   modalRef: BsModalRef;
19
20   constructor(
21     private summaryService: SummaryService,
22     private cephReleaseNamePipe: CephReleaseNamePipe,
23     private modalService: BsModalService
24   ) {}
25
26   ngOnInit() {
27     const subs = this.summaryService.subscribe((summary: any) => {
28       if (!summary) {
29         return;
30       }
31
32       const releaseName = this.cephReleaseNamePipe.transform(summary.version);
33       this.docsUrl = `http://docs.ceph.com/docs/${releaseName}/mgr/dashboard/`;
34
35       setTimeout(() => {
36         subs.unsubscribe();
37       }, 0);
38     });
39   }
40
41   openAboutModal() {
42     this.modalRef = this.modalService.show(AboutComponent);
43   }
44
45   goToApiDocs() {
46     this.docsFormElement.nativeElement.submit();
47   }
48 }