import { I18n } from '@ngx-translate/i18n-polyfill';
import { Icons } from '../../../shared/enum/icons.enum';
-import { CephReleaseNamePipe } from '../../../shared/pipes/ceph-release-name.pipe';
-import { SummaryService } from '../../../shared/services/summary.service';
import { SettingsService } from '../../api/settings.service';
@Component({
@Input()
uid: string;
- docsUrl: string;
-
constructor(
- private summaryService: SummaryService,
private sanitizer: DomSanitizer,
private settingsService: SettingsService,
- private cephReleaseNamePipe: CephReleaseNamePipe,
private i18n: I18n
) {
this.grafanaTimes = [
name: this.i18n('Yesterday'),
value: 'from=now-1d%2Fd&to=now-1d%2Fd'
},
- {
- name: this.i18n('Today'),
- value: 'from=now%2Fd&to=now%2Fd'
- },
{
name: this.i18n('Today so far'),
value: 'from=now%2Fd&to=now'
name: this.i18n('Previous week'),
value: 'from=now-1w%2Fw&to=now-1w%2Fw'
},
- {
- name: this.i18n('This week'),
- value: 'from=now%2Fw&to=now%2Fw'
- },
{
name: this.i18n('This week so far'),
value: 'from=now%2Fw&to=now'
name: this.i18n('Previous month'),
value: 'from=now-1M%2FM&to=now-1M%2FM'
},
- {
- name: this.i18n('This month'),
- value: 'from=now%2FM&to=now%2FM'
- },
{
name: this.i18n('This month so far'),
value: 'from=now%2FM&to=now'
name: this.i18n('Previous year'),
value: 'from=now-1y%2Fy&to=now-1y%2Fy'
},
- {
- name: this.i18n('This year'),
- value: 'from=now%2Fy&to=now%2Fy'
- },
{
name: this.i18n('This year so far'),
value: 'from=now%2Fy&to=now'
three: 'grafana_three'
};
- const subs = this.summaryService.subscribe((summary: any) => {
- if (!summary) {
- return;
- }
-
- const releaseName = this.cephReleaseNamePipe.transform(summary.version);
- this.docsUrl =
- `http://docs.ceph.com/docs/${releaseName}/mgr/dashboard/` +
- `#enabling-the-embedding-of-grafana-dashboards`;
-
- setTimeout(() => {
- subs.unsubscribe();
- }, 0);
- });
this.settingsService.ifSettingConfigured('api/grafana/url', (url) => {
this.grafanaExist = true;
this.loading = false;