Some more changes linked to the change of api organization + some jshint error cleaning
authorymh <ymh.work@gmail.com>
Wed, 28 Sep 2016 17:24:02 +0200
changeset 306 3fccf43160a7
parent 305 ff6cf3fc5f40
child 307 07b44a378ad8
Some more changes linked to the change of api organization + some jshint error cleaning
cms/app-client/app/adapters/application.js
cms/app-client/app/components/player-component.js
cms/app-client/app/components/visu-carto.js
cms/app-client/app/components/visu-langues.js
cms/app-client/bower.json
cms/app-client/mirage/serializers/theme.js
cms/app-client/package.json
server/src/app/Repositories/DocumentRepository.php
server/src/app/Repositories/RdfDocumentRepository.php
server/src/tests/Controllers/BnfControllerTest.php
server/src/tests/Controllers/DiscourseControllerTest.php
server/src/tests/Controllers/GeonamesControllerTest.php
server/src/tests/Controllers/LanguageControllerTest.php
server/src/tests/Controllers/ThemeControllerTest.php
server/src/tests/Controllers/ViafControllerTest.php
--- a/cms/app-client/app/adapters/application.js	Wed Sep 28 15:58:18 2016 +0200
+++ b/cms/app-client/app/adapters/application.js	Wed Sep 28 17:24:02 2016 +0200
@@ -5,7 +5,7 @@
     transcript: 'transcript',
     geostat: 'stats/geostats',
     theme: 'stats/themes'
-}
+};
 
 export default RESTAdapter.extend({
 
--- a/cms/app-client/app/components/player-component.js	Wed Sep 28 15:58:18 2016 +0200
+++ b/cms/app-client/app/components/player-component.js	Wed Sep 28 17:24:02 2016 +0200
@@ -75,16 +75,16 @@
         text.css('text-indent', '0px');
         if(text.width() > jElement.width()) {
             var duration = ( ( text.width() - jElement.width() ) * 8 / 100 ) * 1000;
-            function animate() {
+            var animate = function() {
                 text.delay(4000)
                     .animate({
                         'text-indent': -( text.width() - jElement.width() ) + 'px'
                     }, duration, 'linear', function() {
                         text.stop(true);
-                        text.css('text-indent', '0px')
-                        window.setTimeout(function() { animate() }, 1);
+                        text.css('text-indent', '0px');
+                        window.setTimeout(function() { animate(); }, 1);
                     });
-            }
+            };
             animate();
         }
     },
--- a/cms/app-client/app/components/visu-carto.js	Wed Sep 28 15:58:18 2016 +0200
+++ b/cms/app-client/app/components/visu-carto.js	Wed Sep 28 17:24:02 2016 +0200
@@ -82,7 +82,7 @@
             };
             var departments = self.get('geostats').find(geostat => geostat.id === area.id);
             if(typeof departments === 'undefined') {
-                object['mouseEnabled'] = false,
+                object['mouseEnabled'] = false;
                 object['color'] = self.get('color');
             } else {
                 object['value'] = departments.get('count');
@@ -133,7 +133,7 @@
             };
             var continent = self.get('geostats').find(geostat => geostat.id === area.id);
             if(typeof continent === 'undefined') {
-                object['mouseEnabled'] = false,
+                object['mouseEnabled'] = false;
                 object['color'] = self.get('color');
             } else {
                 object['value'] = continent.get('count');
@@ -149,8 +149,7 @@
     },
 
     createAmMap: function() {
-        var self = this;
-        
+
         this.setContinentsAreas();
         this.set('dataProvider', {
             'mapVar': this.get('continentsMapVar'),
--- a/cms/app-client/app/components/visu-langues.js	Wed Sep 28 15:58:18 2016 +0200
+++ b/cms/app-client/app/components/visu-langues.js	Wed Sep 28 17:24:02 2016 +0200
@@ -19,8 +19,8 @@
 
         d3.json(baseurl+"/stats/languages", function(languages) {
             var margin = { top: 30, right: 0, bottom: 0, left: 0 };
-            var width = $('#' + self.get('elementId')).width();
-            var height = $('#' + self.get('elementId')).height() - margin.top - margin.bottom;
+            var width = Ember.$('#' + self.get('elementId')).width();
+            var height = Ember.$('#' + self.get('elementId')).height() - margin.top - margin.bottom;
 
             var array = Object.keys(languages).map(function (key) { return languages[key]; });
             var oldMin = Math.min(...array),
--- a/cms/app-client/bower.json	Wed Sep 28 15:58:18 2016 +0200
+++ b/cms/app-client/bower.json	Wed Sep 28 17:24:02 2016 +0200
@@ -1,7 +1,7 @@
 {
   "name": "app-client",
   "dependencies": {
-    "ember": "~2.8.0-beta.1",
+    "ember": "~2.8.0",
     "ember-cli-shims": "0.1.1",
     "ember-qunit-notifications": "0.1.0",
     "jquery": "^2.2",
--- a/cms/app-client/mirage/serializers/theme.js	Wed Sep 28 15:58:18 2016 +0200
+++ b/cms/app-client/mirage/serializers/theme.js	Wed Sep 28 17:24:02 2016 +0200
@@ -12,8 +12,8 @@
             response.models.sort(function(a, b) {
                 var aLabel = a.label.toUpperCase();
                 var bLabel = b.label.toUpperCase();
-                if (aLabel < bLabel) return -1;
-                if (aLabel > bLabel) return 1;
+                if (aLabel < bLabel) { return -1; }
+                if (aLabel > bLabel) { return 1; }
                 return 0;
             });
         // Descending order
--- a/cms/app-client/package.json	Wed Sep 28 15:58:18 2016 +0200
+++ b/cms/app-client/package.json	Wed Sep 28 17:24:02 2016 +0200
@@ -30,7 +30,7 @@
     "broccoli-static-compiler": "^0.2.2",
     "corpus-common-addon": "file:../../common/corpus-common-addon",
     "ember-ajax": "^2.4.1",
-    "ember-cli": "2.8.0-beta.2",
+    "ember-cli": "2.8.0",
     "ember-cli-app-version": "^1.0.0",
     "ember-cli-babel": "^5.1.6",
     "ember-cli-d3": "1.1.6",
@@ -39,14 +39,14 @@
     "ember-cli-htmlbars-inline-precompile": "^0.3.1",
     "ember-cli-inject-live-reload": "^1.4.0",
     "ember-cli-jshint": "^1.0.0",
-    "ember-cli-mirage": "0.2.0",
+    "ember-cli-mirage": "^0.2.2",
     "ember-cli-qunit": "^2.1.0",
     "ember-cli-release": "^0.2.9",
     "ember-cli-sass": "5.3.1",
     "ember-cli-sri": "^2.1.0",
     "ember-cli-test-loader": "^1.1.0",
     "ember-cli-uglify": "^1.2.0",
-    "ember-data": "^2.8.0-beta.1",
+    "ember-data": "^2.8.0",
     "ember-data-fixture-adapter": "1.13.0",
     "ember-disable-proxy-controllers": "^1.0.1",
     "ember-export-application-global": "^1.0.5",
--- a/server/src/app/Repositories/DocumentRepository.php	Wed Sep 28 15:58:18 2016 +0200
+++ b/server/src/app/Repositories/DocumentRepository.php	Wed Sep 28 17:24:02 2016 +0200
@@ -7,7 +7,7 @@
 
     public function all();
 
-    public function get($id, bool $short = false);
+    public function get($id, $short = false);
 
     public function save(Document $doc);
 
--- a/server/src/app/Repositories/RdfDocumentRepository.php	Wed Sep 28 15:58:18 2016 +0200
+++ b/server/src/app/Repositories/RdfDocumentRepository.php	Wed Sep 28 17:24:02 2016 +0200
@@ -178,7 +178,7 @@
         return $this->queryDocs();
     }
 
-    public function get($id, bool $short=false) {
+    public function get($id, $short=false) {
 
         if(strpos($id, config('corpusparole.corpus_id_scheme')) === 0) {
             $id = substr($id, strlen(config('corpusparole.corpus_id_scheme')));
--- a/server/src/tests/Controllers/BnfControllerTest.php	Wed Sep 28 15:58:18 2016 +0200
+++ b/server/src/tests/Controllers/BnfControllerTest.php	Wed Sep 28 17:24:02 2016 +0200
@@ -39,7 +39,7 @@
                 'ark:/12148/cb11946662b' => 'parents et enfants',
                 'ark:/12148/cb11965628b' => 'frères et soeurs'
             ]);
-        $response = $this->get('/api/v1/bnf/cb11946662b,cb11965628b')->
+        $response = $this->get('/api/v1/resolvers/bnf/cb11946662b,cb11965628b')->
             seeJsonEquals(['bnfids' => [
                 'ark:/12148/cb11946662b' => 'parents et enfants',
                 'ark:/12148/cb11965628b' => 'frères et soeurs'
@@ -54,7 +54,7 @@
             ->andReturn([
                 'ark:/12148/cb11946662b' => 'parents et enfants'
             ]);
-        $response = $this->get('/api/v1/bnf/cb11946662b')->
+        $response = $this->get('/api/v1/resolvers/bnf/cb11946662b')->
             seeJsonEquals(['bnfids' => [
                 'ark:/12148/cb11946662b' => 'parents et enfants'
             ]]);
@@ -68,7 +68,7 @@
             ->andReturn([
                 'ark:/12148/cb12345678b' => null
             ]);
-        $response = $this->get('/api/v1/bnf/cb12345678b')->
+        $response = $this->get('/api/v1/resolvers/bnf/cb12345678b')->
             seeJsonEquals(['bnfids' => [
                 'ark:/12148/cb12345678b' => null
             ]]);
@@ -80,7 +80,7 @@
             ->with(['ark:/12148/abcdef','ark:/12148/ghij'])
             ->once()
             ->andThrow('CorpusParole\Services\BnfResolverException', "BnfId not in correct format", 500);
-        $response = $this->get('/api/v1/bnf/abcdef,ghij');
+        $response = $this->get('/api/v1/resolvers/bnf/abcdef,ghij');
 
         $this->assertResponseStatus(500);
     }
--- a/server/src/tests/Controllers/DiscourseControllerTest.php	Wed Sep 28 15:58:18 2016 +0200
+++ b/server/src/tests/Controllers/DiscourseControllerTest.php	Wed Sep 28 17:24:02 2016 +0200
@@ -42,7 +42,7 @@
             ->with($query)
             ->once()
             ->andReturn(new \ArrayIterator([]));
-        $this->get('/api/v1/discourses/');
+        $this->get('/api/v1/stats/discourses/');
     }
 
     public function testIndex() {
@@ -55,7 +55,7 @@
                 (object)['res'=>new Resource('http://ark.bnf.fr/ark:/12148/cb119783362'), 'count' => Literal::create(33)],
                 (object)['res'=>new Resource('http://ark.bnf.fr/ark:/12148/cb13319048g'), 'count' => Literal::create(22)],
             ]));
-        $this->get('/api/v1/discourses/')->assertTrue($this->response->isOk(), $this->response->content());
+        $this->get('/api/v1/stats/discourses/')->assertTrue($this->response->isOk(), $this->response->content());
         $this->seeJsonEquals(["discourses" => [
             "http://ark.bnf.fr/ark:/12148/cb12083158d" => ["label" => "argumentation", "count" => 44],
             "http://ark.bnf.fr/ark:/12148/cb119783362" => ["label" => "bavardage", "count" => 33],
--- a/server/src/tests/Controllers/GeonamesControllerTest.php	Wed Sep 28 15:58:18 2016 +0200
+++ b/server/src/tests/Controllers/GeonamesControllerTest.php	Wed Sep 28 17:24:02 2016 +0200
@@ -33,7 +33,7 @@
             ->once()
             ->andReturn(['2968801' => 'Villedieu-les-Poêles', '2988507' => 'Paris', '6255148' => 'Europe']);
 
-        $response = $this->get('/api/v1/geonames/2968801,2988507,6255148')->
+        $response = $this->get('/api/v1/resolvers/geonames/2968801,2988507,6255148')->
             seeJsonEquals(['geonamesids' => ['2968801' => 'Villedieu-les-Poêles', '2988507' => 'Paris', '6255148' => 'Europe']]);
     }
 
@@ -45,7 +45,7 @@
             ->andReturn([
                 '2968801' => 'Villedieu-les-Poêles'
             ]);
-        $response = $this->get('/api/v1/geonames/2968801')->
+        $response = $this->get('/api/v1/resolvers/geonames/2968801')->
             seeJsonEquals(['geonamesids' => [
                 '2968801' => 'Villedieu-les-Poêles'
             ]]);
@@ -59,7 +59,7 @@
             ->andReturn([
                 '12345' => null
             ]);
-        $response = $this->get('/api/v1/geonames/12345')->
+        $response = $this->get('/api/v1/resolvers/geonames/12345')->
             seeJsonEquals(['geonamesids' => [
                 '12345' => null
             ]]);
@@ -71,7 +71,7 @@
             ->with(['abcdef','ghij'])
             ->once()
             ->andThrow('CorpusParole\Services\GeonamesResolverException', "GeonamesId not in correct format", 400);
-        $response = $this->get('/api/v1/geonames/abcdef,ghij');
+        $response = $this->get('/api/v1/resolvers/geonames/abcdef,ghij');
 
         $this->assertResponseStatus(400);
     }
--- a/server/src/tests/Controllers/LanguageControllerTest.php	Wed Sep 28 15:58:18 2016 +0200
+++ b/server/src/tests/Controllers/LanguageControllerTest.php	Wed Sep 28 17:24:02 2016 +0200
@@ -45,7 +45,7 @@
                 (object)['lang'=>new Resource('http://lexvo.org/id/iso639-3/fra'), 'count' => Literal::create(33)],
                 (object)['lang'=>new Resource('http://lexvo.org/id/iso639-3/bre'), 'count' => Literal::create(22)],
             ]));
-        $response = $this->get('/api/v1/languages/')->
+        $response = $this->get('/api/v1/stats/languages/')->
             seeJsonEquals(['languages' => [
                 'http://lexvo.org/id/iso639-3/gsw' => 44,
                 'http://lexvo.org/id/iso639-3/fra' => 33,
--- a/server/src/tests/Controllers/ThemeControllerTest.php	Wed Sep 28 15:58:18 2016 +0200
+++ b/server/src/tests/Controllers/ThemeControllerTest.php	Wed Sep 28 17:24:02 2016 +0200
@@ -42,7 +42,7 @@
             ->with($query)
             ->once()
             ->andReturn(new \ArrayIterator([]));
-        $this->get('/api/v1/themes/');
+        $this->get('/api/v1/stats/themes/');
     }
 
     public function testIndexQueryBnf() {
@@ -60,7 +60,7 @@
             ->with($query)
             ->once()
             ->andReturn(new \ArrayIterator([]));
-        $this->get('/api/v1/themes/?filter=bnf');
+        $this->get('/api/v1/stats/themes/?filter=bnf');
     }
 
 
@@ -78,7 +78,7 @@
             ->with($query)
             ->once()
             ->andReturn(new \ArrayIterator([]));
-        $this->get('/api/v1/themes/?filter=all');
+        $this->get('/api/v1/stats/themes/?filter=all');
     }
 
 
@@ -96,7 +96,7 @@
             ->with($query)
             ->once()
             ->andReturn(new \ArrayIterator([]));
-        $this->get('/api/v1/themes/?filter=none');
+        $this->get('/api/v1/stats/themes/?filter=none');
     }
 
 
@@ -114,7 +114,7 @@
             ->with($query)
             ->once()
             ->andReturn(new \ArrayIterator([]));
-        $this->get('/api/v1/themes/?filter=');
+        $this->get('/api/v1/stats/themes/?filter=');
     }
 
     public function testIndexQueryUri() {
@@ -132,7 +132,7 @@
             ->with($query)
             ->once()
             ->andReturn(new \ArrayIterator([]));
-        $this->get('/api/v1/themes/?filter=uri');
+        $this->get('/api/v1/stats/themes/?filter=uri');
     }
 
 
@@ -146,7 +146,7 @@
                 (object)['theme'=>new Resource('http://ark.bnf.fr/ark:/12148/cb119339867'), 'count' => Literal::create(33)],
                 (object)['theme'=>Literal::create('Français', 'fr'), 'count' => Literal::create(22)],
             ]));
-        $this->get('/api/v1/themes/')->assertTrue($this->response->isOk(), $this->response->content());
+        $this->get('/api/v1/stats/themes/')->assertTrue($this->response->isOk(), $this->response->content());
         $this->seeJsonEquals(["themes" => [
             "http://lexvo.org/id/iso639-3/gsw" => ["label" => "alémanique", "count" => 44],
             "http://ark.bnf.fr/ark:/12148/cb119339867" => ["label" => "famille", "count" => 33],
--- a/server/src/tests/Controllers/ViafControllerTest.php	Wed Sep 28 15:58:18 2016 +0200
+++ b/server/src/tests/Controllers/ViafControllerTest.php	Wed Sep 28 17:24:02 2016 +0200
@@ -35,7 +35,7 @@
                 '56666014' => 'Guylaine Brun-Trigaud',
                 '93752300' => 'Sonia Branca-Rosoff'
             ]);
-        $response = $this->get('/api/v1/viaf/93752300,56666014')->
+        $response = $this->get('/api/v1/resolvers/viaf/93752300,56666014')->
             seeJsonEquals(['viafids' => [
                 '56666014' => 'Guylaine Brun-Trigaud',
                 '93752300' => 'Sonia Branca-Rosoff'
@@ -50,7 +50,7 @@
             ->andReturn([
                 '93752300' => 'Sonia Branca-Rosoff'
             ]);
-        $response = $this->get('/api/v1/viaf/93752300')->
+        $response = $this->get('/api/v1/resolvers/viaf/93752300')->
             seeJsonEquals(['viafids' => [
                 '93752300' => 'Sonia Branca-Rosoff'
             ]]);
@@ -64,7 +64,7 @@
             ->andReturn([
                 '12345' => null
             ]);
-        $response = $this->get('/api/v1/viaf/12345')->
+        $response = $this->get('/api/v1/resolvers/viaf/12345')->
             seeJsonEquals(['viafids' => [
                 '12345' => null
             ]]);
@@ -76,7 +76,7 @@
             ->with(['abcdef','ghij'])
             ->once()
             ->andThrow('CorpusParole\Services\ViafResolverException', "ViafId not in correct format", 400);
-        $response = $this->get('/api/v1/viaf/abcdef,ghij');
+        $response = $this->get('/api/v1/resolvers/viaf/abcdef,ghij');
 
         $this->assertResponseStatus(400);
     }