This commit is contained in:
SuriyaR 2019-08-02 18:24:58 +05:30
parent cfa2a7f0bf
commit 6652ee583b
4 changed files with 78 additions and 63 deletions

View File

@ -16,7 +16,7 @@ import {
TransactionFeeDto, TransactionFeeDto,
} from '../dtos'; } from '../dtos';
import { Paginate } from '../utils'; import { Paginate } from '../utils';
const https = require('https'); const http = require('http');
var moment = require('moment'); var moment = require('moment');
@ -490,10 +490,10 @@ export class BlockchainKernelController {
lang: lang lang: lang
}, },
}); */ }); */
console.log(path.resolve(__dirname + '/../i18n/'+request.query.lang+'.json')); console.log(path.resolve(__dirname + '/../i18n/' + request.query.lang + '.json'));
console.log("Without :",path.resolve('/../i18n/'+request.query.lang+'.json')); console.log("Without :", path.resolve('/../i18n/' + request.query.lang + '.json'));
response.header("Content-Type",'application/json'); response.header("Content-Type", 'application/json');
response.sendFile(path.resolve(__dirname + '/../i18n/'+request.query.lang+'.json')); response.sendFile(path.resolve(__dirname + '/../i18n/' + request.query.lang + '.json'));
} catch (error) { } catch (error) {
next(new InternalServerErrorException(error)); next(new InternalServerErrorException(error));
@ -506,14 +506,29 @@ export class BlockchainKernelController {
next: NextFunction, next: NextFunction,
) => { ) => {
try { try {
https.get('http://5.9.174.122:3413/v1/peers/connected', (resp) => { http.get('http://5.9.174.122:3413/v1/peers/connected', (resp) => {
console.log('resp resp respresp',resp); // console.log('resp resp respresp',resp);
let data = ''; let data = '';
// A chunk of data has been recieved. // A chunk of data has been recieved.
resp.on('data', function (chunk) {
}); data += chunk;
let dataJson = JSON.parse(data);
dataJson.forEach(function (value, i) {
value['id'] = i;
});
response.status(200).json({
status: 200,
timestamp: Date.now(),
message: 'Peers list fetched successfully',
response: {
dataJson
},
});
});
});
} catch (error) { } catch (error) {
console.log('error 3###########', error);
next(new InternalServerErrorException(error)); next(new InternalServerErrorException(error));
} }
}; };

View File

@ -272,9 +272,9 @@
</div> </div>
</div> </div>
<div class="col-6 col-md-3 tble_col"> <div class="col-6 col-md-3 tble_col">
<div class="block_div"> <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 }}">
<h6>Total Difficulty</h6> <h6>Total Difficulty</h6>
<span class="blck_value">{{ peer.total_difficulty.cuckaroo }},{{ peer.total_difficulty.cuckatoo}},{{ peer.total_difficulty.randomx}},{{ peer.total_difficulty.progpow}}</span> <span class="blck_value peers_diff">{{ peer.total_difficulty.cuckaroo }},{{ peer.total_difficulty.cuckatoo}},{{ peer.total_difficulty.progpow}},{{ peer.total_difficulty.randomx}}</span>
</div> </div>
</div> </div>
</div> </div>

View File

@ -47,21 +47,15 @@ export class LatestblocksComponent implements OnInit {
} }
public getpeersList() { public getpeersList() {
const httpOptions = { this.chartService.apiGetRequest('','/blockchain_kernel/getpeers').subscribe(
headers: new HttpHeaders({ res => {
'Access-Control-Allow-Origin':'*' if (res['status'] == 200) {
}) this.peers = res.response.dataJson;
}; }
},
this.http error => {},
.get('http://5.9.174.122:3413/v1/peers/connected',httpOptions) );
.subscribe((res) => { // this.peers = [{"id": 1,"capabilities":{"bits":15},"user_agent":"MW/Epic 1.0.0","version":1,"addr":"54.233.177.64:3414","direction":"Outbound","total_difficulty":{"cuckaroo":1630,"cuckatoo":706,"randomx":138024,"progpow":49792},"height":10},{"id": 2,"capabilities":{"bits":15},"user_agent":"MW/Epic 1.0.0","version":1,"addr":"95.216.102.217:3414","direction":"Outbound","total_difficulty":{"cuckaroo":1630,"cuckatoo":706,"randomx":138024,"progpow":49792},"height":10},{"id": 3,"capabilities":{"bits":15},"user_agent":"MW/Epic 1.0.0","version":1,"addr":"90.190.172.177:3414","direction":"Outbound","total_difficulty":{"cuckaroo":2,"cuckatoo":2,"randomx":1024,"progpow":256},"height":0},{"id": 4,"capabilities":{"bits":15},"user_agent":"MW/Epic 1.0.0","version":1,"addr":"67.189.82.196:3414","direction":"Outbound","total_difficulty":{"cuckaroo":1630,"cuckatoo":706,"randomx":138024,"progpow":49792},"height":10},{"id": 5,"capabilities":{"bits":15},"user_agent":"MW/Epic 1.0.0","version":1,"addr":"167.71.72.2:3414","direction":"Outbound","total_difficulty":{"cuckaroo":1630,"cuckatoo":706,"randomx":138024,"progpow":49792},"height":10}];
console.log('reeeee',res);
// this.peers = res;
console.log('this.peers',this.peers);
});
this.peers = [{"id": 1,"capabilities":{"bits":15},"user_agent":"MW/Epic 1.0.0","version":1,"addr":"54.233.177.64:3414","direction":"Outbound","total_difficulty":{"cuckaroo":1630,"cuckatoo":706,"randomx":138024,"progpow":49792},"height":10},{"id": 2,"capabilities":{"bits":15},"user_agent":"MW/Epic 1.0.0","version":1,"addr":"95.216.102.217:3414","direction":"Outbound","total_difficulty":{"cuckaroo":1630,"cuckatoo":706,"randomx":138024,"progpow":49792},"height":10},{"id": 3,"capabilities":{"bits":15},"user_agent":"MW/Epic 1.0.0","version":1,"addr":"90.190.172.177:3414","direction":"Outbound","total_difficulty":{"cuckaroo":2,"cuckatoo":2,"randomx":1024,"progpow":256},"height":0},{"id": 4,"capabilities":{"bits":15},"user_agent":"MW/Epic 1.0.0","version":1,"addr":"67.189.82.196:3414","direction":"Outbound","total_difficulty":{"cuckaroo":1630,"cuckatoo":706,"randomx":138024,"progpow":49792},"height":10},{"id": 5,"capabilities":{"bits":15},"user_agent":"MW/Epic 1.0.0","version":1,"addr":"167.71.72.2:3414","direction":"Outbound","total_difficulty":{"cuckaroo":1630,"cuckatoo":706,"randomx":138024,"progpow":49792},"height":10}];
} }

View File

@ -632,3 +632,9 @@ margin-right: 10px;
min-width: 5rem; min-width: 5rem;
padding: 0; padding: 0;
} }
.peers_diff{
width: 160px;
overflow: hidden;
display: inline-block;
text-overflow: ellipsis;
}