Split difficult adjustment table - Update indexing progress every 60sec

This commit is contained in:
nymkappa
2022-03-09 21:21:44 +01:00
parent 18f3018170
commit 609bb15b77
9 changed files with 171 additions and 82 deletions

View File

@@ -1,7 +1,7 @@
import { ChangeDetectionStrategy, Component, Inject, Input, LOCALE_ID, OnInit } from '@angular/core';
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Inject, Input, LOCALE_ID, OnInit } from '@angular/core';
import { EChartsOption } from 'echarts';
import { Observable } from 'rxjs';
import { map, share, startWith, switchMap, tap } from 'rxjs/operators';
import { delay, map, retryWhen, share, startWith, switchMap, tap } from 'rxjs/operators';
import { ApiService } from 'src/app/services/api.service';
import { SeoService } from 'src/app/services/seo.service';
import { FormBuilder, FormGroup } from '@angular/forms';
@@ -22,7 +22,7 @@ import { poolsColor } from 'src/app/app.constants';
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class HashrateChartPoolsComponent implements OnInit {
@Input() widget: boolean = false;
@Input() widget = false;
@Input() right: number | string = 40;
@Input() left: number | string = 25;
@@ -43,6 +43,7 @@ export class HashrateChartPoolsComponent implements OnInit {
private seoService: SeoService,
private apiService: ApiService,
private formBuilder: FormBuilder,
private cd: ChangeDetectorRef,
) {
this.radioGroupForm = this.formBuilder.group({ dateSpan: '1y' });
this.radioGroupForm.controls.dateSpan.setValue('1y');
@@ -109,6 +110,11 @@ export class HashrateChartPoolsComponent implements OnInit {
timestamp: data.oldestIndexedBlockTimestamp,
});
this.isLoading = false;
if (series.length === 0) {
this.cd.markForCheck();
throw new Error();
}
}),
map((data: any) => {
const availableTimespanDay = (
@@ -118,6 +124,9 @@ export class HashrateChartPoolsComponent implements OnInit {
availableTimespanDay: availableTimespanDay,
};
}),
retryWhen((errors) => errors.pipe(
delay(60000)
))
);
}),
share()
@@ -133,8 +142,8 @@ export class HashrateChartPoolsComponent implements OnInit {
const yyyy = lastBlock.getFullYear();
title = {
textStyle: {
color: 'grey',
fontSize: 15
color: 'grey',
fontSize: 15
},
text: `Indexing in progess - ${yyyy}-${mm}-${dd}`,
left: 'center',