diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 11f699b5deec147610d4031015418b1e00a5a752..0f3a7115d819c68866e7dbf1d1d559b85f71b6ab 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,5 +1,5 @@ stages: - - sonar-analysis + - quality - build - deploy @@ -16,6 +16,8 @@ build_branch: DOCKER_TLS_CERTDIR: '' DOCKER_HOST: tcp://docker:2375/ DOCKER_DRIVER: overlay2 + only: + - merge_requests image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/docker:18.09 stage: build except: @@ -102,36 +104,53 @@ deploy_rec: environment: name: rec url: https://resin-rec.grandlyon.com -# code_analysis: -# image: skilldlabs/sonar-scanner:3.4.0 -# services: -# - docker:18.09-dind -# stage: sonar-analysis -# only: -# - dev -# before_script: -# - export NODE_PATH=$NODE_PATH:`npm root -g` -# - npm install -g typescript -# script: -# - > -# sonar-scanner -# -Dsonar.projectName=${SONAR_PROJECT_KEY} -# -Dsonar.projectVersion=1.0 -# -Dsonar.sourceEncoding=UTF-8 -# -Dsonar.projectBaseDir=. -# -Dsonar.host.url=${SONAR_URL} -# -Dsonar.projectKey=${SONAR_PROJECT_KEY} -# -Dsonar.login=${SONAR_TOKEN} -# mr: -# variables: -# DOCKER_TLS_CERTDIR: '' -# DOCKER_HOST: tcp://docker:2375/ -# DOCKER_DRIVER: overlay2 -# image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/docker:18.09 -# stage: build -# only: -# - merge_requests -# script: -# - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY -# - docker build --pull -t "$CI_REGISTRY_IMAGE:dev" --build-arg conf=dev . +sonarqube: + stage: quality + only: + - dev + image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/sonarsource/sonar-scanner-cli:4 + variables: + SONAR_USER_HOME: '${CI_PROJECT_DIR}/.sonar' # Defines the location of the analysis task cache + GIT_DEPTH: '0' # T + cache: + key: '${CI_JOB_NAME}' + paths: + - .sonar/cache + script: + - > + sonar-scanner + -Dsonar.projectName=${SONAR_PROJECT_KEY} + -Dsonar.projectVersion=1.0 + -Dsonar.sourceEncoding=UTF-8 + -Dsonar.projectBaseDir=. + -Dsonar.host.url=${SONAR_URL} + -Dsonar.projectKey=${SONAR_PROJECT_KEY} + -Dsonar.login=${SONAR_TOKEN} + -Dsonar.cpd.exclusions=tests/**,src/**/*.spec.ts* + -Dsonar.qualitygate.wait=true + +sonarqube-mr: + stage: quality + only: + - merge_requests + image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/sonarsource/sonar-scanner-cli:4 + variables: + SONAR_USER_HOME: '${CI_PROJECT_DIR}/.sonar' # Defines the location of the analysis task cache + GIT_DEPTH: '0' # T + cache: + key: '${CI_JOB_NAME}' + paths: + - .sonar/cache + script: + - > + sonar-scanner + -Dsonar.projectName=${SONAR_PROJECT_KEY} + -Dsonar.projectVersion=1.0 + -Dsonar.sourceEncoding=UTF-8 + -Dsonar.projectBaseDir=. + -Dsonar.host.url=${SONAR_URL} + -Dsonar.projectKey=${SONAR_PROJECT_KEY} + -Dsonar.login=${SONAR_MR_TOKEN} + -Dsonar.cpd.exclusions=tests/**,src/**/*.spec.ts* + -Dsonar.qualitygate.wait=true diff --git a/src/app/admin/components/manage-users/manage-users.component.ts b/src/app/admin/components/manage-users/manage-users.component.ts index d4713e661aa5d7013f2e30e5c1d3a2f3109d2bc1..03399985c36f17ec38c16b133dc6ae7500ba9648 100644 --- a/src/app/admin/components/manage-users/manage-users.component.ts +++ b/src/app/admin/components/manage-users/manage-users.component.ts @@ -1,8 +1,8 @@ import { Component } from '@angular/core'; import { User } from '../../../models/user.model'; import { AdminService } from '../../services/admin.service'; -import { DeleteUserComponent } from './delete-user/delete-user.component'; import { AdministredStructuresComponent } from './administred-structures/administred-structures.component'; +import { DeleteUserComponent } from './delete-user/delete-user.component'; @Component({ selector: 'app-admin-manage-users', @@ -105,7 +105,7 @@ export class ManageUsersComponent { public findAttachedUsers(): void { this.adminService.getAttachedUsers().subscribe((users) => { this.attachedUsers = users; - this.attachedUsers.map((user) => { + this.attachedUsers.forEach((user) => { user._id = user['id']; }); }); @@ -120,7 +120,7 @@ export class ManageUsersComponent { public findUnVerifiedUsers(): void { this.adminService.getUnVerifiedUsers().subscribe((users) => { this.unVerifiedUsers = users; - this.unVerifiedUsers.map((user) => { + this.unVerifiedUsers.forEach((user) => { user._id = user['id']; }); }); diff --git a/src/app/form/orientation-form/component/structure-print-header/structure-print-header.component.html b/src/app/form/orientation-form/component/structure-print-header/structure-print-header.component.html index 7c09be92799f365e0fd65b12ceaa7647836d95f0..2e40f733618062b2bee566a82b9d04553ac623c6 100644 --- a/src/app/form/orientation-form/component/structure-print-header/structure-print-header.component.html +++ b/src/app/form/orientation-form/component/structure-print-header/structure-print-header.component.html @@ -25,8 +25,15 @@ </div> <div class="beneficiary"> <div class="informationHeader">{{ 'Bénéficiaire' | uppercase }}</div> - <!-- Name --> + <table class="beneficiaryNeeds"> + <caption style="display: none"> + Résumé du besoin de l'utilisateur pour impresion. + </caption> + <thead style="display: none"> + <th>Résumé de besoin</th> + </thead> + <!-- Name --> <tr> <td class="informationHeader">Nom</td> <td class="bold">{{ beneficiaryName }}</td> diff --git a/src/app/structure-list/components/structure-list-search/structure-list-search.component.spec.ts b/src/app/structure-list/components/structure-list-search/structure-list-search.component.spec.ts index d3480a96473500ca0bfd04257ea0aec7d9ae22a1..1cac4adfa66f31be62dfaf480b0d3a1643612953 100644 --- a/src/app/structure-list/components/structure-list-search/structure-list-search.component.spec.ts +++ b/src/app/structure-list/components/structure-list-search/structure-list-search.component.spec.ts @@ -1,13 +1,13 @@ +import { HttpClientTestingModule } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ReactiveFormsModule } from '@angular/forms'; +import { of } from 'rxjs'; +import { GeoJson } from '../../../map/models/geojson.model'; +import { GeojsonService } from '../../../services/geojson.service'; +import { TypeModal } from '../../enum/typeModal.enum'; import { Filter } from '../../models/filter.model'; -import { HttpClientTestingModule } from '@angular/common/http/testing'; -import { StructureListSearchComponent } from './structure-list-search.component'; import { Module } from '../../models/module.model'; -import { TypeModal } from '../../enum/typeModal.enum'; -import { GeojsonService } from '../../../services/geojson.service'; -import { GeoJson } from '../../../map/models/geojson.model'; -import { of } from 'rxjs'; +import { StructureListSearchComponent } from './structure-list-search.component'; describe('StructureListSearchComponent', () => { let component: StructureListSearchComponent; @@ -104,7 +104,6 @@ describe('StructureListSearchComponent', () => { const checkedModules: Module[] = [{ id: evt.target.value, text: categ, count: 0 }]; component.checkedModulesFilter = checkedModules; component.externalCheckboxCheck(evt, categ); - new Module(evt.target.value, categ); expect(component.checkedModulesFilter.length).toEqual(0); expect(component.numberMoreFiltersChecked).toEqual(0); }); @@ -122,7 +121,6 @@ describe('StructureListSearchComponent', () => { const checkedModules: Module[] = [{ id: evt.target.value, text: categ, count: 0 }]; component.checkedModulesFilter = checkedModules; component.externalCheckboxCheck(evt, categ); - new Module(evt.target.value, categ); expect(component.checkedModulesFilter.length).toEqual(0); expect(component.numberMoreFiltersChecked).toEqual(0); });