From 1e51fc9f739e80718097b59fd5a4e84c5dc70a82 Mon Sep 17 00:00:00 2001
From: blavenie <benoit.lavenier@e-is.pro>
Date: Thu, 27 Jul 2017 23:07:28 +0200
Subject: [PATCH] [enh] Network map: fix marker icon & color

---
 .../map/js/controllers/network-controllers.js | 21 ++++++++++++-------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/www/plugins/map/js/controllers/network-controllers.js b/www/plugins/map/js/controllers/network-controllers.js
index 69d611313..fdbd97045 100644
--- a/www/plugins/map/js/controllers/network-controllers.js
+++ b/www/plugins/map/js/controllers/network-controllers.js
@@ -52,17 +52,20 @@ angular.module('cesium.map.network.controllers', ['cesium.services', 'cesium.map
         member: {
           type: 'awesomeMarker',
           icon: 'person',
-          markerColor: 'green'
+          markerColor: 'green',
+          iconColor: 'white'
         },
         mirror: {
           type: 'awesomeMarker',
-          icon: 'android-desktop',
-          markerColor: 'green'
+          icon: 'radio-waves',
+          markerColor: 'green',
+          iconColor: 'white'
         },
         offline: {
           type: 'awesomeMarker',
           icon: 'ion-close-circled',
-          markerColor: 'red'
+          markerColor: 'red',
+          iconColor: 'white'
         }
       },
       markerIdByPeerId = {},
@@ -176,8 +179,9 @@ angular.module('cesium.map.network.controllers', ['cesium.services', 'cesium.map
         }
 
         // Get position by IP
-        var ip = peer.getHost();
-        esGeo.point.searchByIP(ip)
+        var bma = peer.bma;
+        var address = peer.hasValid4(bma) ? bma.ipv4 : (bma.dns || bma.ipv6);
+        esGeo.point.searchByIP(address)
 
           // Create the marker
           .then(function(position){
@@ -243,10 +247,11 @@ angular.module('cesium.map.network.controllers', ['cesium.services', 'cesium.map
     $scope.updateMarker = function(marker, peer) {
       marker.layer = !peer.online ? 'offline' : (peer.uid ? 'member' : 'mirror');
       marker.icon = angular.copy(icons[marker.layer]);
-      marker.opacity = peer.online ? 0.9 : 0.7;
+      marker.opacity = peer.online ? 1 : 0.7;
       marker.title = peer.dns || peer.server;
       if (peer.online && !peer.hasMainConsensusBlock) {
-        marker.icon.markerColor = peer.hasConsensusBlock ? 'beige' : 'lightgray';
+        marker.icon.markerColor = peer.hasConsensusBlock ? 'lightgreen' : 'lightgray';
+        marker.opacity = peer.hasConsensusBlock ? 0.9 : 0.8;
       }
       if (!marker.lng) {
         marker.lng = marker.position.lng + Math.random() / 1000;
-- 
GitLab