diff --git a/platforms/desktop b/platforms/desktop index c840b056a35a48f52d13bb131e55618512f181e4..473c109b8e46634378c5f932702a86be060cfa46 160000 --- a/platforms/desktop +++ b/platforms/desktop @@ -1 +1 @@ -Subproject commit c840b056a35a48f52d13bb131e55618512f181e4 +Subproject commit 473c109b8e46634378c5f932702a86be060cfa46 diff --git a/www/js/controllers/wot-controllers.js b/www/js/controllers/wot-controllers.js index c3c245f045070428b747ebe53192fc1d39268ec7..4dc3b75d08fa16815564a0e4c2f2510163dce17c 100644 --- a/www/js/controllers/wot-controllers.js +++ b/www/js/controllers/wot-controllers.js @@ -43,7 +43,7 @@ angular.module('cesium.wot.controllers', ['cesium.services']) }) .state('app.wot_identity', { - url: "/wot/:pubkey/:uid?action", + url: "/wot/:pubkey/:uid?action&block", views: { 'menuContent': { templateUrl: "templates/wot/view_identity.html", @@ -73,7 +73,7 @@ angular.module('cesium.wot.controllers', ['cesium.services']) }) .state('app.wot_cert', { - url: "/wot/:pubkey/:uid/:type", + url: "/wot/:pubkey/:uid/:type?block", views: { 'menuContent': { templateUrl: "templates/wot/view_certifications.html", @@ -86,7 +86,7 @@ angular.module('cesium.wot.controllers', ['cesium.services']) }) .state('app.wot_cert_lg', { - url: "/wot/cert/lg/:pubkey/:uid", + url: "/wot/cert/lg/:pubkey/:uid?block", views: { 'menuContent': { templateUrl: "templates/wot/view_certifications.html", @@ -703,8 +703,8 @@ function WotIdentityAbstractController($scope, $rootScope, $state, $translate, $ viewData.enableBack = UIUtils.screen.isSmall() ? true : viewData.enableBack; }); - $scope.load = function(pubkey, withCache, uid) { - return csWot.load(pubkey, withCache, uid) + $scope.load = function(pubkey, uid, options) { + return csWot.load(pubkey, uid, options) .then(function(identity){ if (!identity) return UIUtils.onError('ERROR.IDENTITY_NOT_FOUND')().then($scope.showHome); $scope.formData = identity; @@ -731,7 +731,11 @@ function WotIdentityAbstractController($scope, $rootScope, $state, $translate, $ $scope.loading = true; UIUtils.loading.show(); } - return $scope.load($scope.formData.pubkey, false/*no cache*/, $scope.formData.uid) + var options = {cache: false}; // No cache + if ($scope.formData.blockUid) { + options.blockUid = $scope.formData.blockUid; + }; + return $scope.load($scope.formData.pubkey, $scope.formData.uid, options) .then(UIUtils.loading.hide); }; @@ -853,8 +857,10 @@ function WotIdentityAbstractController($scope, $rootScope, $state, $translate, $ UIUtils.loading.show(); + var options = {cache: false, blockUid: idty.blockUid}; + // load selected identity - return csWot.load(idty.pubkey, false /*no cache*/); + return csWot.load(idty.pubkey, idty.uid, options); }) .then(function (identity) { @@ -972,35 +978,41 @@ function WotIdentityAbstractController($scope, $rootScope, $state, $translate, $ /* -- open screens -- */ $scope.showCertifications = function() { + var block = $scope.formData.requirements && $scope.formData.requirements.alternatives && $scope.formData.blockUid || undefined; // Warn: do not use a simple link here (a ng-click is mandatory for help tour) if (UIUtils.screen.isSmall() ) { $state.go('app.wot_cert', { pubkey: $scope.formData.pubkey, uid: $scope.formData.uid, - type: 'received' + type: 'received', + block: block }); } else { $state.go('app.wot_cert_lg', { pubkey: $scope.formData.pubkey, - uid: $scope.formData.uid + uid: $scope.formData.uid, + block: block }); } }; $scope.showGivenCertifications = function() { + var block = $scope.formData.requirements && $scope.formData.requirements.alternatives && $scope.formData.blockUid || undefined; // Warn: do not use a simple link here (a ng-click is mandatory for help tour) if (UIUtils.screen.isSmall() ) { $state.go('app.wot_cert', { pubkey: $scope.formData.pubkey, uid: $scope.formData.uid, - type: 'given' + type: 'given', + block: block }); } else { $state.go('app.wot_cert_lg', { pubkey: $scope.formData.pubkey, - uid: $scope.formData.uid + uid: $scope.formData.uid, + block: block }); } }; @@ -1046,12 +1058,17 @@ function WotIdentityViewController($scope, $rootScope, $controller, $timeout, $s $scope.removeActionParamInLocationHref(state); } }; + var options = { + cache: true, + blockUid: state.stateParams && state.stateParams.block || undefined + }; if (state.stateParams && state.stateParams.pubkey && state.stateParams.pubkey.trim().length > 0) { if ($scope.loading) { // load once - return $scope.load(state.stateParams.pubkey.trim(), true /*withCache*/, state.stateParams.uid) + + return $scope.load(state.stateParams.pubkey.trim(), state.stateParams.uid, options) .then(onLoadSuccess); } } @@ -1060,7 +1077,7 @@ function WotIdentityViewController($scope, $rootScope, $controller, $timeout, $s state.stateParams.uid && state.stateParams.uid.trim().length > 0) { if ($scope.loading) { // load once - return $scope.load(null, true /*withCache*/, state.stateParams.uid) + return $scope.load(null, state.stateParams.uid, options) .then(onLoadSuccess); } } @@ -1069,7 +1086,7 @@ function WotIdentityViewController($scope, $rootScope, $controller, $timeout, $s else if (csWallet.isLogin()){ if ($scope.loading) { - return $scope.load(csWallet.data.pubkey, true /*withCache*/, csWallet.data.uid) + return $scope.load(csWallet.data.pubkey, csWallet.data.uid, options) .then(onLoadSuccess); } } @@ -1096,7 +1113,7 @@ function WotIdentityViewController($scope, $rootScope, $controller, $timeout, $s }; $scope.doQuickFix = function(event) { - if (event == "showSelectIdentities") { + if (event === 'showSelectIdentities') { return $scope.showSelectIdentities(); } }; @@ -1112,7 +1129,8 @@ function WotIdentityViewController($scope, $rootScope, $controller, $timeout, $s // open the identity return $state.go('app.wot_identity', { pubkey: res.pubkey, - uid: res.uid + uid: res.uid, + block: res.meta && res.meta.timestamp || res.blockUid }); }); }; @@ -1239,11 +1257,16 @@ function WotCertificationsViewController($scope, $rootScope, $controller, csSett // First load if ($scope.loading) { + var options = { + cache: true, + blockUid: state.stateParams && state.stateParams.block || undefined + }; + if (state.stateParams && state.stateParams.pubkey && state.stateParams.pubkey.trim().length > 0) { - return $scope.load(state.stateParams.pubkey.trim(), true /*withCache*/, state.stateParams.uid) + return $scope.load(state.stateParams.pubkey.trim(), state.stateParams.uid, options) .then(function () { $scope.doMotion(); $scope.showHelpTip(); @@ -1259,7 +1282,7 @@ function WotCertificationsViewController($scope, $rootScope, $controller, csSett if (!wallet.isLogin()) { return $scope.showHome(); } - return $scope.load(wallet.data.pubkey, true /*withCache*/, csWallet.data.uid) + return $scope.load(wallet.data.pubkey, wallet.data.uid, options) .then(function () { $scope.doMotion(); $scope.showHelpTip(); @@ -1278,7 +1301,11 @@ function WotCertificationsViewController($scope, $rootScope, $controller, csSett // Updating data $scope.doUpdate = function() { - return $scope.load($scope.formData.pubkey, false /*no cache*/, $scope.formData.uid) + var options = { + cache: false, // No cache + blockUid: $scope.formData.blockUid || undefined + }; + return $scope.load($scope.formData.pubkey, $scope.formData.uid, options) .then(function() { $scope.doMotion(); $scope.showHelpTip(); @@ -1374,7 +1401,7 @@ function WotCertificationsViewController($scope, $rootScope, $controller, csSett /** - * Select identities from a pubkey (yusfull when many self on the same pubkey) + * Select identities from a pubkey (useful when many self on the same pubkey) * @param $scope * @param $q * @param csWot diff --git a/www/js/services/wot-services.js b/www/js/services/wot-services.js index 38a9ed3f2931cb92b9bf4956152cb1f7d2763eac..1821362ad489b4aad0b05d9acdac124810d11fbf 100644 --- a/www/js/services/wot-services.js +++ b/www/js/services/wot-services.js @@ -630,23 +630,24 @@ angular.module('cesium.wot.services', ['ngApi', 'cesium.bma.services', 'cesium.c } }, - loadData = function(pubkey, withCache, uid, force) { + loadData = function(pubkey, uid, options) { + options = options || {}; var data; - if (!pubkey && uid && !force) { + if (!pubkey && uid && !options.force) { return BMA.wot.member.getByUid(uid) .then(function(member) { - if (member) return loadData(member.pubkey, withCache, member.uid); // recursive call + if (member) return loadData(member.pubkey, member.uid, options); // recursive call //throw {message: 'NOT_A_MEMBER'}; - return loadData(pubkey, withCache, uid, true/*force*/); + return loadData(pubkey, uid, angular.copy(options, {force: true})); }); } // Check cached data if (pubkey) { - data = withCache ? identityCache.get(pubkey) : null; - if (data && (!uid || data.uid == uid)) { + data = (!angular.isDefined(options.cache) || options.cache) ? identityCache.get(pubkey) : null; + if (data && (!uid || data.uid === uid) && (!options.blockUid || data.blockUid === options.blockUid)) { console.debug("[wot] Identity " + pubkey.substring(0, 8) + " found in cache"); return $q.when(data); } @@ -662,9 +663,11 @@ angular.module('cesium.wot.services', ['ngApi', 'cesium.bma.services', 'cesium.c uid: uid }; } + if (options.blockUid) { + data.blockUid = options.blockUid; + } var now = Date.now(); - var parameters; var medianTime; diff --git a/www/plugins/graph/js/controllers/account-controllers.js b/www/plugins/graph/js/controllers/account-controllers.js index ab9d2076dc6a696083df0cb1f6b8ad547df8ead4..6d2a5ab7bf23f9922606bf7e33a796726055443d 100644 --- a/www/plugins/graph/js/controllers/account-controllers.js +++ b/www/plugins/graph/js/controllers/account-controllers.js @@ -136,7 +136,7 @@ function GpAccountBalanceController($scope, $controller, $q, $state, $filter, $t var withUD = true; - return csWot.load($scope.formData.pubkey) + return csWot.loadRequirements({pubkey: $scope.formData.pubkey}) .then(function(identity) { $scope.identity = identity; withUD = $scope.identity.isMember || $scope.identity.wasMember; @@ -157,7 +157,7 @@ function GpAccountBalanceController($scope, $controller, $q, $state, $filter, $t 'COMMON.DATE_MONTH_YEAR_PATTERN']), // get data - gpData.blockchain.movement($scope.formData.currency, angular.copy($scope.formData)) + gpData.blockchain.movement($scope.formData.currency, angular.copy($scope.formData, {withUD: withUD})) ]); }) .then(function(result) { @@ -168,8 +168,7 @@ function GpAccountBalanceController($scope, $controller, $q, $state, $filter, $t if (!result || !result.times) return; // no data $scope.times = result.times; - var formatInteger = $filter('formatInteger'); - var formatAmount = $filter('formatDecimal'); + var formatDecimal = $filter('formatDecimal'); $scope.currencySymbol = $filter('currencySymbolNoHtml')($scope.formData.currency, $scope.formData.useRelative); // Data @@ -230,7 +229,7 @@ function GpAccountBalanceController($scope, $controller, $q, $state, $filter, $t return data.datasets[tooltipItems.datasetIndex].label + ': ' + (!tooltipItems.yLabel ? '0' : - (formatAmount(tooltipItems.yLabel) + ' ' + $scope.currencySymbol)); + (formatDecimal(tooltipItems.yLabel) + ' ' + $scope.currencySymbol)); } } } @@ -323,8 +322,6 @@ function GpAccountSumTxController($scope, $controller, $filter, $state, csTx, gp $scope.load = function(e, state) { if (!$scope.pubkey) return; - var formatDecimal = $filter('formatDecimal'); - // Load account TX data return csTx.load($scope.pubkey, -1) .then(function(result) { @@ -354,7 +351,12 @@ function GpAccountSumTxController($scope, $controller, $filter, $state, csTx, gp pubkey: tx.pubkey, sum: 0 }; - sumByPubkeys[tx.pubkey].sum += Math.abs(tx.amount/100); + sumByPubkeys[tx.pubkey].sum += Math.abs(tx.amount); + }); + + // Divide amount by 100 + _.each(_.keys(sumByPubkeys), function(pubkey) { + sumByPubkeys[pubkey].sum = sumByPubkeys[pubkey].sum / 100; }); // Get values (from the map), then sort (desc) on sum diff --git a/www/plugins/graph/templates/account/view_stats.html b/www/plugins/graph/templates/account/view_stats.html index ece16b12769c8040173e7681dbce9b1524095e4c..cac7dec8b067bab9c9a83eab42abd6bd9820d77d 100644 --- a/www/plugins/graph/templates/account/view_stats.html +++ b/www/plugins/graph/templates/account/view_stats.html @@ -35,16 +35,16 @@ ng-controller="GpAccountSumTxCtrl"> </div> - <!-- - - - - WOT - - - - --> - <!--<div class="item item-divider" translate> - GRAPH.ACCOUNT.WOT_DIVIDER - </div> - - <div class="item no-padding-xs" - ng-include="'plugins/graph/templates/account/graph_certifications.html'" - ng-controller="GpAccountCertificationCtrl" - ng-init="setSize(350, 1000)"> - </div>--> + <!-- - - - - WOT - - - - + <div class="item item-divider" translate> + GRAPH.ACCOUNT.WOT_DIVIDER + </div> + + <div class="item no-padding-xs" + ng-include="'plugins/graph/templates/account/graph_certifications.html'" + ng-controller="GpAccountCertificationCtrl" + ng-init="setSize(350, 1000)"> + </div>--> </ion-content> diff --git a/www/templates/wot/item_content_identity.html b/www/templates/wot/item_content_identity.html index d1df7d7871ab115d615b77bb3f5ae436e484b1fe..c1a419f2c7b24e2fd1e76ead24fbbc797f9b000a 100644 --- a/www/templates/wot/item_content_identity.html +++ b/www/templates/wot/item_content_identity.html @@ -10,7 +10,7 @@ ng-class="{'pull-right': !smallscreen}" ng-if="::item.sigDate"> <i class="ion-clock"></i> - {{::'WOT.LOOKUP.REGISTERED' | translate:item}} + {{::'WOT.LOOKUP.REGISTERED' | translate:item }} </h4> <h4 class="gray" ng-class="{'pull-right': !smallscreen}" diff --git a/www/templates/wot/modal_select_pubkey_identity.html b/www/templates/wot/modal_select_pubkey_identity.html index cd47546eb6fcf0a3a0e7ec595221ef247eb2c216..ec0e78b87f1c36d97a6916f30d30206af7029288 100644 --- a/www/templates/wot/modal_select_pubkey_identity.html +++ b/www/templates/wot/modal_select_pubkey_identity.html @@ -26,6 +26,15 @@ <span ng-if="::!item.revoked && !item.pendingRevocation && !item.isMember" class="assertive" translate>WOT.NOT_MEMBER_PARENTHESIS</span> <span ng-if="::item.revoked || item.pendingRevocation" class="assertive bold" translate>WOT.IDENTITY_REVOKED_PARENTHESIS</span> <span ng-if="::item.meta.invalid" class="assertive" translate>ERROR.WOT_PENDING_INVALID_BLOCK_HASH</span> + + <!--<span ng-if="::item.meta.time" class="assertive">{{ item.meta.time|formatDate }}</span>--> + </h4> + + <h4 class="dark" + ng-if="::item.meta.time"> + <i class="ion-calendar"></i> + <span translate>WOT.REGISTERED_SINCE</span> + {{::item.meta.time|medianDate}} </h4> <ng-if ng-if="::!item.revoked && !item.pendingRevocation && (item.certificationCount || item.pendingCertificationCount)"> @@ -35,7 +44,7 @@ parameters="$root.currency.parameters"></cs-badge-certification> <!-- certification label --> - <div class="gray badge badge-secondary" > + <div class="gray badge badge-secondary hidden-xs" > <span translate>ACCOUNT.CERTIFICATION_COUNT</span> </div> </ng-if>