forked from LaconicNetwork/cosmos-explorer
add status alert in uptime
This commit is contained in:
parent
91101648fc
commit
b35fca9b05
@ -10,6 +10,14 @@
|
|||||||
placeholder="Keywords to filter validators"
|
placeholder="Keywords to filter validators"
|
||||||
/>
|
/>
|
||||||
</b-card>
|
</b-card>
|
||||||
|
<b-alert
|
||||||
|
variant="danger"
|
||||||
|
:show="syncing"
|
||||||
|
>
|
||||||
|
<div class="alert-body">
|
||||||
|
<span>No new block is produced since <strong>{{ latestTime }}</strong> </span>
|
||||||
|
</div>
|
||||||
|
</b-alert>
|
||||||
<b-row>
|
<b-row>
|
||||||
<b-col
|
<b-col
|
||||||
v-for="(x,index) in uptime"
|
v-for="(x,index) in uptime"
|
||||||
@ -44,10 +52,10 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {
|
import {
|
||||||
BRow, BCol, VBTooltip, BFormInput, BCard,
|
BRow, BCol, VBTooltip, BFormInput, BCard, BAlert,
|
||||||
} from 'bootstrap-vue'
|
} from 'bootstrap-vue'
|
||||||
|
|
||||||
import { consensusPubkeyToHexAddress } from '@/libs/data'
|
import { consensusPubkeyToHexAddress, timeIn, toDay } from '@/libs/data'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@ -55,6 +63,7 @@ export default {
|
|||||||
BCol,
|
BCol,
|
||||||
BFormInput,
|
BFormInput,
|
||||||
BCard,
|
BCard,
|
||||||
|
BAlert,
|
||||||
},
|
},
|
||||||
directives: {
|
directives: {
|
||||||
'b-tooltip': VBTooltip,
|
'b-tooltip': VBTooltip,
|
||||||
@ -65,6 +74,8 @@ export default {
|
|||||||
validators: [],
|
validators: [],
|
||||||
missing: {},
|
missing: {},
|
||||||
blocks: Array.from('0'.repeat(50)).map(x => ({ sigs: {}, height: Number(x) })),
|
blocks: Array.from('0'.repeat(50)).map(x => ({ sigs: {}, height: Number(x) })),
|
||||||
|
syncing: false,
|
||||||
|
latestTime: '',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -84,12 +95,19 @@ export default {
|
|||||||
},
|
},
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
this.blocks = [] // clear running tasks if it is not finish
|
this.blocks = [] // clear running tasks if it is not finish
|
||||||
|
this.syncing = false
|
||||||
clearInterval(this.timer)
|
clearInterval(this.timer)
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
initBlocks() {
|
initBlocks() {
|
||||||
this.$http.getLatestBlock().then(d => {
|
this.$http.getLatestBlock().then(d => {
|
||||||
const { height } = d.block.last_commit
|
const { height } = d.block.last_commit
|
||||||
|
if (timeIn(d.block.header.time, 3, 'm')) {
|
||||||
|
this.syncing = true
|
||||||
|
} else {
|
||||||
|
this.syncing = false
|
||||||
|
}
|
||||||
|
this.latestTime = toDay(d.block.header.time, 'long')
|
||||||
const blocks = []
|
const blocks = []
|
||||||
// update height
|
// update height
|
||||||
let promise = Promise.resolve()
|
let promise = Promise.resolve()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user