Browse Source

- convert "Node Info" and "Mempool Info" in index to be nice tables

- minor cleanup
fix-133-memory-crash
Dan Janosik 8 years ago
parent
commit
14103b84e4
  1. 6
      views/includes/blocks-list.pug
  2. 36
      views/includes/getinfo-table.pug
  3. 30
      views/includes/getmempoolinfo-table.pug
  4. 8
      views/index.pug

6
views/includes/blocks-list.pug

@ -13,8 +13,8 @@ table(class="table table-striped")
tr tr
th #{blockIndex + blockOffset + 1} th #{blockIndex + blockOffset + 1}
td td
a(href=("/block-height/" + block.height)) #{block.height} a(href=("/block-height/" + block.height)) #{block.height.toLocaleString()}
td #{moment.utc(new Date(parseInt(block.time) * 1000)).format("Y-MM-DD HH:mm:ss")} td #{moment.utc(new Date(parseInt(block.time) * 1000)).format("Y-MM-DD HH:mm:ss")}
td #{moment.utc(new Date(parseInt(block.time) * 1000)).fromNow(true)} td #{moment.utc(new Date(parseInt(block.time) * 1000)).fromNow(true)}
td #{block.tx.length.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")} td #{block.tx.length.toLocaleString()}
td #{block.size.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")} td #{block.size.toLocaleString()}

36
views/includes/getinfo-table.pug

@ -0,0 +1,36 @@
if (false)
pre
code #{JSON.stringify(getinfo, null, 4)}
if (true)
table(class="table")
tr
th(class="table-active properties-header") Version
td #{getinfo.version}
tr
th(class="table-active properties-header") Protocol Version
td #{getinfo.protocolversion}
tr
th(class="table-active properties-header") Connections
td #{getinfo.connections.toLocaleString()}
tr
th(class="table-active properties-header") Block Count
td #{getinfo.blocks.toLocaleString()}
tr
th(class="table-active properties-header") Testnet?
td #{getinfo.testnet}
tr
th(class="table-active properties-header") Errors
td #{getinfo.errors}
tr
- var scales = [ {val:1000000000000000, name:"quadrillion"}, {val:1000000000000, name:"trillion"}, {val:1000000000, name:"billion"}, {val:1000000, name:"million"} ];
- var scaleDone = false;
th(class="table-active properties-header") Difficulty
td
span #{getinfo.difficulty.toLocaleString()}
each item in scales
if (!scaleDone)
- var fraction = Math.floor(getinfo.difficulty / item.val);
if (fraction >= 1)
- scaleDone = true;
span(class="text-muted") (#{fraction} #{item.name})

30
views/includes/getmempoolinfo-table.pug

@ -0,0 +1,30 @@
if (false)
pre
code #{JSON.stringify(getmempoolinfo, null, 4)}
if (true)
table(class="table")
tr
th(class="table-active properties-header") Transaction Count
td #{getmempoolinfo.size.toLocaleString()}
tr
- var scales = [ {val:1000000000, name:"GB"}, {val:1000000, name:"MB"}, {val:1000, name:"kB"} ];
- var scaleDone = false;
th(class="table-active properties-header") Size
td
span #{getmempoolinfo.bytes.toLocaleString()} bytes
each item in scales
if (!scaleDone)
- var fraction = Math.floor(getmempoolinfo.bytes / item.val);
if (fraction >= 1)
- scaleDone = true;
span(class="text-muted") (#{fraction} #{item.name})
tr
th(class="table-active properties-header") Total Memory Usage
td #{getmempoolinfo.usage.toLocaleString()}
tr
th(class="table-active properties-header") Max Size
td #{getmempoolinfo.maxmempool.toLocaleString()}
tr
th(class="table-active properties-header") Min Fee
td #{getmempoolinfo.mempoolminfee.toLocaleString()}

8
views/index.pug

@ -35,10 +35,10 @@ block content
div(id="tab-getinfo", class="tab-pane", role="tabpanel") div(id="tab-getinfo", class="tab-pane", role="tabpanel")
h3 Node Info h3 Node Info
pre
code #{JSON.stringify(getinfo, null, 4)} include includes/getinfo-table.pug
div(id="tab-getmempoolinfo", class="tab-pane", role="tabpanel") div(id="tab-getmempoolinfo", class="tab-pane", role="tabpanel")
h3 Mempool Info h3 Mempool Info
pre
code #{JSON.stringify(getmempoolinfo, null, 4)} include includes/getmempoolinfo-table.pug
Loading…
Cancel
Save