# All files / src/app/core/navigation/navigation navigation.component.ts

85.19% Statements 23/27
64.71% Branches 11/17
60% Functions 3/5
86.96% Lines 20/23

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
    53
    54
    554x

    4x

    4x
    4x

    4x

    4x

    1x
    1x

    1x
    1x
    1x
    1x

    1x
    1x

    4x
    1x

    1x

    1x

    4x

    4x
     import { Component, OnInit } from '@angular/core';

    import { PrometheusService } from '../../../shared/api/prometheus.service';
    import { Permissions } from '../../../shared/models/permissions';
    import { AuthStorageService } from '../../../shared/services/auth-storage.service';
    import {
      FeatureTogglesMap$,
      FeatureTogglesService
    } from '../../../shared/services/feature-toggles.service';
    import { SummaryService } from '../../../shared/services/summary.service';

    @Component({
      selector: 'cd-navigation',
      template: require('./navigation.component.html'),
      styles: []
    })
    export class NavigationComponent implements OnInit {
      permissions: Permissions;
      summaryData: any;

      isCollapsed = true;
      prometheusConfigured = false;
      enabledFeature$: FeatureTogglesMap$;

      constructor(
        private authStorageService: AuthStorageService,
        private prometheusService: PrometheusService,
        private summaryService: SummaryService,
        private featureToggles: FeatureTogglesService
      ) {
        this.permissions = this.authStorageService.getPermissions();
        this.enabledFeature$ = this.featureToggles.get();
      }

      ngOnInit() {
        this.summaryService.subscribe((data: any) => {
          if (!data) {
            return;
          }
          this.summaryData = data;
        });
        this.prometheusService.ifAlertmanagerConfigured(() => (this.prometheusConfigured = true));
      }

      blockHealthColor() {
        if (this.summaryData && this.summaryData.rbd_mirroring) {
          if (this.summaryData.rbd_mirroring.errors > 0) {
            return { color: '#d9534f' };
          } else if (this.summaryData.rbd_mirroring.warnings > 0) {
            return { color: '#f0ad4e' };
          }
        }
      }
    }