Add capacity per AS

This commit is contained in:
nymkappa
2022-07-16 11:32:48 +02:00
parent 6bbda1e86c
commit ac4ef502c1
3 changed files with 19 additions and 10 deletions

View File

@@ -21,18 +21,20 @@
<table class="table table-borderless text-center">
<thead>
<tr>
<th class="d-none d-md-block" i18n="mining.rank">Rank</th>
<th class="" i18n="lightning.as-name">Name</th>
<th class="" i18n="lightning.share">Hashrate</th>
<th class="" i18n="lightning.nodes">Nodes</th>
<th *ngIf="!isMobile()" i18n="mining.rank">Rank</th>
<th i18n="lightning.as-name">Name</th>
<th *ngIf="!isMobile()" i18n="lightning.share">Share</th>
<th i18n="lightning.nodes">Nodes</th>
<th i18n="lightning.capacity">Capacity</th>
</tr>
</thead>
<tbody [attr.data-cy]="'pools-table'" *ngIf="(nodesPerAsObservable$ | async) as asList">
<tr *ngFor="let asEntry of asList">
<td class="d-none d-md-block">{{ asEntry.rank }}</td>
<td *ngIf="!isMobile()">{{ asEntry.rank }}</td>
<td class="text-truncate" style="max-width: 100px">{{ asEntry.name }}</td>
<td class="">{{ asEntry.share }}%</td>
<td class="">{{ asEntry.count }}</td>
<td *ngIf="!isMobile()">{{ asEntry.share }}%</td>
<td>{{ asEntry.count }}</td>
<td><app-amount [satoshis]="asEntry.capacity" [digitsInfo]="'1.2-2'" [noFiat]="true"></app-amount></td>
</tr>
</tbody>
</table>

View File

@@ -5,6 +5,7 @@ import { chartColors } from 'src/app/app.constants';
import { ApiService } from 'src/app/services/api.service';
import { SeoService } from 'src/app/services/seo.service';
import { download } from 'src/app/shared/graphs.utils';
import { AmountShortenerPipe } from 'src/app/shared/pipes/amount-shortener.pipe';
@Component({
selector: 'app-nodes-per-as-chart',
@@ -30,6 +31,7 @@ export class NodesPerAsChartComponent implements OnInit {
constructor(
private apiService: ApiService,
private seoService: SeoService,
private amountShortenerPipe: AmountShortenerPipe
) {
}
@@ -89,7 +91,9 @@ export class NodesPerAsChartComponent implements OnInit {
borderColor: '#000',
formatter: () => {
return `<b style="color: white">${as.name} (${as.share}%)</b><br>` +
$localize`${as.count.toString()} nodes`;
$localize`${as.count.toString()} nodes<br>` +
$localize`${this.amountShortenerPipe.transform(as.capacity / 100000000, 2)} BTC capacity`
;
}
},
data: as.slug,