Create indexing sticky notification that show indexing progress in all mining dashboard related pages
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
<div *ngIf="this.indexingProgress$ | async as progress" class="sticky-loading">
|
||||
<span *ngIf="progress >= 0" class="mr-auto badge badge-pill badge-warning">Indexing blocks ({{ progress }}%)</span>
|
||||
</div>
|
||||
@@ -0,0 +1,14 @@
|
||||
.sticky-loading {
|
||||
position: fixed;
|
||||
right: 10px;
|
||||
z-index: 100;
|
||||
@media (width > 991px) {
|
||||
bottom: 15px;
|
||||
}
|
||||
@media (576px <= width <= 991px) {
|
||||
bottom: 60px;
|
||||
}
|
||||
@media (width <= 575px) {
|
||||
top: 17px;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { StateService } from 'src/app/services/state.service';
|
||||
import { WebsocketService } from 'src/app/services/websocket.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-loading-indicator',
|
||||
templateUrl: './loading-indicator.component.html',
|
||||
styleUrls: ['./loading-indicator.component.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush
|
||||
})
|
||||
export class LoadingIndicatorComponent implements OnInit {
|
||||
@Input() name: string;
|
||||
|
||||
public indexingProgress$: Observable<number>;
|
||||
|
||||
constructor(
|
||||
private stateService: StateService,
|
||||
private websocketService: WebsocketService
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.indexingProgress$ = this.stateService.loadingIndicators$
|
||||
.pipe(
|
||||
map((indicators) => indicators[this.name] ?? -1)
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user