diff --git a/server/controllers/BlockchainBlock.ts b/server/controllers/BlockchainBlock.ts index 9b7b4ac..0f409f9 100644 --- a/server/controllers/BlockchainBlock.ts +++ b/server/controllers/BlockchainBlock.ts @@ -828,7 +828,7 @@ export class BlockchainBlockController { console.log('error', error); next(new InternalServerErrorException(error)); } - + }; private BlockchainBlockUpdate = async ( @@ -1167,30 +1167,18 @@ export class BlockchainBlockController { var dateFormat = 'YYYY-MM-DD HH:mm:ss'; var tickFormat = '%H-%M'; } - 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, \ - 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"){ + 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", + " 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)); + 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 }, }); diff --git a/src/app/view/home/block-detail-list/block-detail-list.component.html b/src/app/view/home/block-detail-list/block-detail-list.component.html index f34d90d..2826763 100644 --- a/src/app/view/home/block-detail-list/block-detail-list.component.html +++ b/src/app/view/home/block-detail-list/block-detail-list.component.html @@ -25,7 +25,7 @@ -->
-
+
@@ -39,7 +39,7 @@

-
+
@@ -48,12 +48,12 @@ class="count mb-0" [ngClass]="latestblockdetail.blink == true ? 'item-highlight' : ''" > - {{ latestblockdetail.letest_block_num }} + {{ latestblockdetail.letest_block_num }} {{ latestblockdetail.letest_block_duration }}

- {{ latestblockdetail.letest_block_duration }} +
-
+ +

Cuckaroo : {{latestblockdetail.targetdifficultycuckaroo | number}} / {{latestblockdetail.TotalDifficultyCuckatoo | number}}

Cuckoo : - + Target: {{ latestblockdetail.targetdifficultycuckatoo | number }} - + Total :{{ latestblockdetail.TotalDifficultyCuckatoo | number }}
ProgPow : - + Target: {{ latestblockdetail.targetdifficultyprogpow | number }} - + Total:{{ latestblockdetail.TotalDifficultyProgpow | number }}
RandomX : - + Target: {{ latestblockdetail.targetdifficultyrandomx | number }} - + Total:{{ latestblockdetail.TotalDifficultyRandomx | number }}
- +

-
+
-->

{{ "home.LATEST_BLOCK2" | translate }}

@@ -130,7 +130,7 @@
-
+
diff --git a/src/app/view/home/graph-list/graph-list.component.ts b/src/app/view/home/graph-list/graph-list.component.ts index d6f3148..2c0a9d0 100644 --- a/src/app/view/home/graph-list/graph-list.component.ts +++ b/src/app/view/home/graph-list/graph-list.component.ts @@ -833,7 +833,7 @@ export class GraphListComponent implements OnInit { showgrid: true, }, yaxis: { - title: 'Blocks / sec', + title: 'Seconds / Block', rangemode: 'nonnegative', fixedrange: true, showgrid: true, diff --git a/src/app/view/home/latestblocks/latestblocks.component.html b/src/app/view/home/latestblocks/latestblocks.component.html index f53b7fc..b2fd220 100644 --- a/src/app/view/home/latestblocks/latestblocks.component.html +++ b/src/app/view/home/latestblocks/latestblocks.component.html @@ -168,33 +168,33 @@
-
-
+
+
Capabilities
-
-
+
+
User Agent
-
+
Version
-
+
Addr
-
-
+
+
Direction
-
+
Total Difficulty
@@ -255,7 +255,7 @@ {{ peer.user_agent }}
-
+
Version
{{ peer.version }} @@ -274,9 +274,9 @@
-
+
Total Difficulty
- {{ peer.total_difficulty.cuckaroo }},{{ peer.total_difficulty.cuckatoo}},{{ peer.total_difficulty.progpow}},{{ peer.total_difficulty.randomx}} + {{ peer.total_difficulty.cuckaroo }},{{ peer.total_difficulty.cuckatoo}},{{ peer.total_difficulty.progpow}},{{ peer.total_difficulty.randomx}}
diff --git a/src/assets/css/responsive.css b/src/assets/css/responsive.css index bfeb187..a683a4b 100644 --- a/src/assets/css/responsive.css +++ b/src/assets/css/responsive.css @@ -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){ diff --git a/src/assets/css/style.css b/src/assets/css/style.css index fc27450..b9e217d 100644 --- a/src/assets/css/style.css +++ b/src/assets/css/style.css @@ -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;