diff --git a/www/js/controllers/network-controllers.js b/www/js/controllers/network-controllers.js index 3787893b735d1b1d7d2883c31af698626ead033e..bfeb74bbfe0e52a2db07b5a879f64338d831ece6 100644 --- a/www/js/controllers/network-controllers.js +++ b/www/js/controllers/network-controllers.js @@ -300,25 +300,28 @@ function NetworkLookupController($scope, $state, $location, $ionicPopover, $win } }; - $scope.showEndpointsPopover = function($event, peer, endpoint) { - var endpoints = peer.getEndpoints(endpoint); + $scope.showEndpointsPopover = function($event, peer, endpointName) { + $event.preventDefault(); + $event.stopPropagation(); + + var endpoints = peer.getEndpoints(endpointName); endpoints = (endpoints||[]).reduce(function(res, ep) { - var bma = BMA.node.parseEndPoint(ep); + var bma = BMA.node.parseEndPoint(ep) || BMA.node.parseEndPoint(ep, endpointName); return res.concat({ label: 'NETWORK.VIEW.NODE_ADDRESS', - value: peer.getServer() + (bma.path||'') + value: peer.getServer(bma) + (bma && bma.path||'') }); }, []); if (!endpoints.length) return; + // Call extension points UIUtils.popover.show($event, { templateUrl: 'templates/network/popover_endpoints.html', bindings: { - titleKey: 'NETWORK.VIEW.ENDPOINTS.' + endpoint, + titleKey: 'NETWORK.VIEW.ENDPOINTS.' + endpointName, items: endpoints } }); - $event.stopPropagation(); }; $scope.showWs2pPopover = function($event, peer) { diff --git a/www/js/entities/peer.js b/www/js/entities/peer.js index 7bd9491e648f0acd4144d88734f65910262b820e..6672ba834b6a773841df4ab1c56084b8e21b7f84 100644 --- a/www/js/entities/peer.js +++ b/www/js/entities/peer.js @@ -123,24 +123,24 @@ Peer.prototype.getPort = function() { return bma.port ? bma.port : null; }; -Peer.prototype.getHost = function() { - var bma = this.bma || this.getBMA(); +Peer.prototype.getHost = function(getHost) { + bma = getHost || this.bma || this.getBMA(); return ((bma.port == 443 || bma.useSsl) && bma.dns) ? bma.dns : (this.hasValid4(bma) ? bma.ipv4 : (bma.dns ? bma.dns : (bma.ipv6 ? '[' + bma.ipv6 + ']' :''))); }; -Peer.prototype.getURL = function() { - var bma = this.bma || this.getBMA(); - var host = this.getHost(); +Peer.prototype.getURL = function(bma) { + bma = bma || this.bma || this.getBMA(); + var host = this.getHost(bma); var protocol = (bma.port == 443 || bma.useSsl) ? 'https' : 'http'; return protocol + '://' + host + (bma.port ? (':' + bma.port) : ''); }; -Peer.prototype.getServer = function() { - var bma = this.bma || this.getBMA(); - var host = this.getHost(); +Peer.prototype.getServer = function(bma) { + bma = bma || this.bma || this.getBMA(); + var host = this.getHost(bma); return host + (host && bma.port ? (':' + bma.port) : ''); }; diff --git a/www/js/services/bma-services.js b/www/js/services/bma-services.js index 01c7fe68561118bab71356c093a14ce004e803c0..574c25011d937a0625805fd470b277a03a4ab287 100644 --- a/www/js/services/bma-services.js +++ b/www/js/services/bma-services.js @@ -556,7 +556,7 @@ angular.module('cesium.bma.services', ['ngApi', 'cesium.http.services', 'cesium. }; }; - exports.node.parseEndPoint = function(endpoint) { + exports.node.parseEndPoint = function(endpoint, epPrefix) { // Try BMA var matches = exports.regexp.BMA_ENDPOINT.exec(endpoint); if (matches) { @@ -621,6 +621,23 @@ angular.module('cesium.bma.services', ['ngApi', 'cesium.http.services', 'cesium. "useWs2p": true }; } + + // Use generic match + if (epPrefix) { + matches = exact(epPrefix + REGEX_ENDPOINT_PARAMS).exec(endpoint); + if (matches) { + return { + "dns": matches[2] || '', + "ipv4": matches[4] || '', + "ipv6": matches[6] || '', + "port": matches[8] || 80, + "useSsl": matches[8] && matches[8] == 443, + "path": matches[10], + "useBma": false + }; + } + } + }; exports.copy = function(otherNode) { diff --git a/www/plugins/es/templates/network/view_network_extend.html b/www/plugins/es/templates/network/view_network_extend.html index 91d217861f80cf35c67fb216358326326302c73a..82470990b5f11bb36cce317561b683c82eb45b39 100644 --- a/www/plugins/es/templates/network/view_network_extend.html +++ b/www/plugins/es/templates/network/view_network_extend.html @@ -1,5 +1,5 @@ <!-- Buttons section --> -<ng-if ng-if=":state:enable && extensionPoint === 'buttons'"> +<ng-if ng-if=":state:enable"> <a class="button button-text button-small ink" ui-sref="app.blockchain_search" > <i class="icon ion-android-search"></i> diff --git a/www/templates/network/popover_endpoints.html b/www/templates/network/popover_endpoints.html index 75338af01396ddeb3b6f0739b39a8aa70d42c2c3..bfadee2ada62330abf1d257f238300c8464bd6e1 100644 --- a/www/templates/network/popover_endpoints.html +++ b/www/templates/network/popover_endpoints.html @@ -5,6 +5,7 @@ </div> </ion-header-bar> <ion-content scroll="false"> + <div class="list" ng-class="{'has-header': titleKey}"> <div class="item item-text-wrap" ng-repeat="item in items"> <div class="item-label" ng-if="item.label">{{item.label | translate}}</div>