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

fix the unablity to add node when all default nodes offline #1236 #1489

Merged
Show file tree
Hide file tree
Changes from all 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
11 changes: 6 additions & 5 deletions src/components/PeerSelector/PeerSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,24 @@
<Row>
<i-col span="5" class="current-node-header">{{ $t('current_endpoint') }}:</i-col>
<i-col
v-if="currentPeerInfo"
span="19"
class="current-node-value overflow_ellipsis"
:title="currentPeerInfo.url + currentPeerInfo.friendlyName"
>
<div>
<div class="node-list-entry">{{ currentPeerInfo.friendlyName }}</div>
<div class="node-url">{{ currentPeerInfo.url }}</div>
<div v-if="currentPeerInfo" class="node-list-entry">{{ currentPeerInfo.friendlyName }}</div>
<div v-if="currentPeerInfo" class="node-url">{{ currentPeerInfo.url }}</div>
</div>
</i-col>
</Row>
</div>
<div class="node-list-container">
<div class="node-list-head">
<span>{{ $t('node_list') }}</span>
<span> ({{ peersList.length }})</span>
<span> ({{ peersList && peersList.length ? peersList.length : 0 }})</span>
</div>
<div class="node-list-content">
<div v-if="currentPeerInfo && peersList.length" class="node-list-content">
<ul v-auto-scroll="'active'">
<li
v-for="({ url, friendlyName }, index) in peersList"
Expand Down Expand Up @@ -61,7 +62,7 @@
<span>{{ $t('node_list') }}</span>
<span> ({{ peersList.length }})</span>
</div>
<div class="node-list-content">
<div v-if="currentPeerInfo" class="node-list-content">
<ul v-auto-scroll="'active'">
<li
v-for="({ url, friendlyName }, index) in peersList"
Expand Down
7 changes: 6 additions & 1 deletion src/store/Network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -502,11 +502,16 @@ export default {
SET_NETWORK_IS_NOT_MATCHING_PROFILE({ commit }, networkIsNotMatchingProfile) {
commit('networkIsNotMatchingProfile', networkIsNotMatchingProfile);
},
ADD_KNOWN_PEER({ commit }, peerUrl) {
async ADD_KNOWN_PEER({ commit, rootGetters, dispatch }, peerUrl) {
if (!UrlValidator.validate(peerUrl)) {
throw Error('Cannot add node. URL is not valid: ' + peerUrl);
}
commit('addPeer', peerUrl);
const repositoryFactory = rootGetters['network/repositoryFactory'];
const isConnected = rootGetters['network/isConnected'];
if (!repositoryFactory || !isConnected) {
await dispatch('SET_CURRENT_PEER', peerUrl);
}
},
REMOVE_KNOWN_PEER({ commit }, peerUrl) {
commit('removePeer', peerUrl);
Expand Down