Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ <h4 class="mb-0">
{{ info.responseTime | number:'1.1-1' }} ms
</ng-container>
</div>
<div class="flex flex-nowrap" *ngIf="info.coinbaseOutputs.length > 0">
<div class="flex flex-nowrap" *ngIf="(info.coinbaseOutputs?.length ?? 0) > 0">
@let percentage = getPayoutPercentage(info);
<ng-container *ngIf="percentage >= 95">
<div class="col-fixed-width text-500">
Expand Down Expand Up @@ -474,15 +474,15 @@ <h4 class="white-space-nowrap overflow-hidden text-overflow-ellipsis">
{{ info.scriptsig }}
</div>
</div>
<div class="flex flex-nowrap justify-content-between" *ngIf="info.coinbaseOutputs.length > 0">
<div class="flex flex-nowrap justify-content-between" *ngIf="(info.coinbaseOutputs?.length ?? 0) > 0">
<div class="col-fixed-width text-500">
<tooltip-text-icon text="Value" tooltip="Total value of transaction outputs in BTC. For non-bitcoin chains, disable 'Decode Coinbase Tx' in Advanced Pool Options." />
</div>
<ng-container *ngIf="info.coinbaseValueTotalSatoshis && info.coinbaseValueTotalSatoshis > 0">
{{ info.coinbaseValueTotalSatoshis | sats }}
</ng-container>
</div>
<div class="flex flex-nowrap align-items-baseline" *ngIf="info.coinbaseOutputs.length > 0">
<div class="flex flex-nowrap align-items-baseline" *ngIf="(info.coinbaseOutputs?.length ?? 0) > 0">
<div class="col-fixed-width text-500">
<span>Outputs</span>
</div>
Expand All @@ -501,7 +501,7 @@ <h4 class="white-space-nowrap overflow-hidden text-overflow-ellipsis">
</div>
</div>
</div>
<div class="flex flex-nowrap align-items-baseline" *ngIf="info.coinbaseOutputs.length == 0">
<div class="flex flex-nowrap align-items-baseline" *ngIf="(info.coinbaseOutputs?.length ?? 0) == 0">
<div class="col-fixed-width text-500">
Amount
</div>
Expand Down Expand Up @@ -529,14 +529,14 @@ <h4 class="white-space-nowrap overflow-hidden text-overflow-ellipsis">Hashrate R
</tr>
</thead>
<tbody>
<tr class="cursor-pointer" *ngFor="let asic of info.hashrateMonitor.asics; let i = index"
<tr class="cursor-pointer" *ngFor="let asic of info.hashrateMonitor?.asics; let i = index; trackBy: trackByIndex"
[pTooltip]="(asicAmount > 1 ? 'ASIC ' + (i + 1) + ' - ' : '') + 'Error count: ' + asic.errorCount"
tooltipPosition="bottom">
<td *ngIf="asicAmount > 1" class="text-500 text-left">
{{ i + 1 }}
</td>
<td *ngFor="let domain of asic.domains"
[style.background]="getHeatmapColor(info, domain)"
<td *ngFor="let domain of asic?.domains; trackBy: trackByIndex"
[style.backgroundColor]="getHeatmapColor(info, domain)"
[style.height]="(asicAmount <= 2 ? '2rem' : null)"
class="text-center">
<span class="text-xs">{{ domain | hashSuffix }}</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
width: 100%;
border-collapse: separate;
border-spacing: 1px;
table-layout: fixes;
table-layout: fixed;

th {
padding: 0;
}

&[style*="background"] {
transition: background 250ms;
td {
transition: background-color 2s ease-in-out;
}
}
18 changes: 12 additions & 6 deletions main/http_server/axe-os/src/app/components/home/home.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,10 @@ export class HomeComponent implements OnInit, OnDestroy {
return this.calculateAverage(efficiencies);
}

trackByIndex(index: number, _item: any) {
return index;
}

getPayoutPercentage(info: ISystemInfo) {
if (info.coinbaseValueTotalSatoshis) {
return (info.coinbaseValueUserSatoshis ?? 0) / info.coinbaseValueTotalSatoshis * 100;
Expand Down Expand Up @@ -660,7 +664,7 @@ export class HomeComponent implements OnInit, OnDestroy {
updateMessage(!info.frequency || info.frequency < 400, 'FREQUENCY_LOW', 'warn', 'Device frequency is set low - See settings');
updateMessage(!!info.isUsingFallbackStratum, 'FALLBACK_STRATUM', 'warn', 'Using fallback pool - Share stats reset. Check Pool Settings and / or reboot Device.');
updateMessage(info.version !== info.axeOSVersion, 'VERSION_MISMATCH', 'warn', `Firmware (${info.version}) and AxeOS (${info.axeOSVersion}) versions do not match. Please make sure to update both www.bin and esp-miner.bin.`);
if (info.coinbaseOutputs.length > 0) {
if (info.coinbaseOutputs && info.coinbaseOutputs?.length > 0) {
let percentage = this.getPayoutPercentage(info);
updateMessage(percentage > 0 && percentage < 95, 'NOT_SOLO_MINING', 'warn', `Your share of the mining reward is only ${percentage.toFixed(1)}%`);
updateMessage(percentage === 0, 'NO_MINING_REWARD', 'warn', `You don't have a share in the mining reward`);
Expand Down Expand Up @@ -721,17 +725,18 @@ export class HomeComponent implements OnInit, OnDestroy {
}

public getAsicsAmount(info: ISystemInfo): number {
return info.hashrateMonitor.asics.length;
return info.hashrateMonitor?.asics?.length ?? 0;
}

public getAsicDomainsAmount(info: ISystemInfo): number {
return info.hashrateMonitor.asics[0]?.domains?.length ?? 0;
return info.hashrateMonitor?.asics?.[0]?.domains?.length ?? 0;
}

public getHeatmapColor(info: ISystemInfo, domainHashrate: number): string {
const ratio = Math.max(0, Math.min(2, (domainHashrate / info.expectedHashrate) * this.getAsicsAmount(info)) * this.getAsicDomainsAmount(info));
const deviation = Math.abs(ratio - 1); // 0 = perfect, 1 = 100% off
const t = 1 - Math.pow(1 - deviation, 3);
const expectedHashrate = info.expectedHashrate || 1;
const ratio = Math.max(0, Math.min(2, (domainHashrate / expectedHashrate) * this.getAsicsAmount(info)) * this.getAsicDomainsAmount(info));
const deviation = isNaN(ratio) ? 1 : Math.abs(ratio - 1); // 0 = perfect, 1 = 100% off
const t = 1 - Math.pow(1 - deviation, 1.5); // Exponent controls graduality (lower = more gradual, 7 was very steep)
const target = ratio > 1 ? 255 : 0; // gradient from 0: black, 1: primary-color, 2: white

const primaryColor = getComputedStyle(document.documentElement).getPropertyValue('--primary-color').trim();
Expand Down Expand Up @@ -825,6 +830,7 @@ export class HomeComponent implements OnInit, OnDestroy {
}

static cbFormatValue(value: number, datasetLabel: eChartLabel, args?: any): string {
if (value === undefined || value === null) return '';
switch (datasetLabel) {
case eChartLabel.hashrate:
case eChartLabel.hashrate_1m:
Expand Down
Loading