|
|
@ -13,31 +13,73 @@ const statusScript = { |
|
|
|
}, |
|
|
|
|
|
|
|
refreshApiStatus: function() { |
|
|
|
// Set default values displayed
|
|
|
|
this.setStatusIndicator('#db-status-ind', 'idle') |
|
|
|
this.setStatusIndicator('#tracker-status-ind', 'idle') |
|
|
|
this.setStatusIndicator('#indexer-status-ind', 'idle') |
|
|
|
$('#tracker-uptime').text('-') |
|
|
|
$('#tracker-chaintip').text('-') |
|
|
|
$('#db-chaintip').text('-') |
|
|
|
$('#indexer-chaintip').text('-') |
|
|
|
$('#indexer-type').text('-') |
|
|
|
$('#indexer-url').text('-') |
|
|
|
|
|
|
|
//lib_msg.displayMessage('Loading API status info...');
|
|
|
|
return lib_api.getApiStatus().then(apiStatus => { |
|
|
|
if (apiStatus) { |
|
|
|
$('#tracker-status-ind').html('✓') |
|
|
|
$('#tracker-status-ind').css('color', '#76d776') |
|
|
|
$('#tracker-uptime').text(apiStatus['uptime']) |
|
|
|
$('#tracker-chaintip').text(apiStatus['blocks']) |
|
|
|
|
|
|
|
const blocks = apiStatus['blocks'] |
|
|
|
if (blocks) { |
|
|
|
$('#db-chaintip').text(blocks) |
|
|
|
$('#tracker-chaintip').text(blocks) |
|
|
|
this.setStatusIndicator('#db-status-ind', 'ok') |
|
|
|
this.setStatusIndicator('#tracker-status-ind', 'ok') |
|
|
|
} else { |
|
|
|
this.setStatusIndicator('#db-status-ind', 'ko') |
|
|
|
this.setStatusIndicator('#tracker-status-ind', 'ko') |
|
|
|
} |
|
|
|
|
|
|
|
if (apiStatus['indexer']) { |
|
|
|
const indexerMaxHeight = apiStatus['indexer']['maxHeight'] |
|
|
|
if (indexerMaxHeight) { |
|
|
|
$('#indexer-chaintip').text(indexerMaxHeight) |
|
|
|
this.setStatusIndicator('#indexer-status-ind', 'ok') |
|
|
|
} else { |
|
|
|
this.setStatusIndicator('#indexer-status-ind', 'ko') |
|
|
|
} |
|
|
|
const indexerType = apiStatus['indexer']['type'] |
|
|
|
if (indexerType) |
|
|
|
$('#indexer-type').text(indexerType.replace(/_/g, ' ')) |
|
|
|
const indexerUrl = apiStatus['indexer']['url'] |
|
|
|
if (indexerUrl) |
|
|
|
$('#indexer-url').text(indexerUrl) |
|
|
|
} |
|
|
|
//lib_msg.cleanMessagesUi()
|
|
|
|
} |
|
|
|
}).catch(e => { |
|
|
|
$('#tracker-status-ind').text('X') |
|
|
|
$('#tracker-status-ind').css('color', '#f77c7c') |
|
|
|
$('#tracker-uptime').text('-') |
|
|
|
$('#tracker-chaintip').text('-') |
|
|
|
this.setStatusIndicator('#db-status-ind', 'ko') |
|
|
|
this.setStatusIndicator('#tracker-status-ind', 'ko') |
|
|
|
this.setStatusIndicator('#indexer-status-ind', 'ko') |
|
|
|
lib_errors.processError(e) |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
refreshPushTxStatus: function() { |
|
|
|
// Set default values displayed
|
|
|
|
this.setStatusIndicator('#node-status-ind', 'idle') |
|
|
|
$('#node-uptime').text('-') |
|
|
|
$('#node-chaintip').text('-') |
|
|
|
$('#node-version').text('-') |
|
|
|
$('#node-network').text('-') |
|
|
|
$('#node-conn').text('-') |
|
|
|
$('#node-relay-fee').text('-') |
|
|
|
|
|
|
|
//lib_msg.displayMessage('Loading Tracker status info...');
|
|
|
|
lib_api.getPushtxStatus().then(pushTxStatus => { |
|
|
|
if (pushTxStatus) { |
|
|
|
const data = pushTxStatus['data'] |
|
|
|
$('#node-status-ind').html('✓') |
|
|
|
$('#node-status-ind').css('color', '#76d776') |
|
|
|
this.setStatusIndicator('#node-status-ind', 'ok') |
|
|
|
const uptime = lib_cmn.timePeriod(data['uptime']) |
|
|
|
$('#node-uptime').text(uptime) |
|
|
|
$('#node-chaintip').text(data['bitcoind']['blocks']) |
|
|
@ -49,18 +91,24 @@ const statusScript = { |
|
|
|
//lib_msg.cleanMessagesUi()
|
|
|
|
} |
|
|
|
}).catch(e => { |
|
|
|
$('#node-status-ind').text('-') |
|
|
|
$('#node-status-ind').css('color', '#f77c7c') |
|
|
|
$('#node-uptime').text('-') |
|
|
|
$('#node-chaintip').text('-') |
|
|
|
$('#node-version').text('-') |
|
|
|
$('#node-network').text('-') |
|
|
|
$('#node-conn').text('-') |
|
|
|
$('#node-relay-fee').text('-') |
|
|
|
this.setStatusIndicator('#node-status-ind', 'ko') |
|
|
|
lib_errors.processError(e) |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
setStatusIndicator: function(id, status) { |
|
|
|
if (status == 'ok') { |
|
|
|
$(id).html('✓') |
|
|
|
$(id).css('color', '#76d776') |
|
|
|
} else if (status == 'ko') { |
|
|
|
$(id).html('X') |
|
|
|
$(id).css('color', '#f77c7c') |
|
|
|
} else { |
|
|
|
$(id).html('-') |
|
|
|
$(id).css('color', '#efefef') |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
screenScripts.set('#screen-status', statusScript) |