All files / src/app/shared/components/refresh-selector refresh-selector.component.ts

92.31% Statements 12/13
66.67% Branches 4/6
75% Functions 3/4
90.91% Lines 10/11

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 3397x   97x             97x   1x                 1x   1x   97x 1x     97x     97x  
import { Component, OnInit } from '@angular/core';
 
import { RefreshIntervalService } from '../../services/refresh-interval.service';
 
@Component({
  selector: 'cd-refresh-selector',
  template: require('./refresh-selector.component.html'),
  styles: []
})
export class RefreshSelectorComponent implements OnInit {
  selectedInterval: number;
  intervalList: { [key: string]: number } = {
    '5 s': 5000,
    '10 s': 10000,
    '15 s': 15000,
    '30 s': 30000,
    '1 min': 60000,
    '3 min': 180000,
    '5 min': 300000
  };
  intervalKeys = Object.keys(this.intervalList);
 
  constructor(private refreshIntervalService: RefreshIntervalService) {}
 
  ngOnInit() {
    this.selectedInterval = this.refreshIntervalService.getRefreshInterval() || 5000;
  }
 
  changeRefreshInterval(interval: number) {
    this.refreshIntervalService.setRefreshInterval(interval);
  }
}