Browse Source

add db and indexer blocks to status dashboard

use-env-var-docker
kenshin-samourai 4 years ago
parent
commit
9205ed1c5c
  1. 4
      static/admin/css/style.css
  2. 47
      static/admin/dmt/status/status.html
  3. 82
      static/admin/dmt/status/status.js

4
static/admin/css/style.css

@ -453,6 +453,10 @@ button {
color: #76d776;
}
#indexer-status {
padding-bottom: 12px;
}
/* PAGES - PAIRING */
#qr-label,
#qr-explorer-label {

47
static/admin/dmt/status/status.html

@ -5,6 +5,7 @@
<div class="row box-main">
<div id="left-column" class="two-columns-left">
<div id="bitcoind-status" class="fullwidth box">
<div class="box-header">FULL NODE</div>
<div class="spacer10"></div>
@ -41,8 +42,36 @@
</table>
</div>
</div>
<div id="indexer-status" class="fullwidth box">
<div class="box-header">INDEXER</div>
<div class="spacer10"></div>
<div class="box-body">
<table>
<tr>
<td class="table-label">Status</td>
<td class="table-value" id="indexer-status-ind"></td>
</tr>
<tr>
<td class="table-label">Latest block</td>
<td class="table-value" id="indexer-chaintip"></td>
</tr>
<tr>
<td class="table-label">Indexer type</td>
<td class="table-value" id="indexer-type"></td>
</tr>
<tr>
<td class="table-label">URL</td>
<td class="table-value" id="indexer-url"></td>
</tr>
</table>
</div>
</div>
</div>
<div id="right-column" class="two-columns-right">
<div id="tracker-status" class="fullwidth box">
<div class="box-header">TRACKER</div>
<div class="spacer10"></div>
@ -64,6 +93,23 @@
</div>
</div>
<div id="db-status" class="fullwidth box">
<div class="box-header">DOJO DB</div>
<div class="spacer10"></div>
<div class="box-body">
<table>
<tr>
<td class="table-label">Status</td>
<td class="table-value" id="db-status-ind">&#10003;</td>
</tr>
<tr>
<td class="table-label">Latest block</td>
<td class="table-value" id="db-chaintip"></td>
</tr>
</table>
</div>
</div>
<div id="web-status" class="fullwidth box">
<div class="box-header">WEB</div>
<div class="spacer10"></div>
@ -84,6 +130,7 @@
</table>
</div>
</div>
</div>
</div>

82
static/admin/dmt/status/status.js

@ -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('&#10003;')
$('#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('&#10003;')
$('#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('&#10003;')
$(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)
Loading…
Cancel
Save