This commit is contained in:
SuriyaR 2019-08-12 18:34:10 +05:30
commit 9a67619c06
6 changed files with 87 additions and 91 deletions

View File

@ -1170,27 +1170,15 @@ export class BlockchainBlockController {
if(Difftype == "target"){
var TotalDifficultyNBlockQuery = await getConnection()
.query(
"SELECT a.hash, a.tarket_difficulty, a.date FROM(select 1 as hash, (total_difficulty_"+alog_type+" - LAG(total_difficulty_"+alog_type+") OVER (ORDER BY total_difficulty_"+alog_type+")) AS tarket_difficulty, \
"SELECT a.hash, a.total_difficulty_randomx, a.total_difficulty_cuckatoo,a.total_difficulty_progpow, a.date FROM(select 1 as hash, (total_difficulty_cuckatoo - LAG(total_difficulty_cuckatoo) OVER (ORDER BY total_difficulty_cuckatoo)) AS total_difficulty_cuckatoo, \
(total_difficulty_progpow - LAG(total_difficulty_progpow) OVER (ORDER BY total_difficulty_progpow)) AS total_difficulty_progpow , \
(total_difficulty_randomx - LAG(total_difficulty_randomx) OVER (ORDER BY total_difficulty_randomx)) AS total_difficulty_randomx, \
DATE_TRUNC('minute', timestamp at time zone '" +
process.env.TIME_ZONE +
"') as date \
from blockchain_block where " +
timeIntervalQry +
" order by height) as a WHERE a.tarket_difficulty IS NOT NULL",
)
.catch(err_msg => {
next(err_msg);
});
}else if(Difftype == "solution"){
var TotalDifficultyNBlockQuery = await getConnection()
.query(
"SELECT a.hash, a.tarket_difficulty, a.date FROM(select 1 as hash, (total_difficulty_"+alog_type+" - LAG(total_difficulty_"+alog_type+") OVER (ORDER BY total_difficulty_"+alog_type+")) AS tarket_difficulty, \
DATE_TRUNC('minute', timestamp at time zone '" +
process.env.TIME_ZONE +
"') as date \
from blockchain_block where " +
timeIntervalQry +
" order by height) as a WHERE a.tarket_difficulty IS NOT NULL",
" order by height) as a WHERE a.total_difficulty_randomx IS NOT NULL AND a.total_difficulty_progpow IS NOT NULL AND a.total_difficulty_cuckatoo IS NOT NULL AND a.total_difficulty_cuckatoo != '0' AND a.total_difficulty_randomx != '0' AND a.total_difficulty_progpow != '0'",
)
.catch(err_msg => {
next(err_msg);
@ -1198,7 +1186,7 @@ export class BlockchainBlockController {
}else if(Difftype == "total"){
var TotalDifficultyNBlockQuery = await getConnection()
.query(
"select 1 as hash, total_difficulty_"+alog_type+" as tarket_difficulty, \
"select 1 as hash, total_difficulty_cuckatoo,total_difficulty_progpow,total_difficulty_randomx, \
DATE_TRUNC('minute', timestamp at time zone '" +
process.env.TIME_ZONE +
"') as date \
@ -1209,45 +1197,55 @@ export class BlockchainBlockController {
.catch(err_msg => {
next(err_msg);
});
}else{
var TotalDifficultyNBlockQuery = await getConnection()
.query(
"SELECT a.hash, a.tarket_difficulty, a.date FROM(select 1 as hash, (total_difficulty_"+alog_type+" - LAG(total_difficulty_"+alog_type+") OVER (ORDER BY total_difficulty_"+alog_type+")) AS tarket_difficulty, \
DATE_TRUNC('minute', timestamp at time zone '" +
process.env.TIME_ZONE +
"') as date \
from blockchain_block where " +
timeIntervalQry +
" order by height) as a WHERE a.tarket_difficulty IS NOT NULL",
)
.catch(err_msg => {
next(err_msg);
});
}
let date = [],
//DifficultyCuckaroo = [],
//DifficultyCuckatoo = [],
//DifficultyProgpow = [],
//DifficultyRandomx = [];
TargetDifficulty = [];
DifficultyCuckatoo = [],
DifficultyProgpow = [],
DifficultyRandomx = [];
TotalDifficultyNBlockQuery.forEach(e => {
//date.indexOf(moment(e.date).format('YYYY-MM-DD')) < 0 ?
date.push(moment(e.date).format(dateFormat));
// DifficultyCuckaroo.push(parseInt(e.total_difficulty_cuckaroo));
// DifficultyCuckatoo.push(parseInt(e.total_difficulty_cuckatoo));
// DifficultyProgpow.push(parseInt(e.total_difficulty_progpow));
// DifficultyRandomx.push(parseInt(e.total_difficulty_randomx));
TargetDifficulty.push(parseInt(e.tarket_difficulty));
DifficultyCuckatoo.push(parseInt(e.total_difficulty_cuckatoo));
DifficultyProgpow.push(parseInt(e.total_difficulty_progpow));
DifficultyRandomx.push(parseInt(e.total_difficulty_randomx));
});
var Maxrange = Math.max.apply(Math, TotalDifficultyNBlockQuery.map(function(o) { return o.tarket_difficulty; }));
var Minrange = Math.min.apply(Math, TotalDifficultyNBlockQuery.map(function(o) { return o.tarket_difficulty; }));
var Maxrange;
var Minrange;
if(alog_type == "cuckatoo"){
Maxrange = Math.max.apply(Math, TotalDifficultyNBlockQuery.map(function(o) { return o.total_difficulty_cuckatoo; }));
Minrange = Math.min.apply(Math, TotalDifficultyNBlockQuery.map(function(o) { return o.total_difficulty_cuckatoo; }));
if(Minrange != 0){
Minrange = (Minrange - (Minrange * 0.2));
}
Maxrange = (Maxrange + (Maxrange * 0.2));
}else if(alog_type == "progpow"){
Maxrange = Math.max.apply(Math, TotalDifficultyNBlockQuery.map(function(o) { return o.total_difficulty_progpow; }));
Minrange = Math.min.apply(Math, TotalDifficultyNBlockQuery.map(function(o) { return o.total_difficulty_progpow; }));
if(Minrange != 0){
Minrange = (Minrange - (Minrange * 0.2));
}
Maxrange = (Maxrange + (Maxrange * 0.2));
}else if(alog_type == "randomx"){
Maxrange = Math.max.apply(Math, TotalDifficultyNBlockQuery.map(function(o) { return o.total_difficulty_randomx; }));
Minrange = Math.min.apply(Math, TotalDifficultyNBlockQuery.map(function(o) { return o.total_difficulty_randomx; }));
if(Minrange != 0){
Minrange = (Minrange - (Minrange * 0.2));
}
Maxrange = (Maxrange + (Maxrange * 0.2));
}else{
var Maxrange1 = Math.max.apply(Math, TotalDifficultyNBlockQuery.map(function(o) { return o.total_difficulty_cuckatoo; }));
var Minrange1 = Math.min.apply(Math, TotalDifficultyNBlockQuery.map(function(o) { return o.total_difficulty_cuckatoo; }));
var Maxrange2 = Math.max.apply(Math, TotalDifficultyNBlockQuery.map(function(o) { return o.total_difficulty_progpow; }));
var Minrange2 = Math.min.apply(Math, TotalDifficultyNBlockQuery.map(function(o) { return o.total_difficulty_progpow; }));
var Maxrange3 = Math.max.apply(Math, TotalDifficultyNBlockQuery.map(function(o) { return o.total_difficulty_randomx; }));
var Minrange3 = Math.min.apply(Math, TotalDifficultyNBlockQuery.map(function(o) { return o.total_difficulty_randomx; }));
Maxrange = Math.max(Maxrange1, Maxrange2, Maxrange3);
Minrange = Math.min(Minrange1, Minrange2, Minrange3);
if(Minrange != 0){
Minrange = (Minrange - (Minrange * 0.2));
}
Maxrange = (Maxrange + (Maxrange * 0.2));
}
// Minrange = parseInt(Minrange);
// var Minrange2 = parseInt(Minrange * 0.3);
@ -1257,12 +1255,11 @@ export class BlockchainBlockController {
message: 'Difficulty and Blocks Data fetched Successfully',
response: {
Date: date,
// DifficultyCuckaroo: DifficultyCuckaroo,
// DifficultyCuckatoo: DifficultyCuckatoo,
// DifficultyProgpow: DifficultyProgpow,
DifficultyCuckatoo: DifficultyCuckatoo,
DifficultyRandomx: DifficultyRandomx,
DifficultyProgpow: DifficultyProgpow,
Maxrange: Maxrange,
Minrange: Minrange,
TargetDifficulty: TargetDifficulty,
tickFormat: tickFormat
},
});

View File

@ -25,7 +25,7 @@
</div>
</div> -->
<div class="row" *ngIf="latestblockdetail">
<div class="col-md-2">
<div class="col-md-3">
<div
class="text-center detail_div"
>
@ -39,7 +39,7 @@
</p>
</div>
</div>
<div class="col-md-2">
<div class="col-md-3">
<div
class="text-center detail_div"
>
@ -48,12 +48,12 @@
class="count mb-0"
[ngClass]="latestblockdetail.blink == true ? 'item-highlight' : ''"
>
{{ latestblockdetail.letest_block_num }}
{{ latestblockdetail.letest_block_num }} <span class="">{{ latestblockdetail.letest_block_duration }}</span>
</p>
<span class="">{{ latestblockdetail.letest_block_duration }}</span>
</div>
</div>
<div class="col-md-3">
<!-- <div class="col-md-3">
<div class="text-center detail_div" #minhgt>
<p class="mb-2 desc">{{ "home.LATEST_BLOCK1" | translate }}</p>
<div
@ -61,42 +61,42 @@
[ngClass]="latestblockdetail.blink == true ? 'item-highlight' : ''"
>
<!-- <p class="difficulty_datas">Cuckaroo : {{latestblockdetail.targetdifficultycuckaroo | number}} / {{latestblockdetail.TotalDifficultyCuckatoo | number}}</p> -->
<p class="difficulty_datas">Cuckaroo : {{latestblockdetail.targetdifficultycuckaroo | number}} / {{latestblockdetail.TotalDifficultyCuckatoo | number}}</p>
<div class="difficulty_datas">
<span class="day60_txt">Cuckoo : </span>
<!-- <span>Target:</span> -->
<span>Target:</span>
<span>{{ latestblockdetail.targetdifficultycuckatoo | number }}</span>
<!-- <span>Total :</span><span>{{ latestblockdetail.TotalDifficultyCuckatoo | number }}</span> -->
<span>Total :</span><span>{{ latestblockdetail.TotalDifficultyCuckatoo | number }}</span>
</div>
<div class="difficulty_datas">
<span class="day60_txt">ProgPow : </span>
<!-- <span>Target:</span> -->
<span>Target:</span>
<span class="diff_span" style="width:85px;" title="{{ latestblockdetail.targetdifficultyprogpow | number }}">{{ latestblockdetail.targetdifficultyprogpow | number }}</span>
<!-- <span>Total:</span><span class="diff_span" title="{{ latestblockdetail.TotalDifficultyProgpow | number }}">{{ latestblockdetail.TotalDifficultyProgpow | number }}</span> -->
<span>Total:</span><span class="diff_span" title="{{ latestblockdetail.TotalDifficultyProgpow | number }}">{{ latestblockdetail.TotalDifficultyProgpow | number }}</span>
</div>
<div class="difficulty_datas">
<span class="day60_txt"> RandomX : </span>
<!-- <span>Target:</span> -->
<span>Target:</span>
<span>{{ latestblockdetail.targetdifficultyrandomx | number }}</span>
<!-- <span>Total:</span><span>{{ latestblockdetail.TotalDifficultyRandomx | number }}</span> -->
<span>Total:</span><span>{{ latestblockdetail.TotalDifficultyRandomx | number }}</span>
</div>
<!-- <p class="difficulty_datas">
<p class="difficulty_datas">
ProgPow : {{ latestblockdetail.targetdifficultyprogpow | number }} /
{{ latestblockdetail.TotalDifficultyProgpow | number }}
</p>
<p class="difficulty_datas">
RandomX : {{ latestblockdetail.targetdifficultyrandomx | number }} /
{{ latestblockdetail.TotalDifficultyRandomx | number }}
</p> -->
</div>
</p>
</div>
</div>
</div> -->
<div class="col-md-3">
<div class="text-center detail_div" #minhgt>
<p class="mb-2 desc">{{ "home.LATEST_BLOCK2" | translate }}</p>
<div
class=" text-center d-inline-block"
class=" text-left mx-auto d-inline-block"
[ngClass]="latestblockdetail.blink == true ? 'item-highlight' : ''"
>
@ -130,7 +130,7 @@
</div>
</div>
</div>
<div class="col-md-2">
<div class="col-md-3">
<div
class="text-center detail_div"
>

View File

@ -833,7 +833,7 @@ export class GraphListComponent implements OnInit {
showgrid: true,
},
yaxis: {
title: 'Blocks / sec',
title: 'Seconds / Block',
rangemode: 'nonnegative',
fixedrange: true,
showgrid: true,

View File

@ -168,33 +168,33 @@
<div class="mobile_table peer_table">
<div class="row">
<div class="col-6 col-md-4 tble_col">
<div class="">
<div class=" tble_col">
<div class="block_div">
<h5 class="mb-0">Capabilities</h5>
</div>
</div>
<div class="col-6 col-md-4 tble_col">
<div class="block_div">
<div class=" tble_col">
<div class="block_div text-left">
<h5 class="mb-0">User Agent</h5>
</div>
</div>
<div class="col-6 col-md-4 tble_col">
<div class=" tble_col">
<div class="block_div">
<h5 class="mb-0">Version</h5>
</div>
</div>
<div class="col-6 col-md-4 tble_col">
<div class="tble_col">
<div class="block_div">
<h5 class="mb-0">Addr</h5>
</div>
</div>
<div class="col-7 col-sm-6 col-md-4 tble_col">
<div class="block_div">
<div class=" tble_col">
<div class="block_div text-left pl-4">
<h5 class="mb-0">Direction</h5>
</div>
</div>
<div class="col-5 col-sm-6 col-md-4 tble_col">
<div class="tble_col">
<div class="block_div">
<h5 class="mb-0">Total Difficulty</h5>
</div>
@ -255,7 +255,7 @@
<span class="blck_value">{{ peer.user_agent }}</span>
</div>
</div>
<div class="col-6 col-md-3 tble_col">
<div class="col-6 col-md-3 tble_col ver_col">
<div class="block_div">
<h6>Version</h6>
<span class="blck_value">{{ peer.version }}</span>
@ -274,9 +274,9 @@
</div>
</div>
<div class="col-6 col-md-3 tble_col">
<div class="block_div" title="Cuckaroo : {{ peer.total_difficulty.cuckaroo | number }}, Cuckatoo : {{ peer.total_difficulty.cuckatoo | number }}, Progpow : {{ peer.total_difficulty.progpow | number }}, Randomx : {{ peer.total_difficulty.randomx | number }}">
<div class="block_div peers_diff text-left" title="Cuckaroo : {{ peer.total_difficulty.cuckaroo | number }}, Cuckatoo : {{ peer.total_difficulty.cuckatoo | number }}, Progpow : {{ peer.total_difficulty.progpow | number }}, Randomx : {{ peer.total_difficulty.randomx | number }}">
<h6>Total Difficulty</h6>
<span class="blck_value peers_diff">{{ peer.total_difficulty.cuckaroo }},{{ peer.total_difficulty.cuckatoo}},{{ peer.total_difficulty.progpow}},{{ peer.total_difficulty.randomx}}</span>
<span class="blck_value ">{{ peer.total_difficulty.cuckaroo }},{{ peer.total_difficulty.cuckatoo}},{{ peer.total_difficulty.progpow}},{{ peer.total_difficulty.randomx}}</span>
</div>
</div>
</div>

View File

@ -1,14 +1,17 @@
@media(min-width: 992px){
.block_div {min-width: 136px; text-align: center;padding: .75rem; }
.peer_table .block_div{min-width: 180px;}
.peer_table .block_div{min-width: 148px; text-align: center;}
.mobile_table{border-bottom: 1px solid #dee2e6; padding: 0 15px;display: table; width: 100%;}
.view_moble_tble{border-bottom: 1px solid #dee2e6;}
.mobile_table .row{display: table;}
.mobile_table .tble_col{padding: 0;display: table-cell; max-width: unset; flex: unset;}
.mobile_table h6, .view_moble_tble h6, .peer_mobile_table h6{display: none;}
.view_moble_tble .block_div{text-align: left;}
.peer_table_data .col-md-3 { flex: 0 0 16%; max-width: 16%;}
.peer_table_data .col-md-3 { flex: 0 0 13%; max-width: 13%;}
.peer_table{ margin-left: -20px; border-bottom: none}
.peer_table .tble_col{display: inline-block;}
/* .ver_col .block_div{min-width: 10px;max-width: 15px;} */
.block_div.peers_diff{ min-width: 368px; }
}
@media(max-width: 1199px){

View File

@ -512,12 +512,8 @@ margin-right: 10px;
min-width: 5rem;
padding: 0;
}
.peers_diff{
width: 160px;
overflow: hidden;
display: inline-block;
text-overflow: ellipsis;
}
.peers_diff .blck_value{word-wrap: break-word;}
/**********************************************Dark Theme CSS********************************/
body.dark_theme {
background-color: #27314b;