Skip to content

Commit

Permalink
e2es failing because of local storage
Browse files Browse the repository at this point in the history
  • Loading branch information
okwme committed Aug 16, 2018
1 parent 1634d83 commit a8db29a
Show file tree
Hide file tree
Showing 15 changed files with 107 additions and 86 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
* cache per network to not have side effects between networks @faboweb
* publish script on CI now requires all tests to pass, so we are sure that the published Version runs @ƒaboweb
* disable interaction buttons if not connected to the network, so user do not expect working interaction @faboweb
* changed ATOM to bondingDenom getter @okwme

### Fixed

Expand Down
22 changes: 12 additions & 10 deletions app/src/renderer/components/common/TmOnboarding.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default {
name: "tm-onboarding",
components: { TmBtn, TmBarDiscrete },
computed: {
...mapGetters(["onboarding"]),
...mapGetters(["onboarding", "bondingDenom"]),
activeKey() {
return this.onboarding.state
},
Expand All @@ -36,17 +36,19 @@ export default {
return require(`../../assets/images/onboarding/step-${
this.activeKey
}.png`)
},
nodes() {
return [
"This is a quick tour of the primary features of Cosmos Voyager.",
"You can send and receive Cosmos tokens from anyone around the world.",
`You can stake your ${
this.bondingDenom
}s to Cosmos Validators to earn even more ${this.bondingDenom}s.`,
"Through governance, you can vote on the future of the Cosmos Network.",
"Start using Voyager to explore the Cosmos Network!"
]
}
},
data: () => ({
nodes: [
"This is a quick tour of the primary features of Cosmos Voyager.",
"You can send and receive Cosmos tokens from anyone around the world.",
"You can stake your Atoms to Cosmos Validators to earn even more Atoms.",
"Through governance, you can vote on the future of the Cosmos Network.",
"Start using Voyager to explore the Cosmos Network!"
]
}),
methods: {
go(state) {
this.$store.commit("setOnboardingState", state)
Expand Down
6 changes: 5 additions & 1 deletion app/src/renderer/components/govern/PageProposalsNew.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,20 @@ tm-page(title='New Proposal')
tm-part(title='Choose a Type')
tm-list-item(title='Adjust Parameters' to="/proposals/new/adjust")
tm-list-item(title='Amend Constitution' to="/proposals/new/amend")
tm-list-item(title='Create Atoms' to="/proposals/new/create")
tm-list-item(:title='`Create ${bondingDenom}s`' to="/proposals/new/create")
tm-list-item(title='Plain Text' to="/proposals/new/text")
tm-list-item(title='Upgrade Code' to="/proposals/new/upgrade")
</template>

<script>
import { mapGetters } from "vuex"
import { TmListItem, TmPage, TmPart } from "@tendermint/ui"
import ToolBar from "common/TmToolBar"
export default {
name: "page-proposals-new",
computed: {
...mapGetters(["bondingDenom"])
},
components: {
TmListItem,
TmPage,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template lang="pug">
tm-page(title="Proposal: Create Atoms")
tm-page(:title="`Proposal: Create ${bondingDenom}s`")
div(slot="menu"): tool-bar
router-link(to="/proposals/new" exact v-tooltip.bottom="'Back'")
i.material-icons arrow_back
Expand Down Expand Up @@ -32,6 +32,7 @@ tm-page(title="Proposal: Create Atoms")
</template>

<script>
import { mapGetters } from "vuex"
import { minLength, maxLength, required } from "vuelidate/lib/validators"
import {
TmBtn,
Expand Down Expand Up @@ -63,6 +64,9 @@ export default {
body: ""
}
}),
computed: {
...mapGetters(["bondingDenom"])
},
methods: {
onSubmit() {
this.$v.$touch()
Expand Down
6 changes: 4 additions & 2 deletions app/src/renderer/components/staking/ChartVotePower.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
</template>

<script>
import { mepGetters } from "vuex"
import Chart from "chart.js"
import shortid from "shortid"
export default {
name: "chart-power",
props: ["votes", "size"],
computed: {
...mapGetters(["bondingDenom"]),
chartData() {
return {
labels: [
Expand All @@ -27,7 +29,7 @@ export default {
],
datasets: [
{
label: "Delegated ATOM",
label: "Delegated " + this.bondingDenom.toUpperCase(),
lineTension: 0,
borderColor: "hsl(330,100%,30%)",
borderWidth: 2,
Expand All @@ -51,7 +53,7 @@ export default {
]
},
{
label: "Solo ATOM",
label: "Solo " + this.bondingDenom.toUpperCase(),
lineTension: 0,
borderColor: "hsl(210,50%,30%)",
borderWidth: 2,
Expand Down
41 changes: 19 additions & 22 deletions app/src/renderer/components/staking/PageBond.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<template lang="pug">
tm-page.page-bond(:title="`Bond ${denom}`")
tm-page.page-bond(:title="`Bond ${bondingDenom.toUpperCase()}`")
div(slot="menu"): tool-bar
tm-part(:title="`Start bonding your ${totalAtoms} ${denom}`"): tm-form-struct( :submit="onSubmit")
tm-part(:title="`Start bonding your ${totalAtoms} ${bondingDenom.toUpperCase()}`"): tm-form-struct( :submit="onSubmit")
.bond-group(:class="bondGroupClass(unbondedAtomsDelta)")
.bond-group__fields
.bond-bar
label.bond-bar__label Unbonded {{ denom }}
label.bond-bar__label Unbonded {{ bondingDenom.toUpperCase() }}
.bond-bar__input
.bond-bar-old__outer
.bond-bar-old__inner(:style="styleBondBarInner(oldUnbondedAtoms)")
Expand All @@ -25,11 +25,11 @@ tm-page.page-bond(:title="`Bond ${denom}`")
tm-field.bond-value__input#new-unbonded-atoms(
disabled
type="number"
placeholder="Atoms"
:placeholder="bondingDenom + 's'"
:value="newUnbondedAtoms")
tm-form-msg(type="between"
v-if="newUnbondedAtoms < 0")
| You can't bond more Atoms then you have
| You can't bond more {{bondingDenom}}s then you have

.bond-group.bond-candidate(
v-for='(d, index) in fields.delegates'
Expand Down Expand Up @@ -61,7 +61,7 @@ tm-page.page-bond(:title="`Bond ${denom}`")
span(v-if="d.deltaAtoms !== 0") {{ d.deltaAtoms }}
tm-field.bond-value__input(
type="number"
placeholder="Atoms"
:placeholder="bondingDenom + 's'"
step="1"
min="0"
:max="totalAtoms"
Expand All @@ -70,9 +70,9 @@ tm-page.page-bond(:title="`Bond ${denom}`")
@change.native="limitMax(d, parseInt($event.target.max))"
)

tm-form-msg(name="Atoms" type="required"
tm-form-msg(:name="bondingDenom + 's'" type="required"
v-if="!$v.fields.delegates.$each[index].atoms.required")
tm-form-msg(name="Atoms" type="numeric"
tm-form-msg(name="bondingDenom + 's'" type="numeric"
v-if="!$v.fields.delegates.$each[index].atoms.numeric")

.bond-group.bond-group--unbonding(
Expand Down Expand Up @@ -101,7 +101,7 @@ tm-page.page-bond(:title="`Bond ${denom}`")
tm-field.bond-value__input#new-unbonding-atoms(
disabled
type="number"
placeholder="Atoms"
:placeholder="bondingDenom + 's'"
:value="newUnbondingAtoms")

tm-form-group(field-id="bond-confirm" field-label=''
Expand Down Expand Up @@ -158,11 +158,9 @@ export default {
"user",
"delegation",
"config",
"connected"
"connected",
"bondingDenom"
]),
denom() {
return this.config.bondingDenom.toUpperCase()
},
totalAtoms() {
return (
parseInt(this.user.atoms) + this.oldBondedAtoms + this.oldUnbondingAtoms
Expand Down Expand Up @@ -238,8 +236,9 @@ export default {
if (this.newUnbondedAtoms < 0) {
this.$store.commit("notifyError", {
title: "Too Many Allocated Atoms",
body: `You've tried to bond ${this.newUnbondedAtoms *
-1} more atoms than you have.`
body: `You've tried to bond ${this.newUnbondedAtoms * -1} more ${
this.bondingDenom
}s than you have.`
})
return
}
Expand All @@ -258,12 +257,12 @@ export default {
if (errData) {
let parsedErr = errData.split('"')[1]
this.$store.commit("notifyError", {
title: "Error While Bonding Atoms",
title: `Error While Bonding ${this.bondingDenom}s`,
body: parsedErr[0].toUpperCase() + parsedErr.slice(1)
})
} else {
this.$store.commit("notifyError", {
title: "Error While Bonding Atoms",
title: `Error While Bonding ${this.bondingDenom}s`,
body: err.message
})
}
Expand Down Expand Up @@ -292,8 +291,8 @@ export default {
leaveIfBroke() {
if (!this.userCanDelegate) {
this.$store.commit("notifyError", {
title: "Cannot Bond Without Atoms",
body: `You do not have any ${this.denom} to bond to delegates.`
title: `Cannot Bond Without ${this.bondingDenom}s`,
body: `You do not have any ${this.bondingDenom.toUpperCase()} to bond to delegates.`
})
this.$router.push("/staking")
}
Expand All @@ -302,9 +301,7 @@ export default {
if (count === 0) {
this.$store.commit("notifyError", {
title: "No Delegates Selected",
body: `Select one or more delegates before proceeding to bond ${
this.denom
}`
body: `Select one or more delegates before proceeding to bond ${this.bondingDenom.toUpperCase()}`
})
this.$router.push("/staking")
}
Expand Down
36 changes: 21 additions & 15 deletions app/src/renderer/components/staking/PageStaking.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ tm-page(title='Staking')
tm-data-empty(v-else-if="delegates.delegates.length === 0")
data-empty-search(v-else-if="sortedFilteredEnrichedDelegates.length === 0")
template(v-else)
panel-sort(:sort='sort')
panel-sort(:sort='sort', :properties="properties")
li-delegate(v-for='i in sortedFilteredEnrichedDelegates' :key='i.id' :delegate='i')

.fixed-button-bar(v-if="!delegates.loading")
template(v-if="userCanDelegate")
.label #[strong {{ shoppingCart.length }}] delegates selected
tm-btn(id="go-to-bonding-btn" type="link" to="/staking/bond" :disabled="shoppingCart.length === 0" icon="chevron_right" icon-pos="right" value="Next" color="primary")
template(v-else)
.label You do not have any ATOMs to delegate.
.label You do not have any {{bondingDenom.toUpperCase()}}s to delegate.
tm-btn(disabled icon="chevron_right" icon-pos="right" value="Next" color="primary")
</template>

Expand Down Expand Up @@ -58,7 +58,8 @@ export default {
"committedDelegations",
"config",
"user",
"connected"
"connected",
"bondingDenom"
]),
address() {
return this.user.address
Expand Down Expand Up @@ -104,15 +105,9 @@ export default {
},
userCanDelegate() {
return this.shoppingCart.length > 0 || this.user.atoms > 0
}
},
data: () => ({
num: num,
query: "",
sort: {
property: "percent_of_vote",
order: "desc",
properties: [
},
properties() {
return [
{
title: "Name",
value: "small_moniker",
Expand All @@ -129,14 +124,17 @@ export default {
{
title: "Total Votes",
value: "voting_power",
tooltip: "The delegate stakes this many atoms on the network.",
tooltip: `The delegate stakes this many ${
this.bondingDenom
}s on the network.`,
class: "voting_power"
},
{
title: "Your Votes",
value: "your_votes",
tooltip:
"You have personally staked this many atoms to the delegate.",
tooltip: `You have personally staked this many ${
this.bondingDenom
}s to the delegate.`,
class: "your-votes"
},
{
Expand All @@ -153,6 +151,14 @@ export default {
}
]
}
},
data: () => ({
num: num,
query: "",
sort: {
property: "percent_of_vote",
order: "desc"
}
}),
watch: {
address: function(address) {
Expand Down
6 changes: 3 additions & 3 deletions app/src/renderer/components/staking/PanelSort.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template lang="pug">
.panel-sort: .panel-sort-container: .sort-by(
v-for="property in sort.properties",
v-for="property in properties",
@click="orderBy(property.value, $event)",
:class="property.class")
.label(v-tooltip.top="property.tooltip") {{ property.title }}
Expand All @@ -13,7 +13,7 @@ export default {
orderBy(property) {
let sortBys = this.$el.querySelectorAll(".sort-by")
sortBys.forEach(el => el.classList.remove("active", "desc", "asc"))
let index = this.sort.properties.findIndex(p => p.value === property)
let index = this.properties.findIndex(p => p.value === property)
let el = sortBys[index]
if (this.sort.property === property) {
Expand All @@ -33,7 +33,7 @@ export default {
el.classList.add("active")
}
},
props: ["sort"]
props: ["sort", "properties"]
}
</script>

Expand Down
4 changes: 4 additions & 0 deletions app/src/renderer/vuex/getters.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
// ui
export const config = state => state.config
export const bondingDenom = state =>
state.config.bondingDenom.charAt(0).toUpperCase() +
state.config.bondingDenom.slice(1)

export const filters = state => state.filters
export const notifications = state => state.notifications
export const user = state => state.user
Expand Down
6 changes: 3 additions & 3 deletions archive/components/FormGroupDelegate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ tm-form-group(:class='cssClass' :error="$v.fields.atoms.$error")
field(
theme="cosmos"
type="number"
placeholder="Atoms"
:placeholder="bondingDenom"
v-model="fields.atoms")
form-msg(
name="Atoms"
:name="bondingDenom"
type="required"
v-if="!$v.fields.atoms.required")
</template>
Expand All @@ -30,7 +30,7 @@ export default {
FormMsg
},
computed: {
...mapGetters(["shoppingCart", "delegates"]),
...mapGetters(["shoppingCart", "delegates", "bondingDenom"]),
cssClass() {
let value = "card-delegate-atoms"
return value
Expand Down
Loading

0 comments on commit a8db29a

Please sign in to comment.