Browse Source

removed async false in kmd best chain activation func

master
Petr Balashov 8 years ago
parent
commit
9fcd24f2af
  1. 49
      assets/scripts/kmd_wallet_dashboard.js

49
assets/scripts/kmd_wallet_dashboard.js

@ -168,7 +168,7 @@ function CheckIfWalletEncrypted() {
return result; return result;
} }
function KMD_getInfo_rtrn() { function KMD_getInfo_rtrn(cb) {
var result = [], var result = [],
extcoin = $('[data-extcoin]').attr('data-extcoin'), extcoin = $('[data-extcoin]').attr('data-extcoin'),
passthru_agent = getPassthruAgent(), passthru_agent = getPassthruAgent(),
@ -195,7 +195,7 @@ function KMD_getInfo_rtrn() {
} }
$.ajax({ $.ajax({
async: false, //async: true,
type: 'POST', type: 'POST',
data: JSON.stringify(ajax_data), data: JSON.stringify(ajax_data),
url: 'http://127.0.0.1:' + config.iguanaPort, url: 'http://127.0.0.1:' + config.iguanaPort,
@ -211,6 +211,8 @@ function KMD_getInfo_rtrn() {
} else { } else {
result.push(AjaxOutputData.errors); result.push(AjaxOutputData.errors);
} }
cb.call(this, result[0]);
}, },
error: function(xhr, textStatus, error) { error: function(xhr, textStatus, error) {
console.log('failed getting Coin History.'); console.log('failed getting Coin History.');
@ -228,29 +230,32 @@ function KMD_getInfo_rtrn() {
function KMD_ProgressBar() { function KMD_ProgressBar() {
var result = [], var result = [],
extcoin = $('[data-extcoin]').attr('data-extcoin'), extcoin = $('[data-extcoin]').attr('data-extcoin');
getinfotmp = KMD_getInfo_rtrn();
if (extcoin !== 'ZEC') { KMD_getInfo_rtrn(_KMD_ProgressBar);
if ( getinfotmp == 'activating') {
$('span[data-extcoin="' + extcoin + '"][id="extcoin-sync-percent"]').text(_lang[defaultLang].INDEX.ACTIVATING + '...'); function _KMD_ProgressBar(getinfotmp) {
} else { if (extcoin !== 'ZEC') {
if (getinfotmp.blocks === 0) { if ( getinfotmp == 'activating') {
$('span[data-extcoin="' + extcoin + '"][id="extcoin-sync-percent"]').text('No blocks'); $('span[data-extcoin="' + extcoin + '"][id="extcoin-sync-percent"]').text(_lang[defaultLang].INDEX.ACTIVATING + '...');
$('#extcoin-progressbars .progress-bar').css({ 'width': '100%' });
} else if (getinfotmp.blocks > 0 && getinfotmp.longestchain === 0) {
$('span[data-extcoin="' + extcoin + '"][id="extcoin-sync-percent"]').text('No longestchain');
$('#extcoin-progressbars .progress-bar').css({ 'width': '100%' });
} else { } else {
var sync_percent = parseFloat(parseInt(getinfotmp.blocks, 10) * 100) / parseInt(getinfotmp.longestchain, 10); if (getinfotmp.blocks === 0) {
console.log('getinfotmp', getinfotmp); $('span[data-extcoin="' + extcoin + '"][id="extcoin-sync-percent"]').text('No blocks');
$('div[data-extcoin="' + extcoin + '"][id="extcoin-sync"]').width(parseFloat(sync_percent).toFixed(2) + '%'); $('#extcoin-progressbars .progress-bar').css({ 'width': '100%' });
$('span[data-extcoin="' + extcoin + '"][id="extcoin-sync-percent"]').text(parseFloat(sync_percent).toFixed(2) + '%'); } else if (getinfotmp.blocks > 0 && getinfotmp.longestchain === 0) {
$('span[data-extcoin="' + extcoin + '"][id="extcoin-synced-blocks"]').text(getinfotmp.blocks); $('span[data-extcoin="' + extcoin + '"][id="extcoin-sync-percent"]').text('No longestchain');
$('span[data-extcoin="' + extcoin + '"][id="extcoin-longestchain"]').text(getinfotmp.longestchain); $('#extcoin-progressbars .progress-bar').css({ 'width': '100%' });
$('span[data-extcoin="' + extcoin + '"][id="extcoin-connections"]').text(getinfotmp.connections); } else {
var sync_percent = parseFloat(parseInt(getinfotmp.blocks, 10) * 100) / parseInt(getinfotmp.longestchain, 10);
console.log('getinfotmp', getinfotmp);
$('div[data-extcoin="' + extcoin + '"][id="extcoin-sync"]').width(parseFloat(sync_percent).toFixed(2) + '%');
$('span[data-extcoin="' + extcoin + '"][id="extcoin-sync-percent"]').text(parseFloat(sync_percent).toFixed(2) + '%');
$('span[data-extcoin="' + extcoin + '"][id="extcoin-synced-blocks"]').text(getinfotmp.blocks);
$('span[data-extcoin="' + extcoin + '"][id="extcoin-longestchain"]').text(getinfotmp.longestchain);
$('span[data-extcoin="' + extcoin + '"][id="extcoin-connections"]').text(getinfotmp.connections);
}
$('#extcoin-wallet-activating-alert').hide();
} }
$('#extcoin-wallet-activating-alert').hide();
} }
} }
} }
Loading…
Cancel
Save