All files / src/app/ceph/nfs/nfs-501 nfs-501.component.ts

81.48% Statements 22/27
72.22% Branches 13/18
71.43% Functions 5/7
79.17% Lines 19/24

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 516x 6x   6x   6x 6x             6x   1x       1x 1x 1x 1x     6x 1x 1x 1x                         1x 1x       6x     6x  
import { Component, OnDestroy, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
 
import { I18n } from '@ngx-translate/i18n-polyfill';
 
import { CephReleaseNamePipe } from '../../../shared/pipes/ceph-release-name.pipe';
import { SummaryService } from '../../../shared/services/summary.service';
 
@Component({
  selector: 'cd-nfs-501',
  template: require('./nfs-501.component.html'),
  styles: []
})
export class Nfs501Component implements OnInit, OnDestroy {
  docsUrl: string;
  message = this.i18n('The NFS Ganesha service is not configured.');
  routeParamsSubscribe: any;
 
  constructor(
    private route: ActivatedRoute,
    private summaryService: SummaryService,
    private cephReleaseNamePipe: CephReleaseNamePipe,
    private i18n: I18n
  ) {}
 
  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/` +
        `#configuring-nfs-ganesha-in-the-dashboard`;
 
      setTimeout(() => {
        subs.unsubscribe();
      }, 0);
    });
 
    this.routeParamsSubscribe = this.route.params.subscribe((params: { message: string }) => {
      this.message = params.message;
    });
  }
 
  ngOnDestroy() {
    this.routeParamsSubscribe.unsubscribe();
  }
}