From 103146a7ca43058b69815c2b12cb6883a0a88827 Mon Sep 17 00:00:00 2001
From: blavenie <benoit.lavenier@e-is.pro>
Date: Thu, 26 Jan 2017 09:18:10 +0100
Subject: [PATCH] - Currency: some peers disapears after some time - fix #280 -
 Currency: display new network parameter 'avgTimeTime'

---
 www/i18n/locale-en-GB.json                 |  7 ++---
 www/i18n/locale-en.json                    |  7 ++---
 www/i18n/locale-fr-FR.json                 | 10 ++++---
 www/js/controllers/currency-controllers.js |  1 +
 www/templates/currency/items_network.html  | 19 +++++++++++--
 www/templates/currency/items_wot.html      | 31 +++++++++++-----------
 www/templates/network/items_peers.html     |  2 +-
 7 files changed, 49 insertions(+), 28 deletions(-)

diff --git a/www/i18n/locale-en-GB.json b/www/i18n/locale-en-GB.json
index f122c9ac0..97c065356 100644
--- a/www/i18n/locale-en-GB.json
+++ b/www/i18n/locale-en-GB.json
@@ -134,7 +134,7 @@
     "VIEW": {
       "TITLE": "Currency",
       "TAB_CURRENCY": "Currency",
-      "TAB_WOT": "Community",
+      "TAB_WOT": "Web of trust",
       "TAB_NETWORK": "Network",
       "CURRENCY_NAME": "Currency name",
       "MEMBERS": "Members count",
@@ -154,8 +154,9 @@
       "SIG_PERIOD": "Minimum delay between 2 certifications<br/>sent by one and the same issuer.",
       "SIG_WINDOW": "Maximum delay before a certification<br/>will be treated",
       "STEP_MAX": "Maximum distance between<br/>each WoT member and a newcomer.",
-      "WOT_RULES_DIVIDER": "Rules for Membership",
-      "XPERCENT":"Minimum percent of sentries<br />to reach to match the distance rule"
+      "WOT_RULES_DIVIDER": "Rules for web of trust",
+      "XPERCENT":"Minimum percent of sentries<br />to reach to match the distance rule",
+      "AVG_GEN_TIME": "The average time between 2 blocks"
     }
   },
   "PEER": {
diff --git a/www/i18n/locale-en.json b/www/i18n/locale-en.json
index a64a724e7..cf70a02e2 100644
--- a/www/i18n/locale-en.json
+++ b/www/i18n/locale-en.json
@@ -134,7 +134,7 @@
     "VIEW": {
       "TITLE": "Currency",
       "TAB_CURRENCY": "Currency",
-      "TAB_WOT": "Community",
+      "TAB_WOT": "Web of trust",
       "TAB_NETWORK": "Network",
       "CURRENCY_NAME": "Currency name",
       "MEMBERS": "Members count",
@@ -154,8 +154,9 @@
       "SIG_PERIOD": "Minimum delay between 2 certifications<br/>sent by one and the same issuer.",
       "SIG_WINDOW": "Maximum delay before a certification<br/>will be treated",
       "STEP_MAX": "Maximum distance between<br/>each WoT member and a newcomer.",
-      "WOT_RULES_DIVIDER": "Rules for Membership",
-      "XPERCENT":"Minimum percent of sentries<br />to reach to match the distance rule"
+      "WOT_RULES_DIVIDER": "Rules for web of trust",
+      "XPERCENT":"Minimum percent of sentries<br />to reach to match the distance rule",
+      "AVG_GEN_TIME": "The average time between 2 blocks"
     }
   },
   "PEER": {
diff --git a/www/i18n/locale-fr-FR.json b/www/i18n/locale-fr-FR.json
index b11a48469..a2491ffe0 100644
--- a/www/i18n/locale-fr-FR.json
+++ b/www/i18n/locale-fr-FR.json
@@ -134,8 +134,9 @@
     "VIEW": {
       "TITLE": "Monnaie",
       "TAB_CURRENCY": "Monnaie",
-      "TAB_WOT": "Communauté",
+      "TAB_WOT": "Toile de confiance",
       "TAB_NETWORK": "Réseau",
+      "NETWORK_RULES_DIVIDER": "Règles du réseau",
       "CURRENCY_NAME": "Nom de la monnaie",
       "MEMBERS": "Nombre de membres",
       "MEMBERS_VARIATION": "Variation depuis {{duration|formatDuration}} (depuis le dernier DU)",
@@ -145,7 +146,7 @@
       "UD": "Dividende universel",
       "C_ACTUAL": "Croissance actuelle",
       "TIME": "Heure de la blockchain",
-      "POW_MIN": "Niveau de difficulté",
+      "POW_MIN": "Niveau minimal de difficulté de calcul",
       "MONEY_RULES_DIVIDER": "Règles de la monnaie",
       "C_RULE": "Croissance théorique (c)",
       "UD_RULE": "Dividende universel (formule)",
@@ -154,8 +155,9 @@
       "SIG_PERIOD": "Délai minimal d'attente entre 2 certifications<br/>successives émises par une même personne.",
       "SIG_WINDOW": "Délai maximal d'attente avant<br/>prise en compte d'une certification",
       "STEP_MAX": "Distance maximale dans la toile de confiance <br /> entre chaque membre et un nouvel entrant.",
-      "WOT_RULES_DIVIDER": "Règles pour devenir membre",
-      "XPERCENT":"Pourcentage minimum de sentinelle<br />à atteindre pour respecter la règle de distance."
+      "WOT_RULES_DIVIDER": "Règles de la toile de confiance",
+      "XPERCENT":"Pourcentage minimum de sentinelle<br/>à atteindre pour respecter la règle de distance.",
+      "AVG_GEN_TIME": "Temps moyen entre deux blocs"
     }
   },
   "PEER": {
diff --git a/www/js/controllers/currency-controllers.js b/www/js/controllers/currency-controllers.js
index 70ec73900..79cabf9f3 100644
--- a/www/js/controllers/currency-controllers.js
+++ b/www/js/controllers/currency-controllers.js
@@ -187,6 +187,7 @@ function CurrencyViewController($scope, $q, $timeout, BMA, UIUtils, csSettings,
           data.sigPeriod = json.sigPeriod;
           data.stepMax = json.stepMax;
           data.xpercent = json.xpercent;
+          data.avgGenTime = json.avgGenTime;
         }),
 
       // Get the current block informations
diff --git a/www/templates/currency/items_network.html b/www/templates/currency/items_network.html
index aa2da3d0a..d36342bd9 100644
--- a/www/templates/currency/items_network.html
+++ b/www/templates/currency/items_network.html
@@ -5,18 +5,33 @@
   </ion-nav-buttons>
 
   <ion-item id="helptip-currency-blockchain"
-            class="item-icon-left">
+            class="item-icon-left item-text-wrap">
     <i class="icon ion-clock"></i>
     <span translate>CURRENCY.VIEW.TIME</span>
     <span class="item-note dark">{{formData.medianTime | formatDate}}</span>
   </ion-item>
 
-  <ion-item class="item-icon-left">
+
+  <ion-item class="item-icon-left item-text-wrap">
     <i class="icon ion-lock-combination"></i>
     <span translate>CURRENCY.VIEW.POW_MIN</span>
     <span class="badge badge-stable">{{formData.difficulty | formatInteger}}</span>
   </ion-item>
 
+  <div class="item item-divider">
+    <span translate>CURRENCY.VIEW.NETWORK_RULES_DIVIDER</span>
+  </div>
+
+  <ion-item class="item-icon-left item-text-wrap">
+    <i class="icon ion-clock" style="position: absolute; font-size: 20px; left: 16px; margin-top: 11px"></i>
+    <b class="ion-lock-combination" style="position: absolute; font-size: 16px; left: 14px; margin-top: -4px;"></b>
+    <b class="ion-arrow-right-c" style="position: absolute; font-size: 12px; left: 28px; margin-top: -4px;"></b>
+    <b class="ion-lock-combination" style="position: absolute; font-size: 16px; left: 38px; margin-top: -4px;"></b>
+
+    <span translate>CURRENCY.VIEW.AVG_GEN_TIME</span>
+    <span class="badge badge-stable">{{formData.avgGenTime | formatDuration}}</span>
+  </ion-item>
+
   <ng-controller ng-controller="NetworkLookupCtrl">
 
     <div id="helptip-currency-peers"
diff --git a/www/templates/currency/items_wot.html b/www/templates/currency/items_wot.html
index 4192761dc..b43b1bb5c 100644
--- a/www/templates/currency/items_wot.html
+++ b/www/templates/currency/items_wot.html
@@ -22,41 +22,42 @@
         <span translate>CURRENCY.VIEW.WOT_RULES_DIVIDER</span>
     </div>
 
-    <ion-item class="item-icon-left item item-text-wrap">
+    <ion-item class="item-icon-left item-text-wrap">
       <i class="icon ion-ribbon-b"></i>
       <span class="col col-75" translate>CURRENCY.VIEW.SIG_QTY_RULE</span>
-      <span class="badge badge-assertive" ng-if="!loading">{{formData.sigQty}}</span>
+      <span class="badge badge-positive" ng-if="!loading">{{formData.sigQty}}</span>
     </ion-item>
 
-    <ion-item class="item-icon-left item item-text-wrap">
+    <ion-item class="item-icon-left item-text-wrap">
+      <i class="icon ion-ribbon-b"></i>
+      <b class="ion-clock" style="position: absolute; font-size: 22px; left: 33px;"></b>
+      <span class="col col-75" translate>CURRENCY.VIEW.SIG_WINDOW</span>
+      <span class="badge badge-stable" ng-if="!loading">{{formData.sigWindow | formatDuration}}</span>
+    </ion-item>
+
+    <ion-item class="item-icon-left item-text-wrap">
       <i class="icon ion-ribbon-a"></i>
       <span class="col col-75" translate>CURRENCY.VIEW.SIG_STOCK</span>
       <span class="badge badge-energized" ng-if="!loading">{{formData.sigStock}}</span>
     </ion-item>
 
-    <ion-item class="item-icon-left item item-text-wrap">
+    <ion-item class="item-icon-left item-text-wrap">
       <i class="icon ion-clock" style="position: absolute; font-size: 20px; left: 16px;"></i>
-      <b class="ion-ribbon-a" style="position: absolute; font-size: 18px; left: 14px; "></b>
-      <b class="ion-arrow-right-c" style="position: absolute; font-size: 14px; left: 28px; "></b>
-      <b class="ion-ribbon-a" style="position: absolute; font-size: 18px; left: 38px;"></b>
+      <b class="ion-ribbon-a" style="position: absolute; font-size: 16px; left: 16px; "></b>
+      <b class="ion-arrow-right-c" style="position: absolute; font-size: 12px; left: 28px; "></b>
+      <b class="ion-ribbon-a" style="position: absolute; font-size: 16px; left: 38px;"></b>
       <span class="col col-75" translate>CURRENCY.VIEW.SIG_PERIOD</span>
       <span class="badge badge-stable" ng-if="!loading">{{formData.sigPeriod | formatDuration}}</span>
     </ion-item>
 
-    <ion-item class="item-icon-left item item-text-wrap">
-      <i class="icon ion-ribbon-a"></i>
-      <b class="ion-clock" style="position: absolute; font-size: 22px; left: 33px;"></b>
-      <span class="col col-75" translate>CURRENCY.VIEW.SIG_WINDOW</span>
-      <span class="badge badge-stable" ng-if="!loading">{{formData.sigWindow | formatDuration}}</span>
-    </ion-item>
 
-    <ion-item class="item-icon-left item item-text-wrap">
+    <ion-item class="item-icon-left item-text-wrap">
       <i class="icon ion-steam"></i>
       <span class="col col-75" translate>CURRENCY.VIEW.STEP_MAX</span>
       <span class="badge badge-stable" ng-if="!loading">{{formData.stepMax}}</span>
     </ion-item>
 
-    <ion-item class="item-icon-left item item-text-wrap">
+    <ion-item class="item-icon-left item-text-wrap">
       <i class="icon ion-pull-request"></i>
       <span class="col col-75" translate>CURRENCY.VIEW.XPERCENT</span>
       <span class="badge badge-stable" ng-if="!loading">{{formData.xpercent*100| formatNumeral: '0,0'}} %</span>
diff --git a/www/templates/network/items_peers.html b/www/templates/network/items_peers.html
index 70174ab95..0312b6b5f 100644
--- a/www/templates/network/items_peers.html
+++ b/www/templates/network/items_peers.html
@@ -22,7 +22,7 @@
       </div>
       <div class="col col-20 no-padding">
         <span id="helptip-currency-peer-{{$index}}-block"
-          class="badge" ng-class="{ 'badge-balanced': peer.hasMainConsensusBlock, 'badge-energized': peer.hasConsensusBlock }">{{peer.currentNumber}}</span>
+          class="badge" ng-class="{ 'badge-balanced': peer.hasMainConsensusBlock, 'badge-energized': peer.hasConsensusBlock }">#{{peer.currentNumber}}</span>
       </div>
     </div>
   </div>
-- 
GitLab