All files / src/app/core/navigation/dashboard-help dashboard-help.component.ts

73.33% Statements 22/30
72.22% Branches 13/18
57.14% Functions 4/7
70.37% Lines 19/27

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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