2022-05-01 03:01:27 +04:00
|
|
|
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
|
2022-04-29 03:57:27 +04:00
|
|
|
import { ActivatedRoute, ParamMap } from '@angular/router';
|
|
|
|
import { Observable } from 'rxjs';
|
|
|
|
import { switchMap } from 'rxjs/operators';
|
|
|
|
import { LightningApiService } from '../lightning-api.service';
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'app-node',
|
|
|
|
templateUrl: './node.component.html',
|
2022-05-01 03:01:27 +04:00
|
|
|
styleUrls: ['./node.component.scss'],
|
|
|
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
2022-04-29 03:57:27 +04:00
|
|
|
})
|
|
|
|
export class NodeComponent implements OnInit {
|
|
|
|
node$: Observable<any>;
|
2022-05-05 23:19:24 +04:00
|
|
|
statistics$: Observable<any>;
|
2022-05-01 03:01:27 +04:00
|
|
|
publicKey$: Observable<string>;
|
2022-04-29 03:57:27 +04:00
|
|
|
|
|
|
|
constructor(
|
|
|
|
private lightningApiService: LightningApiService,
|
|
|
|
private activatedRoute: ActivatedRoute,
|
|
|
|
) { }
|
|
|
|
|
|
|
|
ngOnInit(): void {
|
|
|
|
this.node$ = this.activatedRoute.paramMap
|
|
|
|
.pipe(
|
|
|
|
switchMap((params: ParamMap) => {
|
2022-05-01 03:01:27 +04:00
|
|
|
return this.lightningApiService.getNode$(params.get('public_key'));
|
2022-04-29 03:57:27 +04:00
|
|
|
})
|
|
|
|
);
|
2022-05-05 23:19:24 +04:00
|
|
|
|
|
|
|
this.statistics$ = this.activatedRoute.paramMap
|
|
|
|
.pipe(
|
|
|
|
switchMap((params: ParamMap) => {
|
|
|
|
return this.lightningApiService.listNodeStats$(params.get('public_key'));
|
|
|
|
})
|
|
|
|
);
|
2022-04-29 03:57:27 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|