If mining dashboard is enabled, shows pools instead of timestamp
This commit is contained in:
		
							parent
							
								
									7481e27ec2
								
							
						
					
					
						commit
						a7900f6466
					
				| @ -7,7 +7,7 @@ | |||||||
|     <table class="table table-borderless"> |     <table class="table table-borderless"> | ||||||
|       <thead> |       <thead> | ||||||
|         <th class="height" [class]="widget ? 'widget' : ''" i18n="latest-blocks.height">Height</th> |         <th class="height" [class]="widget ? 'widget' : ''" i18n="latest-blocks.height">Height</th> | ||||||
|         <th class="pool text-left" [class]="widget ? 'widget' : ''" i18n="latest-blocks.mined-by"> |         <th class="pool text-left" [class]="widget ? 'widget' : ''" i18n="mining.pool-name"> | ||||||
|           Pool</th> |           Pool</th> | ||||||
|         <th class="timestamp" i18n="latest-blocks.timestamp" *ngIf="!widget">Timestamp</th> |         <th class="timestamp" i18n="latest-blocks.timestamp" *ngIf="!widget">Timestamp</th> | ||||||
|         <th class="mined" i18n="latest-blocks.mined" *ngIf="!widget">Mined</th> |         <th class="mined" i18n="latest-blocks.mined" *ngIf="!widget">Mined</th> | ||||||
|  | |||||||
| @ -110,14 +110,22 @@ | |||||||
|             <table class="table lastest-blocks-table"> |             <table class="table lastest-blocks-table"> | ||||||
|               <thead> |               <thead> | ||||||
|                 <th class="table-cell-height" i18n="dashboard.latest-blocks.height">Height</th> |                 <th class="table-cell-height" i18n="dashboard.latest-blocks.height">Height</th> | ||||||
|                 <th class="table-cell-mined" i18n="dashboard.latest-blocks.mined">Mined</th> |                 <th *ngIf="!stateService.env.MINING_DASHBOARD" class="table-cell-mined" i18n="dashboard.latest-blocks.mined">Mined</th> | ||||||
|  |                 <th *ngIf="stateService.env.MINING_DASHBOARD" class="table-cell-mined pl-lg-4" i18n="mining.pool-name">Pool</th> | ||||||
|                 <th class="table-cell-transaction-count" i18n="dashboard.latest-blocks.transaction-count">TXs</th> |                 <th class="table-cell-transaction-count" i18n="dashboard.latest-blocks.transaction-count">TXs</th> | ||||||
|                 <th class="table-cell-size" i18n="dashboard.latest-blocks.size">Size</th> |                 <th class="table-cell-size" i18n="dashboard.latest-blocks.size">Size</th> | ||||||
|               </thead> |               </thead> | ||||||
|               <tbody> |               <tbody> | ||||||
|                 <tr *ngFor="let block of blocks$ | async; let i = index; trackBy: trackByBlock"> |                 <tr *ngFor="let block of blocks$ | async; let i = index; trackBy: trackByBlock"> | ||||||
|                   <td class="table-cell-height" ><a [routerLink]="['/block' | relativeUrl, block.id]" [state]="{ data: { block: block } }">{{ block.height }}</a></td> |                   <td class="table-cell-height" ><a [routerLink]="['/block' | relativeUrl, block.id]" [state]="{ data: { block: block } }">{{ block.height }}</a></td> | ||||||
|                   <td class="table-cell-mined" ><app-time-since [time]="block.timestamp" [fastRender]="true"></app-time-since></td> |                   <td *ngIf="!stateService.env.MINING_DASHBOARD" class="table-cell-mined" ><app-time-since [time]="block.timestamp" [fastRender]="true"></app-time-since></td> | ||||||
|  |                   <td *ngIf="stateService.env.MINING_DASHBOARD" class="table-cell-mined pl-lg-4"> | ||||||
|  |                     <a class="clear-link" [routerLink]="[('/mining/pool/' + block.extras.pool.id) | relativeUrl]"> | ||||||
|  |                       <img width="20" height="20" src="{{ block.extras.pool['logo'] }}" | ||||||
|  |                         onError="this.src = './resources/mining-pools/default.svg'"> | ||||||
|  |                       <span class="pool-name">{{ block.extras.pool.name }}</span> | ||||||
|  |                     </a> | ||||||
|  |                   </td> | ||||||
|                   <td class="table-cell-transaction-count">{{ block.tx_count | number }}</td> |                   <td class="table-cell-transaction-count">{{ block.tx_count | number }}</td> | ||||||
|                   <td class="table-cell-size"> |                   <td class="table-cell-size"> | ||||||
|                     <div class="progress"> |                     <div class="progress"> | ||||||
|  | |||||||
| @ -305,3 +305,13 @@ | |||||||
|   width: 100%; |   width: 100%; | ||||||
|   vertical-align: middle; |   vertical-align: middle; | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | .clear-link { | ||||||
|  |   color: white; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | .pool-name { | ||||||
|  |   display: inline-block; | ||||||
|  |   vertical-align: text-top; | ||||||
|  |   padding-left: 10px; | ||||||
|  | } | ||||||
|  | |||||||
| @ -149,6 +149,15 @@ export class DashboardComponent implements OnInit { | |||||||
|           } |           } | ||||||
|           acc.unshift(block); |           acc.unshift(block); | ||||||
|           acc = acc.slice(0, 6); |           acc = acc.slice(0, 6); | ||||||
|  | 
 | ||||||
|  |           if (this.stateService.env.MINING_DASHBOARD === true) { | ||||||
|  |             for (const block of acc) { | ||||||
|  |               // @ts-ignore: Need to add an extra field for the template
 | ||||||
|  |               block.extras.pool.logo = `./resources/mining-pools/` + | ||||||
|  |                 block.extras.pool.name.toLowerCase().replace(' ', '').replace('.', '') + '.svg'; | ||||||
|  |             } | ||||||
|  |           } | ||||||
|  | 
 | ||||||
|           return acc; |           return acc; | ||||||
|         }, []), |         }, []), | ||||||
|       ); |       ); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user