From 25f275929aaf2244d62b4b29ebb9df5b71a25064 Mon Sep 17 00:00:00 2001
From: blavenie <benoit.lavenier@e-is.pro>
Date: Wed, 31 May 2017 10:11:56 +0200
Subject: [PATCH] [fix] Peer: click on computed block should show the TX count
 graph, filtered on the issuer [fix] Remove unused lib on Unbuntu build - due
 to  issue #463

---
 www/index.html                                |  9 +++-
 www/js/plugins.js                             | 16 +++++--
 .../js/controllers/blockchain-controllers.js  | 10 +++++
 .../js/controllers/network-controllers.js     | 43 +------------------
 4 files changed, 31 insertions(+), 47 deletions(-)

diff --git a/www/index.html b/www/index.html
index 1ec716fe..cd60b90a 100644
--- a/www/index.html
+++ b/www/index.html
@@ -36,7 +36,9 @@
   <script src="js/vendor/socket-io.js"></script>
   <script src="js/vendor/underscore.js"></script>
   <script src="js/vendor/qrcode.min.js"></script>
+  <!--removeIf(ubuntu)--> <!-- FIXME: issue #463 -->
   <script src="js/vendor/Chart.js"></script>
+  <!--endRemoveIf(ubuntu)-->
 
   <!-- ionic/angularjs js -->
   <script src="lib/ionic/js/ionic.bundle.js"></script>
@@ -50,8 +52,10 @@
   <script src="lib/ionic/js/angular/angular-bind-notifier.min.js"></script>
   <script src="lib/ionic/js/angular/angular-image-crop.js"></script>
   <script src="lib/ionic/js/angular/angular-file-saver.bundle.js"></script>
-  <script src="lib/ionic/js/angular/angular-chart.min.js"></script>
   <script src="lib/ionic/js/angular/angular-idle.js"></script>
+  <!--removeIf(ubuntu)--> <!-- FIXME: issue #463 -->
+  <script src="lib/ionic/js/angular/angular-chart.min.js"></script>
+  <!--endRemoveIf(ubuntu)-->
 
   <script src="js/vendor/base58.js" async></script>
   <!--removeIf(android)-->
@@ -157,7 +161,9 @@
   <script src="dist/dist_js/plugins/es/js/controllers/invitation-controllers.js"></script>
   <script src="dist/dist_js/plugins/es/js/controllers/subscription-controllers.js"></script>
 
+
   <!-- Graph plugin -->
+  <!--removeIf(ubuntu)--> <!-- FIXME: issue #463 -->
   <script src="dist/dist_js/plugins/graph/js/plugin.js"></script>
   <script src="dist/dist_js/plugins/graph/js/services.js"></script>
   <script src="dist/dist_js/plugins/graph/js/services/data-services.js"></script>
@@ -167,6 +173,7 @@
   <script src="dist/dist_js/plugins/graph/js/controllers/network-controllers.js"></script>
   <script src="dist/dist_js/plugins/graph/js/controllers/currency-controllers.js"></script>
   <script src="dist/dist_js/plugins/graph/js/controllers/account-controllers.js"></script>
+  <!--endRemoveIf(ubuntu)-->
 
   <!-- RML9 plugin -->
   <!--<script src="dist/dist_js/plugins/rml9/plugin.js"></script>-->
diff --git a/www/js/plugins.js b/www/js/plugins.js
index 8b94165c..a2d66860 100644
--- a/www/js/plugins.js
+++ b/www/js/plugins.js
@@ -1,14 +1,22 @@
 
 angular.module('cesium.plugins', [
+  /* --  Generated plugin's modules -- */
+
   'cesium.plugins.translations',
   'cesium.plugins.templates',
-  // Plugins
-  'cesium.es.plugin'
 
+  /* --  Plugins  -- */
+
+  // Graph plugin:
   // removeIf(ubuntu)
-  ,'cesium.graph.plugin'
+  // FIXME: issue #463
+  'cesium.graph.plugin',
   // endRemoveIf(ubuntu)
 
-  //,'cesium.rml9.plugin'
+  // RML9 plugin:
+  //'cesium.rml9.plugin',
+
+  // ES plugin (Cesium+):
+  'cesium.es.plugin'
   ])
 ;
diff --git a/www/plugins/graph/js/controllers/blockchain-controllers.js b/www/plugins/graph/js/controllers/blockchain-controllers.js
index f1befd6b..165d0fe0 100644
--- a/www/plugins/graph/js/controllers/blockchain-controllers.js
+++ b/www/plugins/graph/js/controllers/blockchain-controllers.js
@@ -37,6 +37,16 @@ function GpBlockchainTxCountController($scope, $controller, $q, $state, $filter,
   // Initialize the super class and extend it.
   angular.extend(this, $controller('GpCurrencyAbstractCtrl', {$scope: $scope}));
 
+  $scope.init = function(e, state) {
+    if (state && state.stateParams) {
+
+      // get the pubkey
+      if (!$scope.formData.issuer && state && state.stateParams && state.stateParams.pubkey) { // Currency parameter
+        $scope.formData.issuer = state.stateParams.pubkey;
+      }
+    }
+  };
+
   $scope.load = function(updateTimePct) {
 
     var formData = $scope.formData;
diff --git a/www/plugins/graph/js/controllers/network-controllers.js b/www/plugins/graph/js/controllers/network-controllers.js
index 5610d4a2..603a22a3 100644
--- a/www/plugins/graph/js/controllers/network-controllers.js
+++ b/www/plugins/graph/js/controllers/network-controllers.js
@@ -33,7 +33,7 @@ angular.module('cesium.graph.network.controllers', ['chart.js', 'cesium.graph.se
           views: {
             'menuContent': {
               templateUrl: "plugins/graph/templates/network/view_peer_stats.html",
-              controller: 'GpPeerStatsCtrl'
+              controller: 'GpBlockchainTxCountCtrl'
             }
           }
         });
@@ -44,7 +44,6 @@ angular.module('cesium.graph.network.controllers', ['chart.js', 'cesium.graph.se
 
   .controller('GpPeerViewExtendCtrl', GpPeerViewExtendController)
 
-  .controller('GpPeerStatsCtrl', GpPeerStatsController)
 ;
 
 
@@ -114,43 +113,3 @@ function GpPeerViewExtendController($scope, $timeout, PluginService, esSettings,
       });
   };
 }
-
-function GpPeerStatsController($scope, $controller, csCurrency) {
-  'ngInject';
-
-  // Initialize the super class and extend it.
-  angular.extend(this, $controller('GpBlockchainTxCountCtrl', {$scope: $scope}));
-
-  $scope.txOptions = $scope.txOptions || {};
-  $scope.node = $scope.node || {};
-
-  $scope.enter = function(e, state) {
-    if ($scope.loading) {
-
-      if (!$scope.currency && state && state.stateParams && state.stateParams.currency) { // Currency parameter
-        $scope.currency = state.stateParams.currency;
-      }
-
-      // Make sure there is currency, or load it not
-      if (!$scope.currency) {
-        return csCurrency.get()
-          .then(function(currency) {
-            $scope.currency = currency ? currency.name : null;
-            return $scope.enter(e, state);
-          });
-      }
-
-      if (!$scope.txOptions.issuer && state && state.stateParams && state.stateParams.pubkey) { // Pubkey parameter
-        // Add option to filter on issuer pubkey
-        $scope.txOptions.issuer = state.stateParams.pubkey;
-      }
-
-      return $scope.load()
-        .then(function() {
-          $scope.loading = false;
-        });
-    }
-  };
-  $scope.$on('$ionicView.enter', $scope.enter);
-
-}
-- 
GitLab