extends layout

block content
  div.container-fluid(ng-controller='StatsCtrl')
    div.row(ng-cloak)
      div.col-xs-2.stat-holder
        div.big-info.bestblock.text-info
          div.pull-left.icon-full-width
            i.icon-block
          div.pull-left
            span.small-title best block
            span.big-details {{'#'}}{{ bestBlock | number}}
          div.clearfix
      div.col-xs-2.stat-holder
        div.big-info.uncleCount.text-info
          div.pull-left.icon-full-width
            i.icon-uncle
          div.pull-left
            span.small-title uncles #[&nbsp;]
              span.small (current / last 50)
            span.big-details {{ bestStats.block.uncles.length }}/{{ uncleCount }}
          div.clearfix
      div.col-xs-2.stat-holder
        div.big-info.blocktime(class="{{ lastBlock | timeClass : true }}")
          div.pull-left.icon-full-width
            i.icon-time
          div.pull-left
            span.small-title last block
            span.big-details {{ lastBlock | blockTimeFilter }}
          div.clearfix
      div.col-xs-2.stat-holder
        div.big-info.avgblocktime(class="{{ avgBlockTime | avgTimeClass }}")
          div.pull-left.icon-full-width
            i.icon-gas
          div.pull-left
            span.small-title avg block time
            span.big-details {{ avgBlockTime | avgTimeFilter }}
          div.clearfix
      div.col-xs-2.stat-holder
        div.big-info.difficulty.text-orange
          div.pull-left.icon-full-width
            i.icon-hashrate
          div.pull-left
            span.small-title avg network hashrate
            span.big-details {{ avgHashrate | number : 1 }} MH/s
          div.clearfix
      div.col-xs-2.stat-holder
        div.big-info.difficulty.text-danger
          div.pull-left.icon-full-width
            i.icon-difficulty
          div.pull-left
            span.small-title difficulty
            span.big-details {{ lastDifficulty | number }}
          div.clearfix

      div.clearfix


    div.row(ng-cloak)
      div.col-xs-8.stats-boxes(style="padding-top: 0px;")
        div.row.second-row
          div.col-xs-3.stat-holder.box
            div.active-nodes(class="{{ nodesActive | nodesActiveClass : nodesTotal }}")
              i.icon-node
              span.small-title active nodes
              span.small-value {{nodesActive}}/{{nodesTotal}}
          //- div.col-xs-3.stat-holder.box
          //-   div.difficulty.text-info
          //-     i.icon-difficulty
          //-     span.small-title difficulty
          //-     span.small-value {{ lastDifficulty | number }}
          div.col-xs-3.stat-holder.box
            div.gasprice.text-info
              i.icon-gasprice
              span.small-title gas price
              span.small-value {{ bestStats.gasPrice.toString() | gasPriceFilter }}
          div.col-xs-3.stat-holder.box
            div.page-latency(class="{{ {active: true, latency: latency} | latencyClass }}")
              i.icon-clock
              span.small-title page latency
              span.small-value {{latency}} ms
          div.col-xs-3.stat-holder.box
            div.uptime(class="{{ upTimeTotal | upTimeClass : true }}")
              i.icon-bulb
              span.small-title uptime
              span.small-value {{ upTimeTotal | upTimeFilter }}

        div.row
          div.col-xs-3.stat-holder
            div.big-info.chart(class="{{ avgBlockTime | avgTimeClass }}")
              //- i.icon-time
              span.small-title block time
              //- span.small-value {{ avgBlockTime | avgTimeFilter }}
              span.big-details.spark-blocktimes

          div.col-xs-3.stat-holder
            div.big-info.chart.text-info
              //- i.icon-difficulty
              span.small-title difficulty
              //- span.small-value {{ lastDifficulty | number }}
              span.big-details.spark-difficulty

          div.col-xs-3.stat-holder.xpull-right
            div.big-info.chart.xdouble-chart(class="{{ blockPropagationAvg | propagationAvgTimeClass : true }}")
              //- i.icon-gas
              span.small-title block propagation
              span.small-value {{ blockPropagationAvg | blockPropagationFilter : '' }}
              histogram.big-details.d3-blockpropagation(data="blockPropagationChart")

          div.col-xs-3.stat-holder.pull-right
            div.big-info.chart.double-chart
              span.small-title last blocks miners
              div.blocks-holder(ng-repeat='miner in miners', data-toggle="tooltip", data-placement="right", title="{{miner.blocks}}")
                div.block-count(class="{{miner.blocks | minerBlocksClass : 'text-'}}") {{miner.blocks}}
                div.small-title-miner {{miner.miner | minerNameFilter : miner.name}}
                div.block(ng-repeat="i in getNumber(miner.blocks) track by $index", class="{{miner.blocks | minerBlocksClass}}")
                div.clearfix

          div.col-xs-3.stat-holder
            div.big-info.chart.text-info
              //- i.icon-uncle
              span.small-title uncle count #[&nbsp;]
                span.small (25 blocks per bar)
              //- span.small-value {{ bestStats.block.uncles.length }}/{{ uncleCount }}
              span.big-details.spark-uncles

          div.col-xs-3.stat-holder
            div.big-info.chart.text-info
              //- i.icon-uncle
              span.small-title transactions
              span.big-details.spark-transactions

          div.col-xs-3.stat-holder
            div.big-info.chart.text-info
              //- i.icon-gasprice
              span.small-title gas spending
              span.big-details.spark-gasspending



      div.col-xs-4.stat-holder.map-holder
        //- div.col-xs-12
        nodemap#mapHolder(data="map")

      //- div.clearfix

    div.row(ng-cloak, style="padding-top: 10px")
      table.table.table-striped
        thead
          tr.text-info
            th.th-nodename
              i.icon-node(data-toggle="tooltip", data-placement="top", title="Node name", ng-click="orderTable(['-stats.active', 'info.name'], false)")
            th.th-nodetype
              i.icon-laptop(data-toggle="tooltip", data-placement="top", title="Node type", ng-click="orderTable(['-stats.active', 'info.node'], false)")
            th.th-latency
              i.icon-clock(data-toggle="tooltip", data-placement="top", title="Node latency", ng-click="orderTable(['-stats.active', 'stats.latency'], false)")
            th
              i.icon-mining(data-toggle="tooltip", data-placement="top", title="Is mining", ng-click="orderTable(['-stats.active', '-stats.mining'], false)")
            th
              i.icon-hashrate(data-toggle="tooltip", data-placement="top", title="Hashrate", ng-click="orderTable(['-stats.active', '-stats.mining', '-stats.hashrate'], false)")
            th
              i.icon-group(data-toggle="tooltip", data-placement="top", title="Peers", ng-click="orderTable(['-stats.active', '-stats.peers'], false)")
            th
              i.icon-network(data-toggle="tooltip", data-placement="top", title="Pending transactions", ng-click="orderTable(['-stats.active', '-stats.pending'], false)")
            th
              i.icon-block(data-toggle="tooltip", data-placement="top", title="Last block", ng-click="orderTable(['-stats.active', '-stats.block.number', 'stats.block.propagation'], false)")
            th.th-blockhash #[&nbsp;]
            th
              i.icon-check-o(data-toggle="tooltip", data-placement="top", title="Block transactions", ng-click="orderTable(['-stats.active', '-stats.block.transactions.length'], false)")
            th
              i.icon-uncle(data-toggle="tooltip", data-placement="top", title="Uncles", ng-click="orderTable(['-stats.active', '-stats.block.uncles.length'], false)")
            th.th-blocktime
              i.icon-time(data-toggle="tooltip", data-placement="top", title="Last block time", ng-click="orderTable(['-stats.active', '-stats.block.received'], false)")
            th.th-peerPropagationTime
              i.icon-gas(data-toggle="tooltip", data-placement="top", title="Propagation time", ng-click="orderTable(['-stats.active', '-stats.block.number', 'stats.block.propagation'], false)")
            th.th-peerPropagationChart
            th.th-peerPropagationAvg
              i.icon-gas(data-toggle="tooltip", data-placement="top", title="Average propagation time", ng-click="orderTable(['-stats.active', 'stats.propagationAvg'], false)")
            th
              i.icon-bulb(data-toggle="tooltip", data-placement="top", title="Up-time", ng-click="orderTable(['-stats.active', '-stats.uptime'], false)")
        tbody(ng-cloak)
          tr(ng-repeat='node in nodes | orderBy:predicate:reverse', class="{{ node.stats | mainClass : bestBlock }}")
            td.nodeInfo(rel="{{node.id}}")
              span.small(data-toggle="tooltip", data-placement="top", data-html="true", data-original-title="{{node | geoTooltip}}") {{node.info.name}}
              span.small #[&nbsp;]({{node.info.ip}})
              a.small(href="https://github.com/ethereum/wiki/wiki/Network-Status#updating", target="_blank", data-toggle="tooltip", data-placement="top", data-html="true", data-original-title="Netstats client needs update.<br>Click this icon for instructions.", class="{{ node.info | nodeClientClass : currentApiVersion }}")
                i.icon-warning-o
            td
              div.small(ng-bind-html="node.info.node | nodeVersion")
            td(class="{{ node.stats | latencyClass }}")
              span.small {{node.stats | latencyFilter}}
            td(class="{{ node.stats.mining | miningClass : node.stats.active }}")
              i(class="{{ node.stats.mining | miningIconClass }}")
            td(class="{{ node.stats.mining | hashrateClass : node.stats.active }}")
              span.small {{node.stats.hashrate | hashrateFilter}} kH/s
            td(class="{{ node.stats.peers | peerClass : node.stats.active }}", style="padding-left: 11px;") {{node.stats.peers}}
            td(style="padding-left: 15px;") {{node.stats.pending}}
            td(class="{{ node.stats | blockClass : bestBlock }}") {{'#'}}{{ node.stats.block.number | number }}
            td(class="{{ node.stats | blockClass : bestBlock }}")
              span.small {{node.stats.block.hash | hashFilter}}
            td(style="padding-left: 14px;") {{node.stats.block.transactions.length || 0}}
            td(style="padding-left: 14px;") {{node.stats.block.uncles.length || 0}}
            td(class="{{ node.stats.block.arrived | timeClass : node.stats.active }}") {{node.stats.block.arrived | blockTimeFilter }}
            td(class="{{ node.stats | propagationTimeClass : bestBlock }}")
              div.propagationBox
              span {{node.stats.block.propagation | blockPropagationFilter}}
            td.peerPropagationChart(class="{{node.id}}")
            td(class="{{ node.stats.propagationAvg | propagationAvgTimeClass : node.stats.active }}") {{ node.stats.propagationAvg | blockPropagationFilter : '' }}
            td(class="{{ node.stats.uptime | upTimeClass : node.stats.active }}") {{ node.stats.uptime | upTimeFilter }}
