From 732c6ee92237249eb9497ef87e4461b498035827 Mon Sep 17 00:00:00 2001 From: liangping <18786721@qq.com> Date: Sat, 19 Mar 2022 11:39:17 +0800 Subject: [PATCH] add filter --- src/views/Uptime.vue | 57 +++++++++++++++++++++++-------- src/views/UptimeMyChainBlocks.vue | 28 ++++++++++----- src/views/UptimeMyValidators.vue | 4 +-- 3 files changed, 65 insertions(+), 24 deletions(-) diff --git a/src/views/Uptime.vue b/src/views/Uptime.vue index 3518a77f..188b4b9b 100644 --- a/src/views/Uptime.vue +++ b/src/views/Uptime.vue @@ -19,10 +19,20 @@ > Browse favorite only - + + + + + + {{ index+1 }} {{ x.validator.moniker }} - - {{ missing[x.address].missed_blocks_counter }} - + + {{ missing[x.address].missed_blocks_counter }} + + + 0 + +
import { - BRow, BCol, VBTooltip, BFormInput, BCard, BAlert, BFormCheckbox, BButton, BBadge, + BRow, BCol, VBTooltip, BFormInput, BCard, BAlert, BFormCheckbox, BButton, BBadge, BInputGroup, BInputGroupPrepend, } from 'bootstrap-vue' import { @@ -91,6 +113,8 @@ export default { BButton, BBadge, BFormCheckbox, + BInputGroup, + BInputGroupPrepend, }, directives: { 'b-tooltip': VBTooltip, @@ -99,6 +123,7 @@ export default { const { chain } = this.$route.params const pinned = localStorage.getItem('pinned') ? localStorage.getItem('pinned').split(',') : '' return { + missedFilter: false, pinned, chain, query: '', @@ -113,10 +138,14 @@ export default { uptime() { const vals = this.query ? this.validators.filter(x => String(x.description.moniker).indexOf(this.query) > -1) : this.validators vals.sort((a, b) => b.delegator_shares - a.delegator_shares) - return vals.map(x => ({ + const rets = vals.map(x => ({ validator: x.description, address: consensusPubkeyToHexAddress(x.consensus_pubkey), })) + if (this.missedFilter) { + return rets.filter(x => this.missing[x.address].missed_blocks_counter > 0) + } + return rets }, }, created() { diff --git a/src/views/UptimeMyChainBlocks.vue b/src/views/UptimeMyChainBlocks.vue index 84dcbad4..7abcb12d 100644 --- a/src/views/UptimeMyChainBlocks.vue +++ b/src/views/UptimeMyChainBlocks.vue @@ -32,15 +32,27 @@ > {{ x.validator.moniker }} - - {{ missing[x.address].missed_blocks_counter }} - + + {{ missing[x.address].missed_blocks_counter }} + + + 0 + +
- There are two ways to monitor your valdiators: -
  • Pin a validator on Uptime page.
  • + There are two ways to monitor your validators: +
  • Pin a validator on Uptime pages.
  • Specify parameters like following:
    https://ping.pub/cosmos/uptime/my?validators={"sifchain":["FBADE9A30473BB9ED6DFA16BFB3838E028F33650"],"chain_name":["hexAddress"]}