From 9cd18e155d6625d88466acf19b1ea93fc087219e Mon Sep 17 00:00:00 2001 From: Satinder Grewal Date: Mon, 6 Feb 2017 04:17:01 +1300 Subject: [PATCH] Basilisk refresh connections code updated --- assets/scripts/iguana_api.js | 28 ++++++++++++++++++---------- index.html | 9 +++++---- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/assets/scripts/iguana_api.js b/assets/scripts/iguana_api.js index b618260..682cca8 100644 --- a/assets/scripts/iguana_api.js +++ b/assets/scripts/iguana_api.js @@ -1162,20 +1162,15 @@ function EDEX_DEXgetinfoAll() { var get_dex_notarychains = EDEX_DEXnotarychains(); console.log(get_dex_notarychains.length) - //var refresh_percent = ''; + var refresh_percent = ''; $.each(get_dex_notarychains, function( coin_index, coin_value ) { console.log(coin_index + ': ' + coin_value); - //var refresh_percent = parseFloat(parseInt(coin_index, 10) * 100)/ parseInt(get_dex_notarychains.length, 10); - //console.log(refresh_percent) - //$('#basilisk-connections-refresh-title').text(coin_value); - //$('#basilisk-connections-refresh-percent').text(refresh_percent+'%'); - //$('#basilisk-connections-refresh-progress-bar').width(refresh_percent+'%') var tmpIguanaRPCAuth = 'tmpIgRPCUser@'+sessionStorage.getItem('IguanaRPCAuth'); var ajax_data = {'userpass':tmpIguanaRPCAuth,"agent":"dex","method":"getinfo","symbol":coin_value} //console.log(ajax_data); $.ajax({ - async: false, + //async: false, type: 'POST', data: JSON.stringify(ajax_data), url: 'http://127.0.0.1:7778', @@ -1184,12 +1179,28 @@ function EDEX_DEXgetinfoAll() { var AjaxOutputData = JSON.parse(data); //Ajax output gets the whole list of unspent coin with addresses console.log('== EDEX_DEXgetinfoAll Data OutPut =='); console.log(AjaxOutputData); + + var tmp_index = parseInt(coin_index) + 1 + var refresh_percent = parseFloat(parseInt(coin_index, 10) * 100)/ parseInt(get_dex_notarychains.length, 10); + console.log(refresh_percent) + $('#basilisk-connections-refresh-title').text('Connection status... ' + tmp_index + '/' + get_dex_notarychains.length + ': ' + coin_value); + $('#basilisk-connections-refresh-percent').text(refresh_percent+'%'); + $('#basilisk-connections-refresh-progress-bar').width(refresh_percent+'%') + if (AjaxOutputData == '' ) { result.push([{"amount":0}]); } result.push(AjaxOutputData); if (AjaxOutputData.error === 'less than required responses') { toastr.info("Less than required responses for "+coin_value+".", "Basilisk Notification") + $('#basilisk-connections-refresh-status-output').text('Output: ' + AjaxOutputData.error) + } else { + $('#basilisk-connections-refresh-status-output').text('Output: Connected') + } + if ( tmp_index == get_dex_notarychains.length ) { + $('#basilisk-connections-refresh-progress-bar').width('100%') + $('#RefreshBasiliskConnectionsMdl').modal('hide') + toastr.success("Basilsk nodes connections refreshed.", "Basilisk Notification") } }, error: function(xhr, textStatus, error) { @@ -1202,9 +1213,6 @@ function EDEX_DEXgetinfoAll() { } }); }); - //$('#basilisk-connections-refresh-progress-bar').width('100%') - $('#RefreshBasiliskConnectionsMdl').modal('hide') - toastr.success("Basilsk nodes connections refreshed.", "Basilisk Notification") //console.log(result); NProgress.done(); diff --git a/index.html b/index.html index fdda8b9..75f7722 100755 --- a/index.html +++ b/index.html @@ -90,7 +90,7 @@