Skip to content
This repository was archived by the owner on May 16, 2019. It is now read-only.

Commit 19fb50c

Browse files
authored
Merge pull request #1838 from OpenBazaar/pr/1824
Pr/1824
2 parents cedc7df + 29c690d commit 19fb50c

File tree

4 files changed

+70
-1
lines changed

4 files changed

+70
-1
lines changed

css/obBase.css

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6400,3 +6400,22 @@ input[type="checkbox"].fieldItem:checked + label .togLabelOff {
64006400
#ov1 .TODO.TODO.TODO.TODO.TODO {
64016401
display: none; /* hide in production */
64026402
}
6403+
6404+
6405+
.peersList {
6406+
margin-top: 10px;
6407+
padding-right: 30px;
6408+
display: block;
6409+
color: #9999A0;
6410+
max-height: 200px;
6411+
overflow: auto;
6412+
}
6413+
6414+
.peersList>ul{
6415+
list-style-type: none;
6416+
padding-left: 0;
6417+
}
6418+
6419+
.peersList>ul>li {
6420+
padding-bottom: 5px;
6421+
}

js/languages/en-US.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,8 @@
547547
"goodSMTPAuthentication": "You have successfully connected to the SMTP server.",
548548
"tagIsTooLongHeadline": "The tag is too long",
549549
"tagIsTooLongBody": "Tags cannot be more than %{smart_count} character long. |||| Tags cannot be more than %{smart_count} characters long.",
550-
"retryingConnection": "The connection to your node was lost. Retrying connection attempt %{attempt} of %{total}."
550+
"retryingConnection": "The connection to your node was lost. Retrying connection attempt %{attempt} of %{total}.",
551+
"peersFail": "Call to the peers API failed."
551552
},
552553
"pageConnectingMessages": {
553554
"listingConnect": "Connecting to listing ${listing}",

js/templates/settings.html

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,6 +1281,33 @@ <h3 class="padding15 margin0 fontWeight500"><%= polyglot.t('Advanced') %></h3>
12811281
</div>
12821282
</div>
12831283

1284+
</div>
1285+
<div class="flexRow">
1286+
1287+
<div class="flexCol-3 borderRight custCol-border">
1288+
<div class="fieldItem">
1289+
<label>
1290+
Connected Peers
1291+
</label>
1292+
</div>
1293+
</div>
1294+
1295+
<div class="flexCol-9 borderRight0 custCol-border">
1296+
<div class="fieldItem flexRow">
1297+
<div class="flexRow">
1298+
<span class="js-numConnectedPeers"></span>
1299+
<div class="positionTopRight paddingright5">
1300+
<a id="showPeersButton" class="btn btn-txt js-showPeers custCol-secondary">
1301+
Show Connected Peers
1302+
</a>
1303+
</div>
1304+
</div>
1305+
<div class="flexRow">
1306+
<div class="peersList custCol-text customThemeScrollbar js-connectedPeers"></div>
1307+
</div>
1308+
</div>
1309+
</div>
1310+
12841311
</div>
12851312

12861313
<div class="flexRow">

js/views/settingsVw.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ module.exports = pageVw.extend({
4747
'click .js-saveModerator': 'saveModeratorClick',
4848
'click .js-cancelAdvanced': 'cancelView',
4949
'click .js-saveAdvanced': 'saveAdvancedClick',
50+
'click .js-showPeers': 'showPeers',
5051
'click .js-testSMTP': 'testSMTPClick',
5152
'click .js-changeServerSettings': 'launchServerConfig',
5253
'change .js-settingsThemeSelection': 'themeClick',
@@ -134,6 +135,8 @@ module.exports = pageVw.extend({
134135
this.listenTo(app.router, 'cache-reattached', this.onCacheReattached);
135136

136137
__.bindAll(this, 'validateDescription');
138+
139+
137140
},
138141

139142
// disabling caching on settings for now -- too much
@@ -236,6 +239,21 @@ module.exports = pageVw.extend({
236239
placeholder_text_multiple: window.polyglot.t('chosenJS.placeHolderTextMultiple')
237240
});
238241

242+
var connectedPeers = "<ul>";
243+
$.ajax({
244+
url: self.serverUrl + "routing_table",
245+
success: function(data){
246+
self.$('.js-numConnectedPeers').text(data.length);
247+
data.forEach(function (peer) {
248+
connectedPeers += `<li><a href="#userPage/${peer.guid}">${peer.ip}:${peer.port}</a></li>`;
249+
});
250+
self.$('.js-connectedPeers').html(connectedPeers + "</ul>").hide();
251+
},
252+
error: function(){
253+
self.$('.js-numConnectedPeers').text(window.polyglot.t('errorMessages.peersFail'));
254+
}
255+
});
256+
239257
self.avatarCropper = self.$('#settings-image-cropper');
240258

241259
self.avatarCropper.cropit({
@@ -323,6 +341,10 @@ module.exports = pageVw.extend({
323341
return this;
324342
},
325343

344+
showPeers: function () {
345+
this.$el.find('.js-connectedPeers').toggle();
346+
},
347+
326348
validateDescription: function() {
327349
validateMediumEditor.checkVal(this.$('#about'));
328350
},

0 commit comments

Comments
 (0)