diff --git a/public/index.html b/public/index.html index 0c1a4ce5..63d5b490 100644 --- a/public/index.html +++ b/public/index.html @@ -24,7 +24,7 @@
diff --git a/src/layouts/components/Navbar.vue b/src/layouts/components/Navbar.vue index 7125a20d..5304738c 100644 --- a/src/layouts/components/Navbar.vue +++ b/src/layouts/components/Navbar.vue @@ -44,7 +44,7 @@ size="42" :src="selected_chain.logo" class="badge-minimal" - :badge-variant="chainVariant" + :badge-variant="variant" /> @@ -166,22 +166,31 @@ export default { }, data() { return { - chainVariant: 'success', + variant: 'success', tips: 'Synced', } }, computed: { selected_chain() { + this.block() return store.state.chains.selected }, + chainVariant() { + return this.variant + }, }, - created() { - this.$http.getLatestBlock().then(block => { - if (timeIn(block.block.header.time, 1, 'm')) { - this.chainVariant = 'danger' - this.tips = `Halted ${toDay(block.block.header.time, 'from')} ` - } - }) + methods: { + block() { + store.commit('setHeight', 0) + this.$http.getLatestBlock().then(block => { + store.commit('setHeight', Number(block.block.header.height)) + this.tips = `Synced height:${block.block.header.height}` + if (timeIn(block.block.header.time, 1, 'm')) { + this.variant = 'danger' + this.tips = `Halted ${toDay(block.block.header.time, 'from')}, Height: ${store.state.chains.height} ` + } + }) + }, }, } diff --git a/src/libs/fetch.js b/src/libs/fetch.js index e74192a7..7db5292f 100644 --- a/src/libs/fetch.js +++ b/src/libs/fetch.js @@ -112,6 +112,10 @@ const chainAPI = class ChainFetch { }) } + async getValidatorListByHeight(height) { + return this.get(`/validatorsets/${height}`).then(data => commonProcess(data)) + } + async getStakingValidator(address) { return this.get(`/staking/validators/${address}`).then(data => new Validator().init(commonProcess(data))) } diff --git a/src/store/chains/index.js b/src/store/chains/index.js index fc438183..e43cbddc 100644 --- a/src/store/chains/index.js +++ b/src/store/chains/index.js @@ -46,6 +46,7 @@ export default { config: chains, selected, avatars: {}, + height: 0, }, getters: { getchains: state => state.chains, @@ -61,7 +62,9 @@ export default { cacheAvatar(state, args) { state.chains.avatars[args.identity] = args.url }, - + setHeight(state, height) { + state.chains.height = height + }, }, actions: {}, } diff --git a/src/views/ArrayFieldComponent.vue b/src/views/ArrayFieldComponent.vue index d2266a39..12581a38 100644 --- a/src/views/ArrayFieldComponent.vue +++ b/src/views/ArrayFieldComponent.vue @@ -4,7 +4,7 @@ :items="tablefield" :sticky-header="true" :no-border-collapse="true" - responsive + responsive="sm" class="ml-0 mr-0" >