From 6653ce791c928f4a00fcdac49fda467350e41e6a Mon Sep 17 00:00:00 2001 From: liangping <18786721@qq.com> Date: Tue, 16 May 2023 20:07:26 +0800 Subject: [PATCH] add overall --- src/modules/[chain]/uptime/index.vue | 159 ++++++++++++++++----------- 1 file changed, 95 insertions(+), 64 deletions(-) diff --git a/src/modules/[chain]/uptime/index.vue b/src/modules/[chain]/uptime/index.vue index 45b76c4c..9f25e1ab 100644 --- a/src/modules/[chain]/uptime/index.vue +++ b/src/modules/[chain]/uptime/index.vue @@ -16,9 +16,10 @@ import type { SigningInfo } from '@/types/slashing'; const props = defineProps(['chain']); const stakingStore = useStakingStore(); +const format = useFormatter(); const baseStore = useBaseStore(); const chainStore = useBlockchain(); -const latest = ref({} as Block); +const latest = ref(0); const commits = ref([] as Commit[]); const keyword = ref(''); const live = ref(true); @@ -34,10 +35,18 @@ const validators = computed(() => { return stakingStore.validators; }); +const list = computed(() => { + return validators.value.map(v => ({ + v, + signing: signingInfo.value[consensusPubkeyToHexAddress(v.consensus_pubkey)], + hex: toBase64(fromHex(consensusPubkeyToHexAddress(v.consensus_pubkey))) + })) +}) + onMounted(() => { live.value = true; baseStore.fetchLatest().then(b => { - latest.value = b; + latest.value = Number(b.block.header.height); commits.value.unshift(b.block.last_commit); const height = Number(b.block.header?.height || 0); if (height === 0) { @@ -72,80 +81,102 @@ onMounted(() => { const commits2 = computed(() => { const la = baseStore.recents.map(b => b.block.last_commit) const all = [...commits.value, ...la] - return all.length > 50 ? all.slice(all.length - 50): all + return all.length > 50 ? all.slice(all.length - 50) : all }) onUnmounted(() => { live.value = false; }); +const tab = ref("3") +function changeTab(v: string) { + tab.value = v +} - -// watchEffect((x) => { -// const list = selected.value.map(x => { -// const val = stakingStore.validators.find(v => v.operator_address === x) -// return { -// name: val?.description.moniker || "", -// address: x -// } -// }) -// local.value[chainStore.chainName] = list; -// localStorage.setItem('uptime-validators', JSON.stringify(local.value)); -// });