diff options
Diffstat (limited to 'src/pybind/mgr/dashboard/frontend/src/app/shared/components/refresh-selector/refresh-selector.component.ts')
-rw-r--r-- | src/pybind/mgr/dashboard/frontend/src/app/shared/components/refresh-selector/refresh-selector.component.ts | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/refresh-selector/refresh-selector.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/refresh-selector/refresh-selector.component.ts new file mode 100644 index 000000000..080890e26 --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/refresh-selector/refresh-selector.component.ts @@ -0,0 +1,32 @@ +import { Component, OnInit } from '@angular/core'; + +import { RefreshIntervalService } from '~/app/shared/services/refresh-interval.service'; + +@Component({ + selector: 'cd-refresh-selector', + templateUrl: './refresh-selector.component.html', + styleUrls: ['./refresh-selector.component.scss'] +}) +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); + } +} |