-
Notifications
You must be signed in to change notification settings - Fork 98
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
Jordan/1869 network page #1925
Merged
Merged
Jordan/1869 network page #1925
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
f812bda
added PageNetwork route and sidebar link
jbibla 52eff0b
fixed missing stargate url and added test
jbibla dcac056
added link to TmConnectedNetwork
jbibla 97de5ea
removed pool from params page
jbibla 9aed0ba
added real data to PageNetwork
jbibla 21bd352
update snaps
jbibla 5c29267
fixed params tests
jbibla a671b07
lint and changelog
jbibla 0f99466
removed connected-network link because it was blowing things up?????????
jbibla 59b42de
added PageNetwork tests
jbibla abcf97e
Merge branch 'develop' into jordan/1869-network-page
jbibla a6ab68a
why are we mocking moment?
sabau File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
<template> | ||
<tm-page data-title="Network"> | ||
<template slot="menu-body"> | ||
<tm-balance /> | ||
<tool-bar /> | ||
</template> | ||
|
||
<tm-data-error v-if="!connected" /> | ||
|
||
<template v-else> | ||
<div class="page-profile__header page-profile__section network"> | ||
<div class="row"> | ||
<div class="page-profile__header__info"> | ||
<div class="page-profile__status-and-title"> | ||
<span | ||
v-tooltip.top="status.message" | ||
:class="status.color" | ||
class="page-profile__status" | ||
/> | ||
<h2 class="page-profile__title">{{ lastHeader.chain_id }}</h2> | ||
<h3 v-if="config.devMode"> | ||
Proposer: {{ lastHeader.proposer_address }} | ||
</h3> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="row"> | ||
<dl class="info_dl colored_dl"> | ||
<dt>Height</dt> | ||
<dd>{{ lastHeader.height }}</dd> | ||
</dl> | ||
<dl class="info_dl colored_dl"> | ||
<dt>Last Block</dt> | ||
<dd>{{ lastBlock }}</dd> | ||
</dl> | ||
<dl class="info_dl colored_dl"> | ||
<dt>Transactions</dt> | ||
<dd>{{ lastHeader.total_txs }}</dd> | ||
</dl> | ||
<dl class="info_dl colored_dl"> | ||
<dt>Number of Validators</dt> | ||
<dd>{{ delegates.delegates.length }}</dd> | ||
</dl> | ||
</div> | ||
<div class="row"> | ||
<div class="column"> | ||
<dl class="info_dl"> | ||
<dt>Total Liquid {{ bondDenom }}</dt> | ||
<dd id="loose_tokens"> | ||
{{ pool.pool.loose_tokens ? pool.pool.loose_tokens : `n/a` }} | ||
</dd> | ||
</dl> | ||
</div> | ||
<div class="column"> | ||
<dl class="info_dl"> | ||
<dt>Total Delegated {{ bondDenom }}</dt> | ||
<dd id="bonded_tokens"> | ||
{{ pool.pool.bonded_tokens ? pool.pool.bonded_tokens : `n/a` }} | ||
</dd> | ||
</dl> | ||
</div> | ||
</div> | ||
</div> | ||
</template> | ||
</tm-page> | ||
</template> | ||
|
||
<script> | ||
import moment from "moment" | ||
import { mapGetters } from "vuex" | ||
import TmBtn from "common/TmBtn" | ||
import ToolBar from "common/ToolBar" | ||
import TmBalance from "common/TmBalance" | ||
import TmDataError from "common/TmDataError" | ||
import TmPage from "common/TmPage" | ||
export default { | ||
name: `page-network`, | ||
components: { | ||
TmBalance, | ||
TmBtn, | ||
ToolBar, | ||
TmDataError, | ||
TmPage | ||
}, | ||
computed: { | ||
...mapGetters([ | ||
`connected`, | ||
`lastHeader`, | ||
`delegates`, | ||
`config`, | ||
`pool`, | ||
`bondDenom` | ||
]), | ||
status() { | ||
const color = this.connected ? `green` : `red` | ||
const message = this.connected | ||
? `Network is up and running` | ||
: `Network is down` | ||
return { color, message } | ||
}, | ||
lastBlock() { | ||
moment.relativeTimeThreshold(`ss`, 1) | ||
return moment(this.lastHeader.time).fromNow() | ||
} | ||
} | ||
} | ||
</script> | ||
<style> | ||
.network .page-profile__header__info { | ||
padding: 2rem; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import { shallowMount, createLocalVue } from "@vue/test-utils" | ||
import PageNetwork from "renderer/components/network/PageNetwork" | ||
|
||
const localVue = createLocalVue() | ||
localVue.directive(`tooltip`, () => {}) | ||
|
||
describe(`PageNetwork`, () => { | ||
let wrapper, $store | ||
|
||
beforeEach(() => { | ||
$store = { | ||
getters: { | ||
connected: true, | ||
lastHeader: { | ||
chain_id: `gaia-20k`, | ||
proposer_address: `EFH47FH723HDHSH`, | ||
height: `6001`, | ||
total_txs: `108`, | ||
time: Date.now() | ||
}, | ||
delegates: { | ||
delegates: [ | ||
{ | ||
a: `b`, | ||
c: `d` | ||
} | ||
] | ||
}, | ||
config: { | ||
devMode: true | ||
}, | ||
pool: { | ||
pool: { | ||
bonded_tokens: 125, | ||
loose_tokens: 10 | ||
} | ||
}, | ||
bondDenom: `stake` | ||
} | ||
} | ||
|
||
wrapper = shallowMount(PageNetwork, { | ||
localVue, | ||
mocks: { | ||
$store | ||
} | ||
}) | ||
}) | ||
|
||
it(`has the expected html structure`, () => { | ||
expect(wrapper.vm.$el).toMatchSnapshot() | ||
}) | ||
|
||
it(`sets the status correctly`, () => { | ||
expect(wrapper.vm.status).toEqual({ | ||
color: `green`, | ||
message: `Network is up and running` | ||
}) | ||
|
||
$store = { | ||
getters: { | ||
connected: false | ||
} | ||
} | ||
|
||
wrapper = shallowMount(PageNetwork, { | ||
localVue, | ||
mocks: { | ||
$store | ||
} | ||
}) | ||
|
||
expect(wrapper.vm.status).toEqual({ | ||
color: `red`, | ||
message: `Network is down` | ||
}) | ||
}) | ||
}) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be the default route
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
interesting idea @fedekunze! i don't want to make this change right now, but we should talk about it at the next team meeting. i've added it to the agenda.
remember, eventually we will have a dashboard as the default route - but this might be a good interim solution.