Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chooseFilter for pagevalidator. fix website #3289

Merged
merged 8 commits into from
Dec 17, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changes/ana_add-choosefilter-for-pagevalidator
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[Changed] [#3289](https://github.com/cosmos/lunie/pull/3289) Now PageValidator handles empty fields more uniformly, always displaying `--` @Bitcoinera
21 changes: 13 additions & 8 deletions src/components/staking/PageValidator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
</li>
<li class="column">
<h4>Website</h4>
<span v-if="validator.website !== ``">
<span v-if="validator.website">
<a
id="validator-website"
:href="validator.website + `?ref=lunie`"
Expand Down Expand Up @@ -114,25 +114,25 @@
</li>
<li>
<h4>Uptime</h4>
<span id="page-profile__uptime">
{{ validator.uptimePercentage | percent }}
</span>
<span id="page-profile__uptime">{{
chooseFilter(validator.uptimePercentage)
}}</span>
</li>
<li>
<h4>Current Commission Rate</h4>
<span>{{ validator.commission | percent }}</span>
<span>{{ chooseFilter(validator.commission) }}</span>
</li>
<li>
<h4>Max Commission Rate</h4>
<span>{{ validator.maxCommission | percent }}</span>
<span>{{ chooseFilter(validator.maxCommission) }}</span>
</li>
<li>
<h4>Max Daily Commission Change</h4>
<span>{{ validator.maxChangeCommission | percent }}</span>
<span>{{ chooseFilter(validator.maxChangeCommission) }}</span>
</li>
<li>
<h4>Last Commission Change</h4>
<span>{{ validator.commissionUpdateTime | fromNow }}</span>
<span>{{ chooseFilter(validator.commissionLastUpdate) }}</span>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this would use the percent filter. remember the thing I said about setting the filter as the second parameter. maybe investigate if filters can act on the initial value

Copy link
Contributor Author

@Bitcoinera Bitcoinera Dec 14, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. I just changed it to accept a filter as a second parameter. Using either of the filters first doesn't work. They are incompatible.

</li>
</ul>

Expand Down Expand Up @@ -251,6 +251,11 @@ export default {
`undelegations`,
`transactions`
]) // TODO use more finegrained query string (network and address)
},
chooseFilter(field) {
return field
? this.$options.filters.percent(field)
: this.$options.filters.noBlanks(field)
}
},
apollo: {
Expand Down