Browse Source

jazz things up with some ui tweaks, including:

- list of site tools in the header
- list of site tools on homepage
- icons for site tools lists
- icons for homepage's network summary
fix-133-memory-crash
Dan Janosik 7 years ago
parent
commit
1e6c4d48b4
  1. 19
      app/config.js
  2. 2
      routes/baseActionsRouter.js
  3. 4
      views/includes/blocks-list.pug
  4. 19
      views/includes/tools-card.pug
  5. 114
      views/index.pug
  6. 29
      views/layout.pug

19
app/config.js

@ -1,9 +1,12 @@
var credentials = require("./credentials.js");
var coins = require("./coins.js");
var currentCoin = "BTC";
module.exports = {
cookiePassword: "0x000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f",
demoSite: true,
coin: "BTC",
coin: currentCoin,
rpcBlacklist:[
"stop",
@ -41,6 +44,20 @@ module.exports = {
googleAnalyticsTrackingId:"",
sentryUrl:"",
siteTools:[
{name:"Node Status", url:"/node-status", desc:"Summary of this node: version, network, uptime, etc.", fontawesome:"fas fa-broadcast-tower"},
{name:"Peers", url:"/peers", desc:"Detailed info about the peers connected to this node.", fontawesome:"fas fa-sitemap"},
{name:"Browse Blocks", url:"/blocks", desc:"Browse all blocks in the blockchain.", fontawesome:"fas fa-cubes"},
{name:"Transaction Stats", url:"/tx-stats", desc:"See graphs of total transaction volume and transaction rates.", fontawesome:"fas fa-chart-bar"},
{name:"RPC Browser", url:"/rpc-browser", desc:"Browse the RPC functionality of this node. See docs and execute commands.", fontawesome:"fas fa-book"},
{name:"RPC Terminal", url:"/rpc-terminal", desc:"Directly execute RPCs against this node.", fontawesome:"fas fa-terminal"},
{name:"Mempool Summary", url:"/mempool-summary", desc:"Detailed summary of the current mempool for this node.", fontawesome:"fas fa-clipboard-list"},
{name:(coins[currentCoin].name + " Fun"), url:"/fun", desc:"See fun/interesting historical blockchain data.", fontawesome:"fas fa-certificate"}
],
donationAddresses:{
coins:["BTC", "LTC"],

2
routes/baseActionsRouter.js

@ -31,6 +31,8 @@ router.get("/", function(req, res) {
return;
}
res.locals.homepage = true;
var promises = [];
promises.push(coreApi.getMempoolInfo());

4
views/includes/blocks-list.pug

@ -17,7 +17,9 @@ table(class="table table-striped table-responsive-sm")
if (block)
tr
td(class="data-cell monospace")
a(href=("/block-height/" + block.height)) #{block.height.toLocaleString()}
a(href=("/block-height/" + block.height)) #{block.height.toLocaleString()}
if (global.specialBlocks && global.specialBlocks[block.hash])
i(class="fas fa-certificate text-primary")
td(class="data-cell monospace") #{moment.utc(new Date(parseInt(block.time) * 1000)).format("Y-MM-DD HH:mm:ss")}
- var timeAgo = moment.duration(moment.utc(new Date()).diff(moment.utc(new Date(parseInt(block.time) * 1000))));

19
views/includes/tools-card.pug

@ -0,0 +1,19 @@
div(class="card mb-3")
div(class="card-header")
h2(class="h6 mb-0") Tools
div(class="card-body")
div(class="row")
each item, index in [[0, 1, 6], [2, 3, 7], [4, 5]]
div(class="col-md-4")
ul(style="list-style-type: none;", class="pl-0")
each toolIndex, toolIndexIndex in item
- var siteTool = config.siteTools[toolIndex];
li
div(class="float-left", style="height: 50px; width: 40px; margin-right: 10px;")
span
i(class=siteTool.fontawesome, class="fa-2x mr-2", style="margin-top: 6px;")
a(href=siteTool.url) #{siteTool.name}
br
p #{siteTool.desc}

114
views/index.pug

@ -32,36 +32,92 @@ block content
div(class="card-header")
h2(class="h6 mb-0") Network Summary
div(class="card-body")
table(class="table table-responsive-sm")
thead
tr
th Hashrate
div(class="row")
div(class="col-md-4")
ul(style="list-style-type: none;", class="pl-0")
li
div(class="float-left", style="height: 40px; width: 40px;")
span
i(class="fas fa-tachometer-alt fa-2x mr-2", style="margin-top: 6px;")
- var hashrateData = utils.formatLargeNumber(miningInfo.networkhashps, 3);
span(class="font-weight-bold") Hashrate
p(class="lead")
span #{hashrateData[0]}
span(title=(hashrateData[1].name + "-hash / x10^" + hashrateData[1].exponent), data-toggle="tooltip") #{hashrateData[1].abbreviation}H/s
if (getblockchaininfo.size_on_disk)
th Blockchain Size
li
div(class="float-left", style="height: 40px; width: 40px;")
span
i(class="fas fa-database fa-2x mr-2", style="margin-top: 6px; margin-left: 3px;")
span(class="font-weight-bold") Blockchain Size
- var sizeData = utils.formatLargeNumber(getblockchaininfo.size_on_disk, 2);
p(class="lead") #{sizeData[0]} #{sizeData[1].abbreviation}B
th Difficulty
th Mempool Size
div(class="col-md-4")
ul(style="list-style-type: none;", class="pl-0")
li
div(class="float-left", style="height: 40px; width: 40px;")
span
i(class="fas fa-unlock-alt fa-2x mr-2", style="margin-top: 6px; margin-left: 3px;")
tbody(class="monospace")
tr
- var hashrateData = utils.formatLargeNumber(miningInfo.networkhashps, 3);
td
span #{hashrateData[0]}
span(title=(hashrateData[1].name + "-hash / x10^" + hashrateData[1].exponent), data-toggle="tooltip") #{hashrateData[1].abbreviation}H/s
td #{utils.formatBytes(getblockchaininfo.size_on_disk)}
span(class="text-muted") (pruned: #{getblockchaininfo.pruned})
span(class="font-weight-bold") Unconfirmed Transactions
p(class="lead") #{mempoolInfo.size.toLocaleString()} tx
- var mempoolBytesData = utils.formatLargeNumber(mempoolInfo.usage, 2);
span(class="text-muted") (#{mempoolBytesData[0]} #{mempoolBytesData[1].abbreviation}B)
li
div(class="float-left", style="height: 40px; width: 40px; font-size: 12px;")
span
i(class="fas fa-dumbbell fa-2x mr-2", style="margin-top: 6px;")
td
- var difficultyData = utils.formatLargeNumber(getblockchaininfo.difficulty, 3);
span(class="font-weight-bold") Difficulty
p(class="lead")
span(title=parseFloat(getblockchaininfo.difficulty).toLocaleString(), data-toggle="tooltip")
span #{difficultyData[0]}
span x 10
sup #{difficultyData[1].exponent}
div(class="col-md-4")
ul(style="list-style-type: none;", class="pl-0")
li
div(class="float-left", style="height: 40px; width: 40px; font-size: 12px;")
span
i(class="fas fa-money-bill-wave-alt fa-2x mr-2", style="margin-top: 7px;")
span(class="font-weight-bold") Exchange Rate
span(data-toggle="tooltip", title=("Exchange-rate data from: " + coinConfig.exchangeRateData.jsonUrl))
i(class="fas fa-info-circle")
if (global.exchangeRate)
p(class="lead") #{utils.formatExchangedCurrency(1.0)}
else
p(class="lead") -
li
div(class="float-left", style="height: 40px; width: 40px;")
span
i(class="fas fa-bolt fa-2x mr-2", style="margin-top: 6px; margin-left: 6px;")
- var chainworkData = utils.formatLargeNumber(parseInt("0x" + getblockchaininfo.chainwork), 2);
span(class="font-weight-bold") Chainwork
span(title=parseFloat(getblockchaininfo.difficulty).toLocaleString(), data-toggle="tooltip")
span #{difficultyData[0]}
span x 10
sup #{difficultyData[1].exponent}
td #{mempoolInfo.size.toLocaleString()} tx /
- var mempoolBytesData = utils.formatLargeNumber(mempoolInfo.usage, 2);
span #{mempoolBytesData[0]} #{mempoolBytesData[1].abbreviation}B
p(class="lead")
span(data-toggle="tooltip", title=getblockchaininfo.chainwork.replace(/^0+/, ''))
span ~
span #{chainworkData[0]}
span x 10
sup #{chainworkData[1].exponent}
span hashes
include includes/tools-card.pug
if (latestBlocks)
div(class="card mb-3")
@ -74,7 +130,9 @@ block content
div(class="col")
span(style="float: right;")
a(href="/blocks") Browse Blocks »
a(href="/blocks")
i(class="fas fa-cubes")
span Browse Blocks »
div(class="card-body")
@ -89,11 +147,13 @@ block content
div(class="card-header")
div(class="row")
div(class="col")
h2(class="h6 mb-0") Transaction Stats
h2(class="h6 mb-0") Transaction Stats Summary
div(class="col")
span(style="float: right;")
a(href="/tx-stats") More Transaction Stats »
a(href="/tx-stats")
i(class="fas fa-chart-bar")
span Transaction Stats »
div(class="card-body")
table(class="table table-responsive-sm text-right")

29
views/layout.pug

@ -41,6 +41,16 @@ html(lang="en")
a(href="/about", class="nav-link")
span About
if (config.siteTools)
li(class="nav-item dropdown")
a(class="nav-link dropdown-toggle", href="javascript:void(0)", role="button", data-toggle="dropdown", aria-haspopup="true", aria-expanded="false")
span Tools
div(class="dropdown-menu", aria-label="Tools Items")
each item in config.siteTools
a(class="dropdown-item", href=item.url)
i(class=item.fontawesome, style="width: 20px; margin-right: 10px;")
span #{item.name}
if (config.headerDropdownLinks)
li(class="nav-item dropdown")
a(class="nav-link dropdown-toggle", href="javascript:void(0)", role="button", data-toggle="dropdown", aria-haspopup="true", aria-expanded="false")
@ -82,22 +92,15 @@ html(lang="en")
button(type="submit", class="btn btn-primary")
i(class="fas fa-search")
if (host && port)
if (host && port && !homepage)
div(id="sub-menu", class="container mb-4", style="margin-top: -1.0rem;")
ul(class="nav")
li(class="nav-item")
a(href="/node-status", class="nav-link") Node Status
li(class="nav-item")
a(href="/peers", class="nav-link") Peers
li(class="nav-item")
a(href="/rpc-browser", class="nav-link") RPC Browser
li(class="nav-item")
a(href="/rpc-terminal", class="nav-link") RPC Terminal
li(class="nav-item")
a(href="/mempool-summary", class="nav-link") Mempool Summary
if (coinConfig.historicalData && coinConfig.historicalData.length > 0)
each item, index in config.siteTools
li(class="nav-item")
a(href="/fun", class="nav-link") #{coinConfig.name} Fun
a(href=item.url, class="nav-link")
i(class=item.fontawesome, style="margin-right: 5px;")
span #{item.name}
hr

Loading…
Cancel
Save