Merge branch 'master' into natsoni/search-results-ordering

This commit is contained in:
softsimon 2024-05-31 22:18:43 +07:00 committed by GitHub
commit 1c73dc59f9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 119 additions and 65 deletions

View File

@ -18,7 +18,7 @@
"crypto-js": "~4.2.0", "crypto-js": "~4.2.0",
"express": "~4.19.2", "express": "~4.19.2",
"maxmind": "~4.3.11", "maxmind": "~4.3.11",
"mysql2": "~3.9.7", "mysql2": "~3.10.0",
"redis": "^4.6.6", "redis": "^4.6.6",
"rust-gbt": "file:./rust-gbt", "rust-gbt": "file:./rust-gbt",
"socks-proxy-agent": "~7.0.0", "socks-proxy-agent": "~7.0.0",
@ -6197,9 +6197,9 @@
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
}, },
"node_modules/mysql2": { "node_modules/mysql2": {
"version": "3.9.7", "version": "3.10.0",
"resolved": "https://registry.npmjs.org/mysql2/-/mysql2-3.9.7.tgz", "resolved": "https://registry.npmjs.org/mysql2/-/mysql2-3.10.0.tgz",
"integrity": "sha512-KnJT8vYRcNAZv73uf9zpXqNbvBG7DJrs+1nACsjZP1HMJ1TgXEy8wnNilXAn/5i57JizXKtrUtwDB7HxT9DDpw==", "integrity": "sha512-qx0mfWYt1DpTPkw8mAcHW/OwqqyNqBLBHvY5IjN8+icIYTjt6znrgYJ+gxqNNRpVknb5Wc/gcCM4XjbCR0j5tw==",
"dependencies": { "dependencies": {
"denque": "^2.1.0", "denque": "^2.1.0",
"generate-function": "^2.3.1", "generate-function": "^2.3.1",
@ -12382,9 +12382,9 @@
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
}, },
"mysql2": { "mysql2": {
"version": "3.9.7", "version": "3.10.0",
"resolved": "https://registry.npmjs.org/mysql2/-/mysql2-3.9.7.tgz", "resolved": "https://registry.npmjs.org/mysql2/-/mysql2-3.10.0.tgz",
"integrity": "sha512-KnJT8vYRcNAZv73uf9zpXqNbvBG7DJrs+1nACsjZP1HMJ1TgXEy8wnNilXAn/5i57JizXKtrUtwDB7HxT9DDpw==", "integrity": "sha512-qx0mfWYt1DpTPkw8mAcHW/OwqqyNqBLBHvY5IjN8+icIYTjt6znrgYJ+gxqNNRpVknb5Wc/gcCM4XjbCR0j5tw==",
"requires": { "requires": {
"denque": "^2.1.0", "denque": "^2.1.0",
"generate-function": "^2.3.1", "generate-function": "^2.3.1",

View File

@ -47,7 +47,7 @@
"crypto-js": "~4.2.0", "crypto-js": "~4.2.0",
"express": "~4.19.2", "express": "~4.19.2",
"maxmind": "~4.3.11", "maxmind": "~4.3.11",
"mysql2": "~3.9.7", "mysql2": "~3.10.0",
"rust-gbt": "file:./rust-gbt", "rust-gbt": "file:./rust-gbt",
"redis": "^4.6.6", "redis": "^4.6.6",
"socks-proxy-agent": "~7.0.0", "socks-proxy-agent": "~7.0.0",

View File

@ -1,8 +1,8 @@
<table> <table>
<tbody> <tbody>
<tr> <tr>
<td class="td-width" i18n="transaction.accelerated-to-feerate|Accelerated to feerate">Accelerated to</td> <td class="td-width field-label" i18n="transaction.accelerated-to-feerate|Accelerated to feerate">Accelerated to</td>
<td> <td class="field-value">
<div class="effective-fee-container"> <div class="effective-fee-container">
@if (accelerationInfo?.acceleratedFeeRate && (!tx.effectiveFeePerVsize || accelerationInfo.acceleratedFeeRate >= tx.effectiveFeePerVsize)) { @if (accelerationInfo?.acceleratedFeeRate && (!tx.effectiveFeePerVsize || accelerationInfo.acceleratedFeeRate >= tx.effectiveFeePerVsize)) {
<app-fee-rate [fee]="accelerationInfo.acceleratedFeeRate"></app-fee-rate> <app-fee-rate [fee]="accelerationInfo.acceleratedFeeRate"></app-fee-rate>
@ -11,24 +11,30 @@
} }
</div> </div>
</td> </td>
<td rowspan="2" *ngIf="tx && (tx.acceleratedBy || accelerationInfo) && miningStats" class="text-right" style="width: 100%;"> <td class="pie-chart" rowspan="2">
<div class="chart-container" style="width: 100px; margin-left:auto;"> <div class="chart-container">
<div @if (tx && (tx.acceleratedBy || accelerationInfo) && miningStats) {
echarts <div
*browserOnly echarts
class="chart" *browserOnly
[initOpts]="chartInitOptions" class="chart"
[options]="chartOptions" [initOpts]="chartInitOptions"
style="height: 72px" [options]="chartOptions"
(chartInit)="onChartInit($event)" style="height: 72px; width: 72px;"
></div> (chartInit)="onChartInit($event)"
></div>
} @else {
<div class="chart-loading">
<div class="spinner-border text-light"></div>
</div>
}
</div> </div>
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="td-width" i18n="transaction.accelerated-by-hashrate|Accelerated to hashrate">Accelerated by</td> <td class="td-width field-label" i18n="transaction.accelerated-by-hashrate|Accelerated to hashrate">Accelerated by</td>
<td *ngIf="acceleratedByPercentage"> <td class="field-value" *ngIf="acceleratedByPercentage">
{{ acceleratedByPercentage }} <span class="symbol">of hashrate</span> {{ acceleratedByPercentage }} <span class="symbol hashrate-label">of hashrate</span>
</td> </td>
</tr> </tr>
</tbody> </tbody>

View File

@ -1,9 +1,50 @@
.td-width { .td-width {
width: 150px; width: 150px;
min-width: 150px; min-width: 150px;
@media (max-width: 768px) { @media (max-width: 768px) {
width: 175px; width: 175px;
min-width: 175px; min-width: 175px;
} }
}
.field-label {
@media (max-width: 849px) {
text-align: left;
}
@media (max-width: 649px) {
width: auto;
min-width: auto;
}
}
.field-value {
@media (max-width: 849px) {
width: 100%;
}
.hashrate-label {
@media (max-width: 420px) {
display: none;
}
}
}
.pie-chart {
width: 100%;
vertical-align: middle;
text-align: center;
.chart-container {
width: 72px;
height: 100%;
margin-left: auto;
}
@media (max-width: 850px) {
width: 150px;
}
@media (max-width: 420px) {
padding-left: 0;
}
} }

View File

@ -83,7 +83,7 @@ export class ActiveAccelerationBox implements OnChanges {
this.acceleratedByPercentage = ((totalAcceleratedHashrate / parseFloat(this.miningStats.lastEstimatedHashrate)) * 100).toFixed(1) + '%'; this.acceleratedByPercentage = ((totalAcceleratedHashrate / parseFloat(this.miningStats.lastEstimatedHashrate)) * 100).toFixed(1) + '%';
data.push(getDataItem( data.push(getDataItem(
totalAcceleratedHashrate, totalAcceleratedHashrate,
'var(--tertiary)', 'var(--mainnet-alt)',
`${this.acceleratedByPercentage} accelerating`, `${this.acceleratedByPercentage} accelerating`,
) as PieSeriesOption); ) as PieSeriesOption);
const notAcceleratedByPercentage = ((1 - (totalAcceleratedHashrate / parseFloat(this.miningStats.lastEstimatedHashrate))) * 100).toFixed(1) + '%'; const notAcceleratedByPercentage = ((1 - (totalAcceleratedHashrate / parseFloat(this.miningStats.lastEstimatedHashrate))) * 100).toFixed(1) + '%';

View File

@ -71,7 +71,7 @@
color: var(--fg); color: var(--fg);
font-size: 0.8rem; font-size: 0.8rem;
position: absolute; position: absolute;
bottom: 15.8em; bottom: 16.1em;
left: 1px; left: 1px;
transform: translateX(-50%) rotate(90deg); transform: translateX(-50%) rotate(90deg);
background: none; background: none;

View File

@ -1,7 +1,7 @@
import { ChangeDetectionStrategy, Component, Inject, Input, LOCALE_ID, OnInit } from '@angular/core'; import { ChangeDetectionStrategy, Component, Inject, Input, LOCALE_ID, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute } from '@angular/router';
import { echarts, EChartsOption } from '../../graphs/echarts'; import { echarts, EChartsOption } from '../../graphs/echarts';
import { BehaviorSubject, Observable, combineLatest, of, timer } from 'rxjs'; import { BehaviorSubject, Observable, Subscription, combineLatest, of } from 'rxjs';
import { catchError, distinctUntilChanged, filter, map, share, switchMap, tap } from 'rxjs/operators'; import { catchError, distinctUntilChanged, filter, map, share, switchMap, tap } from 'rxjs/operators';
import { BlockExtended, PoolStat } from '../../interfaces/node-api.interface'; import { BlockExtended, PoolStat } from '../../interfaces/node-api.interface';
import { ApiService } from '../../services/api.service'; import { ApiService } from '../../services/api.service';
@ -28,6 +28,7 @@ export class PoolComponent implements OnInit {
gfg = true; gfg = true;
formatNumber = formatNumber; formatNumber = formatNumber;
slugSubscription: Subscription;
poolStats$: Observable<PoolStat>; poolStats$: Observable<PoolStat>;
blocks$: Observable<BlockExtended[]>; blocks$: Observable<BlockExtended[]>;
oobFees$: Observable<AccelerationTotal[]>; oobFees$: Observable<AccelerationTotal[]>;
@ -56,38 +57,24 @@ export class PoolComponent implements OnInit {
} }
ngOnInit(): void { ngOnInit(): void {
this.poolStats$ = this.route.params.pipe(map((params) => params.slug)) this.slugSubscription = this.route.params.pipe(map((params) => params.slug)).subscribe((slug) => {
this.isLoading = true;
this.blocks = [];
this.chartOptions = {};
this.slug = slug;
this.initializeObservables();
});
}
initializeObservables(): void {
this.poolStats$ = this.apiService.getPoolHashrate$(this.slug)
.pipe( .pipe(
switchMap((slug: any) => { switchMap((data) => {
this.isLoading = true; this.isLoading = false;
this.slug = slug; const hashrate = data.map(val => [val.timestamp * 1000, val.avgHashrate]);
return this.apiService.getPoolHashrate$(this.slug) const share = data.map(val => [val.timestamp * 1000, val.share * 100]);
.pipe( this.prepareChartOptions(hashrate, share);
switchMap((data) => { return this.apiService.getPoolStats$(this.slug);
this.isLoading = false;
const hashrate = data.map(val => [val.timestamp * 1000, val.avgHashrate]);
const share = data.map(val => [val.timestamp * 1000, val.share * 100]);
this.prepareChartOptions(hashrate, share);
return [slug];
}),
catchError(() => {
this.isLoading = false;
this.seoService.logSoft404();
return of([slug]);
})
);
}),
switchMap((slug) => {
return this.apiService.getPoolStats$(slug).pipe(
catchError(() => {
this.isLoading = false;
this.seoService.logSoft404();
return of(null);
})
);
}),
tap(() => {
this.loadMoreSubject.next(this.blocks[0]?.height);
}), }),
map((poolStats) => { map((poolStats) => {
this.seoService.setTitle(poolStats.pool.name); this.seoService.setTitle(poolStats.pool.name);
@ -101,7 +88,12 @@ export class PoolComponent implements OnInit {
return Object.assign({ return Object.assign({
logo: `/resources/mining-pools/` + poolStats.pool.slug + '.svg' logo: `/resources/mining-pools/` + poolStats.pool.slug + '.svg'
}, poolStats); }, poolStats);
}) }),
catchError(() => {
this.isLoading = false;
this.seoService.logSoft404();
return of(null);
}),
); );
this.blocks$ = this.loadMoreSubject this.blocks$ = this.loadMoreSubject
@ -328,4 +320,8 @@ export class PoolComponent implements OnInit {
trackByBlock(index: number, block: BlockExtended) { trackByBlock(index: number, block: BlockExtended) {
return block.height; return block.height;
} }
ngOnDestroy(): void {
this.slugSubscription.unsubscribe();
}
} }

View File

@ -380,7 +380,12 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
this.txInBlockIndex = this.mempoolPosition.block; this.txInBlockIndex = this.mempoolPosition.block;
if (txPosition.cpfp !== undefined) { if (txPosition.cpfp !== undefined) {
if (txPosition.position.acceleratedBy) {
txPosition.cpfp.acceleratedBy = txPosition.position.acceleratedBy;
}
this.setCpfpInfo(txPosition.cpfp); this.setCpfpInfo(txPosition.cpfp);
} else if ((this.tx?.acceleration && txPosition.position.acceleratedBy)) {
this.tx.acceleratedBy = txPosition.position.acceleratedBy;
} }
} }
} else { } else {

View File

@ -80,6 +80,12 @@ export class GroupComponent implements OnInit {
}; };
} }
} }
nodes.map((node) => {
node.channels = node.opened_channel_count;
return node;
});
const sumLiquidity = nodes.reduce((partialSum, a) => partialSum + parseInt(a.capacity, 10), 0); const sumLiquidity = nodes.reduce((partialSum, a) => partialSum + parseInt(a.capacity, 10), 0);
const sumChannels = nodes.reduce((partialSum, a) => partialSum + a.opened_channel_count, 0); const sumChannels = nodes.reduce((partialSum, a) => partialSum + a.opened_channel_count, 0);