diff --git a/Gruntfile.js b/Gruntfile.js index 6ec7898..4348181 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -152,8 +152,8 @@ module.exports = function (grunt) { src: [ '<%= yeoman.dist %>/scripts/**/*.js', '<%= yeoman.dist %>/assets/styles/**/*.css', - '<%= yeoman.dist %>/assets/images/**/*.{png,jpg,jpeg,gif,webp,svg}'//, - //'<%= yeoman.dist %>/assets/fonts/*' + '<%= yeoman.dist %>/assets/images/**/*.{png,jpg,jpeg,gif,webp,svg}', + '<%= yeoman.dist %>/assets/fonts/*' ] } } @@ -166,7 +166,8 @@ module.exports = function (grunt) { html: { steps: { js: ['concat', 'uglifyjs'], - css: ['cssmin', useminAutoprefixer] // Let cssmin concat files so it corrects relative paths to fonts and images + css: ['cssmin']//, useminAutoprefixer] // Let cssmin concat files so it corrects + // relative paths to fonts and images }, post: {} } @@ -268,8 +269,8 @@ module.exports = function (grunt) { src: [ '*.html', 'scripts/**/*.html', - 'assets/images/**/*.{png,gif,webp,jpg,jpeg,svg}' - //'assets/fonts/*' + 'assets/images/**/*.{png,gif,webp,jpg,jpeg,svg}', + 'assets/fonts/*' ] }, { expand: true, diff --git a/README.md b/README.md index b065a9c..8053692 100644 --- a/README.md +++ b/README.md @@ -55,8 +55,9 @@ Then navigate to [http://localhost:8080](http://localhost:8080) in your browser. cd docker/test docker-compose build + mkdir /data mkdir /data/postgres -R mkdir /data/es-data - sudo chown 999:999 es-data/ + sudo chown 999:999 /data/es-data/ diff --git a/docker/prod/docker-compose.yml b/docker/prod/docker-compose.yml index 63a1e2f..61bb191 100644 --- a/docker/prod/docker-compose.yml +++ b/docker/prod/docker-compose.yml @@ -15,6 +15,8 @@ services: - MAIL_HOST= smtp.ird.nc - MAIL_PORT= 25 env_file: ./malariaplantdb-web.env + # please define the variables POSTGRES_USER, POSTGRES_PASSWORD, MAIL_USERNAME and MAIL_PASSWORD in the + # malariaplantdb-web.env file. # example of the environment file content : # POSTGRES_USER=malariaplantdb # POSTGRES_PASSWORD=mpdb @@ -28,9 +30,6 @@ services: - /data/postgresql:/var/lib/postgresql/data ports: - "5432:5432" - environment: - - POSTGRES_USER=malariaplantdb - - POSTGRES_PASSWORD=mpdb env_file: ./malariaplantdb-db.env # please define the variables POSTGRES_USER and POSTGRES_PASSWORD in the malariaplantdb-db.env file. # example of the environment file content : @@ -39,12 +38,11 @@ services: elasticsearch: container_name: malariaplantdb-es - image: elasticsearch:5.6.5 + image: itzg/elasticsearch:1.3 volumes: - - /data/es-data:/usr/share/elasticsearch/data + - /data/es-data:/data ports: - "9200:9200" - "9300:9300" environment: - - cluster.name=malariaplantdb-cluster - - ES_JAVA_OPTS=-Xms1g -Xmx1g + - CLUSTER=malariaplantdb-cluster diff --git a/src/main/java/nc/ird/malariaplantdb/repository/InVitroPharmacoRepository.java b/src/main/java/nc/ird/malariaplantdb/repository/InVitroPharmacoRepository.java index ab548ca..201dc07 100644 --- a/src/main/java/nc/ird/malariaplantdb/repository/InVitroPharmacoRepository.java +++ b/src/main/java/nc/ird/malariaplantdb/repository/InVitroPharmacoRepository.java @@ -16,7 +16,7 @@ public interface InVitroPharmacoRepository extends JpaRepository findByPublicationId(Long id); - // Other method to fetch the authors and compilers relationships, but as it's by a join, the firsResult and + // Other method to fetch the authors and compilers relationships, but as it's by a join, the firstResult and // maxResults are applied in memory //@Query("select distinct inVitroPharmaco from InVitroPharmaco inVitroPharmaco left join fetch inVitroPharmaco" + // ".plantIngredients") diff --git a/src/main/java/nc/ird/malariaplantdb/web/rest/AuthorResource.java b/src/main/java/nc/ird/malariaplantdb/web/rest/AuthorResource.java index c2b6acd..1e9fe97 100644 --- a/src/main/java/nc/ird/malariaplantdb/web/rest/AuthorResource.java +++ b/src/main/java/nc/ird/malariaplantdb/web/rest/AuthorResource.java @@ -14,6 +14,7 @@ import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; +import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.*; import javax.inject.Inject; @@ -87,9 +88,12 @@ public ResponseEntity updateAuthor(@Valid @RequestBody Author author) th method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @Timed + @Transactional(readOnly = true) public ResponseEntity> getAllAuthors(Pageable pageable) throws URISyntaxException { Page page = authorRepository.findAll(pageable); + // eagerly load the association + page.getContent().stream().forEach(author -> author.getPublication().getTitle()); HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/authors"); return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK); } @@ -101,11 +105,15 @@ public ResponseEntity> getAllAuthors(Pageable pageable) method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @Timed + @Transactional(readOnly = true) public ResponseEntity getAuthor(@PathVariable Long id) { log.debug("REST request to get Author : {}", id); - return Optional.ofNullable(authorRepository.findOne(id)) - .map(author -> new ResponseEntity<>( - author, + Author author = authorRepository.findOne(id); + // eagerly load the association + author.getPublication().getTitle(); + return Optional.ofNullable(author) + .map(aut -> new ResponseEntity<>( + aut, HttpStatus.OK)) .orElse(new ResponseEntity<>(HttpStatus.NOT_FOUND)); } diff --git a/src/main/resources/config/application-prod.yml b/src/main/resources/config/application-prod.yml index 59436d4..e59d8c7 100644 --- a/src/main/resources/config/application-prod.yml +++ b/src/main/resources/config/application-prod.yml @@ -35,7 +35,8 @@ spring: hibernate.cache.region.factory_class: org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory data: elasticsearch: - cluster-nodes: {ELASTICSEARCH_HOST}:9300 + cluster-name: ${ELASTICSEARCH_CLUSTER} + cluster-nodes: ${ELASTICSEARCH_HOST}:9300 mail: host: ${MAIL_HOST} port: ${MAIL_PORT}