mirror of
https://git.wownero.com/wownero/onion-wownero-blockchain-explorer.git
synced 2024-08-15 00:33:12 +00:00
limit number of tx on front page to 25
This commit is contained in:
parent
c9204be4de
commit
c056d0ec3a
2 changed files with 34 additions and 3 deletions
21
src/page.h
21
src/page.h
|
@ -258,6 +258,9 @@ class page {
|
|||
bool enable_pusher;
|
||||
|
||||
|
||||
uint64_t no_of_mempool_tx_of_frontpage;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
page(MicroCore* _mcore, Blockchain* _core_storage,
|
||||
|
@ -272,6 +275,7 @@ public:
|
|||
enable_pusher {_enable_pusher}
|
||||
{
|
||||
css_styles = xmreg::read(TMPL_CSS_STYLES);
|
||||
no_of_mempool_tx_of_frontpage = 25;
|
||||
}
|
||||
|
||||
|
||||
|
@ -774,14 +778,16 @@ public:
|
|||
return t1 > t2;
|
||||
});
|
||||
|
||||
|
||||
// read mempool.html
|
||||
string mempool_html = xmreg::read(TMPL_MEMPOOL);
|
||||
|
||||
if (add_header_and_footer)
|
||||
{
|
||||
// this is when mempool is on its own page, /mempool
|
||||
add_css_style(context);
|
||||
|
||||
context["partial_mempool_shown"] = false;
|
||||
|
||||
// add header and footer
|
||||
string full_page = get_full_page(mempool_html);
|
||||
|
||||
|
@ -789,6 +795,19 @@ public:
|
|||
return mstch::render(full_page, context);
|
||||
}
|
||||
|
||||
// this is for partial disply on front page.
|
||||
|
||||
context["mempool_fits_on_front_page"] = (txs.size() <= no_of_mempool_tx_of_frontpage);
|
||||
context["no_of_mempool_tx_of_frontpage"] = no_of_mempool_tx_of_frontpage;
|
||||
|
||||
if (txs.size() > no_of_mempool_tx_of_frontpage)
|
||||
{
|
||||
// dont show more than the specific number mempool txs on
|
||||
// the front page
|
||||
txs.resize(no_of_mempool_tx_of_frontpage);
|
||||
}
|
||||
|
||||
context["partial_mempool_shown"] = true;
|
||||
|
||||
// render the page
|
||||
return mstch::render(mempool_html, context);
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
<h2>
|
||||
Memory pool (no of txs: {{mempool_size}}, size: {{mempool_size_kB}} kB)
|
||||
<h2 style="margin-bottom: 0px">
|
||||
Memory pool
|
||||
</h2>
|
||||
<h4 style="font-size: 14px; margin-top: 0px">(no of txs: {{mempool_size}}, size: {{mempool_size_kB}} kB)</h4>
|
||||
<div class="center">
|
||||
|
||||
<table class="center">
|
||||
<tr>
|
||||
<td>height</td>
|
||||
<td>age [h:m:s]</td>
|
||||
<td>size [kB]<!--(Δm)--></td>
|
||||
<td>transaction hash</td>
|
||||
<td>fee</td>
|
||||
<td>outputs</td>
|
||||
|
@ -19,6 +21,7 @@
|
|||
<tr>
|
||||
<td>N/A</td>
|
||||
<td>{{age}}</td>
|
||||
<td>N/A</td>
|
||||
<td><a href="/tx/{{hash}}">{{hash}}</a></td>
|
||||
<td>{{fee}}</td>
|
||||
<td>{{xmr_outputs}}</td>
|
||||
|
@ -30,5 +33,14 @@
|
|||
{{/mempooltxs}}
|
||||
</table>
|
||||
|
||||
{{^mempool_fits_on_front_page}}
|
||||
{{#partial_mempool_shown}}
|
||||
<div class="center" style="text-align: center">
|
||||
<a href="/mempool">Only {{no_of_mempool_tx_of_frontpage}} txs shown. Click this to see all</a>
|
||||
</di>
|
||||
{{/partial_mempool_shown}}
|
||||
|
||||
{{/mempool_fits_on_front_page}}
|
||||
|
||||
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue