From 1b6d5640b711aafebaaaa9ba554d4961de588598 Mon Sep 17 00:00:00 2001 From: blavenie <benoit.lavenier@e-is.pro> Date: Sat, 20 Aug 2016 18:14:52 +0200 Subject: [PATCH] Fix JS Hint --- www/js/config.js | 4 +- www/js/controllers/currency-controllers.js | 16 ++-- .../es/js/controllers/market-controllers.js | 2 +- .../es/js/controllers/registry-controllers.js | 4 +- .../es/js/controllers/settings-controllers.js | 2 +- .../es/js/services/comment-services.js | 95 +++++++++---------- www/plugins/es/js/services/market-services.js | 4 +- .../es/js/services/registry-services.js | 4 +- 8 files changed, 65 insertions(+), 66 deletions(-) diff --git a/www/js/config.js b/www/js/config.js index 6b8baa41d..f5e82e2d4 100644 --- a/www/js/config.js +++ b/www/js/config.js @@ -28,8 +28,8 @@ angular.module("cesium.config", []) "port": "9203" } }, - "version": "0.1.29", - "build": "2016-08-20T15:50:56.272Z", + "version": "0.2.0", + "build": "2016-08-20T16:08:23.561Z", "newIssueUrl": "https://github.com/duniter/cesium/issues/new?labels=bug" }) diff --git a/www/js/controllers/currency-controllers.js b/www/js/controllers/currency-controllers.js index 18a336852..cacaf0079 100644 --- a/www/js/controllers/currency-controllers.js +++ b/www/js/controllers/currency-controllers.js @@ -266,14 +266,14 @@ function CurrencyViewController($scope, $q, $translate, $timeout, BMA, UIUtils, // Network $scope.loadingPeers = true; csNetwork.getPeers() - .then(function(peers) { - $scope.peers = peers; - $scope.loadingPeers = false; - }) - .catch(function(err) { - $scope.peers = []; - $scope.loadingPeers = false; - }) + .then(function(peers) { + $scope.peers = peers; + $scope.loadingPeers = false; + }) + .catch(function(err) { + $scope.peers = []; + $scope.loadingPeers = false; + }); }); }; } diff --git a/www/plugins/es/js/controllers/market-controllers.js b/www/plugins/es/js/controllers/market-controllers.js index 11cf8c640..ef7d0779c 100644 --- a/www/plugins/es/js/controllers/market-controllers.js +++ b/www/plugins/es/js/controllers/market-controllers.js @@ -103,7 +103,7 @@ function ESMarketLookupController($scope, $rootScope, esMarket, $state, $focus, // Search on category if ($state.stateParams && $state.stateParams.category) { - esMarket.category.get($state.stateParams.category) + esMarket.category.get({id: $state.stateParams.category}) .then(function(cat) { $scope.search.category = cat; hasOptions = runSearch = true; diff --git a/www/plugins/es/js/controllers/registry-controllers.js b/www/plugins/es/js/controllers/registry-controllers.js index 1373b18a7..46940cbe4 100644 --- a/www/plugins/es/js/controllers/registry-controllers.js +++ b/www/plugins/es/js/controllers/registry-controllers.js @@ -57,7 +57,7 @@ angular.module('cesium.es.registry.controllers', ['cesium.es.services', 'cesium. ; -function ESRegistryLookupController($scope, $state, $focus, $q, $timeout, esRegistry, UIUtils, $sanitize, ModalUtils, $filter, BMA) { +function ESRegistryLookupController($scope, $state, $focus, $timeout, esRegistry, UIUtils, ModalUtils, $filter, BMA) { 'ngInject'; $scope.search = { @@ -109,7 +109,7 @@ function ESRegistryLookupController($scope, $state, $focus, $q, $timeout, esRegi // Search on category if ($state.stateParams && $state.stateParams.category) { - esRegistry.category.get($state.stateParams.category) + esRegistry.category.get({id: $state.stateParams.category}) .then(function(cat) { $scope.search.category = cat; hasOptions = runSearch = true; diff --git a/www/plugins/es/js/controllers/settings-controllers.js b/www/plugins/es/js/controllers/settings-controllers.js index 893a76408..da91a34fa 100644 --- a/www/plugins/es/js/controllers/settings-controllers.js +++ b/www/plugins/es/js/controllers/settings-controllers.js @@ -181,5 +181,5 @@ function ESPluginSettingsController ($scope, $q, $translate, $ionicPopup, UIUti $scope.getServer = function() { return csHttp.getServer($scope.formData.host, $scope.formData.port); - } + }; } diff --git a/www/plugins/es/js/services/comment-services.js b/www/plugins/es/js/services/comment-services.js index 729715885..f3eff7ec5 100644 --- a/www/plugins/es/js/services/comment-services.js +++ b/www/plugins/es/js/services/comment-services.js @@ -13,57 +13,56 @@ angular.module('cesium.es.comment.services', ['ngResource', 'cesium.bma.services ; function getCommentsByRecordRequest() { - - return function(recordId, size) { - if (!size) { - size = 10; - } - else if (size < 0) { - size = 1000; - } - return $q(function(resolve, reject) { - var errorFct = function(err) { - reject(err); - }; - var request = { - sort : [ - { "time" : {"order" : "desc"}} - ], - query : { - constant_score:{ - filter: { - term: { record : recordId} - } + return function(recordId, size) { + if (!size) { + size = 10; + } + else if (size < 0) { + size = 1000; + } + return $q(function(resolve, reject) { + var errorFct = function(err) { + reject(err); + }; + var request = { + sort : [ + { "time" : {"order" : "desc"}} + ], + query : { + constant_score:{ + filter: { + term: { record : recordId} } - }, - from: 0, - size: size, - _source: fields.commons - }; - - postSearchCommentsRequest(request) - .then(function(res){ - if (res.hits.total === 0) { - resolve([]); } - else { - BMA.wot.member.uids(true/*cache*/) - .then(function(uids){ - var result = res.hits.hits.reduce(function(result, hit) { - var comment = hit._source; - comment.id = hit._id; - comment.uid = uids[comment.issuer]; - return result.concat(comment); - }, []); + }, + from: 0, + size: size, + _source: fields.commons + }; - resolve(result); - }) - .catch(errorFct); - } - }) - .catch(errorFct); - }); - } + postSearchCommentsRequest(request) + .then(function(res){ + if (res.hits.total === 0) { + resolve([]); + } + else { + BMA.wot.member.uids(true/*cache*/) + .then(function(uids){ + var result = res.hits.hits.reduce(function(result, hit) { + var comment = hit._source; + comment.id = hit._id; + comment.uid = uids[comment.issuer]; + return result.concat(comment); + }, []); + + resolve(result); + }) + .catch(errorFct); + } + }) + .catch(errorFct); + }); + }; } return { diff --git a/www/plugins/es/js/services/market-services.js b/www/plugins/es/js/services/market-services.js index e5801ace2..88030ceb7 100644 --- a/www/plugins/es/js/services/market-services.js +++ b/www/plugins/es/js/services/market-services.js @@ -54,7 +54,7 @@ angular.module('cesium.es.market.services', ['ngResource', 'cesium.services', 'c reject(err); }); }); - } + }; } @@ -67,7 +67,7 @@ angular.module('cesium.es.market.services', ['ngResource', 'cesium.services', 'c res.id = hit._id; return res; }); - } + }; } function getRecordCommonsRequest() { diff --git a/www/plugins/es/js/services/registry-services.js b/www/plugins/es/js/services/registry-services.js index 2e4f0d0a4..656e98760 100644 --- a/www/plugins/es/js/services/registry-services.js +++ b/www/plugins/es/js/services/registry-services.js @@ -56,7 +56,7 @@ angular.module('cesium.es.registry.services', ['ngResource', 'cesium.services', reject(err); }); }); - } + }; } function getCategoryRequest() { @@ -68,7 +68,7 @@ angular.module('cesium.es.registry.services', ['ngResource', 'cesium.services', res.id = hit._id; return res; }); - } + }; } function getCommonsRequest() { -- GitLab