Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Erialos 2022-10-08 11:39:11 -06:00
commit b88cce7b5a
4 changed files with 36 additions and 24 deletions

View File

@ -23,10 +23,6 @@ export default class Proposal {
this.id = element.proposal_id || element.id
this.status = element.status
this.type = element.content.type
if (element.content['@type']) {
this.type = element.content['@type']
}
this.tally = new ProposalTally().init(element.final_tally_result, total)
this.submit_time = element.submit_time
this.voting_end_time = element.voting_end_time
@ -37,6 +33,10 @@ export default class Proposal {
if (this.contents) {
this.title = this.contents.title
this.description = this.contents.description
this.type = element.content.type
if (element.content['@type']) {
this.type = element.content['@type']
}
}
return this
}

View File

@ -1,6 +1,16 @@
<template>
<div>
<b-card title="Block Id">
<b-card>
<b-card-title class="d-flex justify-content-between">
<span>#{{ height }}</span>
<span><b-button
size="sm"
@click="goblock(height-1)"
> &lt; </b-button> <b-button
size="sm"
@click="goblock(Number(height)+1)"
> > </b-button></span>
</b-card-title>
<object-field-component :tablefield="block.block_id" />
</b-card>
@ -42,7 +52,9 @@
</template>
<script>
import { BCard, BTable } from 'bootstrap-vue'
import {
BCard, BTable, BCardTitle, BButton,
} from 'bootstrap-vue'
import { fromBase64 } from '@cosmjs/encoding'
import { decodeTxRaw } from '@cosmjs/proto-signing'
import Tx from '@/libs/data/tx'
@ -52,8 +64,10 @@ import ArrayFieldComponent from './components/ArrayFieldComponent.vue'
export default {
components: {
BButton,
BCard,
BTable,
BCardTitle,
ObjectFieldComponent,
ArrayFieldComponent,
},
@ -68,6 +82,7 @@ export default {
return {
block: { block: { header: {}, data: {}, evidence: {} } },
txs: null,
height: 0,
fields: [
{ key: 'hash' },
{ key: 'fee', formatter: v => tokenFormatter(v) },
@ -82,6 +97,7 @@ export default {
},
methods: {
initData(height) {
this.height = height
this.$http.getBlockByHeight(height).then(res => {
this.block = res
const { txs } = res.block.data
@ -101,6 +117,9 @@ export default {
if (array.length > 0) this.txs = array
})
},
goblock(height) {
this.$router.push({ name: 'block', params: { height } })
},
},
}
</script>

View File

@ -49,14 +49,7 @@
>
<tbody>
<b-tr>
<b-td
style="text-transform: capitalize; vertical-align: top; width:200px"
>
{{ $t('proposal_id') }}
</b-td><b-td>{{ proposal.id }}</b-td>
</b-tr>
<b-tr>
<b-td>
<b-td style="text-transform: capitalize; vertical-align: top; width:200px">
{{ $t('proposal_proposer') }}
</b-td><b-td><router-link :to="`../account/${proposer.proposer}`">
{{ formatAddress(proposer.proposer) }}

View File

@ -15,7 +15,7 @@
<b-td
style="text-transform: capitalize; vertical-align: top;"
>
{{ name }}
{{ formatTitle(name) }}
</b-td>
<b-td v-if="isTokenField(value)">
{{ formatTokens( value ) }}
@ -37,13 +37,12 @@
<b-tabs
v-if="value"
small
class="overflow-hidden"
>
<b-tab
v-for="key in Object.keys(value)"
:key="key"
:title="key"
class="p-0 overflow-hidden"
:title="formatTitle(key)"
class="p-0 text-capitalize"
title-item-class="bg-light-primary"
>
<array-field-component
@ -60,7 +59,7 @@
/>
<div
v-else
style="max-width: 800px; overflow: auto;"
style="max-width: 800px; max-height: 300px; overflow: auto;"
>{{ value[key] }}</div>
</b-tab>
</b-tabs>
@ -71,7 +70,7 @@
</VueMarkdown>
<div
v-else
style="max-width: 800px; word-wrap:normal"
style="max-width: 800px; max-height: 300px; overflow: auto;"
>{{ value }}</div>
</b-td>
</b-tr>
@ -135,6 +134,7 @@ export default {
// }
return value
},
formatTitle: v => v.replaceAll('_', ' '),
isObjectText(v) {
return String(v).startsWith('{') && String(v).endsWith('}')
},
@ -146,16 +146,16 @@ export default {
return Array.from(value)
},
isTokenField(value) {
return isToken(value)
return value ? isToken(value) : false
},
isHex(value) {
return isHexAddress(value)
return value ? isHexAddress(value) : false
},
formatHexAddress(v) {
return getStakingValidatorByHex(this.$http.config.chain_name, v)
},
isArrayText(value) {
return isStringArray(value)
return value ? isStringArray(value) : false
},
formatTokens(value) {
return tokenFormatter(value)
@ -165,7 +165,7 @@ export default {
if (percentage.test(value)) {
return `${percent(value)}%`
}
return value.replace(/(?:\\[rn])+/g, '\n')
return value ? value.replace(/(?:\\[rn])+/g, '\n') : '-'
},
},
}