More node info
This commit is contained in:
		
							parent
							
								
									2fec4ead2f
								
							
						
					
					
						commit
						179f959f0f
					
				@ -14,6 +14,30 @@
 | 
			
		||||
    <div class="box">
 | 
			
		||||
 | 
			
		||||
      <div class="row">
 | 
			
		||||
        <div class="col-md">
 | 
			
		||||
          <table class="table table-borderless table-striped">
 | 
			
		||||
            <tbody>
 | 
			
		||||
              <tr>
 | 
			
		||||
                <td i18n="address.total-received">Total capacity</td>
 | 
			
		||||
                <td>
 | 
			
		||||
                  <app-sats [satoshis]="node.capacity"></app-sats>  <app-fiat [value]="node.capacity" digitsInfo="1.0-0"></app-fiat>
 | 
			
		||||
                </td>
 | 
			
		||||
              </tr>
 | 
			
		||||
              <tr>
 | 
			
		||||
                <td i18n="address.total-sent">Total channels</td>
 | 
			
		||||
                <td>
 | 
			
		||||
                  {{ node.channel_count }}
 | 
			
		||||
                </td>
 | 
			
		||||
              </tr>
 | 
			
		||||
              <tr>
 | 
			
		||||
                <td i18n="address.total-received">Average channel size</td>
 | 
			
		||||
                <td>
 | 
			
		||||
                  <app-sats [satoshis]="node.channels_capacity_avg"></app-sats>  <app-fiat [value]="node.channels_capacity_avg" digitsInfo="1.0-0"></app-fiat>
 | 
			
		||||
                </td>
 | 
			
		||||
              </tr>
 | 
			
		||||
            </tbody>
 | 
			
		||||
          </table>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="col-md">
 | 
			
		||||
          <table class="table table-borderless table-striped">
 | 
			
		||||
            <tbody>
 | 
			
		||||
@ -36,10 +60,6 @@
 | 
			
		||||
            </tbody>
 | 
			
		||||
          </table>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="w-100 d-block d-md-none"></div>
 | 
			
		||||
        <div class="col-md qrcode-col">
 | 
			
		||||
          
 | 
			
		||||
        </div>
 | 
			
		||||
      </div>
 | 
			
		||||
 | 
			
		||||
    </div>
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
‎{{ addPlus && satoshis >= 0 ? '+' : '' }}{{ satoshis | number }}
 | 
			
		||||
‎{{ addPlus && satoshis >= 0 ? '+' : '' }}{{ satoshis | number : '1.0-0' }}
 | 
			
		||||
<span class="symbol"><ng-template [ngIf]="network === 'liquid'">L-</ng-template>
 | 
			
		||||
<ng-template [ngIf]="network === 'liquidtestnet'">tL-</ng-template>
 | 
			
		||||
<ng-template [ngIf]="network === 'testnet'">t-</ng-template>
 | 
			
		||||
 | 
			
		||||
@ -4,8 +4,8 @@ import DB from '../../database';
 | 
			
		||||
class NodesApi {
 | 
			
		||||
  public async $getNode(public_key: string): Promise<any> {
 | 
			
		||||
    try {
 | 
			
		||||
      const query = `SELECT nodes.*, (SELECT COUNT(*) FROM channels WHERE channels.status < 2 AND (channels.node1_public_key = ? OR channels.node2_public_key = ?)) AS channel_count, (SELECT SUM(capacity) FROM channels WHERE channels.status < 2 AND (channels.node1_public_key = ? OR channels.node2_public_key = ?)) AS capacity FROM nodes WHERE public_key = ?`;
 | 
			
		||||
      const [rows]: any = await DB.query(query, [public_key, public_key, public_key, public_key, public_key]);
 | 
			
		||||
      const query = `SELECT nodes.*, (SELECT COUNT(*) FROM channels WHERE channels.status < 2 AND (channels.node1_public_key = ? OR channels.node2_public_key = ?)) AS channel_count, (SELECT SUM(capacity) FROM channels WHERE channels.status < 2 AND (channels.node1_public_key = ? OR channels.node2_public_key = ?)) AS capacity, (SELECT AVG(capacity) FROM channels WHERE status < 2 AND (node1_public_key = ? OR node2_public_key = ?)) AS channels_capacity_avg FROM nodes WHERE public_key = ?`;
 | 
			
		||||
      const [rows]: any = await DB.query(query, [public_key, public_key, public_key, public_key, public_key, public_key, public_key]);
 | 
			
		||||
      return rows[0];
 | 
			
		||||
    } catch (e) {
 | 
			
		||||
      logger.err('$getNode error: ' + (e instanceof Error ? e.message : e));
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user