Show avg block heath in pool ranking pie chart
This commit is contained in:
		
							parent
							
								
									e3e7271c9d
								
							
						
					
					
						commit
						0dc2a598c3
					
				@ -100,7 +100,7 @@ class Mining {
 | 
				
			|||||||
        rank: rank++,
 | 
					        rank: rank++,
 | 
				
			||||||
        emptyBlocks: emptyBlocksCount.length > 0 ? emptyBlocksCount[0]['count'] : 0,
 | 
					        emptyBlocks: emptyBlocksCount.length > 0 ? emptyBlocksCount[0]['count'] : 0,
 | 
				
			||||||
        slug: poolInfo.slug,
 | 
					        slug: poolInfo.slug,
 | 
				
			||||||
        avgMatchRate: Math.round(100 * poolInfo.avgMatchRate) / 100,
 | 
					        avgMatchRate: poolInfo.avgMatchRate !== null ? Math.round(100 * poolInfo.avgMatchRate) / 100 : null,
 | 
				
			||||||
      };
 | 
					      };
 | 
				
			||||||
      poolsStats.push(poolStat);
 | 
					      poolsStats.push(poolStat);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
				
			|||||||
@ -16,7 +16,7 @@ export interface PoolInfo {
 | 
				
			|||||||
  link: string;
 | 
					  link: string;
 | 
				
			||||||
  blockCount: number;
 | 
					  blockCount: number;
 | 
				
			||||||
  slug: string;
 | 
					  slug: string;
 | 
				
			||||||
  avgMatchRate: number;
 | 
					  avgMatchRate: number | null;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface PoolStats extends PoolInfo {
 | 
					export interface PoolStats extends PoolInfo {
 | 
				
			||||||
 | 
				
			|||||||
@ -92,6 +92,8 @@
 | 
				
			|||||||
          <th class="" i18n="mining.pool-name">Pool</th>
 | 
					          <th class="" i18n="mining.pool-name">Pool</th>
 | 
				
			||||||
          <th class="" *ngIf="this.miningWindowPreference === '24h'" i18n="mining.hashrate">Hashrate</th>
 | 
					          <th class="" *ngIf="this.miningWindowPreference === '24h'" i18n="mining.hashrate">Hashrate</th>
 | 
				
			||||||
          <th class="" i18n="master-page.blocks">Blocks</th>
 | 
					          <th class="" i18n="master-page.blocks">Blocks</th>
 | 
				
			||||||
 | 
					          <th *ngIf="auditAvailable" class="health text-right widget" i18n="latest-blocks.avg_health"
 | 
				
			||||||
 | 
					            i18n-ngbTooltip="latest-blocks.avg_health" ngbTooltip="Avg Health" placement="bottom" #health [disableTooltip]="!isEllipsisActive(health)">Avg Health</th>
 | 
				
			||||||
          <th class="d-none d-md-block" i18n="mining.empty-blocks">Empty blocks</th>
 | 
					          <th class="d-none d-md-block" i18n="mining.empty-blocks">Empty blocks</th>
 | 
				
			||||||
        </tr>
 | 
					        </tr>
 | 
				
			||||||
      </thead>
 | 
					      </thead>
 | 
				
			||||||
@ -105,6 +107,18 @@
 | 
				
			|||||||
          <td class="" *ngIf="this.miningWindowPreference === '24h' && !isLoading">{{ pool.lastEstimatedHashrate }} {{
 | 
					          <td class="" *ngIf="this.miningWindowPreference === '24h' && !isLoading">{{ pool.lastEstimatedHashrate }} {{
 | 
				
			||||||
            miningStats.miningUnits.hashrateUnit }}</td>
 | 
					            miningStats.miningUnits.hashrateUnit }}</td>
 | 
				
			||||||
          <td class="">{{ pool['blockText'] }}</td>
 | 
					          <td class="">{{ pool['blockText'] }}</td>
 | 
				
			||||||
 | 
					          <td *ngIf="auditAvailable" class="health text-right" [ngClass]="{'widget': widget, 'legacy': !indexingAvailable}">
 | 
				
			||||||
 | 
					            <a
 | 
				
			||||||
 | 
					              class="health-badge badge"
 | 
				
			||||||
 | 
					              [class.badge-success]="pool.avgMatchRate >= 99"
 | 
				
			||||||
 | 
					              [class.badge-warning]="pool.avgMatchRate >= 75 && pool.avgMatchRate < 99"
 | 
				
			||||||
 | 
					              [class.badge-danger]="pool.avgMatchRate < 75"
 | 
				
			||||||
 | 
					              *ngIf="pool.avgMatchRate != null; else nullHealth"
 | 
				
			||||||
 | 
					            >{{ pool.avgMatchRate }}%</a>
 | 
				
			||||||
 | 
					            <ng-template #nullHealth>
 | 
				
			||||||
 | 
					              <span class="health-badge badge badge-secondary" i18n="unknown">Unknown</span>
 | 
				
			||||||
 | 
					            </ng-template>
 | 
				
			||||||
 | 
					          </td>
 | 
				
			||||||
          <td class="d-none d-md-block">{{ pool.emptyBlocks }} ({{ pool.emptyBlockRatio }}%)</td>
 | 
					          <td class="d-none d-md-block">{{ pool.emptyBlocks }} ({{ pool.emptyBlockRatio }}%)</td>
 | 
				
			||||||
        </tr>
 | 
					        </tr>
 | 
				
			||||||
        <tr style="border-top: 1px solid #555">
 | 
					        <tr style="border-top: 1px solid #555">
 | 
				
			||||||
 | 
				
			|||||||
@ -26,6 +26,8 @@ export class PoolRankingComponent implements OnInit {
 | 
				
			|||||||
  miningWindowPreference: string;
 | 
					  miningWindowPreference: string;
 | 
				
			||||||
  radioGroupForm: UntypedFormGroup;
 | 
					  radioGroupForm: UntypedFormGroup;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  auditAvailable = false;
 | 
				
			||||||
 | 
					  indexingAvailable = false;
 | 
				
			||||||
  isLoading = true;
 | 
					  isLoading = true;
 | 
				
			||||||
  chartOptions: EChartsOption = {};
 | 
					  chartOptions: EChartsOption = {};
 | 
				
			||||||
  chartInitOptions = {
 | 
					  chartInitOptions = {
 | 
				
			||||||
@ -60,6 +62,10 @@ export class PoolRankingComponent implements OnInit {
 | 
				
			|||||||
    this.radioGroupForm = this.formBuilder.group({ dateSpan: this.miningWindowPreference });
 | 
					    this.radioGroupForm = this.formBuilder.group({ dateSpan: this.miningWindowPreference });
 | 
				
			||||||
    this.radioGroupForm.controls.dateSpan.setValue(this.miningWindowPreference);
 | 
					    this.radioGroupForm.controls.dateSpan.setValue(this.miningWindowPreference);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    this.indexingAvailable = (this.stateService.env.BASE_MODULE === 'mempool' &&
 | 
				
			||||||
 | 
					      this.stateService.env.MINING_DASHBOARD === true);
 | 
				
			||||||
 | 
					    this.auditAvailable = this.indexingAvailable && this.stateService.env.AUDIT;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.route
 | 
					    this.route
 | 
				
			||||||
      .fragment
 | 
					      .fragment
 | 
				
			||||||
      .subscribe((fragment) => {
 | 
					      .subscribe((fragment) => {
 | 
				
			||||||
 | 
				
			|||||||
@ -73,6 +73,7 @@ export interface SinglePoolStats {
 | 
				
			|||||||
  emptyBlockRatio: string;
 | 
					  emptyBlockRatio: string;
 | 
				
			||||||
  logo: string;
 | 
					  logo: string;
 | 
				
			||||||
  slug: string;
 | 
					  slug: string;
 | 
				
			||||||
 | 
					  avgMatchRate: number;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
export interface PoolsStats {
 | 
					export interface PoolsStats {
 | 
				
			||||||
  blockCount: number;
 | 
					  blockCount: number;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user