From 5cefec37ff4829de75c4868d1bf1cf544a52fd57 Mon Sep 17 00:00:00 2001
From: blavenie <benoit.lavenier@e-is.pro>
Date: Mon, 20 Mar 2017 10:06:56 +0100
Subject: [PATCH] [fix] Network: sort on API not working - fix #412 [fix]
 Network: better alignment of API icons (SSL and Cesium+)

---
 www/js/services/network-services.js    |  4 +++-
 www/templates/network/items_peers.html | 14 ++++++++------
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/www/js/services/network-services.js b/www/js/services/network-services.js
index bde8b7a7f..38e8b20e5 100644
--- a/www/js/services/network-services.js
+++ b/www/js/services/network-services.js
@@ -458,7 +458,9 @@ angular.module('cesium.network.services', ['ngResource', 'ngApi', 'cesium.bma.se
           if (data.sort.type) {
             var sortScore = 0;
             sortScore += (data.sort.type == 'uid' ? computeScoreAlphaValue(peer.uid||peer.pubkey, 3, data.sort.asc) : 0);
-            sortScore += (data.sort.type == 'api' ? (peer.hasEndpoint('ES_USER_API') && data.sort.asc ? 1 : 0) : 0);
+            sortScore += (data.sort.type == 'api' ?
+              (peer.isSsl() ? (data.sort.asc ? 1 : -1) :
+              (peer.hasEndpoint('ES_USER_API') ? (data.sort.asc ? 0.5 : -0.5) : 0)) : 0);
             sortScore += (data.sort.type == 'difficulty' ? (peer.difficulty ? (data.sort.asc ? (1000-peer.difficulty) : peer.difficulty): 0) : 0);
             sortScore += (data.sort.type == 'current_block' ? (peer.currentNumber ? (data.sort.asc ? (1000000000 - peer.currentNumber) : peer.currentNumber) : 0) : 0);
             score += (10000000000 * sortScore);
diff --git a/www/templates/network/items_peers.html b/www/templates/network/items_peers.html
index 16bdc3cd0..81d8295fb 100644
--- a/www/templates/network/items_peers.html
+++ b/www/templates/network/items_peers.html
@@ -59,14 +59,16 @@
           <span class="gray">{{:rebind:peer.server}}</span>
         </h4>
       </div>
-      <div class="col col-15 no-padding text-center" ng-if="::expertMode">
-        <div class="hidden-xs hidden-sm" ng-if=":rebind:peer.hasEndpoint('ES_USER_API')">
+      <div class="col col-15 no-padding text-center hidden-xs hidden-sm" ng-if="::expertMode">
+        <div style="min-width: 50px; padding-top: 5px;" >
+          <span ng-if=":rebind:peer.isSsl()">
+            <i class="ion-locked"></i> <small>SSL</small>
+          </span>
+        </div>
+        <span class="" ng-if=":rebind:peer.hasEndpoint('ES_USER_API')">
           <i class="ion-es-user-api"></i>
           <b class="ion-plus dark" style="position: relative; left: -14px; top:-17px; font-size : 16px;"></b>
-        </div>
-        <div class="hidden-xs hidden-sm dark" ng-if=":rebind:peer.isSsl()">
-          <i class="ion-locked"></i> <small>SSL</small>
-        </div>
+        </span>
       </div>
       <div class="col col-20 no-padding text-center" ng-if="::expertMode && search.type != 'offline'">
         <h3 class="hidden-sm hidden-xs gray">
-- 
GitLab