diff --git a/angular.json b/angular.json index 9b58dcac4728ae08b2ef060ff0f2926ea8f1dd78..d05d01cfb0cfee412ca4cae02b69b637841e6519 100755 --- a/angular.json +++ b/angular.json @@ -68,24 +68,6 @@ "browserTarget": "parapheur:build" } }, - "test": { - "builder": "@angular-devkit/build-angular:karma", - "options": { - "main": "./src/frontend/core/test.ts", - "polyfills": "./src/frontend/core/polyfills.ts", - "tsConfig": "./src/frontend/core/tsconfig.spec.json", - "karmaConfig": "./src/frontend/core/karma.conf.js", - "styles": [ - "./src/frontend/core/styles.scss", - "./node_modules/@fortawesome/fontawesome-free/css/all.min.css" - ], - "scripts": [], - "assets": [ - "src/frontend/core/favicon.ico", - "src/frontend/assets" - ] - } - }, "lint": { "builder": "@angular-devkit/build-angular:tslint", "options": { diff --git a/package.json b/package.json index 0c19da47ce7495814ac962463f53e567c76c7b88..d2e361e544daae59468fc2f0ccb4ccee75e84030 100644 --- a/package.json +++ b/package.json @@ -56,24 +56,15 @@ "codelyzer": "~5.0.0", "exif-js": "^2.3.0", "hammerjs": "^2.0.8", - "jasmine-core": "~3.4.0", - "jasmine-spec-reporter": "~4.2.1", "jquery": "^3.4.0", - "karma": "~4.0.1", - "karma-chrome-launcher": "~2.2.0", - "karma-coverage-istanbul-reporter": "^2.0.5", - "karma-jasmine": "~2.0.1", - "karma-jasmine-html-reporter": "^1.4.0", "ngx-cookie-service": "^2.1.0", "ngx-pipes": "^2.5.1", "ngx-scroll-event": "^1.0.8", "node-sass": "^4.11.0", "npm-check-updates": "^3.1.10", - "protractor": "^5.4.2", "rxjs": "^6.5.1", "stylus": "^0.54.5", "stylus-loader": "^3.0.2", - "ts-node": "~8.0.3", "tslint": "~5.15.0", "typescript": "3.2.4", "typescript-tools": "^0.3.1" diff --git a/src/app/user/controllers/UserController.php b/src/app/user/controllers/UserController.php index 80edcdb4f3cb168ad770112ed722869ae1dfc10b..da97e3fe40b814cf625f418f4bd1da5d82d2d17c 100755 --- a/src/app/user/controllers/UserController.php +++ b/src/app/user/controllers/UserController.php @@ -126,7 +126,7 @@ class UserController } if (!empty($body['isRest'])) { - $body['"isRest"'] = 'true'; + $body['"isRest"'] = true; } if (empty($body['picture'])) { $body['picture'] = base64_encode(file_get_contents('src/frontend/assets/user_picture.png')); @@ -220,7 +220,7 @@ class UserController } if (isset($body['isRest'])) { - $set['"isRest"'] = $body['isRest']; + $set['"isRest"'] = $body['isRest'] ? 'true' : 'false'; } UserModel::update([ diff --git a/src/app/user/models/UserModel.php b/src/app/user/models/UserModel.php index b588ac13b179bced0d843bdc1e127c0aaaeac57f..4b92238029b1a7f5944f87792efe54187b8a8355 100755 --- a/src/app/user/models/UserModel.php +++ b/src/app/user/models/UserModel.php @@ -79,7 +79,7 @@ class UserModel public static function create(array $args) { - ValidatorModel::notEmpty($args, ['login', 'email', 'firstname', 'lastname', 'mode', 'picture']); + ValidatorModel::notEmpty($args, ['login', 'email', 'firstname', 'lastname', 'picture']); ValidatorModel::stringType($args, ['login', 'email', 'firstname', 'lastname', 'picture', 'mode']); $nextSequenceId = DatabaseModel::getNextSequenceValue(['sequenceId' => 'users_id_seq']); @@ -93,7 +93,7 @@ class UserModel 'password' => AuthenticationModel::getPasswordHash('maarch'), 'firstname' => $args['firstname'], 'lastname' => $args['lastname'], - 'mode' => $args['mode'], + '"isRest"' => empty($args['isRest']) ? 'false' : 'true', 'picture' => $args['picture'], 'password_modification_date' => 'CURRENT_TIMESTAMP' ] diff --git a/src/frontend/app/administration/sendmail/sendmail.component.ts b/src/frontend/app/administration/sendmail/sendmail.component.ts index b835885ed5b897e9d25e84a15244b70db2371087..b851df86a0217ef86be0b2b366ae2d945e3f6ef4 100644 --- a/src/frontend/app/administration/sendmail/sendmail.component.ts +++ b/src/frontend/app/administration/sendmail/sendmail.component.ts @@ -9,16 +9,17 @@ import { TranslateService } from '@ngx-translate/core'; export interface Sendmail { - auth: boolean, - from: string, - host: string, - port: number, - type: string, - user: string, - secure: string, - charset: string, - password: string, - passwordAlreadyExists: boolean + + auth: boolean; + from: string; + host: string; + port: number; + type: string; + user: string; + secure: string; + charset: string; + password: string; + passwordAlreadyExists: boolean; } @Component({ @@ -106,11 +107,7 @@ export class SendmailComponent implements OnInit { } canValidate() { - if (JSON.stringify(this.sendmail) === JSON.stringify(this.sendmailClone)) { - return false; - } else { - return true; - } + return JSON.stringify(this.sendmail) !== JSON.stringify(this.sendmailClone); } onSubmit() { @@ -141,13 +138,13 @@ export class SendmailComponent implements OnInit { debug: '', error: false }; - let email = { - "sender": this.sendmail.from, - "recipients": [this.recipientTest], - "subject": "[" + this.translate.instant('lang.doNotReply') +"] " + this.translate.instant('lang.emailSendTest'), - "status": "EXPRESS", - "body": this.translate.instant('lang.emailSendTest'), - "isHtml": false + const email = { + 'sender' : this.sendmail.from, + 'recipients' : [this.recipientTest], + 'subject' : '[' + this.translate.instant('lang.doNotReply') + '] ' + this.translate.instant('lang.emailSendTest'), + 'status' : 'EXPRESS', + 'body' : this.translate.instant('lang.emailSendTest'), + 'isHtml' : false }; this.emailSendLoading = true; @@ -156,7 +153,7 @@ export class SendmailComponent implements OnInit { finalize(() => this.emailSendLoading = false) ) .subscribe({ - next: (data : any) => { + next: (data: any) => { if (data.isSent) { this.emailSendResult = { icon: 'fa-check green', @@ -181,7 +178,7 @@ export class SendmailComponent implements OnInit { this.sendmail.user = ''; this.sendmail.password = ''; } - + cancel() { this.router.navigate(['/administration']); } diff --git a/src/frontend/app/app.module.ts b/src/frontend/app/app.module.ts index feeddbd6f02bce0078e281f0e53a47ec62ec362e..521deffc5fe97df2a1e844ef7ab231e18c399883 100755 --- a/src/frontend/app/app.module.ts +++ b/src/frontend/app/app.module.ts @@ -184,11 +184,6 @@ import { AlertComponent } from './plugins/alert.component'; }) export class AppModule { } -// For traductions -export function HttpLoaderFactory(http: HttpClient) { - return new TranslateBackendHttpLoader(http); -} - export class TranslateBackendHttpLoader implements TranslateLoader { constructor(private http: HttpClient) { } @@ -203,3 +198,8 @@ export class TranslateBackendHttpLoader implements TranslateLoader { return this.http.get(`../rest/languages/` + lang); } } + +// For traductions +export function HttpLoaderFactory(http: HttpClient) { + return new TranslateBackendHttpLoader(http); +} diff --git a/src/frontend/app/document/document.component.ts b/src/frontend/app/document/document.component.ts index 9444e85381a16a56308150a7e4ce312a621d290b..400161858837ef30b1dee1a7072f920469b76102 100755 --- a/src/frontend/app/document/document.component.ts +++ b/src/frontend/app/document/document.component.ts @@ -229,9 +229,9 @@ export class DocumentComponent implements OnInit { this.signaturesService.signaturesContent = []; this.signaturesService.notesContent = []; - let notesContent = localStorage.getItem(this.mainDocument.id.toString()); + const notesContent = localStorage.getItem(this.mainDocument.id.toString()); if (notesContent) { - let storageContent = JSON.parse(notesContent); + const storageContent = JSON.parse(notesContent); this.signaturesService.notesContent = storageContent['note']; this.signaturesService.signaturesContent = storageContent['sign']; } diff --git a/src/frontend/app/documentNotePad/document-note-pad.component.ts b/src/frontend/app/documentNotePad/document-note-pad.component.ts index 51e860e170e3ad17f1c70bae32a3733596bd61eb..77cacdb6e62c80c734d8b8f6344a981d3cf8a8a3 100644 --- a/src/frontend/app/documentNotePad/document-note-pad.component.ts +++ b/src/frontend/app/documentNotePad/document-note-pad.component.ts @@ -33,7 +33,7 @@ export class DocumentNotePadComponent implements OnInit { fixWidth: this.signaturesService.x, mobileMode: this.signaturesService.mobileMode }); - $('input[value=\'' + this.signaturesService.userLogged.preferences.writingColor + '\']').click(); + $('input[value=\'' + this.signaturesService.userLogged.preferences.writingColor + '\']').trigger('click'); }, 200); } diff --git a/src/frontend/app/profile/profile.component.ts b/src/frontend/app/profile/profile.component.ts index 074ec4abcced1982d5e3b8cb7a006bc68a12776a..08537f85872da0ce3171dfc5d2c1a4864d101c73 100644 --- a/src/frontend/app/profile/profile.component.ts +++ b/src/frontend/app/profile/profile.component.ts @@ -184,7 +184,7 @@ export class ProfileComponent implements OnInit { submitProfile() { this.disableState = true; this.msgButton = 'lang.sending'; - let profileToSend = { + const profileToSend = { 'firstname': this.profileInfo.firstname, 'lastname': this.profileInfo.lastname, 'email': this.profileInfo.email, diff --git a/src/frontend/app/service/auth-interceptor.service.ts b/src/frontend/app/service/auth-interceptor.service.ts index ccf8fe9c52b322967f0e374380c1041bbd937041..780ec2c75fa66fe0a1ad13d682cd1d563b0da2f1 100644 --- a/src/frontend/app/service/auth-interceptor.service.ts +++ b/src/frontend/app/service/auth-interceptor.service.ts @@ -4,7 +4,7 @@ import { Observable } from 'rxjs'; import { Router } from '@angular/router'; import { catchError, switchMap } from 'rxjs/operators'; import { NotificationService } from './notification.service'; -import { empty } from 'rxjs'; +import { EMPTY } from 'rxjs'; import { SignaturesContentService } from './signatures.service'; import { AuthService } from './auth.service'; @@ -67,7 +67,7 @@ export class AuthInterceptor implements HttpInterceptor { // Disconnect user if bad token process if (err.status === 401) { this.logout(); - return empty(); + return EMPTY; } }) ); @@ -79,7 +79,7 @@ export class AuthInterceptor implements HttpInterceptor { if (err.status === 401) { this.logout(); } - return empty(); + return EMPTY; }) ); } else { @@ -90,12 +90,12 @@ export class AuthInterceptor implements HttpInterceptor { this.signaturesService.mainDocumentId = null; } this.router.navigate(['/documents']); - return empty(); + return EMPTY; } }); } this.notificationService.handleErrors(error); - return empty(); + return EMPTY; } }) ); diff --git a/src/frontend/app/service/auth.guard.ts b/src/frontend/app/service/auth.guard.ts index 96a3fe81c87c47411e913c204edf2a75e82df2f2..f778b0480ae74a85da488c74fb5878832f20a39f 100644 --- a/src/frontend/app/service/auth.guard.ts +++ b/src/frontend/app/service/auth.guard.ts @@ -19,8 +19,7 @@ export class AuthGuard implements CanActivate { const tokenInfo = this.authService.getToken(); if (tokenInfo !== null) { if (this.signaturesService.userLogged.id === undefined) { - const userInfo = JSON.parse(atob(tokenInfo.split('.')[1])).user; - this.signaturesService.userLogged = userInfo; + this.signaturesService.userLogged = JSON.parse(atob(tokenInfo.split('.')[1])).user; this.translate.use(this.signaturesService.userLogged.preferences.lang); this.cookieService.set('maarchParapheurLang', this.signaturesService.userLogged.preferences.lang); diff --git a/src/frontend/core/environments/environment.ts b/src/frontend/core/environments/environment.ts index d1528275ef0183387df4a60cda75bfbfbe94654a..4320ad78dcb82aa656ced6141d95eec543a55f78 100644 --- a/src/frontend/core/environments/environment.ts +++ b/src/frontend/core/environments/environment.ts @@ -4,7 +4,7 @@ export const environment = { production: false, - VERSION: require('../../../../package.json').version+' (development mode)', + VERSION: require('../../../../package.json').version + ' (development mode)', AUTHOR: require('../../../../package.json').author }; diff --git a/src/frontend/core/karma.conf.js b/src/frontend/core/karma.conf.js deleted file mode 100644 index b6e00421c95f925352ccf765b942a8e94c0cdc74..0000000000000000000000000000000000000000 --- a/src/frontend/core/karma.conf.js +++ /dev/null @@ -1,31 +0,0 @@ -// Karma configuration file, see link for more information -// https://karma-runner.github.io/1.0/config/configuration-file.html - -module.exports = function (config) { - config.set({ - basePath: '', - frameworks: ['jasmine', '@angular-devkit/build-angular'], - plugins: [ - require('karma-jasmine'), - require('karma-chrome-launcher'), - require('karma-jasmine-html-reporter'), - require('karma-coverage-istanbul-reporter'), - require('@angular-devkit/build-angular/plugins/karma') - ], - client: { - clearContext: false // leave Jasmine Spec Runner output visible in browser - }, - coverageIstanbulReporter: { - dir: require('path').join(__dirname, '../coverage'), - reports: ['html', 'lcovonly'], - fixWebpackSourcePaths: true - }, - reporters: ['progress', 'kjhtml'], - port: 9876, - colors: true, - logLevel: config.LOG_INFO, - autoWatch: true, - browsers: ['Chrome'], - singleRun: false - }); -}; \ No newline at end of file diff --git a/src/frontend/core/test.ts b/src/frontend/core/test.ts deleted file mode 100644 index 16317897b1c50a3a71bc775a8d6429f2b4c6cf98..0000000000000000000000000000000000000000 --- a/src/frontend/core/test.ts +++ /dev/null @@ -1,20 +0,0 @@ -// This file is required by karma.conf.js and loads recursively all the .spec and framework files - -import 'zone.js/dist/zone-testing'; -import { getTestBed } from '@angular/core/testing'; -import { - BrowserDynamicTestingModule, - platformBrowserDynamicTesting -} from '@angular/platform-browser-dynamic/testing'; - -declare const require: any; - -// First, initialize the Angular testing environment. -getTestBed().initTestEnvironment( - BrowserDynamicTestingModule, - platformBrowserDynamicTesting() -); -// Then we find all the tests. -const context = require.context('./', true, /\.spec\.ts$/); -// And load the modules. -context.keys().map(context); diff --git a/src/frontend/core/tsconfig.spec.json b/src/frontend/core/tsconfig.spec.json index 0ef7609d3ab809b3f69c66e8ae8c08313bb0bae2..895716a9059ea65acf3c86eb6641ac686edcf72f 100644 --- a/src/frontend/core/tsconfig.spec.json +++ b/src/frontend/core/tsconfig.spec.json @@ -3,7 +3,6 @@ "compilerOptions": { "outDir": "../out-tsc/spec", "types": [ - "jasmine", "node" ] }, diff --git a/src/frontend/core/tslint.json b/src/frontend/core/tslint.json index 52e2c1a5a74ce268bec92d34cd3bca751624adb3..78a62a0db6d7693016928f20962e6a9b923b8e16 100644 --- a/src/frontend/core/tslint.json +++ b/src/frontend/core/tslint.json @@ -1,5 +1,5 @@ { - "extends": "../tslint.json", + "extends": "../../../tslint.json", "rules": { "directive-selector": [ true, diff --git a/tslint.json b/tslint.json index 4a4e1b6f126dd74ffc0849910a1677c36d9d7143..8a06267f75b459436465f2789f9c2cde61fa4c94 100755 --- a/tslint.json +++ b/tslint.json @@ -120,7 +120,7 @@ "use-input-property-decorator": true, "use-output-property-decorator": true, "use-host-property-decorator": true, - "no-input-rename": true, + "no-input-rename": false, "no-output-rename": true, "use-life-cycle-interface": true, "use-pipe-transform-interface": true,