From b06e2623b7e99e1d21f4e0ee3ff550406064fae2 Mon Sep 17 00:00:00 2001
From: liangping <18786721@qq.com>
Date: Tue, 21 Sep 2021 08:18:53 +0800
Subject: [PATCH] Change color for unloaded status
---
src/views/Uptime.vue | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/src/views/Uptime.vue b/src/views/Uptime.vue
index c25eed0a..1cf14beb 100644
--- a/src/views/Uptime.vue
+++ b/src/views/Uptime.vue
@@ -29,7 +29,7 @@
@@ -102,9 +102,9 @@ export default {
}
}
- const sigs = {}
+ const sigs = this.initColor()
d.block.last_commit.signatures.forEach(x => {
- sigs[x.validator_address] = !!x.signature
+ if (x.validator_address) sigs[x.validator_address] = 'bg-success'
})
blocks.push({ sigs, height })
this.blocks = blocks
@@ -112,14 +112,21 @@ export default {
this.timer = setInterval(this.fetch_latest, 6000)
})
},
+ initColor() {
+ const sigs = {}
+ this.validators.forEach(x => {
+ sigs[consensusPubkeyToHexAddress(x.consensus_pubkey)] = 'bg-danger'
+ })
+ return sigs
+ },
fetch_status(height, resolve) {
const block = this.blocks.find(b => b.height === height)
if (block) {
this.$http.getBlockByHeight(height).then(res => {
resolve()
- const sigs = {}
+ const sigs = this.initColor()
res.block.last_commit.signatures.forEach(x => {
- sigs[x.validator_address] = !!x.signature
+ if (x.validator_address) sigs[x.validator_address] = 'bg-success'
})
this.$set(block, 'sigs', sigs)
})
@@ -127,9 +134,9 @@ export default {
},
fetch_latest() {
this.$http.getLatestBlock().then(res => {
- const sigs = {}
+ const sigs = this.initColor()
res.block.last_commit.signatures.forEach(x => {
- sigs[x.validator_address] = !!x.signature
+ if (x.validator_address) sigs[x.validator_address] = 'bg-success'
})
const block = this.blocks.find(b => b[1] === res.block.last_commit.height)
if (typeof block === 'undefined') { // mei