From d8219597dba57dd84154b4d73741ae30f73dafda Mon Sep 17 00:00:00 2001 From: Dan Janosik Date: Sun, 11 Mar 2018 23:27:32 -0400 Subject: [PATCH] - consistent footer across site - consistent url for /mempool-summary - internal linking to /rpc-browser for RPC command references (which still links out to dev docs on bitcoin.org) --- routes/baseActionsRouter.js | 6 ++--- views/index.pug | 23 +---------------- views/layout.pug | 22 +++++++++++++++- views/{mempool.pug => mempool-summary.pug} | 29 ++++------------------ views/node-info.pug | 20 +++++++++------ 5 files changed, 42 insertions(+), 58 deletions(-) rename views/{mempool.pug => mempool-summary.pug} (75%) diff --git a/routes/baseActionsRouter.js b/routes/baseActionsRouter.js index 2888294..c410e1d 100644 --- a/routes/baseActionsRouter.js +++ b/routes/baseActionsRouter.js @@ -90,7 +90,7 @@ router.get("/node-info", function(req, res) { }); }); -router.get("/mempool", function(req, res) { +router.get("/mempool-summary", function(req, res) { var client = global.client; rpcApi.getMempoolInfo().then(function(getmempoolinfo) { @@ -99,12 +99,12 @@ router.get("/mempool", function(req, res) { rpcApi.getMempoolStats().then(function(mempoolstats) { res.locals.mempoolstats = mempoolstats; - res.render("mempool"); + res.render("mempool-summary"); }); }).catch(function(err) { res.locals.userMessage = "Unable to connect to Bitcoin Node at " + env.bitcoind.host + ":" + env.bitcoind.port; - res.render("mempool"); + res.render("mempool-summary"); }); }); diff --git a/views/index.pug b/views/index.pug index ed5be69..d7cf23c 100644 --- a/views/index.pug +++ b/views/index.pug @@ -23,25 +23,4 @@ block content - var blocks = latestBlocks; - var blockOffset = 0; - include includes/blocks-list.pug - - hr - - div(class="") - ul - li MIT-licensed source code available on github: - a(href="https://github.com/janoside/btc-rpc-explorer") janoside/btc-rpc-explorer - if (sourcecodeVersion) - span (@ - a(href=("https://github.com/janoside/btc-rpc-explorer/commit/" + sourcecodeVersion)) #{sourcecodeVersion} - span ) - - li Public instance maintained at - a(href="https://btc-explorer.com") https://btc-explorer.com - - li Donate: - a(href="bitcoin:3NPGpNyLLmVKCEcuipBs7G4KpQJoJXjDGe") BTC - span - 3NPGpNyLLmVKCEcuipBs7G4KpQJoJXjDGe - - li © 2018 - a(href="https://danjanosik.com") Dan Janosik \ No newline at end of file + include includes/blocks-list.pug \ No newline at end of file diff --git a/views/layout.pug b/views/layout.pug index ac2f7d0..5b5d602 100644 --- a/views/layout.pug +++ b/views/layout.pug @@ -49,7 +49,7 @@ html li(class="nav-item") a(href="/rpc-terminal", class="nav-link") RPC Terminal li(class="nav-item") - a(href="/mempool", class="nav-link") Mempool Summary + a(href="/mempool-summary", class="nav-link") Mempool Summary hr @@ -62,6 +62,26 @@ html div(style="margin-bottom: 30px;") + footer(class="pt-4 my-md-5 pt-md-5 border-top") + ul + li MIT-licensed source code available on github: + a(href="https://github.com/janoside/btc-rpc-explorer") janoside/btc-rpc-explorer + if (sourcecodeVersion) + span (@ + a(href=("https://github.com/janoside/btc-rpc-explorer/commit/" + sourcecodeVersion)) #{sourcecodeVersion} + span ) + + li Public instance maintained at + a(href="https://btc-explorer.com") https://btc-explorer.com + + li Donate: + a(href="bitcoin:3NPGpNyLLmVKCEcuipBs7G4KpQJoJXjDGe") BTC + span - 3NPGpNyLLmVKCEcuipBs7G4KpQJoJXjDGe + + li © 2018 + a(href="https://danjanosik.com") Dan Janosik + + div(class="d-none d-md-block") a(href="https://github.com/janoside/btc-rpc-explorer") img(style="position: absolute; top: 0; left: 0; border: 0;", src="https://camo.githubusercontent.com/82b228a3648bf44fc1163ef44c62fcc60081495e/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f6c6566745f7265645f6161303030302e706e67", alt="Fork me on GitHub", data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_left_red_aa0000.png") diff --git a/views/mempool.pug b/views/mempool-summary.pug similarity index 75% rename from views/mempool.pug rename to views/mempool-summary.pug index 832dbb3..93b473a 100644 --- a/views/mempool.pug +++ b/views/mempool-summary.pug @@ -9,39 +9,20 @@ block content if (getmempoolinfo) p Data from RPC command - a(href="https://bitcoin.org/en/developer-reference#getmempoolinfo") getmempoolinfo + a(href="/rpc-browser?method=getmempoolinfo") getmempoolinfo 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") Tx Size + th(class="table-active properties-header") Memory Usage td(class="monospace") - 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 - - var scales = [ {val:1000000000, name:"GB"}, {val:1000000, name:"MB"}, {val:1000, name:"kB"} ]; - - var scaleDone = false; - th(class="table-active properties-header") Total Size - td(class="monospace") - span #{getmempoolinfo.usage.toLocaleString()} bytes - each item in scales - if (!scaleDone) - - var fraction = Math.floor(getmempoolinfo.usage / item.val); - if (fraction >= 1) - - scaleDone = true; - span(class="text-muted") (#{fraction} #{item.name}) + span #{utils.formatBytes(getmempoolinfo.usage)} + span(class="text-muted") (virtual size: #{utils.formatBytes(getmempoolinfo.bytes)}) tr th(class="table-active properties-header") Max Size - td(class="monospace") #{getmempoolinfo.maxmempool.toLocaleString()} + td(class="monospace") #{utils.formatBytes(getmempoolinfo.maxmempool)} tr th(class="table-active properties-header") Min Fee td(class="monospace") #{getmempoolinfo.mempoolminfee.toLocaleString()} diff --git a/views/node-info.pug b/views/node-info.pug index 07e2e9f..1da0976 100644 --- a/views/node-info.pug +++ b/views/node-info.pug @@ -9,9 +9,11 @@ block content if (getblockchaininfo) p Data from RPC commands - a(href="https://bitcoin.org/en/developer-reference#getblockchaininfo") getblockchaininfo - span and - a(href="https://bitcoin.org/en/developer-reference#getnetworkinfo") getnetworkinfo + a(href="/rpc-browser?method=getblockchaininfo") getblockchaininfo + span , + a(href="/rpc-browser?method=getnetworkinfo") getnetworkinfo + span , and + a(href="/rpc-browser?method=getnettotals") getnettotals if (false) pre @@ -32,16 +34,14 @@ block content tr th(class="table-active properties-header") Blockchain Size on Disk td(class="monospace") #{getblockchaininfo.size_on_disk.toLocaleString()} - span (pruned: #{getblockchaininfo.pruned}) + span(class="text-muted") (pruned: #{getblockchaininfo.pruned}) tr th(class="table-active properties-header") Connections td(class="monospace") #{getnetworkinfo.connections.toLocaleString()} tr th(class="table-active properties-header") Block Count td(class="monospace") #{getblockchaininfo.blocks.toLocaleString()} - tr - th(class="table-active properties-header") Header Count - td(class="monospace") #{getblockchaininfo.headers.toLocaleString()} + span(class="text-muted") (header count: #{getblockchaininfo.headers.toLocaleString()}) tr - var scales = [ {val:1000000000000000, name:"quadrillion"}, {val:1000000000000, name:"trillion"}, {val:1000000000, name:"billion"}, {val:1000000, name:"million"} ]; - var scaleDone = false; @@ -79,5 +79,9 @@ block content tr th(class="table-active properties-header") Warnings - td(class="monospace") #{getblockchaininfo.warnings} + td(class="monospace") + if (getblockchaininfo.warnings && getblockchaininfo.warnings.trim().length > 0) + span #{getblockchaininfo.warnings} + else + span None \ No newline at end of file