From 500d79ac4a4a44b4d111fd1bdc73ecb5048f1f75 Mon Sep 17 00:00:00 2001 From: Maxime Robert Date: Fri, 26 Jan 2024 16:21:01 +0100 Subject: [PATCH 1/6] Story #12110 Prettier: update config --- ui/ui-frontend-common/.prettierignore | 4 ++-- ui/ui-frontend-common/package-lock.json | 22 ++++++++++++++++++++++ ui/ui-frontend-common/package.json | 9 ++++++--- ui/ui-frontend/.prettierrc | 3 +-- ui/ui-frontend/package-lock.json | 16 +++++++++------- ui/ui-frontend/package.json | 6 ++++-- 6 files changed, 44 insertions(+), 16 deletions(-) diff --git a/ui/ui-frontend-common/.prettierignore b/ui/ui-frontend-common/.prettierignore index bb7f5242440..b11107c1e4f 100644 --- a/ui/ui-frontend-common/.prettierignore +++ b/ui/ui-frontend-common/.prettierignore @@ -7,7 +7,7 @@ target /* # Except files in projects: -!/projects +!/src # Ignore all given extensions files: *.css @@ -15,4 +15,4 @@ target *.json # Except json files in any assets folder -!**/assets/**/*.json \ No newline at end of file +!**/assets/**/*.json diff --git a/ui/ui-frontend-common/package-lock.json b/ui/ui-frontend-common/package-lock.json index 4553968dfe0..495c3980129 100644 --- a/ui/ui-frontend-common/package-lock.json +++ b/ui/ui-frontend-common/package-lock.json @@ -65,6 +65,7 @@ "ngx-quicklink": "^0.2.1", "node-sass": "^4.14.1", "popper.js": "^1.16.1", + "prettier": "3.2.4", "protractor": "~7.0.0", "puppeteer": "~19.6.3", "rxjs": "^6.5.5", @@ -14823,6 +14824,21 @@ "node": ">=0.10.0" } }, + "node_modules/prettier": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.4.tgz", + "integrity": "sha512-FWu1oLHKCrtpO1ypU6J0SbK2d9Ckwysq6bHj/uaCP26DxrPpppCLQRGVuqAxSTvhF00AcvDRyYrLNW7ocBhFFQ==", + "dev": true, + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, "node_modules/process": { "version": "0.11.10", "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", @@ -33071,6 +33087,12 @@ "integrity": "sha512-PhmXi5XmoyKw1Un4E+opM2KcsJInDvKyuOumcjjw3waw86ZNjHwVUOOWLc4bCzLdcKNaWBH9e99sbWzDQsVaYg==", "dev": true }, + "prettier": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.4.tgz", + "integrity": "sha512-FWu1oLHKCrtpO1ypU6J0SbK2d9Ckwysq6bHj/uaCP26DxrPpppCLQRGVuqAxSTvhF00AcvDRyYrLNW7ocBhFFQ==", + "dev": true + }, "process": { "version": "0.11.10", "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", diff --git a/ui/ui-frontend-common/package.json b/ui/ui-frontend-common/package.json index b657059ad34..20740e1397c 100644 --- a/ui/ui-frontend-common/package.json +++ b/ui/ui-frontend-common/package.json @@ -25,7 +25,9 @@ "copy-assets": "cp-cli ./src/assets ./dist/assets", "tar": "npm pack ./dist", "check": "npm run lint && npm test && npm run build", - "publish-dist": "npm publish ./dist" + "publish-dist": "npm publish ./dist", + "prettier": "prettier --write --ignore-unknown .", + "prettier:ci": "prettier --check --ignore-unknown ." }, "ngPackage": { "lib": { @@ -96,6 +98,7 @@ "@angular/router": "10.1.3", "@types/jasmine": "~3.3.0", "@types/jasminewd2": "^2.0.8", + "@types/lodash": "4.14.191", "@types/lodash-es": "^4.17.3", "@types/node": "^12.11.1", "bootstrap": "^4.5.0", @@ -123,6 +126,7 @@ "ngx-quicklink": "^0.2.1", "node-sass": "^4.14.1", "popper.js": "^1.16.1", + "prettier": "3.2.4", "protractor": "~7.0.0", "puppeteer": "~19.6.3", "rxjs": "^6.5.5", @@ -136,8 +140,7 @@ "utf-8-validate": "^5.0.2", "web-animations-js": "^2.3.2", "webpack-bundle-analyzer": "^3.8.0", - "zone.js": "~0.10.2", - "@types/lodash": "4.14.191" + "zone.js": "~0.10.2" }, "resolutions": { "moment": "2.26.0" diff --git a/ui/ui-frontend/.prettierrc b/ui/ui-frontend/.prettierrc index 9821c567d99..946c56e5851 100644 --- a/ui/ui-frontend/.prettierrc +++ b/ui/ui-frontend/.prettierrc @@ -5,6 +5,5 @@ "tabWidth": 2, "semi": true, "bracketSpacing": true, - "arrowParens": "always", - "jsxBracketSameLine": true + "arrowParens": "always" } diff --git a/ui/ui-frontend/package-lock.json b/ui/ui-frontend/package-lock.json index 93026dfd082..25a4186eca0 100644 --- a/ui/ui-frontend/package-lock.json +++ b/ui/ui-frontend/package-lock.json @@ -54,7 +54,6 @@ "ngx-translate-multi-http-loader": "^3.0.0", "ngx-ui-loader": "^10.0.0", "popper.js": "^1.16.1", - "prettier": "^3.1.1", "remove": "^0.1.5", "rxjs": "^6.5.5", "serialize-javascript": "^5.0.1", @@ -100,6 +99,7 @@ "ngx-i18nsupport": "^0.17.1", "ngx-markdown": "10.1.1", "node-sass": "^4.14.1", + "prettier": "3.2.4", "protractor": "^7.0.0", "puppeteer": "~19.6.3", "ts-node": "~7.0.1", @@ -16568,9 +16568,10 @@ } }, "node_modules/prettier": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.1.1.tgz", - "integrity": "sha512-22UbSzg8luF4UuZtzgiUOfcGM8s4tjBv6dJRT7j275NXsy2jb4aJa4NNveul5x4eqlF1wuhuR2RElK71RvmVaw==", + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.4.tgz", + "integrity": "sha512-FWu1oLHKCrtpO1ypU6J0SbK2d9Ckwysq6bHj/uaCP26DxrPpppCLQRGVuqAxSTvhF00AcvDRyYrLNW7ocBhFFQ==", + "dev": true, "bin": { "prettier": "bin/prettier.cjs" }, @@ -37041,9 +37042,10 @@ "dev": true }, "prettier": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.1.1.tgz", - "integrity": "sha512-22UbSzg8luF4UuZtzgiUOfcGM8s4tjBv6dJRT7j275NXsy2jb4aJa4NNveul5x4eqlF1wuhuR2RElK71RvmVaw==" + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.4.tgz", + "integrity": "sha512-FWu1oLHKCrtpO1ypU6J0SbK2d9Ckwysq6bHj/uaCP26DxrPpppCLQRGVuqAxSTvhF00AcvDRyYrLNW7ocBhFFQ==", + "dev": true }, "prismjs": { "version": "1.29.0", diff --git a/ui/ui-frontend/package.json b/ui/ui-frontend/package.json index f102b8dd531..e822726d310 100644 --- a/ui/ui-frontend/package.json +++ b/ui/ui-frontend/package.json @@ -84,7 +84,9 @@ "check:collect": "npm run lint:collect && npm run test:collect && npm run build:collect", "copy-scss:vitamui-library": "cp-cli ./projects/vitamui-library/src/sass ./dist/sass", "build:vitamui-library": "ng build vitamui-library", - "watch:vitamui-library": "ng build vitamui-library --watch" + "watch:vitamui-library": "ng build vitamui-library --watch", + "prettier": "prettier --write --ignore-unknown .", + "prettier:ci": "prettier --check --ignore-unknown ." }, "private": true, "dependencies": { @@ -132,7 +134,6 @@ "ngx-translate-multi-http-loader": "^3.0.0", "ngx-ui-loader": "^10.0.0", "popper.js": "^1.16.1", - "prettier": "^3.1.1", "remove": "^0.1.5", "rxjs": "^6.5.5", "serialize-javascript": "^5.0.1", @@ -178,6 +179,7 @@ "ngx-i18nsupport": "^0.17.1", "ngx-markdown": "10.1.1", "node-sass": "^4.14.1", + "prettier": "3.2.4", "protractor": "^7.0.0", "puppeteer": "~19.6.3", "ts-node": "~7.0.1", From 440c0879bfb4b9f1a7f4b255263e5277a1927ef3 Mon Sep 17 00:00:00 2001 From: Maxime Robert Date: Mon, 29 Jan 2024 11:50:39 +0100 Subject: [PATCH 2/6] Story #12110 Prettier: updated README documentation --- ui/ui-frontend-common/README.md | 43 +++++++++++++++ ui/ui-frontend/README.md | 93 +++++++++++++++------------------ 2 files changed, 86 insertions(+), 50 deletions(-) diff --git a/ui/ui-frontend-common/README.md b/ui/ui-frontend-common/README.md index 6f9abd69a5e..45c04c0d39c 100644 --- a/ui/ui-frontend-common/README.md +++ b/ui/ui-frontend-common/README.md @@ -26,6 +26,49 @@ Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protrac To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md). +## IDE configuration + +### VSCode + +#### Recommended Extensions for VSCode + +- "ms-vscode.vscode-typescript-tslint-plugin" : for more information: // TsLinst, https://marketplace.visualstudio.com/items?itemName=ms-vscode. +- "esbenp.prettier-vscode" : for more information: // Code formater Prettier, https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode +- "sibiraj-s.vscode-scss-formatter" : for more information: // SCSS Formatter, https://marketplace.visualstudio.com/items?itemName=sibiraj-s.vscode-scss-formatter +- "msjsdiag.debugger-for-chrome": for more information: // Debbuger for Chrome, https://marketplace.visualstudio.com/items?itemName=msjsdiag.debugger-for-chrome +- "firefox-devtools.vscode-firefox-debug" : for more information: // Debbuger for Firefox, https://marketplace.visualstudio.com/items?itemName=firefox-devtools.vscode-firefox-debug + +#### VSCode settings + +Bellow, an example to manage code format for Visual studio code using `settings.json` file: + +```json5 +{ + "editor.formatOnSave": true, + "[typescript]": { + "editor.codeActionsOnSave": { + "source.fixAll.tslint": true, + "source.organizeImports": true + }, + "editor.defaultFormatter": "esbenp.prettier-vscode", + }, + "[html]": { + "editor.defaultFormatter": "esbenp.prettier-vscode", + }, + "[scss]": { + "editor.defaultFormatter": "esbenp.prettier-vscode", + }, + "search.exclude": { + "**/node_modules": true, + "**/dist": true, + }, +} +``` + +### IntelliJ + +- Enable "Automatic Prettier configuration", set `**/*.{js,ts,html,json,md,scss}` in "Run for files" and check the "Run on save" checkbox + # Common lib specific info ## Usage diff --git a/ui/ui-frontend/README.md b/ui/ui-frontend/README.md index 490814d6e50..b74162679ca 100644 --- a/ui/ui-frontend/README.md +++ b/ui/ui-frontend/README.md @@ -26,6 +26,49 @@ Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protrac To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md). +## IDE configuration + +### VSCode + +#### Recommended Extensions for VSCode + +- "ms-vscode.vscode-typescript-tslint-plugin" : for more information: // TsLinst, https://marketplace.visualstudio.com/items?itemName=ms-vscode. +- "esbenp.prettier-vscode" : for more information: // Code formater Prettier, https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode +- "sibiraj-s.vscode-scss-formatter" : for more information: // SCSS Formatter, https://marketplace.visualstudio.com/items?itemName=sibiraj-s.vscode-scss-formatter +- "msjsdiag.debugger-for-chrome": for more information: // Debbuger for Chrome, https://marketplace.visualstudio.com/items?itemName=msjsdiag.debugger-for-chrome +- "firefox-devtools.vscode-firefox-debug" : for more information: // Debbuger for Firefox, https://marketplace.visualstudio.com/items?itemName=firefox-devtools.vscode-firefox-debug + +#### VSCode settings + +Bellow, an example to manage code format for Visual studio code using `settings.json` file: + +```json5 +{ + "editor.formatOnSave": true, + "[typescript]": { + "editor.codeActionsOnSave": { + "source.fixAll.tslint": true, + "source.organizeImports": true + }, + "editor.defaultFormatter": "esbenp.prettier-vscode", + }, + "[html]": { + "editor.defaultFormatter": "esbenp.prettier-vscode", + }, + "[scss]": { + "editor.defaultFormatter": "esbenp.prettier-vscode", + }, + "search.exclude": { + "**/node_modules": true, + "**/dist": true, + }, +} +``` + +### IntelliJ + +- Enable "Automatic Prettier configuration", set `**/*.{js,ts,html,json,md,scss}` in "Run for files" and check the "Run on save" checkbox + ## How to add icons to the library Go to [icomoon.io](https://icomoon.io/app/#/select). @@ -53,7 +96,6 @@ You also need to update the `vitamui-icons.css` file. Open the `style.css` from Please add each new icon to the icon category in the starter-kit project. - ## How to add application icons to the portal Place you new svg icon file in the `ui/ui-frontend/projects/portal/src/assets/app-icons` folder. @@ -68,55 +110,6 @@ Replace each css class ids (for example .stXXX) and svgids (for example #SVGID_X Please add each new icon to the icon category in the starter-kit project. -## Format front end code - -# Recommended Extensions for Visual studio code : - -- "ms-vscode.vscode-typescript-tslint-plugin" : for more information: // TsLinst, https://marketplace.visualstudio.com/items?itemName=ms-vscode. -- "esbenp.prettier-vscode" : for more information: // Code formater Prettier, https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode -- "sibiraj-s.vscode-scss-formatter" : for more information: // SCSS Formatter, https://marketplace.visualstudio.com/items?itemName=sibiraj-s.vscode-scss-formatter -- "msjsdiag.debugger-for-chrome": for more information: // Debbuger for Chrome, https://marketplace.visualstudio.com/items?itemName=msjsdiag.debugger-for-chrome -- "firefox-devtools.vscode-firefox-debug" : for more information: // Debbuger for Firefox, https://marketplace.visualstudio.com/items?itemName=firefox-devtools.vscode-firefox-debug - -# Visual studio code setting : - -Bellow and example to manage code format for Visual studio code using settings.json file : - -{ -"editor.formatOnSave": true, -"[typescript]": { -"editor.codeActionsOnSave": { -"source.fixAll.tslint": true, -"source.organizeImports": true -}, -"editor.defaultFormatter": "esbenp.prettier-vscode", -}, -"[html]": { -"editor.defaultFormatter": "esbenp.prettier-vscode", -}, -"[scss]": { -"editor.defaultFormatter": "esbenp.prettier-vscode", -}, -"search.exclude": { -"**/node_modules": true, -"**/dist": true, -}, -} - - -## How to add application icons to the portal - -Place you new svg icon file in the `ui/ui-frontend/projects/portal/src/assets/app-icons` folder. - -> Attention: Make sure your svg icon file name corresponds to the concerned application identifier (ex: PORTAL_APP.svg), you can find your application identifier by checking database. - -Replace each static hex/rgb colors inside the svg file by the right css variable theme colors. - -Replace each css class ids (for example .stXXX) and svgids (for example #SVGID_XX) by unique identifier compared to the others svg. - -> Attention: If an other application svg have the same class identifiers, your svg will not be displayed properly. **Also, do not forget to rename the css class & svgids usage in the whole file**. - - ## Standalone Profile The standalone profile is used to build the pastis project ignoring other ui-frontend projects : From 866c3abd20afb7637acc5785d400aad2e28973f8 Mon Sep 17 00:00:00 2001 From: Maxime Robert Date: Fri, 26 Jan 2024 17:56:46 +0100 Subject: [PATCH 3/6] Story #12110 Prettier: add pre-commit hook --- ui/ui-frontend-common/.husky/pre-commit | 8 + ui/ui-frontend-common/package-lock.json | 1046 +++++++++++++++++++++++ ui/ui-frontend-common/package.json | 8 +- ui/ui-frontend/.husky/pre-commit | 8 + ui/ui-frontend/package-lock.json | 1031 ++++++++++++++++++++++ ui/ui-frontend/package.json | 8 +- 6 files changed, 2107 insertions(+), 2 deletions(-) create mode 100755 ui/ui-frontend-common/.husky/pre-commit create mode 100755 ui/ui-frontend/.husky/pre-commit diff --git a/ui/ui-frontend-common/.husky/pre-commit b/ui/ui-frontend-common/.husky/pre-commit new file mode 100755 index 00000000000..64db83efd0b --- /dev/null +++ b/ui/ui-frontend-common/.husky/pre-commit @@ -0,0 +1,8 @@ +#!/usr/bin/env sh +[ -n "$CI" ] && exit 0 + +. "$(dirname -- "$0")/_/husky.sh" + +cd ui/ui-frontend-common/ + +npx lint-staged@13 diff --git a/ui/ui-frontend-common/package-lock.json b/ui/ui-frontend-common/package-lock.json index 495c3980129..eb27977cfad 100644 --- a/ui/ui-frontend-common/package-lock.json +++ b/ui/ui-frontend-common/package-lock.json @@ -47,6 +47,7 @@ "core-js": "3.6.5", "cp-cli": "^2.0.0", "file-loader": "^6.0.0", + "husky": "8.0.3", "imagemin": "^6.1.0", "img-loader": "^3.0.1", "jasmine-core": "~3.7.0", @@ -57,6 +58,7 @@ "karma-coverage-istanbul-reporter": "~3.0.2", "karma-jasmine": "~4.0.0", "karma-jasmine-html-reporter": "^1.5.0", + "lint-staged": "13.2.3", "material-design-icons": "^3.0.1", "mini-svg-data-uri": "^1.2.3", "moment-locales-webpack-plugin": "^1.2.0", @@ -3822,6 +3824,15 @@ "integrity": "sha512-eBvWn1lvIApYMhzQMsu9ciLfkBY499mFZlNqG+/9WR7PVlroQw0vG30cOQQbaKz3sCEc44TAOu2ykzqXSNnwag==", "dev": true }, + "node_modules/astral-regex": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", + "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/async": { "version": "2.6.4", "resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz", @@ -5007,6 +5018,72 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/cli-truncate": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-3.1.0.tgz", + "integrity": "sha512-wfOBkjXteqSnI59oPcJkcPl/ZmwvMMOj340qUIY1SKZCv0B9Cf4D4fAucRkIKQmsIuYK3x1rrgU7MeGRruiuiA==", + "dev": true, + "dependencies": { + "slice-ansi": "^5.0.0", + "string-width": "^5.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cli-truncate/node_modules/ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/cli-truncate/node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true + }, + "node_modules/cli-truncate/node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cli-truncate/node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, "node_modules/cli-width": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-3.0.0.tgz", @@ -6763,6 +6840,12 @@ "stream-shift": "^1.0.0" } }, + "node_modules/eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "dev": true + }, "node_modules/ecc-jsbn": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", @@ -9051,6 +9134,15 @@ "ms": "^2.1.1" } }, + "node_modules/human-signals": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-4.3.1.tgz", + "integrity": "sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ==", + "dev": true, + "engines": { + "node": ">=14.18.0" + } + }, "node_modules/humanize-ms": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", @@ -9060,6 +9152,21 @@ "ms": "^2.0.0" } }, + "node_modules/husky": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/husky/-/husky-8.0.3.tgz", + "integrity": "sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg==", + "dev": true, + "bin": { + "husky": "lib/bin.js" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/typicode" + } + }, "node_modules/iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", @@ -11290,12 +11397,383 @@ "immediate": "~3.0.5" } }, + "node_modules/lilconfig": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.1.0.tgz", + "integrity": "sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==", + "dev": true, + "engines": { + "node": ">=10" + } + }, "node_modules/lines-and-columns": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", "dev": true }, + "node_modules/lint-staged": { + "version": "13.2.3", + "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-13.2.3.tgz", + "integrity": "sha512-zVVEXLuQIhr1Y7R7YAWx4TZLdvuzk7DnmrsTNL0fax6Z3jrpFcas+vKbzxhhvp6TA55m1SQuWkpzI1qbfDZbAg==", + "dev": true, + "dependencies": { + "chalk": "5.2.0", + "cli-truncate": "^3.1.0", + "commander": "^10.0.0", + "debug": "^4.3.4", + "execa": "^7.0.0", + "lilconfig": "2.1.0", + "listr2": "^5.0.7", + "micromatch": "^4.0.5", + "normalize-path": "^3.0.0", + "object-inspect": "^1.12.3", + "pidtree": "^0.6.0", + "string-argv": "^0.3.1", + "yaml": "^2.2.2" + }, + "bin": { + "lint-staged": "bin/lint-staged.js" + }, + "engines": { + "node": "^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/lint-staged" + } + }, + "node_modules/lint-staged/node_modules/chalk": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.2.0.tgz", + "integrity": "sha512-ree3Gqw/nazQAPuJJEy+avdl7QfZMcUvmHIKgEZkGL+xOBzRvup5Hxo6LHuMceSxOabuJLJm5Yp/92R9eMmMvA==", + "dev": true, + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/lint-staged/node_modules/commander": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz", + "integrity": "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==", + "dev": true, + "engines": { + "node": ">=14" + } + }, + "node_modules/lint-staged/node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/lint-staged/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/lint-staged/node_modules/execa": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-7.2.0.tgz", + "integrity": "sha512-UduyVP7TLB5IcAQl+OzLyLcS/l32W/GLg+AhHJ+ow40FOk2U3SAllPwR44v4vmdFwIWqpdwxxpQbF1n5ta9seA==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.1", + "human-signals": "^4.3.0", + "is-stream": "^3.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^5.1.0", + "onetime": "^6.0.0", + "signal-exit": "^3.0.7", + "strip-final-newline": "^3.0.0" + }, + "engines": { + "node": "^14.18.0 || ^16.14.0 || >=18.0.0" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/lint-staged/node_modules/get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lint-staged/node_modules/is-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", + "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lint-staged/node_modules/mimic-fn": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", + "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lint-staged/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/lint-staged/node_modules/npm-run-path": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.2.0.tgz", + "integrity": "sha512-W4/tgAXFqFA0iL7fk0+uQ3g7wkL8xJmx3XdK0VGb4cHW//eZTtKGvFBBoRKVTpY7n6ze4NL9ly7rgXcHufqXKg==", + "dev": true, + "dependencies": { + "path-key": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lint-staged/node_modules/npm-run-path/node_modules/path-key": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", + "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lint-staged/node_modules/onetime": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", + "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", + "dev": true, + "dependencies": { + "mimic-fn": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lint-staged/node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/lint-staged/node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/lint-staged/node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/lint-staged/node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/listr2": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/listr2/-/listr2-5.0.8.tgz", + "integrity": "sha512-mC73LitKHj9w6v30nLNGPetZIlfpUniNSsxxrbaPcWOjDb92SHPzJPi/t+v1YC/lxKz/AJ9egOjww0qUuFxBpA==", + "dev": true, + "dependencies": { + "cli-truncate": "^2.1.0", + "colorette": "^2.0.19", + "log-update": "^4.0.0", + "p-map": "^4.0.0", + "rfdc": "^1.3.0", + "rxjs": "^7.8.0", + "through": "^2.3.8", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": "^14.13.1 || >=16.0.0" + }, + "peerDependencies": { + "enquirer": ">= 2.3.0 < 3" + }, + "peerDependenciesMeta": { + "enquirer": { + "optional": true + } + } + }, + "node_modules/listr2/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/listr2/node_modules/cli-truncate": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-2.1.0.tgz", + "integrity": "sha512-n8fOixwDD6b/ObinzTrp1ZKFzbgvKZvuz/TvejnLn1aQfC6r52XEx85FmuC+3HI+JM7coBRXUvNqEU2PHVrHpg==", + "dev": true, + "dependencies": { + "slice-ansi": "^3.0.0", + "string-width": "^4.2.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/listr2/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/listr2/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/listr2/node_modules/colorette": { + "version": "2.0.20", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz", + "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", + "dev": true + }, + "node_modules/listr2/node_modules/rxjs": { + "version": "7.8.1", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz", + "integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==", + "dev": true, + "dependencies": { + "tslib": "^2.1.0" + } + }, + "node_modules/listr2/node_modules/slice-ansi": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-3.0.0.tgz", + "integrity": "sha512-pSyv7bSTC7ig9Dcgbw9AuRNUb5k5V6oDudjZoMBSr13qpLBG7tB+zgCkARjq7xIUgdz5P1Qe8u+rSGdouOOIyQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "astral-regex": "^2.0.0", + "is-fullwidth-code-point": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/listr2/node_modules/tslib": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", + "dev": true + }, + "node_modules/listr2/node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, "node_modules/load-json-file": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", @@ -11489,6 +11967,74 @@ "node": ">=8" } }, + "node_modules/log-update": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/log-update/-/log-update-4.0.0.tgz", + "integrity": "sha512-9fkkDevMefjg0mmzWFBW8YkFP91OrizzkW3diF7CpG+S2EYdy4+TVfGwz1zeF8x7hCx1ovSPTOE9Ngib74qqUg==", + "dev": true, + "dependencies": { + "ansi-escapes": "^4.3.0", + "cli-cursor": "^3.1.0", + "slice-ansi": "^4.0.0", + "wrap-ansi": "^6.2.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/log-update/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/log-update/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/log-update/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/log-update/node_modules/slice-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", + "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "astral-regex": "^2.0.0", + "is-fullwidth-code-point": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/slice-ansi?sponsor=1" + } + }, "node_modules/log4js": { "version": "6.9.1", "resolved": "https://registry.npmjs.org/log4js/-/log4js-6.9.1.tgz", @@ -13984,6 +14530,18 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, + "node_modules/pidtree": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/pidtree/-/pidtree-0.6.0.tgz", + "integrity": "sha512-eG2dWTVw5bzqGRztnHExczNxt5VGsE6OwTeCG3fdUf9KBsZzO3R5OIIIzWR+iZA0NtZ+RDVdaoE2dK1cn6jH4g==", + "dev": true, + "bin": { + "pidtree": "bin/pidtree.js" + }, + "engines": { + "node": ">=0.10" + } + }, "node_modules/pify": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", @@ -17081,6 +17639,46 @@ "node": ">=8" } }, + "node_modules/slice-ansi": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-5.0.0.tgz", + "integrity": "sha512-FC+lgizVPfie0kkhqUScwRu1O/lF6NOgJmlCgK+/LYxDCTk8sGelYaHDhFcDN+Sn3Cv+3VSa4Byeo+IMCzpMgQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^6.0.0", + "is-fullwidth-code-point": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/slice-ansi?sponsor=1" + } + }, + "node_modules/slice-ansi/node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/slice-ansi/node_modules/is-fullwidth-code-point": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-4.0.0.tgz", + "integrity": "sha512-O4L094N2/dZ7xqVdrXhh9r1KODPJpFms8B5sGdJLPy664AgvXsreZUyCQQNItZRDlYug4xStLjNp/sz3HvBowQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/smart-buffer": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", @@ -17852,6 +18450,15 @@ "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", "dev": true }, + "node_modules/string-argv": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.3.2.tgz", + "integrity": "sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q==", + "dev": true, + "engines": { + "node": ">=0.6.19" + } + }, "node_modules/string-width": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", @@ -17944,6 +18551,18 @@ "node": ">=0.10.0" } }, + "node_modules/strip-final-newline": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", + "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/strip-indent": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-1.0.1.tgz", @@ -21374,6 +21993,15 @@ "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", "dev": true }, + "node_modules/yaml": { + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.4.tgz", + "integrity": "sha512-8aAvwVUSHpfEqTQ4w/KMlf3HcRdt50E5ODIQJBw1fQ5RL34xabzxtUlzTXVqc4rkZsPbvrXKWnABCD7kWSmocA==", + "dev": true, + "engines": { + "node": ">= 14" + } + }, "node_modules/yargs": { "version": "15.3.0", "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.3.0.tgz", @@ -24259,6 +24887,12 @@ "integrity": "sha512-eBvWn1lvIApYMhzQMsu9ciLfkBY499mFZlNqG+/9WR7PVlroQw0vG30cOQQbaKz3sCEc44TAOu2ykzqXSNnwag==", "dev": true }, + "astral-regex": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", + "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", + "dev": true + }, "async": { "version": "2.6.4", "resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz", @@ -25164,6 +25798,50 @@ "integrity": "sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg==", "dev": true }, + "cli-truncate": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-3.1.0.tgz", + "integrity": "sha512-wfOBkjXteqSnI59oPcJkcPl/ZmwvMMOj340qUIY1SKZCv0B9Cf4D4fAucRkIKQmsIuYK3x1rrgU7MeGRruiuiA==", + "dev": true, + "requires": { + "slice-ansi": "^5.0.0", + "string-width": "^5.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "dev": true + }, + "emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true + }, + "string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "requires": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + } + }, + "strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "requires": { + "ansi-regex": "^6.0.1" + } + } + } + }, "cli-width": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-3.0.0.tgz", @@ -26622,6 +27300,12 @@ "stream-shift": "^1.0.0" } }, + "eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "dev": true + }, "ecc-jsbn": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", @@ -28475,6 +29159,12 @@ } } }, + "human-signals": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-4.3.1.tgz", + "integrity": "sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ==", + "dev": true + }, "humanize-ms": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", @@ -28484,6 +29174,12 @@ "ms": "^2.0.0" } }, + "husky": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/husky/-/husky-8.0.3.tgz", + "integrity": "sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg==", + "dev": true + }, "iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", @@ -30185,12 +30881,265 @@ "immediate": "~3.0.5" } }, + "lilconfig": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.1.0.tgz", + "integrity": "sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==", + "dev": true + }, "lines-and-columns": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", "dev": true }, + "lint-staged": { + "version": "13.2.3", + "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-13.2.3.tgz", + "integrity": "sha512-zVVEXLuQIhr1Y7R7YAWx4TZLdvuzk7DnmrsTNL0fax6Z3jrpFcas+vKbzxhhvp6TA55m1SQuWkpzI1qbfDZbAg==", + "dev": true, + "requires": { + "chalk": "5.2.0", + "cli-truncate": "^3.1.0", + "commander": "^10.0.0", + "debug": "^4.3.4", + "execa": "^7.0.0", + "lilconfig": "2.1.0", + "listr2": "^5.0.7", + "micromatch": "^4.0.5", + "normalize-path": "^3.0.0", + "object-inspect": "^1.12.3", + "pidtree": "^0.6.0", + "string-argv": "^0.3.1", + "yaml": "^2.2.2" + }, + "dependencies": { + "chalk": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.2.0.tgz", + "integrity": "sha512-ree3Gqw/nazQAPuJJEy+avdl7QfZMcUvmHIKgEZkGL+xOBzRvup5Hxo6LHuMceSxOabuJLJm5Yp/92R9eMmMvA==", + "dev": true + }, + "commander": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz", + "integrity": "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==", + "dev": true + }, + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "execa": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-7.2.0.tgz", + "integrity": "sha512-UduyVP7TLB5IcAQl+OzLyLcS/l32W/GLg+AhHJ+ow40FOk2U3SAllPwR44v4vmdFwIWqpdwxxpQbF1n5ta9seA==", + "dev": true, + "requires": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.1", + "human-signals": "^4.3.0", + "is-stream": "^3.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^5.1.0", + "onetime": "^6.0.0", + "signal-exit": "^3.0.7", + "strip-final-newline": "^3.0.0" + } + }, + "get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true + }, + "is-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", + "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", + "dev": true + }, + "mimic-fn": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", + "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", + "dev": true + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "npm-run-path": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.2.0.tgz", + "integrity": "sha512-W4/tgAXFqFA0iL7fk0+uQ3g7wkL8xJmx3XdK0VGb4cHW//eZTtKGvFBBoRKVTpY7n6ze4NL9ly7rgXcHufqXKg==", + "dev": true, + "requires": { + "path-key": "^4.0.0" + }, + "dependencies": { + "path-key": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", + "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", + "dev": true + } + } + }, + "onetime": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", + "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", + "dev": true, + "requires": { + "mimic-fn": "^4.0.0" + } + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + } + } + }, + "listr2": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/listr2/-/listr2-5.0.8.tgz", + "integrity": "sha512-mC73LitKHj9w6v30nLNGPetZIlfpUniNSsxxrbaPcWOjDb92SHPzJPi/t+v1YC/lxKz/AJ9egOjww0qUuFxBpA==", + "dev": true, + "requires": { + "cli-truncate": "^2.1.0", + "colorette": "^2.0.19", + "log-update": "^4.0.0", + "p-map": "^4.0.0", + "rfdc": "^1.3.0", + "rxjs": "^7.8.0", + "through": "^2.3.8", + "wrap-ansi": "^7.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "cli-truncate": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-2.1.0.tgz", + "integrity": "sha512-n8fOixwDD6b/ObinzTrp1ZKFzbgvKZvuz/TvejnLn1aQfC6r52XEx85FmuC+3HI+JM7coBRXUvNqEU2PHVrHpg==", + "dev": true, + "requires": { + "slice-ansi": "^3.0.0", + "string-width": "^4.2.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "colorette": { + "version": "2.0.20", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz", + "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", + "dev": true + }, + "rxjs": { + "version": "7.8.1", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz", + "integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==", + "dev": true, + "requires": { + "tslib": "^2.1.0" + } + }, + "slice-ansi": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-3.0.0.tgz", + "integrity": "sha512-pSyv7bSTC7ig9Dcgbw9AuRNUb5k5V6oDudjZoMBSr13qpLBG7tB+zgCkARjq7xIUgdz5P1Qe8u+rSGdouOOIyQ==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "astral-regex": "^2.0.0", + "is-fullwidth-code-point": "^3.0.0" + } + }, + "tslib": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", + "dev": true + }, + "wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + } + } + }, "load-json-file": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", @@ -30343,6 +31292,55 @@ } } }, + "log-update": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/log-update/-/log-update-4.0.0.tgz", + "integrity": "sha512-9fkkDevMefjg0mmzWFBW8YkFP91OrizzkW3diF7CpG+S2EYdy4+TVfGwz1zeF8x7hCx1ovSPTOE9Ngib74qqUg==", + "dev": true, + "requires": { + "ansi-escapes": "^4.3.0", + "cli-cursor": "^3.1.0", + "slice-ansi": "^4.0.0", + "wrap-ansi": "^6.2.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "slice-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", + "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "astral-regex": "^2.0.0", + "is-fullwidth-code-point": "^3.0.0" + } + } + } + }, "log4js": { "version": "6.9.1", "resolved": "https://registry.npmjs.org/log4js/-/log4js-6.9.1.tgz", @@ -32367,6 +33365,12 @@ "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", "dev": true }, + "pidtree": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/pidtree/-/pidtree-0.6.0.tgz", + "integrity": "sha512-eG2dWTVw5bzqGRztnHExczNxt5VGsE6OwTeCG3fdUf9KBsZzO3R5OIIIzWR+iZA0NtZ+RDVdaoE2dK1cn6jH4g==", + "dev": true + }, "pify": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", @@ -34872,6 +35876,30 @@ "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", "dev": true }, + "slice-ansi": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-5.0.0.tgz", + "integrity": "sha512-FC+lgizVPfie0kkhqUScwRu1O/lF6NOgJmlCgK+/LYxDCTk8sGelYaHDhFcDN+Sn3Cv+3VSa4Byeo+IMCzpMgQ==", + "dev": true, + "requires": { + "ansi-styles": "^6.0.0", + "is-fullwidth-code-point": "^4.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-4.0.0.tgz", + "integrity": "sha512-O4L094N2/dZ7xqVdrXhh9r1KODPJpFms8B5sGdJLPy664AgvXsreZUyCQQNItZRDlYug4xStLjNp/sz3HvBowQ==", + "dev": true + } + } + }, "smart-buffer": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", @@ -35514,6 +36542,12 @@ } } }, + "string-argv": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.3.2.tgz", + "integrity": "sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q==", + "dev": true + }, "string-width": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", @@ -35582,6 +36616,12 @@ "integrity": "sha512-7FCwGGmx8mD5xQd3RPUvnSpUXHM3BWuzjtpD4TXsfcZ9EL4azvVVUscFYwD9nx8Kh+uCBC00XBtAykoMHwTh8Q==", "dev": true }, + "strip-final-newline": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", + "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", + "dev": true + }, "strip-indent": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-1.0.1.tgz", @@ -38280,6 +39320,12 @@ "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", "dev": true }, + "yaml": { + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.4.tgz", + "integrity": "sha512-8aAvwVUSHpfEqTQ4w/KMlf3HcRdt50E5ODIQJBw1fQ5RL34xabzxtUlzTXVqc4rkZsPbvrXKWnABCD7kWSmocA==", + "dev": true + }, "yargs": { "version": "15.3.0", "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.3.0.tgz", diff --git a/ui/ui-frontend-common/package.json b/ui/ui-frontend-common/package.json index 20740e1397c..946ead36fd2 100644 --- a/ui/ui-frontend-common/package.json +++ b/ui/ui-frontend-common/package.json @@ -27,7 +27,8 @@ "check": "npm run lint && npm test && npm run build", "publish-dist": "npm publish ./dist", "prettier": "prettier --write --ignore-unknown .", - "prettier:ci": "prettier --check --ignore-unknown ." + "prettier:ci": "prettier --check --ignore-unknown .", + "prepare": "cd ../../ && husky install ui/ui-frontend-common/.husky" }, "ngPackage": { "lib": { @@ -108,6 +109,7 @@ "core-js": "3.6.5", "cp-cli": "^2.0.0", "file-loader": "^6.0.0", + "husky": "8.0.3", "imagemin": "^6.1.0", "img-loader": "^3.0.1", "jasmine-core": "~3.7.0", @@ -118,6 +120,7 @@ "karma-coverage-istanbul-reporter": "~3.0.2", "karma-jasmine": "~4.0.0", "karma-jasmine-html-reporter": "^1.5.0", + "lint-staged": "13.2.3", "material-design-icons": "^3.0.1", "mini-svg-data-uri": "^1.2.3", "moment-locales-webpack-plugin": "^1.2.0", @@ -144,5 +147,8 @@ }, "resolutions": { "moment": "2.26.0" + }, + "lint-staged": { + "*": "prettier --write --ignore-unknown" } } diff --git a/ui/ui-frontend/.husky/pre-commit b/ui/ui-frontend/.husky/pre-commit new file mode 100755 index 00000000000..a1927a7d7e7 --- /dev/null +++ b/ui/ui-frontend/.husky/pre-commit @@ -0,0 +1,8 @@ +#!/usr/bin/env sh +[ -n "$CI" ] && exit 0 + +. "$(dirname -- "$0")/_/husky.sh" + +cd ui/ui-frontend/ + +npx lint-staged@13 diff --git a/ui/ui-frontend/package-lock.json b/ui/ui-frontend/package-lock.json index 25a4186eca0..13b75188693 100644 --- a/ui/ui-frontend/package-lock.json +++ b/ui/ui-frontend/package-lock.json @@ -85,6 +85,7 @@ "codelyzer": "6.0.1", "concurrently": "^5.3.0", "cp-cli": "^2.0.0", + "husky": "8.0.3", "jasmine-core": "^3.7.0", "jasmine-marbles": "^0.4.1", "jasmine-spec-reporter": "~4.2.1", @@ -94,6 +95,7 @@ "karma-coverage-istanbul-reporter": "~3.0.3", "karma-jasmine": "~4.0.0", "karma-jasmine-html-reporter": "^1.5.4", + "lint-staged": "13.2.3", "moment-locales-webpack-plugin": "^1.2.0", "ng-packagr": "^10.1.2", "ngx-i18nsupport": "^0.17.1", @@ -4178,6 +4180,15 @@ "integrity": "sha512-eBvWn1lvIApYMhzQMsu9ciLfkBY499mFZlNqG+/9WR7PVlroQw0vG30cOQQbaKz3sCEc44TAOu2ykzqXSNnwag==", "dev": true }, + "node_modules/astral-regex": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", + "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/async": { "version": "2.6.4", "resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz", @@ -5530,6 +5541,72 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/cli-truncate": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-3.1.0.tgz", + "integrity": "sha512-wfOBkjXteqSnI59oPcJkcPl/ZmwvMMOj340qUIY1SKZCv0B9Cf4D4fAucRkIKQmsIuYK3x1rrgU7MeGRruiuiA==", + "dev": true, + "dependencies": { + "slice-ansi": "^5.0.0", + "string-width": "^5.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cli-truncate/node_modules/ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/cli-truncate/node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true + }, + "node_modules/cli-truncate/node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cli-truncate/node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, "node_modules/cli-width": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-3.0.0.tgz", @@ -7794,6 +7871,12 @@ "safe-buffer": "~5.1.0" } }, + "node_modules/eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "dev": true + }, "node_modules/ecc-jsbn": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", @@ -10321,6 +10404,15 @@ "ms": "^2.1.1" } }, + "node_modules/human-signals": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-4.3.1.tgz", + "integrity": "sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ==", + "dev": true, + "engines": { + "node": ">=14.18.0" + } + }, "node_modules/humanize-ms": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", @@ -10330,6 +10422,21 @@ "ms": "^2.0.0" } }, + "node_modules/husky": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/husky/-/husky-8.0.3.tgz", + "integrity": "sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg==", + "dev": true, + "bin": { + "husky": "lib/bin.js" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/typicode" + } + }, "node_modules/iconv-lite": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", @@ -12502,12 +12609,360 @@ "immediate": "~3.0.5" } }, + "node_modules/lilconfig": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.1.0.tgz", + "integrity": "sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==", + "dev": true, + "engines": { + "node": ">=10" + } + }, "node_modules/lines-and-columns": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", "dev": true }, + "node_modules/lint-staged": { + "version": "13.2.3", + "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-13.2.3.tgz", + "integrity": "sha512-zVVEXLuQIhr1Y7R7YAWx4TZLdvuzk7DnmrsTNL0fax6Z3jrpFcas+vKbzxhhvp6TA55m1SQuWkpzI1qbfDZbAg==", + "dev": true, + "dependencies": { + "chalk": "5.2.0", + "cli-truncate": "^3.1.0", + "commander": "^10.0.0", + "debug": "^4.3.4", + "execa": "^7.0.0", + "lilconfig": "2.1.0", + "listr2": "^5.0.7", + "micromatch": "^4.0.5", + "normalize-path": "^3.0.0", + "object-inspect": "^1.12.3", + "pidtree": "^0.6.0", + "string-argv": "^0.3.1", + "yaml": "^2.2.2" + }, + "bin": { + "lint-staged": "bin/lint-staged.js" + }, + "engines": { + "node": "^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/lint-staged" + } + }, + "node_modules/lint-staged/node_modules/chalk": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.2.0.tgz", + "integrity": "sha512-ree3Gqw/nazQAPuJJEy+avdl7QfZMcUvmHIKgEZkGL+xOBzRvup5Hxo6LHuMceSxOabuJLJm5Yp/92R9eMmMvA==", + "dev": true, + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/lint-staged/node_modules/commander": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz", + "integrity": "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==", + "dev": true, + "engines": { + "node": ">=14" + } + }, + "node_modules/lint-staged/node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/lint-staged/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/lint-staged/node_modules/execa": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-7.2.0.tgz", + "integrity": "sha512-UduyVP7TLB5IcAQl+OzLyLcS/l32W/GLg+AhHJ+ow40FOk2U3SAllPwR44v4vmdFwIWqpdwxxpQbF1n5ta9seA==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.1", + "human-signals": "^4.3.0", + "is-stream": "^3.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^5.1.0", + "onetime": "^6.0.0", + "signal-exit": "^3.0.7", + "strip-final-newline": "^3.0.0" + }, + "engines": { + "node": "^14.18.0 || ^16.14.0 || >=18.0.0" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/lint-staged/node_modules/get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lint-staged/node_modules/is-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", + "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lint-staged/node_modules/mimic-fn": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", + "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lint-staged/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/lint-staged/node_modules/npm-run-path": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.2.0.tgz", + "integrity": "sha512-W4/tgAXFqFA0iL7fk0+uQ3g7wkL8xJmx3XdK0VGb4cHW//eZTtKGvFBBoRKVTpY7n6ze4NL9ly7rgXcHufqXKg==", + "dev": true, + "dependencies": { + "path-key": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lint-staged/node_modules/npm-run-path/node_modules/path-key": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", + "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lint-staged/node_modules/onetime": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", + "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", + "dev": true, + "dependencies": { + "mimic-fn": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lint-staged/node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/lint-staged/node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/lint-staged/node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/lint-staged/node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/listr2": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/listr2/-/listr2-5.0.8.tgz", + "integrity": "sha512-mC73LitKHj9w6v30nLNGPetZIlfpUniNSsxxrbaPcWOjDb92SHPzJPi/t+v1YC/lxKz/AJ9egOjww0qUuFxBpA==", + "dev": true, + "dependencies": { + "cli-truncate": "^2.1.0", + "colorette": "^2.0.19", + "log-update": "^4.0.0", + "p-map": "^4.0.0", + "rfdc": "^1.3.0", + "rxjs": "^7.8.0", + "through": "^2.3.8", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": "^14.13.1 || >=16.0.0" + }, + "peerDependencies": { + "enquirer": ">= 2.3.0 < 3" + }, + "peerDependenciesMeta": { + "enquirer": { + "optional": true + } + } + }, + "node_modules/listr2/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/listr2/node_modules/cli-truncate": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-2.1.0.tgz", + "integrity": "sha512-n8fOixwDD6b/ObinzTrp1ZKFzbgvKZvuz/TvejnLn1aQfC6r52XEx85FmuC+3HI+JM7coBRXUvNqEU2PHVrHpg==", + "dev": true, + "dependencies": { + "slice-ansi": "^3.0.0", + "string-width": "^4.2.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/listr2/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/listr2/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/listr2/node_modules/colorette": { + "version": "2.0.20", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz", + "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", + "dev": true + }, + "node_modules/listr2/node_modules/rxjs": { + "version": "7.8.1", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz", + "integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==", + "dev": true, + "dependencies": { + "tslib": "^2.1.0" + } + }, + "node_modules/listr2/node_modules/slice-ansi": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-3.0.0.tgz", + "integrity": "sha512-pSyv7bSTC7ig9Dcgbw9AuRNUb5k5V6oDudjZoMBSr13qpLBG7tB+zgCkARjq7xIUgdz5P1Qe8u+rSGdouOOIyQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "astral-regex": "^2.0.0", + "is-fullwidth-code-point": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/load-json-file": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", @@ -12709,6 +13164,88 @@ "node": ">=8" } }, + "node_modules/log-update": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/log-update/-/log-update-4.0.0.tgz", + "integrity": "sha512-9fkkDevMefjg0mmzWFBW8YkFP91OrizzkW3diF7CpG+S2EYdy4+TVfGwz1zeF8x7hCx1ovSPTOE9Ngib74qqUg==", + "dev": true, + "dependencies": { + "ansi-escapes": "^4.3.0", + "cli-cursor": "^3.1.0", + "slice-ansi": "^4.0.0", + "wrap-ansi": "^6.2.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/log-update/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/log-update/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/log-update/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/log-update/node_modules/slice-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", + "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "astral-regex": "^2.0.0", + "is-fullwidth-code-point": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/slice-ansi?sponsor=1" + } + }, + "node_modules/log-update/node_modules/wrap-ansi": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/log4js": { "version": "6.9.1", "resolved": "https://registry.npmjs.org/log4js/-/log4js-6.9.1.tgz", @@ -15690,6 +16227,18 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, + "node_modules/pidtree": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/pidtree/-/pidtree-0.6.0.tgz", + "integrity": "sha512-eG2dWTVw5bzqGRztnHExczNxt5VGsE6OwTeCG3fdUf9KBsZzO3R5OIIIzWR+iZA0NtZ+RDVdaoE2dK1cn6jH4g==", + "dev": true, + "bin": { + "pidtree": "bin/pidtree.js" + }, + "engines": { + "node": ">=0.10" + } + }, "node_modules/pify": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", @@ -18949,6 +19498,46 @@ "node": ">=8" } }, + "node_modules/slice-ansi": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-5.0.0.tgz", + "integrity": "sha512-FC+lgizVPfie0kkhqUScwRu1O/lF6NOgJmlCgK+/LYxDCTk8sGelYaHDhFcDN+Sn3Cv+3VSa4Byeo+IMCzpMgQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^6.0.0", + "is-fullwidth-code-point": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/slice-ansi?sponsor=1" + } + }, + "node_modules/slice-ansi/node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/slice-ansi/node_modules/is-fullwidth-code-point": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-4.0.0.tgz", + "integrity": "sha512-O4L094N2/dZ7xqVdrXhh9r1KODPJpFms8B5sGdJLPy664AgvXsreZUyCQQNItZRDlYug4xStLjNp/sz3HvBowQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/smart-buffer": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", @@ -19809,6 +20398,15 @@ "safe-buffer": "~5.2.0" } }, + "node_modules/string-argv": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.3.2.tgz", + "integrity": "sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q==", + "dev": true, + "engines": { + "node": ">=0.6.19" + } + }, "node_modules/string-width": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", @@ -19901,6 +20499,18 @@ "node": ">=0.10.0" } }, + "node_modules/strip-final-newline": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", + "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/strip-indent": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-1.0.1.tgz", @@ -23866,6 +24476,15 @@ "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", "dev": true }, + "node_modules/yaml": { + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.4.tgz", + "integrity": "sha512-8aAvwVUSHpfEqTQ4w/KMlf3HcRdt50E5ODIQJBw1fQ5RL34xabzxtUlzTXVqc4rkZsPbvrXKWnABCD7kWSmocA==", + "dev": true, + "engines": { + "node": ">= 14" + } + }, "node_modules/yargs": { "version": "15.3.0", "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.3.0.tgz", @@ -27040,6 +27659,12 @@ "integrity": "sha512-eBvWn1lvIApYMhzQMsu9ciLfkBY499mFZlNqG+/9WR7PVlroQw0vG30cOQQbaKz3sCEc44TAOu2ykzqXSNnwag==", "dev": true }, + "astral-regex": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", + "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", + "dev": true + }, "async": { "version": "2.6.4", "resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz", @@ -28066,6 +28691,50 @@ "integrity": "sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg==", "dev": true }, + "cli-truncate": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-3.1.0.tgz", + "integrity": "sha512-wfOBkjXteqSnI59oPcJkcPl/ZmwvMMOj340qUIY1SKZCv0B9Cf4D4fAucRkIKQmsIuYK3x1rrgU7MeGRruiuiA==", + "dev": true, + "requires": { + "slice-ansi": "^5.0.0", + "string-width": "^5.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "dev": true + }, + "emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true + }, + "string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "requires": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + } + }, + "strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "requires": { + "ansi-regex": "^6.0.1" + } + } + } + }, "cli-width": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-3.0.0.tgz", @@ -29944,6 +30613,12 @@ } } }, + "eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "dev": true + }, "ecc-jsbn": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", @@ -32028,6 +32703,12 @@ } } }, + "human-signals": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-4.3.1.tgz", + "integrity": "sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ==", + "dev": true + }, "humanize-ms": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", @@ -32037,6 +32718,12 @@ "ms": "^2.0.0" } }, + "husky": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/husky/-/husky-8.0.3.tgz", + "integrity": "sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg==", + "dev": true + }, "iconv-lite": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", @@ -33688,12 +34375,248 @@ "immediate": "~3.0.5" } }, + "lilconfig": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.1.0.tgz", + "integrity": "sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==", + "dev": true + }, "lines-and-columns": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", "dev": true }, + "lint-staged": { + "version": "13.2.3", + "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-13.2.3.tgz", + "integrity": "sha512-zVVEXLuQIhr1Y7R7YAWx4TZLdvuzk7DnmrsTNL0fax6Z3jrpFcas+vKbzxhhvp6TA55m1SQuWkpzI1qbfDZbAg==", + "dev": true, + "requires": { + "chalk": "5.2.0", + "cli-truncate": "^3.1.0", + "commander": "^10.0.0", + "debug": "^4.3.4", + "execa": "^7.0.0", + "lilconfig": "2.1.0", + "listr2": "^5.0.7", + "micromatch": "^4.0.5", + "normalize-path": "^3.0.0", + "object-inspect": "^1.12.3", + "pidtree": "^0.6.0", + "string-argv": "^0.3.1", + "yaml": "^2.2.2" + }, + "dependencies": { + "chalk": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.2.0.tgz", + "integrity": "sha512-ree3Gqw/nazQAPuJJEy+avdl7QfZMcUvmHIKgEZkGL+xOBzRvup5Hxo6LHuMceSxOabuJLJm5Yp/92R9eMmMvA==", + "dev": true + }, + "commander": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz", + "integrity": "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==", + "dev": true + }, + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "execa": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-7.2.0.tgz", + "integrity": "sha512-UduyVP7TLB5IcAQl+OzLyLcS/l32W/GLg+AhHJ+ow40FOk2U3SAllPwR44v4vmdFwIWqpdwxxpQbF1n5ta9seA==", + "dev": true, + "requires": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.1", + "human-signals": "^4.3.0", + "is-stream": "^3.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^5.1.0", + "onetime": "^6.0.0", + "signal-exit": "^3.0.7", + "strip-final-newline": "^3.0.0" + } + }, + "get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true + }, + "is-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", + "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", + "dev": true + }, + "mimic-fn": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", + "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", + "dev": true + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "npm-run-path": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.2.0.tgz", + "integrity": "sha512-W4/tgAXFqFA0iL7fk0+uQ3g7wkL8xJmx3XdK0VGb4cHW//eZTtKGvFBBoRKVTpY7n6ze4NL9ly7rgXcHufqXKg==", + "dev": true, + "requires": { + "path-key": "^4.0.0" + }, + "dependencies": { + "path-key": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", + "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", + "dev": true + } + } + }, + "onetime": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", + "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", + "dev": true, + "requires": { + "mimic-fn": "^4.0.0" + } + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + } + } + }, + "listr2": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/listr2/-/listr2-5.0.8.tgz", + "integrity": "sha512-mC73LitKHj9w6v30nLNGPetZIlfpUniNSsxxrbaPcWOjDb92SHPzJPi/t+v1YC/lxKz/AJ9egOjww0qUuFxBpA==", + "dev": true, + "requires": { + "cli-truncate": "^2.1.0", + "colorette": "^2.0.19", + "log-update": "^4.0.0", + "p-map": "^4.0.0", + "rfdc": "^1.3.0", + "rxjs": "^7.8.0", + "through": "^2.3.8", + "wrap-ansi": "^7.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "cli-truncate": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-2.1.0.tgz", + "integrity": "sha512-n8fOixwDD6b/ObinzTrp1ZKFzbgvKZvuz/TvejnLn1aQfC6r52XEx85FmuC+3HI+JM7coBRXUvNqEU2PHVrHpg==", + "dev": true, + "requires": { + "slice-ansi": "^3.0.0", + "string-width": "^4.2.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "colorette": { + "version": "2.0.20", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz", + "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", + "dev": true + }, + "rxjs": { + "version": "7.8.1", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz", + "integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==", + "dev": true, + "requires": { + "tslib": "^2.1.0" + } + }, + "slice-ansi": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-3.0.0.tgz", + "integrity": "sha512-pSyv7bSTC7ig9Dcgbw9AuRNUb5k5V6oDudjZoMBSr13qpLBG7tB+zgCkARjq7xIUgdz5P1Qe8u+rSGdouOOIyQ==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "astral-regex": "^2.0.0", + "is-fullwidth-code-point": "^3.0.0" + } + } + } + }, "load-json-file": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", @@ -33851,6 +34774,66 @@ } } }, + "log-update": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/log-update/-/log-update-4.0.0.tgz", + "integrity": "sha512-9fkkDevMefjg0mmzWFBW8YkFP91OrizzkW3diF7CpG+S2EYdy4+TVfGwz1zeF8x7hCx1ovSPTOE9Ngib74qqUg==", + "dev": true, + "requires": { + "ansi-escapes": "^4.3.0", + "cli-cursor": "^3.1.0", + "slice-ansi": "^4.0.0", + "wrap-ansi": "^6.2.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "slice-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", + "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "astral-regex": "^2.0.0", + "is-fullwidth-code-point": "^3.0.0" + } + }, + "wrap-ansi": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + } + } + }, "log4js": { "version": "6.9.1", "resolved": "https://registry.npmjs.org/log4js/-/log4js-6.9.1.tgz", @@ -36291,6 +37274,12 @@ "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", "dev": true }, + "pidtree": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/pidtree/-/pidtree-0.6.0.tgz", + "integrity": "sha512-eG2dWTVw5bzqGRztnHExczNxt5VGsE6OwTeCG3fdUf9KBsZzO3R5OIIIzWR+iZA0NtZ+RDVdaoE2dK1cn6jH4g==", + "dev": true + }, "pify": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", @@ -38918,6 +39907,30 @@ "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", "dev": true }, + "slice-ansi": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-5.0.0.tgz", + "integrity": "sha512-FC+lgizVPfie0kkhqUScwRu1O/lF6NOgJmlCgK+/LYxDCTk8sGelYaHDhFcDN+Sn3Cv+3VSa4Byeo+IMCzpMgQ==", + "dev": true, + "requires": { + "ansi-styles": "^6.0.0", + "is-fullwidth-code-point": "^4.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-4.0.0.tgz", + "integrity": "sha512-O4L094N2/dZ7xqVdrXhh9r1KODPJpFms8B5sGdJLPy664AgvXsreZUyCQQNItZRDlYug4xStLjNp/sz3HvBowQ==", + "dev": true + } + } + }, "smart-buffer": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", @@ -39657,6 +40670,12 @@ "safe-buffer": "~5.2.0" } }, + "string-argv": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.3.2.tgz", + "integrity": "sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q==", + "dev": true + }, "string-width": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", @@ -39725,6 +40744,12 @@ "integrity": "sha512-7FCwGGmx8mD5xQd3RPUvnSpUXHM3BWuzjtpD4TXsfcZ9EL4azvVVUscFYwD9nx8Kh+uCBC00XBtAykoMHwTh8Q==", "dev": true }, + "strip-final-newline": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", + "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", + "dev": true + }, "strip-indent": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-1.0.1.tgz", @@ -42883,6 +43908,12 @@ "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", "dev": true }, + "yaml": { + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.4.tgz", + "integrity": "sha512-8aAvwVUSHpfEqTQ4w/KMlf3HcRdt50E5ODIQJBw1fQ5RL34xabzxtUlzTXVqc4rkZsPbvrXKWnABCD7kWSmocA==", + "dev": true + }, "yargs": { "version": "15.3.0", "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.3.0.tgz", diff --git a/ui/ui-frontend/package.json b/ui/ui-frontend/package.json index e822726d310..2691302b8cf 100644 --- a/ui/ui-frontend/package.json +++ b/ui/ui-frontend/package.json @@ -86,7 +86,8 @@ "build:vitamui-library": "ng build vitamui-library", "watch:vitamui-library": "ng build vitamui-library --watch", "prettier": "prettier --write --ignore-unknown .", - "prettier:ci": "prettier --check --ignore-unknown ." + "prettier:ci": "prettier --check --ignore-unknown .", + "prepare": "cd ../../ && husky install ui/ui-frontend/.husky" }, "private": true, "dependencies": { @@ -165,6 +166,7 @@ "codelyzer": "6.0.1", "concurrently": "^5.3.0", "cp-cli": "^2.0.0", + "husky": "8.0.3", "jasmine-core": "^3.7.0", "jasmine-marbles": "^0.4.1", "jasmine-spec-reporter": "~4.2.1", @@ -174,6 +176,7 @@ "karma-coverage-istanbul-reporter": "~3.0.3", "karma-jasmine": "~4.0.0", "karma-jasmine-html-reporter": "^1.5.4", + "lint-staged": "13.2.3", "moment-locales-webpack-plugin": "^1.2.0", "ng-packagr": "^10.1.2", "ngx-i18nsupport": "^0.17.1", @@ -190,5 +193,8 @@ }, "overrides": { "colors": "1.4.0" + }, + "lint-staged": { + "*": "prettier --write --ignore-unknown" } } From e69555af8ace852d84abe86abc9ab9405ac8f432 Mon Sep 17 00:00:00 2001 From: Maxime Robert Date: Mon, 29 Jan 2024 10:52:00 +0100 Subject: [PATCH 4/6] Story #12110 Prettier: execute Prettier in build/CI --- pom.xml | 11 +++++++++++ ui/ui-frontend/pom.xml | 13 ------------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/pom.xml b/pom.xml index e5d1c66a11c..aa859bdf58a 100644 --- a/pom.xml +++ b/pom.xml @@ -1648,6 +1648,17 @@ install --legacy-peer-deps --loglevel warn + + npm run prettier:ci + + npm + + process-sources + + ${skipAllFrontend} + run prettier:ci + + npm run build diff --git a/ui/ui-frontend/pom.xml b/ui/ui-frontend/pom.xml index b9d3ea5e801..2f13f0484e0 100644 --- a/ui/ui-frontend/pom.xml +++ b/ui/ui-frontend/pom.xml @@ -43,24 +43,11 @@ com.github.eirslett frontend-maven-plugin - ${maven.frontend.plugin.version} ${maven.multiModuleProjectDirectory}/ui/ui-frontend ${maven.multiModuleProjectDirectory}/ui/ui-frontend - - install node and npm - - install-node-and-npm - - initialize - - ${skipAllFrontend} - ${node.version} - ${npm.version} - - npm install From de3e5891e1aa94234466a78a1aaaa8a4d2c2b065 Mon Sep 17 00:00:00 2001 From: Maxime Robert Date: Thu, 1 Feb 2024 15:47:36 +0100 Subject: [PATCH 5/6] Story #12110 Prettier: automatic fix --- .../src/app/app.component.html | 20 +- .../src/app/app.component.ts | 8 +- ui/ui-frontend-common/src/app/app.module.ts | 4 +- .../account/account-api.service.spec.ts | 12 +- .../modules/account/account-api.service.ts | 9 +- .../account-application-tab.component.html | 4 +- .../account-application-tab.component.spec.ts | 5 +- .../account-application-tab.component.ts | 9 +- .../account-information-tab.component.html | 44 +- .../account-information-tab.component.scss | 9 +- .../account-information-tab.component.spec.ts | 21 +- .../account-information-tab.component.ts | 21 +- .../modules/account/account.component.html | 8 +- .../modules/account/account.component.scss | 10 +- .../modules/account/account.component.spec.ts | 28 +- .../app/modules/account/account.component.ts | 18 +- .../src/app/modules/account/account.module.ts | 10 +- .../modules/account/account.service.spec.ts | 6 +- .../app/modules/account/account.service.ts | 14 +- .../src/app/modules/active-tenant.guard.ts | 8 +- .../analytics-resolver.service.spec.ts | 2 +- .../app/modules/analytics-resolver.service.ts | 29 +- .../animations/vitamui-common-animations.ts | 38 +- .../api/access-contract-api.service.ts | 5 +- .../api/application-api.service.spec.ts | 12 +- .../modules/api/application-api.service.ts | 11 +- .../modules/api/base-user-info-api.service.ts | 16 +- .../api/external-param-profile-api.service.ts | 20 +- .../modules/api/logbook-api.service.spec.ts | 10 +- .../app/modules/api/logbook-api.service.ts | 71 +-- .../modules/api/profile-api.service.spec.ts | 14 +- .../app/modules/api/profile-api.service.ts | 10 +- .../src/app/modules/api/rule-api.service.ts | 2 +- .../modules/api/security-api.service.spec.ts | 12 +- .../app/modules/api/security-api.service.ts | 8 +- .../api/subrogation-api.service.spec.ts | 18 +- .../modules/api/subrogation-api.service.ts | 10 +- .../app/modules/api/user-api.service.spec.ts | 18 +- .../src/app/modules/api/user-api.service.ts | 12 +- .../app/modules/app-root-component.class.ts | 6 +- .../src/app/modules/app.guard.spec.ts | 30 +- .../src/app/modules/app.guard.ts | 11 +- .../src/app/modules/application.service.ts | 16 +- .../src/app/modules/auth.guard.spec.ts | 6 +- .../src/app/modules/auth.guard.ts | 4 +- .../src/app/modules/auth.service.ts | 15 +- .../src/app/modules/base-http-client.ts | 24 +- .../application-select-content.component.html | 15 +- .../application-select-content.component.scss | 20 +- ...plication-select-content.component.spec.ts | 12 +- .../application-select-content.component.ts | 25 +- .../application-select-content.module.ts | 9 +- .../components/blank/blank.component.html | 2 +- .../components/blank/blank.component.ts | 6 +- .../cancelled-snack-bar.component.html | 4 +- .../cancelled-snack-bar.component.scss | 2 +- .../cancelled-snack-bar.component.spec.ts | 12 +- .../cancelled-snack-bar.component.ts | 4 +- .../cancelled-snack-bar.module.ts | 21 +- .../collapse/collapse.component.html | 2 +- .../collapse/collapse.component.scss | 16 +- .../collapse/collapse.component.spec.ts | 14 +- .../components/collapse/collapse.component.ts | 12 +- .../components/collapse/collapse.module.ts | 8 +- .../common-progress-bar.component.html | 4 +- .../common-progress-bar.component.scss | 22 +- .../common-tooltip.component.html | 6 +- .../common-tooltip.component.scss | 2 +- .../common-tooltip.component.ts | 13 +- .../common-tooltip.directive.ts | 41 +- .../close-popup-dialog.component.html | 2 +- .../close-popup-dialog.component.spec.ts | 7 +- .../close-popup-dialog.component.ts | 9 +- .../confirm-dialog.component.html | 4 +- .../confirm-dialog.component.spec.ts | 10 +- .../confirm-dialog.component.ts | 9 +- .../confirm-dialog/confirm-dialog.module.ts | 10 +- .../confirm-dialog.service.spec.ts | 10 +- .../confirm-dialog/confirm-dialog.service.ts | 21 +- .../customer-select-content.component.html | 2 +- .../customer-select-content.component.scss | 62 +- .../customer-select-content.component.spec.ts | 7 +- .../customer-select-content.component.ts | 7 +- .../customer-select-content.module.ts | 8 +- .../download-snack-bar.component.html | 14 +- .../download-snack-bar.component.scss | 63 +- .../download-snack-bar.component.ts | 14 +- .../download-snack-bar.module.ts | 21 +- .../editable-duration-input.component.html | 67 +- .../editable-duration-input.component.scss | 52 +- .../editable-duration-input.component.ts | 17 +- .../humanized-duration.pipe.ts | 3 +- .../editable-email-input.component.scss | 20 +- .../editable-email-input.component.ts | 16 +- .../editable-field.component.spec.ts | 13 +- .../editable-field.component.ts | 49 +- .../editable-field/editable-field.module.ts | 11 +- .../editable-file.component.html | 33 +- .../editable-file.component.spec.ts | 20 +- .../editable-file/editable-file.component.ts | 10 +- .../editable-input.component.spec.ts | 25 +- .../editable-input.component.ts | 8 +- .../editable-level-input.component.html | 22 +- .../editable-level-input.component.spec.ts | 11 +- .../editable-level-input.component.ts | 6 +- .../editable-level-input/sub-level.pipe.ts | 4 +- .../editable-option.component.ts | 4 +- .../editable-select.component.html | 44 +- .../editable-select.component.scss | 4 +- .../editable-select.component.spec.ts | 21 +- .../editable-select.component.ts | 29 +- .../editable-textarea.component.html | 19 +- .../editable-textarea.component.scss | 2 +- .../editable-textarea.component.spec.ts | 69 +- .../editable-textarea.component.ts | 6 +- .../editable-button-toggle.component.ts | 4 +- .../editable-toggle-group.component.html | 27 +- .../editable-toggle-group.component.scss | 4 +- .../editable-toggle-group.component.spec.ts | 23 +- .../editable-toggle-group.component.ts | 6 +- .../emails-input/emails-input.component.html | 47 +- .../emails-input/emails-input.component.scss | 80 +-- .../emails-input/emails-input.component.ts | 20 +- .../emails-input/emails-input.module.ts | 13 +- .../level-input/level-input.component.html | 39 +- .../level-input/level-input.component.scss | 23 +- .../level-input/level-input.component.spec.ts | 13 +- .../level-input/level-input.component.ts | 35 +- .../level-input/level-input.module.spec.ts | 1 - .../level-input/level-input.module.ts | 10 +- .../multiple-email-input.component.html | 86 +-- .../multiple-email-input.component.spec.ts | 22 +- .../multiple-email-input.component.ts | 14 +- .../components/footer/footer.component.html | 4 +- .../footer/footer.component.spec.ts | 7 +- .../components/footer/footer.component.ts | 4 +- .../components/footer/footer.module.ts | 2 +- .../components/header/header.component.html | 28 +- .../components/header/header.component.scss | 38 +- .../components/header/header.component.ts | 120 ++-- .../components/header/header.module.ts | 9 +- .../item-select/item-select.component.html | 12 +- .../item-select/item-select.component.scss | 188 +++--- .../item-select/item-select.component.ts | 7 +- .../header/item-select/item-select.module.ts | 11 +- .../menu-application-tile.component.html | 25 +- .../menu-application-tile.component.scss | 47 +- .../menu-application-tile.component.ts | 6 +- .../header/menu/menu-overlay-ref.ts | 13 +- .../header/menu/menu-overlay.service.ts | 14 +- .../header/menu/menu.component.html | 125 ++-- .../header/menu/menu.component.scss | 36 +- .../components/header/menu/menu.component.ts | 6 +- .../components/header/menu/menu.module.ts | 24 +- .../select-language.component.html | 30 +- .../select-language.component.scss | 32 +- .../select-language.component.ts | 12 +- .../select-language/select-language.module.ts | 10 +- .../select-tenant-dialog.component.html | 27 +- .../select-tenant-dialog.component.scss | 10 +- .../select-tenant-dialog.module.ts | 17 +- .../user-photo/user-photo.component.html | 2 +- .../user-photo/user-photo.component.scss | 10 +- .../header/user-photo/user-photo.component.ts | 7 +- .../header/user-photo/user-photo.module.ts | 14 +- .../logbook-operation-facet.component.html | 9 +- .../logbook-operation-facet.component.scss | 8 +- .../logbook-operation-facet.component.ts | 8 +- .../login-redirect.component.html | 7 +- .../login-redirect.component.scss | 42 +- .../login-redirect.component.spec.ts | 7 +- .../login-redirect.component.ts | 10 +- .../login-redirect/login-redirect.module.ts | 11 +- .../application-menu.component.html | 2 +- .../application-menu.component.ts | 5 +- .../common-menu/common-menu.component.html | 37 +- .../common-menu/common-menu.component.scss | 84 ++- .../common-menu/common-menu.component.spec.ts | 14 +- .../common-menu/common-menu.component.ts | 14 +- .../customer-menu.component.html | 2 +- .../customer-menu.component.spec.ts | 9 +- .../customer-menu/customer-menu.component.ts | 9 +- .../customer-menu/customer-menu.service.ts | 3 +- .../components/navbar/menu-type.enum.ts | 6 +- .../components/navbar/navbar.component.html | 26 +- .../components/navbar/navbar.component.scss | 45 +- .../navbar/navbar.component.spec.ts | 23 +- .../components/navbar/navbar.component.ts | 23 +- .../components/navbar/navbar.module.ts | 4 +- .../tenant-menu/tenant-menu.component.html | 2 +- .../tenant-menu/tenant-menu.component.spec.ts | 9 +- .../tenant-menu/tenant-menu.component.ts | 8 +- .../tenant-menu/tenant-menu.service.spec.ts | 20 +- .../navbar/tenant-menu/tenant-menu.service.ts | 9 +- .../order-by-button.component.html | 4 +- .../order-by-button.component.spec.ts | 5 +- .../order-by-button.component.ts | 9 +- .../order-by-button/order-by-button.module.ts | 8 +- .../order-dropdown.component.html | 6 +- .../order-dropdown.component.scss | 57 +- .../order-dropdown.component.spec.ts | 5 +- .../order-dropdown.component.ts | 11 +- .../order-dropdown/order-dropdown.module.ts | 14 +- .../order-option/order-option.component.html | 4 +- .../order-option/order-option.component.scss | 63 +- .../order-option.component.spec.ts | 5 +- .../order-option/order-option.component.ts | 9 +- .../role-toggle/role-toggle.component.html | 2 +- .../role-toggle/role-toggle.component.spec.ts | 24 +- .../role-toggle/role-toggle.component.ts | 13 +- .../role-toggle/role-toggle.module.ts | 11 +- .../role-toggle/role.component.html | 2 +- .../role-toggle/role.component.spec.ts | 5 +- .../components/role-toggle/role.component.ts | 9 +- .../scroll-top/scroll-top.component.scss | 4 +- .../scroll-top/scroll-top.component.spec.ts | 7 +- .../scroll-top/scroll-top.component.ts | 26 +- ...rch-bar-with-sibling-button.component.html | 8 +- ...earch-bar-with-sibling-button.component.ts | 4 +- .../search-bar/search-bar.component.html | 15 +- .../search-bar/search-bar.component.scss | 6 +- .../search-bar/search-bar.component.spec.ts | 11 +- .../search-bar/search-bar.component.ts | 8 +- .../search-bar/search-bar.module.ts | 9 +- .../slide-toggle/slide-toggle.component.html | 11 +- .../slide-toggle/slide-toggle.component.scss | 167 ++--- .../slide-toggle.component.spec.ts | 12 +- .../slide-toggle/slide-toggle.component.ts | 12 +- .../slide-toggle/slide-toggle.module.ts | 9 +- .../components/stepper/stepper.component.html | 8 +- .../components/stepper/stepper.component.scss | 4 +- .../stepper/stepper.component.spec.ts | 14 +- .../components/stepper/stepper.component.ts | 10 +- .../components/stepper/stepper.module.ts | 16 +- .../table-filter-option.component.html | 5 +- .../table-filter-option.component.scss | 40 +- .../table-filter-option.component.spec.ts | 5 +- .../table-filter-option.component.ts | 10 +- .../table-filter-search.component.html | 11 +- .../table-filter-search.component.scss | 4 +- .../table-filter-search.component.spec.ts | 26 +- .../table-filter-search.component.ts | 13 +- .../table-filter/table-filter.component.html | 2 +- .../table-filter/table-filter.component.scss | 84 +-- .../table-filter.component.spec.ts | 24 +- .../table-filter/table-filter.component.ts | 4 +- .../table-filter.directive.spec.ts | 15 +- .../table-filter/table-filter.directive.ts | 29 +- .../table-filter/table-filter.module.ts | 12 +- .../tenant-select-content.component.html | 2 +- .../tenant-select-content.component.scss | 60 +- .../tenant-select-content.component.spec.ts | 7 +- .../tenant-select-content.component.ts | 7 +- .../tenant-select-content.module.ts | 8 +- .../vitamui-autocomplete/option.interface.ts | 2 - .../vitamui-autocomplete.component.html | 37 +- .../vitamui-autocomplete.component.scss | 15 +- .../vitamui-autocomplete.component.spec.ts | 10 +- .../vitamui-autocomplete.component.ts | 70 ++- .../vitamui-body/vitamui-body.component.html | 6 +- .../vitamui-body/vitamui-body.component.scss | 8 +- .../vitamui-body/vitamui-body.component.ts | 6 +- .../vitamui-body/vitamui-body.module.ts | 9 +- .../vitamui-common-banner.component.html | 8 +- .../vitamui-common-banner.component.ts | 6 +- .../vitamui-common-banner.module.ts | 9 +- .../vitamui-common-select.component.html | 14 +- .../vitamui-common-select.component.scss | 15 +- .../vitamui-common-select.component.ts | 13 +- .../vitamui-common-select.module.ts | 11 +- .../vitamui-breadcrumb.component.html | 38 +- .../vitamui-breadcrumb.component.scss | 37 +- .../vitamui-breadcrumb.component.ts | 13 +- .../vitamui-content-breadcrumb.module.ts | 17 +- .../vitamui-title-breadcrumb.component.html | 18 +- .../vitamui-title-breadcrumb.component.scss | 28 +- .../vitamui-title-breadcrumb.component.ts | 7 +- .../vitamui-customer-select.component.html | 8 +- .../vitamui-customer-select.component.scss | 26 +- .../vitamui-customer-select.component.ts | 15 +- .../vitamui-customer-select.module.ts | 11 +- .../vitamui-display-node.component.html | 6 +- .../vitamui-display-node.component.scss | 27 +- .../vitamui-display-node.component.spec.ts | 11 +- .../vitamui-display-node.component.ts | 9 +- .../vitamui-display-node.module.ts | 7 +- .../vitamui-drag-drop-file.component.html | 49 +- .../vitamui-drag-drop-file.component.scss | 72 +-- .../vitamui-drag-drop-file.component.ts | 12 +- .../vitamui-drag-drop-file.module.ts | 11 +- .../vitamui-duration-input.component.html | 26 +- .../vitamui-duration-input.component.scss | 57 +- .../vitamui-duration-input.component.spec.ts | 11 +- .../vitamui-duration-input.component.ts | 17 +- .../vitamui-duration-input.module.ts | 11 +- .../vitamui-facet.component.html | 4 +- .../vitamui-facet.component.scss | 12 +- .../vitamui-field-error.component.spec.ts | 5 +- .../vitamui-field-error.component.ts | 6 +- .../vitamui-field-error.module.ts | 14 +- .../vitamui-input-error.component.scss | 2 +- .../vitamui-input-error.component.spec.ts | 5 +- .../vitamui-input-error.component.ts | 11 +- ...tamui-input-positive-number.component.html | 22 +- ...tamui-input-positive-number.component.scss | 23 +- ...ui-input-positive-number.component.spec.ts | 11 +- ...vitamui-input-positive-number.component.ts | 26 +- .../vitamui-input.component.html | 19 +- .../vitamui-input.component.scss | 16 +- .../vitamui-input.component.spec.ts | 11 +- .../vitamui-input/vitamui-input.component.ts | 33 +- .../vitamui-input/vitamui-input.module.ts | 10 +- .../vitamui-textarea.component.html | 34 +- .../vitamui-textarea.component.scss | 33 +- .../vitamui-textarea.component.spec.ts | 11 +- .../vitamui-textarea.component.ts | 21 +- ...itamui-interval-date-picker.component.html | 2 +- ...itamui-interval-date-picker.component.scss | 2 +- .../vitamui-interval-date-picker.component.ts | 9 +- .../vitamui-list-input.component.html | 16 +- .../vitamui-list-input.component.scss | 70 +-- .../vitamui-list-input.component.spec.ts | 28 +- .../vitamui-list-input.component.ts | 28 +- .../vitamui-list-input.module.ts | 11 +- .../vitamui-menu-button.component.html | 22 +- .../vitamui-menu-button.component.scss | 110 ++-- .../vitamui-menu-button.component.ts | 5 +- .../vitamui-menu-button.module.ts | 16 +- .../vitamui-menu-tile.component.html | 22 +- .../vitamui-menu-tile.component.scss | 84 +-- .../vitamui-menu-tile.component.spec.ts | 25 +- .../vitamui-menu-tile.component.ts | 13 +- .../vitamui-menu-tile.module.ts | 8 +- .../vitamui-multi-inputs.component.html | 17 +- .../vitamui-multi-inputs.component.scss | 6 +- .../vitamui-multi-inputs.component.ts | 33 +- .../vitamui-multi-inputs.module.ts | 32 +- .../vitamui-sidenav-header.module.ts | 11 +- .../vitamui-snack-bar.component.html | 2 +- .../vitamui-snack-bar.component.scss | 50 +- .../vitamui-snack-bar.component.spec.ts | 12 +- .../vitamui-snack-bar.component.ts | 9 +- .../vitamui-snack-bar.module.ts | 8 +- .../vitamui-snack-bar.service.ts | 6 +- .../vitamui-tenant-select.component.html | 6 +- .../vitamui-tenant-select.component.scss | 75 +-- .../vitamui-tenant-select.component.ts | 48 +- .../vitamui-tenant-select.module.ts | 11 +- .../vitamui-tree-node/node.interface.ts | 2 +- .../vitamui-tree-node.module.ts | 25 +- .../src/app/modules/country.service.ts | 6 +- .../app/modules/customer-selection.service.ts | 3 +- .../collapse/collapse-container.directive.ts | 6 +- .../collapse-trigger-for.directive.ts | 6 +- .../collapse/collapse.directive.module.ts | 20 +- .../collapse/collapse.directive.spec.ts | 22 +- .../directives/collapse/collapse.directive.ts | 4 +- .../drag-and-drop/drag-and-drop.directive.ts | 6 +- .../drag-and-drop/drag-and-drop.module.ts | 9 +- .../ellipsis/ellipsis.directive.module.ts | 8 +- .../ellipsis/ellipsis.directive.spec.ts | 18 +- .../directives/ellipsis/ellipsis.directive.ts | 11 +- .../infinite-scroll.directive.ts | 46 +- .../infinite-scroll/infinite-scroll.module.ts | 8 +- .../resize-sidebar.directive.ts | 15 +- .../resize-sidebar/resize-sidebar.module.ts | 16 +- .../resize-vertical.directive.spec.ts | 49 +- .../resize-vertical.directive.ts | 5 +- .../row-collapse-container.directive.ts | 6 +- .../row-collapse-trigger-for.directive.ts | 6 +- .../row-collapse.directive.spec.ts | 22 +- .../row-collapse/row-collapse.directive.ts | 4 +- .../row-collapse/row-collapse.module.ts | 20 +- .../modules/directives/tooltip/tooltip-ref.ts | 9 +- .../directives/tooltip/tooltip.component.html | 2 - .../tooltip/tooltip.component.spec.ts | 13 +- .../directives/tooltip/tooltip.component.ts | 10 +- .../directives/tooltip/tooltip.directive.ts | 30 +- .../directives/tooltip/tooltip.module.ts | 8 +- .../directives/tooltip/tooltip.service.ts | 5 +- .../error-dialog/error-dialog.component.html | 10 +- .../error-dialog/error-dialog.component.scss | 19 +- .../error-dialog.component.spec.ts | 14 +- .../error-dialog/error-dialog.component.ts | 21 +- .../app/modules/externalParameters.enum.ts | 4 +- .../app/modules/externalParameters.service.ts | 7 +- .../src/app/modules/global-event.service.ts | 7 +- .../src/app/modules/helper/injector-helper.ts | 2 +- .../src/app/modules/helper/injector.module.ts | 2 +- .../src/app/modules/language.service.ts | 10 +- .../event-type-label.component.html | 4 +- .../event-type-label.component.scss | 2 +- .../event-type-label.component.ts | 9 +- .../event-type-label.module.ts | 7 +- .../history-events.component.html | 4 +- .../history-events.component.scss | 164 ++--- .../modules/logbook/history/history.module.ts | 17 +- ...multi-operation-history-tab.component.html | 9 +- .../multi-operation-history-tab.component.ts | 30 +- .../operation-history-tab.component.html | 9 +- .../operation-history-tab.component.ts | 29 +- .../app/modules/logbook/logbook.service.ts | 41 +- .../src/app/modules/logger/logger.module.ts | 6 +- .../app/modules/logger/logger.service.spec.ts | 10 +- .../src/app/modules/logger/logger.ts | 16 +- .../app/modules/logger/no-log.service.spec.ts | 10 +- .../src/app/modules/logger/no-log.service.ts | 12 +- .../modules/missing-translation-handler.ts | 18 +- .../accession-register-detail.ts | 1 - .../accession-register-status.ts | 2 +- .../accession-registers-stats.ts | 3 +- .../models/breadcrumb/breadcrumb.interface.ts | 6 +- .../modules/models/collect/legal-status.ts | 3 +- .../modules/models/collect/project-status.ts | 2 +- .../models/collect/transaction-status.ts | 2 +- .../app/modules/models/collect/transaction.ts | 5 +- .../models/content-disposition.enum.ts | 4 +- .../modules/models/criteria/criteria.enums.ts | 3 +- .../customer/basic-customer.interface.ts | 17 +- .../models/customer/customer.interface.ts | 7 +- .../customer/identity-provider.interface.ts | 20 +- .../modules/models/customer/otp-state.enum.ts | 6 +- .../models/customer/theme/color.interface.ts | 6 +- .../theme/customer-theme.interface.ts | 4 +- .../models/customer/theme/logo.interface.ts | 4 +- .../http-interceptor/vitamui-timeout-error.ts | 6 +- .../modules/models/logbook/event.interface.ts | 2 +- .../logbook/logbook-operation.interface.ts | 2 +- .../models/operation/facet-colors.enum.ts | 8 +- .../models/operation/operation-status.enum.ts | 12 +- .../models/operation/operation-type.enum.ts | 4 +- .../models/position/position-type.enum.ts | 8 +- .../profile/admin-user-profile.interface.ts | 18 +- .../models/profile/profile.interface.ts | 1 - .../models/units/unit-object-api.interface.ts | 4 +- .../models/units/unit-object-helper.spec.ts | 12 +- .../models/units/unit-object-helper.ts | 4 +- .../models/user/auth-user.interface.ts | 4 +- .../user/user-profile-group-info.interface.ts | 8 +- .../models/vitam/vitam-response.interface.ts | 6 +- .../vitam/vitam-select-criteria.interface.ts | 78 ++- .../vitam/vitam-select-query.interface.ts | 6 +- .../app/modules/paginated-api.interface.ts | 2 - .../src/app/modules/pipes/bytes.pipe.spec.ts | 4 +- .../src/app/modules/pipes/bytes.pipe.ts | 11 +- .../src/app/modules/pipes/empty.pipe.ts | 4 +- .../src/app/modules/pipes/filesize.pipe.ts | 14 +- .../src/app/modules/pipes/highlight.pipe.ts | 6 +- .../src/app/modules/pipes/pipes.module.ts | 4 +- .../src/app/modules/pipes/safe-style.pipe.ts | 5 +- .../src/app/modules/pipes/strongify.pipe.ts | 8 +- .../src/app/modules/pipes/truncate.pipe.ts | 4 +- .../src/app/modules/pipes/yes-no.pipe.ts | 4 +- .../src/app/modules/rule/rule.service.ts | 40 +- .../security/has-any-role.directive.spec.ts | 72 +-- .../security/has-any-role.directive.ts | 17 +- .../security/has-role.directive.spec.ts | 75 +-- .../modules/security/has-role.directive.ts | 6 +- .../app/modules/security/security.module.ts | 12 +- .../modules/security/security.service.spec.ts | 30 +- .../app/modules/security/security.service.ts | 36 +- .../modules/services/profile.service.spec.ts | 13 +- .../app/modules/services/profile.service.ts | 13 +- .../src/app/modules/sidenav-page.class.ts | 21 +- .../src/app/modules/startup.service.ts | 15 +- .../notification-snack-bar.component.html | 15 +- .../notification-snack-bar.component.scss | 4 +- .../notification-snack-bar.component.spec.ts | 14 +- .../notification-snack-bar.component.ts | 6 +- .../subrogation/notification-type.enum.ts | 2 +- .../subrogation-banner.component.html | 8 +- .../subrogation-banner.component.spec.ts | 9 +- .../subrogation-banner.component.ts | 43 +- .../subrogation-modal.component.spec.ts | 5 +- .../subrogation-modal.component.ts | 17 +- .../subrogation-modal.service.spec.ts | 2 +- .../subrogation-modal.service.ts | 10 +- .../subrogation-snack-bar.component.html | 9 +- .../subrogation-snack-bar.component.spec.ts | 15 +- .../subrogation-snack-bar.component.ts | 7 +- .../modules/subrogation/subrogation.module.ts | 29 +- .../subrogation/subrogation.service.spec.ts | 14 +- .../subrogation/subrogation.service.ts | 79 +-- .../src/app/modules/tenant-selection.guard.ts | 6 +- .../app/modules/tenant-selection.service.ts | 224 +++---- .../src/app/modules/theme.service.ts | 53 +- .../app/modules/utils/access-contract.util.ts | 2 +- .../modules/utils/authnRequestBinding.enum.ts | 2 +- .../src/app/modules/utils/colors.util.spec.ts | 8 +- .../src/app/modules/utils/colors.util.ts | 59 +- .../src/app/modules/utils/diff.util.spec.ts | 6 +- .../src/app/modules/utils/diff.util.ts | 2 +- .../src/app/modules/utils/level.util.ts | 2 +- .../src/app/modules/utils/role.enum.ts | 7 +- .../modules/utils/theme-color-type.enum.ts | 1 - .../src/app/modules/vitamui-common.module.ts | 9 +- .../modules/vitamui-global-error-handler.ts | 8 +- .../app/modules/vitamui-http-interceptor.ts | 4 +- .../vitamui-table/criteria-builder.util.ts | 12 +- .../modules/vitamui-table/direction.enum.ts | 2 +- .../infinite-scroll-table.spec.ts | 7 - .../vitamui-table/infinite-scroll-table.ts | 6 +- .../modules/vitamui-table/operators.enum.ts | 2 +- .../vitamui-table/page-request.model.ts | 6 +- .../vitamui-table/search.service.spec.ts | 13 +- .../modules/vitamui-table/search.service.ts | 50 +- .../src/environments/environment.prod.ts | 2 +- .../src/environments/environment.ts | 2 +- ui/ui-frontend-common/src/index.html | 38 +- ui/ui-frontend-common/src/main.ts | 3 +- ui/ui-frontend-common/src/polyfills.ts | 5 +- .../src/sass/_app-loader.scss | 62 +- ui/ui-frontend-common/src/sass/_button.scss | 6 +- ui/ui-frontend-common/src/sass/_chip.scss | 9 +- .../src/sass/_editable-field.scss | 254 ++++---- ui/ui-frontend-common/src/sass/_file.scss | 22 +- ui/ui-frontend-common/src/sass/_icon.scss | 24 +- ui/ui-frontend-common/src/sass/_image.scss | 14 +- ui/ui-frontend-common/src/sass/_input.scss | 19 +- ui/ui-frontend-common/src/sass/_layout.scss | 133 ++-- ui/ui-frontend-common/src/sass/_mixins.scss | 10 +- ui/ui-frontend-common/src/sass/_modal.scss | 3 +- ui/ui-frontend-common/src/sass/_navbar.scss | 114 ++-- ui/ui-frontend-common/src/sass/_preview.scss | 217 ++++--- .../src/sass/_search-bar.scss | 107 ++-- ui/ui-frontend-common/src/sass/_spinner.scss | 101 +-- ui/ui-frontend-common/src/sass/_table.scss | 563 ++++++++--------- ui/ui-frontend-common/src/sass/_theme.scss | 56 +- ui/ui-frontend-common/src/sass/_title.scss | 20 +- ui/ui-frontend-common/src/sass/_tooltip.scss | 98 +-- .../src/sass/_variables.scss | 6 +- .../src/sass/base/_base.scss | 317 +++++----- .../src/sass/base/_typography.scss | 119 ++-- .../src/sass/base/_utilities.scss | 18 +- .../src/sass/material/_autocomplete.scss | 80 ++- .../sass/material/_button-toggle-group.scss | 140 ++--- .../src/sass/material/_checkbox.scss | 74 ++- .../src/sass/material/_dialog.scss | 20 +- .../src/sass/material/_form-field.scss | 170 ++--- .../src/sass/material/_icon.scss | 2 +- .../src/sass/material/_input.scss | 15 +- .../src/sass/material/_material-theme.scss | 93 ++- .../src/sass/material/_menu.scss | 263 ++++---- .../src/sass/material/_modal.scss | 2 - .../src/sass/material/_preview-tab.scss | 122 ++-- .../src/sass/material/_progress-bar.scss | 18 +- .../src/sass/material/_select.scss | 250 ++++---- .../src/sass/material/_snack-bar.scss | 190 +++--- .../src/sass/mixins/_badge.scss | 59 +- .../src/sass/mixins/_breakpoints.scss | 30 +- .../src/sass/mixins/_elevation.scss | 332 ++++++---- .../src/sass/mixins/_fonts.scss | 24 +- .../src/sass/mixins/material/_modal.scss | 7 +- .../src/sass/mixins/material/_select.scss | 100 ++- .../sass/variables/_bootstrap-variables.scss | 2 +- .../src/sass/variables/_colors.scss | 8 +- ui/ui-frontend-common/src/test.ts | 10 +- .../archive-search/e2e/src/app.e2e-spec.ts | 8 +- .../archive-search/src/app/app.component.scss | 60 +- .../archive-search/src/app/app.component.ts | 6 +- .../archive-preview.component.html | 22 +- .../archive-preview.component.spec.ts | 41 +- .../archive-preview.component.ts | 21 +- ...rchive-unit-information-tab.component.html | 10 +- ...ive-unit-information-tab.component.spec.ts | 2 +- .../archive-unit-information-tab.component.ts | 60 +- ...ve-unit-objects-details-tab.component.html | 63 +- ...ve-unit-objects-details-tab.component.scss | 10 +- ...unit-objects-details-tab.component.spec.ts | 4 +- ...hive-unit-objects-details-tab.component.ts | 7 +- ...rchive-unit-rules-details-tab.component.ts | 5 +- ...t-rules-informations-tab.component.spec.ts | 8 +- ...e-unit-rules-informations-tab.component.ts | 11 +- .../dip-request-create.component.ts | 4 +- .../add-management-rules.component.ts | 26 +- .../add-update-property.component.spec.ts | 8 +- .../add-update-property.component.ts | 19 +- .../archive-unit-rules.component.ts | 22 +- ...ock-category-inheritance.component.spec.ts | 4 +- .../block-category-inheritance.component.ts | 11 +- .../block-rules-inheritance.component.ts | 12 +- .../delete-unit-rules.component.ts | 12 +- ...ock-category-inheritance.component.spec.ts | 4 +- .../unlock-category-inheritance.component.ts | 12 +- .../unlock-rules-inheritance.component.ts | 16 +- .../update-unit-rules.component.ts | 16 +- .../management-rules.component.html | 22 +- .../management-rules.component.ts | 106 ++-- .../reclassification.component.html | 19 +- .../reclassification.component.ts | 12 +- .../transfer-request-modal.component.ts | 4 +- .../access-rule-search.component.html | 2 +- .../access-rule-search.component.ts | 30 +- .../appraisal-rule-search.component.html | 2 +- .../appraisal-rule-search.component.ts | 40 +- .../dissemination-rule-search.component.ts | 30 +- .../reuse-rule-search.component.ts | 30 +- .../storage-rule-search.component.ts | 40 +- .../search-access-rules-facets.component.ts | 10 +- ...search-appraisal-rules-facets.component.ts | 16 +- ...ch-dissemination-rules-facets.component.ts | 10 +- .../search-reuse-rules-facets.component.ts | 10 +- .../search-storage-rules-facets.component.ts | 16 +- .../archive-search.component.html | 8 +- .../archive-search.component.spec.ts | 2 +- .../archive-search.component.ts | 103 ++- .../archive/archive-search/rule.validator.ts | 7 +- .../confirm-action.component.ts | 11 +- .../search-criteria-list.component.ts | 2 +- .../search-criteria-list.service.ts | 5 +- .../search-criteria-saver.component.html | 4 +- .../search-criteria-saver.component.ts | 6 +- .../search-criteria-saver.service.ts | 15 +- .../simple-criteria-search.component.html | 53 +- .../simple-criteria-search.component.ts | 78 +-- ...d-description-criteria-search.component.ts | 10 +- .../transfer-acknowledgment.component.ts | 8 +- .../src/app/archive/archive.component.html | 15 +- .../src/app/archive/archive.component.ts | 16 +- .../src/app/archive/archive.module.ts | 219 +++---- .../src/app/archive/archive.service.ts | 41 +- .../common-services/archive-facets.service.ts | 14 +- .../archive-search-helper.service.ts | 25 +- .../archive-unit-dip.service.ts | 21 +- .../archive-unit-elimination.service.ts | 37 +- .../compute-inherited-rules.service.ts | 10 +- .../update-unit-management-rule.service.ts | 24 +- .../criteria-search.component.html | 82 ++- .../criteria-search.component.scss | 1 - .../classification-tree.component.html | 4 +- .../classification-tree.component.scss | 13 +- .../classification-tree.component.ts | 8 +- .../filing-holding-scheme.component.html | 6 +- .../filing-holding-scheme.component.scss | 13 +- .../filing-holding-scheme.component.ts | 22 +- .../filing-holding-scheme.handler.spec.ts | 2 +- .../filing-holding-scheme.handler.ts | 4 +- .../leaves-tree/leaves-tree.component.html | 6 +- .../leaves-tree/leaves-tree.component.scss | 13 +- .../leaves-tree/leaves-tree.component.spec.ts | 2 +- .../leaves-tree/leaves-tree.component.ts | 20 +- .../models/dip-request-detail.interface.ts | 2 +- .../transfer-request-detail.interface.ts | 2 +- .../src/app/archive/shared/shared.module.ts | 13 +- .../vitamui-snack-bar.component.ts | 7 +- .../vitamui-snack-bar.module.ts | 11 +- .../vitamui-snack-bar.service.ts | 211 ++++--- .../archive-unit-validator.service.ts | 15 +- .../management-rules-validator.service.ts | 15 +- .../app/core/api/archive-api.service.spec.ts | 2 +- .../app/core/archive-shared-data.service.ts | 7 +- .../src/environments/environment.prod.ts | 2 +- .../src/environments/environment.ts | 2 +- .../projects/archive-search/src/index.html | 39 +- .../projects/archive-search/src/main.ts | 5 +- .../projects/archive-search/src/polyfills.ts | 2 +- .../src/sass/_common-archive.scss | 20 +- .../archive-search/src/sass/_form.scss | 8 +- .../archive-search/src/sass/_profile-tag.scss | 30 +- .../archive-search/src/sass/_tooltip.scss | 74 +-- .../src/sass/_vitamui-tab-group.scss | 92 +-- .../archive-search/src/sass/login.scss | 232 ++++--- .../archive-search/src/sass/styles.scss | 5 +- .../projects/archive-search/src/test.ts | 10 +- .../projects/collect/e2e/src/app.e2e-spec.ts | 2 +- .../collect/src/app/app.component.html | 2 +- .../collect/src/app/app.component.scss | 1 - .../archive-collect.service.ts | 56 +- .../archive-preview.component.html | 12 +- .../archive-preview.component.ts | 8 +- ...rchive-unit-information-tab.component.html | 10 +- .../archive-unit-information-tab.component.ts | 72 +-- ...rchive-unit-rules-details-tab.component.ts | 17 +- ...t-rules-informations-tab.component.spec.ts | 2 +- ...e-unit-rules-informations-tab.component.ts | 43 +- ...object-group-details-tab.component.spec.ts | 61 +- ...lect-object-group-details-tab.component.ts | 25 +- .../archive-search-collect.component.html | 25 +- .../archive-search-collect.component.spec.ts | 4 +- .../archive-search-collect.component.ts | 146 +++-- .../access-rule-search.component.html | 10 +- .../access-rule-search.component.ts | 28 +- .../appraisal-rule-search.component.html | 10 +- .../appraisal-rule-search.component.ts | 36 +- .../search-access-rules-facets.component.ts | 10 +- ...search-appraisal-rules-facets.component.ts | 16 +- ...ch-dissemination-rules-facets.component.ts | 10 +- .../search-reuse-rules-facets.component.ts | 10 +- .../search-storage-rules-facets.component.ts | 16 +- .../criteria-search.component.html | 82 +-- .../criteria-search.component.scss | 1 - .../criteria-search.component.ts | 3 +- .../dissemination-rule-search.component.html | 8 +- .../dissemination-rule-search.component.ts | 26 +- .../classification-tree.component.html | 4 +- .../classification-tree.component.scss | 13 +- .../classification-tree.component.ts | 8 +- .../filing-holding-scheme.component.html | 3 +- .../filing-holding-scheme.component.scss | 13 +- .../filing-holding-scheme.component.ts | 33 +- .../filing-holding-scheme.handler.ts | 6 +- .../leaves-tree/leaves-tree.component.html | 6 +- .../leaves-tree/leaves-tree.component.scss | 13 +- .../leaves-tree/leaves-tree.component.spec.ts | 4 +- .../leaves-tree/leaves-tree.component.ts | 22 +- .../reuse-rule-search.component.html | 8 +- .../reuse-rule-search.component.ts | 28 +- .../confirm-action.component.ts | 11 +- .../search-criteria-list.component.ts | 2 +- .../search-criteria-saver.component.html | 4 +- .../search-criteria-saver.component.ts | 12 +- .../simple-criteria-search.component.html | 6 +- .../simple-criteria-search.component.ts | 36 +- .../storage-rule-search.component.html | 12 +- .../storage-rule-search.component.ts | 36 +- ...ion-criteria-search-collect.component.html | 3 +- ...ption-criteria-search-collect.component.ts | 10 +- .../archive-search-criteria/models/utils.ts | 8 +- .../services/archive-facets.service.ts | 14 +- .../services/archive-search-helper.service.ts | 20 +- .../services/archive-shared-data.service.ts | 2 +- .../services/rule.validator.ts | 14 +- .../services/search-criteria-saver.service.ts | 5 +- .../update-units-metadata.component.spec.ts | 2 +- .../update-units-metadata.component.ts | 4 +- .../core/api/project-api.service.spec.ts | 2 +- .../collect/core/api/project-api.service.ts | 24 +- .../core/api/transaction-api.service.ts | 29 +- .../core/models/create-project.interface.ts | 2 +- .../create-project.component.html | 189 +++--- .../create-project.component.scss | 12 +- .../create-project.component.spec.ts | 31 +- .../create-project.component.ts | 67 +- .../project-list/project-list.component.ts | 5 +- .../project-preview.component.html | 104 ++- .../project-preview.component.scss | 12 +- .../project-preview.component.spec.ts | 61 +- .../project-preview.component.ts | 8 +- .../app/collect/projects/project.module.ts | 42 +- .../collect/projects/projects.component.html | 6 +- .../collect/projects/projects.component.ts | 6 +- .../app/collect/projects/projects.service.ts | 17 +- .../collect-upload/collect-upload.service.ts | 10 +- .../vitamui-snack-bar.component.ts | 5 +- .../vitamui-snack-bar.module.ts | 11 +- .../vitamui-snack-bar.service.ts | 211 ++++--- .../transaction-list.component.html | 54 +- .../transaction-list.component.spec.ts | 6 +- .../transaction-list.component.ts | 10 +- .../transaction-resolver.service.ts | 25 +- .../transaction-routing.module.ts | 15 +- .../transactions/transaction.module.ts | 35 +- .../transactions/transactions.component.html | 8 +- .../transactions/transactions.component.ts | 34 +- .../transactions/transactions.service.ts | 8 +- .../projects/collect/src/index.html | 39 +- .../collect/src/sass/_common-archive.scss | 20 +- .../projects/collect/src/sass/_form.scss | 2 +- .../projects/collect/src/sass/_tooltip.scss | 8 +- .../collect/src/sass/_vitamui-tab-group.scss | 4 +- .../projects/collect/src/sass/login.scss | 6 +- .../projects/collect/src/sass/styles.scss | 5 +- .../projects/demo/e2e/src/app.e2e-spec.ts | 8 +- .../projects/demo/src/app/app.component.html | 20 +- .../projects/demo/src/app/app.component.ts | 9 +- .../projects/demo/src/app/app.module.ts | 12 +- .../account-demo/account-demo.component.html | 4 +- .../account-demo/account-demo.component.ts | 9 +- .../demo/account-demo/account-demo.module.ts | 8 +- .../app-guard-demo.component.html | 4 +- .../app-guard-demo.component.ts | 9 +- .../app-guard-demo/app-guard-demo.module.ts | 9 +- .../guarded-page.component.html | 4 +- .../app-guard-demo/guarded-page.component.ts | 7 +- .../component-demo.component.ts | 9 +- .../component-demo/component-demo.module.ts | 18 +- .../components/components.component.html | 85 +-- .../components/components.component.scss | 10 +- .../components/components.component.ts | 24 +- .../demo/component-demo/css/css.component.ts | 9 +- .../demo/icon-demo/icon-demo.component.html | 1 - .../demo/icon-demo/icon-demo.component.scss | 24 +- .../app/demo/icon-demo/icon-demo.component.ts | 9 +- .../app/demo/icon-demo/icon-demo.module.ts | 9 +- .../subrogation-demo.component.html | 4 +- .../subrogation-demo.component.ts | 11 +- .../subrogation-demo.module.ts | 10 +- .../demo/src/environments/environment.prod.ts | 2 +- .../demo/src/environments/environment.ts | 2 +- ui/ui-frontend/projects/demo/src/index.html | 21 +- ui/ui-frontend/projects/demo/src/main.ts | 5 +- ui/ui-frontend/projects/demo/src/polyfills.ts | 2 +- ui/ui-frontend/projects/demo/src/styles.scss | 12 +- ui/ui-frontend/projects/demo/src/test.ts | 10 +- .../identity/src/app/app-routing.module.ts | 55 +- .../identity/src/app/app.component.html | 2 +- .../identity/src/app/app.component.scss | 4 +- .../identity/src/app/app.component.spec.ts | 15 +- .../identity/src/app/app.component.ts | 7 +- .../projects/identity/src/app/app.module.ts | 2 +- .../app/core/api/customer-api.service.spec.ts | 2 +- .../src/app/core/api/customer-api.service.ts | 62 +- .../app/core/api/group-api.service.spec.ts | 14 +- .../src/app/core/api/group-api.service.ts | 11 +- .../src/app/core/api/user-api.service.spec.ts | 14 +- .../src/app/core/api/user-api.service.ts | 9 +- .../identity/src/app/core/core.module.ts | 13 +- .../src/app/core/customer.service.spec.ts | 11 +- .../identity/src/app/core/customer.service.ts | 80 ++- .../src/app/customer/attachment.enum.ts | 6 +- .../customer-alerting.component.html | 18 +- .../customer-alerting.component.spec.ts | 11 +- .../customer-alerting.component.ts | 9 +- .../customer-colors-input.component.html | 31 +- .../customer-colors-input.component.ts | 15 +- .../customer-colors-input.module.ts | 41 +- .../input-color/color-error.enum.ts | 2 +- .../input-color/input-color.component.html | 50 +- .../customer-create.component.html | 64 +- .../customer-create.component.spec.ts | 94 ++- .../customer-create.component.ts | 6 +- .../customer-create/customer-create.module.ts | 11 +- .../customer-create.validators.spec.ts | 4 +- .../customer-create.validators.ts | 32 +- .../customer-list.component.html | 39 +- .../customer-list.component.spec.ts | 182 +++--- .../customer-list/customer-list.component.ts | 57 +- .../customer-list/customer-list.module.ts | 11 +- .../customer-list.service.spec.ts | 127 ++-- .../customer-list/customer-list.service.ts | 53 +- .../owner-list/owner-list.component.html | 74 ++- .../owner-list/owner-list.component.scss | 4 +- .../owner-list/owner-list.component.ts | 40 +- .../customer-popup.component.ts | 7 +- .../customer-preview.component.html | 55 +- .../customer-preview.component.scss | 4 +- .../customer-preview.component.spec.ts | 25 +- .../customer-preview.component.ts | 25 +- .../customer-preview.module.ts | 12 +- .../graphic-identity-tab.component.html | 50 +- .../graphic-identity-tab.component.scss | 6 +- .../graphic-identity-tab.component.ts | 63 +- .../graphic-identity-update.component.html | 16 +- .../graphic-identity-update.component.scss | 8 +- .../graphic-identity-update.component.spec.ts | 32 +- .../graphic-identity-update.component.ts | 32 +- .../graphic-identity-form.component.scss | 42 +- .../graphic-identity.component.ts | 2 +- .../logos-safe-resource-url.interface.ts | 8 +- .../homepage-message-tab.component.html | 41 +- .../homepage-message-tab.component.ts | 13 +- .../homepage-message-update.component.html | 25 +- .../homepage-message-update.component.scss | 8 +- .../homepage-message-update.component.ts | 53 +- .../homepage-message-translation.html | 110 ++-- .../homepage-message-translation.scss | 4 +- .../homepage-message-translation.ts | 56 +- .../homepage-message.component.html | 70 ++- .../homepage-message.component.scss | 6 +- .../homepage-message.component.ts | 67 +- .../information-tab.component.html | 111 ++-- .../information-tab.component.spec.ts | 98 ++- .../information-tab.component.ts | 84 ++- ...identity-provider-create.component.spec.ts | 47 +- .../identity-provider-create.component.ts | 16 +- .../identity-provider-details.component.html | 19 +- .../identity-provider-details.component.scss | 4 +- .../identity-provider-details.component.ts | 6 +- .../sso-tab/identity-provider.service.ts | 164 +++-- .../sso-tab/provider-api.service.spec.ts | 14 +- .../sso-tab/provider-api.service.ts | 5 +- .../customer-preview/sso-tab/sso-tab-const.ts | 32 +- .../sso-tab/sso-tab.component.html | 51 +- .../sso-tab/sso-tab.component.scss | 114 ++-- .../sso-tab/sso-tab.component.spec.ts | 60 +- .../sso-tab/sso-tab.component.ts | 39 +- .../customer-resolver.service.spec.ts | 22 +- .../app/customer/customer-resolver.service.ts | 30 +- .../app/customer/customer-routing.module.ts | 18 +- .../src/app/customer/customer.component.html | 25 +- .../app/customer/customer.component.spec.ts | 46 +- .../src/app/customer/customer.component.ts | 36 +- .../src/app/customer/customer.data.service.ts | 4 +- .../src/app/customer/customer.module.ts | 21 +- .../app/customer/owner-api.service.spec.ts | 14 +- .../src/app/customer/owner-api.service.ts | 8 +- .../owner-create/owner-create.component.html | 34 +- .../owner-create.component.spec.ts | 54 +- .../owner-create/owner-create.component.ts | 34 +- .../owner-create/owner-create.module.ts | 10 +- .../owner-form/owner-form.component.html | 70 ++- .../owner-form/owner-form.component.spec.ts | 27 +- .../owner-form/owner-form.component.ts | 61 +- .../customer/owner-form/owner-form.module.ts | 12 +- .../owner-form/owner-form.validators.spec.ts | 6 +- .../owner-form/owner-form.validators.ts | 27 +- .../information-tab.component.html | 100 ++- .../information-tab.component.scss | 2 +- .../information-tab.component.spec.ts | 52 +- .../information-tab.component.ts | 6 +- ...owner-operation-history-tab.component.html | 4 +- ...er-operation-history-tab.component.spec.ts | 13 +- .../owner-operation-history-tab.component.ts | 17 +- .../owner-preview/owner-popup.component.ts | 14 +- .../owner-preview.component.html | 20 +- .../owner-preview.component.spec.ts | 12 +- .../owner-preview/owner-preview.component.ts | 23 +- .../owner-preview/owner-preview.module.ts | 6 +- .../customer/owner-resolver.service.spec.ts | 12 +- .../app/customer/owner-resolver.service.ts | 30 +- .../src/app/customer/owner.service.spec.ts | 40 +- .../src/app/customer/owner.service.ts | 74 +-- .../app/customer/tenant-api.service.spec.ts | 14 +- .../src/app/customer/tenant-api.service.ts | 8 +- .../tenant-create.component.html | 6 +- .../tenant-create.component.spec.ts | 35 +- .../tenant-create/tenant-create.component.ts | 23 +- .../tenant-create/tenant-create.module.ts | 11 +- .../tenant-form.validators.spec.ts | 6 +- .../tenant-create/tenant-form.validators.ts | 27 +- .../customer/tenant-resolver.service.spec.ts | 10 +- .../app/customer/tenant-resolver.service.ts | 30 +- .../src/app/customer/tenant.service.spec.ts | 69 +- .../src/app/customer/tenant.service.ts | 89 ++- ...ternal-param-profile-create.component.html | 3 +- ...external-param-profile-create.component.ts | 4 +- ...ternal-param-profile-detail.component.html | 12 +- ...nal-param-profile-detail.component.spec.ts | 65 +- ...external-param-profile-detail.component.ts | 31 +- .../information-tab.component.ts | 14 +- .../thresholds-tab.component.html | 15 +- .../thresholds-tab.component.ts | 41 +- ...ernal-param-profile-list.component.spec.ts | 72 +-- .../external-param-profile-list.component.ts | 2 +- .../external-param-profile-routing.module.ts | 16 +- .../external-param-profile.component.html | 5 +- .../external-param-profile.component.spec.ts | 42 +- .../external-param-profile.component.ts | 32 +- .../external-param-profile.module.ts | 2 +- .../external-param-profile.service.ts | 10 +- .../external-param-profile.validators.ts | 4 +- .../external-param-profile/shared.service.ts | 2 +- .../group-create/group-create.component.html | 132 ++-- .../group-create.component.spec.ts | 79 ++- .../group-create/group-create.component.ts | 30 +- .../group/group-create/group-create.module.ts | 8 +- .../group-list/group-criteria-builder.util.ts | 3 +- .../group-list/group-list.component.html | 79 ++- .../group-list/group-list.component.scss | 8 +- .../group-list/group-list.component.spec.ts | 63 +- .../group/group-list/group-list.component.ts | 43 +- .../app/group/group-list/group-list.module.ts | 19 +- .../group-preview/group-popup.component.ts | 7 +- .../group-preview.component.html | 14 +- .../group-preview/group-preview.component.ts | 29 +- .../group-preview/group-preview.module.ts | 6 +- .../information-tab.component.html | 78 ++- .../information-tab.component.spec.ts | 60 +- .../information-tab.component.ts | 35 +- .../units-edit/units-edit.component.html | 31 +- .../units-edit/units-edit.component.spec.ts | 32 +- .../units-edit/units-edit.component.ts | 50 +- .../profiles-edit.component.html | 25 +- .../profiles-edit.component.spec.ts | 35 +- .../profiles-edit/profiles-edit.component.ts | 17 +- .../profiles-tab/profiles-tab.component.html | 14 +- .../profiles-tab.component.spec.ts | 49 +- .../profiles-tab/profiles-tab.component.ts | 21 +- .../app/group/group-resolver.service.spec.ts | 11 +- .../src/app/group/group-resolver.service.ts | 30 +- .../src/app/group/group-routing.module.ts | 17 +- .../src/app/group/group.component.html | 6 +- .../src/app/group/group.component.spec.ts | 34 +- .../identity/src/app/group/group.component.ts | 19 +- .../identity/src/app/group/group.module.ts | 13 +- .../src/app/group/group.service.spec.ts | 278 ++++---- .../identity/src/app/group/group.service.ts | 93 ++- .../src/app/group/group.validators.spec.ts | 4 +- .../src/app/group/group.validators.ts | 51 +- .../units-form/units-form.component.html | 51 +- .../units-form/units-form.component.scss | 22 +- .../group/units-form/units-form.component.ts | 27 +- .../app/group/units-form/units-form.module.ts | 21 +- .../hierarchy-create.component.html | 29 +- .../hierarchy-create.component.spec.ts | 40 +- .../hierarchy-create.component.ts | 18 +- .../hierarchy-create.module.ts | 6 +- .../hierarchy-detail.component.html | 13 +- .../hierarchy-detail.component.spec.ts | 42 +- .../hierarchy-detail.component.ts | 25 +- .../hierarchy-detail.module.ts | 14 +- .../hierarchy-popup.component.ts | 7 +- .../information-tab.component.html | 60 +- .../information-tab.component.spec.ts | 58 +- .../information-tab.component.ts | 62 +- .../hierarchy-list.component.html | 33 +- .../hierarchy-list.component.spec.ts | 27 +- .../hierarchy-list.component.ts | 34 +- .../hierarchy-list/hierarchy-list.module.ts | 11 +- .../hierarchy/hierarchy-resolver.service.ts | 34 +- .../app/hierarchy/hierarchy-routing.module.ts | 18 +- .../app/hierarchy/hierarchy.component.html | 4 +- .../src/app/hierarchy/hierarchy.component.ts | 27 +- .../src/app/hierarchy/hierarchy.module.ts | 9 +- .../app/hierarchy/hierarchy.service.spec.ts | 5 +- .../src/app/hierarchy/hierarchy.service.ts | 66 +- .../src/app/hierarchy/profile.validators.ts | 28 +- .../profile-create.component.html | 119 ++-- .../profile-create.component.spec.ts | 17 +- .../profile-create.component.ts | 68 +- .../profile-create/profile-create.module.ts | 7 +- .../information-tab.component.html | 113 ++-- .../information-tab.component.ts | 51 +- .../profile-detail.component.html | 15 +- .../profile-detail.component.spec.ts | 37 +- .../profile-detail.component.ts | 8 +- .../profile-detail/profile-detail.module.ts | 4 +- .../profile-detail/profile-popup.component.ts | 7 +- .../profile-list/profile-list.component.html | 31 +- .../profile-list/profile-list.component.ts | 20 +- .../profile-list/profile-list.module.ts | 11 +- .../profile/profile-resolver.service.spec.ts | 17 +- .../app/profile/profile-resolver.service.ts | 34 +- .../src/app/profile/profile-routing.module.ts | 20 +- .../src/app/profile/profile.component.html | 11 +- .../src/app/profile/profile.component.ts | 18 +- .../src/app/profile/profile.module.ts | 7 +- .../src/app/profile/profile.service.spec.ts | 98 ++- .../src/app/profile/profile.service.ts | 96 +-- .../app/profile/profile.validators.spec.ts | 4 +- .../src/app/profile/profile.validators.ts | 28 +- .../custom-params.component.scss | 72 +-- .../custom-params/custom-params.component.ts | 8 +- .../custom-params/custom-params.module.ts | 13 +- .../domains-input.component.spec.ts | 33 +- .../domains-input/domains-input.component.ts | 19 +- .../domains-input/domains-input.module.ts | 11 +- .../editable-custom-params.component.html | 12 +- .../editable-domain-input.component.html | 41 +- .../editable-domain-input.component.spec.ts | 55 +- .../editable-domain-input.component.ts | 20 +- .../editable-field/editable-field.module.ts | 18 +- .../editable-keystore.component.html | 54 +- .../editable-keystore.component.scss | 12 +- .../editable-keystore.component.spec.ts | 33 +- .../editable-keystore.component.ts | 32 +- .../editable-patterns.component.html | 22 +- .../editable-patterns.component.spec.ts | 55 +- .../editable-patterns.component.ts | 12 +- .../app/shared/pattern/pattern.component.html | 12 +- .../app/shared/pattern/pattern.component.scss | 30 +- .../shared/pattern/pattern.component.spec.ts | 17 +- .../app/shared/pattern/pattern.component.ts | 16 +- .../src/app/shared/pattern/pattern.module.ts | 11 +- .../profiles-form/option-tree.interface.ts | 10 +- .../profiles-form.component.html | 69 +- .../profiles-form.component.spec.ts | 119 ++-- .../profiles-form/profiles-form.component.ts | 87 +-- .../profiles-form/profiles-form.module.ts | 13 +- .../identity/src/app/shared/shared.module.ts | 6 +- .../vitamui-snack-bar.service.ts | 75 +-- .../customer-select.service.spec.ts | 37 +- .../subrogation/customer-select.service.ts | 28 +- .../subrogate-user-list.component.html | 61 +- .../subrogate-user-list.component.scss | 31 +- .../subrogate-user-list.component.ts | 80 +-- .../subrogate-user.component.html | 8 +- .../subrogate-user.component.spec.ts | 9 +- .../subrogate-user.component.ts | 53 +- .../subrogation-resolver.service.spec.ts | 3 +- .../subrogation-resolver.service.ts | 29 +- .../subrogation/subrogation-routing.module.ts | 17 +- .../src/app/subrogation/subrogation.module.ts | 14 +- .../subrogation/subrogation.service.spec.ts | 7 +- .../app/subrogation/subrogation.service.ts | 20 +- .../user-generic-api.service.spec.ts | 14 +- .../subrogation/user-generic-api.service.ts | 4 +- .../group-attribution.component.html | 8 +- .../group-attribution.component.ts | 33 +- .../group-attribution.module.ts | 27 +- .../group-detail/group-detail.component.html | 19 +- .../group-detail/group-detail.component.ts | 11 +- .../group-list/group-list.component.html | 35 +- .../group-list/group-list.component.ts | 2 +- .../user/user-create/user-create.component.ts | 162 ++--- .../user/user-create/user-create.module.ts | 8 +- .../user-create/user-create.validators.ts | 17 +- .../src/app/user/user-info.service.ts | 20 +- .../user-list/user-criteria-builder.util.ts | 8 +- .../user/user-list/user-list.component.html | 143 +++-- .../user/user-list/user-list.component.scss | 8 +- .../app/user/user-list/user-list.component.ts | 118 ++-- .../app/user/user-list/user-list.module.ts | 19 +- .../user-group-tab.component.html | 39 +- .../user-group-tab.component.ts | 70 ++- .../user-information-tab.component.html | 156 +++-- .../user-information-tab.component.scss | 23 +- .../user-information-tab.component.spec.ts | 189 +++--- .../user-information-tab.component.ts | 6 +- .../user/user-preview/user-popup.component.ts | 14 +- .../user-preview/user-preview.component.html | 83 ++- .../user-preview/user-preview.component.ts | 31 +- .../user/user-preview/user-preview.module.ts | 11 +- .../src/app/user/user-resolver.service.ts | 30 +- .../src/app/user/user-routing.module.ts | 18 +- .../identity/src/app/user/user.component.html | 18 +- .../identity/src/app/user/user.component.ts | 33 +- .../identity/src/app/user/user.module.ts | 15 +- .../src/app/user/user.service.spec.ts | 8 +- .../identity/src/app/user/user.service.ts | 14 +- .../src/app/user/user.validators.spec.ts | 65 +- .../identity/src/app/user/user.validators.ts | 5 +- .../projects/identity/src/assets/i18n/en.json | 6 +- .../projects/identity/src/assets/i18n/fr.json | 6 +- .../src/environments/environment.prod.ts | 2 +- .../identity/src/environments/environment.ts | 2 +- .../projects/identity/src/index.html | 43 +- ui/ui-frontend/projects/identity/src/main.ts | 3 +- .../projects/identity/src/polyfills.ts | 6 +- .../projects/identity/src/sass/_form.scss | 8 +- .../identity/src/sass/_profile-tag.scss | 30 +- .../projects/identity/src/sass/_tooltip.scss | 74 +-- .../identity/src/sass/_vitamui-tab-group.scss | 92 +-- .../projects/identity/src/sass/login.scss | 234 +++---- ui/ui-frontend/projects/identity/src/test.ts | 10 +- .../ingest/src/app/app.component.scss | 2 +- .../ingest/src/app/app.component.spec.ts | 17 +- .../projects/ingest/src/app/app.component.ts | 7 +- .../projects/ingest/src/app/app.module.ts | 52 +- .../app/core/api/ingest-api.service.spec.ts | 20 +- .../src/app/core/api/ingest-api.service.ts | 22 +- .../ingest/src/app/core/common/ingest-list.ts | 8 +- .../src/app/core/common/upload.component.html | 8 +- .../src/app/core/common/upload.component.scss | 233 ++++--- .../app/core/common/upload.component.spec.ts | 4 +- .../src/app/core/common/upload.component.ts | 37 +- .../src/app/core/common/upload.module.ts | 10 +- .../src/app/core/common/upload.service.ts | 23 +- .../ingest/src/app/core/core.module.ts | 13 +- .../holding-filling-scheme-routing.module.ts | 22 +- .../holding-filling-scheme.component.spec.ts | 63 +- .../holding-filling-scheme.component.ts | 28 +- .../ingest-list/ingest-list.component.html | 26 +- .../ingest-list/ingest-list.component.scss | 40 +- .../ingest-list/ingest-list.component.ts | 21 +- .../ingest/ingest-list/ingest-list.module.ts | 13 +- .../event-display-helper.service.ts | 22 +- ...ngest-errors-details-tab.component.spec.ts | 18 +- .../ingest-errors-details-tab.component.ts | 23 +- .../event-display.component.html | 2 +- .../event-display.component.scss | 27 +- .../event-display.component.spec.ts | 17 +- .../event-display/event-display.component.ts | 7 +- .../ingest-event-detail.component.html | 5 +- .../ingest-event-detail.component.scss | 2 +- .../ingest-event-detail.component.spec.ts | 46 +- .../ingest-event-detail.component.ts | 32 +- .../ingest-information-tab.component.html | 34 +- .../ingest-information-tab.component.scss | 8 +- .../ingest-information-tab.component.spec.ts | 12 +- .../ingest-information-tab.component.ts | 16 +- .../ingest-preview.component.html | 23 +- .../ingest-preview.component.scss | 2 +- .../ingest-preview.component.spec.ts | 47 +- .../ingest-preview.component.ts | 51 +- .../ingest-preview/ingest-preview.module.ts | 26 +- .../src/app/ingest/ingest-routing.module.ts | 23 +- .../src/app/ingest/ingest.component.html | 37 +- .../src/app/ingest/ingest.component.spec.ts | 73 +-- .../ingest/src/app/ingest/ingest.component.ts | 34 +- .../ingest/src/app/ingest/ingest.service.ts | 19 +- .../src/app/models/logbook-event.interface.ts | 24 +- .../ingest/src/app/shared/shared.module.ts | 11 +- .../upload-tracking.component.html | 2 +- .../upload-tracking.component.scss | 32 +- .../upload-tracking.component.spec.ts | 2 +- .../upload-tracking/upload-tracking.module.ts | 1 - .../vitamui-snack-bar.component.html | 11 +- .../vitamui-snack-bar.component.scss | 18 +- .../vitamui-snack-bar.component.spec.ts | 7 +- .../vitamui-snack-bar.component.ts | 9 +- .../vitamui-snack-bar.module.ts | 10 +- .../vitamui-snack-bar.service.ts | 82 ++- .../src/environments/environment.prod.ts | 2 +- .../ingest/src/environments/environment.ts | 2 +- ui/ui-frontend/projects/ingest/src/index.html | 39 +- ui/ui-frontend/projects/ingest/src/main.ts | 3 +- .../projects/ingest/src/polyfills.ts | 6 +- .../projects/ingest/src/sass/_filter.scss | 2 +- .../projects/ingest/src/sass/_form.scss | 8 +- .../ingest/src/sass/_material-theme.scss | 64 +- .../ingest/src/sass/_profile-tag.scss | 30 +- .../ingest/src/sass/_vitamui-tab-group.scss | 92 +-- .../projects/ingest/src/sass/login.scss | 232 ++++--- ui/ui-frontend/projects/ingest/src/test.ts | 10 +- .../projects/pastis/e2e/src/app.e2e-spec.ts | 8 +- .../pastis/src/app/app-routing.module.ts | 80 +-- .../pastis/src/app/app.component.html | 8 +- .../pastis/src/app/app.component.scss | 17 +- .../pastis/src/app/app.component.spec.ts | 18 +- .../projects/pastis/src/app/app.component.ts | 5 +- .../src/app/core/api/api.pastis.service.ts | 19 +- .../app/core/classes/pastis-configuration.ts | 35 +- .../pastis/src/app/core/core.module.ts | 64 +- .../archival-profile-unit-api.service.ts | 14 +- .../services/archive-profile-api.service.ts | 26 +- .../src/app/core/services/file.service.ts | 53 +- .../src/app/core/services/notice.service.ts | 13 +- .../app/core/services/notification.service.ts | 15 +- .../src/app/core/services/popup.service.ts | 5 +- .../src/app/core/services/profile.service.ts | 41 +- .../src/app/core/services/seda.service.ts | 37 +- .../core/services/toggle-sidenav.service.ts | 39 +- .../projects/pastis/src/app/json-typings.d.ts | 8 +- .../pastis/src/app/main/main.component.html | 33 +- .../pastis/src/app/main/main.component.scss | 41 +- .../pastis/src/app/main/main.component.ts | 51 +- .../pastis/src/app/material.module.ts | 8 +- .../src/app/models/archival-profile-unit.ts | 2 +- .../pastis/src/app/models/breadcrumb.ts | 10 +- .../src/app/models/edit-attribute-models.ts | 20 +- .../pastis/src/app/models/file-node.ts | 30 +- .../src/app/models/metadata-validator.ts | 11 +- .../projects/pastis/src/app/models/models.ts | 26 +- .../src/app/models/profile-common-models.ts | 2 +- .../app/models/profile-description.model.ts | 6 +- .../pastis/src/app/models/profile-response.ts | 1 - .../projects/pastis/src/app/models/profile.ts | 2 +- .../pastis/src/app/models/pua-data.ts | 1 - .../src/app/models/pua-definitions.model.ts | 99 ++- .../pastis/src/app/models/pua.model.ts | 14 +- .../src/app/models/pua.propreties.model.ts | 8 +- .../pastis/src/app/models/seda-data.ts | 56 +- .../vitam-ui-exception-response.model.ts | 12 +- .../src/app/pastis/pastis-routing.module.ts | 111 ++-- .../pastis/src/app/pastis/pastis.module.ts | 18 +- .../create-notice-choice.component.html | 25 +- .../create-notice-choice.component.scss | 17 +- .../create-notice-choice.component.ts | 31 +- .../create-profile.component.html | 42 +- .../create-profile.component.scss | 17 +- .../create-profile.component.ts | 22 +- .../edit-profile/edit-profile.component.html | 84 +-- .../edit-profile/edit-profile.component.scss | 142 ++--- .../edit-profile/edit-profile.component.ts | 47 +- .../attributes/attributes.component.html | 62 +- .../attributes/attributes.component.scss | 19 +- .../attributes/attributes.component.ts | 117 ++-- .../center-matmenu.directive.ts | 26 +- .../file-tree-metadata.component.html | 485 ++++++++------ .../file-tree-metadata.component.scss | 128 ++-- .../file-tree-metadata.component.ts | 21 +- .../file-tree-metadata.service.ts | 44 +- .../file-tree/file-tree.component.html | 118 ++-- .../file-tree/file-tree.component.scss | 48 +- .../file-tree/file-tree.component.ts | 12 +- .../file-tree/file-tree.module.ts | 54 +- .../file-tree/file-tree.service.ts | 4 +- .../file-tree/pipes/file-tree-filter.pipe.ts | 4 +- .../list-profile/list-profile.component.html | 195 +++--- .../list-profile/list-profile.component.scss | 160 +++-- .../list-profile/list-profile.component.ts | 88 ++- .../pipes/filterByStringName.pipe.ts | 17 +- .../list-profile/pipes/filterByType.pipe.ts | 18 +- .../profile-information-tab.component.html | 14 +- .../profile-information-tab.component.scss | 1 - .../profile-information-tab.component.ts | 11 +- .../profile-preview.component.html | 19 +- .../profile-preview.component.scss | 4 +- .../profile-preview.component.ts | 31 +- .../profile-preview/profile-preview.module.ts | 80 ++- .../pastis/src/app/profile/profile.module.ts | 71 ++- .../seda-visualizer.component.html | 23 +- .../seda-visualizer.component.scss | 8 +- .../seda-visualizer.component.ts | 522 +++++++++------ .../shared/data-generique-popup.service.ts | 7 +- .../modify-text-button.component.html | 32 +- .../modify-text-button.component.ts | 7 +- .../pastis-breadcrumb.component.html | 2 +- .../pastis-breadcrumb.component.scss | 28 +- .../pastis-breadcrumb.component.ts | 15 +- .../pastis-title-breadcrumb.component.html | 5 +- .../pastis-title-breadcrumb.component.scss | 8 +- .../pastis-title-breadcrumb.component.ts | 12 +- .../classes/pastis-dialog-data.ts | 22 +- .../pastis-dialog-confirm.component.html | 39 +- .../pastis-dialog-confirm.component.scss | 4 +- .../pastis-dialog-confirm.component.ts | 24 +- .../pastis-generic-popup.component.html | 29 +- .../pastis-generic-popup.component.scss | 32 +- .../pastis-generic-popup.component.spec.ts | 10 +- .../pastis-generic-popup.component.ts | 20 +- .../pastis-popup-selection.service.ts | 5 +- ...tis-popup-metadata-language.component.html | 13 +- ...tis-popup-metadata-language.component.scss | 27 +- ...-popup-metadata-language.component.spec.ts | 11 +- ...astis-popup-metadata-language.component.ts | 7 +- .../pastis-popup-metadata-language.service.ts | 4 +- .../pastis-popup-option.component.html | 55 +- .../pastis-popup-option.component.scss | 10 +- .../pastis-popup-option.component.spec.ts | 14 +- .../pastis-popup-option.component.ts | 52 +- .../pastis-under-construction.component.html | 13 +- .../pastis-under-construction.component.scss | 39 +- ...astis-under-construction.component.spec.ts | 5 +- .../pastis-under-construction.component.ts | 9 +- .../pastis/src/app/shared/shared.module.ts | 35 +- .../add-metadata/add-metadata.component.html | 74 ++- .../add-metadata/add-metadata.component.scss | 185 +++--- .../add-metadata/add-metadata.component.ts | 62 +- .../add-pua-control.component.html | 47 +- .../add-pua-control.component.scss | 3 +- .../add-pua-control.component.ts | 53 +- ...allow-additional-properties.component.html | 10 +- ...allow-additional-properties.component.scss | 8 +- ...ow-additional-properties.component.spec.ts | 5 +- .../allow-additional-properties.component.ts | 33 +- .../create-notice.component.html | 66 +- .../create-notice.component.scss | 12 +- .../create-notice.component.spec.ts | 11 +- .../create-notice/create-notice.component.ts | 95 ++- .../download-doc/download-doc.component.scss | 32 +- .../download-doc.component.spec.ts | 5 +- .../download-doc/download-doc.component.ts | 9 +- .../duplicate-metadata.component.ts | 18 +- .../remove-metadata.component.ts | 11 +- .../save-profile-options.component.html | 31 +- .../save-profile-options.component.scss | 8 +- .../save-profile-options.component.spec.ts | 14 +- .../save-profile-options.component.ts | 38 +- .../save-profile/save-profile.component.scss | 38 +- .../save-profile/save-profile.component.ts | 262 ++++---- .../select-notice.component.html | 70 ++- .../select-notice.component.scss | 11 +- .../select-notice/select-notice.component.ts | 27 +- .../upload-profile.component.html | 16 +- .../upload-profile.component.scss | 45 +- .../upload-profile.component.spec.ts | 13 +- .../upload-profile.component.ts | 17 +- .../app/user-actions/user-actions.module.ts | 67 +- .../src/assets/config/config-standalone.json | 2 - .../src/assets/config/config-vitam-ui.json | 6 +- .../pastis/src/assets/css/_buttons.scss | 268 ++++---- .../pastis/src/assets/css/_colors.scss | 66 +- .../pastis/src/assets/css/_dropdown.scss | 233 ++++--- .../projects/pastis/src/assets/css/_font.scss | 592 +++++++++-------- .../pastis/src/assets/css/_input.scss | 53 +- .../pastis/src/assets/css/_layout.scss | 140 ++--- .../pastis/src/assets/css/_mixins.scss | 102 ++- .../pastis/src/assets/css/_toaster.scss | 9 +- .../pastis/src/assets/css/_variables.scss | 5 +- .../pastis/src/assets/i18n-old/fr.json | 6 - .../projects/pastis/src/assets/i18n/en.json | 20 +- .../projects/pastis/src/assets/i18n/fr.json | 18 +- .../pastis/src/assets/json/AUP_OK_VITAM.json | 29 +- .../projects/pastis/src/assets/seda.json | 130 +--- .../pastis/src/assets/seda_lower.json | 50 +- .../pastis/src/environments/IEnvironment.ts | 6 +- .../src/environments/environment.prod.ts | 4 +- .../src/environments/environment.rec.ts | 2 +- .../environments/environment.standalone.ts | 2 +- .../pastis/src/environments/environment.ts | 4 +- ui/ui-frontend/projects/pastis/src/index.html | 39 +- ui/ui-frontend/projects/pastis/src/main.ts | 5 +- .../projects/pastis/src/polyfills.ts | 2 +- .../projects/pastis/src/sass/_buttons.scss | 268 ++++---- .../projects/pastis/src/sass/_colors.scss | 66 +- .../projects/pastis/src/sass/_dropdown.scss | 233 ++++--- .../projects/pastis/src/sass/_font.scss | 594 +++++++++--------- .../projects/pastis/src/sass/_input.scss | 53 +- .../projects/pastis/src/sass/_layout.scss | 144 ++--- .../projects/pastis/src/sass/_mixins.scss | 102 ++- .../projects/pastis/src/sass/_toaster.scss | 9 +- .../projects/pastis/src/sass/_variables.scss | 5 +- .../projects/pastis/src/sass/login.scss | 234 +++---- .../projects/pastis/src/sass/styles.scss | 7 +- ui/ui-frontend/projects/pastis/src/test.ts | 10 +- .../portal/src/app/app-routing.module.ts | 15 +- .../portal/src/app/app.component.html | 12 +- .../portal/src/app/app.component.scss | 18 +- .../portal/src/app/app.component.spec.ts | 23 +- .../projects/portal/src/app/app.component.ts | 6 +- .../portal/src/app/application-svg-loader.ts | 43 +- .../application-list.component.html | 12 +- .../application-list.component.scss | 117 ++-- .../application-list.component.ts | 8 +- .../application-list.module.ts | 12 +- .../welcome-message.component.html | 18 +- .../welcome-message.component.scss | 8 +- .../welcome-message.component.ts | 9 +- .../welcome-message/welcome-message.module.ts | 10 +- .../src/app/portal/portal.component.html | 6 +- .../portal/src/app/portal/portal.component.ts | 92 +-- .../portal/src/app/portal/portal.module.ts | 6 +- .../projects/portal/src/assets/i18n/en.json | 18 +- .../projects/portal/src/assets/i18n/fr.json | 18 +- .../src/environments/environment.prod.ts | 2 +- .../portal/src/environments/environment.ts | 2 +- ui/ui-frontend/projects/portal/src/index.html | 45 +- ui/ui-frontend/projects/portal/src/main.ts | 3 +- .../projects/portal/src/polyfills.ts | 6 +- .../projects/portal/src/sass/login.scss | 234 +++---- .../portal/src/sass/material-custom.scss | 24 +- .../src/sass/theming/_application-icons.scss | 56 +- ui/ui-frontend/projects/portal/src/test.ts | 10 +- .../referential/e2e/src/app.e2e-spec.ts | 8 +- .../access-contract-create.component.scss | 175 +++--- .../access-contract-create.component.spec.ts | 85 ++- .../access-contract-create.component.ts | 6 +- .../access-contract-create.module.ts | 39 +- .../access-contract-create.validators.ts | 4 +- .../access-contract-list.component.html | 170 ++--- .../access-contract-list.component.spec.ts | 33 +- .../access-contract-list.component.ts | 2 +- ...contract-information-tab.component.spec.ts | 21 +- ...cess-contract-information-tab.component.ts | 6 +- .../access-contract-nodes-tab.component.html | 8 +- .../access-contract-nodes-tab.component.scss | 4 +- ...ccess-contract-nodes-tab.component.spec.ts | 42 +- .../access-contract-nodes-tab.component.ts | 4 +- ...access-contract-node-update.component.html | 22 +- ...access-contract-node-update.component.scss | 116 ++-- ...ess-contract-node-update.component.spec.ts | 81 ++- .../access-contract-node-update.component.ts | 4 +- .../access-contract-preview.component.html | 100 +-- .../access-contract-preview.component.ts | 5 +- .../access-contract-preview.module.ts | 56 +- ...ract-usage-and-services-tab.component.html | 104 +-- ...ntract-usage-and-services-tab.component.ts | 8 +- ...s-contract-write-access-tab.component.html | 35 +- ...ontract-write-access-tab.component.spec.ts | 21 +- ...ess-contract-write-access-tab.component.ts | 11 +- .../access-contract-routing.module.ts | 29 +- .../access-contract.component.html | 30 +- .../access-contract.component.spec.ts | 42 +- .../access-contract.component.ts | 2 +- .../access-contract/access-contract.module.ts | 46 +- .../access-contract.service.ts | 14 +- ...on-register-advanced-search.component.html | 55 +- ...on-register-advanced-search.component.scss | 3 +- ...sion-register-advanced-search.component.ts | 4 +- .../accession-register-facets.component.html | 20 +- .../accession-register-facets.component.ts | 2 +- .../accession-register-list.component.html | 20 +- .../accession-register-list.component.scss | 1 - .../accession-register-list.component.spec.ts | 74 +-- .../accession-register-list.component.ts | 13 +- .../accession-register-detail.component.html | 34 +- .../accession-register-detail.component.scss | 2 - .../accession-register-detail.component.ts | 29 +- ...ccession-register-operation.component.html | 10 +- .../accession-register-operation.component.ts | 15 +- ...on-register-operations-list.component.html | 32 +- ...on-register-operations-list.component.scss | 1 - ...register-operations-list.component.spec.ts | 66 +- ...-operations-list.component.statics.spec.ts | 10 +- ...sion-register-operations-list.component.ts | 42 +- .../accession-register-preview.component.html | 15 +- .../accession-register-preview.component.scss | 3 - ...cession-register-preview.component.spec.ts | 150 ++--- .../accession-register-preview.component.ts | 9 +- .../accession-register.component.html | 30 +- .../accession-register.component.scss | 2 +- .../accession-register.component.ts | 17 +- .../accession-register.module.ts | 14 +- .../accession-register.service.ts | 10 +- .../app/admin-dsl/admin-dsl-routing.module.ts | 29 +- .../app/admin-dsl/admin-dsl.component.scss | 22 +- .../src/app/admin-dsl/admin-dsl.component.ts | 4 +- .../src/app/admin-dsl/admin-dsl.module.ts | 41 +- .../src/app/admin-dsl/admin-dsl.service.ts | 30 +- .../agency-create.component.html | 4 +- .../agency-create.component.scss | 167 +++-- .../agency-create.component.spec.ts | 77 ++- .../agency-create/agency-create.component.ts | 6 +- .../agency-create/agency-create.module.ts | 37 +- .../agency-create/agency-create.validators.ts | 23 +- .../agency-list/agency-list.component.html | 30 +- .../agency-list/agency-list.component.spec.ts | 48 +- .../agency-list/agency-list.component.ts | 6 +- .../agency-information-tab.component.html | 28 +- .../agency-information-tab.component.spec.ts | 7 +- .../agency-information-tab.component.ts | 6 +- .../agency-preview.component.html | 58 +- .../agency-preview.component.spec.ts | 30 +- .../agency-preview.component.ts | 5 +- .../agency-preview/agency-preview.module.ts | 47 +- .../src/app/agency/agency-routing.module.ts | 30 +- .../src/app/agency/agency.component.html | 41 +- .../src/app/agency/agency.component.spec.ts | 19 +- .../src/app/agency/agency.component.ts | 2 +- .../src/app/agency/agency.module.ts | 43 +- .../src/app/agency/agency.service.ts | 20 +- .../referential/src/app/app-routing.module.ts | 2 +- .../referential/src/app/app.component.spec.ts | 22 +- .../referential/src/app/app.component.ts | 4 +- .../referential/src/app/app.module.ts | 2 +- .../audit-create/audit-create-validator.ts | 45 +- .../audit-create/audit-create.component.html | 35 +- .../audit-create/audit-create.component.scss | 6 +- .../audit-create.component.spec.ts | 7 +- .../audit-create/audit-create.component.ts | 103 ++- .../audit/audit-create/audit-create.module.ts | 36 +- .../audit/audit-list/audit-list.component.ts | 27 +- .../app/audit/audit-list/audit-list.module.ts | 24 +- .../audit-information-tab.component.scss | 2 +- .../audit-information-tab.component.ts | 20 +- .../audit-preview.component.html | 53 +- .../audit-preview.component.scss | 2 +- .../audit-preview.component.spec.ts | 27 +- .../audit-preview/audit-preview.component.ts | 24 +- .../audit-preview/audit-preview.module.ts | 42 +- .../src/app/audit/audit-routing.module.ts | 29 +- .../src/app/audit/audit.component.html | 158 +++-- .../src/app/audit/audit.component.scss | 2 +- .../src/app/audit/audit.component.spec.ts | 60 +- .../src/app/audit/audit.component.ts | 51 +- .../referential/src/app/audit/audit.module.ts | 46 +- .../src/app/audit/audit.service.ts | 30 +- .../context-create.component.html | 140 +++-- .../context-create.component.scss | 169 +++-- .../context-create.component.spec.ts | 111 ++-- .../context-create.component.ts | 4 +- .../context-create/context-create.module.ts | 43 +- .../context-create.validators.ts | 2 +- .../context-edit-permission.component.scss | 4 +- .../context-edit-permission.component.ts | 6 +- .../context-edit-permission.module.ts | 37 +- .../context-edit/context-edit.component.html | 82 ++- .../context-edit/context-edit.component.scss | 28 +- .../context-edit/context-edit.component.ts | 4 +- .../context-edit/context-edit.module.ts | 41 +- .../context-list/context-list.component.ts | 5 +- .../context-information-tab.component.html | 47 +- .../context-information-tab.component.spec.ts | 34 +- .../context-information-tab.component.ts | 6 +- .../context-permission-tab.component.html | 5 +- .../context-permission-tab.component.scss | 1 - .../context-permission-tab.component.ts | 14 +- .../context-preview.component.html | 60 +- .../context-preview.component.ts | 5 +- .../context-preview/context-preview.module.ts | 51 +- .../src/app/context/context-routing.module.ts | 23 +- .../src/app/context/context.component.html | 12 +- .../src/app/context/context.component.spec.ts | 42 +- .../src/app/context/context.component.ts | 2 +- .../src/app/context/context.module.ts | 43 +- .../src/app/context/context.service.ts | 14 +- .../api/access-contract-api.service.spec.ts | 30 +- .../accession-register-detail-api.service.ts | 14 +- .../app/core/api/agency-api.service.spec.ts | 30 +- .../core/api/archive-profile-api.service.ts | 9 +- .../app/core/api/context-api.service.spec.ts | 30 +- .../app/core/api/customer-api.service.spec.ts | 13 +- .../src/app/core/api/customer-api.service.ts | 3 +- .../app/core/api/file-format-api.service.ts | 26 +- .../api/ingest-contract-api.service.spec.ts | 30 +- ...k-management-operation-api.service.spec.ts | 14 +- .../api/management-contract-api.service.ts | 9 +- .../app/core/api/ontology-api.service.spec.ts | 30 +- .../src/app/core/api/ontology-api.service.ts | 28 +- .../core/api/operation-api.service.spec.ts | 31 +- .../src/app/core/api/operation-api.service.ts | 20 +- .../referential-import-api.service.spec.ts | 31 +- .../api/referential-import-api.service.ts | 17 +- .../api/security-profile-api.service.spec.ts | 30 +- .../app/core/api/tenant-api.service.spec.ts | 8 +- .../src/app/core/api/tenant-api.service.ts | 3 +- .../src/app/core/core.module.spec.ts | 2 +- .../referential/src/app/core/core.module.ts | 30 +- .../file-format-create.component.scss | 161 +++-- .../file-format-create.component.spec.ts | 60 +- .../file-format-create.component.ts | 4 +- .../file-format-create.module.ts | 39 +- .../file-format-create.validators.spec.ts | 34 +- .../file-format-create.validators.ts | 23 +- .../file-format-list.component.html | 14 +- .../file-format-list.component.spec.ts | 29 +- .../file-format-list.component.ts | 71 +-- ...file-format-information-tab.component.html | 68 +- .../file-format-information-tab.component.ts | 82 +-- .../file-format-preview.component.html | 59 +- .../file-format-preview.component.spec.ts | 17 +- .../file-format-preview.component.ts | 46 +- .../file-format-preview.module.ts | 47 +- .../file-format/file-format.component.html | 20 +- .../app/file-format/file-format.component.ts | 55 +- .../src/app/file-format/file-format.module.ts | 43 +- .../app/file-format/file-format.service.ts | 75 ++- .../ingest-contract-create.component.html | 129 ++-- .../ingest-contract-create.component.spec.ts | 86 ++- .../ingest-contract-create.component.ts | 6 +- .../ingest-contract-create.validators.ts | 4 +- .../ingest-contract-list.component.spec.ts | 28 +- .../ingest-contract-list.component.ts | 2 +- ...-contract-attachment-tab.component.spec.ts | 73 ++- ...ngest-contract-attachment-tab.component.ts | 4 +- ...est-contract-node-update.component.spec.ts | 56 +- .../ingest-contract-node-update.component.ts | 8 +- ...gest-contract-format-tab.component.spec.ts | 61 +- .../ingest-contract-format-tab.component.ts | 8 +- .../ingest-contract-heritage-tab.component.ts | 11 +- ...gest-contract-information-tab.component.ts | 6 +- .../ingest-contract-object-tab.component.ts | 11 +- .../ingest-contract-preview.component.html | 14 +- .../ingest-contract-preview.component.spec.ts | 22 +- .../ingest-contract-preview.component.ts | 5 +- .../ingest-contract.component.html | 11 +- .../ingest-contract.component.ts | 4 +- .../ingest-contract.service.ts | 14 +- ...k-management-operation-list.component.html | 8 +- ...k-management-operation-list.component.scss | 4 +- ...ook-management-operation-list.component.ts | 9 +- ...peration-information-tab.component.spec.ts | 38 +- ...-management-operation-preview.component.ts | 14 +- ...ogbook-management-operation.component.scss | 8 +- .../logbook-management-operation.component.ts | 6 +- .../logbook-management-operation.service.ts | 16 +- .../event-filter.interface.ts | 2 +- .../logbook-download.service.ts | 21 +- .../logbook-operation-constants.ts | 2 +- .../logbook-operation-detail.component.html | 19 +- .../logbook-operation-detail.component.scss | 60 +- .../logbook-operation-detail.component.ts | 6 +- .../logbook-operation-popup.component.ts | 7 +- .../event-type-badge-class.pipe.ts | 6 +- .../event-type-color-class.pipe.ts | 6 +- .../logbook-operation-list/last-event.pipe.ts | 6 +- .../logbook-operation-list.component.ts | 9 +- .../logbook-operation-routing.module.ts | 20 +- .../logbook-operation.component.spec.ts | 36 +- .../logbook-operation.component.ts | 31 +- .../logbook-search.service.spec.ts | 16 +- .../logbook-search.service.ts | 22 +- .../management-contract-create.component.ts | 4 +- .../management-contract-list.component.html | 8 +- .../management-contract-list.component.ts | 4 +- ...nt-contract-information-tab.component.html | 8 +- ...ment-contract-information-tab.component.ts | 9 +- ...management-contract-preview.component.html | 2 +- ...nagement-contract-storage-tab.component.ts | 9 +- .../management-contract.component.ts | 4 +- .../management-contract.service.ts | 10 +- .../management-contract-create.validators.ts | 2 +- ...accession-register-export-csv.interface.ts | 20 +- .../ontology-create.component.scss | 167 +++-- .../ontology-create.component.ts | 4 +- .../ontology-create/ontology-create.module.ts | 37 +- .../ontology-create.validators.ts | 33 +- .../ontology-list.component.spec.ts | 26 +- .../ontology-list/ontology-list.component.ts | 57 +- .../ontology-information-tab.component.html | 93 +-- ...ontology-information-tab.component.spec.ts | 56 +- .../ontology-information-tab.component.ts | 124 ++-- .../ontology-preview.component.html | 59 +- .../ontology-preview.component.spec.ts | 17 +- .../ontology-preview.component.ts | 42 +- .../ontology-preview.module.ts | 47 +- .../app/ontology/ontology-routing.module.ts | 23 +- .../src/app/ontology/ontology.component.html | 21 +- .../app/ontology/ontology.component.spec.ts | 36 +- .../src/app/ontology/ontology.component.ts | 45 +- .../src/app/ontology/ontology.module.ts | 43 +- .../src/app/ontology/ontology.service.ts | 81 +-- .../probative-value-create.component.scss | 2 +- .../probative-value-create.component.spec.ts | 41 +- .../probative-value-create.component.ts | 6 +- .../probative-value-create.module.ts | 33 +- .../probative-value-list.component.html | 104 +-- .../probative-value-list.component.spec.ts | 19 +- .../probative-value-list.component.ts | 48 +- .../probative-value-list.module.ts | 23 +- .../probative-value-preview.component.scss | 2 +- .../probative-value-preview.component.spec.ts | 63 +- .../probative-value-preview.component.ts | 4 +- .../probative-value-preview.module.ts | 38 +- .../probative-value-routing.module.ts | 29 +- .../probative-value.component.scss | 2 +- .../probative-value.component.spec.ts | 56 +- .../probative-value.component.ts | 2 +- .../probative-value/probative-value.module.ts | 46 +- .../probative-value.service.ts | 18 +- .../rule/rule-create/rule-create.component.ts | 4 +- .../rule/rule-create/rule-create.module.ts | 39 +- .../rule-create.validators.spec.ts | 26 +- .../rule-create/rule-create.validators.ts | 2 +- .../rule/rule-list/rule-list.component.html | 14 +- .../rule-list/rule-list.component.spec.ts | 28 +- .../app/rule/rule-list/rule-list.component.ts | 2 +- .../rule-information-tab.component.ts | 8 +- .../rule-preview.component.spec.ts | 19 +- .../rule-preview/rule-preview.component.ts | 7 +- .../rule/rule-preview/rule-preview.module.ts | 31 +- .../src/app/rule/rule-routing.module.ts | 29 +- .../src/app/rule/rule.component.html | 127 ++-- .../src/app/rule/rule.component.ts | 2 +- .../referential/src/app/rule/rule.module.ts | 35 +- .../referential/src/app/rule/rule.service.ts | 28 +- .../securisation-list.component.html | 131 ++-- .../securisation-list.component.spec.ts | 21 +- .../securisation-list.component.ts | 38 +- .../securisation-list.module.ts | 24 +- .../securisation-check-tab.component.html | 35 +- .../securisation-check-tab.component.scss | 1 - .../securisation-check-tab.component.spec.ts | 73 +-- .../securisation-check-tab.component.ts | 2 +- ...ecurisation-information-tab.component.html | 90 +-- ...ecurisation-information-tab.component.scss | 2 +- .../securisation-information-tab.component.ts | 17 +- .../securisation-preview.component.html | 85 +-- .../securisation-preview.component.scss | 6 +- .../securisation-preview.component.spec.ts | 83 ++- .../securisation-preview.component.ts | 27 +- .../securisation-preview.module.ts | 43 +- .../securisation-routing.module.ts | 30 +- .../securisation/securisation.component.html | 149 +++-- .../securisation/securisation.component.scss | 2 +- .../securisation.component.spec.ts | 41 +- .../securisation/securisation.component.ts | 47 +- .../app/securisation/securisation.module.ts | 43 +- .../app/securisation/securisation.service.ts | 29 +- .../permission.utils.ts | 506 +++++++-------- .../security-profile-create.component.scss | 167 +++-- .../security-profile-create.component.spec.ts | 105 ++-- .../security-profile-create.component.ts | 4 +- .../security-profile-create.module.ts | 41 +- ...security-profile-create.validators.spec.ts | 24 +- .../security-profile-create.validators.ts | 2 +- ...ity-profile-edit-permission.component.html | 96 +-- ...urity-profile-edit-permission.component.ts | 24 +- ...security-profile-edit-permission.module.ts | 37 +- .../security-profile-list.component.ts | 5 +- ...ity-profile-information-tab.component.html | 22 +- ...urity-profile-information-tab.component.ts | 11 +- ...urity-profile-permissions-tab.component.ts | 8 +- .../security-profile-preview.component.html | 69 +- ...security-profile-preview.component.spec.ts | 17 +- .../security-profile-preview.component.ts | 5 +- .../security-profile-preview.module.ts | 53 +- .../security-profile-routing.module.ts | 23 +- .../security-profile.component.html | 20 +- .../security-profile.component.spec.ts | 44 +- .../security-profile.component.ts | 2 +- .../security-profile.module.ts | 41 +- .../security-profile.service.ts | 14 +- .../src/app/shared/shared.module.spec.ts | 2 +- .../src/app/shared/shared.module.ts | 19 +- .../referential-import.service.ts | 13 +- .../vitamui-import-dialog/referential.enum.ts | 8 +- .../vitamui-import-dialog.component.html | 144 ++--- .../vitamui-import-dialog.component.scss | 82 +-- .../vitamui-import-dialog.component.spec.ts | 54 +- .../vitamui-import-dialog.component.ts | 22 +- .../vitamui-import-dialog.module.ts | 30 +- .../src/environments/environment.prod.ts | 2 +- .../src/environments/environment.ts | 2 +- .../projects/referential/src/index.html | 20 +- .../projects/referential/src/main.ts | 13 +- .../projects/referential/src/polyfills.ts | 1 - .../projects/referential/src/sass/_form.scss | 8 +- .../referential/src/sass/_profile-tag.scss | 30 +- .../src/sass/_vitamui-tab-group.scss | 92 +-- .../projects/referential/src/sass/login.scss | 234 +++---- .../projects/referential/src/test.ts | 10 +- ui/ui-frontend/projects/starter-kit/README.md | 20 +- .../starter-kit/src/app/app-routing.module.ts | 10 +- .../starter-kit/src/app/app.component.html | 54 +- .../starter-kit/src/app/app.component.scss | 52 +- .../starter-kit/src/app/app.component.spec.ts | 17 +- .../starter-kit/src/app/app.component.ts | 8 +- .../starter-kit/src/app/app.module.ts | 31 +- .../app/components/arrays/arrays.module.ts | 19 +- .../breadcrumb/breadcrumb.component.html | 10 +- .../breadcrumb/breadcrumb.component.ts | 12 +- .../breadcrumb/breadcrumb.module.ts | 11 +- .../components/buttons/buttons.component.html | 521 ++++++++------- .../components/buttons/buttons.component.scss | 17 +- .../components/buttons/buttons.component.ts | 9 +- .../app/components/buttons/buttons.module.ts | 17 +- .../components/colors/colors.component.html | 206 ++---- .../components/colors/colors.component.scss | 50 +- .../app/components/colors/colors.component.ts | 10 +- .../app/components/colors/colors.module.ts | 10 +- .../elevations/elevations.component.html | 14 +- .../elevations/elevations.component.scss | 180 +++--- .../elevations/elevations.component.ts | 9 +- .../elevations/elevations.module.ts | 9 +- .../app/components/icons/icons.component.html | 16 +- .../app/components/icons/icons.component.scss | 47 +- .../app/components/icons/icons.component.ts | 9 +- .../src/app/components/icons/icons.module.ts | 11 +- .../components/inputs/inputs.component.scss | 47 +- .../app/components/inputs/inputs.component.ts | 29 +- .../app/components/inputs/inputs.module.ts | 4 +- .../miscellaneous.component.html | 28 +- .../miscellaneous/miscellaneous.module.ts | 11 +- .../sample-dialog.component.html | 16 +- .../sample-dialog/sample-dialog.component.ts | 9 +- .../sample-dialog/sample-dialog.module.ts | 9 +- .../progress-bar/progress-bar.component.html | 9 +- .../progress-bar/progress-bar.component.ts | 7 +- .../components/tooltip/tooltip.component.html | 14 +- .../components/tooltip/tooltip.component.ts | 7 +- .../translation/translation.component.html | 61 +- .../translation/translation.component.ts | 6 +- .../translation/translation.module.ts | 20 +- .../typography/typography.component.html | 6 +- .../typography/typography.component.scss | 6 +- .../typography/typography.component.ts | 9 +- .../typography/typography.module.ts | 9 +- .../starter-kit/starter-kit.component.html | 2 +- .../app/starter-kit/starter-kit.component.ts | 9 +- .../src/app/starter-kit/starter-kit.module.ts | 11 +- .../starter-kit/src/assets/i18n/en.json | 6 +- .../starter-kit/src/assets/i18n/fr.json | 6 +- .../src/environments/environment.prod.ts | 4 +- .../src/environments/environment.ts | 2 +- .../projects/starter-kit/src/index.html | 45 +- .../projects/starter-kit/src/main.ts | 3 +- .../projects/starter-kit/src/polyfills.ts | 6 +- .../projects/starter-kit/src/sass/login.scss | 234 +++---- .../starter-kit/src/sass/material-custom.scss | 24 +- .../projects/starter-kit/src/sass/styles.scss | 10 +- .../projects/starter-kit/src/test.ts | 10 +- .../projects/vitamui-library/README.md | 3 +- .../src/lib/api/metadata-api.service.ts | 20 +- .../src/lib/api/search-unit-api.service.ts | 21 +- .../application-select-content.component.html | 127 ++-- .../application-select-content.component.scss | 18 +- ...plication-select-content.component.spec.ts | 24 +- .../application-select-content.component.ts | 10 +- .../application-select-content.module.ts | 22 +- .../card-group/card-group.component.html | 2 +- .../card-group/card-group.component.spec.ts | 11 +- .../card-group/card-group.component.ts | 12 +- .../card-group/card-group.module.ts | 25 +- .../card-select/card-select.component.html | 32 +- .../card-select/card-select.component.scss | 12 +- .../card-select/card-select.component.spec.ts | 9 +- .../card-select/card-select.component.ts | 19 +- .../card-select/card-select.module.ts | 34 +- .../lib/components/card/card.component.html | 12 +- .../lib/components/card/card.component.scss | 2 +- .../components/card/card.component.spec.ts | 9 +- .../src/lib/components/card/card.component.ts | 12 +- .../src/lib/components/card/card.module.ts | 28 +- .../confirm-action.component.html | 30 +- .../confirm-action.component.spec.ts | 9 +- .../confirm-action.component.ts | 9 +- .../confirm-action/confirm-action.module.ts | 21 +- .../filing-plan/filing-plan.component.html | 10 +- .../filing-plan/filing-plan.component.scss | 62 +- .../filing-plan/filing-plan.component.spec.ts | 16 +- .../filing-plan/filing-plan.component.ts | 64 +- .../filing-plan/filing-plan.module.spec.ts | 2 +- .../filing-plan/filing-plan.module.ts | 35 +- .../filing-plan/filing-plan.service.spec.ts | 2 +- .../filing-plan/filing-plan.service.ts | 9 +- .../filing-plan/node.component.html | 17 +- .../filing-plan/node.component.scss | 104 +-- .../components/filing-plan/node.component.ts | 14 +- .../vitamui-input.component.html | 29 +- .../vitamui-input.component.scss | 24 +- .../vitamui-input.component.spec.ts | 25 +- .../vitamui-input/vitamui-input.component.ts | 19 +- .../vitamui-input/vitamui-input.module.ts | 19 +- .../vitamui-menu-tile.component.html | 20 +- .../vitamui-menu-tile.component.scss | 125 ++-- .../vitamui-menu-tile.component.spec.ts | 44 +- .../vitamui-menu-tile.component.ts | 17 +- .../vitamui-menu-tile.module.ts | 19 +- .../vitamui-radio-group.component.html | 15 +- .../vitamui-radio-group.component.scss | 2 +- .../vitamui-radio-group.component.spec.ts | 9 +- .../vitamui-radio-group.component.ts | 41 +- .../vitamui-radio-group.module.ts | 20 +- .../vitamui-radio-group.service.spec.ts | 12 +- .../vitamui-radio-group.service.ts | 8 +- .../vitamui-radio.component.html | 6 +- .../vitamui-radio.component.scss | 4 +- .../vitamui-radio.component.spec.ts | 9 +- .../vitamui-radio/vitamui-radio.component.ts | 7 +- .../vitamui-radio/vitamui-radio.module.ts | 13 +- .../vitamui-select-all-option.component.html | 17 +- ...itamui-select-all-option.component.spec.ts | 12 +- .../vitamui-select-all-option.component.ts | 59 +- .../vitamui-select-all-option.module.ts | 17 +- .../models/autocomplete-response.interface.ts | 2 +- .../src/lib/models/date-query.interface.ts | 20 +- .../lib/models/date-range-query.interface.ts | 6 +- .../vitamui-library/src/lib/models/event.ts | 2 +- .../src/lib/models/file-format.ts | 2 +- .../src/lib/models/metadata.interface.ts | 5 +- .../src/lib/models/ontology.ts | 2 +- .../models/precise-date-query.interface.ts | 4 +- .../lib/models/search-criteria.interface.ts | 12 +- .../src/lib/models/search-query.interface.ts | 2 +- .../src/lib/models/unit.interface.ts | 6 +- .../lib/models/year-month-query.interface.ts | 2 +- .../src/lib/services/metadata.service.ts | 23 +- .../vitamui-library/src/lib/utils/download.ts | 2 +- .../src/lib/utils/keyword.util.ts | 8 +- .../src/lib/vitamui-library.module.ts | 33 +- .../src/lib/vitamui-library.service.spec.ts | 14 +- .../src/lib/vitamui-library.service.ts | 8 +- .../src/sass/_date-filter.scss | 44 +- .../vitamui-library/src/sass/_filter.scss | 2 +- .../vitamui-library/src/sass/styles.scss | 1 - .../projects/vitamui-library/src/test.ts | 12 +- 1909 files changed, 28312 insertions(+), 29668 deletions(-) diff --git a/ui/ui-frontend-common/src/app/app.component.html b/ui/ui-frontend-common/src/app/app.component.html index 599fac47180..f54d462060e 100644 --- a/ui/ui-frontend-common/src/app/app.component.html +++ b/ui/ui-frontend-common/src/app/app.component.html @@ -1,18 +1,13 @@ - + - Components - Icons - Subrogation Demo - Account Demo - App Guard Demo + Components + Icons + Subrogation Demo + Account Demo + App Guard Demo -
    -
+
    @@ -20,4 +15,3 @@
    - diff --git a/ui/ui-frontend-common/src/app/app.component.ts b/ui/ui-frontend-common/src/app/app.component.ts index b80ac501181..cfb123e7130 100644 --- a/ui/ui-frontend-common/src/app/app.component.ts +++ b/ui/ui-frontend-common/src/app/app.component.ts @@ -45,12 +45,16 @@ import { StartupService } from './modules/startup.service'; @Component({ selector: 'vitamui-common-root', templateUrl: './app.component.html', - styleUrls: ['./app.component.scss'] + styleUrls: ['./app.component.scss'], }) export class AppComponent { title = 'app'; - constructor(public authService: AuthService, private matDialog: MatDialog, titleService: Title, startupService: StartupService + constructor( + public authService: AuthService, + private matDialog: MatDialog, + titleService: Title, + startupService: StartupService, ) { titleService.setTitle(startupService.getPlatformName()); } diff --git a/ui/ui-frontend-common/src/app/app.module.ts b/ui/ui-frontend-common/src/app/app.module.ts index 81616cf6113..c7d23214ce3 100644 --- a/ui/ui-frontend-common/src/app/app.module.ts +++ b/ui/ui-frontend-common/src/app/app.module.ts @@ -72,9 +72,9 @@ import { PipesModule } from './modules/pipes/pipes.module'; ], { preloadingStrategy: QuicklinkStrategy, - } + }, ), - PipesModule + PipesModule, ], providers: [ { provide: BASE_URL, useValue: '/portal-api' }, diff --git a/ui/ui-frontend-common/src/app/modules/account/account-api.service.spec.ts b/ui/ui-frontend-common/src/app/modules/account/account-api.service.spec.ts index 7effa40db6e..98bfff57a48 100644 --- a/ui/ui-frontend-common/src/app/modules/account/account-api.service.spec.ts +++ b/ui/ui-frontend-common/src/app/modules/account/account-api.service.spec.ts @@ -41,12 +41,12 @@ import { BASE_URL } from '../injection-tokens'; import { AccountApiService } from './account-api.service'; describe('AccountApiService', () => { - beforeEach(() => TestBed.configureTestingModule({ - imports: [HttpClientTestingModule], - providers: [ - { provide: BASE_URL, useValue: '/fake-api' }, - ] - })); + beforeEach(() => + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule], + providers: [{ provide: BASE_URL, useValue: '/fake-api' }], + }), + ); it('should be created', () => { const service: AccountApiService = TestBed.inject(AccountApiService); diff --git a/ui/ui-frontend-common/src/app/modules/account/account-api.service.ts b/ui/ui-frontend-common/src/app/modules/account/account-api.service.ts index 8cfbc99d776..f8f93b23108 100644 --- a/ui/ui-frontend-common/src/app/modules/account/account-api.service.ts +++ b/ui/ui-frontend-common/src/app/modules/account/account-api.service.ts @@ -42,18 +42,19 @@ import { BASE_URL } from '../injection-tokens'; import { Account } from '../models/account/account.interface'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class AccountApiService { - private readonly apiUrl: string; - constructor(private http: HttpClient, @Inject(BASE_URL) baseUrl: string) { + constructor( + private http: HttpClient, + @Inject(BASE_URL) baseUrl: string, + ) { this.apiUrl = baseUrl + '/accounts'; } public patchMe(userPartial: { [key: string]: any }, headers?: HttpHeaders): Observable { return this.http.patch(this.apiUrl + '/me', userPartial, { headers }); } - } diff --git a/ui/ui-frontend-common/src/app/modules/account/account-application-tab/account-application-tab.component.html b/ui/ui-frontend-common/src/app/modules/account/account-application-tab/account-application-tab.component.html index 897c45624ee..2de96be84f6 100644 --- a/ui/ui-frontend-common/src/app/modules/account/account-application-tab/account-application-tab.component.html +++ b/ui/ui-frontend-common/src/app/modules/account/account-application-tab/account-application-tab.component.html @@ -1,3 +1 @@ -

    - account-application-tab works! -

    +

    account-application-tab works!

    diff --git a/ui/ui-frontend-common/src/app/modules/account/account-application-tab/account-application-tab.component.spec.ts b/ui/ui-frontend-common/src/app/modules/account/account-application-tab/account-application-tab.component.spec.ts index c1235bf7237..47403f40a68 100644 --- a/ui/ui-frontend-common/src/app/modules/account/account-application-tab/account-application-tab.component.spec.ts +++ b/ui/ui-frontend-common/src/app/modules/account/account-application-tab/account-application-tab.component.spec.ts @@ -44,9 +44,8 @@ describe('AccountApplicationTabComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - declarations: [ AccountApplicationTabComponent ] - }) - .compileComponents(); + declarations: [AccountApplicationTabComponent], + }).compileComponents(); })); beforeEach(() => { diff --git a/ui/ui-frontend-common/src/app/modules/account/account-application-tab/account-application-tab.component.ts b/ui/ui-frontend-common/src/app/modules/account/account-application-tab/account-application-tab.component.ts index dc05ef31cd4..3ec7aec8561 100644 --- a/ui/ui-frontend-common/src/app/modules/account/account-application-tab/account-application-tab.component.ts +++ b/ui/ui-frontend-common/src/app/modules/account/account-application-tab/account-application-tab.component.ts @@ -39,13 +39,10 @@ import { Component, OnInit } from '@angular/core'; @Component({ selector: 'vitamui-common-account-application-tab', templateUrl: './account-application-tab.component.html', - styleUrls: ['./account-application-tab.component.scss'] + styleUrls: ['./account-application-tab.component.scss'], }) export class AccountApplicationTabComponent implements OnInit { + constructor() {} - constructor() { } - - ngOnInit() { - } - + ngOnInit() {} } diff --git a/ui/ui-frontend-common/src/app/modules/account/account-information-tab/account-information-tab.component.html b/ui/ui-frontend-common/src/app/modules/account/account-information-tab/account-information-tab.component.html index a5b4018933c..402e1d40845 100644 --- a/ui/ui-frontend-common/src/app/modules/account/account-information-tab/account-information-tab.component.html +++ b/ui/ui-frontend-common/src/app/modules/account/account-information-tab/account-information-tab.component.html @@ -1,72 +1,74 @@
    - - {{form?.get('lastname')?.value}} + + {{ form?.get('lastname')?.value }}
    - - {{form?.get('firstname')?.value}} + + {{ form?.get('firstname')?.value }}
    - - {{form?.get('email')?.value}} + + {{ form?.get('email')?.value }}
    - - {{'COMMON.LANGUAGE.'+language | translate: { default:'-'} }} + + {{ 'COMMON.LANGUAGE.' + language | translate: { default: '-' } }}
    - {{'ACCOUNT.OTP_AUTH' | translate}} + {{ 'ACCOUNT.OTP_AUTH' | translate }}
    - - {{form?.get('mobile')?.value}} + + {{ form?.get('mobile')?.value }}
    - - {{form?.get('phone')?.value}} + + {{ form?.get('phone')?.value }}
    - - {{form.get('address').value?.street}} + + {{ form.get('address').value?.street }} , - {{form.get('address').value?.zipCode}}, {{form.get('address').value?.city}} + {{ form.get('address').value?.zipCode }}, {{ form.get('address').value?.city }}
    - - {{form?.get('level')?.value}} + + {{ form?.get('level')?.value }}
    - - {{form.get('profileGroup').value?.name}} - {{form.get('profileGroup').value?.description}} + + {{ form.get('profileGroup').value?.name }} + {{ form.get('profileGroup').value?.description }}
    diff --git a/ui/ui-frontend-common/src/app/modules/account/account-information-tab/account-information-tab.component.scss b/ui/ui-frontend-common/src/app/modules/account/account-information-tab/account-information-tab.component.scss index ce179dbe289..dc380cc744a 100644 --- a/ui/ui-frontend-common/src/app/modules/account/account-information-tab/account-information-tab.component.scss +++ b/ui/ui-frontend-common/src/app/modules/account/account-information-tab/account-information-tab.component.scss @@ -2,7 +2,7 @@ .row > div { display: flex; - flex-direction: column; + flex-direction: column; } .row:not(:last-child) { @@ -12,15 +12,14 @@ label { font-size: 14px; - color:var(--vitamui-grey-600); + color: var(--vitamui-grey-600); font-weight: normal; } -span -{ +span { font-size: 16px; - color:var(--vitamui-grey-900); + color: var(--vitamui-grey-900); font-weight: bold; } .form-pad { diff --git a/ui/ui-frontend-common/src/app/modules/account/account-information-tab/account-information-tab.component.spec.ts b/ui/ui-frontend-common/src/app/modules/account/account-information-tab/account-information-tab.component.spec.ts index e6b3493be6b..16e80f69f74 100644 --- a/ui/ui-frontend-common/src/app/modules/account/account-information-tab/account-information-tab.component.spec.ts +++ b/ui/ui-frontend-common/src/app/modules/account/account-information-tab/account-information-tab.component.spec.ts @@ -52,29 +52,18 @@ describe('AccountInformationTabComponent', () => { let fixture: ComponentFixture; const accountServiceSpy = { - getMyAccount: () => of({}) + getMyAccount: () => of({}), }; beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [ - ReactiveFormsModule, - EditableFieldModule, - SlideToggleModule, - TranslateModule.forRoot(), - NoopAnimationsModule, - ], - declarations: [ - AccountInformationTabComponent, - VitamUIFieldErrorStubComponent, - NavbarStubComponent, - ], + imports: [ReactiveFormsModule, EditableFieldModule, SlideToggleModule, TranslateModule.forRoot(), NoopAnimationsModule], + declarations: [AccountInformationTabComponent, VitamUIFieldErrorStubComponent, NavbarStubComponent], providers: [ { provide: WINDOW_LOCATION, useValue: {} }, - { provide: AccountService, useValue: accountServiceSpy } + { provide: AccountService, useValue: accountServiceSpy }, ], - }) - .compileComponents(); + }).compileComponents(); })); beforeEach(() => { diff --git a/ui/ui-frontend-common/src/app/modules/account/account-information-tab/account-information-tab.component.ts b/ui/ui-frontend-common/src/app/modules/account/account-information-tab/account-information-tab.component.ts index c6b4bae0748..25512cb36e1 100644 --- a/ui/ui-frontend-common/src/app/modules/account/account-information-tab/account-information-tab.component.ts +++ b/ui/ui-frontend-common/src/app/modules/account/account-information-tab/account-information-tab.component.ts @@ -43,7 +43,7 @@ import { AccountService } from '../account.service'; @Component({ selector: 'vitamui-common-account-information-tab', templateUrl: './account-information-tab.component.html', - styleUrls: ['./account-information-tab.component.scss'] + styleUrls: ['./account-information-tab.component.scss'], }) export class AccountInformationTabComponent implements OnInit { public form: FormGroup; @@ -54,7 +54,7 @@ export class AccountInformationTabComponent implements OnInit { set account(account: Account) { this._account = account; if (this.account?.userInfo) { - this.language = this.account.userInfo.language; + this.language = this.account.userInfo.language; } this.resetForm(this.account); } @@ -66,26 +66,17 @@ export class AccountInformationTabComponent implements OnInit { constructor( private formBuilder: FormBuilder, - private accountService: AccountService + private accountService: AccountService, ) { this.form = this.formBuilder.group({ id: [null], firstname: [{ value: null, disabled: true }, Validators.required], lastname: [{ value: null, disabled: true }, Validators.required], - email: [ - { value: null, disabled: true }, - [Validators.required, Validators.email], - ], + email: [{ value: null, disabled: true }, [Validators.required, Validators.email]], level: [{ value: null, disabled: true }], otp: [{ value: null, disabled: true }], - mobile: [ - { value: null, disabled: true }, - [Validators.pattern(/^[+]{1}[0-9]{11,12}$/)], - ], - phone: [ - { value: null, disabled: true }, - [Validators.pattern(/^[+]{1}[0-9]{11,12}$/)], - ], + mobile: [{ value: null, disabled: true }, [Validators.pattern(/^[+]{1}[0-9]{11,12}$/)]], + phone: [{ value: null, disabled: true }, [Validators.pattern(/^[+]{1}[0-9]{11,12}$/)]], address: [{ value: null, disabled: true }, Validators.required], type: [{ value: null, disabled: true }], profileGroup: [{ value: null, disabled: true }], diff --git a/ui/ui-frontend-common/src/app/modules/account/account.component.html b/ui/ui-frontend-common/src/app/modules/account/account.component.html index 884d5b8745e..72faf107ceb 100644 --- a/ui/ui-frontend-common/src/app/modules/account/account.component.html +++ b/ui/ui-frontend-common/src/app/modules/account/account.component.html @@ -2,12 +2,12 @@
    - {{'ACCOUNT.TITLE' | translate}} + {{ 'ACCOUNT.TITLE' | translate }}
    - +
    @@ -18,7 +18,7 @@
    - + -
    \ No newline at end of file +
    diff --git a/ui/ui-frontend-common/src/app/modules/account/account.component.scss b/ui/ui-frontend-common/src/app/modules/account/account.component.scss index 7fa547b99c6..f48ec1122c5 100644 --- a/ui/ui-frontend-common/src/app/modules/account/account.component.scss +++ b/ui/ui-frontend-common/src/app/modules/account/account.component.scss @@ -1,4 +1,4 @@ -@import "../../../sass/variables/colors"; +@import '../../../sass/variables/colors'; h2 { display: flex; @@ -15,7 +15,7 @@ h2 { :host::ng-deep { --radius: 20px; - + .mat-tab-body-wrapper { border-top-right-radius: var(--radius); border-bottom-right-radius: var(--radius); @@ -37,14 +37,16 @@ h2 { border-bottom: none; } - .mat-tab-header, .mat-tab-nav-bar { + .mat-tab-header, + .mat-tab-nav-bar { border-bottom: 0; } .mat-ink-bar { display: none; } - &.mat-tab-label-active, &.mat-tab-label-active:not(.mat-tab-disabled):focus { + &.mat-tab-label-active, + &.mat-tab-label-active:not(.mat-tab-disabled):focus { background-color: $white; font-weight: bold; color: var(--vitamui-grey-700); diff --git a/ui/ui-frontend-common/src/app/modules/account/account.component.spec.ts b/ui/ui-frontend-common/src/app/modules/account/account.component.spec.ts index 6e6f0eaff09..f72a3d82095 100644 --- a/ui/ui-frontend-common/src/app/modules/account/account.component.spec.ts +++ b/ui/ui-frontend-common/src/app/modules/account/account.component.spec.ts @@ -52,7 +52,7 @@ import { Account } from '../models/account/account.interface'; import { AccountComponent } from './account.component'; import { AccountService } from './account.service'; -@Component({selector: 'vitamui-common-account-information-tab', template: ''}) +@Component({ selector: 'vitamui-common-account-information-tab', template: '' }) class InformationTabStubComponent { @Input() account: Account; } @@ -62,38 +62,26 @@ describe('AccountComponent', () => { let fixture: ComponentFixture; const accountServiceSpy = { - getMyAccount: () => of({}) + getMyAccount: () => of({}), }; - const userInfoApiServiceSpy = { - getMyUserInfo: () => of({}) + getMyUserInfo: () => of({}), }; beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [ - InjectorModule, - MatTabsModule, - NoopAnimationsModule, - LoggerModule.forRoot(), - VitamUICommonTestModule - ], - declarations: [ - AccountComponent, - InformationTabStubComponent, - NavbarStubComponent - ], + imports: [InjectorModule, MatTabsModule, NoopAnimationsModule, LoggerModule.forRoot(), VitamUICommonTestModule], + declarations: [AccountComponent, InformationTabStubComponent, NavbarStubComponent], providers: [ { provide: TranslateService, useValue: { instant: () => EMPTY } }, { provide: AccountService, useValue: accountServiceSpy }, { provide: BaseUserInfoApiService, useValue: userInfoApiServiceSpy }, { provide: ActivatedRoute, useValue: { data: EMPTY } }, - { provide: ENVIRONMENT, useValue: environment } + { provide: ENVIRONMENT, useValue: environment }, ], - schemas: [NO_ERRORS_SCHEMA] - }) - .compileComponents(); + schemas: [NO_ERRORS_SCHEMA], + }).compileComponents(); })); beforeEach(() => { diff --git a/ui/ui-frontend-common/src/app/modules/account/account.component.ts b/ui/ui-frontend-common/src/app/modules/account/account.component.ts index 49b5b63fbcd..37ca883cf34 100644 --- a/ui/ui-frontend-common/src/app/modules/account/account.component.ts +++ b/ui/ui-frontend-common/src/app/modules/account/account.component.ts @@ -58,19 +58,21 @@ export class AccountComponent extends AppRootComponent implements OnInit, OnDest private sub: Subscription; - constructor(private accountService: AccountService, - private userInfoApiService: BaseUserInfoApiService, - public route: ActivatedRoute) { + constructor( + private accountService: AccountService, + private userInfoApiService: BaseUserInfoApiService, + public route: ActivatedRoute, + ) { super(route); } ngOnInit() { this.sub = this.accountService.getMyAccount().subscribe((account) => { - this.userInfoApiService.getMyUserInfo().subscribe((userInfo) => { - const accountWithUserInfos = account; - accountWithUserInfos.userInfo = userInfo; - this.account = accountWithUserInfos; - }); + this.userInfoApiService.getMyUserInfo().subscribe((userInfo) => { + const accountWithUserInfos = account; + accountWithUserInfos.userInfo = userInfo; + this.account = accountWithUserInfos; + }); }); this.dataBreadcrumb = [{ identifier: ApplicationId.PORTAL_APP }, { identifier: ApplicationId.ACCOUNTS_APP }]; } diff --git a/ui/ui-frontend-common/src/app/modules/account/account.module.ts b/ui/ui-frontend-common/src/app/modules/account/account.module.ts index 3bc6a2ba964..8df74907d6b 100644 --- a/ui/ui-frontend-common/src/app/modules/account/account.module.ts +++ b/ui/ui-frontend-common/src/app/modules/account/account.module.ts @@ -65,12 +65,8 @@ import { AccountComponent } from './account.component'; VitamUIFieldErrorModule, VitamuiContentBreadcrumbModule, UserPhotoModule, - TranslateModule + TranslateModule, ], - declarations: [ - AccountComponent, - AccountInformationTabComponent, - AccountApplicationTabComponent, - ] + declarations: [AccountComponent, AccountInformationTabComponent, AccountApplicationTabComponent], }) -export class AccountModule { } +export class AccountModule {} diff --git a/ui/ui-frontend-common/src/app/modules/account/account.service.spec.ts b/ui/ui-frontend-common/src/app/modules/account/account.service.spec.ts index 815f7afa76d..b7a86f608b0 100644 --- a/ui/ui-frontend-common/src/app/modules/account/account.service.spec.ts +++ b/ui/ui-frontend-common/src/app/modules/account/account.service.spec.ts @@ -45,9 +45,7 @@ import { EMPTY } from 'rxjs'; import { TranslateService } from '@ngx-translate/core'; import { VitamUISnackBarService } from '../components/vitamui-snack-bar/vitamui-snack-bar.service'; - describe('AccountService', () => { - beforeEach(() => { TestBed.configureTestingModule({ imports: [HttpClientTestingModule], @@ -55,8 +53,8 @@ describe('AccountService', () => { AccountService, { provide: BASE_URL, useValue: {} }, { provide: TranslateService, useValue: { instant: () => EMPTY } }, - { provide: VitamUISnackBarService, useValue: { instant: () => EMPTY } } - ] + { provide: VitamUISnackBarService, useValue: { instant: () => EMPTY } }, + ], }); }); diff --git a/ui/ui-frontend-common/src/app/modules/account/account.service.ts b/ui/ui-frontend-common/src/app/modules/account/account.service.ts index 752a29c354f..cc12517d026 100644 --- a/ui/ui-frontend-common/src/app/modules/account/account.service.ts +++ b/ui/ui-frontend-common/src/app/modules/account/account.service.ts @@ -44,14 +44,14 @@ import { Account } from '../models/account/account.interface'; import { AccountApiService } from './account-api.service'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class AccountService { constructor( private accountApi: AccountApiService, private securityApi: SecurityApiService, - private snackBarService: VitamUISnackBarService) { - } + private snackBarService: VitamUISnackBarService, + ) {} public getMyAccount(): Observable { return this.securityApi.getAuthenticated(); @@ -63,13 +63,13 @@ export class AccountService { () => { this.snackBarService.open({ message: 'SNACKBAR.UPDATED_ACCOUNT', - icon: 'vitamui-icon-user' + icon: 'vitamui-icon-user', }); }, (error) => { - this.snackBarService.open({message: error.error.message}); - } - ) + this.snackBarService.open({ message: error.error.message }); + }, + ), ); } } diff --git a/ui/ui-frontend-common/src/app/modules/active-tenant.guard.ts b/ui/ui-frontend-common/src/app/modules/active-tenant.guard.ts index 618ce69c5bd..7729ccf0ab6 100644 --- a/ui/ui-frontend-common/src/app/modules/active-tenant.guard.ts +++ b/ui/ui-frontend-common/src/app/modules/active-tenant.guard.ts @@ -48,10 +48,9 @@ import { TenantsByApplication } from './models/user/tenants-by-application.inter import { StartupService } from './startup.service'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class ActiveTenantGuard implements CanActivate, CanActivateChild { - constructor( private authService: AuthService, private appService: ApplicationService, @@ -59,7 +58,7 @@ export class ActiveTenantGuard implements CanActivate, CanActivateChild { private globalEventService: GlobalEventService, private router: Router, @Inject(WINDOW_LOCATION) private location: any, - ) { } + ) {} canActivate(route: ActivatedRouteSnapshot): Observable | boolean { return this.checkTenants(route); @@ -85,9 +84,8 @@ export class ActiveTenantGuard implements CanActivate, CanActivateChild { } // redirect user to the tenant selection page const application = this.appService.applications.find((appFromService) => appFromService.identifier === route.data.appId); - this.router.navigate(route.pathFromRoot.map(r => r.url.toString()).concat(['tenant'])); + this.router.navigate(route.pathFromRoot.map((r) => r.url.toString()).concat(['tenant'])); return false; } - } diff --git a/ui/ui-frontend-common/src/app/modules/analytics-resolver.service.spec.ts b/ui/ui-frontend-common/src/app/modules/analytics-resolver.service.spec.ts index 9f6171c8fec..f8ebce01869 100644 --- a/ui/ui-frontend-common/src/app/modules/analytics-resolver.service.spec.ts +++ b/ui/ui-frontend-common/src/app/modules/analytics-resolver.service.spec.ts @@ -27,7 +27,7 @@ describe('AnalyticsResolver', () => { }, }, ], - }) + }), ); it('should be created', () => { diff --git a/ui/ui-frontend-common/src/app/modules/analytics-resolver.service.ts b/ui/ui-frontend-common/src/app/modules/analytics-resolver.service.ts index 3ccdcfc15c0..3824c69caf1 100644 --- a/ui/ui-frontend-common/src/app/modules/analytics-resolver.service.ts +++ b/ui/ui-frontend-common/src/app/modules/analytics-resolver.service.ts @@ -7,28 +7,33 @@ import { User } from './models/user/user.interface'; import { TenantSelectionService } from './tenant-selection.service'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class AnalyticsResolver implements Resolve { - private currentApplicationId: string; - constructor(private userApiService: UserApiService, private applicationService: ApplicationService, - private tenantService: TenantSelectionService) { } + constructor( + private userApiService: UserApiService, + private applicationService: ApplicationService, + private tenantService: TenantSelectionService, + ) {} - resolve(route: ActivatedRouteSnapshot) { - const nextApplicationId = route.data.appId; - this.tenantService.currentAppId$.next(nextApplicationId); - if (nextApplicationId && nextApplicationId !== this.currentApplicationId) { - // tag the application us the last used - this.userApiService.analytics({ applicationId: nextApplicationId }).pipe(take(1)).subscribe((userData: User) => { + resolve(route: ActivatedRouteSnapshot) { + const nextApplicationId = route.data.appId; + this.tenantService.currentAppId$.next(nextApplicationId); + if (nextApplicationId && nextApplicationId !== this.currentApplicationId) { + // tag the application us the last used + this.userApiService + .analytics({ applicationId: nextApplicationId }) + .pipe(take(1)) + .subscribe((userData: User) => { if (userData.analytics) { const analytics = userData.analytics; this.applicationService.applicationsAnalytics = analytics.applications; this.tenantService.setLastTenantIdentifier(analytics.lastTenantIdentifier); } }); - this.currentApplicationId = nextApplicationId; - } + this.currentApplicationId = nextApplicationId; } } +} diff --git a/ui/ui-frontend-common/src/app/modules/animations/vitamui-common-animations.ts b/ui/ui-frontend-common/src/app/modules/animations/vitamui-common-animations.ts index 6f25d20676b..94c7529d720 100644 --- a/ui/ui-frontend-common/src/app/modules/animations/vitamui-common-animations.ts +++ b/ui/ui-frontend-common/src/app/modules/animations/vitamui-common-animations.ts @@ -1,8 +1,8 @@ import { animate, keyframes, query, stagger, state, style, transition, trigger } from '@angular/animations'; export const collapseAnimation = trigger('collapseAnimation', [ - state('collapsed', style({height: '0px', visibility: 'hidden', opacity: '0'})), - state('expanded', style({height: '*', visibility: 'visible', opacity: '1'})), + state('collapsed', style({ height: '0px', visibility: 'hidden', opacity: '0' })), + state('expanded', style({ height: '*', visibility: 'visible', opacity: '1' })), transition('expanded <=> collapsed', animate('150ms cubic-bezier(0.4,0.0,0.2,1)')), ]); @@ -34,7 +34,7 @@ export const slideDownAnimation = trigger('slideDownAnimation', [ transition(':enter', [ style({ opacity: 0, - transform: 'translateY(-100%)' + transform: 'translateY(-100%)', }), animate('100ms ease-out'), ]), @@ -45,7 +45,7 @@ export const tooltipAnimation = trigger('tooltipAnimation', [ transition(':enter', [ style({ opacity: 0, - transform: 'translateY(-100%)' + transform: 'translateY(-100%)', }), animate('100ms ease-out'), ]), @@ -53,18 +53,8 @@ export const tooltipAnimation = trigger('tooltipAnimation', [ export const opacityAnimation = trigger('opacityAnimation', [ state('close', style({})), - transition(':enter', [ - animate('500ms cubic-bezier(0, 0, 0.2, 1)', keyframes([ - style({ opacity: 0 }), - style({ opacity: 1 }), - ])), - ]), - transition('* => close', [ - animate('500ms cubic-bezier(0, 0, 0.2, 1)', keyframes([ - style({ opacity: 1 }), - style({ opacity: 0 }), - ])), - ]), + transition(':enter', [animate('500ms cubic-bezier(0, 0, 0.2, 1)', keyframes([style({ opacity: 0 }), style({ opacity: 1 })]))]), + transition('* => close', [animate('500ms cubic-bezier(0, 0, 0.2, 1)', keyframes([style({ opacity: 1 }), style({ opacity: 0 })]))]), ]); export const transitionAnimation = trigger('transitionAnimation', [ @@ -78,18 +68,8 @@ export const slideAnimation = trigger('slideAnimation', [ transition(':enter', [ query('*', [ style({ opacity: 0, transform: 'translateX(-20px)' }), - stagger(50, [ - animate( - '50ms', - style({ opacity: 1, transform: 'none' }) - ) - ]) - ]) + stagger(50, [animate('50ms', style({ opacity: 1, transform: 'none' }))]), + ]), ]), - transition(':leave', [ - animate( - '250ms', - style({ opacity: 0, transform: 'translateX(+100px)' }) - ) - ]) + transition(':leave', [animate('250ms', style({ opacity: 0, transform: 'translateX(+100px)' }))]), ]); diff --git a/ui/ui-frontend-common/src/app/modules/api/access-contract-api.service.ts b/ui/ui-frontend-common/src/app/modules/api/access-contract-api.service.ts index edc706865d6..0c233bc35c4 100644 --- a/ui/ui-frontend-common/src/app/modules/api/access-contract-api.service.ts +++ b/ui/ui-frontend-common/src/app/modules/api/access-contract-api.service.ts @@ -47,7 +47,10 @@ export class AccessContractApiService { private readonly apiUrl: string; private readonly baseUrl: string; - constructor(private http: HttpClient, @Inject(BASE_URL) baseUrl: string) { + constructor( + private http: HttpClient, + @Inject(BASE_URL) baseUrl: string, + ) { this.apiUrl = baseUrl + '/accesscontracts'; this.baseUrl = baseUrl; } diff --git a/ui/ui-frontend-common/src/app/modules/api/application-api.service.spec.ts b/ui/ui-frontend-common/src/app/modules/api/application-api.service.spec.ts index 4fe170db3e5..1f46816ffb7 100644 --- a/ui/ui-frontend-common/src/app/modules/api/application-api.service.spec.ts +++ b/ui/ui-frontend-common/src/app/modules/api/application-api.service.spec.ts @@ -41,12 +41,12 @@ import { BASE_URL } from '../injection-tokens'; import { ApplicationApiService } from './application-api.service'; describe('ApplicationApiService', () => { - beforeEach(() => TestBed.configureTestingModule({ - imports: [HttpClientTestingModule], - providers: [ - { provide: BASE_URL, useValue: '/fake-api' }, - ] - })); + beforeEach(() => + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule], + providers: [{ provide: BASE_URL, useValue: '/fake-api' }], + }), + ); it('should be created', () => { const service: ApplicationApiService = TestBed.inject(ApplicationApiService); diff --git a/ui/ui-frontend-common/src/app/modules/api/application-api.service.ts b/ui/ui-frontend-common/src/app/modules/api/application-api.service.ts index 0ebcf337fbb..ec30c4d4c38 100644 --- a/ui/ui-frontend-common/src/app/modules/api/application-api.service.ts +++ b/ui/ui-frontend-common/src/app/modules/api/application-api.service.ts @@ -42,13 +42,15 @@ import { BASE_URL } from '../injection-tokens'; import { AppConfiguration, ApplicationInfo, AttachmentType } from '../models'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class ApplicationApiService { - private readonly apiUrl: string; - constructor(private http: HttpClient, @Inject(BASE_URL) baseUrl: string) { + constructor( + private http: HttpClient, + @Inject(BASE_URL) baseUrl: string, + ) { this.apiUrl = baseUrl + '/ui/applications'; } @@ -57,7 +59,7 @@ export class ApplicationApiService { } isApplicationExternalIdentifierEnabled(id: string): Observable { - return this.http.get(this.apiUrl + '/' + id + '/externalid'); + return this.http.get(this.apiUrl + '/' + id + '/externalid'); } getConfiguration(): Observable { @@ -67,5 +69,4 @@ export class ApplicationApiService { getAsset(assets: AttachmentType[]): Observable { return this.http.get(`${this.apiUrl}/asset?assets=${assets}`); } - } diff --git a/ui/ui-frontend-common/src/app/modules/api/base-user-info-api.service.ts b/ui/ui-frontend-common/src/app/modules/api/base-user-info-api.service.ts index 93996436380..a47173d1705 100644 --- a/ui/ui-frontend-common/src/app/modules/api/base-user-info-api.service.ts +++ b/ui/ui-frontend-common/src/app/modules/api/base-user-info-api.service.ts @@ -44,25 +44,26 @@ import { Account } from '../models/account/account.interface'; import { AuthService } from './../auth.service'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class BaseUserInfoApiService extends BaseHttpClient { - - constructor(http: HttpClient, @Inject(BASE_URL) baseUrl: string, private authService: AuthService) { + constructor( + http: HttpClient, + @Inject(BASE_URL) baseUrl: string, + private authService: AuthService, + ) { super(http, baseUrl + '/userinfos'); } - getOne(id: string, headers?: HttpHeaders): Observable { return super.getOne(id, headers); } - create(userInfo: UserInfo, headers?: HttpHeaders): Observable { return super.create(userInfo, headers); } - patch(data: { id: string, [key: string]: any }, headers?: HttpHeaders): Observable { + patch(data: { id: string; [key: string]: any }, headers?: HttpHeaders): Observable { return super.patch(data, headers); } @@ -70,11 +71,8 @@ export class BaseUserInfoApiService extends BaseHttpClient { return this.http.patch(this.apiUrl + '/me', userPartial, { headers }); } - - getMyUserInfo(headers?: HttpHeaders): Observable { headers = new HttpHeaders({ 'X-Tenant-Id': this.authService.getAnyTenantIdentifier() }); return super.getHttp().get(super.getApiUrl() + '/me', { headers }); } - } diff --git a/ui/ui-frontend-common/src/app/modules/api/external-param-profile-api.service.ts b/ui/ui-frontend-common/src/app/modules/api/external-param-profile-api.service.ts index c0761f2c3a5..1a1bdca47b5 100644 --- a/ui/ui-frontend-common/src/app/modules/api/external-param-profile-api.service.ts +++ b/ui/ui-frontend-common/src/app/modules/api/external-param-profile-api.service.ts @@ -34,23 +34,23 @@ * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ -import {HttpClient, HttpHeaders} from '@angular/common/http'; -import {Inject, Injectable} from '@angular/core'; -import {Observable} from 'rxjs'; -import {BaseHttpClient} from '../base-http-client'; -import {BASE_URL} from '../injection-tokens'; -import {ExternalParamProfile} from '../models'; -import {PageRequest, PaginatedResponse} from '../vitamui-table'; +import { HttpClient, HttpHeaders } from '@angular/common/http'; +import { Inject, Injectable } from '@angular/core'; +import { Observable } from 'rxjs'; +import { BaseHttpClient } from '../base-http-client'; +import { BASE_URL } from '../injection-tokens'; +import { ExternalParamProfile } from '../models'; +import { PageRequest, PaginatedResponse } from '../vitamui-table'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class ExternalParamProfileApiService extends BaseHttpClient { constructor(http: HttpClient, @Inject(BASE_URL) baseUrl: string) { super(http, baseUrl + '/externalparamprofile'); } - getAllPaginated(pageRequest: PageRequest,embedded?: string,headers?: HttpHeaders): Observable> { + getAllPaginated(pageRequest: PageRequest, embedded?: string, headers?: HttpHeaders): Observable> { return super.getAllPaginated(pageRequest, embedded, headers); } @@ -58,7 +58,7 @@ export class ExternalParamProfileApiService extends BaseHttpClient { + patch(data: { id: string; [key: string]: any }, headers?: HttpHeaders): Observable { return super.getHttp().patch(super.getApiUrl() + '/me', data, { headers }); } diff --git a/ui/ui-frontend-common/src/app/modules/api/logbook-api.service.spec.ts b/ui/ui-frontend-common/src/app/modules/api/logbook-api.service.spec.ts index 7d8e2ec93fe..0754722af20 100644 --- a/ui/ui-frontend-common/src/app/modules/api/logbook-api.service.spec.ts +++ b/ui/ui-frontend-common/src/app/modules/api/logbook-api.service.spec.ts @@ -41,10 +41,12 @@ import { BASE_URL } from '../injection-tokens'; import { LogbookApiService } from './logbook-api.service'; describe('LogbookApiService', () => { - beforeEach(() => TestBed.configureTestingModule({ - imports: [HttpClientTestingModule], - providers: [{ provide: BASE_URL, useValue: '/fake-api' }] - })); + beforeEach(() => + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule], + providers: [{ provide: BASE_URL, useValue: '/fake-api' }], + }), + ); it('should be created', () => { const service: LogbookApiService = TestBed.inject(LogbookApiService); diff --git a/ui/ui-frontend-common/src/app/modules/api/logbook-api.service.ts b/ui/ui-frontend-common/src/app/modules/api/logbook-api.service.ts index 886b396f40a..d94a1203d1b 100644 --- a/ui/ui-frontend-common/src/app/modules/api/logbook-api.service.ts +++ b/ui/ui-frontend-common/src/app/modules/api/logbook-api.service.ts @@ -44,7 +44,6 @@ import { VitamResponse } from '../models/vitam/vitam-response.interface'; import { PaginatedApi } from '../paginated-api.interface'; import { PageRequest, PaginatedResponse } from '../vitamui-table'; - const CAS_CONTEXT = 'Contexte CAS'; const UNKNOWN_VALUE = '-'; const USER_INDEX = 3; @@ -52,14 +51,16 @@ const SUBROGATOR_INDEX = 4; const API_CONTEXT_INDEX = 2; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class LogbookApiService implements PaginatedApi { - private readonly apiUrl: string; private readonly baseUrl: string; - constructor(private http: HttpClient, @Inject(BASE_URL) baseUrl: string) { + constructor( + private http: HttpClient, + @Inject(BASE_URL) baseUrl: string, + ) { this.apiUrl = baseUrl + '/logbooks'; this.baseUrl = baseUrl; } @@ -90,13 +91,13 @@ export class LogbookApiService implements PaginatedApi { rightsStatementIdentifier: apiEvent.rightsStatementIdentifier, userIdentifier: user, subrogatorIdentifier: subrogator, - events: LogbookApiService.getSubEvents(apiEvent.events || [], user, subrogator) + events: LogbookApiService.getSubEvents(apiEvent.events || [], user, subrogator), }; } private static getSubEvents(apiEvents: ApiEvent[], userIdentifier: string, subrogatorIdentifier: string): Event[] { const result: Event[] = []; - apiEvents.forEach(apiEvent => { + apiEvents.forEach((apiEvent) => { const event: Event = LogbookApiService.toEvent(apiEvent); event.userIdentifier = userIdentifier; event.subrogatorIdentifier = subrogatorIdentifier; @@ -118,16 +119,16 @@ export class LogbookApiService implements PaginatedApi { return userIdentifier; } - findUnitLifeCyclesByUnitId(unitId: string, headers?: HttpHeaders): Observable<{ $hits: any, $results: Event[] }> { - return this.http.get<{ $hits: any, $results: ApiEvent[] }>(this.apiUrl + '/unitlifecycles/' + unitId, { headers }).pipe( - map((response) => ({ $hits: response.$hits, $results: response.$results.map(LogbookApiService.toEvent) })) - ); + findUnitLifeCyclesByUnitId(unitId: string, headers?: HttpHeaders): Observable<{ $hits: any; $results: Event[] }> { + return this.http + .get<{ $hits: any; $results: ApiEvent[] }>(this.apiUrl + '/unitlifecycles/' + unitId, { headers }) + .pipe(map((response) => ({ $hits: response.$hits, $results: response.$results.map(LogbookApiService.toEvent) }))); } - findObjectGroupLifeCyclesByUnitId(objectId: string, headers?: HttpHeaders): Observable<{ $hits: any, $results: Event[] }> { - return this.http.get<{ $hits: any, $results: ApiEvent[] }>(this.apiUrl + '/objectslifecycles/' + objectId, { headers }).pipe( - map((response) => ({ $hits: response.$hits, $results: response.$results.map(LogbookApiService.toEvent) })) - ); + findObjectGroupLifeCyclesByUnitId(objectId: string, headers?: HttpHeaders): Observable<{ $hits: any; $results: Event[] }> { + return this.http + .get<{ $hits: any; $results: ApiEvent[] }>(this.apiUrl + '/objectslifecycles/' + objectId, { headers }) + .pipe(map((response) => ({ $hits: response.$hits, $results: response.$results.map(LogbookApiService.toEvent) }))); } findOperationById(operationId: string, headers?: HttpHeaders): Observable<{ $results: any[] }> { @@ -135,25 +136,23 @@ export class LogbookApiService implements PaginatedApi { } findOperations(obId: string, obIdReq: string, headers?: HttpHeaders): Observable<{ $results: Event[] }> { - const params = new HttpParams() - .set('obId', obId) - .set('obIdReq', obIdReq); + const params = new HttpParams().set('obId', obId).set('obIdReq', obIdReq); - return this.http.get<{ $results: ApiEvent[] }>(this.apiUrl + '/operations/', { params, headers }).pipe( - map((response) => ({ $results: response.$results.map(LogbookApiService.toEvent) })) - ); + return this.http + .get<{ $results: ApiEvent[] }>(this.apiUrl + '/operations/', { params, headers }) + .pipe(map((response) => ({ $results: response.$results.map(LogbookApiService.toEvent) }))); } findOperationByIdAndCollectionName(id: string, resourcePath: string, headers?: HttpHeaders): Observable<{ $results: Event[] }> { - return this.http.get<{ $results: ApiEvent[] }>(this.baseUrl + '/' + resourcePath + '/' + id + '/history', { headers }).pipe( - map((response) => ({ $results: response.$results.map(LogbookApiService.toEvent) })) - ); + return this.http + .get<{ $results: ApiEvent[] }>(this.baseUrl + '/' + resourcePath + '/' + id + '/history', { headers }) + .pipe(map((response) => ({ $results: response.$results.map(LogbookApiService.toEvent) }))); } findOperationsBySelectQuery(selectQuery: VitamSelectQuery, headers?: HttpHeaders): Observable<{ $results: Event[] }> { - return this.http.post<{ $results: ApiEvent[] }>(this.apiUrl + '/operations', selectQuery, { headers }).pipe( - map((response) => ({ $results: response.$results.map(LogbookApiService.toEvent) })) - ); + return this.http + .post<{ $results: ApiEvent[] }>(this.apiUrl + '/operations', selectQuery, { headers }) + .pipe(map((response) => ({ $results: response.$results.map(LogbookApiService.toEvent) }))); } downloadManifest(id: string, headers?: HttpHeaders): Observable> { @@ -176,7 +175,6 @@ export class LogbookApiService implements PaginatedApi { return `${this.apiUrl}/operations/${id}/download/${downloadType}?tenantId=${tenantId}&contractId=${accessContractId}`; } - getAllPaginated(pageRequest: PageRequest, _?: string, headers?: HttpHeaders): Observable> { const criteria = JSON.parse(pageRequest.criteria); criteria.$filter.$offset = pageRequest.page * pageRequest.size; @@ -184,15 +182,14 @@ export class LogbookApiService implements PaginatedApi { // The pagination and order are defined in the Vitam DSL query stored in the `criteria` property // We don't actually need to use the other properties of the page request - return this.http.post>(this.apiUrl + '/operations', JSON.parse(pageRequest.criteria), { headers }) - .pipe( - map((response) => ({ - pageNum: pageRequest.page, - pageSize: pageRequest.size, - totalElements: response.$hits.total, - hasMore: (response.$hits.offset + response.$hits.size) < response.$hits.total, - values: response.$results.map(LogbookApiService.toEvent) - })) - ); + return this.http.post>(this.apiUrl + '/operations', JSON.parse(pageRequest.criteria), { headers }).pipe( + map((response) => ({ + pageNum: pageRequest.page, + pageSize: pageRequest.size, + totalElements: response.$hits.total, + hasMore: response.$hits.offset + response.$hits.size < response.$hits.total, + values: response.$results.map(LogbookApiService.toEvent), + })), + ); } } diff --git a/ui/ui-frontend-common/src/app/modules/api/profile-api.service.spec.ts b/ui/ui-frontend-common/src/app/modules/api/profile-api.service.spec.ts index 567bb1ae708..f86ae7e4ead 100644 --- a/ui/ui-frontend-common/src/app/modules/api/profile-api.service.spec.ts +++ b/ui/ui-frontend-common/src/app/modules/api/profile-api.service.spec.ts @@ -41,14 +41,12 @@ import { BASE_URL } from '../injection-tokens'; import { ProfileApiService } from './profile-api.service'; describe('ProfileApiService', () => { - beforeEach(() => TestBed.configureTestingModule({ - imports: [ - HttpClientTestingModule, - ], - providers: [ - { provide: BASE_URL, useValue: '/fake-api' }, - ] - })); + beforeEach(() => + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule], + providers: [{ provide: BASE_URL, useValue: '/fake-api' }], + }), + ); it('should be created', () => { const service: ProfileApiService = TestBed.inject(ProfileApiService); diff --git a/ui/ui-frontend-common/src/app/modules/api/profile-api.service.ts b/ui/ui-frontend-common/src/app/modules/api/profile-api.service.ts index b5eb66e7977..ffadb07a114 100644 --- a/ui/ui-frontend-common/src/app/modules/api/profile-api.service.ts +++ b/ui/ui-frontend-common/src/app/modules/api/profile-api.service.ts @@ -42,12 +42,10 @@ import { BASE_URL } from '../injection-tokens'; import { Profile, SearchQuery } from '../models'; import { PageRequest, PaginatedResponse } from '../vitamui-table'; - @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class ProfileApiService extends BaseHttpClient { - constructor(http: HttpClient, @Inject(BASE_URL) baseUrl: string) { super(http, baseUrl + '/profiles'); } @@ -68,7 +66,7 @@ export class ProfileApiService extends BaseHttpClient { return super.getOneWithEmbedded(id, embedded, headers); } - checkExistsByParam(params: Array<{ key: string, value: string }>, headers?: HttpHeaders): Observable { + checkExistsByParam(params: Array<{ key: string; value: string }>, headers?: HttpHeaders): Observable { return super.checkExistsByParam(params, headers); } @@ -76,12 +74,12 @@ export class ProfileApiService extends BaseHttpClient { return super.create(profile, headers); } - patch(data: { id: string, [key: string]: any }, headers?: HttpHeaders): Observable { + patch(data: { id: string; [key: string]: any }, headers?: HttpHeaders): Observable { return super.patch(data, headers); } getLevels(query?: SearchQuery, headers?: HttpHeaders): Observable { - let params = new HttpParams(); + let params = new HttpParams(); if (query) { params = params.set('criteria', JSON.stringify(query)); } diff --git a/ui/ui-frontend-common/src/app/modules/api/rule-api.service.ts b/ui/ui-frontend-common/src/app/modules/api/rule-api.service.ts index 8df7ee78e35..f713cd2581f 100644 --- a/ui/ui-frontend-common/src/app/modules/api/rule-api.service.ts +++ b/ui/ui-frontend-common/src/app/modules/api/rule-api.service.ts @@ -46,7 +46,7 @@ import { PageRequest, PaginatedResponse } from '../vitamui-table'; const HTTP_STATUS_OK = 200; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class RuleApiService extends BaseHttpClient { constructor(http: HttpClient, @Inject(BASE_URL) baseUrl: string) { diff --git a/ui/ui-frontend-common/src/app/modules/api/security-api.service.spec.ts b/ui/ui-frontend-common/src/app/modules/api/security-api.service.spec.ts index 6dfe59507eb..1be5a4ef89a 100644 --- a/ui/ui-frontend-common/src/app/modules/api/security-api.service.spec.ts +++ b/ui/ui-frontend-common/src/app/modules/api/security-api.service.spec.ts @@ -41,12 +41,12 @@ import { BASE_URL } from '../injection-tokens'; import { SecurityApiService } from './security-api.service'; describe('SecurityApiService', () => { - beforeEach(() => TestBed.configureTestingModule({ - imports: [HttpClientTestingModule], - providers: [ - { provide: BASE_URL, useValue: '/fake-api' }, - ] - })); + beforeEach(() => + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule], + providers: [{ provide: BASE_URL, useValue: '/fake-api' }], + }), + ); it('should be created', () => { const service: SecurityApiService = TestBed.inject(SecurityApiService); diff --git a/ui/ui-frontend-common/src/app/modules/api/security-api.service.ts b/ui/ui-frontend-common/src/app/modules/api/security-api.service.ts index b250f07cf1d..4c6a5d4911a 100644 --- a/ui/ui-frontend-common/src/app/modules/api/security-api.service.ts +++ b/ui/ui-frontend-common/src/app/modules/api/security-api.service.ts @@ -42,13 +42,15 @@ import { BASE_URL } from '../injection-tokens'; import { AuthUser } from '../models'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class SecurityApiService { - private readonly apiUrl: string; - constructor(private http: HttpClient, @Inject(BASE_URL) baseUrl: string) { + constructor( + private http: HttpClient, + @Inject(BASE_URL) baseUrl: string, + ) { this.apiUrl = baseUrl + '/security'; } diff --git a/ui/ui-frontend-common/src/app/modules/api/subrogation-api.service.spec.ts b/ui/ui-frontend-common/src/app/modules/api/subrogation-api.service.spec.ts index 1c8e13f4b99..d56e783d07b 100644 --- a/ui/ui-frontend-common/src/app/modules/api/subrogation-api.service.spec.ts +++ b/ui/ui-frontend-common/src/app/modules/api/subrogation-api.service.spec.ts @@ -42,14 +42,16 @@ import { BASE_URL, WINDOW_LOCATION } from '../injection-tokens'; import { SubrogationApiService } from './subrogation-api.service'; describe('SubrogationApiService', () => { - beforeEach(() => TestBed.configureTestingModule({ - imports: [HttpClientTestingModule], - providers: [ - { provide: BASE_URL, useValue: '/fake-api' }, - { provide: WINDOW_LOCATION, useValue: {} }, - { provide: AuthService, useValue: {} }, - ] - })); + beforeEach(() => + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule], + providers: [ + { provide: BASE_URL, useValue: '/fake-api' }, + { provide: WINDOW_LOCATION, useValue: {} }, + { provide: AuthService, useValue: {} }, + ], + }), + ); it('should be created', () => { const service: SubrogationApiService = TestBed.inject(SubrogationApiService); diff --git a/ui/ui-frontend-common/src/app/modules/api/subrogation-api.service.ts b/ui/ui-frontend-common/src/app/modules/api/subrogation-api.service.ts index 6fe068563e6..17ec0081a74 100644 --- a/ui/ui-frontend-common/src/app/modules/api/subrogation-api.service.ts +++ b/ui/ui-frontend-common/src/app/modules/api/subrogation-api.service.ts @@ -44,12 +44,14 @@ import { BASE_URL } from '../injection-tokens'; import { Group, Subrogation } from '../models'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class SubrogationApiService extends BaseHttpClient { - - constructor(http: HttpClient, @Inject(BASE_URL) baseUrl: string, - private authService: AuthService) { + constructor( + http: HttpClient, + @Inject(BASE_URL) baseUrl: string, + private authService: AuthService, + ) { super(http, baseUrl + '/subrogations'); } diff --git a/ui/ui-frontend-common/src/app/modules/api/user-api.service.spec.ts b/ui/ui-frontend-common/src/app/modules/api/user-api.service.spec.ts index 5e533015469..abf30eda7ac 100644 --- a/ui/ui-frontend-common/src/app/modules/api/user-api.service.spec.ts +++ b/ui/ui-frontend-common/src/app/modules/api/user-api.service.spec.ts @@ -1,17 +1,19 @@ import { HttpClientTestingModule } from '@angular/common/http/testing'; import { TestBed } from '@angular/core/testing'; -import {BASE_URL, WINDOW_LOCATION} from './../injection-tokens'; +import { BASE_URL, WINDOW_LOCATION } from './../injection-tokens'; import { UserApiService } from './user-api.service'; describe('UserApiService', () => { - beforeEach(() => TestBed.configureTestingModule({ - imports: [HttpClientTestingModule], - providers: [ - { provide: BASE_URL, useValue: '/fake-api' }, - { provide: WINDOW_LOCATION, useValue: {} }, - ] - })); + beforeEach(() => + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule], + providers: [ + { provide: BASE_URL, useValue: '/fake-api' }, + { provide: WINDOW_LOCATION, useValue: {} }, + ], + }), + ); it('should be created', () => { const service: UserApiService = TestBed.inject(UserApiService); diff --git a/ui/ui-frontend-common/src/app/modules/api/user-api.service.ts b/ui/ui-frontend-common/src/app/modules/api/user-api.service.ts index 859fe36d5c7..fbdc27d7e0a 100644 --- a/ui/ui-frontend-common/src/app/modules/api/user-api.service.ts +++ b/ui/ui-frontend-common/src/app/modules/api/user-api.service.ts @@ -44,19 +44,21 @@ import { Analytics } from '../models/user/analytics.interface'; import { User } from '../models/user/user.interface'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class UserApiService { - private readonly apiUrl: string; - constructor(private http: HttpClient, @Inject(BASE_URL) baseUrl: string, private authService: AuthService) { + constructor( + private http: HttpClient, + @Inject(BASE_URL) baseUrl: string, + private authService: AuthService, + ) { this.apiUrl = baseUrl + '/users'; } - public analytics(data: { applicationId?: string, lastTenantIdentifier?: number }): Observable { + public analytics(data: { applicationId?: string; lastTenantIdentifier?: number }): Observable { const headers = new HttpHeaders({ 'X-Tenant-Id': this.authService.getAnyTenantIdentifier() }); return this.http.post(this.apiUrl + '/analytics', data, { headers }); } - } diff --git a/ui/ui-frontend-common/src/app/modules/app-root-component.class.ts b/ui/ui-frontend-common/src/app/modules/app-root-component.class.ts index 22bd7067e13..826e19d7f9c 100644 --- a/ui/ui-frontend-common/src/app/modules/app-root-component.class.ts +++ b/ui/ui-frontend-common/src/app/modules/app-root-component.class.ts @@ -39,14 +39,15 @@ import { InjectorHelper } from './helper/injector-helper'; import { Logger } from './logger/logger'; export class AppRootComponent { - // tslint:disable-next-line:variable-name private _appId: string; public logger: Logger; constructor(route: ActivatedRoute) { - if (InjectorHelper.injector === undefined) { throw new Error('Injector not Found'); } + if (InjectorHelper.injector === undefined) { + throw new Error('Injector not Found'); + } this.logger = InjectorHelper.injector.get(Logger); route.data.subscribe((data) => { if (!data.hasOwnProperty('appId')) { @@ -60,5 +61,4 @@ export class AppRootComponent { get appId(): string { return this._appId; } - } diff --git a/ui/ui-frontend-common/src/app/modules/app.guard.spec.ts b/ui/ui-frontend-common/src/app/modules/app.guard.spec.ts index 34b4fa7203a..0ca667262ab 100644 --- a/ui/ui-frontend-common/src/app/modules/app.guard.spec.ts +++ b/ui/ui-frontend-common/src/app/modules/app.guard.spec.ts @@ -51,33 +51,37 @@ const expectedApp = [ id: 'CUSTOMERS_APP', identifier: 'CUSTOMERS_APP', name: 'Organisations', - url: '' + url: '', }, { id: 'USERS_APP', identifier: 'USERS_APP', name: 'Utilisateurs', - url: '' + url: '', }, { id: 'GROUPS_APP', identifier: 'GROUPS_APP', name: 'Groupes de profils', - url: '' + url: '', }, { id: 'PROFILES_APP', identifier: 'PROFILES_APP', name: 'Profils APP Utilisateurs', - url: '' + url: '', }, ]; class TranslateServiceStub { - setDefaultLang(lang: string) { } - use(lang: string) { } - instant() {return EMPTY; } - get onLangChange(){return of({lang: 'en'}); } + setDefaultLang(lang: string) {} + use(lang: string) {} + instant() { + return EMPTY; + } + get onLangChange() { + return of({ lang: 'en' }); + } } describe('AppGuard', () => { @@ -87,11 +91,11 @@ describe('AppGuard', () => { providers: [ AppGuard, { provide: AuthService, useValue: { user: { profileGroup: { profiles: [{ applicationName: 'USERS_APP' }] } } } }, - { provide: StartupService, useValue: { getPortalUrl: () => '', setTenantIdentifier: () => { } } }, + { provide: StartupService, useValue: { getPortalUrl: () => '', setTenantIdentifier: () => {} } }, { provide: ApplicationService, useValue: { applications: expectedApp } }, { provide: WINDOW_LOCATION, useValue: {} }, - { provide: TranslateService, useClass: TranslateServiceStub} - ] + { provide: TranslateService, useClass: TranslateServiceStub }, + ], }); }); @@ -107,14 +111,14 @@ describe('AppGuard', () => { it('should not allow and redirect if no profile match appId in user permissions', inject([AppGuard], (guard: AppGuard) => { const param: ActivatedRouteSnapshot = new ActivatedRouteSnapshot(); - param.data = {appId: 'BAD_APP'}; + param.data = { appId: 'BAD_APP' }; expect(guard.canActivate(param)).toBeFalsy(); })); it('should allow activation with good app', inject([AppGuard], (guard: AppGuard) => { const param: ActivatedRouteSnapshot = new ActivatedRouteSnapshot(); - param.data = {appId: 'USERS_APP'}; + param.data = { appId: 'USERS_APP' }; expect(guard.canActivate(param)).toBeTruthy(); })); diff --git a/ui/ui-frontend-common/src/app/modules/app.guard.ts b/ui/ui-frontend-common/src/app/modules/app.guard.ts index dabc3934fc3..99cd5558786 100644 --- a/ui/ui-frontend-common/src/app/modules/app.guard.ts +++ b/ui/ui-frontend-common/src/app/modules/app.guard.ts @@ -48,22 +48,19 @@ import { StartupService } from './startup.service'; const APPLICATION_TRANSLATE_PATH = 'APPLICATION'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class AppGuard implements CanActivate { - constructor( private authService: AuthService, private startupService: StartupService, private titleService: Title, private globalEventService: GlobalEventService, @Inject(WINDOW_LOCATION) private location: any, - private translateService: TranslateService - ) {} + private translateService: TranslateService, + ) {} - canActivate( - next: ActivatedRouteSnapshot - ): Observable | Promise | boolean { + canActivate(next: ActivatedRouteSnapshot): Observable | Promise | boolean { if (!next.data.hasOwnProperty('appId')) { console.error('AppGuard Error: Missing "appId" property in route declaration. Please add the property to the route\'s data'); return false; diff --git a/ui/ui-frontend-common/src/app/modules/application.service.ts b/ui/ui-frontend-common/src/app/modules/application.service.ts index 25cf441a835..45370a02cb8 100644 --- a/ui/ui-frontend-common/src/app/modules/application.service.ts +++ b/ui/ui-frontend-common/src/app/modules/application.service.ts @@ -85,7 +85,7 @@ export class ApplicationService { private applicationApi: ApplicationApiService, private authService: AuthService, private tenantService: TenantSelectionService, - private globalEventService: GlobalEventService + private globalEventService: GlobalEventService, ) {} /** @@ -101,7 +101,7 @@ export class ApplicationService { this._categories = this.sortCategories(applicationInfo.CATEGORY_CONFIGURATION); this._applications$.next(this._applications); return applicationInfo; - }) + }), ); } @@ -111,7 +111,7 @@ export class ApplicationService { public getActiveTenantAppsMap(): Observable> { return this.tenantService.getSelectedTenant$().pipe( mergeMap((tenant: Tenant) => this.getTenantAppMap(tenant)), - tap((appMap: Map) => this.appMap$.next(appMap)) + tap((appMap: Map) => this.appMap$.next(appMap)), ); } @@ -143,7 +143,7 @@ export class ApplicationService { const convertedMap = this.convertToCategoryMap(resultMap); return this.sortMapByCategory(convertedMap); } - }) + }), ); } @@ -203,9 +203,9 @@ export class ApplicationService { return true; } return app ? app.hasTenantList : false; - }) + }), ); - }) + }), ); } @@ -214,14 +214,14 @@ export class ApplicationService { catchError(() => of([])), map((result: boolean) => { return result; - }) + }), ); } public getApplications$(): Observable { return this._applications$.pipe( filter((apps: Application[]) => !!apps), - take(1) + take(1), ); } diff --git a/ui/ui-frontend-common/src/app/modules/auth.guard.spec.ts b/ui/ui-frontend-common/src/app/modules/auth.guard.spec.ts index 1573da3ed2e..5374efbc80a 100644 --- a/ui/ui-frontend-common/src/app/modules/auth.guard.spec.ts +++ b/ui/ui-frontend-common/src/app/modules/auth.guard.spec.ts @@ -43,11 +43,7 @@ import { WINDOW_LOCATION } from './injection-tokens'; describe('AuthGuard', () => { beforeEach(() => { TestBed.configureTestingModule({ - providers: [ - { provide: WINDOW_LOCATION, useValue: {} }, - { provide: AuthService, useValue: {} }, - AuthGuard, - ] + providers: [{ provide: WINDOW_LOCATION, useValue: {} }, { provide: AuthService, useValue: {} }, AuthGuard], }); }); diff --git a/ui/ui-frontend-common/src/app/modules/auth.guard.ts b/ui/ui-frontend-common/src/app/modules/auth.guard.ts index be458524e77..ff1da17023b 100644 --- a/ui/ui-frontend-common/src/app/modules/auth.guard.ts +++ b/ui/ui-frontend-common/src/app/modules/auth.guard.ts @@ -42,14 +42,12 @@ import { CanActivate } from '@angular/router'; import { AuthService } from './auth.service'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class AuthGuard implements CanActivate { - constructor(private authService: AuthService) {} canActivate(): Observable | Promise | boolean { return !!this.authService.user; } - } diff --git a/ui/ui-frontend-common/src/app/modules/auth.service.ts b/ui/ui-frontend-common/src/app/modules/auth.service.ts index 7f83dc65497..63da3039c92 100644 --- a/ui/ui-frontend-common/src/app/modules/auth.service.ts +++ b/ui/ui-frontend-common/src/app/modules/auth.service.ts @@ -42,10 +42,9 @@ import { WINDOW_LOCATION } from './injection-tokens'; import { AuthUser, Tenant, User, UserInfo } from './models'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class AuthService { - get userInfo(): UserInfo { return this._userInfo; } @@ -75,10 +74,13 @@ export class AuthService { private _userInfo: UserInfo; private userInfo$ = new BehaviorSubject(null); - constructor(@Inject(WINDOW_LOCATION) private location: any) { } + constructor(@Inject(WINDOW_LOCATION) private location: any) {} public getUser$(): Observable { - return this.user$.pipe(filter((user: AuthUser) => !!user), take(1)); + return this.user$.pipe( + filter((user: AuthUser) => !!user), + take(1), + ); } logout() { @@ -152,6 +154,9 @@ export class AuthService { } public getUserInfo$(): Observable { - return this.userInfo$.pipe(filter((userInfo: UserInfo) => !!userInfo), take(1)); + return this.userInfo$.pipe( + filter((userInfo: UserInfo) => !!userInfo), + take(1), + ); } } diff --git a/ui/ui-frontend-common/src/app/modules/base-http-client.ts b/ui/ui-frontend-common/src/app/modules/base-http-client.ts index 9b5ed672d6d..59e7bcc345e 100644 --- a/ui/ui-frontend-common/src/app/modules/base-http-client.ts +++ b/ui/ui-frontend-common/src/app/modules/base-http-client.ts @@ -45,8 +45,10 @@ import { PageRequest, PaginatedResponse } from './vitamui-table'; const HTTP_STATUS_OK = 200; export abstract class BaseHttpClient { - - constructor(protected http: HttpClient, protected readonly apiUrl: string) {} + constructor( + protected http: HttpClient, + protected readonly apiUrl: string, + ) {} protected getHttp() { return this.http; @@ -78,14 +80,15 @@ export abstract class BaseHttpClient { return this.http.get(this.apiUrl + '/' + id, { params, headers }); } - protected checkExistsByParam(params: Array<{ key: string, value: string }>, headers?: HttpHeaders): Observable { - const paramsToHttpParams = (tempHttpParams: HttpParams, param: { key: string, value: string }) => { + protected checkExistsByParam(params: Array<{ key: string; value: string }>, headers?: HttpHeaders): Observable { + const paramsToHttpParams = (tempHttpParams: HttpParams, param: { key: string; value: string }) => { return tempHttpParams.set(param.key, param.value); }; const httpParams = params.reduce(paramsToHttpParams, new HttpParams()); - return this.http.head(this.apiUrl + '/check', { params: httpParams, observe: 'response', headers }) - .pipe(map((response: HttpResponse) => response.status === HTTP_STATUS_OK ? true : false)); + return this.http + .head(this.apiUrl + '/check', { params: httpParams, observe: 'response', headers }) + .pipe(map((response: HttpResponse) => (response.status === HTTP_STATUS_OK ? true : false))); } protected create(data: T, headers?: HttpHeaders): Observable { @@ -96,14 +99,13 @@ export abstract class BaseHttpClient { return this.http.put(this.apiUrl + '/' + data.id, data, { headers }); } - protected patch(data: { id: string, [key: string]: any }, headers?: HttpHeaders): Observable { + protected patch(data: { id: string; [key: string]: any }, headers?: HttpHeaders): Observable { return this.http.patch(this.apiUrl + '/' + data.id, data, { headers }); } public logbook(id: string, headers?: HttpHeaders): Observable<{ $results: Event[] }> { - return this.http.get<{ $results: ApiEvent[] }>(this.apiUrl + '/' + id + '/logbook', {headers}).pipe( - map((response) => ({ $results: response.$results.map(LogbookApiService.toEvent) })) - ); + return this.http + .get<{ $results: ApiEvent[] }>(this.apiUrl + '/' + id + '/logbook', { headers }) + .pipe(map((response) => ({ $results: response.$results.map(LogbookApiService.toEvent) }))); } - } diff --git a/ui/ui-frontend-common/src/app/modules/components/application-select-content/application-select-content.component.html b/ui/ui-frontend-common/src/app/modules/components/application-select-content/application-select-content.component.html index 3be6dc7f407..7a56f4f8538 100644 --- a/ui/ui-frontend-common/src/app/modules/components/application-select-content/application-select-content.component.html +++ b/ui/ui-frontend-common/src/app/modules/components/application-select-content/application-select-content.component.html @@ -1,11 +1,16 @@ -
    {{ category.title }}
    +
    + {{ category.title }} +
    - +
    diff --git a/ui/ui-frontend-common/src/app/modules/components/application-select-content/application-select-content.component.scss b/ui/ui-frontend-common/src/app/modules/components/application-select-content/application-select-content.component.scss index bfbb26e3bd8..f0b2fb8ed49 100644 --- a/ui/ui-frontend-common/src/app/modules/components/application-select-content/application-select-content.component.scss +++ b/ui/ui-frontend-common/src/app/modules/components/application-select-content/application-select-content.component.scss @@ -1,26 +1,26 @@ @import '../../../../sass/variables/colors'; .app-container { - margin-bottom: 20px; + margin-bottom: 20px; } .modal-container { - margin-top: 9px; - margin-bottom: 16px; + margin-top: 9px; + margin-bottom: 16px; } .ext-app-container { - margin-bottom: 20px; + margin-bottom: 20px; } .category-header { - font-size: 20px; - color: $charcoal-grey-two; - padding-bottom: 10px; - padding-left: 25px; + font-size: 20px; + color: $charcoal-grey-two; + padding-bottom: 10px; + padding-left: 25px; } .modal-category { - font-size: 16px; - padding-left: 20px; + font-size: 16px; + padding-left: 20px; } diff --git a/ui/ui-frontend-common/src/app/modules/components/application-select-content/application-select-content.component.spec.ts b/ui/ui-frontend-common/src/app/modules/components/application-select-content/application-select-content.component.spec.ts index 0a2318a9790..5eec17b3459 100644 --- a/ui/ui-frontend-common/src/app/modules/components/application-select-content/application-select-content.component.spec.ts +++ b/ui/ui-frontend-common/src/app/modules/components/application-select-content/application-select-content.component.spec.ts @@ -44,7 +44,7 @@ import { ApplicationSelectContentComponent } from './application-select-content. @Component({ selector: 'vitamui-common-menu-tile', - template: '' + template: '', }) class VitamUIMenuTileStubComponent { @Input() application: any; @@ -57,16 +57,12 @@ describe('ApplicationSelectContentComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - declarations: [ - ApplicationSelectContentComponent, - VitamUIMenuTileStubComponent, - ], + declarations: [ApplicationSelectContentComponent, VitamUIMenuTileStubComponent], providers: [ { provide: WINDOW_LOCATION, useValue: {} }, { provide: AuthService, useValue: {} }, - ] - }) - .compileComponents(); + ], + }).compileComponents(); })); beforeEach(() => { diff --git a/ui/ui-frontend-common/src/app/modules/components/application-select-content/application-select-content.component.ts b/ui/ui-frontend-common/src/app/modules/components/application-select-content/application-select-content.component.ts index 1bb134a7e7b..2d18d0333ae 100644 --- a/ui/ui-frontend-common/src/app/modules/components/application-select-content/application-select-content.component.ts +++ b/ui/ui-frontend-common/src/app/modules/components/application-select-content/application-select-content.component.ts @@ -42,10 +42,9 @@ import { Category } from '../../models/application/category.interface'; @Component({ selector: 'vitamui-common-application-select-content', templateUrl: './application-select-content.component.html', - styleUrls: ['./application-select-content.component.scss'] + styleUrls: ['./application-select-content.component.scss'], }) export class ApplicationSelectContentComponent { - @Input() isModalMenu: boolean; @Input() @@ -56,7 +55,9 @@ export class ApplicationSelectContentComponent { this.computeAppCategories(); } } - get applications(): Application[] { return this._applications; } + get applications(): Application[] { + return this._applications; + } // tslint:disable-next-line:variable-name private _applications: Application[]; @@ -67,17 +68,21 @@ export class ApplicationSelectContentComponent { this.computeAppCategories(); } } - get categories(): Category[] { return this._categories; } + get categories(): Category[] { + return this._categories; + } // tslint:disable-next-line:variable-name private _categories: Category[]; @Output() applicationSelected = new EventEmitter(); - get target(): string { return '_blank'; } + get target(): string { + return '_blank'; + } categoryList: any[]; - constructor(private authService: AuthService) { } + constructor(private authService: AuthService) {} checkTenantNumberByApp(apps: Application[]) { apps.forEach((application) => { @@ -102,17 +107,17 @@ export class ApplicationSelectContentComponent { title: 'Autres', // FIXME : MDI - handle this property when translating categories displayTitle: true, order: 99, - applications: [] + applications: [], }; this.categoryList.push(defaultCategory); // recreate categories list before assembling applications by categories // add a default category in order to view applications linked to a non existent category - this.categories.forEach(category => { + this.categories.forEach((category) => { if (category.identifier === 'default') { // do not compute category when identifier is the default ; } else { - const categoryTmp: any = this._categories.find(tmp => tmp.identifier === category.identifier); + const categoryTmp: any = this._categories.find((tmp) => tmp.identifier === category.identifier); categoryTmp.identifier = category.identifier; categoryTmp.applications = []; this.categoryList.push(categoryTmp); @@ -120,7 +125,7 @@ export class ApplicationSelectContentComponent { } }); - this.categoryList.forEach(category => { + this.categoryList.forEach((category) => { if (category.identifier === 'default') { category.applications = sortedApps.filter((app) => !identifiers.includes(app.category)); } else { diff --git a/ui/ui-frontend-common/src/app/modules/components/application-select-content/application-select-content.module.ts b/ui/ui-frontend-common/src/app/modules/components/application-select-content/application-select-content.module.ts index 665e9bb4739..2d222b64b7a 100644 --- a/ui/ui-frontend-common/src/app/modules/components/application-select-content/application-select-content.module.ts +++ b/ui/ui-frontend-common/src/app/modules/components/application-select-content/application-select-content.module.ts @@ -43,13 +43,8 @@ import { VitamUIMenuTileModule } from '../vitamui-menu-tile/vitamui-menu-tile.mo import { ApplicationSelectContentComponent } from './application-select-content.component'; @NgModule({ - imports: [ - CommonModule, - HttpClientModule, - RouterModule, - VitamUIMenuTileModule, - ], + imports: [CommonModule, HttpClientModule, RouterModule, VitamUIMenuTileModule], declarations: [ApplicationSelectContentComponent], exports: [ApplicationSelectContentComponent], }) -export class ApplicationSelectContentModule { } +export class ApplicationSelectContentModule {} diff --git a/ui/ui-frontend-common/src/app/modules/components/blank/blank.component.html b/ui/ui-frontend-common/src/app/modules/components/blank/blank.component.html index 1c11e074e74..8ac86974fd5 100644 --- a/ui/ui-frontend-common/src/app/modules/components/blank/blank.component.html +++ b/ui/ui-frontend-common/src/app/modules/components/blank/blank.component.html @@ -1,5 +1,5 @@
    - +
    diff --git a/ui/ui-frontend-common/src/app/modules/components/blank/blank.component.ts b/ui/ui-frontend-common/src/app/modules/components/blank/blank.component.ts index 9911f54964b..a79b8f4235b 100644 --- a/ui/ui-frontend-common/src/app/modules/components/blank/blank.component.ts +++ b/ui/ui-frontend-common/src/app/modules/components/blank/blank.component.ts @@ -41,18 +41,16 @@ import { ApplicationId } from '../../application-id.enum'; @Component({ selector: 'vitamui-common-blank', templateUrl: './blank.component.html', - styleUrls: ['./blank.component.scss'] + styleUrls: ['./blank.component.scss'], }) export class BlankComponent { - appId: ApplicationId; hideTenantMenu = true; hideCustomerMenu = true; constructor(private route: ActivatedRoute) { this.route.data.subscribe((data) => { - this.appId = data.appId; + this.appId = data.appId; }); } - } diff --git a/ui/ui-frontend-common/src/app/modules/components/cancelled-snack-bar/cancelled-snack-bar.component.html b/ui/ui-frontend-common/src/app/modules/components/cancelled-snack-bar/cancelled-snack-bar.component.html index cc3ba812d09..9260553a60a 100644 --- a/ui/ui-frontend-common/src/app/modules/components/cancelled-snack-bar/cancelled-snack-bar.component.html +++ b/ui/ui-frontend-common/src/app/modules/components/cancelled-snack-bar/cancelled-snack-bar.component.html @@ -1,9 +1,7 @@
    - - info {{'DOWNLOAD.CANCELLED' | translate}} + info {{ 'DOWNLOAD.CANCELLED' | translate }} -
    diff --git a/ui/ui-frontend-common/src/app/modules/components/cancelled-snack-bar/cancelled-snack-bar.component.scss b/ui/ui-frontend-common/src/app/modules/components/cancelled-snack-bar/cancelled-snack-bar.component.scss index ef5debcd64b..8c053302ad4 100644 --- a/ui/ui-frontend-common/src/app/modules/components/cancelled-snack-bar/cancelled-snack-bar.component.scss +++ b/ui/ui-frontend-common/src/app/modules/components/cancelled-snack-bar/cancelled-snack-bar.component.scss @@ -1,3 +1,3 @@ .cancelled-label { - padding: 15px; + padding: 15px; } diff --git a/ui/ui-frontend-common/src/app/modules/components/cancelled-snack-bar/cancelled-snack-bar.component.spec.ts b/ui/ui-frontend-common/src/app/modules/components/cancelled-snack-bar/cancelled-snack-bar.component.spec.ts index 0d7718e1e97..dc341e1e88b 100644 --- a/ui/ui-frontend-common/src/app/modules/components/cancelled-snack-bar/cancelled-snack-bar.component.spec.ts +++ b/ui/ui-frontend-common/src/app/modules/components/cancelled-snack-bar/cancelled-snack-bar.component.spec.ts @@ -49,16 +49,12 @@ describe('CancelledSnackBarComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ declarations: [CancelledSnackBarComponent], - imports: [ - HttpClientTestingModule, - TranslateModule.forRoot(), - ], + imports: [HttpClientTestingModule, TranslateModule.forRoot()], providers: [ { provide: WINDOW_LOCATION, useValue: {} }, - { provide: MatSnackBarRef, useValue: { close: () => { } } }, - ] - }) - .compileComponents(); + { provide: MatSnackBarRef, useValue: { close: () => {} } }, + ], + }).compileComponents(); })); beforeEach(() => { diff --git a/ui/ui-frontend-common/src/app/modules/components/cancelled-snack-bar/cancelled-snack-bar.component.ts b/ui/ui-frontend-common/src/app/modules/components/cancelled-snack-bar/cancelled-snack-bar.component.ts index ada6e5f6ed2..a66d5e8addc 100644 --- a/ui/ui-frontend-common/src/app/modules/components/cancelled-snack-bar/cancelled-snack-bar.component.ts +++ b/ui/ui-frontend-common/src/app/modules/components/cancelled-snack-bar/cancelled-snack-bar.component.ts @@ -40,14 +40,12 @@ import { MatSnackBarRef } from '@angular/material/snack-bar'; @Component({ selector: 'vitamui-common-cancelled-snack-bar', templateUrl: './cancelled-snack-bar.component.html', - styleUrls: ['./cancelled-snack-bar.component.scss'] + styleUrls: ['./cancelled-snack-bar.component.scss'], }) export class CancelledSnackBarComponent { - constructor(private matSnackBarRef: MatSnackBarRef) {} close() { this.matSnackBarRef.dismiss(); } - } diff --git a/ui/ui-frontend-common/src/app/modules/components/cancelled-snack-bar/cancelled-snack-bar.module.ts b/ui/ui-frontend-common/src/app/modules/components/cancelled-snack-bar/cancelled-snack-bar.module.ts index 18be4377a6e..2ff8fe70659 100644 --- a/ui/ui-frontend-common/src/app/modules/components/cancelled-snack-bar/cancelled-snack-bar.module.ts +++ b/ui/ui-frontend-common/src/app/modules/components/cancelled-snack-bar/cancelled-snack-bar.module.ts @@ -40,21 +40,10 @@ import { MatDialogModule } from '@angular/material/dialog'; import { TranslateModule } from '@ngx-translate/core'; import { CancelledSnackBarComponent } from './cancelled-snack-bar.component'; - @NgModule({ - imports: [ - CommonModule, - MatDialogModule, - TranslateModule, - ], - declarations: [ - CancelledSnackBarComponent, - ], - exports: [ - CancelledSnackBarComponent, - ], - entryComponents: [ - CancelledSnackBarComponent, - ] + imports: [CommonModule, MatDialogModule, TranslateModule], + declarations: [CancelledSnackBarComponent], + exports: [CancelledSnackBarComponent], + entryComponents: [CancelledSnackBarComponent], }) -export class CancelledSnackBarModule { } +export class CancelledSnackBarModule {} diff --git a/ui/ui-frontend-common/src/app/modules/components/collapse/collapse.component.html b/ui/ui-frontend-common/src/app/modules/components/collapse/collapse.component.html index ba71b86da95..df142740bac 100644 --- a/ui/ui-frontend-common/src/app/modules/components/collapse/collapse.component.html +++ b/ui/ui-frontend-common/src/app/modules/components/collapse/collapse.component.html @@ -1,4 +1,4 @@
    - keyboard_arrow_down {{collapseTitle}} + keyboard_arrow_down {{ collapseTitle }}
    diff --git a/ui/ui-frontend-common/src/app/modules/components/collapse/collapse.component.scss b/ui/ui-frontend-common/src/app/modules/components/collapse/collapse.component.scss index 8349a7db56b..aa494ea8177 100644 --- a/ui/ui-frontend-common/src/app/modules/components/collapse/collapse.component.scss +++ b/ui/ui-frontend-common/src/app/modules/components/collapse/collapse.component.scss @@ -1,11 +1,11 @@ :host.collapse-container { - .collapse-title { - width: 100%; - margin-bottom: 10px; - cursor: pointer; - } + .collapse-title { + width: 100%; + margin-bottom: 10px; + cursor: pointer; + } - .collapse-content { - overflow: hidden; - } + .collapse-content { + overflow: hidden; + } } diff --git a/ui/ui-frontend-common/src/app/modules/components/collapse/collapse.component.spec.ts b/ui/ui-frontend-common/src/app/modules/components/collapse/collapse.component.spec.ts index ac1acf90891..f5ae60b0f09 100644 --- a/ui/ui-frontend-common/src/app/modules/components/collapse/collapse.component.spec.ts +++ b/ui/ui-frontend-common/src/app/modules/components/collapse/collapse.component.spec.ts @@ -41,11 +41,7 @@ import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { CollapseComponent } from './collapse.component'; @Component({ - template: ` - - Test Collapse Content - - ` + template: ` Test Collapse Content `, }) class TesthostComponent { @ViewChild(CollapseComponent) component: CollapseComponent; @@ -57,10 +53,9 @@ describe('CollapseComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [ NoopAnimationsModule ], - declarations: [ CollapseComponent, TesthostComponent ] - }) - .compileComponents(); + imports: [NoopAnimationsModule], + declarations: [CollapseComponent, TesthostComponent], + }).compileComponents(); })); beforeEach(() => { @@ -96,6 +91,5 @@ describe('CollapseComponent', () => { elTitle.click(); fixture.detectChanges(); expect(testhost.component.collapseState).toBe('expanded'); - }); }); diff --git a/ui/ui-frontend-common/src/app/modules/components/collapse/collapse.component.ts b/ui/ui-frontend-common/src/app/modules/components/collapse/collapse.component.ts index 9193909e41c..715177a8fb8 100644 --- a/ui/ui-frontend-common/src/app/modules/components/collapse/collapse.component.ts +++ b/ui/ui-frontend-common/src/app/modules/components/collapse/collapse.component.ts @@ -43,26 +43,20 @@ import { collapseAnimation, rotate90Animation } from '../../animations/vitamui-c templateUrl: './collapse.component.html', styleUrls: ['./collapse.component.scss'], exportAs: 'vitamuiCommonCollapse', - animations: [ - collapseAnimation, - rotate90Animation, - ] + animations: [collapseAnimation, rotate90Animation], }) export class CollapseComponent implements OnInit { - @HostBinding('class.collapse-container') classCollapseContainer = true; @Input() collapseTitle: string; @Input() collapseState = 'expanded'; - constructor() { } + constructor() {} - ngOnInit() { - } + ngOnInit() {} toggle() { this.collapseState = this.collapseState === 'expanded' ? 'collapsed' : 'expanded'; } - } diff --git a/ui/ui-frontend-common/src/app/modules/components/collapse/collapse.module.ts b/ui/ui-frontend-common/src/app/modules/components/collapse/collapse.module.ts index dcfab9d8d59..df3e2098b11 100644 --- a/ui/ui-frontend-common/src/app/modules/components/collapse/collapse.module.ts +++ b/ui/ui-frontend-common/src/app/modules/components/collapse/collapse.module.ts @@ -40,10 +40,8 @@ import { NgModule } from '@angular/core'; import { CollapseComponent } from './collapse.component'; @NgModule({ - imports: [ - CommonModule, - ], + imports: [CommonModule], declarations: [CollapseComponent], - exports: [CollapseComponent] + exports: [CollapseComponent], }) -export class CollapseModule { } +export class CollapseModule {} diff --git a/ui/ui-frontend-common/src/app/modules/components/common-progress-bar/common-progress-bar.component.html b/ui/ui-frontend-common/src/app/modules/components/common-progress-bar/common-progress-bar.component.html index f50a0bfceb6..f8e380cf3d7 100644 --- a/ui/ui-frontend-common/src/app/modules/components/common-progress-bar/common-progress-bar.component.html +++ b/ui/ui-frontend-common/src/app/modules/components/common-progress-bar/common-progress-bar.component.html @@ -1,4 +1,2 @@ -
    - {{'PROGRESS_BAR.STEP' | translate}} {{index +1 }} / {{count}} -
    +
    {{ 'PROGRESS_BAR.STEP' | translate }} {{ index + 1 }} / {{ count }}
    diff --git a/ui/ui-frontend-common/src/app/modules/components/common-progress-bar/common-progress-bar.component.scss b/ui/ui-frontend-common/src/app/modules/components/common-progress-bar/common-progress-bar.component.scss index 2f1544fcbb9..68df7bdf99c 100644 --- a/ui/ui-frontend-common/src/app/modules/components/common-progress-bar/common-progress-bar.component.scss +++ b/ui/ui-frontend-common/src/app/modules/components/common-progress-bar/common-progress-bar.component.scss @@ -2,7 +2,7 @@ transition: width 250ms ease; } -.tooltip-custom{ +.tooltip-custom { display: inline-flex; padding: 5px 8px; background-color: var(--vitamui-primary); @@ -14,14 +14,14 @@ margin-left: -14px; margin-right: -37px; - &:before { - content: ""; - position: absolute; - bottom: -5px; - width: 0; - height: 0; - border-style: solid; - border-width: 5px 5px 0; - border-color: var(--vitamui-primary) transparent transparent transparent; - } + &:before { + content: ''; + position: absolute; + bottom: -5px; + width: 0; + height: 0; + border-style: solid; + border-width: 5px 5px 0; + border-color: var(--vitamui-primary) transparent transparent transparent; + } } diff --git a/ui/ui-frontend-common/src/app/modules/components/common-tooltip/common-tooltip.component.html b/ui/ui-frontend-common/src/app/modules/components/common-tooltip/common-tooltip.component.html index c20e6a4932a..a1829687b14 100644 --- a/ui/ui-frontend-common/src/app/modules/components/common-tooltip/common-tooltip.component.html +++ b/ui/ui-frontend-common/src/app/modules/components/common-tooltip/common-tooltip.component.html @@ -1,3 +1,3 @@ -
    -
    {{ text }}
    -
    +
    +
    {{ text }}
    +
    diff --git a/ui/ui-frontend-common/src/app/modules/components/common-tooltip/common-tooltip.component.scss b/ui/ui-frontend-common/src/app/modules/components/common-tooltip/common-tooltip.component.scss index a81b6e11719..342311d162c 100644 --- a/ui/ui-frontend-common/src/app/modules/components/common-tooltip/common-tooltip.component.scss +++ b/ui/ui-frontend-common/src/app/modules/components/common-tooltip/common-tooltip.component.scss @@ -18,7 +18,7 @@ max-width: 200px; &:before { - content: ""; + content: ''; position: absolute; background-color: var(--color); diff --git a/ui/ui-frontend-common/src/app/modules/components/common-tooltip/common-tooltip.component.ts b/ui/ui-frontend-common/src/app/modules/components/common-tooltip/common-tooltip.component.ts index 8cace0cc1fc..31166b39446 100644 --- a/ui/ui-frontend-common/src/app/modules/components/common-tooltip/common-tooltip.component.ts +++ b/ui/ui-frontend-common/src/app/modules/components/common-tooltip/common-tooltip.component.ts @@ -41,22 +41,15 @@ import { fadeInOutAnimation } from '../../animations'; selector: 'vitamui-common-tooltip', templateUrl: './common-tooltip.component.html', styleUrls: ['./common-tooltip.component.scss'], - animations: [ - fadeInOutAnimation, - ], + animations: [fadeInOutAnimation], }) export class CommonTooltipComponent implements OnInit { - - constructor() { } + constructor() {} public text = ''; public position: string; public outline: boolean; public className: string; - ngOnInit() { - } - - - + ngOnInit() {} } diff --git a/ui/ui-frontend-common/src/app/modules/components/common-tooltip/common-tooltip.directive.ts b/ui/ui-frontend-common/src/app/modules/components/common-tooltip/common-tooltip.directive.ts index 0bff878c28e..dbcfecfd0be 100644 --- a/ui/ui-frontend-common/src/app/modules/components/common-tooltip/common-tooltip.directive.ts +++ b/ui/ui-frontend-common/src/app/modules/components/common-tooltip/common-tooltip.directive.ts @@ -35,22 +35,9 @@ * knowledge of the CeCILL-C license and that you accept its terms. */ import { coerceBooleanProperty } from '@angular/cdk/coercion'; -import { - ConnectedPosition, - Overlay, - OverlayPositionBuilder, - OverlayRef, -} from '@angular/cdk/overlay'; +import { ConnectedPosition, Overlay, OverlayPositionBuilder, OverlayRef } from '@angular/cdk/overlay'; import { ComponentPortal } from '@angular/cdk/portal'; -import { - ComponentRef, - Directive, - ElementRef, - HostListener, - Input, - OnDestroy, - OnInit, -} from '@angular/core'; +import { ComponentRef, Directive, ElementRef, HostListener, Input, OnDestroy, OnInit } from '@angular/core'; import { CommonTooltipComponent } from './common-tooltip.component'; import { TooltipPosition } from './TooltipPosition.enum'; import { TooltipType } from './TooltipType.enum'; @@ -65,9 +52,11 @@ export class CommonTooltipDirective implements OnInit, OnDestroy { @Input() vitamuiCommonToolTipClass: string; @Input() type = 'BOTTOM'; - /** Disables the display of the tooltip. */ + /** Disables the display of the tooltip. */ @Input('vitamuiCommonToolTipDisabled') - get disabled(): boolean { return this._disabled; } + get disabled(): boolean { + return this._disabled; + } set disabled(value) { this._disabled = coerceBooleanProperty(value); @@ -84,16 +73,14 @@ export class CommonTooltipDirective implements OnInit, OnDestroy { constructor( private overlay: Overlay, private overlayPositionBuilder: OverlayPositionBuilder, - private elementRef: ElementRef + private elementRef: ElementRef, ) {} ngOnInit(): void { - const position = this.buildPosition(this.type); - const positionStrategy = this.overlayPositionBuilder - .flexibleConnectedTo(this.elementRef) - .withPositions([position]); + const position = this.buildPosition(this.type); + const positionStrategy = this.overlayPositionBuilder.flexibleConnectedTo(this.elementRef).withPositions([position]); - this.overlayRef = this.overlay.create({ positionStrategy }); + this.overlayRef = this.overlay.create({ positionStrategy }); } ngOnDestroy() { @@ -107,9 +94,7 @@ export class CommonTooltipDirective implements OnInit, OnDestroy { } const tooltipPortal = new ComponentPortal(CommonTooltipComponent); if (this.overlayRef) { - const tooltipRef: ComponentRef = this.overlayRef.attach( - tooltipPortal - ); + const tooltipRef: ComponentRef = this.overlayRef.attach(tooltipPortal); tooltipRef.instance.text = this.text; tooltipRef.instance.position = this.position; tooltipRef.instance.outline = this.outline; @@ -119,8 +104,8 @@ export class CommonTooltipDirective implements OnInit, OnDestroy { @HostListener('mouseout') hide() { - this.overlayRef?.detach(); - this.overlayRef.detach(); + this.overlayRef?.detach(); + this.overlayRef.detach(); } private buildPosition(type: string): ConnectedPosition { diff --git a/ui/ui-frontend-common/src/app/modules/components/confirm-dialog/close-popup-dialog.component.html b/ui/ui-frontend-common/src/app/modules/components/confirm-dialog/close-popup-dialog.component.html index c75e42276cd..60e8a06b73e 100644 --- a/ui/ui-frontend-common/src/app/modules/components/confirm-dialog/close-popup-dialog.component.html +++ b/ui/ui-frontend-common/src/app/modules/components/confirm-dialog/close-popup-dialog.component.html @@ -3,5 +3,5 @@ [confirmLabel]="'COMMON.CLOSE' | translate" [cancelLabel]="'COMMON.BACK' | translate" > - {{'COMMON.UNDO_MODAL.UNDO_MESSAGE' | translate}} + {{ 'COMMON.UNDO_MODAL.UNDO_MESSAGE' | translate }} diff --git a/ui/ui-frontend-common/src/app/modules/components/confirm-dialog/close-popup-dialog.component.spec.ts b/ui/ui-frontend-common/src/app/modules/components/confirm-dialog/close-popup-dialog.component.spec.ts index 35bafbe93ef..d83eb6d8ff8 100644 --- a/ui/ui-frontend-common/src/app/modules/components/confirm-dialog/close-popup-dialog.component.spec.ts +++ b/ui/ui-frontend-common/src/app/modules/components/confirm-dialog/close-popup-dialog.component.spec.ts @@ -47,10 +47,9 @@ describe('ClosePopupDialogComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [VitamUICommonTestModule], - declarations: [ ClosePopupDialogComponent ], - schemas: [NO_ERRORS_SCHEMA] - }) - .compileComponents(); + declarations: [ClosePopupDialogComponent], + schemas: [NO_ERRORS_SCHEMA], + }).compileComponents(); })); beforeEach(() => { diff --git a/ui/ui-frontend-common/src/app/modules/components/confirm-dialog/close-popup-dialog.component.ts b/ui/ui-frontend-common/src/app/modules/components/confirm-dialog/close-popup-dialog.component.ts index b53c7281776..381545e6936 100644 --- a/ui/ui-frontend-common/src/app/modules/components/confirm-dialog/close-popup-dialog.component.ts +++ b/ui/ui-frontend-common/src/app/modules/components/confirm-dialog/close-popup-dialog.component.ts @@ -39,13 +39,10 @@ import { Component, OnInit } from '@angular/core'; @Component({ selector: 'vitamui-common-close-popup-dialog', templateUrl: './close-popup-dialog.component.html', - styleUrls: ['./close-popup-dialog.component.scss'] + styleUrls: ['./close-popup-dialog.component.scss'], }) export class ClosePopupDialogComponent implements OnInit { + constructor() {} - constructor() { } - - ngOnInit() { - } - + ngOnInit() {} } diff --git a/ui/ui-frontend-common/src/app/modules/components/confirm-dialog/confirm-dialog.component.html b/ui/ui-frontend-common/src/app/modules/components/confirm-dialog/confirm-dialog.component.html index 8982185a381..587450bbabc 100644 --- a/ui/ui-frontend-common/src/app/modules/components/confirm-dialog/confirm-dialog.component.html +++ b/ui/ui-frontend-common/src/app/modules/components/confirm-dialog/confirm-dialog.component.html @@ -4,9 +4,9 @@

    {{ dialogTitle }}

    diff --git a/ui/ui-frontend-common/src/app/modules/components/confirm-dialog/confirm-dialog.component.spec.ts b/ui/ui-frontend-common/src/app/modules/components/confirm-dialog/confirm-dialog.component.spec.ts index 8355f165349..2f9a50be9ba 100644 --- a/ui/ui-frontend-common/src/app/modules/components/confirm-dialog/confirm-dialog.component.spec.ts +++ b/ui/ui-frontend-common/src/app/modules/components/confirm-dialog/confirm-dialog.component.spec.ts @@ -46,13 +46,9 @@ describe('ConfirmDialogComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [ - MatDialogModule, - VitamUICommonTestModule - ], - declarations: [ ConfirmDialogComponent ] - }) - .compileComponents(); + imports: [MatDialogModule, VitamUICommonTestModule], + declarations: [ConfirmDialogComponent], + }).compileComponents(); })); beforeEach(() => { diff --git a/ui/ui-frontend-common/src/app/modules/components/confirm-dialog/confirm-dialog.component.ts b/ui/ui-frontend-common/src/app/modules/components/confirm-dialog/confirm-dialog.component.ts index 5697cbdc6f9..037f9988005 100644 --- a/ui/ui-frontend-common/src/app/modules/components/confirm-dialog/confirm-dialog.component.ts +++ b/ui/ui-frontend-common/src/app/modules/components/confirm-dialog/confirm-dialog.component.ts @@ -39,17 +39,14 @@ import { Component, Input, OnInit } from '@angular/core'; @Component({ selector: 'vitamui-common-confirm-dialog', templateUrl: './confirm-dialog.component.html', - styleUrls: ['./confirm-dialog.component.scss'] + styleUrls: ['./confirm-dialog.component.scss'], }) export class ConfirmDialogComponent implements OnInit { - @Input() dialogTitle: string; @Input() cancelLabel: string; @Input() confirmLabel: string; - constructor() { } - - ngOnInit() { - } + constructor() {} + ngOnInit() {} } diff --git a/ui/ui-frontend-common/src/app/modules/components/confirm-dialog/confirm-dialog.module.ts b/ui/ui-frontend-common/src/app/modules/components/confirm-dialog/confirm-dialog.module.ts index 546eeacb4da..ed228307887 100644 --- a/ui/ui-frontend-common/src/app/modules/components/confirm-dialog/confirm-dialog.module.ts +++ b/ui/ui-frontend-common/src/app/modules/components/confirm-dialog/confirm-dialog.module.ts @@ -44,12 +44,8 @@ import { ConfirmDialogComponent } from './confirm-dialog.component'; @NgModule({ declarations: [ConfirmDialogComponent, ClosePopupDialogComponent], - imports: [ - CommonModule, - MatDialogModule, - TranslateModule - ], + imports: [CommonModule, MatDialogModule, TranslateModule], exports: [ConfirmDialogComponent, ClosePopupDialogComponent], - entryComponents: [ClosePopupDialogComponent] + entryComponents: [ClosePopupDialogComponent], }) -export class ConfirmDialogModule { } +export class ConfirmDialogModule {} diff --git a/ui/ui-frontend-common/src/app/modules/components/confirm-dialog/confirm-dialog.service.spec.ts b/ui/ui-frontend-common/src/app/modules/components/confirm-dialog/confirm-dialog.service.spec.ts index 8d1b72c45a2..6e470489e76 100644 --- a/ui/ui-frontend-common/src/app/modules/components/confirm-dialog/confirm-dialog.service.spec.ts +++ b/ui/ui-frontend-common/src/app/modules/components/confirm-dialog/confirm-dialog.service.spec.ts @@ -40,11 +40,11 @@ import { MatDialog } from '@angular/material/dialog'; import { ConfirmDialogService } from './confirm-dialog.service'; describe('ConfirmDialogService', () => { - beforeEach(() => TestBed.configureTestingModule({ - providers: [ - { provide: MatDialog, useValue: {} }, - ] - })); + beforeEach(() => + TestBed.configureTestingModule({ + providers: [{ provide: MatDialog, useValue: {} }], + }), + ); it('should be created', () => { const service: ConfirmDialogService = TestBed.inject(ConfirmDialogService); diff --git a/ui/ui-frontend-common/src/app/modules/components/confirm-dialog/confirm-dialog.service.ts b/ui/ui-frontend-common/src/app/modules/components/confirm-dialog/confirm-dialog.service.ts index ac9520d42ba..1adee395fc0 100644 --- a/ui/ui-frontend-common/src/app/modules/components/confirm-dialog/confirm-dialog.service.ts +++ b/ui/ui-frontend-common/src/app/modules/components/confirm-dialog/confirm-dialog.service.ts @@ -45,25 +45,24 @@ import { MatDialog, MatDialogRef } from '@angular/material/dialog'; import { ClosePopupDialogComponent } from './close-popup-dialog.component'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class ConfirmDialogService { - - constructor(private matDialog: MatDialog) { } + constructor(private matDialog: MatDialog) {} confirm(componentOrTemplateRef: TemplateRef | ComponentType): Observable { - return this.matDialog.open(componentOrTemplateRef, { panelClass: 'vitamui-confirm-dialog' }).afterClosed().pipe( - filter((result) => !!result) - ); + return this.matDialog + .open(componentOrTemplateRef, { panelClass: 'vitamui-confirm-dialog' }) + .afterClosed() + .pipe(filter((result) => !!result)); } // returns an observable that emits when escape is pressed listenToEscapeKeyPress(matDialogRef: MatDialogRef): Observable { - return matDialogRef.keydownEvents() - .pipe( - filter((event) => event.key === 'Escape' && !hasModifierKey(event)), - tap((event) => event.preventDefault) - ); + return matDialogRef.keydownEvents().pipe( + filter((event) => event.key === 'Escape' && !hasModifierKey(event)), + tap((event) => event.preventDefault), + ); } // Opens a confirmation dialog before closing the dialog diff --git a/ui/ui-frontend-common/src/app/modules/components/customer-select-content/customer-select-content.component.html b/ui/ui-frontend-common/src/app/modules/components/customer-select-content/customer-select-content.component.html index 8be76fc8622..3d07da83e98 100644 --- a/ui/ui-frontend-common/src/app/modules/components/customer-select-content/customer-select-content.component.html +++ b/ui/ui-frontend-common/src/app/modules/components/customer-select-content/customer-select-content.component.html @@ -1,7 +1,7 @@
    -
    +
    diff --git a/ui/ui-frontend-common/src/app/modules/components/customer-select-content/customer-select-content.component.scss b/ui/ui-frontend-common/src/app/modules/components/customer-select-content/customer-select-content.component.scss index 221298d8203..b6e76bd757e 100644 --- a/ui/ui-frontend-common/src/app/modules/components/customer-select-content/customer-select-content.component.scss +++ b/ui/ui-frontend-common/src/app/modules/components/customer-select-content/customer-select-content.component.scss @@ -2,47 +2,47 @@ @import '../../../../sass/mixins/elevation'; .modal-body { - min-height: 100px; + min-height: 100px; } .mat-drawer, .mat-dialog-container { - .customer-box { - @include dialog-elevation-dark; + .customer-box { + @include dialog-elevation-dark; } } .customer-box { - @include input-elevation-dark; - display: flex; - height: 90px; - align-items: center; - word-break: break-word; - font-size: 16px; - font-weight: 500; - background: $white; - border-radius: 10px; - padding-top: 23px; - padding-bottom: 23px; - padding-right: 12px; - padding-left: 30px; - margin-bottom: 24px; - color: #474747; - transition: box-shadow 240ms ease-out; + @include input-elevation-dark; + display: flex; + height: 90px; + align-items: center; + word-break: break-word; + font-size: 16px; + font-weight: 500; + background: $white; + border-radius: 10px; + padding-top: 23px; + padding-bottom: 23px; + padding-right: 12px; + padding-left: 30px; + margin-bottom: 24px; + color: #474747; + transition: box-shadow 240ms ease-out; - i { - color: var(--vitamui-primary); - font-size: 42px; - margin-right: 15px; - } + i { + color: var(--vitamui-primary); + font-size: 42px; + margin-right: 15px; + } } .modal-customer-box { - height: 60px; - font-size: 14px; - padding-left: 20px; + height: 60px; + font-size: 14px; + padding-left: 20px; - i { - font-size: 30px; - } -} \ No newline at end of file + i { + font-size: 30px; + } +} diff --git a/ui/ui-frontend-common/src/app/modules/components/customer-select-content/customer-select-content.component.spec.ts b/ui/ui-frontend-common/src/app/modules/components/customer-select-content/customer-select-content.component.spec.ts index 48c27b92fe2..7261a80572e 100644 --- a/ui/ui-frontend-common/src/app/modules/components/customer-select-content/customer-select-content.component.spec.ts +++ b/ui/ui-frontend-common/src/app/modules/components/customer-select-content/customer-select-content.component.spec.ts @@ -45,13 +45,12 @@ describe('CustomerSelectContentComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - declarations: [ CustomerSelectContentComponent ], + declarations: [CustomerSelectContentComponent], providers: [ { provide: ActivatedRoute, useValue: {} }, { provide: Router, useValue: {} }, - ] - }) - .compileComponents(); + ], + }).compileComponents(); })); beforeEach(() => { diff --git a/ui/ui-frontend-common/src/app/modules/components/customer-select-content/customer-select-content.component.ts b/ui/ui-frontend-common/src/app/modules/components/customer-select-content/customer-select-content.component.ts index 7e18f4d6f37..23af7dc8743 100644 --- a/ui/ui-frontend-common/src/app/modules/components/customer-select-content/customer-select-content.component.ts +++ b/ui/ui-frontend-common/src/app/modules/components/customer-select-content/customer-select-content.component.ts @@ -44,10 +44,9 @@ import { CustomerMenuService } from '../navbar/customer-menu/customer-menu.servi @Component({ selector: 'vitamui-common-customer-select-content', templateUrl: './customer-select-content.component.html', - styleUrls: ['./customer-select-content.component.scss'] + styleUrls: ['./customer-select-content.component.scss'], }) export class CustomerSelectContentComponent implements OnInit, OnDestroy { - @Input() customers: MenuOption[]; @Input() isModalMenu: boolean; @@ -57,7 +56,8 @@ export class CustomerSelectContentComponent implements OnInit, OnDestroy { private router: Router, private route: ActivatedRoute, private customerMenuService: CustomerMenuService, - private customerSelectionService: CustomerSelectionService) { } + private customerSelectionService: CustomerSelectionService, + ) {} ngOnInit(): void { if (this.customers) { @@ -79,5 +79,4 @@ export class CustomerSelectContentComponent implements OnInit, OnDestroy { } } } - } diff --git a/ui/ui-frontend-common/src/app/modules/components/customer-select-content/customer-select-content.module.ts b/ui/ui-frontend-common/src/app/modules/components/customer-select-content/customer-select-content.module.ts index 0901dec411f..4aeb77775e5 100644 --- a/ui/ui-frontend-common/src/app/modules/components/customer-select-content/customer-select-content.module.ts +++ b/ui/ui-frontend-common/src/app/modules/components/customer-select-content/customer-select-content.module.ts @@ -41,12 +41,8 @@ import { RouterModule } from '@angular/router'; import { CustomerSelectContentComponent } from './customer-select-content.component'; @NgModule({ - imports: [ - CommonModule, - HttpClientModule, - RouterModule, - ], + imports: [CommonModule, HttpClientModule, RouterModule], declarations: [CustomerSelectContentComponent], exports: [CustomerSelectContentComponent], }) -export class CustomerSelectContentModule { } +export class CustomerSelectContentModule {} diff --git a/ui/ui-frontend-common/src/app/modules/components/download-snack-bar/download-snack-bar.component.html b/ui/ui-frontend-common/src/app/modules/components/download-snack-bar/download-snack-bar.component.html index 28751999c42..b7651e9c94d 100644 --- a/ui/ui-frontend-common/src/app/modules/components/download-snack-bar/download-snack-bar.component.html +++ b/ui/ui-frontend-common/src/app/modules/components/download-snack-bar/download-snack-bar.component.html @@ -1,5 +1,4 @@
    -
    @@ -9,24 +8,23 @@
    - {{'DOWNLOAD.FILE_GENERATION' | translate}} + {{ 'DOWNLOAD.FILE_GENERATION' | translate }}
    - +
    -
    -

    {{'DOWNLOAD.CONFIRM_CANCEL_ACTION' | translate}}

    +

    {{ 'DOWNLOAD.CONFIRM_CANCEL_ACTION' | translate }}

    - - + + -
    \ No newline at end of file + diff --git a/ui/ui-frontend-common/src/app/modules/components/download-snack-bar/download-snack-bar.component.scss b/ui/ui-frontend-common/src/app/modules/components/download-snack-bar/download-snack-bar.component.scss index 231ccec8ff8..0fc6f05cdff 100644 --- a/ui/ui-frontend-common/src/app/modules/components/download-snack-bar/download-snack-bar.component.scss +++ b/ui/ui-frontend-common/src/app/modules/components/download-snack-bar/download-snack-bar.component.scss @@ -3,51 +3,50 @@ // TODO Refactor :host { - width: 100%; - background: var(--vitamui-primary); - padding: 14px 24px; + width: 100%; + background: var(--vitamui-primary); + padding: 14px 24px; } .download-label { - padding: 15px; + padding: 15px; } .download-bar-container { - height: 100%; - display: flex; - align-items: center; - justify-content: space-between; + height: 100%; + display: flex; + align-items: center; + justify-content: space-between; } .download-bar-content { - font-size: 14px; - font-weight: bold; - color: white; - display: flex; - align-items: center; - justify-content: flex-start; - flex-grow: 1; - - > i.material-icons { - margin-right: 10px; - } - + font-size: 14px; + font-weight: bold; + color: white; + display: flex; + align-items: center; + justify-content: flex-start; + flex-grow: 1; + + > i.material-icons { + margin-right: 10px; + } } .download-progress-bar-container { - width: 100%; - max-width: 300px; - padding: 0 15px; + width: 100%; + max-width: 300px; + padding: 0 15px; } .cancel-link { - background: none; - border: none; - color: white; - text-decoration: underline; - outline: none; - cursor: pointer; - padding: 10px; - font-size: 14px; - font-weight: bold; + background: none; + border: none; + color: white; + text-decoration: underline; + outline: none; + cursor: pointer; + padding: 10px; + font-size: 14px; + font-weight: bold; } diff --git a/ui/ui-frontend-common/src/app/modules/components/download-snack-bar/download-snack-bar.component.ts b/ui/ui-frontend-common/src/app/modules/components/download-snack-bar/download-snack-bar.component.ts index c4308e30c4a..bb8b1d2de7f 100644 --- a/ui/ui-frontend-common/src/app/modules/components/download-snack-bar/download-snack-bar.component.ts +++ b/ui/ui-frontend-common/src/app/modules/components/download-snack-bar/download-snack-bar.component.ts @@ -42,10 +42,9 @@ import { filter } from 'rxjs/operators'; @Component({ selector: 'vitamui-common-download-snack-bar', templateUrl: './download-snack-bar.component.html', - styleUrls: ['./download-snack-bar.component.scss'] + styleUrls: ['./download-snack-bar.component.scss'], }) export class DownloadSnackBarComponent implements OnInit { - @ViewChild('confirmDialog', { static: true }) confirmDialog: TemplateRef; isCompressed = false; @@ -66,8 +65,7 @@ export class DownloadSnackBarComponent implements OnInit { // tslint:disable-next-line:variable-name private readonly _cancel = new Subject(); - constructor(private matDialog: MatDialog) { - } + constructor(private matDialog: MatDialog) {} initialize(isCompressed: boolean, count?: number, total?: number) { this.count = count; @@ -76,17 +74,17 @@ export class DownloadSnackBarComponent implements OnInit { this.notDownloadable = total - count; } - ngOnInit() { - } + ngOnInit() {} confirmClose() { const dialogRef = this.matDialog.open(this.confirmDialog, { panelClass: 'vitamui-dialog' }); - dialogRef.afterClosed().pipe(filter((result) => !!result)) + dialogRef + .afterClosed() + .pipe(filter((result) => !!result)) .subscribe(() => this._cancel.next()); } get cancel(): Observable { return this._cancel.asObservable(); } - } diff --git a/ui/ui-frontend-common/src/app/modules/components/download-snack-bar/download-snack-bar.module.ts b/ui/ui-frontend-common/src/app/modules/components/download-snack-bar/download-snack-bar.module.ts index 54189110e33..e73ab402e47 100644 --- a/ui/ui-frontend-common/src/app/modules/components/download-snack-bar/download-snack-bar.module.ts +++ b/ui/ui-frontend-common/src/app/modules/components/download-snack-bar/download-snack-bar.module.ts @@ -42,20 +42,9 @@ import { TranslateModule } from '@ngx-translate/core'; import { DownloadSnackBarComponent } from '../download-snack-bar/download-snack-bar.component'; @NgModule({ - imports: [ - CommonModule, - MatDialogModule, - MatProgressBarModule, - TranslateModule, - ], - declarations: [ - DownloadSnackBarComponent, - ], - exports: [ - DownloadSnackBarComponent, - ], - entryComponents: [ - DownloadSnackBarComponent, - ] + imports: [CommonModule, MatDialogModule, MatProgressBarModule, TranslateModule], + declarations: [DownloadSnackBarComponent], + exports: [DownloadSnackBarComponent], + entryComponents: [DownloadSnackBarComponent], }) -export class DownloadSnackBarModule { } +export class DownloadSnackBarModule {} diff --git a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-duration-input/editable-duration-input.component.html b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-duration-input/editable-duration-input.component.html index a4c931c533a..35e3e496124 100644 --- a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-duration-input/editable-duration-input.component.html +++ b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-duration-input/editable-duration-input.component.html @@ -1,40 +1,45 @@ -
    -
    -
    - - {{ control?.value | humanizedDuration}} -
    -
    J
    -
    H
    -
    M
    -
    -
    - edit -
    - -
    +
    +
    +
    + + {{ control?.value | humanizedDuration }} +
    + +
    J
    + +
    H
    + +
    M
    +
    + edit +
    + +
    +
    -
    - -
    - - -
    - - -
    -
    +
    + +
    + +
    + + +
    +
    - -
    {{ control?.value | humanizedDuration}}
    + +
    {{ control?.value | humanizedDuration }}
    diff --git a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-duration-input/editable-duration-input.component.scss b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-duration-input/editable-duration-input.component.scss index 3233920b9b0..b1ac4900df9 100644 --- a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-duration-input/editable-duration-input.component.scss +++ b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-duration-input/editable-duration-input.component.scss @@ -1,26 +1,28 @@ .vitamui-duration-input { - margin-top: 8px; - } - - .unit { - width: 25px; - height: 25px; - background-color: var(--vitamui-grey-200); - display: flex; - align-items: center; - justify-content: center; - - & > div{ - margin-top: 11px; - margin-left: 5px; - } - } - - input { - border: none; - } - - .days, .hours, .minutes { - width: 40px; - margin-left: 30px; - } \ No newline at end of file + margin-top: 8px; +} + +.unit { + width: 25px; + height: 25px; + background-color: var(--vitamui-grey-200); + display: flex; + align-items: center; + justify-content: center; + + & > div { + margin-top: 11px; + margin-left: 5px; + } +} + +input { + border: none; +} + +.days, +.hours, +.minutes { + width: 40px; + margin-left: 30px; +} diff --git a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-duration-input/editable-duration-input.component.ts b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-duration-input/editable-duration-input.component.ts index bcdebfa19c9..48e075b520a 100644 --- a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-duration-input/editable-duration-input.component.ts +++ b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-duration-input/editable-duration-input.component.ts @@ -45,17 +45,16 @@ const moment = moment_; export const EDITABLE_DURATION_INPUT_VALUE_ACCESSOR: any = { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => EditableDurationInputComponent), - multi: true + multi: true, }; @Component({ selector: 'vitamui-common-editable-duration-input', templateUrl: './editable-duration-input.component.html', styleUrls: ['./editable-duration-input.component.scss'], - providers: [EDITABLE_DURATION_INPUT_VALUE_ACCESSOR] + providers: [EDITABLE_DURATION_INPUT_VALUE_ACCESSOR], }) export class EditableDurationInputComponent extends EditableFieldComponent { - delaySlaForm: FormGroup; constructor(formBuilder: FormBuilder, elementRef: ElementRef) { @@ -64,7 +63,7 @@ export class EditableDurationInputComponent extends EditableFieldComponent { this.delaySlaForm = formBuilder.group({ days: [null], hours: [null], - minutes: [null] + minutes: [null], }); this.delaySlaForm.valueChanges.subscribe((delayData) => { @@ -86,15 +85,13 @@ export class EditableDurationInputComponent extends EditableFieldComponent { } onClick(target: HTMLElement) { - if (!this.editMode) { return; } + if (!this.editMode) { + return; + } const overlayRef = this.cdkConnectedOverlay.overlayRef; - if ( - this.isInside(target, this.elementRef.nativeElement) || - this.isInside(target, overlayRef.hostElement) - ) { + if (this.isInside(target, this.elementRef.nativeElement) || this.isInside(target, overlayRef.hostElement)) { return; } this.cancel(); } - } diff --git a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-duration-input/humanized-duration.pipe.ts b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-duration-input/humanized-duration.pipe.ts index 436d7c652ac..a011becbdb2 100644 --- a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-duration-input/humanized-duration.pipe.ts +++ b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-duration-input/humanized-duration.pipe.ts @@ -40,10 +40,9 @@ import * as moment_ from 'moment'; const moment = moment_; @Pipe({ - name: 'humanizedDuration' + name: 'humanizedDuration', }) export class HumanizedDurationPipe implements PipeTransform { - /** * Method allowing to transform a duration (ISOString) * @param value String value (ISOString) linked to a duration. diff --git a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-email-input/editable-email-input.component.scss b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-email-input/editable-email-input.component.scss index 55427903151..d3b21ff4142 100644 --- a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-email-input/editable-email-input.component.scss +++ b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-email-input/editable-email-input.component.scss @@ -1,20 +1,20 @@ :host::ng-deep { - .mat-select-trigger { - border-bottom: 1px solid var(--vitamui-primary); - } + .mat-select-trigger { + border-bottom: 1px solid var(--vitamui-primary); + } } input { - width: 100%; + width: 100%; } mat-form-field { - width: 40%!important; + width: 40% !important; } .layer { - margin: 0 0.5rem; - font-size: 18px; - font-weight: bold; - color: var(--vitamui-grey-800); -} \ No newline at end of file + margin: 0 0.5rem; + font-size: 18px; + font-weight: bold; + color: var(--vitamui-grey-800); +} diff --git a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-email-input/editable-email-input.component.ts b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-email-input/editable-email-input.component.ts index 90acff24891..1b20cca3dc6 100644 --- a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-email-input/editable-email-input.component.ts +++ b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-email-input/editable-email-input.component.ts @@ -45,18 +45,16 @@ import { EditableFieldComponent } from '../editable-field.component'; export const EDITABLE_EMAIL_INPUT_VALUE_ACCESSOR: any = { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => EditableEmailInputComponent), - multi: true + multi: true, }; @Component({ selector: 'vitamui-common-editable-email-input', templateUrl: './editable-email-input.component.html', styleUrls: ['./editable-email-input.component.scss'], - providers: [EDITABLE_EMAIL_INPUT_VALUE_ACCESSOR] + providers: [EDITABLE_EMAIL_INPUT_VALUE_ACCESSOR], }) - export class EditableEmailInputComponent extends EditableFieldComponent { - @ViewChild('select') select: MatSelect; constructor(formBuilder: FormBuilder, elementRef: ElementRef) { @@ -64,15 +62,14 @@ export class EditableEmailInputComponent extends EditableFieldComponent { this.formEmail = formBuilder.group({ emailFirstPart: null, - domain: [null] + domain: [null], }); this.formEmail.valueChanges.subscribe((emailData) => { this.control.setValue(emailData.emailFirstPart + '@' + emailData.domain); this.control.markAsDirty(); }); - - } + } formEmail: FormGroup; @@ -89,7 +86,9 @@ export class EditableEmailInputComponent extends EditableFieldComponent { } onClick(target: HTMLElement) { - if (!this.editMode) { return; } + if (!this.editMode) { + return; + } const overlayRef = this.cdkConnectedOverlay.overlayRef; const selectOverlayRef = this.select.overlayDir.overlayRef; if ( @@ -102,5 +101,4 @@ export class EditableEmailInputComponent extends EditableFieldComponent { } this.cancel(); } - } diff --git a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-field.component.spec.ts b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-field.component.spec.ts index ffc2397e449..c8da98bca9b 100644 --- a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-field.component.spec.ts +++ b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-field.component.spec.ts @@ -45,12 +45,12 @@ import { EditableFieldComponent } from './editable-field.component'; describe('EditableFieldComponent', () => { let component: EditableFieldComponent; - beforeEach(() => TestBed.configureTestingModule({ - imports: [HttpClientTestingModule, VitamUICommonTestModule], - providers: [ - { provide: BASE_URL, useValue: '/fake-api' }, - ] - })); + beforeEach(() => + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule, VitamUICommonTestModule], + providers: [{ provide: BASE_URL, useValue: '/fake-api' }], + }), + ); beforeEach(() => { component = new EditableFieldComponent({ nativeElement: document.createElement('dummy') }); }); @@ -190,5 +190,4 @@ describe('EditableFieldComponent', () => { component.setDisabledState(false); expect(component.disabled).toBeFalsy(); }); - }); diff --git a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-field.component.ts b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-field.component.ts index 4e9b9ed840c..0c0bb356dd1 100644 --- a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-field.component.ts +++ b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-field.component.ts @@ -35,24 +35,36 @@ * knowledge of the CeCILL-C license and that you accept its terms. */ import { CdkConnectedOverlay } from '@angular/cdk/overlay'; -import { AfterContentInit, ContentChildren, Directive, ElementRef, EventEmitter, - HostBinding, HostListener, Input, Output, QueryList, ViewChild } from '@angular/core'; +import { + AfterContentInit, + ContentChildren, + Directive, + ElementRef, + EventEmitter, + HostBinding, + HostListener, + Input, + Output, + QueryList, + ViewChild, +} from '@angular/core'; import { AsyncValidatorFn, ControlValueAccessor, FormControl, ValidatorFn } from '@angular/forms'; import { VitamUIFieldErrorComponent } from '../vitamui-field-error/vitamui-field-error.component'; @Directive({ - selector: 'editable-field-component' + selector: 'editable-field-component', }) export class EditableFieldComponent implements AfterContentInit, ControlValueAccessor { - @Input() label: string; @Input() set disabled(disabled: boolean) { this._disabled = disabled; this.readonly = this._disabled; } - get disabled(): boolean { return this._disabled; } + get disabled(): boolean { + return this._disabled; + } // tslint:disable-next-line:variable-name private _disabled: boolean; @@ -84,24 +96,28 @@ export class EditableFieldComponent implements AfterContentInit, ControlValueAcc originX: 'end', originY: 'center', overlayX: 'start', - overlayY: 'center' + overlayY: 'center', }, { originX: 'end', originY: 'bottom', overlayX: 'end', - overlayY: 'top' + overlayY: 'top', }, { originX: 'end', originY: 'top', overlayX: 'end', - overlayY: 'bottom' + overlayY: 'bottom', }, ]; - get showSpinner(): boolean { return this.control.pending && this.control.dirty; } - get canConfirm() { return this.editMode && !this.control.pending && this.control.valid && this.control.dirty; } + get showSpinner(): boolean { + return this.control.pending && this.control.dirty; + } + get canConfirm() { + return this.editMode && !this.control.pending && this.control.valid && this.control.dirty; + } constructor(protected elementRef: ElementRef) {} @@ -151,7 +167,9 @@ export class EditableFieldComponent implements AfterContentInit, ControlValueAcc @HostListener('document:click', ['$event.target']) onClick(target: HTMLElement) { - if (!this.editMode) { return; } + if (!this.editMode) { + return; + } const overlayRef = this.cdkConnectedOverlay.overlayRef; if (this.isInside(target, this.elementRef.nativeElement) || this.isInside(target, overlayRef.hostElement)) { return; @@ -160,7 +178,9 @@ export class EditableFieldComponent implements AfterContentInit, ControlValueAcc } confirm() { - if (!this.canConfirm) { return; } + if (!this.canConfirm) { + return; + } this.editMode = false; this.onChange(this.control.value); this.originValue = this.control.value; @@ -168,7 +188,9 @@ export class EditableFieldComponent implements AfterContentInit, ControlValueAcc } cancel() { - if (!this.editMode) { return; } + if (!this.editMode) { + return; + } this.editMode = false; this.control.reset(this.originValue); } @@ -176,5 +198,4 @@ export class EditableFieldComponent implements AfterContentInit, ControlValueAcc protected isInside(target: HTMLElement, element: HTMLElement): boolean { return element && (target === element || element.contains(target)); } - } diff --git a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-field.module.ts b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-field.module.ts index ae78a5a88a7..96bbe779c4c 100644 --- a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-field.module.ts +++ b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-field.module.ts @@ -41,7 +41,7 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { MatButtonToggleModule } from '@angular/material/button-toggle'; import { MatDialogModule } from '@angular/material/dialog'; import { MatFormFieldModule } from '@angular/material/form-field'; -import { MatInputModule} from '@angular/material/input'; +import { MatInputModule } from '@angular/material/input'; import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; import { MatSelectModule } from '@angular/material/select'; import { TranslateModule } from '@ngx-translate/core'; @@ -63,7 +63,6 @@ import { EmailsInputModule } from './emails-input/emails-input.module'; import { LevelInputModule } from './level-input/level-input.module'; import { MultipleEmailInputComponent } from './multiple-email-input/multiple-email-input.component'; - @NgModule({ imports: [ CommonModule, @@ -79,7 +78,7 @@ import { MultipleEmailInputComponent } from './multiple-email-input/multiple-ema LevelInputModule, MatInputModule, MatFormFieldModule, - TranslateModule + TranslateModule, ], declarations: [ EditableFieldComponent, @@ -113,7 +112,7 @@ import { MultipleEmailInputComponent } from './multiple-email-input/multiple-ema HumanizedDurationPipe, SubLevelPipe, LevelInputModule, - EmailsInputModule - ] + EmailsInputModule, + ], }) -export class EditableFieldModule { } +export class EditableFieldModule {} diff --git a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-file/editable-file.component.html b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-file/editable-file.component.html index b0bbed30f59..5ea9219f328 100644 --- a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-file/editable-file.component.html +++ b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-file/editable-file.component.html @@ -2,17 +2,17 @@
    - - {{control?.value?.name}} -
    -
    - - -
    + + {{ control?.value?.name }} +
    +
    + +
    +
    edit
    @@ -29,15 +29,18 @@ cdkConnectedOverlay [cdkConnectedOverlayOpen]="editMode" [cdkConnectedOverlayOrigin]="origin" - [cdkConnectedOverlayPositions]="positions"> + [cdkConnectedOverlayPositions]="positions" + >
    - +
    - -
    {{control?.value?.name}}
    -
    \ No newline at end of file + +
    {{ control?.value?.name }}
    +
    diff --git a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-file/editable-file.component.spec.ts b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-file/editable-file.component.spec.ts index 0d12885dc83..4baba6f4d5d 100644 --- a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-file/editable-file.component.spec.ts +++ b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-file/editable-file.component.spec.ts @@ -63,7 +63,7 @@ import { EditableFileComponent } from './editable-file.component'; Expected required error message Expected async error message - ` + `, }) class TesthostComponent { value: File; @@ -74,7 +74,7 @@ class TesthostComponent { validator = Validators.required; asyncValidator = (control: AbstractControl) => { return of(control.value !== 'invalid value' ? null : { async: true }); - } + }; } describe('EditableFileComponent', () => { @@ -93,16 +93,9 @@ describe('EditableFileComponent', () => { HttpClientTestingModule, TranslateModule.forRoot(), ], - providers: [ - { provide: WINDOW_LOCATION, useValue: {} }, - ], - declarations: [ - TesthostComponent, - EditableFileComponent, - VitamUIFieldErrorComponent, - ], - }) - .compileComponents(); + providers: [{ provide: WINDOW_LOCATION, useValue: {} }], + declarations: [TesthostComponent, EditableFileComponent, VitamUIFieldErrorComponent], + }).compileComponents(); inject([OverlayContainer], (oc: OverlayContainer) => { overlayContainerElement = oc.getContainerElement(); @@ -120,7 +113,6 @@ describe('EditableFileComponent', () => { }); describe('DOM', () => { - it('should call enterEditMode() on click', () => { spyOn(testhost.component, 'enterEditMode'); const element = fixture.nativeElement.querySelector('.editable-field'); @@ -217,11 +209,9 @@ describe('EditableFileComponent', () => { expect(elErrors.length).toBe(2); expect(elErrors[1].textContent).toContain('Expected async error message'); }); - }); describe('Class', () => { - it('should set the control value', waitForAsync(() => { testhost.value = newFile([''], 'test-file.txt'); fixture.detectChanges(); diff --git a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-file/editable-file.component.ts b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-file/editable-file.component.ts index 01263e79337..3b2ca52d994 100644 --- a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-file/editable-file.component.ts +++ b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-file/editable-file.component.ts @@ -44,16 +44,15 @@ import { EditableFieldComponent } from '../editable-field.component'; export const EDITABLE_FILE_VALUE_ACCESSOR: any = { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => EditableFileComponent), - multi: true + multi: true, }; @Component({ selector: 'vitamui-common-editable-file', templateUrl: './editable-file.component.html', - providers: [EDITABLE_FILE_VALUE_ACCESSOR] + providers: [EDITABLE_FILE_VALUE_ACCESSOR], }) export class EditableFileComponent extends EditableFieldComponent { - @Input() accept: string; file: File; @@ -70,10 +69,11 @@ export class EditableFileComponent extends EditableFieldComponent { } cancel() { - if (!this.editMode) { return; } + if (!this.editMode) { + return; + } this.file = null; this.fileInput.nativeElement.value = null; super.cancel(); } - } diff --git a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-input/editable-input.component.spec.ts b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-input/editable-input.component.spec.ts index 7ebcc9b6a06..e1e59be2ba3 100644 --- a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-input/editable-input.component.spec.ts +++ b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-input/editable-input.component.spec.ts @@ -59,7 +59,7 @@ import { EditableInputComponent } from './editable-input.component'; Expected required error message Expected async error message - ` + `, }) class TesthostComponent { value: string; @@ -70,7 +70,7 @@ class TesthostComponent { validator = Validators.required; asyncValidator = (control: AbstractControl) => { return of(control.value !== 'invalid value' ? null : { async: true }); - } + }; } describe('EditableInputComponent', () => { @@ -80,20 +80,9 @@ describe('EditableInputComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [ - OverlayModule, - FormsModule, - ReactiveFormsModule, - MatProgressSpinnerModule, - NoopAnimationsModule, - ], - declarations: [ - TesthostComponent, - EditableInputComponent, - VitamUIFieldErrorComponent, - ] - }) - .compileComponents(); + imports: [OverlayModule, FormsModule, ReactiveFormsModule, MatProgressSpinnerModule, NoopAnimationsModule], + declarations: [TesthostComponent, EditableInputComponent, VitamUIFieldErrorComponent], + }).compileComponents(); inject([OverlayContainer], (oc: OverlayContainer) => { overlayContainerElement = oc.getContainerElement(); @@ -111,7 +100,6 @@ describe('EditableInputComponent', () => { }); describe('DOM', () => { - it('should call enterEditMode() on click', () => { spyOn(testhost.component, 'enterEditMode'); const element = fixture.nativeElement.querySelector('.editable-field'); @@ -203,11 +191,9 @@ describe('EditableInputComponent', () => { expect(elErrors.length).toBe(2); expect(elErrors[1].textContent).toContain('Expected async error message'); }); - }); describe('Class', () => { - it('should set the control value', waitForAsync(() => { testhost.value = 'test value'; fixture.detectChanges(); @@ -286,6 +272,5 @@ describe('EditableInputComponent', () => { expect(testhost.component.control.value).toEqual('origin value'); }); })); - }); }); diff --git a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-input/editable-input.component.ts b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-input/editable-input.component.ts index 67a081461e9..8d9f5b0573d 100644 --- a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-input/editable-input.component.ts +++ b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-input/editable-input.component.ts @@ -43,20 +43,19 @@ import { EditableFieldComponent } from '../editable-field.component'; export const EDITABLE_INPUT_VALUE_ACCESSOR: any = { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => EditableInputComponent), - multi: true + multi: true, }; @Component({ selector: 'vitamui-common-editable-input', templateUrl: './editable-input.component.html', styleUrls: ['./editable-input.component.scss'], - providers: [EDITABLE_INPUT_VALUE_ACCESSOR] + providers: [EDITABLE_INPUT_VALUE_ACCESSOR], }) export class EditableInputComponent extends EditableFieldComponent { - @Input() maxlength: number; @Input() type = 'text'; - @Input() writeDisabled : boolean; + @Input() writeDisabled: boolean; @ViewChild('input') private input: ElementRef; constructor(elementRef: ElementRef) { @@ -67,5 +66,4 @@ export class EditableInputComponent extends EditableFieldComponent { super.enterEditMode(); setTimeout(() => this.input.nativeElement.focus(), 0); } - } diff --git a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-level-input/editable-level-input.component.html b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-level-input/editable-level-input.component.html index 1f80edd8162..19739245218 100644 --- a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-level-input/editable-level-input.component.html +++ b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-level-input/editable-level-input.component.html @@ -2,9 +2,9 @@
    - + - {{ control.value | subLevel:prefix }} + {{ control.value | subLevel: prefix }}
    @@ -16,10 +16,16 @@
    - +
    - +
    @@ -27,7 +33,9 @@
    - -
    {{control.value | subLevel:prefix }}
    + +
    + {{ control.value | subLevel: prefix }} +
    diff --git a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-level-input/editable-level-input.component.spec.ts b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-level-input/editable-level-input.component.spec.ts index a6dcd1f5a19..4f139fa1cad 100644 --- a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-level-input/editable-level-input.component.spec.ts +++ b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-level-input/editable-level-input.component.spec.ts @@ -58,14 +58,9 @@ describe('EditableLevelInputComponent', () => { HttpClientTestingModule, TranslateModule.forRoot(), ], - declarations: [ - EditableLevelInputComponent, - SubLevelPipe], - providers: [ - { provide: WINDOW_LOCATION, useValue: {} }, - ] - }) - .compileComponents(); + declarations: [EditableLevelInputComponent, SubLevelPipe], + providers: [{ provide: WINDOW_LOCATION, useValue: {} }], + }).compileComponents(); })); beforeEach(() => { diff --git a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-level-input/editable-level-input.component.ts b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-level-input/editable-level-input.component.ts index 8d7ba093332..4cc492c5c35 100644 --- a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-level-input/editable-level-input.component.ts +++ b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-level-input/editable-level-input.component.ts @@ -42,21 +42,19 @@ import { EditableFieldComponent } from '../editable-field.component'; export const EDITABLE_LEVEL_INPUT_VALUE_ACCESSOR: any = { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => EditableLevelInputComponent), - multi: true + multi: true, }; @Component({ selector: 'vitamui-common-editable-level-input', templateUrl: './editable-level-input.component.html', styleUrls: ['./editable-level-input.component.scss'], - providers: [EDITABLE_LEVEL_INPUT_VALUE_ACCESSOR] + providers: [EDITABLE_LEVEL_INPUT_VALUE_ACCESSOR], }) export class EditableLevelInputComponent extends EditableFieldComponent { - @Input() prefix: string; constructor(elementRef: ElementRef) { super(elementRef); } - } diff --git a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-level-input/sub-level.pipe.ts b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-level-input/sub-level.pipe.ts index 87b94a65146..5b8e21a543c 100644 --- a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-level-input/sub-level.pipe.ts +++ b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-level-input/sub-level.pipe.ts @@ -38,12 +38,10 @@ import { Pipe, PipeTransform } from '@angular/core'; import { extractSubLevel } from '../../../utils'; @Pipe({ - name: 'subLevel' + name: 'subLevel', }) export class SubLevelPipe implements PipeTransform { - transform(level: any, userLevel: string): any { return extractSubLevel(userLevel, level); } - } diff --git a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-select/editable-option.component.ts b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-select/editable-option.component.ts index 82c47ff33ca..d85d0d2a813 100644 --- a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-select/editable-option.component.ts +++ b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-select/editable-option.component.ts @@ -38,12 +38,10 @@ import { Component, Input } from '@angular/core'; @Component({ selector: 'vitamui-common-editable-option', - template: '' + template: '', }) export class EditableOptionComponent { - @Input() value: any; @Input() content: string; @Input() disabled: string; - } diff --git a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-select/editable-select.component.html b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-select/editable-select.component.html index 5481f4adcf2..9d4cef53ab8 100644 --- a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-select/editable-select.component.html +++ b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-select/editable-select.component.html @@ -2,19 +2,21 @@
    - - {{content(control?.value)}} -
    - - - {{option?.content}} - -
    - keyboard_arrow_up - keyboard_arrow_down -
    -
    -
    + + {{ content(control?.value) }} +
    + + + {{ + option?.content + }} + +
    + keyboard_arrow_up + keyboard_arrow_down +
    +
    +
    edit
    @@ -32,24 +34,22 @@ [cdkConnectedOverlayPositions]="positions" >
    - +
    -
    - -
    {{content(control?.value)}}
    + +
    {{ content(control?.value) }}
    - - {{'EDITABLE_SELECT.CONFIM_UPDATE' | translate}} + + {{ 'EDITABLE_SELECT.CONFIM_UPDATE' | translate }} {{ confirmDialogMessage }} diff --git a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-select/editable-select.component.scss b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-select/editable-select.component.scss index 13dc00a19c7..5963215ebad 100644 --- a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-select/editable-select.component.scss +++ b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-select/editable-select.component.scss @@ -1,3 +1,3 @@ .editable-field { - height: 60px; -} \ No newline at end of file + height: 60px; +} diff --git a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-select/editable-select.component.spec.ts b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-select/editable-select.component.spec.ts index c9c6f381d37..a99dcc81489 100644 --- a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-select/editable-select.component.spec.ts +++ b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-select/editable-select.component.spec.ts @@ -56,7 +56,7 @@ import { EditableSelectComponent } from './editable-select.component'; - ` + `, }) class TesthostComponent { value: string; @@ -84,17 +84,10 @@ describe('EditableSelectComponent', () => { HttpClientTestingModule, TranslateModule.forRoot(), ], - providers: [ - { provide: WINDOW_LOCATION, useValue: {} }, - ], - declarations: [ - TesthostComponent, - EditableSelectComponent, - EditableOptionComponent, - ], - schemas: [NO_ERRORS_SCHEMA] - }) - .compileComponents(); + providers: [{ provide: WINDOW_LOCATION, useValue: {} }], + declarations: [TesthostComponent, EditableSelectComponent, EditableOptionComponent], + schemas: [NO_ERRORS_SCHEMA], + }).compileComponents(); inject([OverlayContainer], (oc: OverlayContainer) => { overlayContainerElement = oc.getContainerElement(); @@ -112,7 +105,6 @@ describe('EditableSelectComponent', () => { }); describe('DOM', () => { - it('should call enterEditMode() on click', () => { spyOn(testhost.component, 'enterEditMode'); const element = fixture.nativeElement.querySelector('.editable-field'); @@ -183,11 +175,9 @@ describe('EditableSelectComponent', () => { const elSpinner = fixture.nativeElement.querySelector('.editable-field mat-spinner'); expect(elSpinner).toBeFalsy(); }); - }); describe('Class', () => { - it('should set the control value', waitForAsync(() => { testhost.value = 'value1'; fixture.detectChanges(); @@ -266,6 +256,5 @@ describe('EditableSelectComponent', () => { expect(testhost.component.control.value).toEqual('value1'); }); })); - }); }); diff --git a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-select/editable-select.component.ts b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-select/editable-select.component.ts index 3ee72d6fc62..e3a1dbf7d7c 100644 --- a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-select/editable-select.component.ts +++ b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-select/editable-select.component.ts @@ -37,9 +37,7 @@ import { filter } from 'rxjs/operators'; /* tslint:disable: no-use-before-declare */ -import { - Component, ContentChildren, ElementRef, forwardRef, Input, QueryList, TemplateRef, ViewChild -} from '@angular/core'; +import { Component, ContentChildren, ElementRef, forwardRef, Input, QueryList, TemplateRef, ViewChild } from '@angular/core'; import { NG_VALUE_ACCESSOR } from '@angular/forms'; import { MatDialog, MatDialogRef } from '@angular/material/dialog'; import { MatSelect } from '@angular/material/select'; @@ -50,17 +48,16 @@ import { EditableOptionComponent } from './editable-option.component'; export const EDITABLE_SELECT_VALUE_ACCESSOR: any = { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => EditableSelectComponent), - multi: true + multi: true, }; @Component({ selector: 'vitamui-common-editable-select', templateUrl: './editable-select.component.html', styleUrls: ['./editable-select.component.scss'], - providers: [EDITABLE_SELECT_VALUE_ACCESSOR] + providers: [EDITABLE_SELECT_VALUE_ACCESSOR], }) export class EditableSelectComponent extends EditableFieldComponent { - @ContentChildren(EditableOptionComponent) options: QueryList; @ViewChild('select') select: MatSelect; @@ -72,7 +69,10 @@ export class EditableSelectComponent extends EditableFieldComponent { private dialogRef: MatDialogRef; - constructor(private matDialog: MatDialog, elementRef: ElementRef) { + constructor( + private matDialog: MatDialog, + elementRef: ElementRef, + ) { super(elementRef); } @@ -83,7 +83,9 @@ export class EditableSelectComponent extends EditableFieldComponent { } onClick(target: HTMLElement) { - if (!this.editMode) { return; } + if (!this.editMode) { + return; + } const overlayRef = this.cdkConnectedOverlay.overlayRef; const selectOverlayRef = this.select.overlayDir.overlayRef; if ( @@ -99,13 +101,15 @@ export class EditableSelectComponent extends EditableFieldComponent { } confirm() { - if (!this.canConfirm) { return; } + if (!this.canConfirm) { + return; + } if (this.showConfirmDialog) { this.dialogRef = this.matDialog.open(this.confirmDialog, { panelClass: 'vitamui-confirm-dialog' }); - this.dialogRef.afterClosed().pipe( - filter((result) => !!result) - ) + this.dialogRef + .afterClosed() + .pipe(filter((result) => !!result)) .subscribe(() => { this.dialogRef = null; this.applyChange(); @@ -127,5 +131,4 @@ export class EditableSelectComponent extends EditableFieldComponent { super.enterEditMode(); setTimeout(() => this.select.open(), 0); } - } diff --git a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-textarea/editable-textarea.component.html b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-textarea/editable-textarea.component.html index 205ab6c46fb..4b5471aa193 100644 --- a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-textarea/editable-textarea.component.html +++ b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-textarea/editable-textarea.component.html @@ -2,11 +2,11 @@
    - - {{control?.value}} -
    - -
    + + {{ control?.value }} +
    + +
    edit
    @@ -26,14 +26,15 @@ [cdkConnectedOverlayPositions]="positions" >
    - +
    -
    - -
    {{control?.value}}
    + +
    {{ control?.value }}
    diff --git a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-textarea/editable-textarea.component.scss b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-textarea/editable-textarea.component.scss index d4b611a915d..567cf605896 100644 --- a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-textarea/editable-textarea.component.scss +++ b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-textarea/editable-textarea.component.scss @@ -1,3 +1,3 @@ .editable-field-content .editable-field-text-content.display-all { - white-space: normal; + white-space: normal; } diff --git a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-textarea/editable-textarea.component.spec.ts b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-textarea/editable-textarea.component.spec.ts index 8b53350f3dd..2a7f4073e76 100644 --- a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-textarea/editable-textarea.component.spec.ts +++ b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-textarea/editable-textarea.component.spec.ts @@ -49,30 +49,30 @@ import { VitamUIFieldErrorStubComponent } from '../../../../../../testing/src'; import { EditableTextareaComponent } from './editable-textarea.component'; @Component({ - template: ` - - Expected required error message - Expected async error message - - ` - }) - class TesthostComponent { - value: string; - label = 'Test label'; - maxlength = 42; - @ViewChild(EditableTextareaComponent) component: EditableTextareaComponent; - - validator = Validators.required; - asyncValidator = (control: AbstractControl) => { - return of(control.value !== 'invalid value' ? null : { async: true }); - } - } + template: ` + + Expected required error message + Expected async error message + + `, +}) +class TesthostComponent { + value: string; + label = 'Test label'; + maxlength = 42; + @ViewChild(EditableTextareaComponent) component: EditableTextareaComponent; + + validator = Validators.required; + asyncValidator = (control: AbstractControl) => { + return of(control.value !== 'invalid value' ? null : { async: true }); + }; +} describe('EditableTextareaComponent', () => { let testhost: TesthostComponent; @@ -81,20 +81,9 @@ describe('EditableTextareaComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [ - OverlayModule, - FormsModule, - ReactiveFormsModule, - MatProgressSpinnerModule, - NoopAnimationsModule, - ], - declarations: [ - TesthostComponent, - EditableTextareaComponent, - VitamUIFieldErrorStubComponent, - ] - }) - .compileComponents(); + imports: [OverlayModule, FormsModule, ReactiveFormsModule, MatProgressSpinnerModule, NoopAnimationsModule], + declarations: [TesthostComponent, EditableTextareaComponent, VitamUIFieldErrorStubComponent], + }).compileComponents(); inject([OverlayContainer], (oc: OverlayContainer) => { overlayContainerElement = oc.getContainerElement(); @@ -112,7 +101,6 @@ describe('EditableTextareaComponent', () => { }); describe('DOM', () => { - it('should call enterEditMode() on click', () => { spyOn(testhost.component, 'enterEditMode'); const element = fixture.nativeElement.querySelector('.editable-field'); @@ -204,11 +192,9 @@ describe('EditableTextareaComponent', () => { expect(elErrors.length).toBe(2); expect(elErrors[1].textContent).toContain('Expected async error message'); }); - }); describe('Class', () => { - it('should set the control value', waitForAsync(() => { testhost.value = 'test value'; fixture.detectChanges(); @@ -287,6 +273,5 @@ describe('EditableTextareaComponent', () => { expect(testhost.component.control.value).toEqual('origin value'); }); })); - }); }); diff --git a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-textarea/editable-textarea.component.ts b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-textarea/editable-textarea.component.ts index 67cb8b6e189..e3b5efa8661 100644 --- a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-textarea/editable-textarea.component.ts +++ b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-textarea/editable-textarea.component.ts @@ -43,17 +43,16 @@ import { EditableFieldComponent } from '../editable-field.component'; export const EDITABLE_TEXTAREA_VALUE_ACCESSOR: any = { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => EditableTextareaComponent), - multi: true + multi: true, }; @Component({ selector: 'vitamui-common-editable-textarea', templateUrl: './editable-textarea.component.html', styleUrls: ['./editable-textarea.component.scss'], - providers: [EDITABLE_TEXTAREA_VALUE_ACCESSOR] + providers: [EDITABLE_TEXTAREA_VALUE_ACCESSOR], }) export class EditableTextareaComponent extends EditableFieldComponent { - @Input() maxlength: number; @ViewChild('input') private input: ElementRef; @@ -65,5 +64,4 @@ export class EditableTextareaComponent extends EditableFieldComponent { super.enterEditMode(); setTimeout(() => this.input.nativeElement.focus(), 0); } - } diff --git a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-toggle-group/editable-button-toggle.component.ts b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-toggle-group/editable-button-toggle.component.ts index 1e08a5d729c..57485189d69 100644 --- a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-toggle-group/editable-button-toggle.component.ts +++ b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-toggle-group/editable-button-toggle.component.ts @@ -38,11 +38,9 @@ import { Component, Input } from '@angular/core'; @Component({ selector: 'vitamui-common-editable-button-toggle', - template: '' + template: '', }) export class EditableButtonToggleComponent { - @Input() value: any; @Input() content: string; - } diff --git a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-toggle-group/editable-toggle-group.component.html b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-toggle-group/editable-toggle-group.component.html index 1c6423954e2..fbc6bb02f28 100644 --- a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-toggle-group/editable-toggle-group.component.html +++ b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-toggle-group/editable-toggle-group.component.html @@ -2,13 +2,13 @@
    - - {{content(control?.value)}} -
    - - {{button?.content}} - -
    + + {{ content(control?.value) }} +
    + + {{ button?.content }} + +
    edit
    @@ -23,17 +23,18 @@ cdkConnectedOverlay [cdkConnectedOverlayOpen]="editMode" [cdkConnectedOverlayOrigin]="origin" - [cdkConnectedOverlayPositions]="positions"> - + [cdkConnectedOverlayPositions]="positions" + >
    - +
    -
    - -
    {{content(control?.value)}}
    + +
    {{ content(control?.value) }}
    diff --git a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-toggle-group/editable-toggle-group.component.scss b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-toggle-group/editable-toggle-group.component.scss index cb7d883dfd0..36d49ad31c2 100644 --- a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-toggle-group/editable-toggle-group.component.scss +++ b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-toggle-group/editable-toggle-group.component.scss @@ -1,3 +1,3 @@ .editable-field-control { - margin-top: 15px; -} \ No newline at end of file + margin-top: 15px; +} diff --git a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-toggle-group/editable-toggle-group.component.spec.ts b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-toggle-group/editable-toggle-group.component.spec.ts index a875c20c8ec..548b51ce530 100644 --- a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-toggle-group/editable-toggle-group.component.spec.ts +++ b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-toggle-group/editable-toggle-group.component.spec.ts @@ -52,7 +52,7 @@ import { EditableToggleGroupComponent } from './editable-toggle-group.component' - ` + `, }) class TesthostComponent { value: string; @@ -69,20 +69,9 @@ describe('EditableSelectComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [ - OverlayModule, - FormsModule, - ReactiveFormsModule, - MatProgressSpinnerModule, - MatButtonToggleModule, - ], - declarations: [ - TesthostComponent, - EditableToggleGroupComponent, - EditableButtonToggleComponent, - ] - }) - .compileComponents(); + imports: [OverlayModule, FormsModule, ReactiveFormsModule, MatProgressSpinnerModule, MatButtonToggleModule], + declarations: [TesthostComponent, EditableToggleGroupComponent, EditableButtonToggleComponent], + }).compileComponents(); inject([OverlayContainer], (oc: OverlayContainer) => { overlayContainerElement = oc.getContainerElement(); @@ -100,7 +89,6 @@ describe('EditableSelectComponent', () => { }); describe('DOM', () => { - it('should call enterEditMode() on click', () => { spyOn(testhost.component, 'enterEditMode'); const element = fixture.nativeElement.querySelector('.editable-field'); @@ -171,11 +159,9 @@ describe('EditableSelectComponent', () => { const elSpinner = fixture.nativeElement.querySelector('.editable-field mat-spinner'); expect(elSpinner).toBeFalsy(); }); - }); describe('Class', () => { - it('should set the control value', waitForAsync(() => { testhost.value = 'value1'; fixture.detectChanges(); @@ -254,6 +240,5 @@ describe('EditableSelectComponent', () => { expect(testhost.component.control.value).toEqual('value1'); }); })); - }); }); diff --git a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-toggle-group/editable-toggle-group.component.ts b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-toggle-group/editable-toggle-group.component.ts index 221c1ccc76b..847fde8902b 100644 --- a/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-toggle-group/editable-toggle-group.component.ts +++ b/ui/ui-frontend-common/src/app/modules/components/editable-field/editable-toggle-group/editable-toggle-group.component.ts @@ -44,17 +44,16 @@ import { EditableButtonToggleComponent } from './editable-button-toggle.componen export const EDITABLE_TOGGLE_GROUP_VALUE_ACCESSOR: any = { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => EditableToggleGroupComponent), - multi: true + multi: true, }; @Component({ selector: 'vitamui-common-editable-toggle-group', templateUrl: './editable-toggle-group.component.html', styleUrls: ['./editable-toggle-group.component.scss'], - providers: [EDITABLE_TOGGLE_GROUP_VALUE_ACCESSOR] + providers: [EDITABLE_TOGGLE_GROUP_VALUE_ACCESSOR], }) export class EditableToggleGroupComponent extends EditableFieldComponent { - @ContentChildren(EditableButtonToggleComponent) buttons: QueryList; constructor(elementRef: ElementRef) { @@ -66,5 +65,4 @@ export class EditableToggleGroupComponent extends EditableFieldComponent { return found ? found.content : null; } - } diff --git a/ui/ui-frontend-common/src/app/modules/components/editable-field/emails-input/emails-input.component.html b/ui/ui-frontend-common/src/app/modules/components/editable-field/emails-input/emails-input.component.html index 773dfd1e271..59f3287fbfe 100644 --- a/ui/ui-frontend-common/src/app/modules/components/editable-field/emails-input/emails-input.component.html +++ b/ui/ui-frontend-common/src/app/modules/components/editable-field/emails-input/emails-input.component.html @@ -1,30 +1,37 @@
    -
    - - {{placeholder}} - - - -
    +
    + + {{ placeholder }} + + + +
    -
    - -
    +
    + +
    -
    {{'EMAILS_INPUT.WRONG_FORMAT' | translate}}
    -
    {{'EMAILS_INPUT.INVALID_USER' | translate}}
    +
    {{ 'EMAILS_INPUT.WRONG_FORMAT' | translate }}
    +
    {{ 'EMAILS_INPUT.INVALID_USER' | translate }}
    -
    -
    {{ email }}
    -
    - clear -
    +
    +
    {{ email }}
    +
    + clear
    +
    - diff --git a/ui/ui-frontend-common/src/app/modules/components/editable-field/emails-input/emails-input.component.scss b/ui/ui-frontend-common/src/app/modules/components/editable-field/emails-input/emails-input.component.scss index 55854063b54..7524d13a7f2 100644 --- a/ui/ui-frontend-common/src/app/modules/components/editable-field/emails-input/emails-input.component.scss +++ b/ui/ui-frontend-common/src/app/modules/components/editable-field/emails-input/emails-input.component.scss @@ -1,63 +1,63 @@ @import '../../../../../sass/variables/colors'; :host { - width: 100%; - display: block; + width: 100%; + display: block; - &::ng-deep { - .mat-button-wrapper { - padding: 0!important; - } + &::ng-deep { + .mat-button-wrapper { + padding: 0 !important; } + } } button { - background-color: var(--vitamui-primary)!important; - width: 35px; - height: 35px; + background-color: var(--vitamui-primary) !important; + width: 35px; + height: 35px; - i { - font-size: 20px; - font-weight: 600; - } + i { + font-size: 20px; + font-weight: 600; + } + + &:disabled { + background-color: var(--vitamui-grey-300) !important; - &:disabled { - background-color: var(--vitamui-grey-300)!important; - - > i { - color: var(--vitamui-grey-800);; - } + > i { + color: var(--vitamui-grey-800); } + } } .domain-input-control { - display: flex; - height: 60px; + display: flex; + height: 60px; - .domain-input-wrapper { - display: flex; - align-items: center; - } + .domain-input-wrapper { + display: flex; + align-items: center; + } - .actions { - width: 100%; - display: flex; - align-items: center; - justify-content: flex-end; - } + .actions { + width: 100%; + display: flex; + align-items: center; + justify-content: flex-end; + } - mat-spinner { - margin-left: 1rem;; - } + mat-spinner { + margin-left: 1rem; + } } .vitamui-input-errors { - padding: 0; - position: relative; - top: -8px; + padding: 0; + position: relative; + top: -8px; } .vitamui-chip-list { - margin-top: 0.5rem; - margin-bottom: 0.5rem; -} \ No newline at end of file + margin-top: 0.5rem; + margin-bottom: 0.5rem; +} diff --git a/ui/ui-frontend-common/src/app/modules/components/editable-field/emails-input/emails-input.component.ts b/ui/ui-frontend-common/src/app/modules/components/editable-field/emails-input/emails-input.component.ts index b529293c4bb..dce6188f50e 100644 --- a/ui/ui-frontend-common/src/app/modules/components/editable-field/emails-input/emails-input.component.ts +++ b/ui/ui-frontend-common/src/app/modules/components/editable-field/emails-input/emails-input.component.ts @@ -43,17 +43,16 @@ import { ControlValueAccessor, FormControl, NG_VALUE_ACCESSOR, Validators } from export const EMAILS_INPUT_ACCESSOR: any = { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => EmailsInputComponent), - multi: true + multi: true, }; @Component({ selector: 'vitamui-common-emails-input', templateUrl: './emails-input.component.html', styleUrls: ['./emails-input.component.scss'], - providers: [EMAILS_INPUT_ACCESSOR] + providers: [EMAILS_INPUT_ACCESSOR], }) export class EmailsInputComponent implements ControlValueAccessor { - @Input() placeholder: string; @Input() spinnerDiameter = 25; @@ -65,11 +64,7 @@ export class EmailsInputComponent implements ControlValueAccessor { onTouched: () => void; constructor() { - this.control = new FormControl( - '', - [Validators.pattern(/^[_a-z0-9]+(\.[_a-z0-9]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/)], - null - ); + this.control = new FormControl('', [Validators.pattern(/^[_a-z0-9]+(\.[_a-z0-9]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/)], null); } writeValue(emails: string[]) { @@ -85,9 +80,13 @@ export class EmailsInputComponent implements ControlValueAccessor { } add(): void { - if (this.control.invalid || this.control.pending) { return; } + if (this.control.invalid || this.control.pending) { + return; + } const email = this.control.value.trim(); - if (this.emails.includes(email)) { return; } + if (this.emails.includes(email)) { + return; + } this.emails.push(email); this.onChange(this.emails); this.control.reset(); @@ -109,5 +108,4 @@ export class EmailsInputComponent implements ControlValueAccessor { get emailExists(): boolean { return this.emails.includes((this.control.value || '').trim()); } - } diff --git a/ui/ui-frontend-common/src/app/modules/components/editable-field/emails-input/emails-input.module.ts b/ui/ui-frontend-common/src/app/modules/components/editable-field/emails-input/emails-input.module.ts index 20567739f8f..35ce21d2c93 100644 --- a/ui/ui-frontend-common/src/app/modules/components/editable-field/emails-input/emails-input.module.ts +++ b/ui/ui-frontend-common/src/app/modules/components/editable-field/emails-input/emails-input.module.ts @@ -44,15 +44,8 @@ import { TranslateModule } from '@ngx-translate/core'; import { EmailsInputComponent } from './emails-input.component'; @NgModule({ - imports: [ - CommonModule, - ReactiveFormsModule, - MatProgressSpinnerModule, - MatButtonModule, - MatInputModule, - TranslateModule - ], + imports: [CommonModule, ReactiveFormsModule, MatProgressSpinnerModule, MatButtonModule, MatInputModule, TranslateModule], declarations: [EmailsInputComponent], - exports: [EmailsInputComponent] + exports: [EmailsInputComponent], }) -export class EmailsInputModule { } +export class EmailsInputModule {} diff --git a/ui/ui-frontend-common/src/app/modules/components/editable-field/level-input/level-input.component.html b/ui/ui-frontend-common/src/app/modules/components/editable-field/level-input/level-input.component.html index f3d15421458..432715f72c2 100644 --- a/ui/ui-frontend-common/src/app/modules/components/editable-field/level-input/level-input.component.html +++ b/ui/ui-frontend-common/src/app/modules/components/editable-field/level-input/level-input.component.html @@ -1,17 +1,34 @@
    - - + +
    -
    - +
    +
    - -
    \ No newline at end of file + +
    diff --git a/ui/ui-frontend-common/src/app/modules/components/editable-field/level-input/level-input.component.scss b/ui/ui-frontend-common/src/app/modules/components/editable-field/level-input/level-input.component.scss index 1bc7af26478..0d282cc5360 100644 --- a/ui/ui-frontend-common/src/app/modules/components/editable-field/level-input/level-input.component.scss +++ b/ui/ui-frontend-common/src/app/modules/components/editable-field/level-input/level-input.component.scss @@ -3,23 +3,22 @@ $anim-timing: 150ms ease-out; :host { + &.ng-valid.ng-touched .vitamui-input { + border: 1px solid $green; + } - &.ng-valid.ng-touched .vitamui-input { - border: 1px solid $green; - } - - &.ng-invalid.ng-touched .vitamui-input { - border: 1px solid $red; - } + &.ng-invalid.ng-touched .vitamui-input { + border: 1px solid $red; + } } :host.ng-pending { - .vitamui-input mat-spinner { - display: block; - } + .vitamui-input mat-spinner { + display: block; + } } input { - text-transform: uppercase; - transition: margin $anim-timing; + text-transform: uppercase; + transition: margin $anim-timing; } diff --git a/ui/ui-frontend-common/src/app/modules/components/editable-field/level-input/level-input.component.spec.ts b/ui/ui-frontend-common/src/app/modules/components/editable-field/level-input/level-input.component.spec.ts index 52dfff73155..96c912a2afd 100644 --- a/ui/ui-frontend-common/src/app/modules/components/editable-field/level-input/level-input.component.spec.ts +++ b/ui/ui-frontend-common/src/app/modules/components/editable-field/level-input/level-input.component.spec.ts @@ -47,17 +47,10 @@ describe('LevelInputComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [ - FormsModule, - HttpClientTestingModule, - TranslateModule.forRoot() - ], - providers: [ - { provide: WINDOW_LOCATION, useValue: {} }, - ], + imports: [FormsModule, HttpClientTestingModule, TranslateModule.forRoot()], + providers: [{ provide: WINDOW_LOCATION, useValue: {} }], declarations: [LevelInputComponent], - }) - .compileComponents(); + }).compileComponents(); })); beforeEach(() => { diff --git a/ui/ui-frontend-common/src/app/modules/components/editable-field/level-input/level-input.component.ts b/ui/ui-frontend-common/src/app/modules/components/editable-field/level-input/level-input.component.ts index 6c420b949e2..f357881c49f 100644 --- a/ui/ui-frontend-common/src/app/modules/components/editable-field/level-input/level-input.component.ts +++ b/ui/ui-frontend-common/src/app/modules/components/editable-field/level-input/level-input.component.ts @@ -44,34 +44,45 @@ import { extractSubLevel } from '../../../utils'; export const LEVEL_INPUT_VALUE_ACCESSOR: any = { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => LevelInputComponent), - multi: true + multi: true, }; @Component({ selector: 'vitamui-common-level-input', templateUrl: './level-input.component.html', styleUrls: ['./level-input.component.scss'], - providers: [LEVEL_INPUT_VALUE_ACCESSOR] + providers: [LEVEL_INPUT_VALUE_ACCESSOR], }) export class LevelInputComponent implements OnInit, ControlValueAccessor { - @Input() prefix: string; @Input() - get isEditableComponent(): boolean { return this._isEditableComponent; } - set isEditableComponent(value: boolean) { this._isEditableComponent = coerceBooleanProperty(value); } + get isEditableComponent(): boolean { + return this._isEditableComponent; + } + set isEditableComponent(value: boolean) { + this._isEditableComponent = coerceBooleanProperty(value); + } // tslint:disable-next-line:variable-name private _isEditableComponent = false; @Input() - get required(): boolean { return this._required; } - set required(value: boolean) { this._required = coerceBooleanProperty(value); } + get required(): boolean { + return this._required; + } + set required(value: boolean) { + this._required = coerceBooleanProperty(value); + } // tslint:disable-next-line:variable-name private _required = false; @Input() - get disabled(): boolean { return this._disabled; } - set disabled(value: boolean) { this._disabled = coerceBooleanProperty(value); } + get disabled(): boolean { + return this._disabled; + } + set disabled(value: boolean) { + this._disabled = coerceBooleanProperty(value); + } // tslint:disable-next-line:variable-name private _disabled = false; @@ -82,8 +93,8 @@ export class LevelInputComponent implements OnInit, ControlValueAccessor { @HostBinding('class.vitamui-focused') focused = false; @HostBinding('class.vitamui-float') labelFloat = false; - onChange = (_: any) => { }; - onTouched = () => { }; + onChange = (_: any) => {}; + onTouched = () => {}; @HostListener('click') onClick() { @@ -122,7 +133,7 @@ export class LevelInputComponent implements OnInit, ControlValueAccessor { onValueChange(_: string) { this.labelFloat = !!this.subLevel; - const level = this.prefix ? this.prefix + '.' + this.subLevel : this.subLevel ; + const level = this.prefix ? this.prefix + '.' + this.subLevel : this.subLevel; this.onChange(level.toLocaleUpperCase()); } } diff --git a/ui/ui-frontend-common/src/app/modules/components/editable-field/level-input/level-input.module.spec.ts b/ui/ui-frontend-common/src/app/modules/components/editable-field/level-input/level-input.module.spec.ts index fbaa01b4d3d..06e8fe18b7b 100644 --- a/ui/ui-frontend-common/src/app/modules/components/editable-field/level-input/level-input.module.spec.ts +++ b/ui/ui-frontend-common/src/app/modules/components/editable-field/level-input/level-input.module.spec.ts @@ -35,7 +35,6 @@ * knowledge of the CeCILL-C license and that you accept its terms. */ - import { TranslateModule } from '@ngx-translate/core'; import { LevelInputModule } from './level-input.module'; diff --git a/ui/ui-frontend-common/src/app/modules/components/editable-field/level-input/level-input.module.ts b/ui/ui-frontend-common/src/app/modules/components/editable-field/level-input/level-input.module.ts index edc6996577e..bdd9f8f4fa0 100644 --- a/ui/ui-frontend-common/src/app/modules/components/editable-field/level-input/level-input.module.ts +++ b/ui/ui-frontend-common/src/app/modules/components/editable-field/level-input/level-input.module.ts @@ -42,12 +42,8 @@ import { TranslateModule } from '@ngx-translate/core'; import { LevelInputComponent } from './level-input.component'; @NgModule({ - imports: [ - CommonModule, - FormsModule, - TranslateModule, - ], + imports: [CommonModule, FormsModule, TranslateModule], declarations: [LevelInputComponent], - exports: [LevelInputComponent] + exports: [LevelInputComponent], }) -export class LevelInputModule { } +export class LevelInputModule {} diff --git a/ui/ui-frontend-common/src/app/modules/components/editable-field/multiple-email-input/multiple-email-input.component.html b/ui/ui-frontend-common/src/app/modules/components/editable-field/multiple-email-input/multiple-email-input.component.html index b420f2211e6..12c34223801 100644 --- a/ui/ui-frontend-common/src/app/modules/components/editable-field/multiple-email-input/multiple-email-input.component.html +++ b/ui/ui-frontend-common/src/app/modules/components/editable-field/multiple-email-input/multiple-email-input.component.html @@ -1,49 +1,51 @@ -
    -
    -
    - - -
    - {{ email }} -
    -
    -
    - -
    -
    {{'MULTIPLE_EMAILS_INPUT.ERROR' | translate}}
    -
    - edit -
    - +
    +
    +
    + + +
    + {{ email }} +
    +
    +
    +
    +
    {{ 'MULTIPLE_EMAILS_INPUT.ERROR' | translate }}
    +
    + edit +
    +
    +
    -
    +
    - -
    - - -
    -
    - - -
    - -
    - {{ email }} + +
    + +
    -
    \ No newline at end of file + + + +
    + +
    + {{ email }} +
    +
    diff --git a/ui/ui-frontend-common/src/app/modules/components/editable-field/multiple-email-input/multiple-email-input.component.spec.ts b/ui/ui-frontend-common/src/app/modules/components/editable-field/multiple-email-input/multiple-email-input.component.spec.ts index ac5c5a1ef8c..ecf85db9cac 100644 --- a/ui/ui-frontend-common/src/app/modules/components/editable-field/multiple-email-input/multiple-email-input.component.spec.ts +++ b/ui/ui-frontend-common/src/app/modules/components/editable-field/multiple-email-input/multiple-email-input.component.spec.ts @@ -52,9 +52,7 @@ import { EmailsInputModule } from '../emails-input/emails-input.module'; import { MultipleEmailInputComponent } from './multiple-email-input.component'; @Component({ - template: ` - - ` + template: ` `, }) class TesthostComponent { value: string[]; @@ -70,7 +68,6 @@ describe('MultipleEmailInputComponent', () => { let overlayContainerElement: HTMLElement; beforeEach(waitForAsync(() => { - // const flowValidatorsSpy = jasmine.createSpyObj( // 'FlowValidators', // { nameExists: () => of(null), uniqueName: of(null)} @@ -87,16 +84,12 @@ describe('MultipleEmailInputComponent', () => { HttpClientTestingModule, TranslateModule.forRoot(), ], - declarations: [ - TesthostComponent, - MultipleEmailInputComponent, - ], + declarations: [TesthostComponent, MultipleEmailInputComponent], providers: [ { provide: WINDOW_LOCATION, useValue: {} }, // { provide: FlowValidators, useValue: flowValidatorsSpy }, - ] - }) - .compileComponents(); + ], + }).compileComponents(); inject([OverlayContainer], (oc: OverlayContainer) => { overlayContainerElement = oc.getContainerElement(); @@ -114,7 +107,6 @@ describe('MultipleEmailInputComponent', () => { }); describe('DOM', () => { - it('should call enterEditMode() on click', () => { spyOn(testhost.component, 'enterEditMode'); const element = fixture.nativeElement.querySelector('.editable-field'); @@ -133,7 +125,7 @@ describe('MultipleEmailInputComponent', () => { fixture.whenStable().then(() => { fixture.detectChanges(); const elDomains = fixture.nativeElement.querySelectorAll( - '.editable-field .editable-field-content .editable-field-text-content > div' + '.editable-field .editable-field-content .editable-field-text-content > div', ); expect(elDomains.length).toBe(3); expect(elDomains[0].textContent).toContain(testhost.value[0]); @@ -149,7 +141,7 @@ describe('MultipleEmailInputComponent', () => { fixture.whenStable().then(() => { fixture.detectChanges(); const elDomains = fixture.nativeElement.querySelectorAll( - '.editable-field .editable-field-content .editable-field-text-content > div' + '.editable-field .editable-field-content .editable-field-text-content > div', ); expect(elDomains.length).toBe(4); }); @@ -203,11 +195,9 @@ describe('MultipleEmailInputComponent', () => { const elSpinner = fixture.nativeElement.querySelector('.editable-field mat-spinner'); expect(elSpinner).toBeFalsy(); }); - }); describe('Class', () => { - it('should set the control value', waitForAsync(() => { testhost.value = ['test1.com', 'test2.com']; fixture.detectChanges(); diff --git a/ui/ui-frontend-common/src/app/modules/components/editable-field/multiple-email-input/multiple-email-input.component.ts b/ui/ui-frontend-common/src/app/modules/components/editable-field/multiple-email-input/multiple-email-input.component.ts index 688729c4911..d81443f8f91 100644 --- a/ui/ui-frontend-common/src/app/modules/components/editable-field/multiple-email-input/multiple-email-input.component.ts +++ b/ui/ui-frontend-common/src/app/modules/components/editable-field/multiple-email-input/multiple-email-input.component.ts @@ -42,16 +42,15 @@ import { EditableFieldComponent } from '../editable-field.component'; export const MULTIPLE_EMAIL_INPUT_VALUE_ACCESSOR: any = { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => MultipleEmailInputComponent), - multi: true + multi: true, }; @Component({ selector: 'vitamui-common-multiple-email-input', templateUrl: './multiple-email-input.component.html', - providers: [MULTIPLE_EMAIL_INPUT_VALUE_ACCESSOR] + providers: [MULTIPLE_EMAIL_INPUT_VALUE_ACCESSOR], }) export class MultipleEmailInputComponent extends EditableFieldComponent { - private emailInputClicked = false; get canConfirm(): boolean { @@ -63,7 +62,9 @@ export class MultipleEmailInputComponent extends EditableFieldComponent { } confirm() { - if (!this.canConfirm) { return; } + if (!this.canConfirm) { + return; + } super.confirm(); } @@ -72,7 +73,9 @@ export class MultipleEmailInputComponent extends EditableFieldComponent { } onClick(target: HTMLElement) { - if (!this.editMode) { return; } + if (!this.editMode) { + return; + } if (this.emailInputClicked) { this.emailInputClicked = false; @@ -88,5 +91,4 @@ export class MultipleEmailInputComponent extends EditableFieldComponent { onEmailInputClick() { this.emailInputClicked = true; } - } diff --git a/ui/ui-frontend-common/src/app/modules/components/footer/footer.component.html b/ui/ui-frontend-common/src/app/modules/components/footer/footer.component.html index 61a9d0c3f6c..16c932fcdb2 100644 --- a/ui/ui-frontend-common/src/app/modules/components/footer/footer.component.html +++ b/ui/ui-frontend-common/src/app/modules/components/footer/footer.component.html @@ -1,4 +1,4 @@
    -
    -
    {{version}}
    +
    +
    {{ version }}
    diff --git a/ui/ui-frontend-common/src/app/modules/components/footer/footer.component.spec.ts b/ui/ui-frontend-common/src/app/modules/components/footer/footer.component.spec.ts index 7384bb9ed14..23b0b86a26b 100644 --- a/ui/ui-frontend-common/src/app/modules/components/footer/footer.component.spec.ts +++ b/ui/ui-frontend-common/src/app/modules/components/footer/footer.component.spec.ts @@ -1,16 +1,14 @@ import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { FooterComponent } from './footer.component'; - describe('FooterComponent', () => { let component: FooterComponent; let fixture: ComponentFixture; beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - declarations: [ FooterComponent ] - }) - .compileComponents(); + declarations: [FooterComponent], + }).compileComponents(); })); beforeEach(() => { @@ -18,5 +16,4 @@ describe('FooterComponent', () => { component = fixture.componentInstance; fixture.detectChanges(); }); - }); diff --git a/ui/ui-frontend-common/src/app/modules/components/footer/footer.component.ts b/ui/ui-frontend-common/src/app/modules/components/footer/footer.component.ts index 5f3fd78c1c8..d028bee34b2 100644 --- a/ui/ui-frontend-common/src/app/modules/components/footer/footer.component.ts +++ b/ui/ui-frontend-common/src/app/modules/components/footer/footer.component.ts @@ -17,8 +17,8 @@ export class FooterComponent implements OnInit { constructor( private startupService: StartupService, private authService: AuthService, - private themeService: ThemeService - ) { } + private themeService: ThemeService, + ) {} ngOnInit() { const versionRelease = this.startupService.getConfigStringValue('VERSION_RELEASE'); diff --git a/ui/ui-frontend-common/src/app/modules/components/footer/footer.module.ts b/ui/ui-frontend-common/src/app/modules/components/footer/footer.module.ts index f2a87c650ca..ab0553e8fa1 100644 --- a/ui/ui-frontend-common/src/app/modules/components/footer/footer.module.ts +++ b/ui/ui-frontend-common/src/app/modules/components/footer/footer.module.ts @@ -42,6 +42,6 @@ import { FooterComponent } from './footer.component'; @NgModule({ declarations: [FooterComponent], imports: [TranslateModule, CommonModule], - exports: [FooterComponent] + exports: [FooterComponent], }) export class FooterModule {} diff --git a/ui/ui-frontend-common/src/app/modules/components/header/header.component.html b/ui/ui-frontend-common/src/app/modules/components/header/header.component.html index 0f8425ab1ca..ab0fb2ca0d6 100644 --- a/ui/ui-frontend-common/src/app/modules/components/header/header.component.html +++ b/ui/ui-frontend-common/src/app/modules/components/header/header.component.html @@ -1,7 +1,7 @@ @@ -20,7 +20,8 @@ [selectedLabel]="'SELECT_TENANT.SELECTED' | translate" [items]="appTenants" [selectedItem]="selectedTenant" - (itemSelected)="updateTenant($event)"> + (itemSelected)="updateTenant($event)" + > @@ -30,15 +31,16 @@ [selectedLabel]="'SELECT_CUSTOMER.SELECTED' | translate" [items]="customers" [selectedItem]="selectedCustomer" - (itemSelected)="updateCustomer($event)"> + (itemSelected)="updateCustomer($event)" + >
    @@ -71,7 +71,7 @@ > - {{ node.count | number : '1.0' }} + {{ node.count | number: '1.0' }}
    { it('LeavesTreeComponent should be stable after creation', () => { expect(component).toBeTruthy(); - // expect(component.projectId).toBeDefined(); + // expect(component.projectId).toBeDefined(); expect(component.nestedTreeControlLeaves).toBeDefined(); }); diff --git a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/filing-holding-scheme/leaves-tree/leaves-tree.component.ts b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/filing-holding-scheme/leaves-tree/leaves-tree.component.ts index 5170e923fae..117b0756113 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/filing-holding-scheme/leaves-tree/leaves-tree.component.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/filing-holding-scheme/leaves-tree/leaves-tree.component.ts @@ -36,7 +36,7 @@ import { DescriptionLevel, FilingHoldingSchemeNode, VitamuiIcons, - VitamuiUnitTypes + VitamuiUnitTypes, } from 'ui-frontend-common'; import { ArchiveCollectService } from '../../../../archive-collect.service'; import { PagedResult, ResultFacet, SearchCriteriaDto, SearchCriteriaTypeEnum } from '../../../models/search.criteria'; @@ -65,7 +65,7 @@ export class LeavesTreeComponent implements OnInit, OnChanges, OnDestroy { @Output() switchView: EventEmitter = new EventEmitter(); nestedTreeControlLeaves: NestedTreeControl = new NestedTreeControl( - (node) => node.children + (node) => node.children, ); showEveryNodes = true; showFacetsCount = false; @@ -75,7 +75,7 @@ export class LeavesTreeComponent implements OnInit, OnChanges, OnDestroy { constructor( private archiveCollectService: ArchiveCollectService, private archiveSharedDataService: ArchiveSharedDataService, - private archiveFacetsService: ArchiveFacetsService + private archiveFacetsService: ArchiveFacetsService, ) {} ngOnChanges(changes: SimpleChanges): void { @@ -105,7 +105,7 @@ export class LeavesTreeComponent implements OnInit, OnChanges, OnDestroy { this.subscriptions.add( this.archiveSharedDataService.getLastSearchCriteriaDtoSubject().subscribe((searchCriteriaDto: SearchCriteriaDto) => { this.searchCriterias = searchCriteriaDto; - }) + }), ); this.showFacetsCount = false; } @@ -155,7 +155,7 @@ export class LeavesTreeComponent implements OnInit, OnChanges, OnDestroy { FilingHoldingSchemeHandler.setCountRecursively(parentNodes, facets); this.refreshTreeNodes(); this.loadingNodesDetails = false; - }) + }), ); } @@ -185,7 +185,7 @@ export class LeavesTreeComponent implements OnInit, OnChanges, OnDestroy { this.subscriptions.add( this.sendSearchArchiveUnitsByCriteria(searchCriteria).subscribe((pageResult) => { this.checkFacetsAndLoadUnknowns(parentNodes, pageResult); - }) + }), ); } @@ -219,7 +219,7 @@ export class LeavesTreeComponent implements OnInit, OnChanges, OnDestroy { parentNode.isLoadingChildren = false; this.refreshTreeNodes(); this.searchWithSearchCriteriasForFacets(matchingNodesNumbers.nodesAddedList); - }) + }), ); } @@ -361,9 +361,9 @@ export class LeavesTreeComponent implements OnInit, OnChanges, OnDestroy { return this.getNodeUnitType(filingholdingscheme) === VitamuiUnitTypes.HOLDING_UNIT ? VitamuiIcons.VITAMUI_HOLDING_UNIT_ICON_ : this.getNodeUnitType(filingholdingscheme) === VitamuiUnitTypes.FILING_UNIT - ? VitamuiIcons.VITAMUI_FILING_UNIT_ICON_ - : this.getNodeUnitType(filingholdingscheme) === VitamuiUnitTypes.INGEST && !filingholdingscheme?.hasObject - ? VitamuiIcons.VITAMUI_INGEST_WITHOUT_OBJECT_ICON_ - : VitamuiIcons.VITAMUI_INGEST_WITH_OBJECT_ICON_; + ? VitamuiIcons.VITAMUI_FILING_UNIT_ICON_ + : this.getNodeUnitType(filingholdingscheme) === VitamuiUnitTypes.INGEST && !filingholdingscheme?.hasObject + ? VitamuiIcons.VITAMUI_INGEST_WITHOUT_OBJECT_ICON_ + : VitamuiIcons.VITAMUI_INGEST_WITH_OBJECT_ICON_; } } diff --git a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/reuse-rule-search/reuse-rule-search.component.html b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/reuse-rule-search/reuse-rule-search.component.html index 28478305ac0..366cfa5bd96 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/reuse-rule-search/reuse-rule-search.component.html +++ b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/reuse-rule-search/reuse-rule-search.component.html @@ -16,13 +16,9 @@ minlength="1" > {{ 'COMMON.REQUIRED' | translate }} - {{ 'COLLECT.RULE.WRONG_FORMAT' | translate }} - + {{ 'COLLECT.RULE.WRONG_FORMAT' | translate }} - {{ 'COLLECT.RULE.CODE_NOT_EXIST' | translate }} - + {{ 'COLLECT.RULE.CODE_NOT_EXIST' | translate }}
    diff --git a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/reuse-rule-search/reuse-rule-search.component.ts b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/reuse-rule-search/reuse-rule-search.component.ts index 4bec893164d..4df6c0933ca 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/reuse-rule-search/reuse-rule-search.component.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/reuse-rule-search/reuse-rule-search.component.ts @@ -100,7 +100,7 @@ export class ReuseRuleSearchComponent implements OnInit, OnDestroy { private formBuilder: FormBuilder, public dialog: MatDialog, private archiveExchangeDataService: ArchiveSharedDataService, - private ruleValidator: RuleValidator + private ruleValidator: RuleValidator, ) { this.reuseRuleCriteriaForm = this.formBuilder.group({ reuseRuleIdentifier: [null, [this.ruleValidator.ruleIdPattern()], this.ruleValidator.uniqueRuleId()], @@ -115,7 +115,7 @@ export class ReuseRuleSearchComponent implements OnInit, OnDestroy { debounceTime(ArchiveSearchConstsEnum.UPDATE_DEBOUNCE_TIME), map(() => this.reuseRuleCriteriaForm.value), map(() => diff(this.reuseRuleCriteriaForm.value, this.previousReuseCriteriaValue)), - filter((formData) => this.isEmpty(formData)) + filter((formData) => this.isEmpty(formData)), ) .subscribe(() => { this.resetReuseRuleCriteriaForm(); @@ -134,7 +134,7 @@ export class ReuseRuleSearchComponent implements OnInit, OnDestroy { CriteriaOperator.EQ, false, CriteriaDataType.STRING, - SearchCriteriaTypeEnum.REUSE_RULE + SearchCriteriaTypeEnum.REUSE_RULE, ); this.resetReuseRuleCriteriaForm(); } @@ -151,7 +151,7 @@ export class ReuseRuleSearchComponent implements OnInit, OnDestroy { } } } - } + }, ); } @@ -169,7 +169,7 @@ export class ReuseRuleSearchComponent implements OnInit, OnDestroy { CriteriaOperator.MISSING, true, CriteriaDataType.STRING, - SearchCriteriaTypeEnum.REUSE_RULE + SearchCriteriaTypeEnum.REUSE_RULE, ); } else { this.emitRemoveCriteriaEvent(RULE_ORIGIN + RULE_TYPE_SUFFIX, { @@ -189,7 +189,7 @@ export class ReuseRuleSearchComponent implements OnInit, OnDestroy { CriteriaOperator.EQ, true, CriteriaDataType.STRING, - SearchCriteriaTypeEnum.REUSE_RULE + SearchCriteriaTypeEnum.REUSE_RULE, ); } else { this.emitRemoveCriteriaEvent(RULE_ORIGIN + RULE_TYPE_SUFFIX, { @@ -209,7 +209,7 @@ export class ReuseRuleSearchComponent implements OnInit, OnDestroy { CriteriaOperator.EXISTS, true, CriteriaDataType.STRING, - SearchCriteriaTypeEnum.REUSE_RULE + SearchCriteriaTypeEnum.REUSE_RULE, ); } else { this.emitRemoveCriteriaEvent(RULE_ORIGIN + RULE_TYPE_SUFFIX, { @@ -238,7 +238,7 @@ export class ReuseRuleSearchComponent implements OnInit, OnDestroy { CriteriaOperator.LTE, false, CriteriaDataType.INTERVAL, - SearchCriteriaTypeEnum.REUSE_RULE + SearchCriteriaTypeEnum.REUSE_RULE, ); this.reuseRuleCriteriaForm.controls.reuseRuleStartDate.setValue(null); } @@ -258,7 +258,7 @@ export class ReuseRuleSearchComponent implements OnInit, OnDestroy { CriteriaOperator.EQ, false, CriteriaDataType.STRING, - SearchCriteriaTypeEnum.REUSE_RULE + SearchCriteriaTypeEnum.REUSE_RULE, ); this.reuseRuleCriteriaForm.controls.reuseRuleIdentifier.setValue(null); } @@ -278,7 +278,7 @@ export class ReuseRuleSearchComponent implements OnInit, OnDestroy { CriteriaOperator.BETWEEN, false, CriteriaDataType.INTERVAL, - SearchCriteriaTypeEnum.REUSE_RULE + SearchCriteriaTypeEnum.REUSE_RULE, ); this.reuseRuleCriteriaForm.controls.reuseRuleStartDate.setValue(null); this.reuseRuleCriteriaForm.controls.reuseRuleEndDate.setValue(null); @@ -297,7 +297,7 @@ export class ReuseRuleSearchComponent implements OnInit, OnDestroy { CriteriaOperator.EQ, false, CriteriaDataType.STRING, - SearchCriteriaTypeEnum.REUSE_RULE + SearchCriteriaTypeEnum.REUSE_RULE, ); this.resetReuseRuleCriteriaForm(); return true; @@ -310,7 +310,7 @@ export class ReuseRuleSearchComponent implements OnInit, OnDestroy { CriteriaOperator.EQ, false, CriteriaDataType.STRING, - SearchCriteriaTypeEnum.REUSE_RULE + SearchCriteriaTypeEnum.REUSE_RULE, ); return true; } @@ -357,7 +357,7 @@ export class ReuseRuleSearchComponent implements OnInit, OnDestroy { CriteriaOperator.EXISTS, true, CriteriaDataType.STRING, - SearchCriteriaTypeEnum.REUSE_RULE + SearchCriteriaTypeEnum.REUSE_RULE, ); this.reuseAdditionalCriteria.set(ORIGIN_HAS_AT_LEAST_ONE, true); } @@ -374,7 +374,7 @@ export class ReuseRuleSearchComponent implements OnInit, OnDestroy { operator: string, valueTranslated: boolean, dataType: string, - category?: SearchCriteriaTypeEnum + category?: SearchCriteriaTypeEnum, ) { if (keyElt && valueElt) { this.archiveExchangeDataService.addSimpleSearchCriteriaSubject({ diff --git a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/search-criteria-list/confirm-action/confirm-action.component.ts b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/search-criteria-list/confirm-action/confirm-action.component.ts index 2e2c9b68cd2..a8fafd009f7 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/search-criteria-list/confirm-action/confirm-action.component.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/search-criteria-list/confirm-action/confirm-action.component.ts @@ -35,11 +35,11 @@ * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ -import {Component, Input, OnInit} from '@angular/core'; +import { Component, Input, OnInit } from '@angular/core'; @Component({ selector: 'vitamui-confirm-action', - templateUrl: './confirm-action.component.html' + templateUrl: './confirm-action.component.html', }) export class ConfirmActionComponent implements OnInit { // delete or changeTab @@ -50,10 +50,7 @@ export class ConfirmActionComponent implements OnInit { @Input() objectType: string; @Input() objectDate: string; - constructor() { - } - - ngOnInit() { - } + constructor() {} + ngOnInit() {} } diff --git a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/search-criteria-list/search-criteria-list.component.ts b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/search-criteria-list/search-criteria-list.component.ts index 9b742d9e4cf..088c0c885ca 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/search-criteria-list/search-criteria-list.component.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/search-criteria-list/search-criteria-list.component.ts @@ -69,7 +69,7 @@ export class SearchCriteriaListComponent implements OnInit { private archiveSharedDataService: ArchiveSharedDataService, public dialog: MatDialog, private snackBar: VitamUISnackBar, - private translateService: TranslateService + private translateService: TranslateService, ) {} ngOnInit() { diff --git a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/search-criteria-saver/search-criteria-saver.component.html b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/search-criteria-saver/search-criteria-saver.component.html index 1281c16bcde..4cff4532adb 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/search-criteria-saver/search-criteria-saver.component.html +++ b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/search-criteria-saver/search-criteria-saver.component.html @@ -81,7 +81,7 @@ save - {{ criteria.name | truncate : 30 }} + {{ criteria.name | truncate: 30 }} - ({{ getNbFilters(criteria) }} filtres) @@ -125,7 +125,7 @@ matTooltipClass="vitamui-tooltip" [matTooltipShowDelay]="300" > - {{ criteriaToUpdate.name | truncate : 30 }} + {{ criteriaToUpdate.name | truncate: 30 }} - ({{ getNbFilters(criteriaToUpdate) }} filtres) diff --git a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/search-criteria-saver/search-criteria-saver.component.ts b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/search-criteria-saver/search-criteria-saver.component.ts index 4a1d52e676c..15372fef405 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/search-criteria-saver/search-criteria-saver.component.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/search-criteria-saver/search-criteria-saver.component.ts @@ -84,7 +84,7 @@ export class SearchCriteriaSaverComponent implements OnInit, OnDestroy { private confirmDialogService: ConfirmDialogService, private snackBar: MatSnackBar, private datePipe: DatePipe, - private translatePipe: TranslatePipe + private translatePipe: TranslatePipe, ) { this.searchCriteriaForm = this.formBuilder.group({ searchCriteriaForm: null, @@ -129,7 +129,7 @@ export class SearchCriteriaSaverComponent implements OnInit, OnDestroy { this.dialogRef.close(true); this.snackBar.openFromComponent(VitamUISnackBarComponent, { panelClass: 'vitamui-snack-bar', - data: {type: 'searchCriteriaHistoryCreated', name: response.name}, + data: { type: 'searchCriteriaHistoryCreated', name: response.name }, duration: 10000, }); }, @@ -139,7 +139,7 @@ export class SearchCriteriaSaverComponent implements OnInit, OnDestroy { panelClass: 'vitamui-snack-bar', duration: 10000, }); - } + }, ); } @@ -196,7 +196,7 @@ export class SearchCriteriaSaverComponent implements OnInit, OnDestroy { this.dialogRef.close(true); this.snackBar.openFromComponent(VitamUISnackBarComponent, { panelClass: 'vitamui-snack-bar', - data: {type: 'searchCriteriaHistoryCreated', name: this.criteriaToUpdate.name}, + data: { type: 'searchCriteriaHistoryCreated', name: this.criteriaToUpdate.name }, duration: 10000, }); }, @@ -205,7 +205,7 @@ export class SearchCriteriaSaverComponent implements OnInit, OnDestroy { panelClass: 'vitamui-snack-bar', duration: 10000, }); - } + }, ); } @@ -262,7 +262,7 @@ export class SearchCriteriaSaverComponent implements OnInit, OnDestroy { } return [...searchCriteriaMap.values()] .map((searchCriteria) => { - const {dataType, category, keyTranslated, key, values} = searchCriteria; + const { dataType, category, keyTranslated, key, values } = searchCriteria; const categoryName = this.getCategoryName(category); const label = keyTranslated ? this.translatePipe.transform(`COLLECT.SEARCH_CRITERIA_FILTER.${categoryName}.${key}`) : key; const tooltip = label; diff --git a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/simple-criteria-search/simple-criteria-search.component.html b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/simple-criteria-search/simple-criteria-search.component.html index eef355ac5b3..63706ec9db1 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/simple-criteria-search/simple-criteria-search.component.html +++ b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/simple-criteria-search/simple-criteria-search.component.html @@ -56,7 +56,7 @@ >{{ 'COLLECT.SEARCH_CRITERIA_FILTER.FIELDS.START_DATE_SEARCH' | translate }} {{ simpleCriteriaForm.get('beginDt').value | dateTime : 'dd/MM/yyyy' }} + >{{ simpleCriteriaForm.get('beginDt').value | dateTime: 'dd/MM/yyyy' }} {{ simpleCriteriaForm.get('endDt').value | dateTime : 'dd/MM/yyyy' }} + >{{ simpleCriteriaForm.get('endDt').value | dateTime: 'dd/MM/yyyy' }} {{ simpleCriteriaForm.get('otherCriteriaValue').value | dateTime : 'dd/MM/yyyy' }} + >{{ simpleCriteriaForm.get('otherCriteriaValue').value | dateTime: 'dd/MM/yyyy' }} { this.ontologies = data.filter((ontology) => ontology.ApiField !== undefined); @@ -154,7 +154,7 @@ export class SimpleCriteriaSearchComponent implements OnInit { filter(() => this.simpleCriteriaForm.valid), map(() => this.simpleCriteriaForm.value), map(() => diff(this.simpleCriteriaForm.value, this.previousSimpleCriteriaValue)), - filter((formData) => this.isEmpty(formData)) + filter((formData) => this.isEmpty(formData)), ) .subscribe(() => { this.resetSimpleCriteriaForm(); @@ -181,7 +181,7 @@ export class SimpleCriteriaSearchComponent implements OnInit { true, CriteriaOperator.EQ, false, - CriteriaDataType.STRING + CriteriaDataType.STRING, ); return true; } else if (formData.description) { @@ -192,7 +192,7 @@ export class SimpleCriteriaSearchComponent implements OnInit { true, CriteriaOperator.EQ, false, - CriteriaDataType.STRING + CriteriaDataType.STRING, ); return true; } else if (formData.beginDt) { @@ -203,7 +203,7 @@ export class SimpleCriteriaSearchComponent implements OnInit { true, CriteriaOperator.GTE, false, - CriteriaDataType.DATE + CriteriaDataType.DATE, ); return true; } else if (formData.endDt) { @@ -214,7 +214,7 @@ export class SimpleCriteriaSearchComponent implements OnInit { true, CriteriaOperator.LTE, false, - CriteriaDataType.DATE + CriteriaDataType.DATE, ); return true; } else if (formData.serviceProdCode) { @@ -225,7 +225,7 @@ export class SimpleCriteriaSearchComponent implements OnInit { true, CriteriaOperator.EQ, false, - CriteriaDataType.STRING + CriteriaDataType.STRING, ); return true; } else if (formData.serviceProdLabel) { @@ -236,7 +236,7 @@ export class SimpleCriteriaSearchComponent implements OnInit { true, CriteriaOperator.EQ, false, - CriteriaDataType.STRING + CriteriaDataType.STRING, ); return true; } else if (formData.guid) { @@ -250,7 +250,7 @@ export class SimpleCriteriaSearchComponent implements OnInit { true, CriteriaOperator.EQ, false, - CriteriaDataType.STRING + CriteriaDataType.STRING, ); } }); @@ -265,7 +265,7 @@ export class SimpleCriteriaSearchComponent implements OnInit { false, CriteriaOperator.EQ, false, - CriteriaDataType.DATE + CriteriaDataType.DATE, ); } else { this.addCriteria( @@ -275,7 +275,7 @@ export class SimpleCriteriaSearchComponent implements OnInit { false, CriteriaOperator.EQ, false, - CriteriaDataType.STRING + CriteriaDataType.STRING, ); } return true; @@ -314,7 +314,7 @@ export class SimpleCriteriaSearchComponent implements OnInit { criteriaSearch.operator, this.isValueTranslated(criteriaSearch.criteria), criteriaSearch.dataType, - criteriaSearch.category as SearchCriteriaTypeEnum + criteriaSearch.category as SearchCriteriaTypeEnum, ); }); }); @@ -327,7 +327,7 @@ export class SimpleCriteriaSearchComponent implements OnInit { CriteriaOperator.EQ, false, CriteriaDataType.STRING, - SearchCriteriaTypeEnum.FIELDS + SearchCriteriaTypeEnum.FIELDS, ); this.addCriteria( @@ -338,7 +338,7 @@ export class SimpleCriteriaSearchComponent implements OnInit { CriteriaOperator.EQ, false, CriteriaDataType.STRING, - SearchCriteriaTypeEnum.FIELDS + SearchCriteriaTypeEnum.FIELDS, ); } } @@ -369,7 +369,7 @@ export class SimpleCriteriaSearchComponent implements OnInit { operator: string, valueTranslated: boolean, dataType: string, - category?: SearchCriteriaTypeEnum + category?: SearchCriteriaTypeEnum, ) { if (keyElt && valueElt) { this.archiveExchangeDataService.addSimpleSearchCriteriaSubject({ @@ -399,7 +399,7 @@ export class SimpleCriteriaSearchComponent implements OnInit { CriteriaOperator.EQ, false, CriteriaDataType.STRING, - SearchCriteriaTypeEnum.FIELDS + SearchCriteriaTypeEnum.FIELDS, ); } else { this.emitRemoveCriteriaEvent(ALL_ARCHIVE_UNIT_TYPES, { value: ARCHIVE_UNIT_WITH_OBJECTS, id: ARCHIVE_UNIT_WITH_OBJECTS }); @@ -415,7 +415,7 @@ export class SimpleCriteriaSearchComponent implements OnInit { CriteriaOperator.EQ, false, CriteriaDataType.STRING, - SearchCriteriaTypeEnum.FIELDS + SearchCriteriaTypeEnum.FIELDS, ); } else { this.emitRemoveCriteriaEvent(ALL_ARCHIVE_UNIT_TYPES, { value: ARCHIVE_UNIT_WITHOUT_OBJECTS, id: ARCHIVE_UNIT_WITHOUT_OBJECTS }); @@ -440,7 +440,7 @@ export class SimpleCriteriaSearchComponent implements OnInit { CriteriaOperator.EQ, false, CriteriaDataType.STRING, - SearchCriteriaTypeEnum.FIELDS + SearchCriteriaTypeEnum.FIELDS, ); this.archiveUnitTypesCriteria.set(unitObjectProperty, true); } diff --git a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/storage-rule-search/storage-rule-search.component.html b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/storage-rule-search/storage-rule-search.component.html index 93c2dd3f607..b0b421b4916 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/storage-rule-search/storage-rule-search.component.html +++ b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/storage-rule-search/storage-rule-search.component.html @@ -16,13 +16,9 @@ minlength="1" > {{ 'COMMON.REQUIRED' | translate }} - {{ 'COLLECT.RULE.WRONG_FORMAT' | translate }} - + {{ 'COLLECT.RULE.WRONG_FORMAT' | translate }} - {{ 'COLLECT.RULE.CODE_NOT_EXIST' | translate }} - + {{ 'COLLECT.RULE.CODE_NOT_EXIST' | translate }}
    @@ -97,9 +93,7 @@ >{{ 'COLLECT.SEARCH_CRITERIA_FILTER.FIELDS.END_DATE_DUA_END' | translate }} {{ storageRuleCriteriaForm.get('storageRuleEndDate').value | date: 'dd/MM/yyyy' }} - + >{{ storageRuleCriteriaForm.get('storageRuleEndDate').value | date: 'dd/MM/yyyy' }} this.storageRuleCriteriaForm.value), map(() => diff(this.storageRuleCriteriaForm.value, this.previousStorageCriteriaValue)), - filter((formData) => this.isEmpty(formData)) + filter((formData) => this.isEmpty(formData)), ) .subscribe(() => { this.resetStorageRuleCriteriaForm(); @@ -152,7 +152,7 @@ export class StorageRuleSearchComponent implements OnInit, OnDestroy { CriteriaOperator.EQ, false, CriteriaDataType.STRING, - SearchCriteriaTypeEnum.STORAGE_RULE + SearchCriteriaTypeEnum.STORAGE_RULE, ); this.resetStorageRuleCriteriaForm(); } @@ -169,7 +169,7 @@ export class StorageRuleSearchComponent implements OnInit, OnDestroy { } } } - } + }, ); } @@ -215,7 +215,7 @@ export class StorageRuleSearchComponent implements OnInit, OnDestroy { CriteriaOperator.EXISTS, true, CriteriaDataType.STRING, - SearchCriteriaTypeEnum.STORAGE_RULE + SearchCriteriaTypeEnum.STORAGE_RULE, ); this.storageAdditionalCriteria.set(ORIGIN_HAS_AT_LEAST_ONE, true); } @@ -234,7 +234,7 @@ export class StorageRuleSearchComponent implements OnInit, OnDestroy { CriteriaOperator.MISSING, true, CriteriaDataType.STRING, - SearchCriteriaTypeEnum.STORAGE_RULE + SearchCriteriaTypeEnum.STORAGE_RULE, ); } else { this.emitRemoveCriteriaEvent(RULE_ORIGIN + RULE_TYPE_SUFFIX, { @@ -254,7 +254,7 @@ export class StorageRuleSearchComponent implements OnInit, OnDestroy { CriteriaOperator.EQ, true, CriteriaDataType.STRING, - SearchCriteriaTypeEnum.STORAGE_RULE + SearchCriteriaTypeEnum.STORAGE_RULE, ); } else { this.emitRemoveCriteriaEvent(RULE_ORIGIN + RULE_TYPE_SUFFIX, { @@ -274,7 +274,7 @@ export class StorageRuleSearchComponent implements OnInit, OnDestroy { CriteriaOperator.EXISTS, true, CriteriaDataType.STRING, - SearchCriteriaTypeEnum.STORAGE_RULE + SearchCriteriaTypeEnum.STORAGE_RULE, ); } else { this.emitRemoveCriteriaEvent(RULE_ORIGIN + RULE_TYPE_SUFFIX, { @@ -294,7 +294,7 @@ export class StorageRuleSearchComponent implements OnInit, OnDestroy { CriteriaOperator.EQ, true, CriteriaDataType.STRING, - SearchCriteriaTypeEnum.STORAGE_RULE + SearchCriteriaTypeEnum.STORAGE_RULE, ); } else { this.emitRemoveCriteriaEvent(FINAL_ACTION_TYPE + RULE_TYPE_SUFFIX, { @@ -314,7 +314,7 @@ export class StorageRuleSearchComponent implements OnInit, OnDestroy { CriteriaOperator.EQ, true, CriteriaDataType.STRING, - SearchCriteriaTypeEnum.STORAGE_RULE + SearchCriteriaTypeEnum.STORAGE_RULE, ); } else { this.emitRemoveCriteriaEvent(FINAL_ACTION_TYPE + RULE_TYPE_SUFFIX, { @@ -334,7 +334,7 @@ export class StorageRuleSearchComponent implements OnInit, OnDestroy { CriteriaOperator.EQ, true, CriteriaDataType.STRING, - SearchCriteriaTypeEnum.STORAGE_RULE + SearchCriteriaTypeEnum.STORAGE_RULE, ); } else { this.emitRemoveCriteriaEvent(FINAL_ACTION_TYPE + RULE_TYPE_SUFFIX, { @@ -354,7 +354,7 @@ export class StorageRuleSearchComponent implements OnInit, OnDestroy { CriteriaOperator.EQ, true, CriteriaDataType.STRING, - SearchCriteriaTypeEnum.STORAGE_RULE + SearchCriteriaTypeEnum.STORAGE_RULE, ); } else { this.emitRemoveCriteriaEvent(FINAL_ACTION + RULE_TYPE_SUFFIX, { @@ -384,7 +384,7 @@ export class StorageRuleSearchComponent implements OnInit, OnDestroy { CriteriaOperator.LTE, false, CriteriaDataType.INTERVAL, - SearchCriteriaTypeEnum.STORAGE_RULE + SearchCriteriaTypeEnum.STORAGE_RULE, ); this.storageRuleCriteriaForm.controls.storageRuleStartDate.setValue(null); } @@ -404,7 +404,7 @@ export class StorageRuleSearchComponent implements OnInit, OnDestroy { CriteriaOperator.EQ, false, CriteriaDataType.STRING, - SearchCriteriaTypeEnum.STORAGE_RULE + SearchCriteriaTypeEnum.STORAGE_RULE, ); this.storageRuleCriteriaForm.controls.storageRuleIdentifier.setValue(null); } @@ -424,7 +424,7 @@ export class StorageRuleSearchComponent implements OnInit, OnDestroy { CriteriaOperator.BETWEEN, false, CriteriaDataType.INTERVAL, - SearchCriteriaTypeEnum.STORAGE_RULE + SearchCriteriaTypeEnum.STORAGE_RULE, ); this.storageRuleCriteriaForm.controls.storageRuleStartDate.setValue(null); this.storageRuleCriteriaForm.controls.storageRuleEndDate.setValue(null); @@ -443,7 +443,7 @@ export class StorageRuleSearchComponent implements OnInit, OnDestroy { CriteriaOperator.EQ, false, CriteriaDataType.STRING, - SearchCriteriaTypeEnum.STORAGE_RULE + SearchCriteriaTypeEnum.STORAGE_RULE, ); this.resetStorageRuleCriteriaForm(); return true; @@ -456,7 +456,7 @@ export class StorageRuleSearchComponent implements OnInit, OnDestroy { CriteriaOperator.EQ, false, CriteriaDataType.STRING, - SearchCriteriaTypeEnum.STORAGE_RULE + SearchCriteriaTypeEnum.STORAGE_RULE, ); return true; } @@ -485,7 +485,7 @@ export class StorageRuleSearchComponent implements OnInit, OnDestroy { operator: string, valueTranslated: boolean, dataType: string, - category?: SearchCriteriaTypeEnum + category?: SearchCriteriaTypeEnum, ) { if (keyElt && valueElt) { this.archiveExchangeDataService.addSimpleSearchCriteriaSubject({ diff --git a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/title-and-description-criteria-search-collect/title-and-description-criteria-search-collect.component.html b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/title-and-description-criteria-search-collect/title-and-description-criteria-search-collect.component.html index 5d5ef88244e..14717310103 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/title-and-description-criteria-search-collect/title-and-description-criteria-search-collect.component.html +++ b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/title-and-description-criteria-search-collect/title-and-description-criteria-search-collect.component.html @@ -2,6 +2,7 @@ + label="{{ 'COLLECT.TITLE_SEARCH_AREA' | translate }}" + > diff --git a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/title-and-description-criteria-search-collect/title-and-description-criteria-search-collect.component.ts b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/title-and-description-criteria-search-collect/title-and-description-criteria-search-collect.component.ts index 898c9333261..3ff5276ee08 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/title-and-description-criteria-search-collect/title-and-description-criteria-search-collect.component.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/title-and-description-criteria-search-collect/title-and-description-criteria-search-collect.component.ts @@ -60,7 +60,11 @@ export class TitleAndDescriptionCriteriaSearchCollectComponent implements OnInit archiveCriteria: '', }; - constructor(private formBuilder: FormBuilder, private archiveExchangeDataService: ArchiveSharedDataService, public dialog: MatDialog) { + constructor( + private formBuilder: FormBuilder, + private archiveExchangeDataService: ArchiveSharedDataService, + public dialog: MatDialog, + ) { this.previousTitleDescriptionCriteriaValue = { archiveCriteria: '', }; @@ -74,7 +78,7 @@ export class TitleAndDescriptionCriteriaSearchCollectComponent implements OnInit filter(() => this.quickSearchCriteriaForm.valid), map(() => this.quickSearchCriteriaForm.value), map(() => diff(this.quickSearchCriteriaForm.value, this.previousTitleDescriptionCriteriaValue)), - filter((formData) => this.isEmpty(formData)) + filter((formData) => this.isEmpty(formData)), ) .subscribe(() => { this.resetSimpleCriteriaForm(); @@ -90,7 +94,7 @@ export class TitleAndDescriptionCriteriaSearchCollectComponent implements OnInit formData.archiveCriteria.trim(), true, CriteriaOperator.EQ, - false + false, ); return true; } else { diff --git a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/models/utils.ts b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/models/utils.ts index 3b31325bbb1..cc0a75aa0eb 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/models/utils.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/models/utils.ts @@ -36,8 +36,8 @@ */ /** - * This class is used as a tuple of 2 values to represent a Pair structure. - * Both key and value have the native object type in order to apply polymorphism + * This class is used as a tuple of 2 values to represent a Pair structure. + * Both key and value have the native object type in order to apply polymorphism * on the wanted types! */ export class Pair { @@ -55,13 +55,11 @@ export class Pair { * and optimize code ! */ export enum VitamInternalFields { - // UNITS ID = '#id', MANAGEMENT = '#management', ALL_UNIT_UPS = '#allunitups', UNIT_UPS = '#unitups', OPI = '#opi', - UNIT_TYPE = '#unitType' + UNIT_TYPE = '#unitType', } - diff --git a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/services/archive-facets.service.ts b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/services/archive-facets.service.ts index 7d3ce62f7be..b80ada18248 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/services/archive-facets.service.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/services/archive-facets.service.ts @@ -76,37 +76,37 @@ export class ArchiveFacetsService { if (facetResults) { archiveSearchResultFacets.appraisalRuleFacets = this.extractRulesFacetsResultsByCategory( facetResults, - SearchCriteriaMgtRuleEnum.APPRAISAL_RULE + SearchCriteriaMgtRuleEnum.APPRAISAL_RULE, ); archiveSearchResultFacets.accessRuleFacets = this.extractRulesFacetsResultsByCategory( facetResults, - SearchCriteriaMgtRuleEnum.ACCESS_RULE + SearchCriteriaMgtRuleEnum.ACCESS_RULE, ); archiveSearchResultFacets.disseminationRuleFacets = this.extractRulesFacetsResultsByCategory( facetResults, - SearchCriteriaMgtRuleEnum.DISSEMINATION_RULE + SearchCriteriaMgtRuleEnum.DISSEMINATION_RULE, ); archiveSearchResultFacets.reuseRuleFacets = this.extractRulesFacetsResultsByCategory( facetResults, - SearchCriteriaMgtRuleEnum.REUSE_RULE + SearchCriteriaMgtRuleEnum.REUSE_RULE, ); archiveSearchResultFacets.holdRuleFacets = this.extractRulesFacetsResultsByCategory( facetResults, - SearchCriteriaMgtRuleEnum.HOLD_RULE + SearchCriteriaMgtRuleEnum.HOLD_RULE, ); archiveSearchResultFacets.classificationRuleFacets = this.extractRulesFacetsResultsByCategory( facetResults, - SearchCriteriaMgtRuleEnum.CLASSIFICATION_RULE + SearchCriteriaMgtRuleEnum.CLASSIFICATION_RULE, ); archiveSearchResultFacets.storageRuleFacets = this.extractRulesFacetsResultsByCategory( facetResults, - SearchCriteriaMgtRuleEnum.STORAGE_RULE + SearchCriteriaMgtRuleEnum.STORAGE_RULE, ); } return archiveSearchResultFacets; diff --git a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/services/archive-search-helper.service.ts b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/services/archive-search-helper.service.ts index 03c0fb74766..3f7d8e9319e 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/services/archive-search-helper.service.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/services/archive-search-helper.service.ts @@ -68,7 +68,7 @@ export class ArchiveSearchHelperService { category: SearchCriteriaTypeEnum, valueTranslated: boolean, dataType: string, - emit: boolean + emit: boolean, ) { if (keyElt && valueElt) { if (valueElt && valueElt.id === ORIGIN_WAITING_RECALCULATE) { @@ -84,7 +84,7 @@ export class ArchiveSearchHelperService { SearchCriteriaTypeEnum.FIELDS, valueTranslated, dataType, - emit + emit, ); if (category === SearchCriteriaTypeEnum.ACCESS_RULE) { @@ -116,7 +116,7 @@ export class ArchiveSearchHelperService { const filtredValues = values.filter((elt) => criteria.dataType === CriteriaDataType.STRING || criteria.dataType === CriteriaDataType.DATE ? elt.value.value === valueElt.value - : elt.value.beginInterval === valueElt.beginInterval && elt.value.endInterval === valueElt.endInterval + : elt.value.beginInterval === valueElt.beginInterval && elt.value.endInterval === valueElt.endInterval, ); if (filtredValues.length === 0) { values.push({ @@ -191,7 +191,7 @@ export class ArchiveSearchHelperService { listOfUAIdToInclude: CriteriaValue[], listOfUAIdToExclude: CriteriaValue[], isAllchecked: boolean, - isIndeterminate: boolean + isIndeterminate: boolean, ) { const listOfUACriteriaSearch = []; if (criteriaSearchList && criteriaSearchList.length > 0) { @@ -231,7 +231,7 @@ export class ArchiveSearchHelperService { emit: boolean, searchCriteriaKeys: string[], searchCriterias: Map, - nbQueryCriteria: number + nbQueryCriteria: number, ) { if (searchCriterias && searchCriterias.size > 0) { if (valueElt && valueElt.id === WAITING_RECALCULATE) { @@ -275,7 +275,7 @@ export class ArchiveSearchHelperService { emit, searchCriteriaKeys, searchCriterias, - nbQueryCriteria + nbQueryCriteria, ); } searchCriterias.forEach((val, key) => { @@ -348,7 +348,7 @@ export class ArchiveSearchHelperService { updateCriteriaStatus( searchCriterias: Map, oldStatusFilter: SearchCriteriaStatusEnum, - newStatus: SearchCriteriaStatusEnum + newStatus: SearchCriteriaStatusEnum, ) { searchCriterias.forEach((value: SearchCriteria) => { value.values.forEach((elt) => { @@ -440,7 +440,7 @@ export class ArchiveSearchHelperService { buildManagementRulesCriteriaListForQuery( managementRuleType: string, searchCriterias: Map, - criteriaSearchList: SearchCriteriaEltDto[] + criteriaSearchList: SearchCriteriaEltDto[], ) { searchCriterias.forEach((criteria: SearchCriteria) => { if (criteria.category.toString() === managementRuleType) { @@ -498,7 +498,7 @@ export class ArchiveSearchHelperService { nodeId: string, searchCriterias: Map, searchCriteriaKeys: string[], - nbQueryCriteria: number + nbQueryCriteria: number, ) { nodeArray.forEach((node) => { if (node.id === nodeId) { @@ -516,7 +516,7 @@ export class ArchiveSearchHelperService { SearchCriteriaTypeEnum.NODES, false, CriteriaDataType.STRING, - false + false, ); } else if (node.children.length > 0) { this.fillNodeTitle(node.children, nodeId, searchCriterias, searchCriteriaKeys, nbQueryCriteria); diff --git a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/services/archive-shared-data.service.ts b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/services/archive-shared-data.service.ts index 3f3585965e7..90645690cdd 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/services/archive-shared-data.service.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/services/archive-shared-data.service.ts @@ -35,7 +35,7 @@ knowledge of the CeCILL-C license and that you accept its terms. */ import { Injectable } from '@angular/core'; import { BehaviorSubject, Observable } from 'rxjs'; -import {Direction, FilingHoldingSchemeNode, Unit} from 'ui-frontend-common'; +import { Direction, FilingHoldingSchemeNode, Unit } from 'ui-frontend-common'; import { NodeData } from '../models/nodedata.interface'; import { SearchCriteriaHistory } from '../models/search-criteria-history.interface'; import { ResultFacet, SearchCriteriaAddAction, SearchCriteriaDto, SearchCriteriaRemoveAction } from '../models/search.criteria'; diff --git a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/services/rule.validator.ts b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/services/rule.validator.ts index 24fc7f40f6c..55de31e06d1 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/services/rule.validator.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/services/rule.validator.ts @@ -41,11 +41,14 @@ import { ArchiveSharedDataService } from './archive-shared-data.service'; import { ManagementRulesSharedDataService } from './management-rules-shared-data.service'; @Injectable() -export class RuleValidator { +export class RuleValidator { private debounceTime = 400; ruleCategorySelected: string; - constructor(private managementRulesSharedDataService: ManagementRulesSharedDataService, private archiveSharedDataService: ArchiveSharedDataService) { } + constructor( + private managementRulesSharedDataService: ManagementRulesSharedDataService, + private archiveSharedDataService: ArchiveSharedDataService, + ) {} uniqueRuleId(ruleIdToIgnore?: string): AsyncValidatorFn { return this.uniqueFields('ruleId', 'ruleIdExists', ruleIdToIgnore); @@ -91,10 +94,11 @@ export class RuleValidator { const existField: any = {}; existField[existTag] = true; return timer(this.debounceTime).pipe( - switchMap(() => (control.value !== valueToIgnore ? - this.managementRulesSharedDataService.existsProperties(properties) : of(false))), + switchMap(() => + control.value !== valueToIgnore ? this.managementRulesSharedDataService.existsProperties(properties) : of(false), + ), take(1), - map((exists: boolean) => (exists ? null : existField)) + map((exists: boolean) => (exists ? null : existField)), ); } else { return of(false); diff --git a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/services/search-criteria-saver.service.ts b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/services/search-criteria-saver.service.ts index e1eba6a30a1..959e6dfa7a5 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/services/search-criteria-saver.service.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/services/search-criteria-saver.service.ts @@ -41,13 +41,12 @@ import { ProjectsApiService } from '../../../core/api/project-api.service'; import { SearchCriteriaHistory } from '../models/search-criteria-history.interface'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class SearchCriteriaSaverService extends SearchService { - constructor( private projectsApiService: ProjectsApiService, - http: HttpClient + http: HttpClient, ) { super(http, projectsApiService, 'ALL'); } diff --git a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/update-units-metadata/update-units-metadata.component.spec.ts b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/update-units-metadata/update-units-metadata.component.spec.ts index 132a3e67b7f..ca471725e01 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/update-units-metadata/update-units-metadata.component.spec.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/update-units-metadata/update-units-metadata.component.spec.ts @@ -56,7 +56,7 @@ const selectedTransaction: Transaction = { archiveProfile: 'archivalProfile', comment: 'comment', legalStatus: 'A legal status', - acquisitionInformation: 'Protocol' + acquisitionInformation: 'Protocol', }; describe('UpdateUaMetadataComponent', () => { diff --git a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/update-units-metadata/update-units-metadata.component.ts b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/update-units-metadata/update-units-metadata.component.ts index e931a65fad9..c83a9efa632 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/update-units-metadata/update-units-metadata.component.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/update-units-metadata/update-units-metadata.component.ts @@ -83,7 +83,7 @@ export class UpdateUnitsaMetadataComponent implements OnInit, OnDestroy { private dialogRef: MatDialogRef, private dialogRefToClose: MatDialogRef, private translateService: TranslateService, - private archiveCollectService: ArchiveCollectService + private archiveCollectService: ArchiveCollectService, ) {} ngOnDestroy(): void { @@ -130,7 +130,7 @@ export class UpdateUnitsaMetadataComponent implements OnInit, OnDestroy { this.isLoadingData = false; this.dialogRef.close(true); this.logger.error('Error message :', error); - } + }, ); } diff --git a/ui/ui-frontend/projects/collect/src/app/collect/core/api/project-api.service.spec.ts b/ui/ui-frontend/projects/collect/src/app/collect/core/api/project-api.service.spec.ts index 06e5e2ae868..c3859a11f6d 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/core/api/project-api.service.spec.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/core/api/project-api.service.spec.ts @@ -49,7 +49,7 @@ describe('ProjectService', () => { { provide: BASE_URL, useValue: '/fake-api' }, { provide: ENVIRONMENT, useValue: environment }, ], - }) + }), ); it('should be created', () => { const service: ProjectsApiService = TestBed.get(ProjectsApiService); diff --git a/ui/ui-frontend/projects/collect/src/app/collect/core/api/project-api.service.ts b/ui/ui-frontend/projects/collect/src/app/collect/core/api/project-api.service.ts index a32a9ba02da..66a009b8b91 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/core/api/project-api.service.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/core/api/project-api.service.ts @@ -34,11 +34,11 @@ The fact that you are presently reading this means that you have had knowledge of the CeCILL-C license and that you accept its terms. */ -import {HttpClient, HttpHeaders} from '@angular/common/http'; -import {Inject, Injectable} from '@angular/core'; -import {Observable} from 'rxjs'; -import {BASE_URL, BaseHttpClient, PageRequest, PaginatedResponse, Project, Transaction} from 'ui-frontend-common'; -import {SearchCriteriaHistory} from '../models'; +import { HttpClient, HttpHeaders } from '@angular/common/http'; +import { Inject, Injectable } from '@angular/core'; +import { Observable } from 'rxjs'; +import { BASE_URL, BaseHttpClient, PageRequest, PaginatedResponse, Project, Transaction } from 'ui-frontend-common'; +import { SearchCriteriaHistory } from '../models'; @Injectable({ providedIn: 'root', @@ -81,13 +81,7 @@ export class ProjectsApiService extends BaseHttpClient { // Manage Object Groups - getDownloadObjectFromUnitUrl( - unitId: string, - objectId: string, - tenantId: number, - qualifier?: string, - version?: number - ): string { + getDownloadObjectFromUnitUrl(unitId: string, objectId: string, tenantId: number, qualifier?: string, version?: number): string { let url = `${this.apiUrl}/object-groups/downloadobjectfromunit/${unitId}?objectId=${objectId}&tenantId=${tenantId}`; if (qualifier && version) { url += `&qualifier=${qualifier}&version=${version}`; @@ -116,7 +110,7 @@ export class ProjectsApiService extends BaseHttpClient { updateSearchCriteriaHistory(searchCriteriaHistory: SearchCriteriaHistory): Observable { return this.http.put( `${this.apiUrl}/archive-units/searchcriteriahistory/${searchCriteriaHistory.id}`, - searchCriteriaHistory + searchCriteriaHistory, ); } @@ -127,10 +121,10 @@ export class ProjectsApiService extends BaseHttpClient { public getTransactionsByProjectId( pageRequest: PageRequest, projectId?: string, - headers?: HttpHeaders + headers?: HttpHeaders, ): Observable> { const params = pageRequest.httpParams; - return this.http.get>(`${this.apiUrl}/${projectId}/transactions`, {params, headers}); + return this.http.get>(`${this.apiUrl}/${projectId}/transactions`, { params, headers }); } validateTransaction(id: string) { diff --git a/ui/ui-frontend/projects/collect/src/app/collect/core/api/transaction-api.service.ts b/ui/ui-frontend/projects/collect/src/app/collect/core/api/transaction-api.service.ts index 63bf3b88a58..8fe3968bcc4 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/core/api/transaction-api.service.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/core/api/transaction-api.service.ts @@ -34,21 +34,12 @@ The fact that you are presently reading this means that you have had knowledge of the CeCILL-C license and that you accept its terms. */ -import {HttpClient, HttpHeaders} from '@angular/common/http'; -import {Inject, Injectable} from '@angular/core'; -import {Observable} from 'rxjs'; -import { - ApiUnitObject, - BASE_URL, - BaseHttpClient, - Ontology, - PageRequest, - PaginatedResponse, - Transaction, - Unit -} from 'ui-frontend-common'; -import {SearchResponse} from '../../archive-search-collect/archive-search-criteria/models/search-response.interface'; -import {SearchCriteriaDto} from '../../archive-search-collect/archive-search-criteria/models/search.criteria'; +import { HttpClient, HttpHeaders } from '@angular/common/http'; +import { Inject, Injectable } from '@angular/core'; +import { Observable } from 'rxjs'; +import { ApiUnitObject, BASE_URL, BaseHttpClient, Ontology, PageRequest, PaginatedResponse, Transaction, Unit } from 'ui-frontend-common'; +import { SearchResponse } from '../../archive-search-collect/archive-search-criteria/models/search-response.interface'; +import { SearchCriteriaDto } from '../../archive-search-collect/archive-search-criteria/models/search.criteria'; @Injectable({ providedIn: 'root', @@ -102,11 +93,11 @@ export class TransactionApiService extends BaseHttpClient { // Manage Archive Units getCollectUnitById(unitId: string, headers?: HttpHeaders) { - return this.http.get(this.apiUrl + '/archive-units/archiveunit/' + unitId, {headers}); + return this.http.get(this.apiUrl + '/archive-units/archiveunit/' + unitId, { headers }); } searchArchiveUnitsByCriteria(criteriaDto: SearchCriteriaDto, tranasctionId: string, headers?: HttpHeaders): Observable { - return this.http.post(`${this.apiUrl}/archive-units/${tranasctionId}/search`, criteriaDto, {headers}); + return this.http.post(`${this.apiUrl}/archive-units/${tranasctionId}/search`, criteriaDto, { headers }); } exportCsvSearchArchiveUnitsByCriteria(criteriaDto: SearchCriteriaDto, tranasctionId: string, headers?: HttpHeaders): Observable { @@ -118,7 +109,7 @@ export class TransactionApiService extends BaseHttpClient { // Get the technical group object of a unit getObjectGroupDetailsById(objectId: string, headers?: HttpHeaders): Observable { - return this.http.get(this.apiUrl + '/objects/' + objectId, {headers, responseType: 'json'}); + return this.http.get(this.apiUrl + '/objects/' + objectId, { headers, responseType: 'json' }); } getExternalOntologiesList(): Observable { @@ -126,6 +117,6 @@ export class TransactionApiService extends BaseHttpClient { } selectUnitWithInheritedRules(tranasctionId: string, criteriaDto: SearchCriteriaDto, headers?: HttpHeaders): Observable { - return this.http.post(`${this.apiUrl}/${tranasctionId}/unit-with-inherited-rules`, criteriaDto, {headers}); + return this.http.post(`${this.apiUrl}/${tranasctionId}/unit-with-inherited-rules`, criteriaDto, { headers }); } } diff --git a/ui/ui-frontend/projects/collect/src/app/collect/core/models/create-project.interface.ts b/ui/ui-frontend/projects/collect/src/app/collect/core/models/create-project.interface.ts index c9d2b477dd8..f968557d885 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/core/models/create-project.interface.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/core/models/create-project.interface.ts @@ -33,5 +33,5 @@ export enum Workflow { export enum FlowType { FIX = 'FIX', - RULES = 'RULES' + RULES = 'RULES', } diff --git a/ui/ui-frontend/projects/collect/src/app/collect/projects/create-project/create-project.component.html b/ui/ui-frontend/projects/collect/src/app/collect/projects/create-project/create-project.component.html index f3fcd95a0ad..25dafdeea77 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/projects/create-project/create-project.component.html +++ b/ui/ui-frontend/projects/collect/src/app/collect/projects/create-project/create-project.component.html @@ -8,20 +8,18 @@
    -

    {{ 'COLLECT.MODAL.TITLE' | translate }}

    {{ 'COLLECT.MODAL.WORKFLOW_CHOICE' | translate }}

    - + - {{'COLLECT.MODAL.MANUAL_WORKFLOW' | translate}} + {{ 'COLLECT.MODAL.MANUAL_WORKFLOW' | translate }} - {{'COLLECT.MODAL.FLOW_WORKFLOW' | translate}} + {{ 'COLLECT.MODAL.FLOW_WORKFLOW' | translate }}
    @@ -49,14 +47,16 @@

    {{ 'COLLECT.PROJECT_DESCRIPTION_SUB_TITLE' | translate }}

    class="col" formControlName="messageIdentifier" placeholder="{{ 'COLLECT.PROJECT_DESCRIPTION_LABEL' | translate }}" - required> + required + >
    + placeholder="{{ 'COLLECT.PROJECT_DESCRIPTION_DESC' | translate }}" + >
    @@ -69,7 +69,8 @@

    {{ 'COLLECT.PROJECT_DESCRIPTION_SERVICES' | translate }}

    class="fields-padding d-flex" [disabled]="true" formControlName="referentialCheckup" - matTooltipPosition="below"> + matTooltipPosition="below" + > {{ 'COLLECT.PROJECT_DESCRIPTION_REFERENTIAL_CHECKUP' | translate }}
    @@ -80,12 +81,14 @@

    {{ 'COLLECT.PROJECT_DESCRIPTION_SERVICES' | translate }}

    class="col" formControlName="originatingAgencyIdentifier" placeholder="{{ 'COLLECT.PROJECT_DESCRIPTION_ORIGINATING_AGENCY' | translate }}" - required> + required + > + placeholder="{{ 'COLLECT.PROJECT_DESCRIPTION_ORIGINATING_AGENCY' | translate }}" + >
    @@ -93,19 +96,20 @@

    {{ 'COLLECT.PROJECT_DESCRIPTION_SERVICES' | translate }}

    class="col" formControlName="submissionAgencyIdentifier" placeholder="{{ 'COLLECT.PROJECT_DESCRIPTION_SUBMISSION_AGENCY' | translate }}" - required> + required + > + placeholder="{{ 'COLLECT.PROJECT_DESCRIPTION_SUBMISSION_AGENCY' | translate }}" + >
    -
    @@ -144,12 +149,14 @@

    {{ 'COLLECT.PROJECT_CONTEXT_SUB_TITLE' | translate }}

    class="col" formControlName="archivalAgencyIdentifier" placeholder="{{ 'COLLECT.PROJECT_CONTEXT_ARCHIVAL_AGENCY' | translate }}" - required> + required + > + placeholder="{{ 'COLLECT.PROJECT_CONTEXT_ARCHIVAL_AGENCY' | translate }}" + >
    @@ -157,12 +164,14 @@

    {{ 'COLLECT.PROJECT_CONTEXT_SUB_TITLE' | translate }}

    class="col" formControlName="transferringAgencyIdentifier" placeholder="{{ 'COLLECT.PROJECT_CONTEXT_TRANSFERRING_AGENCY' | translate }}" - required> + required + > + placeholder="{{ 'COLLECT.PROJECT_CONTEXT_TRANSFERRING_AGENCY' | translate }}" + >
    @@ -170,24 +179,28 @@

    {{ 'COLLECT.PROJECT_CONTEXT_SUB_TITLE' | translate }}

    class="col" formControlName="archivalAgreement" placeholder="{{ 'COLLECT.PROJECT_CONTEXT_ARCHIVAL_AGREEMENT' | translate }}" - required> + required + > + placeholder="{{ 'COLLECT.PROJECT_CONTEXT_ARCHIVAL_AGREEMENT' | translate }}" + >
    + placeholder="{{ 'COLLECT.PROJECT_CONTEXT_ARCHIVE_PROFILE' | translate }}" + > + placeholder="{{ 'COLLECT.PROJECT_CONTEXT_ARCHIVE_PROFILE' | translate }}" + >
    @@ -196,10 +209,9 @@

    {{ 'COLLECT.PROJECT_CONTEXT_SUB_TITLE' | translate }}

    {{ 'COLLECT.PROJECT_CONTEXT_ACQUISITION_INFORMATION' | translate }} - {{ + {{ acquisitionInformation - }} + }}
    @@ -209,8 +221,7 @@

    {{ 'COLLECT.PROJECT_CONTEXT_SUB_TITLE' | translate }}

    {{ 'COLLECT.PROJECT_CONTEXT_LEGAL_STATUS' | translate }} - {{ legalStatus.value }} + {{ legalStatus.value }}
    @@ -238,11 +249,13 @@

    {{ 'COLLECT.PROJECT_CONTEXT_SUB_TITLE' | translate }}

    {{ 'COLLECT.MODAL.TITLE' | translate }}

    {{ 'COLLECT.MODAL.UPLOAD_SUB_TITLE' | translate }}

    -
    +
    @@ -258,8 +271,7 @@

    {{ 'COLLECT.MODAL.UPLOAD_SUB_TITLE' | translate }}

    - +
    @@ -272,8 +284,7 @@

    {{ 'COLLECT.MODAL.UPLOAD_SUB_TITLE' | translate }}

    -
    @@ -389,13 +405,12 @@

    {{ 'COLLECT.MODAL.RULES_TITLE' | translate }}

    - - + {{ ontology.Identifier }} @@ -407,26 +422,31 @@

    {{ 'COLLECT.MODAL.RULES_TITLE' | translate }}

    - + -
    - +
    + {{ ruleParamForm.value.metadataValue }} - {{ ruleParamForm.value.metadataValue | dateTime : 'dd/MM/yyyy' }} + {{ ruleParamForm.value.metadataValue | dateTime: 'dd/MM/yyyy' }} - +
    @@ -435,9 +455,10 @@

    {{ 'COLLECT.MODAL.RULES_TITLE' | translate }}

    + [tenantIdentifier]="tenantIdentifier" + >
    @@ -456,8 +477,7 @@

    {{ 'COLLECT.MODAL.RULES_TITLE' | translate }}

    -
    - diff --git a/ui/ui-frontend/projects/collect/src/app/collect/projects/create-project/create-project.component.scss b/ui/ui-frontend/projects/collect/src/app/collect/projects/create-project/create-project.component.scss index 6792cf57464..f3c281329b2 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/projects/create-project/create-project.component.scss +++ b/ui/ui-frontend/projects/collect/src/app/collect/projects/create-project/create-project.component.scss @@ -1,8 +1,6 @@ @import '~ui-frontend-common/sass/variables/colors'; - .content { - .main-content { display: flex; flex-direction: column; @@ -74,7 +72,6 @@ h4 { align-items: center; } } - } .on-over { @@ -87,7 +84,7 @@ h4 { .drop-area { height: 100%; - background: #5CBAA9; + background: #5cbaa9; opacity: 0.9; color: $white; overflow: hidden; @@ -137,7 +134,8 @@ h4 { } .mat-form-field { - label, .mat-select { + label, + .mat-select { padding: 0 20px !important; } @@ -210,13 +208,12 @@ h4 { .delete-button { border: 1px solid var(--vitamui-primary); border-radius: 50%; - background-color: #FFFFFF; + background-color: #ffffff; width: 30px; height: 30px; font-size: medium; color: var(--vitamui-primary); cursor: pointer; - } } @@ -233,7 +230,6 @@ h4 { &.delete-button { padding: 15px 0 15px 20px; } - } } } diff --git a/ui/ui-frontend/projects/collect/src/app/collect/projects/create-project/create-project.component.spec.ts b/ui/ui-frontend/projects/collect/src/app/collect/projects/create-project/create-project.component.spec.ts index 2b565ebfdf9..2a95d0cbb88 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/projects/create-project/create-project.component.spec.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/projects/create-project/create-project.component.spec.ts @@ -37,20 +37,12 @@ import { MatSnackBarModule } from '@angular/material/snack-bar'; import { TranslateModule } from '@ngx-translate/core'; import { environment } from 'projects/collect/src/environments/environment'; import { of } from 'rxjs'; -import { - BASE_URL, - ENVIRONMENT, - InjectorModule, - LoggerModule, - Project, - ProjectStatus, - WINDOW_LOCATION -} from 'ui-frontend-common'; +import { BASE_URL, ENVIRONMENT, InjectorModule, LoggerModule, Project, ProjectStatus, WINDOW_LOCATION } from 'ui-frontend-common'; import { FlowType, Workflow } from '../../core/models/create-project.interface'; import { ProjectsService } from '../projects.service'; import { CreateProjectComponent } from './create-project.component'; -@Pipe({name: 'fileSize'}) +@Pipe({ name: 'fileSize' }) export class MockFileSizePipe implements PipeTransform { transform(value: string = ''): any { return value; @@ -82,13 +74,13 @@ describe('CreateProjectComponent', () => { declarations: [CreateProjectComponent, MockFileSizePipe], providers: [ FormBuilder, - {provide: BASE_URL, useValue: '/fake-api'}, - {provide: ENVIRONMENT, useValue: environment}, - {provide: MAT_DIALOG_DATA, useValue: {}}, - {provide: MatDialogRef, useValue: matDialogRefSpy}, - {provide: MatDialog, useValue: matDialogSpy}, - {provide: WINDOW_LOCATION, useValue: window.location}, - {provide: ProjectsService, useValue: projectsServiceMock}, + { provide: BASE_URL, useValue: '/fake-api' }, + { provide: ENVIRONMENT, useValue: environment }, + { provide: MAT_DIALOG_DATA, useValue: {} }, + { provide: MatDialogRef, useValue: matDialogRefSpy }, + { provide: MatDialog, useValue: matDialogSpy }, + { provide: WINDOW_LOCATION, useValue: window.location }, + { provide: ProjectsService, useValue: projectsServiceMock }, ], schemas: [NO_ERRORS_SCHEMA], }).compileComponents(); @@ -147,8 +139,8 @@ describe('CreateProjectComponent', () => { it('should createProject with form', () => { // Given - component.selectedWorkflow = Workflow.FLOW - component.selectedFlowType = FlowType.FIX + component.selectedWorkflow = Workflow.FLOW; + component.selectedFlowType = FlowType.FIX; component.initForm(); const project: Project = { id: 'id', @@ -175,7 +167,6 @@ describe('CreateProjectComponent', () => { }); describe('DOM', () => { - it('should have an input file', () => { const nativeElement = fixture.nativeElement; const elInput = nativeElement.querySelector('input[type=file]'); diff --git a/ui/ui-frontend/projects/collect/src/app/collect/projects/create-project/create-project.component.ts b/ui/ui-frontend/projects/collect/src/app/collect/projects/create-project/create-project.component.ts index 7dda1968b03..726df785a50 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/projects/create-project/create-project.component.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/projects/create-project/create-project.component.ts @@ -25,16 +25,7 @@ * accept its terms. */ import { animate, state, style, transition, trigger } from '@angular/animations'; -import { - AfterViewChecked, - ChangeDetectorRef, - Component, - Inject, - OnDestroy, - OnInit, - TemplateRef, - ViewChild -} from '@angular/core'; +import { AfterViewChecked, ChangeDetectorRef, Component, Inject, OnDestroy, OnInit, TemplateRef, ViewChild } from '@angular/core'; import { AbstractControl, FormArray, FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms'; import { MAT_DIALOG_DATA, MatDialog, MatDialogRef } from '@angular/material/dialog'; import { MatSnackBar } from '@angular/material/snack-bar'; @@ -49,7 +40,7 @@ import { Project, ProjectStatus, Transaction, - TransactionStatus + TransactionStatus, } from 'ui-frontend-common'; import { FilingPlanMode, oneIncludedNodeRequired } from 'vitamui-library'; @@ -66,8 +57,8 @@ import { TransactionsService } from '../transactions.service'; styleUrls: ['./create-project.component.scss'], animations: [ trigger('rotateAnimation', [ - state('collapse', style({transform: 'rotate(-180deg)'})), - state('expand', style({transform: 'rotate(0deg)'})), + state('collapse', style({ transform: 'rotate(-180deg)' })), + state('expand', style({ transform: 'rotate(0deg)' })), transition('expand <=> collapse', animate('200ms ease-out')), ]), ], @@ -91,7 +82,7 @@ export class CreateProjectComponent implements OnInit, OnDestroy, AfterViewCheck hasError = false; uploadFiles$: Observable; zippedFile$: Observable; - @ViewChild('fileSearch', {static: false}) fileSearch: any; + @ViewChild('fileSearch', { static: false }) fileSearch: any; tenantIdentifier: number; createdProject: Project; createdTransaction: Transaction; @@ -113,14 +104,14 @@ export class CreateProjectComponent implements OnInit, OnDestroy, AfterViewCheck ]; legalStatusList = [ - {id: 'Public Archive', value: this.translationService.instant('LEGAL_STATUS.PUBLIC_ARCHIVE')}, - {id: 'Private Archive', value: this.translationService.instant('LEGAL_STATUS.PRIVATE_ARCHIVE')}, - {id: 'Public and Private Archive', value: this.translationService.instant('LEGAL_STATUS.PUBLIC_PRIVATE_ARCHIVE')}, + { id: 'Public Archive', value: this.translationService.instant('LEGAL_STATUS.PUBLIC_ARCHIVE') }, + { id: 'Private Archive', value: this.translationService.instant('LEGAL_STATUS.PRIVATE_ARCHIVE') }, + { id: 'Public and Private Archive', value: this.translationService.instant('LEGAL_STATUS.PUBLIC_PRIVATE_ARCHIVE') }, ]; uploadZipCompleted = false; - @ViewChild('confirmDeleteAddRuleDialog', {static: true}) confirmDeleteAddRuleDialog: TemplateRef; + @ViewChild('confirmDeleteAddRuleDialog', { static: true }) confirmDeleteAddRuleDialog: TemplateRef; constructor( private formBuilder: FormBuilder, @@ -136,9 +127,8 @@ export class CreateProjectComponent implements OnInit, OnDestroy, AfterViewCheck private cdr: ChangeDetectorRef, private translationService: TranslateService, private archiveCollectService: ArchiveCollectService, - public dialog: MatDialog - ) { - } + public dialog: MatDialog, + ) {} get linkParentIdControl() { return this.projectForm.controls.linkParentIdControl as FormControl; @@ -229,7 +219,7 @@ export class CreateProjectComponent implements OnInit, OnDestroy, AfterViewCheck const items = event.dataTransfer.items; const exists = this.uploadService.directoryExistInZipFile(items, true); if (exists) { - this.snackBar.open(this.translationService.instant('COLLECT.UPLOAD_FILE_ALREADY_IMPORTED'), null, {duration: 3000}); + this.snackBar.open(this.translationService.instant('COLLECT.UPLOAD_FILE_ALREADY_IMPORTED'), null, { duration: 3000 }); return; } await this.uploadService.handleDragAndDropUpload(items); @@ -240,7 +230,7 @@ export class CreateProjectComponent implements OnInit, OnDestroy, AfterViewCheck const items = event.target.files; const exists = this.uploadService.directoryExistInZipFile(items, false); if (exists) { - this.snackBar.open(this.translationService.instant('COLLECT.UPLOAD_FILE_ALREADY_IMPORTED'), null, {duration: 3000}); + this.snackBar.open(this.translationService.instant('COLLECT.UPLOAD_FILE_ALREADY_IMPORTED'), null, { duration: 3000 }); return; } await this.uploadService.handleUpload(items); @@ -274,9 +264,7 @@ export class CreateProjectComponent implements OnInit, OnDestroy, AfterViewCheck /*** Form validator Step : Parametrer les regles de rattachement ***/ stepRulesParamsIsInvalid() { - return ( - this.projectForm.controls.rulesParams.invalid - ); + return this.projectForm.controls.rulesParams.invalid; } /*** Step 5 : Téléchargements ***/ @@ -304,7 +292,7 @@ export class CreateProjectComponent implements OnInit, OnDestroy, AfterViewCheck acquisitionInformation: [null], legalStatus: [null], // for unitUp : - linkParentIdControl: [{included: [], excluded: []}], + linkParentIdControl: [{ included: [], excluded: [] }], // for unitUps : rulesParams: this.formBuilder.array([], Validators.required), comment: [null], @@ -343,8 +331,8 @@ export class CreateProjectComponent implements OnInit, OnDestroy, AfterViewCheck metadataKey: ruleParam.ontology.ApiField, metadataValue: ruleParam.metadataValue, unitUp: ruleParam.unitUp.included[0], - } - }) + }; + }); } get rulesParams(): FormArray { @@ -364,7 +352,7 @@ export class CreateProjectComponent implements OnInit, OnDestroy, AfterViewCheck opened: [true], ontology: ['', Validators.required], metadataValue: ['', Validators.required], - unitUp: [{included: [], excluded: []}, oneIncludedNodeRequired()], + unitUp: [{ included: [], excluded: [] }, oneIncludedNodeRequired()], }); this.rulesParams.push(newRuleParamForm); } @@ -386,14 +374,14 @@ export class CreateProjectComponent implements OnInit, OnDestroy, AfterViewCheck const project: Project = this.formToProject(); this.moveToNextStep(); await this.projectsService.create(project).subscribe( - _result => { + (_result) => { this.pending = false; this.snackBar.open(this.translationService.instant('COLLECT.MODAL.PROJECT_CREATED'), null, { panelClass: 'vitamui-snack-bar', duration: 10000, }); }, - _error => { + (_error) => { this.pending = false; this.snackBar.open(this.translationService.instant('COLLECT.MODAL.PROJECT_CREATION_ERROR'), null, { panelClass: 'vitamui-snack-bar', @@ -411,11 +399,14 @@ export class CreateProjectComponent implements OnInit, OnDestroy, AfterViewCheck } as Transaction; this.uploadZipCompleted = false; this.moveToNextStep(); - await this.projectsService.create(project).toPromise() + await this.projectsService + .create(project) + .toPromise() .then((createProjectResponse) => { this.createdProject = createProjectResponse; transaction.projectId = this.createdProject.id; - this.transactionsService.create(transaction) + this.transactionsService + .create(transaction) .toPromise() .then((createTransactionResponse) => { this.createdTransaction = createTransactionResponse; @@ -423,8 +414,7 @@ export class CreateProjectComponent implements OnInit, OnDestroy, AfterViewCheck }) .then((uploadOperation) => { uploadOperation.subscribe( - () => { - }, + () => {}, (error: any) => { this.logger.error(error); }, @@ -435,13 +425,13 @@ export class CreateProjectComponent implements OnInit, OnDestroy, AfterViewCheck panelClass: 'vitamui-snack-bar', duration: 10000, }); - } + }, ); }) .catch((error) => { this.logger.error(error); }); - }) + }); } asFormGroup(control: AbstractControl) { @@ -451,5 +441,4 @@ export class CreateProjectComponent implements OnInit, OnDestroy, AfterViewCheck asFormControl(control: AbstractControl) { return control as FormControl; } - } diff --git a/ui/ui-frontend/projects/collect/src/app/collect/projects/project-list/project-list.component.ts b/ui/ui-frontend/projects/collect/src/app/collect/projects/project-list/project-list.component.ts index fbba4ec3413..9988eea109f 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/projects/project-list/project-list.component.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/projects/project-list/project-list.component.ts @@ -45,7 +45,10 @@ export class ProjectListComponent extends InfiniteScrollTable implement @Output() previewProjectDetailsPanel: EventEmitter = new EventEmitter(); - constructor(public projectsService: ProjectsService, private router: Router) { + constructor( + public projectsService: ProjectsService, + private router: Router, + ) { super(projectsService); } diff --git a/ui/ui-frontend/projects/collect/src/app/collect/projects/project-preview/project-preview.component.html b/ui/ui-frontend/projects/collect/src/app/collect/projects/project-preview/project-preview.component.html index 7f4b83b35dc..3af200f8cf2 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/projects/project-preview/project-preview.component.html +++ b/ui/ui-frontend/projects/collect/src/app/collect/projects/project-preview/project-preview.component.html @@ -1,7 +1,12 @@ -
    - +
    + -
    - +
    @@ -40,14 +52,15 @@
    - + -
    -
    @@ -57,7 +70,6 @@
    -
    @@ -79,13 +91,14 @@ class="col-4 px-0" formControlName="originatingAgencyIdentifier" placeholder="{{ 'COLLECT.PROJECT_UNIT_PREVIEW.FIELDS.SP_ID' | translate }} " - required *ngIf="updateStarted" + required + *ngIf="updateStarted" > @@ -100,22 +113,19 @@
    -
    -
    -
    @@ -197,7 +207,6 @@ placeholder="{{ 'COLLECT.PROJECT_CONTEXT_ARCHIVAL_AGENCY' | translate }}" required > - {{ 'COLLECT.PROJECT_CONTEXT_ACQUISITION_INFORMATION' | translate }} - {{ + {{ acquisitionInformation - }} + }}
    @@ -259,22 +267,18 @@ {{ 'COLLECT.PROJECT_CONTEXT_LEGAL_STATUS' | translate }} - {{ legalStatus.value }} + {{ legalStatus.value }}
    -
    -
    -
    @@ -308,39 +312,29 @@ - - -
    - {{'COLLECT.UPDATE_PROJECT.POPUP_ACTIONS_TITLE' | translate}} +
    + {{ 'COLLECT.UPDATE_PROJECT.POPUP_ACTIONS_TITLE' | translate }}
    - -
    - {{'COLLECT.UPDATE_PROJECT.POPUP_ACTIONS_CONTENT_MAJ1' | translate}} -
    - {{'COLLECT.UPDATE_PROJECT.POPUP_ACTIONS_CONTENT_MAJ2' | translate}} -
    - {{'COLLECT.UPDATE_PROJECT.POPUP_ACTIONS_CONTENT_MAJ3' | translate}} - +
    + {{ 'COLLECT.UPDATE_PROJECT.POPUP_ACTIONS_CONTENT_MAJ1' | translate }} +
    + {{ 'COLLECT.UPDATE_PROJECT.POPUP_ACTIONS_CONTENT_MAJ2' | translate }} +
    + {{ 'COLLECT.UPDATE_PROJECT.POPUP_ACTIONS_CONTENT_MAJ3' | translate }}
    -
    - - - {{'COMMON.YES' | translate}} - {{'COMMON.NO' | translate}} - + + {{ 'COMMON.YES' | translate }} + {{ 'COMMON.NO' | translate }}
    - - + diff --git a/ui/ui-frontend/projects/collect/src/app/collect/projects/project-preview/project-preview.component.scss b/ui/ui-frontend/projects/collect/src/app/collect/projects/project-preview/project-preview.component.scss index 0401b98677c..1cfab26bd0d 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/projects/project-preview/project-preview.component.scss +++ b/ui/ui-frontend/projects/collect/src/app/collect/projects/project-preview/project-preview.component.scss @@ -1,4 +1,3 @@ - .spinnerClass { min-height: 100px; display: flex; @@ -7,8 +6,6 @@ margin-top: 50%; } - - .dialog-content { padding-bottom: 15px; } @@ -36,20 +33,17 @@ } :host::ng-deep .mat-form-field { - .mat-form-field-outline { - background-color: #FFFFFF; + background-color: #ffffff; } - - label, .mat-select { + label, + .mat-select { padding: 0 20px !important; - } label { font-weight: 700; color: var(--vitamui-primary); - } } diff --git a/ui/ui-frontend/projects/collect/src/app/collect/projects/project-preview/project-preview.component.spec.ts b/ui/ui-frontend/projects/collect/src/app/collect/projects/project-preview/project-preview.component.spec.ts index 7a6faa9912e..6c6658c6d78 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/projects/project-preview/project-preview.component.spec.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/projects/project-preview/project-preview.component.spec.ts @@ -32,14 +32,14 @@ describe('ProjectPreviewComponent', () => { status: TransactionStatus.OPEN, submissionAgencyIdentifier: 'submissionAgencyIdentifier', transferringAgencyIdentifier: 'transferringAgencyIdentifier', - } + }; const transactionPaginatedResponse: PaginatedResponse = { pageNum: 0, pageSize: 1, totalElements: 1, hasMore: false, values: [transaction], - } + }; const project: Project = { id: 'newId', @@ -56,30 +56,39 @@ describe('ProjectPreviewComponent', () => { } as Project; const projectAfterUpdate = { - project, ...{messageIdentifier: 'test'} - } + project, + ...{ messageIdentifier: 'test' }, + }; const projectServiceMock = { getBaseUrl: () => '/fake-api', getProjectById: () => of(project), updateProject: () => of(projectAfterUpdate), getLegalStatusList: () => [ - {id: 'Public Archive', value: 'Public archives'}, - {id: 'Private Archive', value: 'Private archives'}, - {id: 'Public and Private Archive', value: 'Public and private archives'}, + { id: 'Public Archive', value: 'Public archives' }, + { id: 'Private Archive', value: 'Private archives' }, + { id: 'Public and Private Archive', value: 'Public and private archives' }, ], getAcquisitionInformationsList: () => [ - 'Payment', 'Protocol', 'Purchase', 'Copy', 'Dation', 'Deposit', 'Devolution', 'Donation', 'Bequest', 'Reinstatement', 'Other', 'Unknown' - ] + 'Payment', + 'Protocol', + 'Purchase', + 'Copy', + 'Dation', + 'Deposit', + 'Devolution', + 'Donation', + 'Bequest', + 'Reinstatement', + 'Other', + 'Unknown', + ], }; - beforeEach(waitForAsync(() => { - - const projectApiServiceMock = { getTransactionsByProjectId: () => of(transactionPaginatedResponse), - updateTransaction: () => of(transaction) + updateTransaction: () => of(transaction), }; TestBed.configureTestingModule({ @@ -87,20 +96,19 @@ describe('ProjectPreviewComponent', () => { imports: [MatDialogModule, VitamUICommonTestModule, MatSnackBarModule, BrowserModule, BrowserAnimationsModule, MatButtonToggleModule], providers: [ FormBuilder, - {provide: ProjectsService, useValue: projectServiceMock}, + { provide: ProjectsService, useValue: projectServiceMock }, { - provide: MatDialogRef, useValue: { - close: () => { - } - } + provide: MatDialogRef, + useValue: { + close: () => {}, + }, }, - {provide: ProjectsApiService, useValue: projectApiServiceMock}, - {provide: ActivatedRoute, useValue: {params: of('11')}}, - {provide: TranslateService, useValue: {instant: () => EMPTY}}, - {provide: Router, useValue: {}}, + { provide: ProjectsApiService, useValue: projectApiServiceMock }, + { provide: ActivatedRoute, useValue: { params: of('11') } }, + { provide: TranslateService, useValue: { instant: () => EMPTY } }, + { provide: Router, useValue: {} }, ], }).compileComponents(); - })); beforeEach(waitForAsync(() => { @@ -118,7 +126,6 @@ describe('ProjectPreviewComponent', () => { // Make assertions about the component expect(component.project).toEqual(project); }); - })); it('should get project when update', waitForAsync(() => { @@ -141,7 +148,7 @@ describe('ProjectPreviewComponent', () => { component.form.get('messageIdentifier').setValue(projectAfterUpdate.messageIdentifier); component.launchUpdate(); fixture.detectChanges(); - component.selectedValue = 'NON' + component.selectedValue = 'NON'; component.onConfirm(); fixture.detectChanges(); fixture.whenStable().then(() => { @@ -149,7 +156,6 @@ describe('ProjectPreviewComponent', () => { }); })); - it('should update project with transactions', waitForAsync(() => { spyOn(projectServiceMock, 'updateProject').and.returnValue(of(projectAfterUpdate)); component.showEditProject(); @@ -157,12 +163,11 @@ describe('ProjectPreviewComponent', () => { component.form.get('messageIdentifier').setValue(projectAfterUpdate.messageIdentifier); component.launchUpdate(); fixture.detectChanges(); - component.selectedValue = 'YES' + component.selectedValue = 'YES'; component.onConfirm(); fixture.detectChanges(); fixture.whenStable().then(() => { expect(projectServiceMock.updateProject).toHaveBeenCalled(); }); })); - }); diff --git a/ui/ui-frontend/projects/collect/src/app/collect/projects/project-preview/project-preview.component.ts b/ui/ui-frontend/projects/collect/src/app/collect/projects/project-preview/project-preview.component.ts index 9c7e5a9dee2..96d62e721d2 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/projects/project-preview/project-preview.component.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/projects/project-preview/project-preview.component.ts @@ -72,7 +72,7 @@ export class ProjectPreviewComponent implements OnInit { private router: Router, public dialog: MatDialog, private translationService: TranslateService, - private snackBar: MatSnackBar + private snackBar: MatSnackBar, ) {} ngOnInit(): void { @@ -210,7 +210,7 @@ export class ProjectPreviewComponent implements OnInit { } }); return combineLatest(updateTransactionOperation$).pipe(map(() => transactionsKO)); - }) + }), ) .subscribe( (transactionsKO: Transaction[]) => { @@ -225,7 +225,7 @@ export class ProjectPreviewComponent implements OnInit { }, () => { this.project = previousProject; - } + }, ); } else { updateProjectOperation$.subscribe( @@ -240,7 +240,7 @@ export class ProjectPreviewComponent implements OnInit { }, () => { this.project = previousProject; - } + }, ); } } diff --git a/ui/ui-frontend/projects/collect/src/app/collect/projects/project.module.ts b/ui/ui-frontend/projects/collect/src/app/collect/projects/project.module.ts index b7c573235b7..7646f9ed598 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/projects/project.module.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/projects/project.module.ts @@ -36,12 +36,12 @@ knowledge of the CeCILL-C license and that you accept its terms. import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; -import {FormsModule, ReactiveFormsModule} from '@angular/forms'; +import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { TableFilterModule, VitamUICommonModule } from 'ui-frontend-common'; import { VitamUILibraryModule } from 'vitamui-library'; import { MAT_MOMENT_DATE_ADAPTER_OPTIONS } from '@angular/material-moment-adapter'; -import {MatButtonToggleModule} from '@angular/material/button-toggle'; +import { MatButtonToggleModule } from '@angular/material/button-toggle'; import { MatDatepickerModule } from '@angular/material/datepicker'; import { MatDialogModule } from '@angular/material/dialog'; import { MatFormFieldModule } from '@angular/material/form-field'; @@ -58,25 +58,25 @@ import { ProjectRoutingModule } from './project-routing.module'; import { ProjectsComponent } from './projects.component'; @NgModule({ - imports: [ - CommonModule, - ProjectRoutingModule, - VitamUICommonModule, - MatMenuModule, - MatSnackBarModule, - MatDialogModule, - MatSidenavModule, - MatProgressSpinnerModule, - TableFilterModule, - VitamUILibraryModule, - ReactiveFormsModule, - MatFormFieldModule, - MatDatepickerModule, - MatSelectModule, - MatTabsModule, - MatButtonToggleModule, - FormsModule, - ], + imports: [ + CommonModule, + ProjectRoutingModule, + VitamUICommonModule, + MatMenuModule, + MatSnackBarModule, + MatDialogModule, + MatSidenavModule, + MatProgressSpinnerModule, + TableFilterModule, + VitamUILibraryModule, + ReactiveFormsModule, + MatFormFieldModule, + MatDatepickerModule, + MatSelectModule, + MatTabsModule, + MatButtonToggleModule, + FormsModule, + ], providers: [{ provide: MAT_MOMENT_DATE_ADAPTER_OPTIONS, useValue: { useUtc: true } }], declarations: [ProjectsComponent, ProjectListComponent, CreateProjectComponent, ProjectPreviewComponent], }) diff --git a/ui/ui-frontend/projects/collect/src/app/collect/projects/projects.component.html b/ui/ui-frontend/projects/collect/src/app/collect/projects/projects.component.html index b5a407e9aa6..c0c7901a984 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/projects/projects.component.html +++ b/ui/ui-frontend/projects/collect/src/app/collect/projects/projects.component.html @@ -19,10 +19,8 @@
    {{ 'COLLECT.APP_BREADCRUMB' | translate }} - - diff --git a/ui/ui-frontend/projects/collect/src/app/collect/projects/projects.component.ts b/ui/ui-frontend/projects/collect/src/app/collect/projects/projects.component.ts index 6624ae92ccb..15cc5f5617b 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/projects/projects.component.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/projects/projects.component.ts @@ -46,7 +46,11 @@ export class ProjectsComponent extends SidenavPage implements OnDestroy { @ViewChild(ProjectListComponent, { static: true }) projectListComponent: ProjectListComponent; - constructor(projectsService: ProjectsService, route: ActivatedRoute, private dialog: MatDialog) { + constructor( + projectsService: ProjectsService, + route: ActivatedRoute, + private dialog: MatDialog, + ) { super(route, projectsService); route.params.subscribe((params) => { this.tenantIdentifier = params.tenantIdentifier; diff --git a/ui/ui-frontend/projects/collect/src/app/collect/projects/projects.service.ts b/ui/ui-frontend/projects/collect/src/app/collect/projects/projects.service.ts index 5cf274262c3..d2ba6d2ace9 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/projects/projects.service.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/projects/projects.service.ts @@ -26,7 +26,7 @@ */ import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; -import {TranslateService} from '@ngx-translate/core'; +import { TranslateService } from '@ngx-translate/core'; import { Observable, Subject } from 'rxjs'; import { Project, SearchService } from 'ui-frontend-common'; import { ProjectsApiService } from '../core/api/project-api.service'; @@ -60,7 +60,11 @@ export class ProjectsService extends SearchService { { id: 'Public and Private Archive', value: this.translationService.instant('LEGAL_STATUS.PUBLIC_PRIVATE_ARCHIVE') }, ]; - constructor(http: HttpClient, private projectsApiService: ProjectsApiService,private translationService: TranslateService) { + constructor( + http: HttpClient, + private projectsApiService: ProjectsApiService, + private translationService: TranslateService, + ) { super(http, projectsApiService, 'ALL'); } @@ -68,12 +72,11 @@ export class ProjectsService extends SearchService { return this.projectsApiService.create(project); } - public getLegalStatusList(){ + public getLegalStatusList() { return this.legalStatusList; } - - public getAcquisitionInformationsList(){ + public getAcquisitionInformationsList() { return this.acquisitionInformationsList; } @@ -85,9 +88,7 @@ export class ProjectsService extends SearchService { return this.projectsApiService.getById(projectId); } - public deleteProjectId(projectId: string) : Observable { + public deleteProjectId(projectId: string): Observable { return this.projectsApiService.deletebyId(projectId); } - - } diff --git a/ui/ui-frontend/projects/collect/src/app/collect/shared/collect-upload/collect-upload.service.ts b/ui/ui-frontend/projects/collect/src/app/collect/shared/collect-upload/collect-upload.service.ts index 40823603c47..d13d6de3622 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/shared/collect-upload/collect-upload.service.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/shared/collect-upload/collect-upload.service.ts @@ -135,7 +135,7 @@ export class CollectUploadService { this.updateUploadedZipFile(data); } }), - catchError((error) => of(error)) + catchError((error) => of(error)), ); }); } @@ -224,11 +224,11 @@ export class CollectUploadService { private async parse(zip: JSZip, item: any) { if (item.isDirectory) { const dirEntries: any[] = await this.parseDirectoryEntry(item); - if(dirEntries.length === 0){ + if (dirEntries.length === 0) { zip.folder(item.fullPath.substring(1)); } for (let entry of dirEntries) { - await this.parse(zip, entry); + await this.parse(zip, entry); } } else { const f = await this.parseFileEntry(item); @@ -244,7 +244,7 @@ export class CollectUploadService { }, (err: any) => { reject(err); - } + }, ); }); } @@ -258,7 +258,7 @@ export class CollectUploadService { }, (err: any) => { reject(err); - } + }, ); }); } diff --git a/ui/ui-frontend/projects/collect/src/app/collect/shared/vitamui-snack-bar/vitamui-snack-bar.component.ts b/ui/ui-frontend/projects/collect/src/app/collect/shared/vitamui-snack-bar/vitamui-snack-bar.component.ts index 23d5e63f835..f197d726191 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/shared/vitamui-snack-bar/vitamui-snack-bar.component.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/shared/vitamui-snack-bar/vitamui-snack-bar.component.ts @@ -42,7 +42,10 @@ import { MatSnackBarRef, MAT_SNACK_BAR_DATA } from '@angular/material/snack-bar' styleUrls: ['./vitamui-snack-bar.component.scss'], }) export class VitamUISnackBarComponent { - constructor(@Inject(MAT_SNACK_BAR_DATA) public data: any, private matSnackBarRef: MatSnackBarRef) {} + constructor( + @Inject(MAT_SNACK_BAR_DATA) public data: any, + private matSnackBarRef: MatSnackBarRef, + ) {} close() { this.matSnackBarRef.dismiss(); diff --git a/ui/ui-frontend/projects/collect/src/app/collect/shared/vitamui-snack-bar/vitamui-snack-bar.module.ts b/ui/ui-frontend/projects/collect/src/app/collect/shared/vitamui-snack-bar/vitamui-snack-bar.module.ts index 3f383c86d9d..fa0021be2ff 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/shared/vitamui-snack-bar/vitamui-snack-bar.module.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/shared/vitamui-snack-bar/vitamui-snack-bar.module.ts @@ -36,16 +36,13 @@ knowledge of the CeCILL-C license and that you accept its terms. import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; -import {TranslateModule} from '@ngx-translate/core'; +import { TranslateModule } from '@ngx-translate/core'; import { VitamUISnackBarComponent } from './vitamui-snack-bar.component'; @NgModule({ - imports: [ - CommonModule, - TranslateModule - ], + imports: [CommonModule, TranslateModule], declarations: [VitamUISnackBarComponent], exports: [VitamUISnackBarComponent], - entryComponents: [VitamUISnackBarComponent] + entryComponents: [VitamUISnackBarComponent], }) -export class VitamUISnackBarModule { } +export class VitamUISnackBarModule {} diff --git a/ui/ui-frontend/projects/collect/src/app/collect/shared/vitamui-snack-bar/vitamui-snack-bar.service.ts b/ui/ui-frontend/projects/collect/src/app/collect/shared/vitamui-snack-bar/vitamui-snack-bar.service.ts index f669700880b..2e382b5b17d 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/shared/vitamui-snack-bar/vitamui-snack-bar.service.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/shared/vitamui-snack-bar/vitamui-snack-bar.service.ts @@ -34,20 +34,29 @@ The fact that you are presently reading this means that you have had knowledge of the CeCILL-C license and that you accept its terms. */ -import {LiveAnnouncer} from '@angular/cdk/a11y'; -import {BreakpointObserver,Breakpoints} from '@angular/cdk/layout'; -import {Overlay,OverlayConfig,OverlayRef} from '@angular/cdk/overlay'; -import {ComponentPortal,ComponentType,PortalInjector,TemplatePortal} from '@angular/cdk/portal'; -import {ComponentRef,EmbeddedViewRef,Inject,Injectable,InjectionToken,Injector,Optional,SkipSelf,TemplateRef} from '@angular/core'; -import {MatSnackBarConfig,MatSnackBarContainer,MatSnackBarRef,MAT_SNACK_BAR_DATA,SimpleSnackBar} from '@angular/material/snack-bar'; -import {take,takeUntil} from 'rxjs/operators'; +import { LiveAnnouncer } from '@angular/cdk/a11y'; +import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout'; +import { Overlay, OverlayConfig, OverlayRef } from '@angular/cdk/overlay'; +import { ComponentPortal, ComponentType, PortalInjector, TemplatePortal } from '@angular/cdk/portal'; +import { + ComponentRef, + EmbeddedViewRef, + Inject, + Injectable, + InjectionToken, + Injector, + Optional, + SkipSelf, + TemplateRef, +} from '@angular/core'; +import { MatSnackBarConfig, MatSnackBarContainer, MatSnackBarRef, MAT_SNACK_BAR_DATA, SimpleSnackBar } from '@angular/material/snack-bar'; +import { take, takeUntil } from 'rxjs/operators'; /** Injection token that can be used to specify default snack bar. */ -export const MAT_SNACK_BAR_DEFAULT_OPTIONS= - new InjectionToken('mat-snack-bar-default-options',{ - providedIn: 'root', - factory: MAT_SNACK_BAR_DEFAULT_OPTIONS_FACTORY, - }); +export const MAT_SNACK_BAR_DEFAULT_OPTIONS = new InjectionToken('mat-snack-bar-default-options', { + providedIn: 'root', + factory: MAT_SNACK_BAR_DEFAULT_OPTIONS_FACTORY, +}); /** @docs-private */ export function MAT_SNACK_BAR_DEFAULT_OPTIONS_FACTORY(): MatSnackBarConfig { @@ -55,30 +64,29 @@ export function MAT_SNACK_BAR_DEFAULT_OPTIONS_FACTORY(): MatSnackBarConfig { } @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class VitamUISnackBar { - /** * Reference to the current snack bar in the view *at this level* (in the Angular injector tree). * If there is a parent snack-bar service, all operations should delegate to that parent * via `_openedSnackBarRef`. */ // tslint:disable-next-line:variable-name - private _snackBarRefAtThisLevel: MatSnackBarRef|null=null; + private _snackBarRefAtThisLevel: MatSnackBarRef | null = null; /** Reference to the currently opened snackbar at *any* level. */ - get _openedSnackBarRef(): MatSnackBarRef|null { - const parent=this._parentSnackBar; + get _openedSnackBarRef(): MatSnackBarRef | null { + const parent = this._parentSnackBar; - return parent? parent._openedSnackBarRef:this._snackBarRefAtThisLevel; + return parent ? parent._openedSnackBarRef : this._snackBarRefAtThisLevel; } - set _openedSnackBarRef(value: MatSnackBarRef|null) { - if(this._parentSnackBar) { - this._parentSnackBar._openedSnackBarRef=value; + set _openedSnackBarRef(value: MatSnackBarRef | null) { + if (this._parentSnackBar) { + this._parentSnackBar._openedSnackBarRef = value; } else { - this._snackBarRefAtThisLevel=value; + this._snackBarRefAtThisLevel = value; } } @@ -94,7 +102,8 @@ export class VitamUISnackBar { // tslint:disable-next-line:variable-name @Optional() @SkipSelf() private _parentSnackBar: VitamUISnackBar, // tslint:disable-next-line:variable-name - @Inject(MAT_SNACK_BAR_DEFAULT_OPTIONS) private _defaultConfig: MatSnackBarConfig) {} + @Inject(MAT_SNACK_BAR_DEFAULT_OPTIONS) private _defaultConfig: MatSnackBarConfig, + ) {} /** * Creates and dispatches a snack bar with a custom component for the content, removing any @@ -103,9 +112,8 @@ export class VitamUISnackBar { * @param component Component to be instantiated. * @param config Extra configuration for the snack bar. */ - openFromComponent(component: ComponentType,config?: MatSnackBarConfig): - MatSnackBarRef { - return this._attach(component,config) as MatSnackBarRef; + openFromComponent(component: ComponentType, config?: MatSnackBarConfig): MatSnackBarRef { + return this._attach(component, config) as MatSnackBarRef; } /** @@ -115,9 +123,8 @@ export class VitamUISnackBar { * @param template Template to be instantiated. * @param config Extra configuration for the snack bar. */ - openFromTemplate(template: TemplateRef,config?: MatSnackBarConfig): - MatSnackBarRef> { - return this._attach(template,config); + openFromTemplate(template: TemplateRef, config?: MatSnackBarConfig): MatSnackBarRef> { + return this._attach(template, config); } /** @@ -126,23 +133,22 @@ export class VitamUISnackBar { * @param action The label for the snackbar action. * @param config Additional configuration options for the snackbar. */ - open(message: string,action: string='',config?: MatSnackBarConfig): - MatSnackBarRef { - const mergedConfig={...this._defaultConfig,...config}; + open(message: string, action: string = '', config?: MatSnackBarConfig): MatSnackBarRef { + const mergedConfig = { ...this._defaultConfig, ...config }; // Since the user doesn't have access to the component, we can // override the data to pass in our own message and action. - mergedConfig.data={message,action}; - mergedConfig.announcementMessage=message; + mergedConfig.data = { message, action }; + mergedConfig.announcementMessage = message; - return this.openFromComponent(SimpleSnackBar,mergedConfig); + return this.openFromComponent(SimpleSnackBar, mergedConfig); } /** * Dismisses the currently-visible snack bar. */ dismiss(): void { - if(this._openedSnackBarRef) { + if (this._openedSnackBarRef) { this._openedSnackBarRef.dismiss(); } } @@ -150,18 +156,13 @@ export class VitamUISnackBar { /** * Attaches the snack bar container component to the overlay. */ - private _attachSnackBarContainer(overlayRef: OverlayRef, - config: MatSnackBarConfig): MatSnackBarContainer { - - const userInjector=config&&config.viewContainerRef&&config.viewContainerRef.injector; - const injector=new PortalInjector(userInjector||this._injector,new WeakMap([ - [MatSnackBarConfig,config], - ])); + private _attachSnackBarContainer(overlayRef: OverlayRef, config: MatSnackBarConfig): MatSnackBarContainer { + const userInjector = config && config.viewContainerRef && config.viewContainerRef.injector; + const injector = new PortalInjector(userInjector || this._injector, new WeakMap([[MatSnackBarConfig, config]])); - const containerPortal= - new ComponentPortal(MatSnackBarContainer,config.viewContainerRef,injector); - const containerRef: ComponentRef=overlayRef.attach(containerPortal); - containerRef.instance.snackBarConfig=config; + const containerPortal = new ComponentPortal(MatSnackBarContainer, config.viewContainerRef, injector); + const containerRef: ComponentRef = overlayRef.attach(containerPortal); + containerRef.instance.snackBarConfig = config; return containerRef.instance; } @@ -169,60 +170,59 @@ export class VitamUISnackBar { /** * Places a new component or a template as the content of the snack bar container. */ - private _attach(content: ComponentType|TemplateRef,userConfig?: MatSnackBarConfig): - MatSnackBarRef> { - - const config={...new MatSnackBarConfig(),...this._defaultConfig,...userConfig}; - const overlayRef=this._createOverlay(config); - const container=this._attachSnackBarContainer(overlayRef,config); - const snackBarRef=new MatSnackBarRef>(container,overlayRef); - - if(content instanceof TemplateRef) { - const portal=new TemplatePortal(content,null,{ + private _attach(content: ComponentType | TemplateRef, userConfig?: MatSnackBarConfig): MatSnackBarRef> { + const config = { ...new MatSnackBarConfig(), ...this._defaultConfig, ...userConfig }; + const overlayRef = this._createOverlay(config); + const container = this._attachSnackBarContainer(overlayRef, config); + const snackBarRef = new MatSnackBarRef>(container, overlayRef); + + if (content instanceof TemplateRef) { + const portal = new TemplatePortal(content, null, { $implicit: config.data, - snackBarRef + snackBarRef, } as any); - snackBarRef.instance=container.attachTemplatePortal(portal); + snackBarRef.instance = container.attachTemplatePortal(portal); } else { - const injector=this._createInjector(config,snackBarRef); - const portal=new ComponentPortal(content,undefined,injector); - const contentRef=container.attachComponentPortal(portal); + const injector = this._createInjector(config, snackBarRef); + const portal = new ComponentPortal(content, undefined, injector); + const contentRef = container.attachComponentPortal(portal); // We can't pass this via the injector, because the injector is created earlier. - snackBarRef.instance=contentRef.instance; + snackBarRef.instance = contentRef.instance; } // Subscribe to the breakpoint observer and attach the mat-snack-bar-handset class as // appropriate. This class is applied to the overlay element because the overlay must expand to // fill the width of the screen for full width snackbars. - this._breakpointObserver.observe(Breakpoints.Handset).pipe( - takeUntil(overlayRef.detachments().pipe(take(1))) - ).subscribe((state) => { - if(state.matches) { - overlayRef.overlayElement.classList.add('mat-snack-bar-handset'); - } else { - overlayRef.overlayElement.classList.remove('mat-snack-bar-handset'); - } - }); + this._breakpointObserver + .observe(Breakpoints.Handset) + .pipe(takeUntil(overlayRef.detachments().pipe(take(1)))) + .subscribe((state) => { + if (state.matches) { + overlayRef.overlayElement.classList.add('mat-snack-bar-handset'); + } else { + overlayRef.overlayElement.classList.remove('mat-snack-bar-handset'); + } + }); - this._animateSnackBar(snackBarRef,config); - this._openedSnackBarRef=snackBarRef; + this._animateSnackBar(snackBarRef, config); + this._openedSnackBarRef = snackBarRef; return this._openedSnackBarRef; } /** Animates the old snack bar out and the new one in. */ - private _animateSnackBar(snackBarRef: MatSnackBarRef,config: MatSnackBarConfig) { + private _animateSnackBar(snackBarRef: MatSnackBarRef, config: MatSnackBarConfig) { // When the snackbar is dismissed, clear the reference to it. snackBarRef.afterDismissed().subscribe(() => { // Clear the snackbar ref if it hasn't already been replaced by a newer snackbar. - if(this._openedSnackBarRef===snackBarRef) { - this._openedSnackBarRef=null; + if (this._openedSnackBarRef === snackBarRef) { + this._openedSnackBarRef = null; } }); - if(this._openedSnackBarRef) { + if (this._openedSnackBarRef) { // If a snack bar is already in view, dismiss it and enter the // new snack bar after exit animation is complete. this._openedSnackBarRef.afterDismissed().subscribe(() => { @@ -235,12 +235,12 @@ export class VitamUISnackBar { } // If a dismiss timeout is provided, set up dismiss based on after the snackbar is opened. - if(config.duration&&config.duration>0) { + if (config.duration && config.duration > 0) { snackBarRef.afterOpened().subscribe(() => snackBarRef._dismissAfter(config.duration)); } - if(config.announcementMessage) { - this._live.announce(config.announcementMessage,config.politeness); + if (config.announcementMessage) { + this._live.announce(config.announcementMessage, config.politeness); } } @@ -249,26 +249,26 @@ export class VitamUISnackBar { * @param config The user-specified snack bar config. */ private _createOverlay(config: MatSnackBarConfig): OverlayRef { - const overlayConfig=new OverlayConfig(); - overlayConfig.direction=config.direction; + const overlayConfig = new OverlayConfig(); + overlayConfig.direction = config.direction; - const positionStrategy=this._overlay.position().global(); + const positionStrategy = this._overlay.position().global(); // Set horizontal position. - const isRtl=config.direction==='rtl'; - const isLeft=( - config.horizontalPosition==='left'|| - (config.horizontalPosition==='start'&&!isRtl)|| - (config.horizontalPosition==='end'&&isRtl)); - const isRight=!isLeft&&config.horizontalPosition!=='center'; - if(isLeft) { + const isRtl = config.direction === 'rtl'; + const isLeft = + config.horizontalPosition === 'left' || + (config.horizontalPosition === 'start' && !isRtl) || + (config.horizontalPosition === 'end' && isRtl); + const isRight = !isLeft && config.horizontalPosition !== 'center'; + if (isLeft) { positionStrategy.left('0'); - } else if(isRight) { + } else if (isRight) { positionStrategy.right('0'); } else { positionStrategy.centerHorizontally(); } // Set horizontal position. - if(config.verticalPosition==='top') { + if (config.verticalPosition === 'top') { positionStrategy.top('0'); } else { positionStrategy.bottom('0'); @@ -278,9 +278,9 @@ export class VitamUISnackBar { // The whole file has been ripped from the angular material sources // (https://github.com/angular/material2/blob/master/src/lib/snack-bar/snack-bar.ts) // just to add the line below - overlayConfig.width='100%'; + overlayConfig.width = '100%'; - overlayConfig.positionStrategy=positionStrategy; + overlayConfig.positionStrategy = positionStrategy; return this._overlay.create(overlayConfig); } @@ -290,16 +290,15 @@ export class VitamUISnackBar { * @param config Config that was used to create the snack bar. * @param snackBarRef Reference to the snack bar. */ - private _createInjector( - config: MatSnackBarConfig, - snackBarRef: MatSnackBarRef): PortalInjector { - - const userInjector=config&&config.viewContainerRef&&config.viewContainerRef.injector; - - return new PortalInjector(userInjector||this._injector,new WeakMap([ - [MatSnackBarRef,snackBarRef], - [MAT_SNACK_BAR_DATA,config.data], - ])); + private _createInjector(config: MatSnackBarConfig, snackBarRef: MatSnackBarRef): PortalInjector { + const userInjector = config && config.viewContainerRef && config.viewContainerRef.injector; + + return new PortalInjector( + userInjector || this._injector, + new WeakMap([ + [MatSnackBarRef, snackBarRef], + [MAT_SNACK_BAR_DATA, config.data], + ]), + ); } - } diff --git a/ui/ui-frontend/projects/collect/src/app/collect/transactions/transaction-list/transaction-list.component.html b/ui/ui-frontend/projects/collect/src/app/collect/transactions/transaction-list/transaction-list.component.html index 42b76fbea0b..abb51bc2c5e 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/transactions/transaction-list/transaction-list.component.html +++ b/ui/ui-frontend/projects/collect/src/app/collect/transactions/transaction-list/transaction-list.component.html @@ -11,10 +11,10 @@
    {{ 'COLLECT.INGEST_LIST_TITLE' | translate }}
    - {{ 'COLLECT.SINGLE_TRANSACTION' | translate: {nb: dataSource?.length} }} + {{ 'COLLECT.SINGLE_TRANSACTION' | translate: { nb: dataSource?.length } }} - - {{ 'COLLECT.NB_ENTRIES_TRANSACTIONS' | translate: {nb: dataSource?.length} }} + + {{ 'COLLECT.NB_ENTRIES_TRANSACTIONS' | translate: { nb: dataSource?.length } }}
    @@ -22,24 +22,32 @@
    {{ 'COLLECT.INGEST_LIST_TITLE' | translate }}
    {{ 'COLLECT.FIELD_MESSAGE_IDENTIFIER' | translate }} - +
    {{ 'COLLECT.FIELD_OPERATION_ID' | translate }} - +
    {{ 'COLLECT.FIELD_STATUS_TRANSACTION' | translate }} - -
    -
    +
    +
    @@ -55,27 +63,22 @@
    {{ 'COLLECT.INGEST_LIST_TITLE' | translate }}
    {{ transaction.messageIdentifier }}
    {{ transaction.id }}
    -
    {{ 'COLLECT.PROJECT_TRANSACTION_PREVIEW.STATUS.' + transaction.status | translate}}
    +
    {{ 'COLLECT.PROJECT_TRANSACTION_PREVIEW.STATUS.' + transaction.status | translate }}
    - - - - - @@ -84,7 +87,6 @@
    {{ 'COLLECT.INGEST_LIST_TITLE' | translate }}
    -
    diff --git a/ui/ui-frontend/projects/collect/src/app/collect/transactions/transaction-list/transaction-list.component.spec.ts b/ui/ui-frontend/projects/collect/src/app/collect/transactions/transaction-list/transaction-list.component.spec.ts index cb08220a56b..03371c19c15 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/transactions/transaction-list/transaction-list.component.spec.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/transactions/transaction-list/transaction-list.component.spec.ts @@ -44,7 +44,7 @@ import { StartupService, Transaction, TransactionStatus, - WINDOW_LOCATION + WINDOW_LOCATION, } from 'ui-frontend-common'; import { environment } from '../../../../../../archive-search/src/environments/environment'; import { VitamUISnackBar } from '../../shared/vitamui-snack-bar'; @@ -75,7 +75,7 @@ describe('TransactionListComponent', () => { submissionAgencyIdentifier: 'submissionAgencyIdentifier', archiveProfile: 'archivalProfile', comment: 'comment', - legalStatus:'A legal status' + legalStatus: 'A legal status', }; const matDialogRefSpy = jasmine.createSpyObj('MatDialogRef', ['open']); @@ -95,7 +95,7 @@ describe('TransactionListComponent', () => { editTransaction: of({}), validateTransaction: of({}), search: of([transaction]), - } + }, ); const TransactionResolverStub = { diff --git a/ui/ui-frontend/projects/collect/src/app/collect/transactions/transaction-list/transaction-list.component.ts b/ui/ui-frontend/projects/collect/src/app/collect/transactions/transaction-list/transaction-list.component.ts index cb4100915df..45e0c83a351 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/transactions/transaction-list/transaction-list.component.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/transactions/transaction-list/transaction-list.component.ts @@ -48,7 +48,7 @@ export class TransactionListComponent extends InfiniteScrollTable i private transactionService: TransactionsService, private translateService: TranslateService, private router: Router, - private startupService: StartupService + private startupService: StartupService, ) { super(transactionService); } @@ -84,7 +84,7 @@ export class TransactionListComponent extends InfiniteScrollTable i }, () => { transaction.status = TransactionStatus.KO; - } + }, ); } @@ -100,7 +100,7 @@ export class TransactionListComponent extends InfiniteScrollTable i }, () => { transaction.status = TransactionStatus.KO; - } + }, ); } @@ -116,7 +116,7 @@ export class TransactionListComponent extends InfiniteScrollTable i }, () => { transaction.status = TransactionStatus.KO; - } + }, ); } @@ -132,7 +132,7 @@ export class TransactionListComponent extends InfiniteScrollTable i }, () => { transaction.status = TransactionStatus.KO; - } + }, ); } diff --git a/ui/ui-frontend/projects/collect/src/app/collect/transactions/transaction-resolver.service.ts b/ui/ui-frontend/projects/collect/src/app/collect/transactions/transaction-resolver.service.ts index cbbca39be32..4eb56b63259 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/transactions/transaction-resolver.service.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/transactions/transaction-resolver.service.ts @@ -24,33 +24,32 @@ * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you * accept its terms. */ -import {Injectable} from '@angular/core'; -import {ActivatedRouteSnapshot, Resolve} from '@angular/router'; -import {combineLatest, Observable} from 'rxjs'; -import {map} from 'rxjs/operators'; +import { Injectable } from '@angular/core'; +import { ActivatedRouteSnapshot, Resolve } from '@angular/router'; +import { combineLatest, Observable } from 'rxjs'; +import { map } from 'rxjs/operators'; -import {ProjectsService} from '../projects/projects.service'; -import {TransactionsService} from './transactions.service'; +import { ProjectsService } from '../projects/projects.service'; +import { TransactionsService } from './transactions.service'; @Injectable({ providedIn: 'root', }) export class TransactionResolver implements Resolve { - - constructor(private transactionsService: TransactionsService, private projectService: ProjectsService) { - } + constructor( + private transactionsService: TransactionsService, + private projectService: ProjectsService, + ) {} resolve(route: ActivatedRouteSnapshot): Observable { const id = route.paramMap.get('projectId'); - return combineLatest([this.transactionsService.getTransactionsByProjectId(id), - this.projectService.getProjectById(id)]).pipe( + return combineLatest([this.transactionsService.getTransactionsByProjectId(id), this.projectService.getProjectById(id)]).pipe( map(([paginated, project]) => { const transactions = paginated.values; this.transactionsService.loadDataForTransactions(transactions, project); return true; - }) + }), ); } - } diff --git a/ui/ui-frontend/projects/collect/src/app/collect/transactions/transaction-routing.module.ts b/ui/ui-frontend/projects/collect/src/app/collect/transactions/transaction-routing.module.ts index 2a17430a5ca..d354d1d0f8b 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/transactions/transaction-routing.module.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/transactions/transaction-routing.module.ts @@ -34,18 +34,18 @@ The fact that you are presently reading this means that you have had knowledge of the CeCILL-C license and that you accept its terms. */ -import {CommonModule} from '@angular/common'; -import {NgModule} from '@angular/core'; -import {Route, RouterModule} from '@angular/router'; +import { CommonModule } from '@angular/common'; +import { NgModule } from '@angular/core'; +import { Route, RouterModule } from '@angular/router'; -import {TransactionResolver} from './transaction-resolver.service'; -import {TransactionsComponent} from './transactions.component'; +import { TransactionResolver } from './transaction-resolver.service'; +import { TransactionsComponent } from './transactions.component'; const routes: Route[] = [ { path: '', component: TransactionsComponent, - resolve: {transaction: TransactionResolver} + resolve: { transaction: TransactionResolver }, }, ]; @@ -54,5 +54,4 @@ const routes: Route[] = [ imports: [CommonModule, RouterModule.forChild(routes)], exports: [RouterModule], }) -export class TransactionRoutingModule { -} +export class TransactionRoutingModule {} diff --git a/ui/ui-frontend/projects/collect/src/app/collect/transactions/transaction.module.ts b/ui/ui-frontend/projects/collect/src/app/collect/transactions/transaction.module.ts index c0ab8e38ee3..c83c9873bdf 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/transactions/transaction.module.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/transactions/transaction.module.ts @@ -34,32 +34,23 @@ The fact that you are presently reading this means that you have had knowledge of the CeCILL-C license and that you accept its terms. */ -import {NgModule} from '@angular/core'; +import { NgModule } from '@angular/core'; -import {MAT_MOMENT_DATE_ADAPTER_OPTIONS} from '@angular/material-moment-adapter'; +import { MAT_MOMENT_DATE_ADAPTER_OPTIONS } from '@angular/material-moment-adapter'; -import {CommonModule} from '@angular/common'; -import {MatMenuModule} from '@angular/material/menu'; -import {MatProgressSpinnerModule} from '@angular/material/progress-spinner'; -import {MatSidenavModule} from '@angular/material/sidenav'; -import {VitamUICommonModule} from 'ui-frontend-common'; +import { CommonModule } from '@angular/common'; +import { MatMenuModule } from '@angular/material/menu'; +import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; +import { MatSidenavModule } from '@angular/material/sidenav'; +import { VitamUICommonModule } from 'ui-frontend-common'; import { TransactionListComponent } from './transaction-list/transaction-list.component'; -import {TransactionResolver} from './transaction-resolver.service'; -import {TransactionRoutingModule} from './transaction-routing.module'; -import {TransactionsComponent} from './transactions.component'; - +import { TransactionResolver } from './transaction-resolver.service'; +import { TransactionRoutingModule } from './transaction-routing.module'; +import { TransactionsComponent } from './transactions.component'; @NgModule({ - imports: [ - CommonModule, - TransactionRoutingModule, - MatMenuModule, - MatSidenavModule, - VitamUICommonModule, - MatProgressSpinnerModule, - ], - providers: [TransactionResolver, {provide: MAT_MOMENT_DATE_ADAPTER_OPTIONS, useValue: {useUtc: true}}], + imports: [CommonModule, TransactionRoutingModule, MatMenuModule, MatSidenavModule, VitamUICommonModule, MatProgressSpinnerModule], + providers: [TransactionResolver, { provide: MAT_MOMENT_DATE_ADAPTER_OPTIONS, useValue: { useUtc: true } }], declarations: [TransactionsComponent, TransactionListComponent], }) -export class TransactionModule { -} +export class TransactionModule {} diff --git a/ui/ui-frontend/projects/collect/src/app/collect/transactions/transactions.component.html b/ui/ui-frontend/projects/collect/src/app/collect/transactions/transactions.component.html index 70d66227481..f6cf1e5cb09 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/transactions/transactions.component.html +++ b/ui/ui-frontend/projects/collect/src/app/collect/transactions/transactions.component.html @@ -1,6 +1,4 @@ - -
    @@ -8,13 +6,11 @@
    -
    -
    +
    -
    -
    +
    diff --git a/ui/ui-frontend/projects/collect/src/app/collect/transactions/transactions.component.ts b/ui/ui-frontend/projects/collect/src/app/collect/transactions/transactions.component.ts index eb0e905f3be..00865fc70a8 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/transactions/transactions.component.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/transactions/transactions.component.ts @@ -24,12 +24,12 @@ * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you * accept its terms. */ -import {Component, OnInit} from '@angular/core'; -import {ActivatedRoute} from '@angular/router'; -import {Observable} from 'rxjs'; -import {map} from 'rxjs/operators'; -import {ApplicationId, BreadCrumbData, GlobalEventService, Project, SidenavPage, Transaction} from 'ui-frontend-common'; -import {TransactionsService} from './transactions.service'; +import { Component, OnInit } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; +import { Observable } from 'rxjs'; +import { map } from 'rxjs/operators'; +import { ApplicationId, BreadCrumbData, GlobalEventService, Project, SidenavPage, Transaction } from 'ui-frontend-common'; +import { TransactionsService } from './transactions.service'; @Component({ selector: 'app-projects', @@ -37,27 +37,27 @@ import {TransactionsService} from './transactions.service'; styleUrls: ['./transactions.component.scss'], }) export class TransactionsComponent extends SidenavPage implements OnInit { - tenantIdentifier: string; projectName$: Observable; transactions$: Observable; dataBreadcrumb: BreadCrumbData[]; - - constructor(route: ActivatedRoute, globalEventService: GlobalEventService, private transactionsService: TransactionsService) { + constructor( + route: ActivatedRoute, + globalEventService: GlobalEventService, + private transactionsService: TransactionsService, + ) { super(route, globalEventService); } ngOnInit(): void { const TRANSACTION_MONITORING = 'TRANSACTIONS_MONITORING'; - this.projectName$ = this.transactionsService.getProject$() - .pipe(map((project: Project) => project.messageIdentifier)); - this.dataBreadcrumb = [{identifier: ApplicationId.PORTAL_APP}, - {identifier: ApplicationId.COLLECT_APP}, - {identifier: TRANSACTION_MONITORING}]; + this.projectName$ = this.transactionsService.getProject$().pipe(map((project: Project) => project.messageIdentifier)); + this.dataBreadcrumb = [ + { identifier: ApplicationId.PORTAL_APP }, + { identifier: ApplicationId.COLLECT_APP }, + { identifier: TRANSACTION_MONITORING }, + ]; this.transactions$ = this.transactionsService.search(); - } - - } diff --git a/ui/ui-frontend/projects/collect/src/app/collect/transactions/transactions.service.ts b/ui/ui-frontend/projects/collect/src/app/collect/transactions/transactions.service.ts index 6c9dab0d819..332311e81d2 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/transactions/transactions.service.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/transactions/transactions.service.ts @@ -38,13 +38,17 @@ export class TransactionsService extends SearchService { transactions$: BehaviorSubject = new BehaviorSubject([]); project$: BehaviorSubject = new BehaviorSubject(null); - constructor(http: HttpClient, private transactionApiService: TransactionApiService, private projectApiService: ProjectsApiService) { + constructor( + http: HttpClient, + private transactionApiService: TransactionApiService, + private projectApiService: ProjectsApiService, + ) { super(http, transactionApiService, 'ALL'); } public getTransactionsByProjectId( projectId: string, - pageRequest: PageRequest = new PageRequest(0, DEFAULT_PAGE_SIZE, 'id', Direction.ASCENDANT) + pageRequest: PageRequest = new PageRequest(0, DEFAULT_PAGE_SIZE, 'id', Direction.ASCENDANT), ): Observable> { this.pageRequest = pageRequest; return this.projectApiService.getTransactionsByProjectId(this.pageRequest, projectId); diff --git a/ui/ui-frontend/projects/collect/src/index.html b/ui/ui-frontend/projects/collect/src/index.html index a5cffc42a24..2c53c7ee2e5 100644 --- a/ui/ui-frontend/projects/collect/src/index.html +++ b/ui/ui-frontend/projects/collect/src/index.html @@ -1,25 +1,24 @@ - - - Vitam-UI - + + + Vitam-UI + - - - - - + + + + + + - -
    - - - - - -
    - -
    - + +
    + + + + +
    +
    + diff --git a/ui/ui-frontend/projects/collect/src/sass/_common-archive.scss b/ui/ui-frontend/projects/collect/src/sass/_common-archive.scss index c358fe238f8..a5e23cfc002 100644 --- a/ui/ui-frontend/projects/collect/src/sass/_common-archive.scss +++ b/ui/ui-frontend/projects/collect/src/sass/_common-archive.scss @@ -1,15 +1,15 @@ /** TODO DEPRECATED : REMOVE THIS CSS AT THE END OF THE REWORK **/ -.after-search-launched-button{ - color: #fff; - background-color: #2C76C9; - border: 1px solid #2C76C9; - box-sizing: border-box; - border-radius: 5px; +.after-search-launched-button { + color: #fff; + background-color: #2c76c9; + border: 1px solid #2c76c9; + box-sizing: border-box; + border-radius: 5px; } -.search-criterias{ - font-size: large; - font-weight: bold; - margin-top: 50px; +.search-criterias { + font-size: large; + font-weight: bold; + margin-top: 50px; } diff --git a/ui/ui-frontend/projects/collect/src/sass/_form.scss b/ui/ui-frontend/projects/collect/src/sass/_form.scss index 72b4975d1e0..a5567ab938a 100644 --- a/ui/ui-frontend/projects/collect/src/sass/_form.scss +++ b/ui/ui-frontend/projects/collect/src/sass/_form.scss @@ -7,7 +7,7 @@ .form-divider { width: 100%; height: 2px; - background-color: #E0E0E0; + background-color: #e0e0e0; } .btn.more-actions { diff --git a/ui/ui-frontend/projects/collect/src/sass/_tooltip.scss b/ui/ui-frontend/projects/collect/src/sass/_tooltip.scss index 038b7f034ae..784606642e5 100644 --- a/ui/ui-frontend/projects/collect/src/sass/_tooltip.scss +++ b/ui/ui-frontend/projects/collect/src/sass/_tooltip.scss @@ -5,12 +5,12 @@ $arrow-size: 20px; .vitamui-tooltip.mat-tooltip { - background: #E1F3F0; + background: #e1f3f0; font-size: 13px; font-weight: 600; color: #666666; border-radius: 15px; - border: 1px solid #E1F3F0; + border: 1px solid #e1f3f0; padding: 5px 20px; position: relative; overflow: visible; @@ -21,7 +21,7 @@ $arrow-size: 20px; position: absolute; top: 0; left: 50%; - border-color: transparent transparent #E1F3F0 transparent; + border-color: transparent transparent #e1f3f0 transparent; border-width: $arrow-size * 0.5; border-style: solid; width: $arrow-size; @@ -36,7 +36,7 @@ $arrow-size: 20px; position: absolute; top: 0; left: 50%; - border-color: transparent transparent #E1F3F0 transparent; + border-color: transparent transparent #e1f3f0 transparent; border-width: ($arrow-size - 2px) * 0.5; border-style: solid; width: $arrow-size - 2px; diff --git a/ui/ui-frontend/projects/collect/src/sass/_vitamui-tab-group.scss b/ui/ui-frontend/projects/collect/src/sass/_vitamui-tab-group.scss index d0f500d51d0..6bd76d01142 100644 --- a/ui/ui-frontend/projects/collect/src/sass/_vitamui-tab-group.scss +++ b/ui/ui-frontend/projects/collect/src/sass/_vitamui-tab-group.scss @@ -18,7 +18,9 @@ font-weight: normal; color: rgba(72, 80, 83, 0.3); text-transform: uppercase; - transition: background-color 200ms ease-out, color 200ms ease-out; + transition: + background-color 200ms ease-out, + color 200ms ease-out; &:hover { color: var(--vitamui-primary); diff --git a/ui/ui-frontend/projects/collect/src/sass/login.scss b/ui/ui-frontend/projects/collect/src/sass/login.scss index 8cd15b1a9b6..076398ba44f 100644 --- a/ui/ui-frontend/projects/collect/src/sass/login.scss +++ b/ui/ui-frontend/projects/collect/src/sass/login.scss @@ -40,9 +40,9 @@ text-decoration: underline; } - input[type=text], - input[type=email], - input[type=password] { + input[type='text'], + input[type='email'], + input[type='password'] { border: none; outline: none; border-radius: 25px; diff --git a/ui/ui-frontend/projects/collect/src/sass/styles.scss b/ui/ui-frontend/projects/collect/src/sass/styles.scss index ea21c657b39..d4a53755018 100644 --- a/ui/ui-frontend/projects/collect/src/sass/styles.scss +++ b/ui/ui-frontend/projects/collect/src/sass/styles.scss @@ -55,7 +55,10 @@ vertical-align: top; cursor: pointer; outline: none; - box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.2), 0px 2px 2px rgba(0, 0, 0, 0.12), 0px 0px 2px rgba(0, 0, 0, 0.14); + box-shadow: + 0px 1px 3px rgba(0, 0, 0, 0.2), + 0px 2px 2px rgba(0, 0, 0, 0.12), + 0px 0px 2px rgba(0, 0, 0, 0.14); } .mat-select-content { diff --git a/ui/ui-frontend/projects/demo/e2e/src/app.e2e-spec.ts b/ui/ui-frontend/projects/demo/e2e/src/app.e2e-spec.ts index e52f929fdd7..beba332a216 100644 --- a/ui/ui-frontend/projects/demo/e2e/src/app.e2e-spec.ts +++ b/ui/ui-frontend/projects/demo/e2e/src/app.e2e-spec.ts @@ -52,8 +52,10 @@ describe('workspace-project App', () => { afterEach(async () => { // Assert that there are no errors emitted from the browser const logs = await browser.manage().logs().get(logging.Type.BROWSER); - expect(logs).not.toContain(jasmine.objectContaining({ - level: logging.Level.SEVERE, - } as logging.Entry)); + expect(logs).not.toContain( + jasmine.objectContaining({ + level: logging.Level.SEVERE, + } as logging.Entry), + ); }); }); diff --git a/ui/ui-frontend/projects/demo/src/app/app.component.html b/ui/ui-frontend/projects/demo/src/app/app.component.html index 599fac47180..f54d462060e 100644 --- a/ui/ui-frontend/projects/demo/src/app/app.component.html +++ b/ui/ui-frontend/projects/demo/src/app/app.component.html @@ -1,18 +1,13 @@ - + - Components - Icons - Subrogation Demo - Account Demo - App Guard Demo + Components + Icons + Subrogation Demo + Account Demo + App Guard Demo -
      -
    +
      @@ -20,4 +15,3 @@
      - diff --git a/ui/ui-frontend/projects/demo/src/app/app.component.ts b/ui/ui-frontend/projects/demo/src/app/app.component.ts index eb9f47650f8..cda41a4a72b 100644 --- a/ui/ui-frontend/projects/demo/src/app/app.component.ts +++ b/ui/ui-frontend/projects/demo/src/app/app.component.ts @@ -43,14 +43,15 @@ import { ErrorDialogComponent } from 'ui-frontend-common'; @Component({ selector: 'demo-root', templateUrl: './app.component.html', - styleUrls: ['./app.component.scss'] + styleUrls: ['./app.component.scss'], }) export class AppComponent { title = 'demo'; - constructor(public authService: AuthService, private matDialog: MatDialog) { - - } + constructor( + public authService: AuthService, + private matDialog: MatDialog, + ) {} openErrorModal() { this.matDialog.open(ErrorDialogComponent, { diff --git a/ui/ui-frontend/projects/demo/src/app/app.module.ts b/ui/ui-frontend/projects/demo/src/app/app.module.ts index b0887c73053..a00860c410b 100644 --- a/ui/ui-frontend/projects/demo/src/app/app.module.ts +++ b/ui/ui-frontend/projects/demo/src/app/app.module.ts @@ -59,9 +59,7 @@ import { SubrogationDemoComponent } from './demo/subrogation-demo/subrogation-de import { SubrogationDemoModule } from './demo/subrogation-demo/subrogation-demo.module'; @NgModule({ - declarations: [ - AppComponent, - ], + declarations: [AppComponent], imports: [ BrowserAnimationsModule, BrowserModule, @@ -87,7 +85,7 @@ import { SubrogationDemoModule } from './demo/subrogation-demo/subrogation-demo. { path: 'angular/customer/:customerId', component: ComponentsComponent }, { path: 'css', component: CssComponent }, { path: '', redirectTo: 'angular', pathMatch: 'full' }, - ] + ], }, { path: 'icons-demo', component: IconDemoComponent }, { @@ -98,7 +96,7 @@ import { SubrogationDemoModule } from './demo/subrogation-demo/subrogation-demo. { path: 'subrogation', component: GuardedPageComponent, canActivate: [AppGuard], data: { appId: 'SUBROGATIONS_APP' } }, { path: 'customers', component: GuardedPageComponent, canActivate: [AppGuard], data: { appId: 'CUSTOMERS_APP' } }, { path: 'fake-app', component: GuardedPageComponent, canActivate: [AppGuard], data: { appId: 'DOES_NOT_EXIST_APP' } }, - ] + ], }, { path: 'account', component: AccountComponent, canActivate: [AppGuard], data: { appId: 'ACCOUNTS_APP' } }, { path: '', redirectTo: 'components-demo', pathMatch: 'full' }, @@ -111,6 +109,6 @@ import { SubrogationDemoModule } from './demo/subrogation-demo/subrogation-demo. { provide: WINDOW_LOCATION, useValue: window.location }, // { provide: ErrorHandler, useClass: GlobalErrorHandler }, ], - bootstrap: [AppComponent] + bootstrap: [AppComponent], }) -export class AppModule { } +export class AppModule {} diff --git a/ui/ui-frontend/projects/demo/src/app/demo/account-demo/account-demo.component.html b/ui/ui-frontend/projects/demo/src/app/demo/account-demo/account-demo.component.html index 9b789881ec0..a927f177dba 100644 --- a/ui/ui-frontend/projects/demo/src/app/demo/account-demo/account-demo.component.html +++ b/ui/ui-frontend/projects/demo/src/app/demo/account-demo/account-demo.component.html @@ -1,3 +1 @@ -

      - account-demo works! -

      +

      account-demo works!

      diff --git a/ui/ui-frontend/projects/demo/src/app/demo/account-demo/account-demo.component.ts b/ui/ui-frontend/projects/demo/src/app/demo/account-demo/account-demo.component.ts index 398efbbb571..bc7109ac3e9 100644 --- a/ui/ui-frontend/projects/demo/src/app/demo/account-demo/account-demo.component.ts +++ b/ui/ui-frontend/projects/demo/src/app/demo/account-demo/account-demo.component.ts @@ -39,13 +39,10 @@ import { Component, OnInit } from '@angular/core'; @Component({ selector: 'demo-account-demo', templateUrl: './account-demo.component.html', - styleUrls: ['./account-demo.component.scss'] + styleUrls: ['./account-demo.component.scss'], }) export class AccountDemoComponent implements OnInit { + constructor() {} - constructor() { } - - ngOnInit() { - } - + ngOnInit() {} } diff --git a/ui/ui-frontend/projects/demo/src/app/demo/account-demo/account-demo.module.ts b/ui/ui-frontend/projects/demo/src/app/demo/account-demo/account-demo.module.ts index f7c6bec427b..947297fd4da 100644 --- a/ui/ui-frontend/projects/demo/src/app/demo/account-demo/account-demo.module.ts +++ b/ui/ui-frontend/projects/demo/src/app/demo/account-demo/account-demo.module.ts @@ -40,9 +40,7 @@ import { NgModule } from '@angular/core'; import { AccountDemoComponent } from './account-demo.component'; @NgModule({ - imports: [ - CommonModule, - ], - declarations: [AccountDemoComponent] + imports: [CommonModule], + declarations: [AccountDemoComponent], }) -export class AccountDemoModule { } +export class AccountDemoModule {} diff --git a/ui/ui-frontend/projects/demo/src/app/demo/app-guard-demo/app-guard-demo.component.html b/ui/ui-frontend/projects/demo/src/app/demo/app-guard-demo/app-guard-demo.component.html index 8ae253c3e64..7116aa71cb0 100644 --- a/ui/ui-frontend/projects/demo/src/app/demo/app-guard-demo/app-guard-demo.component.html +++ b/ui/ui-frontend/projects/demo/src/app/demo/app-guard-demo/app-guard-demo.component.html @@ -7,9 +7,7 @@

      Example app routes

    • SUBROGATIONS_APP
    • CUSTOMERS_APP
    • -

      - Below is a routerLink that is should fail and redirect the user to the portal -

      +

      Below is a routerLink that is should fail and redirect the user to the portal

      diff --git a/ui/ui-frontend/projects/demo/src/app/demo/app-guard-demo/app-guard-demo.component.ts b/ui/ui-frontend/projects/demo/src/app/demo/app-guard-demo/app-guard-demo.component.ts index 4aaf6a1d38e..76598613e0b 100644 --- a/ui/ui-frontend/projects/demo/src/app/demo/app-guard-demo/app-guard-demo.component.ts +++ b/ui/ui-frontend/projects/demo/src/app/demo/app-guard-demo/app-guard-demo.component.ts @@ -42,19 +42,16 @@ import { CssComponent } from '../component-demo/css/css.component'; @Component({ selector: 'demo-app-guard-demo', templateUrl: './app-guard-demo.component.html', - styleUrls: ['./app-guard-demo.component.scss'] + styleUrls: ['./app-guard-demo.component.scss'], }) export class AppGuardDemoComponent implements OnInit { - routeCodeExample = [ { path: 'account', component: CssComponent, canActivate: [AppGuard], data: { appId: 'ACCOUNTS_APP' } }, { path: 'subrogation', component: CssComponent, canActivate: [AppGuard], data: { appId: 'SUBROGATIONS_APP' } }, { path: 'customers', component: CssComponent, canActivate: [AppGuard], data: { appId: 'CUSTOMERS_APP' } }, ]; - constructor() { } - - ngOnInit() { - } + constructor() {} + ngOnInit() {} } diff --git a/ui/ui-frontend/projects/demo/src/app/demo/app-guard-demo/app-guard-demo.module.ts b/ui/ui-frontend/projects/demo/src/app/demo/app-guard-demo/app-guard-demo.module.ts index d9a6622a259..b6965fad0fc 100644 --- a/ui/ui-frontend/projects/demo/src/app/demo/app-guard-demo/app-guard-demo.module.ts +++ b/ui/ui-frontend/projects/demo/src/app/demo/app-guard-demo/app-guard-demo.module.ts @@ -42,10 +42,7 @@ import { AppGuardDemoComponent } from './app-guard-demo.component'; import { GuardedPageComponent } from './guarded-page.component'; @NgModule({ - imports: [ - CommonModule, - RouterModule, - ], - declarations: [AppGuardDemoComponent, GuardedPageComponent] + imports: [CommonModule, RouterModule], + declarations: [AppGuardDemoComponent, GuardedPageComponent], }) -export class AppGuardDemoModule { } +export class AppGuardDemoModule {} diff --git a/ui/ui-frontend/projects/demo/src/app/demo/app-guard-demo/guarded-page.component.html b/ui/ui-frontend/projects/demo/src/app/demo/app-guard-demo/guarded-page.component.html index 231c4088149..05d3527ba0e 100644 --- a/ui/ui-frontend/projects/demo/src/app/demo/app-guard-demo/guarded-page.component.html +++ b/ui/ui-frontend/projects/demo/src/app/demo/app-guard-demo/guarded-page.component.html @@ -1,3 +1 @@ -

      - Guarded Page ({{appId}}) -

      +

      Guarded Page ({{ appId }})

      diff --git a/ui/ui-frontend/projects/demo/src/app/demo/app-guard-demo/guarded-page.component.ts b/ui/ui-frontend/projects/demo/src/app/demo/app-guard-demo/guarded-page.component.ts index 038b48dfd64..c4c0e145ccb 100644 --- a/ui/ui-frontend/projects/demo/src/app/demo/app-guard-demo/guarded-page.component.ts +++ b/ui/ui-frontend/projects/demo/src/app/demo/app-guard-demo/guarded-page.component.ts @@ -40,17 +40,14 @@ import { ActivatedRoute } from '@angular/router'; @Component({ selector: 'demo-guarded-page', templateUrl: './guarded-page.component.html', - styleUrls: ['./guarded-page.component.scss'] + styleUrls: ['./guarded-page.component.scss'], }) export class GuardedPageComponent implements OnInit { - appId: string; constructor(route: ActivatedRoute) { this.appId = route.snapshot.data.appId; } - ngOnInit() { - } - + ngOnInit() {} } diff --git a/ui/ui-frontend/projects/demo/src/app/demo/component-demo/component-demo.component.ts b/ui/ui-frontend/projects/demo/src/app/demo/component-demo/component-demo.component.ts index f3999280f0b..7e7ea31879c 100644 --- a/ui/ui-frontend/projects/demo/src/app/demo/component-demo/component-demo.component.ts +++ b/ui/ui-frontend/projects/demo/src/app/demo/component-demo/component-demo.component.ts @@ -39,13 +39,10 @@ import { Component, OnInit } from '@angular/core'; @Component({ selector: 'demo-component-demo', templateUrl: './component-demo.component.html', - styleUrls: ['./component-demo.component.scss'] + styleUrls: ['./component-demo.component.scss'], }) export class ComponentDemoComponent implements OnInit { + constructor() {} - constructor() { } - - ngOnInit() { - } - + ngOnInit() {} } diff --git a/ui/ui-frontend/projects/demo/src/app/demo/component-demo/component-demo.module.ts b/ui/ui-frontend/projects/demo/src/app/demo/component-demo/component-demo.module.ts index b74003a7aea..a99e87a3b05 100644 --- a/ui/ui-frontend/projects/demo/src/app/demo/component-demo/component-demo.module.ts +++ b/ui/ui-frontend/projects/demo/src/app/demo/component-demo/component-demo.module.ts @@ -37,7 +37,7 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; -import { MatDialogModule} from '@angular/material/dialog'; +import { MatDialogModule } from '@angular/material/dialog'; import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; import { MatTabsModule } from '@angular/material/tabs'; import { RouterModule } from '@angular/router'; @@ -48,18 +48,8 @@ import { ComponentsComponent } from './components/components.component'; import { CssComponent } from './css/css.component'; @NgModule({ - imports: [ - CommonModule, - VitamUICommonModule, - RouterModule, - FormsModule, - MatTabsModule, - MatProgressSpinnerModule, - MatDialogModule, - ], + imports: [CommonModule, VitamUICommonModule, RouterModule, FormsModule, MatTabsModule, MatProgressSpinnerModule, MatDialogModule], declarations: [ComponentDemoComponent, CssComponent, ComponentsComponent], - providers: [ - ] - + providers: [], }) -export class ComponentDemoModule { } +export class ComponentDemoModule {} diff --git a/ui/ui-frontend/projects/demo/src/app/demo/component-demo/components/components.component.html b/ui/ui-frontend/projects/demo/src/app/demo/component-demo/components/components.component.html index 86c86fb6ebd..0b9b1603aac 100644 --- a/ui/ui-frontend/projects/demo/src/app/demo/component-demo/components/components.component.html +++ b/ui/ui-frontend/projects/demo/src/app/demo/component-demo/components/components.component.html @@ -3,24 +3,38 @@

      Angular Components

      Navbar

      - +
      -

      Form Fields

      - Invalid field + Invalid field

      Input Positive Number

      - +
      @@ -30,36 +44,33 @@

      Input Positive Number

      Tooltip

      -
      +

      - Nullam ipsum turpis, sagittis at hendrerit at, lacinia vel augue. Nunc interdum, eros pulvinar suscipit vulputate, - dolor ante volutpat turpis, - ac scelerisque elit mi eget est. Mauris tincidunt, magna vel porttitor fringilla, ligula est eleifend ante, ac - pharetra metus augue sit amet sapien. - Cras eget mauris id dui semper convallis sed vel ante. Aenean sit amet semper velit, ac tincidunt tellus. Mauris - lacinia gravida ligula sit amet commodo. - Vestibulum a magna nec velit tristique mollis. Praesent posuere, orci eget vestibulum dictum, elit turpis faucibus - orci, et congue leo enim id sapien. - Ut congue nisi vitae aliquet finibus. Nullam accumsan magna a sagittis posuere. Sed venenatis egestas justo. Donec - magna tellus, efficitur nec sollicitudin - rutrum, ultricies non massa. Vestibulum a mauris a orci lacinia pharetra. Curabitur placerat sem a tellus - sagittis, ac rutrum eros interdum. Duis sagittis - orci sed neque consequat, non lobortis ex vehicula. Vestibulum nec risus eu justo rhoncus feugiat sed vel turpis. - Mauris consequat quis ante id semper. - Integer tempus convallis tellus, at eleifend dui dapibus vitae. Sed vel posuere elit. Etiam leo enim, dignissim - sit amet sem vel, scelerisque tempus ipsum. - Praesent lobortis faucibus mi ac condimentum. Nullam dignissim erat sit amet aliquam maximus. + Nullam ipsum turpis, sagittis at hendrerit at, lacinia vel augue. Nunc interdum, eros pulvinar suscipit vulputate, dolor ante volutpat + turpis, ac scelerisque elit mi eget est. Mauris tincidunt, magna vel porttitor fringilla, ligula est eleifend ante, ac pharetra metus + augue sit amet sapien. Cras eget mauris id dui semper convallis sed vel ante. Aenean sit amet semper velit, ac tincidunt tellus. + Mauris lacinia gravida ligula sit amet commodo. Vestibulum a magna nec velit tristique mollis. Praesent posuere, orci eget vestibulum + dictum, elit turpis faucibus orci, et congue leo enim id sapien. Ut congue nisi vitae aliquet finibus. Nullam accumsan magna a + sagittis posuere. Sed venenatis egestas justo. Donec magna tellus, efficitur nec sollicitudin rutrum, ultricies non massa. Vestibulum + a mauris a orci lacinia pharetra. Curabitur placerat sem a tellus sagittis, ac rutrum eros interdum. Duis sagittis orci sed neque + consequat, non lobortis ex vehicula. Vestibulum nec risus eu justo rhoncus feugiat sed vel turpis. Mauris consequat quis ante id + semper. Integer tempus convallis tellus, at eleifend dui dapibus vitae. Sed vel posuere elit. Etiam leo enim, dignissim sit amet sem + vel, scelerisque tempus ipsum. Praesent lobortis faucibus mi ac condimentum. Nullam dignissim erat sit amet aliquam maximus.

      -

      Editable Fields

      - +
      @@ -96,7 +107,6 @@

      Stepper

      -

      Step 1

      @@ -106,7 +116,7 @@

      Stepper

      -

      Step 2
      Taller content
      ...
      ...

      +

      Step 2
      Taller content
      ...
      ...

      @@ -117,7 +127,6 @@

      Stepper

      Step 3

      -
      @@ -127,14 +136,13 @@

      Stepper

      -

      Confirm dialog Service

      - Result: {{confirmResult|json}} + Result: {{ confirmResult | json }} Confirm dialog Service

      Infinite Scroll Directive

      -
      -
      value {{value}}
      +
      +
      value {{ value }}
      -
      diff --git a/ui/ui-frontend/projects/demo/src/app/demo/component-demo/components/components.component.scss b/ui/ui-frontend/projects/demo/src/app/demo/component-demo/components/components.component.scss index a0a2b983b9c..e7283c777f9 100644 --- a/ui/ui-frontend/projects/demo/src/app/demo/component-demo/components/components.component.scss +++ b/ui/ui-frontend/projects/demo/src/app/demo/component-demo/components/components.component.scss @@ -1,16 +1,16 @@ .editable-fields-container { - max-width: 350px; + max-width: 350px; } .demo-stepper { - border: 1px solid rgba(0, 0, 0, 0.2); + border: 1px solid rgba(0, 0, 0, 0.2); } .demo-step-content { - padding: 20px; - border-radius: 3px; + padding: 20px; + border-radius: 3px; } .tooltip-demo-block { - min-width: 800px; + min-width: 800px; } diff --git a/ui/ui-frontend/projects/demo/src/app/demo/component-demo/components/components.component.ts b/ui/ui-frontend/projects/demo/src/app/demo/component-demo/components/components.component.ts index b17e1077ca6..ecf186dd73e 100644 --- a/ui/ui-frontend/projects/demo/src/app/demo/component-demo/components/components.component.ts +++ b/ui/ui-frontend/projects/demo/src/app/demo/component-demo/components/components.component.ts @@ -44,10 +44,9 @@ const INFINITE_SCROLL_FAKE_DELAY_MS = 1500; @Component({ selector: 'demo-components', templateUrl: './components.component.html', - styleUrls: ['./components.component.scss'] + styleUrls: ['./components.component.scss'], }) export class ComponentsComponent implements OnInit { - @ViewChild('confirmDialogTemplate', { static: true }) confirmDialogTemplate: TemplateRef; appId = ApplicationId.ACCOUNTS_APP; // FIXME: Why this app id, can we replace easy ? @@ -77,11 +76,11 @@ export class ComponentsComponent implements OnInit { private router: Router, private route: ActivatedRoute, private appService: ApplicationService, - private confirmDialogService: ConfirmDialogService - ) { } + private confirmDialogService: ConfirmDialogService, + ) {} ngOnInit() { - this.appService.list().subscribe((apps) => this.applications = apps); + this.appService.list().subscribe((apps) => (this.applications = apps)); } onTenantSelect(tenantIdentifier: number) { @@ -102,22 +101,19 @@ export class ComponentsComponent implements OnInit { onScroll() { this.infiniteScrollDisabled = true; - setTimeout( - () => { - this.infiniteScrollDisabled = false; - this.infiniteValues = this.infiniteValues.concat([1, 1, 1, 1, 1]); - }, - INFINITE_SCROLL_FAKE_DELAY_MS - ); + setTimeout(() => { + this.infiniteScrollDisabled = false; + this.infiniteValues = this.infiniteValues.concat([1, 1, 1, 1, 1]); + }, INFINITE_SCROLL_FAKE_DELAY_MS); } openConfirmDialog() { - this.confirmDialogService.confirm(this.confirmDialogTemplate).subscribe(() => this.confirmResult = true); + this.confirmDialogService.confirm(this.confirmDialogTemplate).subscribe(() => (this.confirmResult = true)); } onKeyPress(event: KeyboardEvent): boolean { // tslint:disable-next-line: deprecation - const charCode = (event.which) ? event.which : event.keyCode; + const charCode = event.which ? event.which : event.keyCode; if (charCode > 31 && (charCode < 48 || charCode > 57)) { return false; } diff --git a/ui/ui-frontend/projects/demo/src/app/demo/component-demo/css/css.component.ts b/ui/ui-frontend/projects/demo/src/app/demo/component-demo/css/css.component.ts index 5591bbf083d..2d3952660f7 100644 --- a/ui/ui-frontend/projects/demo/src/app/demo/component-demo/css/css.component.ts +++ b/ui/ui-frontend/projects/demo/src/app/demo/component-demo/css/css.component.ts @@ -39,13 +39,10 @@ import { Component, OnInit } from '@angular/core'; @Component({ selector: 'demo-css', templateUrl: './css.component.html', - styleUrls: ['./css.component.scss'] + styleUrls: ['./css.component.scss'], }) export class CssComponent implements OnInit { + constructor() {} - constructor() { } - - ngOnInit() { - } - + ngOnInit() {} } diff --git a/ui/ui-frontend/projects/demo/src/app/demo/icon-demo/icon-demo.component.html b/ui/ui-frontend/projects/demo/src/app/demo/icon-demo/icon-demo.component.html index bbce5199857..1c03bbfe085 100644 --- a/ui/ui-frontend/projects/demo/src/app/demo/icon-demo/icon-demo.component.html +++ b/ui/ui-frontend/projects/demo/src/app/demo/icon-demo/icon-demo.component.html @@ -65,5 +65,4 @@

      Icon Library

      vitamui-icon-support-keys
      - diff --git a/ui/ui-frontend/projects/demo/src/app/demo/icon-demo/icon-demo.component.scss b/ui/ui-frontend/projects/demo/src/app/demo/icon-demo/icon-demo.component.scss index 7d6bf4912d9..572dae438c6 100644 --- a/ui/ui-frontend/projects/demo/src/app/demo/icon-demo/icon-demo.component.scss +++ b/ui/ui-frontend/projects/demo/src/app/demo/icon-demo/icon-demo.component.scss @@ -1,18 +1,18 @@ i { - font-size: 64px; + font-size: 64px; } ul { - display: flex; - flex-wrap: wrap; - list-style: none; - padding: 0; - margin: 0; + display: flex; + flex-wrap: wrap; + list-style: none; + padding: 0; + margin: 0; - li { - display: flex; - flex-direction: column; - align-items: center; - margin: 10px; - } + li { + display: flex; + flex-direction: column; + align-items: center; + margin: 10px; + } } diff --git a/ui/ui-frontend/projects/demo/src/app/demo/icon-demo/icon-demo.component.ts b/ui/ui-frontend/projects/demo/src/app/demo/icon-demo/icon-demo.component.ts index d3768502c42..cec8745391c 100644 --- a/ui/ui-frontend/projects/demo/src/app/demo/icon-demo/icon-demo.component.ts +++ b/ui/ui-frontend/projects/demo/src/app/demo/icon-demo/icon-demo.component.ts @@ -39,13 +39,10 @@ import { Component, OnInit } from '@angular/core'; @Component({ selector: 'demo-icon-demo', templateUrl: './icon-demo.component.html', - styleUrls: ['./icon-demo.component.scss'] + styleUrls: ['./icon-demo.component.scss'], }) export class IconDemoComponent implements OnInit { + constructor() {} - constructor() { } - - ngOnInit() { - } - + ngOnInit() {} } diff --git a/ui/ui-frontend/projects/demo/src/app/demo/icon-demo/icon-demo.module.ts b/ui/ui-frontend/projects/demo/src/app/demo/icon-demo/icon-demo.module.ts index 0285a581e80..fbd1fa0d455 100644 --- a/ui/ui-frontend/projects/demo/src/app/demo/icon-demo/icon-demo.module.ts +++ b/ui/ui-frontend/projects/demo/src/app/demo/icon-demo/icon-demo.module.ts @@ -41,10 +41,7 @@ import { VitamUICommonModule } from 'ui-frontend-common'; import { IconDemoComponent } from './icon-demo.component'; @NgModule({ - imports: [ - CommonModule, - VitamUICommonModule, - ], - declarations: [IconDemoComponent] + imports: [CommonModule, VitamUICommonModule], + declarations: [IconDemoComponent], }) -export class IconDemoModule { } +export class IconDemoModule {} diff --git a/ui/ui-frontend/projects/demo/src/app/demo/subrogation-demo/subrogation-demo.component.html b/ui/ui-frontend/projects/demo/src/app/demo/subrogation-demo/subrogation-demo.component.html index a335d7ac563..383b991af7e 100644 --- a/ui/ui-frontend/projects/demo/src/app/demo/subrogation-demo/subrogation-demo.component.html +++ b/ui/ui-frontend/projects/demo/src/app/demo/subrogation-demo/subrogation-demo.component.html @@ -2,8 +2,8 @@

      Subrogation Demo

      - - + +
      diff --git a/ui/ui-frontend/projects/demo/src/app/demo/subrogation-demo/subrogation-demo.component.ts b/ui/ui-frontend/projects/demo/src/app/demo/subrogation-demo/subrogation-demo.component.ts index d56a8f5f0ea..855e6ec5566 100644 --- a/ui/ui-frontend/projects/demo/src/app/demo/subrogation-demo/subrogation-demo.component.ts +++ b/ui/ui-frontend/projects/demo/src/app/demo/subrogation-demo/subrogation-demo.component.ts @@ -41,29 +41,26 @@ import { Subrogation, SubrogationModalService } from 'ui-frontend-common'; @Component({ selector: 'demo-subrogation-demo', templateUrl: './subrogation-demo.component.html', - styleUrls: ['./subrogation-demo.component.scss'] + styleUrls: ['./subrogation-demo.component.scss'], }) export class SubrogationDemoComponent implements OnInit { - surrogateUser = 'julien@vitamui.com'; subrogation: Subrogation; - constructor(private subrogationModalService: SubrogationModalService) { } + constructor(private subrogationModalService: SubrogationModalService) {} - ngOnInit() { - } + ngOnInit() {} createSubrogation(email?: string) { if (email) { const user = { email, firstname: 'Jean Michel', - lastname: 'Good Enough' + lastname: 'Good Enough', }; this.subrogationModalService.open(['vitamui.com', 'vitamui.fr'], user); } else { this.subrogationModalService.open(['vitamui.com', 'vitamui.fr']); } } - } diff --git a/ui/ui-frontend/projects/demo/src/app/demo/subrogation-demo/subrogation-demo.module.ts b/ui/ui-frontend/projects/demo/src/app/demo/subrogation-demo/subrogation-demo.module.ts index 097e25cdd6e..b821bc2faed 100644 --- a/ui/ui-frontend/projects/demo/src/app/demo/subrogation-demo/subrogation-demo.module.ts +++ b/ui/ui-frontend/projects/demo/src/app/demo/subrogation-demo/subrogation-demo.module.ts @@ -42,11 +42,7 @@ import { VitamUICommonModule } from 'ui-frontend-common'; import { SubrogationDemoComponent } from './subrogation-demo.component'; @NgModule({ - imports: [ - CommonModule, - FormsModule, - VitamUICommonModule, - ], - declarations: [SubrogationDemoComponent] + imports: [CommonModule, FormsModule, VitamUICommonModule], + declarations: [SubrogationDemoComponent], }) -export class SubrogationDemoModule { } +export class SubrogationDemoModule {} diff --git a/ui/ui-frontend/projects/demo/src/environments/environment.prod.ts b/ui/ui-frontend/projects/demo/src/environments/environment.prod.ts index 9e5ff8d93ff..647d686ea9e 100644 --- a/ui/ui-frontend/projects/demo/src/environments/environment.prod.ts +++ b/ui/ui-frontend/projects/demo/src/environments/environment.prod.ts @@ -35,5 +35,5 @@ * knowledge of the CeCILL-C license and that you accept its terms. */ export const environment = { - production: true + production: true, }; diff --git a/ui/ui-frontend/projects/demo/src/environments/environment.ts b/ui/ui-frontend/projects/demo/src/environments/environment.ts index 74276600f25..633ca91720f 100644 --- a/ui/ui-frontend/projects/demo/src/environments/environment.ts +++ b/ui/ui-frontend/projects/demo/src/environments/environment.ts @@ -39,7 +39,7 @@ // The list of file replacements can be found in `angular.json`. export const environment = { - production: false + production: false, }; /* diff --git a/ui/ui-frontend/projects/demo/src/index.html b/ui/ui-frontend/projects/demo/src/index.html index 16754752557..18f0097da54 100644 --- a/ui/ui-frontend/projects/demo/src/index.html +++ b/ui/ui-frontend/projects/demo/src/index.html @@ -1,15 +1,14 @@ - - - Demo - + + + Demo + - - - - - - - + + + + + + diff --git a/ui/ui-frontend/projects/demo/src/main.ts b/ui/ui-frontend/projects/demo/src/main.ts index 2478b33ce93..b4156078c9c 100644 --- a/ui/ui-frontend/projects/demo/src/main.ts +++ b/ui/ui-frontend/projects/demo/src/main.ts @@ -44,5 +44,6 @@ if (environment.production) { enableProdMode(); } -platformBrowserDynamic().bootstrapModule(AppModule) - .catch(err => console.error(err)); +platformBrowserDynamic() + .bootstrapModule(AppModule) + .catch((err) => console.error(err)); diff --git a/ui/ui-frontend/projects/demo/src/polyfills.ts b/ui/ui-frontend/projects/demo/src/polyfills.ts index ca114137190..ea9b5e6b247 100644 --- a/ui/ui-frontend/projects/demo/src/polyfills.ts +++ b/ui/ui-frontend/projects/demo/src/polyfills.ts @@ -91,7 +91,7 @@ /*************************************************************************************************** * Zone JS is required by default for Angular itself. */ -import 'zone.js/dist/zone'; // Included with Angular CLI. +import 'zone.js/dist/zone'; // Included with Angular CLI. import '@angular/localize/init'; diff --git a/ui/ui-frontend/projects/demo/src/styles.scss b/ui/ui-frontend/projects/demo/src/styles.scss index 29b34c8ad6a..b420ec2c70b 100644 --- a/ui/ui-frontend/projects/demo/src/styles.scss +++ b/ui/ui-frontend/projects/demo/src/styles.scss @@ -6,14 +6,12 @@ @import '~ui-frontend-common/sass/fonts/font-styles.css'; .demo-block { - margin: 20px 0; + margin: 20px 0; } .demo-layout { - - background: rgba(0, 0, 0, 0.1); - border: 1px solid rgba(0, 0, 0, 0.1); - border-radius: 2px; - // padding: 20px; - + background: rgba(0, 0, 0, 0.1); + border: 1px solid rgba(0, 0, 0, 0.1); + border-radius: 2px; + // padding: 20px; } diff --git a/ui/ui-frontend/projects/demo/src/test.ts b/ui/ui-frontend/projects/demo/src/test.ts index 58dda4097c2..124ce8872ca 100644 --- a/ui/ui-frontend/projects/demo/src/test.ts +++ b/ui/ui-frontend/projects/demo/src/test.ts @@ -37,19 +37,13 @@ // This file is required by karma.conf.ci.js and loads recursively all the .spec and framework files import { getTestBed } from '@angular/core/testing'; -import { - BrowserDynamicTestingModule, - platformBrowserDynamicTesting -} from '@angular/platform-browser-dynamic/testing'; +import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing'; import 'zone.js/dist/zone-testing'; declare const require: any; // First, initialize the Angular testing environment. -getTestBed().initTestEnvironment( - BrowserDynamicTestingModule, - platformBrowserDynamicTesting() -); +getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting()); // Then we find all the tests. const context = require.context('./', true, /\.spec\.ts$/); // And load the modules. diff --git a/ui/ui-frontend/projects/identity/src/app/app-routing.module.ts b/ui/ui-frontend/projects/identity/src/app/app-routing.module.ts index 1ec4b6b788c..de3c67535d6 100644 --- a/ui/ui-frontend/projects/identity/src/app/app-routing.module.ts +++ b/ui/ui-frontend/projects/identity/src/app/app-routing.module.ts @@ -37,13 +37,7 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { QuicklinkStrategy } from 'ngx-quicklink'; -import { - AccountComponent, - ActiveTenantGuard, - AnalyticsResolver, - AppGuard, - AuthGuard -} from 'ui-frontend-common'; +import { AccountComponent, ActiveTenantGuard, AnalyticsResolver, AppGuard, AuthGuard } from 'ui-frontend-common'; import { AppComponent } from './app.component'; const routes: Routes = [ @@ -51,25 +45,24 @@ const routes: Routes = [ path: '', component: AppComponent, canActivate: [AuthGuard, AppGuard], - data: { appId: 'PORTAL_APP' } + data: { appId: 'PORTAL_APP' }, }, { path: 'account', component: AccountComponent, canActivate: [AuthGuard, AppGuard], resolve: { userAnalytics: AnalyticsResolver }, - data: { appId: 'ACCOUNTS_APP' } + data: { appId: 'ACCOUNTS_APP' }, }, // ===================================================== // Customers // ===================================================== { path: 'customer', - loadChildren: () => - import('./customer/customer.module').then(m => m.CustomerModule), + loadChildren: () => import('./customer/customer.module').then((m) => m.CustomerModule), canActivate: [AuthGuard, AppGuard], resolve: { userAnalytics: AnalyticsResolver }, - data: { appId: 'CUSTOMERS_APP' } + data: { appId: 'CUSTOMERS_APP' }, }, // ===================================================== @@ -77,80 +70,74 @@ const routes: Routes = [ // ===================================================== { path: 'user', - loadChildren: () => import('./user/user.module').then(m => m.UserModule), + loadChildren: () => import('./user/user.module').then((m) => m.UserModule), canActivate: [AuthGuard, AppGuard], resolve: { userAnalytics: AnalyticsResolver }, - data: { appId: 'USERS_APP' } + data: { appId: 'USERS_APP' }, }, // ===================================================== // Groups // ===================================================== { path: 'group', - loadChildren: () => import('./group/group.module').then(m => m.GroupModule), + loadChildren: () => import('./group/group.module').then((m) => m.GroupModule), canActivate: [AuthGuard, AppGuard], resolve: { userAnalytics: AnalyticsResolver }, - data: { appId: 'GROUPS_APP' } + data: { appId: 'GROUPS_APP' }, }, // ===================================================== // Profile // ===================================================== { path: 'profile', - loadChildren: () => - import('./profile/profile.module').then(m => m.ProfileModule), + loadChildren: () => import('./profile/profile.module').then((m) => m.ProfileModule), canActivate: [AuthGuard, AppGuard], resolve: { userAnalytics: AnalyticsResolver }, - data: { appId: 'PROFILES_APP' } + data: { appId: 'PROFILES_APP' }, }, // ===================================================== // Hierarchy // ===================================================== { path: 'profile-hierarchy', - loadChildren: () => - import('./hierarchy/hierarchy.module').then(m => m.HierarchyModule), + loadChildren: () => import('./hierarchy/hierarchy.module').then((m) => m.HierarchyModule), canActivate: [AuthGuard, AppGuard], resolve: { userAnalytics: AnalyticsResolver }, - data: { appId: 'HIERARCHY_PROFILE_APP' } + data: { appId: 'HIERARCHY_PROFILE_APP' }, }, // ===================================================== // Subrogation // ===================================================== { path: 'subrogation', - loadChildren: () => - import('./subrogation/subrogation.module').then(m => m.SubrogationModule), + loadChildren: () => import('./subrogation/subrogation.module').then((m) => m.SubrogationModule), canActivate: [AuthGuard, AppGuard], resolve: { userAnalytics: AnalyticsResolver }, - data: { appId: 'SUBROGATIONS_APP' } + data: { appId: 'SUBROGATIONS_APP' }, }, // ===================================================== // Profile // ===================================================== { path: 'externalparamprofile', - loadChildren: () => - import('./external-param-profile/external-param-profile.module').then( - m => m.ExternalParamProfileModule - ), + loadChildren: () => import('./external-param-profile/external-param-profile.module').then((m) => m.ExternalParamProfileModule), canActivate: [AuthGuard, AppGuard], resolve: { userAnalytics: AnalyticsResolver }, - data: { appId: 'EXTERNAL_PARAM_PROFILE_APP' } + data: { appId: 'EXTERNAL_PARAM_PROFILE_APP' }, }, // ===================================================== // unknown path // ===================================================== - { path: '**', redirectTo: '' } + { path: '**', redirectTo: '' }, ]; @NgModule({ imports: [ RouterModule.forRoot(routes, { - preloadingStrategy: QuicklinkStrategy - }) + preloadingStrategy: QuicklinkStrategy, + }), ], exports: [RouterModule], - providers: [ActiveTenantGuard, AuthGuard] + providers: [ActiveTenantGuard, AuthGuard], }) export class AppRoutingModule {} diff --git a/ui/ui-frontend/projects/identity/src/app/app.component.html b/ui/ui-frontend/projects/identity/src/app/app.component.html index e27d1424c5a..97cf8972cd2 100644 --- a/ui/ui-frontend/projects/identity/src/app/app.component.html +++ b/ui/ui-frontend/projects/identity/src/app/app.component.html @@ -1,7 +1,7 @@ - + diff --git a/ui/ui-frontend/projects/identity/src/app/app.component.scss b/ui/ui-frontend/projects/identity/src/app/app.component.scss index 4f66d37db5b..15f8ab50ff3 100644 --- a/ui/ui-frontend/projects/identity/src/app/app.component.scss +++ b/ui/ui-frontend/projects/identity/src/app/app.component.scss @@ -1,3 +1,3 @@ .app-container { - padding-bottom: 50px; -} \ No newline at end of file + padding-bottom: 50px; +} diff --git a/ui/ui-frontend/projects/identity/src/app/app.component.spec.ts b/ui/ui-frontend/projects/identity/src/app/app.component.spec.ts index 320955ecde1..fb351ca617a 100644 --- a/ui/ui-frontend/projects/identity/src/app/app.component.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/app.component.spec.ts @@ -51,25 +51,17 @@ class RouterOutletStubComponent {} class SubrogationBannerStubComponent {} describe('AppComponent', () => { - beforeEach(waitForAsync(() => { const startupServiceStub = { configurationLoaded: () => true, printConfiguration: () => {}, getPlatformName: () => '' }; TestBed.configureTestingModule({ - imports: [ - MatSidenavModule, - NoopAnimationsModule - ], - declarations: [ - AppComponent, - SubrogationBannerStubComponent, - RouterOutletStubComponent, - ], + imports: [MatSidenavModule, NoopAnimationsModule], + declarations: [AppComponent, SubrogationBannerStubComponent, RouterOutletStubComponent], providers: [ { provide: StartupService, useValue: startupServiceStub }, { provide: AuthService, useValue: { userLoaded: of(null) } }, { provide: Router, useValue: { navigate: () => {} } }, ], - schemas: [ CUSTOM_ELEMENTS_SCHEMA ] + schemas: [CUSTOM_ELEMENTS_SCHEMA], }).compileComponents(); })); @@ -86,5 +78,4 @@ describe('AppComponent', () => { console.log('Title App: ', app); expect(app.title).toEqual('Identity App'); })); - }); diff --git a/ui/ui-frontend/projects/identity/src/app/app.component.ts b/ui/ui-frontend/projects/identity/src/app/app.component.ts index 20747b21745..cf21bfd5b36 100644 --- a/ui/ui-frontend/projects/identity/src/app/app.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/app.component.ts @@ -41,10 +41,9 @@ import { StartupService } from 'ui-frontend-common'; @Component({ selector: 'app-root', templateUrl: './app.component.html', - styleUrls: ['./app.component.scss'] + styleUrls: ['./app.component.scss'], }) export class AppComponent implements OnInit { - title = 'Identity App'; subrogating = false; @@ -52,7 +51,5 @@ export class AppComponent implements OnInit { titleService.setTitle(startupService.getPlatformName()); } - ngOnInit() { - } - + ngOnInit() {} } diff --git a/ui/ui-frontend/projects/identity/src/app/app.module.ts b/ui/ui-frontend/projects/identity/src/app/app.module.ts index e47a24c97a1..0eb2e40f101 100644 --- a/ui/ui-frontend/projects/identity/src/app/app.module.ts +++ b/ui/ui-frontend/projects/identity/src/app/app.module.ts @@ -80,7 +80,7 @@ export function httpLoaderFactory(httpBackend: HttpBackend): MultiTranslateHttpL }), ServiceWorkerModule.register('ngsw-worker.js', { enabled: environment.production }), ], - providers: [Title, { provide: LOCALE_ID, useValue: 'fr' }, { provide: WINDOW_LOCATION, useValue: window.location },DatePipe], + providers: [Title, { provide: LOCALE_ID, useValue: 'fr' }, { provide: WINDOW_LOCATION, useValue: window.location }, DatePipe], bootstrap: [AppComponent], }) export class AppModule {} diff --git a/ui/ui-frontend/projects/identity/src/app/core/api/customer-api.service.spec.ts b/ui/ui-frontend/projects/identity/src/app/core/api/customer-api.service.spec.ts index 021638a19d7..889367509bf 100644 --- a/ui/ui-frontend/projects/identity/src/app/core/api/customer-api.service.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/core/api/customer-api.service.spec.ts @@ -48,7 +48,7 @@ describe('CustomerApiService Identity', () => { { provide: BASE_URL, useValue: '/fake-api' }, { provide: ENVIRONMENT, useValue: environment }, ], - }) + }), ); it('should be created', () => { diff --git a/ui/ui-frontend/projects/identity/src/app/core/api/customer-api.service.ts b/ui/ui-frontend/projects/identity/src/app/core/api/customer-api.service.ts index 7d1d03b9805..4db3474e738 100644 --- a/ui/ui-frontend/projects/identity/src/app/core/api/customer-api.service.ts +++ b/ui/ui-frontend/projects/identity/src/app/core/api/customer-api.service.ts @@ -41,11 +41,14 @@ import { BaseHttpClient, BASE_URL, Customer, Logger, Logo, PageRequest, Paginate import { AttachmentType } from '../../customer/attachment.enum'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class CustomerApiService extends BaseHttpClient { - - constructor(http: HttpClient, @Inject(BASE_URL) baseUrl: string, private logger: Logger) { + constructor( + http: HttpClient, + @Inject(BASE_URL) baseUrl: string, + private logger: Logger, + ) { super(http, baseUrl + '/customers'); } @@ -61,7 +64,7 @@ export class CustomerApiService extends BaseHttpClient { return super.getOne(id, headers); } - checkExistsByParam(params: Array<{ key: string, value: string }>, headers?: HttpHeaders): Observable { + checkExistsByParam(params: Array<{ key: string; value: string }>, headers?: HttpHeaders): Observable { return super.checkExistsByParam(params, headers); } @@ -73,39 +76,41 @@ export class CustomerApiService extends BaseHttpClient { formData.append('customerDto', JSON.stringify(customerTmp)); if (logos) { - logos.forEach(logo => { + logos.forEach((logo) => { formData.append(logo.attr.toLowerCase(), logo.file); }); } return super.getHttp().post(super.getApiUrl(), formData, { headers }); } - patchCustomer(partialCustomer: { id: string, [key: string]: any }, logos?: Logo[], headers?: HttpHeaders): Observable { + patchCustomer(partialCustomer: { id: string; [key: string]: any }, logos?: Logo[], headers?: HttpHeaders): Observable { const formData: FormData = new FormData(); - formData.append('partialCustomerDto', JSON.stringify({ - id: partialCustomer.id, - hasCustomGraphicIdentity: partialCustomer.hasCustomGraphicIdentity, - themeColors: partialCustomer.themeColors, - portalTitles: partialCustomer.portalTitles, - portalMessages: partialCustomer.portalMessages, - identifier: partialCustomer.identifier, - code: partialCustomer.code, - name: partialCustomer.name, - companyName: partialCustomer.companyName, - passwordRevocationDelay: partialCustomer.passwordRevocationDelay, - otp: partialCustomer.otp, - address: partialCustomer.address, - internalCode: partialCustomer.internalCode, - language: partialCustomer.language, - emailDomains: partialCustomer.emailDomains, - defaultEmailDomain: partialCustomer.defaultEmailDomain, - gdprAlert: partialCustomer.gdprAlert, - gdprAlertDelay: partialCustomer.gdprAlertDelay, - - })); + formData.append( + 'partialCustomerDto', + JSON.stringify({ + id: partialCustomer.id, + hasCustomGraphicIdentity: partialCustomer.hasCustomGraphicIdentity, + themeColors: partialCustomer.themeColors, + portalTitles: partialCustomer.portalTitles, + portalMessages: partialCustomer.portalMessages, + identifier: partialCustomer.identifier, + code: partialCustomer.code, + name: partialCustomer.name, + companyName: partialCustomer.companyName, + passwordRevocationDelay: partialCustomer.passwordRevocationDelay, + otp: partialCustomer.otp, + address: partialCustomer.address, + internalCode: partialCustomer.internalCode, + language: partialCustomer.language, + emailDomains: partialCustomer.emailDomains, + defaultEmailDomain: partialCustomer.defaultEmailDomain, + gdprAlert: partialCustomer.gdprAlert, + gdprAlertDelay: partialCustomer.gdprAlertDelay, + }), + ); if (logos) { - logos.forEach(logo => { + logos.forEach((logo) => { formData.append(logo.attr.toLowerCase(), logo.file); }); } @@ -125,5 +130,4 @@ export class CustomerApiService extends BaseHttpClient { getGdprSettingStatus(): Observable { return this.http.get(this.apiUrl + '/gdpr-status'); } - } diff --git a/ui/ui-frontend/projects/identity/src/app/core/api/group-api.service.spec.ts b/ui/ui-frontend/projects/identity/src/app/core/api/group-api.service.spec.ts index 3bc6ff1a479..739845eb93c 100644 --- a/ui/ui-frontend/projects/identity/src/app/core/api/group-api.service.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/core/api/group-api.service.spec.ts @@ -41,14 +41,12 @@ import { BASE_URL } from 'ui-frontend-common'; import { GroupApiService } from './group-api.service'; describe('GroupApiService', () => { - beforeEach(() => TestBed.configureTestingModule({ - imports: [ - HttpClientTestingModule, - ], - providers: [ - { provide: BASE_URL, useValue: '/fake-api' }, - ] - })); + beforeEach(() => + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule], + providers: [{ provide: BASE_URL, useValue: '/fake-api' }], + }), + ); it('should be created', () => { const service: GroupApiService = TestBed.inject(GroupApiService); diff --git a/ui/ui-frontend/projects/identity/src/app/core/api/group-api.service.ts b/ui/ui-frontend/projects/identity/src/app/core/api/group-api.service.ts index 14e2ffb4132..aeae2f1356f 100644 --- a/ui/ui-frontend/projects/identity/src/app/core/api/group-api.service.ts +++ b/ui/ui-frontend/projects/identity/src/app/core/api/group-api.service.ts @@ -38,13 +38,12 @@ import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http'; import { Inject, Injectable } from '@angular/core'; import { Observable } from 'rxjs'; -import {BaseHttpClient, BASE_URL, Group, PageRequest, PaginatedResponse, SearchQuery} from 'ui-frontend-common'; +import { BaseHttpClient, BASE_URL, Group, PageRequest, PaginatedResponse, SearchQuery } from 'ui-frontend-common'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class GroupApiService extends BaseHttpClient { - constructor(http: HttpClient, @Inject(BASE_URL) baseUrl: string) { super(http, baseUrl + '/groups'); } @@ -65,7 +64,7 @@ export class GroupApiService extends BaseHttpClient { return super.getOneWithEmbedded(id, embedded, headers); } - checkExistsByParam(params: Array<{ key: string, value: string }>, headers?: HttpHeaders): Observable { + checkExistsByParam(params: Array<{ key: string; value: string }>, headers?: HttpHeaders): Observable { return super.checkExistsByParam(params, headers); } @@ -73,12 +72,12 @@ export class GroupApiService extends BaseHttpClient { return super.create(group, headers); } - patch(groupPartial: { id: string, [key: string]: any }, headers?: HttpHeaders): Observable { + patch(groupPartial: { id: string; [key: string]: any }, headers?: HttpHeaders): Observable { return super.patch(groupPartial, headers); } getLevels(query?: SearchQuery, headers?: HttpHeaders): Observable { - let params = new HttpParams(); + let params = new HttpParams(); if (query) { params = params.set('criteria', JSON.stringify(query)); } diff --git a/ui/ui-frontend/projects/identity/src/app/core/api/user-api.service.spec.ts b/ui/ui-frontend/projects/identity/src/app/core/api/user-api.service.spec.ts index 6dacabab36a..b4af050cd31 100644 --- a/ui/ui-frontend/projects/identity/src/app/core/api/user-api.service.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/core/api/user-api.service.spec.ts @@ -41,14 +41,12 @@ import { BASE_URL } from 'ui-frontend-common'; import { UserApiService } from './user-api.service'; describe('UserApiService', () => { - beforeEach(() => TestBed.configureTestingModule({ - imports: [ - HttpClientTestingModule, - ], - providers: [ - { provide: BASE_URL, useValue: '/fake-api' }, - ] - })); + beforeEach(() => + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule], + providers: [{ provide: BASE_URL, useValue: '/fake-api' }], + }), + ); it('should be created', () => { const service: UserApiService = TestBed.inject(UserApiService); diff --git a/ui/ui-frontend/projects/identity/src/app/core/api/user-api.service.ts b/ui/ui-frontend/projects/identity/src/app/core/api/user-api.service.ts index ffdade41a34..4db6c5dbbc6 100644 --- a/ui/ui-frontend/projects/identity/src/app/core/api/user-api.service.ts +++ b/ui/ui-frontend/projects/identity/src/app/core/api/user-api.service.ts @@ -41,10 +41,9 @@ import { Observable } from 'rxjs'; import { BaseHttpClient, BASE_URL, PageRequest, PaginatedResponse, SearchQuery, User } from 'ui-frontend-common'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class UserApiService extends BaseHttpClient { - constructor(http: HttpClient, @Inject(BASE_URL) baseUrl: string) { super(http, baseUrl + '/users'); } @@ -61,7 +60,7 @@ export class UserApiService extends BaseHttpClient { return super.getOne(id, headers); } - checkExistsByParam(params: Array<{ key: string, value: string }>, headers?: HttpHeaders): Observable { + checkExistsByParam(params: Array<{ key: string; value: string }>, headers?: HttpHeaders): Observable { return super.checkExistsByParam(params, headers); } @@ -69,12 +68,12 @@ export class UserApiService extends BaseHttpClient { return super.create(user, headers); } - patch(userPartial: { id: string, [key: string]: any }, headers?: HttpHeaders): Observable { + patch(userPartial: { id: string; [key: string]: any }, headers?: HttpHeaders): Observable { return super.patch(userPartial, headers); } getLevels(query?: SearchQuery, headers?: HttpHeaders): Observable { - let params = new HttpParams(); + let params = new HttpParams(); if (query) { params = params.set('criteria', JSON.stringify(query)); } diff --git a/ui/ui-frontend/projects/identity/src/app/core/core.module.ts b/ui/ui-frontend/projects/identity/src/app/core/core.module.ts index e143eb8c2af..9ae1d7bba33 100644 --- a/ui/ui-frontend/projects/identity/src/app/core/core.module.ts +++ b/ui/ui-frontend/projects/identity/src/app/core/core.module.ts @@ -41,22 +41,15 @@ import { BASE_URL, ENVIRONMENT, InjectorModule, LoggerModule, throwIfAlreadyLoad import { environment } from '../../environments/environment'; @NgModule({ - imports: [ - HttpClientModule, - VitamUICommonModule, - InjectorModule, - LoggerModule.forRoot() - ], + imports: [HttpClientModule, VitamUICommonModule, InjectorModule, LoggerModule.forRoot()], exports: [VitamUICommonModule], providers: [ { provide: BASE_URL, useValue: './identity-api' }, - { provide: ENVIRONMENT, useValue: environment } - ] + { provide: ENVIRONMENT, useValue: environment }, + ], }) export class CoreModule { - constructor(@Optional() @SkipSelf() parentModule: CoreModule) { throwIfAlreadyLoaded(parentModule, 'CoreModule'); } - } diff --git a/ui/ui-frontend/projects/identity/src/app/core/customer.service.spec.ts b/ui/ui-frontend/projects/identity/src/app/core/customer.service.spec.ts index ce2da3ef825..d36fe9600d8 100644 --- a/ui/ui-frontend/projects/identity/src/app/core/customer.service.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/core/customer.service.spec.ts @@ -34,7 +34,16 @@ * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ -import { BASE_URL, Customer, ENVIRONMENT, LoggerModule, Operators, OtpState, SearchQuery, VitamUISnackBarService } from 'ui-frontend-common'; +import { + BASE_URL, + Customer, + ENVIRONMENT, + LoggerModule, + Operators, + OtpState, + SearchQuery, + VitamUISnackBarService, +} from 'ui-frontend-common'; import { environment } from './../../environments/environment'; import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; diff --git a/ui/ui-frontend/projects/identity/src/app/core/customer.service.ts b/ui/ui-frontend/projects/identity/src/app/core/customer.service.ts index d88dfe9e03e..9d62a1f00f6 100644 --- a/ui/ui-frontend/projects/identity/src/app/core/customer.service.ts +++ b/ui/ui-frontend/projects/identity/src/app/core/customer.service.ts @@ -57,7 +57,7 @@ export class CustomerService { private customerApi: CustomerApiService, private snackBarService: VitamUISnackBarService, private sanitizer: DomSanitizer, - private themeService: ThemeService + private themeService: ThemeService, ) {} get(id: string): Observable { @@ -84,47 +84,45 @@ export class CustomerService { } create(customer: Customer, logos?: Logo[]): Observable { - return this.customerApi.createCustomer(customer, logos) - .pipe( - tap( - (response: Customer) => { - this.snackBarService.open({ - message: 'SHARED.SNACKBAR.CUSTOMER_CREATE', - icon: 'vitamui-icon-bank', - translateParams: { - param1: response.code - } - }); - }, - () => { - this.snackBarService.open({ - message: 'SHARED.SNACKBAR.CUSTOMER_CREATE_ERROR', - icon: 'vitamui-icon-danger', - }); - } - ) - ); + return this.customerApi.createCustomer(customer, logos).pipe( + tap( + (response: Customer) => { + this.snackBarService.open({ + message: 'SHARED.SNACKBAR.CUSTOMER_CREATE', + icon: 'vitamui-icon-bank', + translateParams: { + param1: response.code, + }, + }); + }, + () => { + this.snackBarService.open({ + message: 'SHARED.SNACKBAR.CUSTOMER_CREATE_ERROR', + icon: 'vitamui-icon-danger', + }); + }, + ), + ); } - patch(partialCustomer: { id: string, [key: string]: any }, logos?: Logo[]): Observable { - return this.customerApi.patchCustomer(partialCustomer, logos) - .pipe( - tap((updatedCustomer: Customer) => this.updated.next(updatedCustomer)), - tap( - (updatedCustomer: Customer) => { - this.snackBarService.open({ - message: 'SHARED.SNACKBAR.CUSTOMER_UPDATE', - icon: 'vitamui-icon-bank', - translateParams: { - param1: updatedCustomer.code - } - }); - }, - (error) => { - this.snackBarService.open({ message: error.error.message, translate: false }); - } - ) - ); + patch(partialCustomer: { id: string; [key: string]: any }, logos?: Logo[]): Observable { + return this.customerApi.patchCustomer(partialCustomer, logos).pipe( + tap((updatedCustomer: Customer) => this.updated.next(updatedCustomer)), + tap( + (updatedCustomer: Customer) => { + this.snackBarService.open({ + message: 'SHARED.SNACKBAR.CUSTOMER_UPDATE', + icon: 'vitamui-icon-bank', + translateParams: { + param1: updatedCustomer.code, + }, + }); + }, + (error) => { + this.snackBarService.open({ message: error.error.message, translate: false }); + }, + ), + ); } public getLogoUrl(id: string, type: AttachmentType): Observable { @@ -145,7 +143,7 @@ export class CustomerService { return null; } return this.sanitizer.bypassSecurityTrustResourceUrl(window.URL.createObjectURL(res.body)); - }) + }), ); } diff --git a/ui/ui-frontend/projects/identity/src/app/customer/attachment.enum.ts b/ui/ui-frontend/projects/identity/src/app/customer/attachment.enum.ts index 7e8c7e25746..664961bc4eb 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/attachment.enum.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/attachment.enum.ts @@ -1,5 +1,5 @@ export enum AttachmentType { - Header = 'HEADER', - Footer = 'FOOTER', - Portal = 'PORTAL' + Header = 'HEADER', + Footer = 'FOOTER', + Portal = 'PORTAL', } diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-alerting/customer-alerting.component.html b/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-alerting/customer-alerting.component.html index 28010c0826a..9b1cd4dbb48 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-alerting/customer-alerting.component.html +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-alerting/customer-alerting.component.html @@ -1,10 +1,10 @@ -

      Vous êtes sur le point de désactiver les alertes sur utilisateurs inactifs - dont les données personnelles sont arrivées à échéance dans cette organisation. Voulez-vous continuer ? -

      -
      - - - - \ No newline at end of file +

      + Vous êtes sur le point de désactiver les alertes sur utilisateurs inactifs dont les données personnelles sont arrivées à échéance dans + cette organisation. Voulez-vous continuer ? +

      + + + + + diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-alerting/customer-alerting.component.spec.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-alerting/customer-alerting.component.spec.ts index 98e86891537..e40140e0d69 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-alerting/customer-alerting.component.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-alerting/customer-alerting.component.spec.ts @@ -1,7 +1,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { CustomerAlertingComponent } from './customer-alerting.component'; -import {MatDialogModule} from '@angular/material/dialog'; +import { MatDialogModule } from '@angular/material/dialog'; describe('CustomerAlertingComponent', () => { let component: CustomerAlertingComponent; @@ -9,12 +9,9 @@ describe('CustomerAlertingComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - imports: [ - MatDialogModule - ], - declarations: [ CustomerAlertingComponent ] - }) - .compileComponents(); + imports: [MatDialogModule], + declarations: [CustomerAlertingComponent], + }).compileComponents(); })); beforeEach(() => { diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-alerting/customer-alerting.component.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-alerting/customer-alerting.component.ts index 37ae68cf7c7..9628f205405 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-alerting/customer-alerting.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-alerting/customer-alerting.component.ts @@ -3,13 +3,10 @@ import { Component, OnInit } from '@angular/core'; @Component({ selector: 'app-customer-alerting', templateUrl: './customer-alerting.component.html', - styleUrls: ['./customer-alerting.component.scss'] + styleUrls: ['./customer-alerting.component.scss'], }) export class CustomerAlertingComponent implements OnInit { + constructor() {} - constructor() { } - - ngOnInit() { - } - + ngOnInit() {} } diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-colors-input/customer-colors-input.component.html b/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-colors-input/customer-colors-input.component.html index 1b326bc0830..96686e1213d 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-colors-input/customer-colors-input.component.html +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-colors-input/customer-colors-input.component.html @@ -1,18 +1,23 @@
      - + [placeholder]="baseColors[color] | translate" + >
      - {{'CUSTOMER.GRAPHIC_IDENTITY.TERTIARY_COLOR_SHOW' | translate}} + {{ + 'CUSTOMER.GRAPHIC_IDENTITY.TERTIARY_COLOR_SHOW' | translate + }} - {{'CUSTOMER.GRAPHIC_IDENTITY.TERTIARY_COLOR_HIDE' | translate}} + {{ + 'CUSTOMER.GRAPHIC_IDENTITY.TERTIARY_COLOR_HIDE' | translate + }} + [placeholder]="'COLOR.TERTIARY' | translate" + > + [placeholder]="'COLOR.HEADER_FOOTER' | translate" + > - + (selectedChange)="formGroup.get(THEME_COLORS.VITAMUI_BACKGROUND).setValue($event)" + > -
      - - diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-colors-input/customer-colors-input.component.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-colors-input/customer-colors-input.component.ts index f29897a4e39..c24bcced0dd 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-colors-input/customer-colors-input.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-colors-input/customer-colors-input.component.ts @@ -1,7 +1,6 @@ -import {Component, Input, OnInit} from '@angular/core'; -import {FormGroup} from '@angular/forms'; -import {Color, ThemeColorType, ThemeService} from 'ui-frontend-common'; - +import { Component, Input, OnInit } from '@angular/core'; +import { FormGroup } from '@angular/forms'; +import { Color, ThemeColorType, ThemeService } from 'ui-frontend-common'; @Component({ selector: 'app-customer-colors-input', @@ -9,7 +8,6 @@ import {Color, ThemeColorType, ThemeService} from 'ui-frontend-common'; styleUrls: ['./customer-colors-input.component.scss'], }) export class CustomerColorsInputComponent implements OnInit { - @Input() formGroup: FormGroup; @Input() themeOverloadSelector: string; @@ -22,19 +20,16 @@ export class CustomerColorsInputComponent implements OnInit { public baseColors: { [colorId in ThemeColorType]?: string }; public displayTertiary = false; - public backgroundColors: {id: string, label: string}[] = []; + public backgroundColors: { id: string; label: string }[] = []; public THEME_COLORS = ThemeColorType; constructor(private themeService: ThemeService) {} public ngOnInit(): void { - this.baseColors = this.themeService.getBaseColors(); this.colors = this.themeService.getThemeColors(); - this.backgroundColors = this.themeService.backgroundChoice - .map((c: Color) => ({id: c.value, label: c.class, isDefault: c.isDefault})); + this.backgroundColors = this.themeService.backgroundChoice.map((c: Color) => ({ id: c.value, label: c.class, isDefault: c.isDefault })); } - } diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-colors-input/customer-colors-input.module.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-colors-input/customer-colors-input.module.ts index 857160968ab..79010e3e521 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-colors-input/customer-colors-input.module.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-colors-input/customer-colors-input.module.ts @@ -1,17 +1,17 @@ -import {CommonModule} from '@angular/common'; -import {NgModule} from '@angular/core'; -import {ReactiveFormsModule} from '@angular/forms'; -import {MatButtonToggleModule} from '@angular/material/button-toggle'; -import {MatFormFieldModule} from '@angular/material/form-field'; -import {MatInputModule} from '@angular/material/input'; -import {MatProgressBarModule} from '@angular/material/progress-bar'; -import {MatSelectModule} from '@angular/material/select'; -import {MatSnackBarModule} from '@angular/material/snack-bar'; -import {ColorPickerModule} from 'ngx-color-picker'; -import {VitamUICommonModule} from 'ui-frontend-common'; -import {SharedModule} from '../../../shared/shared.module'; -import {OwnerFormModule} from '../../owner-form/owner-form.module'; -import {CustomerColorsInputComponent} from './customer-colors-input.component'; +import { CommonModule } from '@angular/common'; +import { NgModule } from '@angular/core'; +import { ReactiveFormsModule } from '@angular/forms'; +import { MatButtonToggleModule } from '@angular/material/button-toggle'; +import { MatFormFieldModule } from '@angular/material/form-field'; +import { MatInputModule } from '@angular/material/input'; +import { MatProgressBarModule } from '@angular/material/progress-bar'; +import { MatSelectModule } from '@angular/material/select'; +import { MatSnackBarModule } from '@angular/material/snack-bar'; +import { ColorPickerModule } from 'ngx-color-picker'; +import { VitamUICommonModule } from 'ui-frontend-common'; +import { SharedModule } from '../../../shared/shared.module'; +import { OwnerFormModule } from '../../owner-form/owner-form.module'; +import { CustomerColorsInputComponent } from './customer-colors-input.component'; import { InputColorComponent } from './input-color/input-color.component'; @NgModule({ @@ -27,14 +27,9 @@ import { InputColorComponent } from './input-color/input-color.component'; ReactiveFormsModule, OwnerFormModule, VitamUICommonModule, - ColorPickerModule - ], - declarations: [ - CustomerColorsInputComponent, - InputColorComponent - ], - exports: [ - CustomerColorsInputComponent + ColorPickerModule, ], + declarations: [CustomerColorsInputComponent, InputColorComponent], + exports: [CustomerColorsInputComponent], }) -export class CustomerColorsInputModule { } +export class CustomerColorsInputModule {} diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-colors-input/input-color/color-error.enum.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-colors-input/input-color/color-error.enum.ts index 8a4a176cfa3..c682bdee5ed 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-colors-input/input-color/color-error.enum.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-colors-input/input-color/color-error.enum.ts @@ -2,5 +2,5 @@ export enum ColorErrorEnum { NONE, COLOR_INVALID, COLOR_TOO_LIGHT, - COLOR_TOO_DARK + COLOR_TOO_DARK, } diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-colors-input/input-color/input-color.component.html b/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-colors-input/input-color/input-color.component.html index 235cdae24ea..2d7d7c74a1d 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-colors-input/input-color/input-color.component.html +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-colors-input/input-color/input-color.component.html @@ -1,21 +1,33 @@ - - - -
      -
      {{'GRAPHIC_IDENTITY.INVALID' | translate}}
      - -
      {{'CUSTOMER.GRAPHIC_IDENTITY.TOO_LIGHT' | translate}}
      -
      {{'CUSTOMER.GRAPHIC_IDENTITY.INCOMPATIBLE' | translate}}
      -
      - -
      {{'CUSTOMER.GRAPHIC_IDENTITY.TOO_DARK' | translate}}
      -
      {{'CUSTOMER.GRAPHIC_IDENTITY.INCOMPATIBLE' | translate}}
      -
      -
      -
      + + + +
      +
      {{ 'GRAPHIC_IDENTITY.INVALID' | translate }}
      + +
      {{ 'CUSTOMER.GRAPHIC_IDENTITY.TOO_LIGHT' | translate }}
      +
      {{ 'CUSTOMER.GRAPHIC_IDENTITY.INCOMPATIBLE' | translate }}
      +
      + +
      {{ 'CUSTOMER.GRAPHIC_IDENTITY.TOO_DARK' | translate }}
      +
      {{ 'CUSTOMER.GRAPHIC_IDENTITY.INCOMPATIBLE' | translate }}
      +
      +
      +
      -
      \ No newline at end of file +
      diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-create.component.html b/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-create.component.html index e8e60ad9e99..363669fc8b1 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-create.component.html +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-create.component.html @@ -10,10 +10,17 @@ - {{'COMMON.ERROR.REQUIRED' | translate }} - {{ 'COMMON.ERROR.WRONG_FORMAT' | translate }} - {{ 'COMMON.ERROR.STRING_MAX_LENGTH' | translate: { max: customerCodeMaxLength } }} - {{'CUSTOMER.INFORMATIONS.MODAL.CODE_ALREADY_EXIST' | translate}} + {{ + 'COMMON.ERROR.REQUIRED' | translate + }} + {{ + 'COMMON.ERROR.WRONG_FORMAT' | translate + }} + {{ + 'COMMON.ERROR.STRING_MAX_LENGTH' | translate: { max: customerCodeMaxLength } + }} + {{ 'CUSTOMER.INFORMATIONS.MODAL.CODE_ALREADY_EXIST' | translate }} @@ -23,8 +30,11 @@ class="col-6 pl-0" formControlName="name" maxlength="100" -required [placeholder]="'CUSTOMER.INFORMATIONS.NAME' | translate"> - {{'COMMON.ERROR.REQUIRED' | translate}} + required + [placeholder]="'CUSTOMER.INFORMATIONS.NAME' | translate" + > + {{ 'COMMON.ERROR.REQUIRED' | translate }}
      @@ -97,8 +107,12 @@
      - +
      @@ -259,26 +273,32 @@ -
      +
      {{ 'CUSTOMER.OWNER.CREATE.TITLE' | translate }} "{{ customerInfo.name }}"
      -
      - +
      +

      {{ 'CUSTOMER.OWNER.CREATE.PROOF_ELEMENTS' | translate }}

      -
      - - -
      - +
      + + +
      +
      - + - -
      + +
      {{ 'CUSTOMER.OWNER.MODAL.SAFE_TITLE' | translate }} "{{ getOwnerName() }}"
      -
      + diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-create.component.spec.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-create.component.spec.ts index e344697fca4..70d68b5b55b 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-create.component.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-create.component.spec.ts @@ -171,54 +171,52 @@ class Page { let page: Page; describe('CustomerCreateComponent', () => { - beforeEach( - waitForAsync(() => { - const matDialogRefSpy = jasmine.createSpyObj('MatDialogRef', ['close']); - const customerServiceSpy = jasmine.createSpyObj('CustomerService', { create: of({}), getMyCustomer: of({}) }); - const customerCreateValidatorsSpy = jasmine.createSpyObj('CustomerCreateValidators', { - uniqueCode: () => of(null), - uniqueDomain: of(null), - }); - const ownerServiceSpy = jasmine.createSpyObj('OwnerService', { create: of({}) }); - const ownerFormValidatorsSpy = jasmine.createSpyObj('OwnerFormValidators', { uniqueCode: () => of(null) }); - const tenantServiceSpy = jasmine.createSpyObj('TenantService', { getTenantsByCustomerIds: of([]) }); - const tenantFormValidatorsSpy = jasmine.createSpyObj('TenantFormValidators', { - uniqueName: () => of(null), - }); - TestBed.configureTestingModule({ - imports: [ - ReactiveFormsModule, - MatFormFieldModule, - MatSelectModule, - MatButtonToggleModule, - MatProgressBarModule, - NoopAnimationsModule, - MatProgressSpinnerModule, - VitamUICommonTestModule, - LoggerModule.forRoot(), - HttpClientTestingModule, - ], - declarations: [CustomerCreateComponent, OwnerFormStubComponent, CustomerColorsInputStubComponent, DomainInputStubComponent], - providers: [ - { provide: MatDialogRef, useValue: matDialogRefSpy }, - { provide: MAT_DIALOG_DATA, useValue: {} }, - { provide: WINDOW_LOCATION, useValue: window.location }, - { provide: BASE_URL, useValue: '/fake-api' }, - { provide: StartupService, useValue: { getConfigNumberValue: () => 100 } }, - { provide: CustomerService, useValue: customerServiceSpy }, - { provide: CustomerCreateValidators, useValue: customerCreateValidatorsSpy }, - { provide: OwnerService, useValue: ownerServiceSpy }, - { provide: OwnerFormValidators, useValue: ownerFormValidatorsSpy }, - { provide: TenantService, useValue: tenantServiceSpy }, - { provide: ConfirmDialogService, useValue: { listenToEscapeKeyPress: () => EMPTY } }, - { provide: TenantFormValidators, useValue: tenantFormValidatorsSpy }, - { provide: CountryService, useValue: { getAvailableCountries: () => EMPTY } }, - { provide: MatDialog, useValue: {} }, - ], - schemas: [NO_ERRORS_SCHEMA], - }).compileComponents(); - }) - ); + beforeEach(waitForAsync(() => { + const matDialogRefSpy = jasmine.createSpyObj('MatDialogRef', ['close']); + const customerServiceSpy = jasmine.createSpyObj('CustomerService', { create: of({}), getMyCustomer: of({}) }); + const customerCreateValidatorsSpy = jasmine.createSpyObj('CustomerCreateValidators', { + uniqueCode: () => of(null), + uniqueDomain: of(null), + }); + const ownerServiceSpy = jasmine.createSpyObj('OwnerService', { create: of({}) }); + const ownerFormValidatorsSpy = jasmine.createSpyObj('OwnerFormValidators', { uniqueCode: () => of(null) }); + const tenantServiceSpy = jasmine.createSpyObj('TenantService', { getTenantsByCustomerIds: of([]) }); + const tenantFormValidatorsSpy = jasmine.createSpyObj('TenantFormValidators', { + uniqueName: () => of(null), + }); + TestBed.configureTestingModule({ + imports: [ + ReactiveFormsModule, + MatFormFieldModule, + MatSelectModule, + MatButtonToggleModule, + MatProgressBarModule, + NoopAnimationsModule, + MatProgressSpinnerModule, + VitamUICommonTestModule, + LoggerModule.forRoot(), + HttpClientTestingModule, + ], + declarations: [CustomerCreateComponent, OwnerFormStubComponent, CustomerColorsInputStubComponent, DomainInputStubComponent], + providers: [ + { provide: MatDialogRef, useValue: matDialogRefSpy }, + { provide: MAT_DIALOG_DATA, useValue: {} }, + { provide: WINDOW_LOCATION, useValue: window.location }, + { provide: BASE_URL, useValue: '/fake-api' }, + { provide: StartupService, useValue: { getConfigNumberValue: () => 100 } }, + { provide: CustomerService, useValue: customerServiceSpy }, + { provide: CustomerCreateValidators, useValue: customerCreateValidatorsSpy }, + { provide: OwnerService, useValue: ownerServiceSpy }, + { provide: OwnerFormValidators, useValue: ownerFormValidatorsSpy }, + { provide: TenantService, useValue: tenantServiceSpy }, + { provide: ConfirmDialogService, useValue: { listenToEscapeKeyPress: () => EMPTY } }, + { provide: TenantFormValidators, useValue: tenantFormValidatorsSpy }, + { provide: CountryService, useValue: { getAvailableCountries: () => EMPTY } }, + { provide: MatDialog, useValue: {} }, + ], + schemas: [NO_ERRORS_SCHEMA], + }).compileComponents(); + })); beforeEach(() => { fixture = TestBed.createComponent(CustomerCreateComponent); diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-create.component.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-create.component.ts index 3ab815a7b5c..8180032bacd 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-create.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-create.component.ts @@ -106,7 +106,7 @@ export class CustomerCreateComponent implements OnInit, OnDestroy { private tenantFormValidators: TenantFormValidators, private countryService: CountryService, private startupService: StartupService, - private matDialog: MatDialog + private matDialog: MatDialog, ) { this.maxStreetLength = this.startupService.getConfigNumberValue('MAX_STREET_LENGTH'); this.form = this.formBuilder.group({ @@ -179,7 +179,7 @@ export class CustomerCreateComponent implements OnInit, OnDestroy { name: this.form.get('name').value, companyName: this.form.get('companyName').value, }; - } + }, ); } @@ -219,7 +219,7 @@ export class CustomerCreateComponent implements OnInit, OnDestroy { (error) => { this.creating = false; console.error(error); - } + }, ); } diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-create.module.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-create.module.ts index dbe407796cd..784ca385c89 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-create.module.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-create.module.ts @@ -68,13 +68,10 @@ import { CustomerAlertingComponent } from './customer-alerting/customer-alerting OwnerFormModule, VitamUICommonModule, CustomerPreviewModule, - MatDialogModule - ], - declarations: [ - CustomerCreateComponent, - CustomerAlertingComponent + MatDialogModule, ], + declarations: [CustomerCreateComponent, CustomerAlertingComponent], entryComponents: [CustomerCreateComponent, CustomerAlertingComponent], - providers: [CustomerCreateValidators] + providers: [CustomerCreateValidators], }) -export class CustomerCreateModule { } +export class CustomerCreateModule {} diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-create.validators.spec.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-create.validators.spec.ts index c52435c7231..8a7e344e96a 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-create.validators.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-create.validators.spec.ts @@ -43,7 +43,7 @@ import { CustomerCreateValidators } from './customer-create.validators'; function toObservable(r: any): Observable { const obs = isPromise(r) ? from(r) : r; - if (!(isObservable(obs))) { + if (!isObservable(obs)) { throw new Error(`Expected validator to return Promise or Observable.`); } @@ -51,7 +51,6 @@ function toObservable(r: any): Observable { } describe('Customer Create Validators', () => { - describe('uniqueCode', () => { it('should return null', fakeAsync(() => { const customerServiceSpy = jasmine.createSpyObj('CustomerService', ['exists']); @@ -121,5 +120,4 @@ describe('Customer Create Validators', () => { expect(customerServiceSpy.exists).toHaveBeenCalledWith({ domain: 'test.com' }); })); }); - }); diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-create.validators.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-create.validators.ts index 87100d936a1..a17a64583a4 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-create.validators.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-create.validators.ts @@ -47,27 +47,25 @@ export const ALPHA_NUMERIC_REGEX = /^[a-zA-Z0-9]*$/; @Injectable() export class CustomerCreateValidators { + private debounceTime = 400; - private debounceTime = 400; + constructor(private customerService: CustomerService) {} - constructor(private customerService: CustomerService) {} - - uniqueCode = (codeToIgnore?: string): AsyncValidatorFn => { - return (control: AbstractControl) => { - return timer(this.debounceTime).pipe( - switchMap(() => control.value !== codeToIgnore ? this.customerService.exists({ code: control.value }) : of(false)), - take(1), - map((exists: boolean) => exists ? { uniqueCode: true } : null) - ); - }; - } - - uniqueDomain = (control: AbstractControl): Observable => { + uniqueCode = (codeToIgnore?: string): AsyncValidatorFn => { + return (control: AbstractControl) => { return timer(this.debounceTime).pipe( - switchMap(() => this.customerService.exists({ domain: control.value })), + switchMap(() => (control.value !== codeToIgnore ? this.customerService.exists({ code: control.value }) : of(false))), take(1), - map((exists: boolean) => exists ? { uniqueDomain: true } : null) + map((exists: boolean) => (exists ? { uniqueCode: true } : null)), ); - } + }; + }; + uniqueDomain = (control: AbstractControl): Observable => { + return timer(this.debounceTime).pipe( + switchMap(() => this.customerService.exists({ domain: control.value })), + take(1), + map((exists: boolean) => (exists ? { uniqueDomain: true } : null)), + ); + }; } diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-list/customer-list.component.html b/ui/ui-frontend/projects/identity/src/app/customer/customer-list/customer-list.component.html index ab82be5b446..4f75fdcefb5 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-list/customer-list.component.html +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-list/customer-list.component.html @@ -2,17 +2,23 @@
      -
      {{'CUSTOMER.HOME.RESULTS_TABLE.CODE' | translate}}
      -
      {{'CUSTOMER.HOME.RESULTS_TABLE.NAME' | translate}}
      -
      {{'CUSTOMER.HOME.RESULTS_TABLE.SOCIAL_REASON' | translate}}
      -
      {{'CUSTOMER.HOME.RESULTS_TABLE.SSO' | translate}}
      -
      {{'CUSTOMER.HOME.RESULTS_TABLE.VALIDATIONS' | translate}}
      +
      {{ 'CUSTOMER.HOME.RESULTS_TABLE.CODE' | translate }}
      +
      {{ 'CUSTOMER.HOME.RESULTS_TABLE.NAME' | translate }}
      +
      {{ 'CUSTOMER.HOME.RESULTS_TABLE.SOCIAL_REASON' | translate }}
      +
      {{ 'CUSTOMER.HOME.RESULTS_TABLE.SSO' | translate }}
      +
      {{ 'CUSTOMER.HOME.RESULTS_TABLE.VALIDATIONS' | translate }}
      -
      +
      @@ -22,10 +28,10 @@
      {{ customer?.code }}
      {{ customer?.name }}
      {{ customer?.companyName }}
      -
      {{ customer?.idp ? 'Oui' : 'Non'}}
      +
      {{ customer?.idp ? 'Oui' : 'Non' }}
      - { customer?.otp, select, DISABLED {Non} OPTIONAL {Optionnelle} MANDATORY {Obligatoire} } + {customer?.otp, select, DISABLED {Non} OPTIONAL {Optionnelle} MANDATORY {Obligatoire}}
      -
      -
      -
      +
      +
      +
      -
      {{'COMMON.NO_RESULT' | translate}}
      -
      +
      {{ 'COMMON.NO_RESULT' | translate }}
      + - +
      - {{'COMMON.SHOW_MORE_RESULTS' | translate}} + {{ 'COMMON.SHOW_MORE_RESULTS' | translate }}
      diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-list/customer-list.component.spec.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-list/customer-list.component.spec.ts index 6848b9d9861..1a69c6d8e95 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-list/customer-list.component.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-list/customer-list.component.spec.ts @@ -1,40 +1,39 @@ /* -* Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2020) -* and the signatories of the "VITAM - Accord du Contributeur" agreement. -* -* contact@programmevitam.fr -* -* This software is a computer program whose purpose is to implement -* implement a digital archiving front-office system for the secure and -* efficient high volumetry VITAM solution. -* -* This software is governed by the CeCILL-C license under French law and -* abiding by the rules of distribution of free software. You can use, -* modify and/ or redistribute the software under the terms of the CeCILL-C -* license as circulated by CEA, CNRS and INRIA at the following URL -* "http://www.cecill.info". -* -* As a counterpart to the access to the source code and rights to copy, -* modify and redistribute granted by the license, users are provided only -* with a limited warranty and the software's author, the holder of the -* economic rights, and the successive licensors have only limited -* liability. -* -* In this respect, the user's attention is drawn to the risks associated -* with loading, using, modifying and/or developing or reproducing the -* software by the user in light of its specific status of free software, -* that may mean that it is complicated to manipulate, and that also -* therefore means that it is reserved for developers and experienced -* professionals having in-depth computer knowledge. Users are therefore -* encouraged to load and test the software's suitability as regards their -* requirements in conditions enabling the security of their systems and/or -* data to be ensured and, more generally, to use and operate it in the -* same conditions as regards security. -* -* The fact that you are presently reading this means that you have had -* knowledge of the CeCILL-C license and that you accept its terms. -*/ - + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2020) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to implement + * implement a digital archiving front-office system for the secure and + * efficient high volumetry VITAM solution. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ import { Component, Directive, Input } from '@angular/core'; import { waitForAsync } from '@angular/core/testing'; @@ -44,7 +43,7 @@ import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; import { By } from '@angular/platform-browser'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { Router } from '@angular/router'; -import { of , Subject } from 'rxjs'; +import { of, Subject } from 'rxjs'; import { Customer, OtpState, Owner, Tenant } from 'ui-frontend-common'; import { InfiniteScrollStubDirective, VitamUICommonTestModule } from 'ui-frontend-common/testing'; @@ -74,14 +73,24 @@ let component: CustomerListComponent; let fixture: ComponentFixture; class Page { - - get table() { return fixture.nativeElement.querySelector('.vitamui-table'); } - get columns() { return fixture.nativeElement.querySelectorAll('.vitamui-table-head div'); } - get rows() { return fixture.nativeElement.querySelectorAll('.vitamui-table-rows .vitamui-row .align-items-center'); } - get ownerBtn() { return fixture.nativeElement.querySelectorAll('.vitamui-table-rows .vitamui-row .btn.btn-circle.primary'); } - get loadMoreButton() { return fixture.nativeElement.querySelectorAll('.vitamui-min-content.vitamui-table-message'); } - get infiniteScroll() { return fixture.debugElement.query(By.directive(InfiniteScrollStubDirective)); } - + get table() { + return fixture.nativeElement.querySelector('.vitamui-table'); + } + get columns() { + return fixture.nativeElement.querySelectorAll('.vitamui-table-head div'); + } + get rows() { + return fixture.nativeElement.querySelectorAll('.vitamui-table-rows .vitamui-row .align-items-center'); + } + get ownerBtn() { + return fixture.nativeElement.querySelectorAll('.vitamui-table-rows .vitamui-row .btn.btn-circle.primary'); + } + get loadMoreButton() { + return fixture.nativeElement.querySelectorAll('.vitamui-min-content.vitamui-table-message'); + } + get infiniteScroll() { + return fixture.debugElement.query(By.directive(InfiniteScrollStubDirective)); + } } let page: Page; @@ -89,9 +98,9 @@ let customers: Customer[]; let tenants: Tenant[]; describe('CustomerListComponent', () => { - beforeEach(waitForAsync(() => { - customers = [{ + customers = [ + { id: '11', identifier: '11', code: '011000', @@ -104,20 +113,18 @@ describe('CustomerListComponent', () => { passwordRevocationDelay: 1, otp: OtpState.DEACTIVATED, idp: true, - emailDomains: [ - 'kouygues.com', - ], + emailDomains: ['kouygues.com'], defaultEmailDomain: 'kouygues.com', address: { street: '13 rue faubourg', zipCode: '75009', city: 'paris', - country: 'france' + country: 'france', }, owners: [], themeColors: {}, - gdprAlert : false, - gdprAlertDelay : 72, + gdprAlert: false, + gdprAlertDelay: 72, portalMessages: {}, portalTitles: {}, }, @@ -134,20 +141,18 @@ describe('CustomerListComponent', () => { passwordRevocationDelay: 1, otp: OtpState.OPTIONAL, idp: false, - emailDomains: [ - 'louygues.com', - ], + emailDomains: ['louygues.com'], defaultEmailDomain: 'louygues.com', address: { street: '13 rue faubourg', zipCode: '75009', city: 'paris', - country: 'france' + country: 'france', }, owners: [], themeColors: {}, - gdprAlert : false, - gdprAlertDelay : 72, + gdprAlert: false, + gdprAlertDelay: 72, portalMessages: {}, portalTitles: {}, }, @@ -164,20 +169,18 @@ describe('CustomerListComponent', () => { passwordRevocationDelay: 1, otp: OtpState.MANDATORY, idp: true, - emailDomains: [ - 'mouygues.com', - ], + emailDomains: ['mouygues.com'], defaultEmailDomain: 'mouygues.com', address: { street: '13 rue faubourg', zipCode: '75009', city: 'paris', - country: 'france' + country: 'france', }, owners: [], themeColors: {}, - gdprAlert : false, - gdprAlertDelay : 72, + gdprAlert: false, + gdprAlertDelay: 72, portalMessages: {}, portalTitles: {}, }, @@ -194,20 +197,18 @@ describe('CustomerListComponent', () => { passwordRevocationDelay: 1, otp: OtpState.OPTIONAL, idp: false, - emailDomains: [ - 'nrange.com', - ], + emailDomains: ['nrange.com'], defaultEmailDomain: 'nrange.com', address: { street: '13 rue faubourg', zipCode: '75009', city: 'paris', - country: 'france' + country: 'france', }, owners: [], themeColors: {}, - gdprAlert : false, - gdprAlertDelay : 72, + gdprAlert: false, + gdprAlertDelay: 72, portalMessages: {}, portalTitles: {}, }, @@ -224,20 +225,18 @@ describe('CustomerListComponent', () => { passwordRevocationDelay: 1, otp: OtpState.OPTIONAL, idp: false, - emailDomains: [ - 'bouygues.com', - ], + emailDomains: ['bouygues.com'], defaultEmailDomain: 'bouygues.com', address: { street: '13 rue faubourg', zipCode: '75009', city: 'paris', - country: 'france' + country: 'france', }, owners: [], themeColors: {}, - gdprAlert : false, - gdprAlertDelay : 72, + gdprAlert: false, + gdprAlertDelay: 72, portalMessages: {}, portalTitles: {}, }, @@ -259,27 +258,17 @@ describe('CustomerListComponent', () => { matDialogSpy.open.and.returnValue({ afterClosed: () => of(true) }); TestBed.configureTestingModule({ - imports: [ - MatProgressSpinnerModule, - NoopAnimationsModule, - VitamUICommonTestModule, - ], - declarations: [ - CustomerListComponent, - CollapseStubDirective, - CollapseTriggerForStubDirective, - OwnerListStubComponent - ], + imports: [MatProgressSpinnerModule, NoopAnimationsModule, VitamUICommonTestModule], + declarations: [CustomerListComponent, CollapseStubDirective, CollapseTriggerForStubDirective, OwnerListStubComponent], providers: [ { provide: CustomerListService, useValue: customerListServiceSpy }, - { provide: CustomerService, useValue: { updated: new Subject()} }, + { provide: CustomerService, useValue: { updated: new Subject() } }, { provide: TenantService, useValue: tenantServiceSpy }, { provide: MatDialog, useValue: matDialogSpy }, { provide: Router, useValue: routerSpy }, CustomerDataService, - ] - }) - .compileComponents(); + ], + }).compileComponents(); const customerListService = TestBed.get(CustomerListService); spyOn(customerListService, 'search').and.callThrough(); @@ -289,7 +278,6 @@ describe('CustomerListComponent', () => { spyOn(customerDataService, 'addTenants').and.callThrough(); spyOn(customerDataService, 'updateTenant').and.callThrough(); spyOn(customerDataService, 'tenantsUpdated$').and.callThrough(); - })); beforeEach(() => { @@ -370,14 +358,14 @@ describe('CustomerListComponent', () => { expect(matDialogSpy.open).toHaveBeenCalledWith(OwnerCreateComponent, { data: { customer: customers[2] }, panelClass: 'vitamui-modal', - disableClose: true + disableClose: true, }); }); it('should add the new owner to the list', () => { const newOwner: Owner = { id: '42', - identifier : '42', + identifier: '42', code: '00042', customerId: customers[0].id, name: 'Toto', @@ -386,9 +374,9 @@ describe('CustomerListComponent', () => { street: null, zipCode: null, city: null, - country: null + country: null, }, - readonly : false + readonly: false, }; const matDialogSpy = TestBed.get(MatDialog); matDialogSpy.open.and.returnValue({ afterClosed: () => of({ owner: newOwner }) }); diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-list/customer-list.component.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-list/customer-list.component.ts index edae5adc037..75cc2444dbb 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-list/customer-list.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-list/customer-list.component.ts @@ -40,14 +40,17 @@ import { MatDialog } from '@angular/material/dialog'; import { Subscription } from 'rxjs'; import { filter } from 'rxjs/operators'; -import { collapseAnimation, +import { + collapseAnimation, Customer, DEFAULT_PAGE_SIZE, Direction, InfiniteScrollTable, - Owner, PageRequest, + Owner, + PageRequest, rotateAnimation, - Tenant } from 'ui-frontend-common'; + Tenant, +} from 'ui-frontend-common'; import { CustomerService } from '../../core/customer.service'; import { CustomerDataService } from '../customer.data.service'; import { OwnerCreateComponent } from '../owner-create/owner-create.component'; @@ -58,13 +61,9 @@ import { CustomerListService } from './customer-list.service'; selector: 'app-customer-list', templateUrl: './customer-list.component.html', styleUrls: ['./customer-list.component.scss'], - animations: [ - collapseAnimation, - rotateAnimation, - ] + animations: [collapseAnimation, rotateAnimation], }) export class CustomerListComponent extends InfiniteScrollTable implements OnDestroy, OnInit { - @Output() customerClick = new EventEmitter(); @Output() ownerClick = new EventEmitter(); @Output() tenantClick = new EventEmitter(); @@ -80,29 +79,28 @@ export class CustomerListComponent extends InfiniteScrollTable impleme public customerService: CustomerService, public tenantService: TenantService, private customerDataService: CustomerDataService, - private dialog: MatDialog + private dialog: MatDialog, ) { super(customerListService); } - ngOnInit() { - this.searchCustomersOrderedByCode(); - this.customerDataService.tenantsUpdated$.subscribe((tenants) => { + this.searchCustomersOrderedByCode(); + this.customerDataService.tenantsUpdated$.subscribe((tenants) => { this.tenants = tenants; }); this.updatedData.subscribe(() => { + const customerIds = this.dataSource + .filter((customer: Customer) => { + const existingTenant = this.tenants.find((tenant) => tenant.customerId === customer.id); + if (!existingTenant) { + return true; + } - const customerIds = this.dataSource.filter((customer: Customer) => { - const existingTenant = this.tenants.find((tenant) => tenant.customerId === customer.id); - if (!existingTenant) { - return true; - } - - return false; - }) - .map((customer: Customer) => customer.id); + return false; + }) + .map((customer: Customer) => customer.id); if (customerIds && customerIds.length > 0) { this.tenantService.getTenantsByCustomerIds(customerIds).subscribe((results) => { @@ -137,14 +135,15 @@ export class CustomerListComponent extends InfiniteScrollTable impleme const dialogRef = this.dialog.open(OwnerCreateComponent, { disableClose: true, data: { customer }, - panelClass: 'vitamui-modal' - }); - dialogRef.afterClosed().pipe(filter((result) => !!result)) - .subscribe((result: { owner?: Owner, tenant?: Tenant }) => { - if (result.owner) { - customer.owners.push(result.owner); - } + panelClass: 'vitamui-modal', }); + dialogRef + .afterClosed() + .pipe(filter((result) => !!result)) + .subscribe((result: { owner?: Owner; tenant?: Tenant }) => { + if (result.owner) { + customer.owners.push(result.owner); + } + }); } - } diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-list/customer-list.module.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-list/customer-list.module.ts index 364a246db97..fb54f5de9a9 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-list/customer-list.module.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-list/customer-list.module.ts @@ -58,12 +58,7 @@ import { OwnerListComponent } from './owner-list/owner-list.component'; MatTooltipModule, VitamUICommonModule, ], - declarations: [ - CustomerListComponent, - OwnerListComponent, - ], - exports: [ - CustomerListComponent, - ] + declarations: [CustomerListComponent, OwnerListComponent], + exports: [CustomerListComponent], }) -export class CustomerListModule { } +export class CustomerListModule {} diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-list/customer-list.service.spec.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-list/customer-list.service.spec.ts index 796fbbd6cdc..992bac2851f 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-list/customer-list.service.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-list/customer-list.service.spec.ts @@ -43,7 +43,7 @@ import { BASE_URL, Customer, Direction, LoggerModule, OtpState, PageRequest } fr import { environment } from './../../../environments/environment'; import { CustomerListService } from './customer-list.service'; -const expectedCustomersPage: { values: Customer[], pageNum: number, pageSize: number, hasMore: boolean } = { +const expectedCustomersPage: { values: Customer[]; pageNum: number; pageSize: number; hasMore: boolean } = { values: [ { id: '5acc6bd8b75bfb2e46aeec3da96bdc5206a641e2babc48ec12473c206c4bb97d', @@ -57,9 +57,7 @@ const expectedCustomersPage: { values: Customer[], pageNum: number, pageSize: nu language: 'FRENCH', passwordRevocationDelay: 365, otp: OtpState.OPTIONAL, - emailDomains: [ - 'vitamui.com', - ], + emailDomains: ['vitamui.com'], defaultEmailDomain: 'vitamui.com', owners: [ { @@ -73,10 +71,9 @@ const expectedCustomersPage: { values: Customer[], pageNum: number, pageSize: nu street: '73 rue du Faubourg Poissonnière ', zipCode: '75009', city: 'Paris', - country: 'France' + country: 'France', }, readonly: false, - }, { id: '2', @@ -89,9 +86,9 @@ const expectedCustomersPage: { values: Customer[], pageNum: number, pageSize: nu street: '73 rue du Faubourg Poissonnière ', zipCode: '75009', city: 'Paris', - country: 'France' + country: 'France', }, - readonly: false + readonly: false, }, ], internalCode: '1', @@ -99,11 +96,11 @@ const expectedCustomersPage: { values: Customer[], pageNum: number, pageSize: nu street: '73 rue du Faubourg Poissonnière ', zipCode: '75009', city: 'Paris', - country: 'France' + country: 'France', }, themeColors: {}, - gdprAlert : false, - gdprAlertDelay : 72, + gdprAlert: false, + gdprAlertDelay: 72, portalMessages: {}, portalTitles: {}, }, @@ -119,9 +116,7 @@ const expectedCustomersPage: { values: Customer[], pageNum: number, pageSize: nu language: 'ENGLISH', passwordRevocationDelay: 365, otp: OtpState.OPTIONAL, - emailDomains: [ - 'edf.com', - ], + emailDomains: ['edf.com'], defaultEmailDomain: 'edf.com', owners: [ { @@ -135,9 +130,9 @@ const expectedCustomersPage: { values: Customer[], pageNum: number, pageSize: nu street: '22-30 Avenue de WAGRAM', zipCode: '75008', city: 'Paris', - country: 'France' + country: 'France', }, - readonly: false + readonly: false, }, { id: '5', @@ -150,9 +145,9 @@ const expectedCustomersPage: { values: Customer[], pageNum: number, pageSize: nu street: '22-30 Avenue de WAGRAM', zipCode: '75008', city: 'Paris', - country: 'France' + country: 'France', }, - readonly: false + readonly: false, }, ], internalCode: '1', @@ -160,21 +155,21 @@ const expectedCustomersPage: { values: Customer[], pageNum: number, pageSize: nu street: '22-30 Avenue de WAGRAM', zipCode: '75008', city: 'Paris', - country: 'France' + country: 'France', }, themeColors: {}, - gdprAlert : false, - gdprAlertDelay : 72, + gdprAlert: false, + gdprAlertDelay: 72, portalMessages: {}, - portalTitles: {} + portalTitles: {}, }, ], pageNum: 0, pageSize: 20, - hasMore: false + hasMore: false, }; -const customersPage: { values: Customer[], pageNum: number, pageSize: number, hasMore: boolean } = { +const customersPage: { values: Customer[]; pageNum: number; pageSize: number; hasMore: boolean } = { values: [ { id: '5acc6bd8b75bfb2e46aeec3da96bdc5206a641e2babc48ec12473c206c4bb97d', @@ -188,9 +183,7 @@ const customersPage: { values: Customer[], pageNum: number, pageSize: number, ha language: 'FRENCH', passwordRevocationDelay: 365, otp: OtpState.OPTIONAL, - emailDomains: [ - 'vitamui.com', - ], + emailDomains: ['vitamui.com'], defaultEmailDomain: 'vitamui.com', owners: [ { @@ -204,9 +197,9 @@ const customersPage: { values: Customer[], pageNum: number, pageSize: number, ha street: '73 rue du Faubourg Poissonnière ', zipCode: '75009', city: 'Paris', - country: 'France' + country: 'France', }, - readonly: false + readonly: false, }, { id: '2', @@ -219,9 +212,9 @@ const customersPage: { values: Customer[], pageNum: number, pageSize: number, ha street: '73 rue du Faubourg Poissonnière ', zipCode: '75009', city: 'Paris', - country: 'France' + country: 'France', }, - readonly: false + readonly: false, }, ], internalCode: '1', @@ -229,13 +222,13 @@ const customersPage: { values: Customer[], pageNum: number, pageSize: number, ha street: '73 rue du Faubourg Poissonnière ', zipCode: '75009', city: 'Paris', - country: 'France' + country: 'France', }, themeColors: {}, - gdprAlert : false, - gdprAlertDelay : 72, + gdprAlert: false, + gdprAlertDelay: 72, portalMessages: {}, - portalTitles: {} + portalTitles: {}, }, { id: '5acc6bd8b75bfb2e46aeec41e0973280907b4bc7a918b07df78df36f501b3ba5', @@ -249,9 +242,7 @@ const customersPage: { values: Customer[], pageNum: number, pageSize: number, ha language: 'ENGLISH', passwordRevocationDelay: 365, otp: OtpState.OPTIONAL, - emailDomains: [ - 'edf.com', - ], + emailDomains: ['edf.com'], defaultEmailDomain: 'edf.com', owners: [ { @@ -265,9 +256,9 @@ const customersPage: { values: Customer[], pageNum: number, pageSize: number, ha street: '22-30 Avenue de WAGRAM', zipCode: '75008', city: 'Paris', - country: 'France' + country: 'France', }, - readonly: false + readonly: false, }, { id: '5', @@ -280,9 +271,9 @@ const customersPage: { values: Customer[], pageNum: number, pageSize: number, ha street: '22-30 Avenue de WAGRAM', zipCode: '75008', city: 'Paris', - country: 'France' + country: 'France', }, - readonly: false + readonly: false, }, ], internalCode: '1', @@ -290,18 +281,18 @@ const customersPage: { values: Customer[], pageNum: number, pageSize: number, ha street: '22-30 Avenue de WAGRAM', zipCode: '75008', city: 'Paris', - country: 'France' + country: 'France', }, themeColors: {}, - gdprAlert : false, - gdprAlertDelay : 72, + gdprAlert: false, + gdprAlertDelay: 72, portalMessages: {}, - portalTitles: {} + portalTitles: {}, }, ], pageNum: 0, pageSize: 20, - hasMore: false + hasMore: false, }; describe('CustomerListService', () => { @@ -313,8 +304,8 @@ describe('CustomerListService', () => { imports: [HttpClientTestingModule, LoggerModule.forRoot()], providers: [ { provide: BASE_URL, useValue: '/fake-api' }, - { provide: ENVIRONMENT, useValue: environment } - ] + { provide: ENVIRONMENT, useValue: environment }, + ], }); httpTestingController = TestBed.inject(HttpTestingController as Type); @@ -334,10 +325,10 @@ describe('CustomerListService', () => { }); it('should call /fake-api/customers?page=42&size=15&orderBy=code&direction=DESC', () => { - customerListService.search(new PageRequest(42, 15, 'name', Direction.DESCENDANT)) + customerListService + .search(new PageRequest(42, 15, 'name', Direction.DESCENDANT)) .subscribe((response) => expect(response).toEqual(expectedCustomersPage.values), fail); - const req = httpTestingController.expectOne( - '/fake-api/customers?page=42&size=15&orderBy=name&direction=DESC&embedded=OWNER,TENANT'); + const req = httpTestingController.expectOne('/fake-api/customers?page=42&size=15&orderBy=name&direction=DESC&embedded=OWNER,TENANT'); expect(req.request.method).toEqual('GET'); req.flush(customersPage); }); @@ -345,21 +336,21 @@ describe('CustomerListService', () => { it('should call /fake-api/customers?page=0&size=15&orderBy=companyName&direction=DESC', () => { customersPage.hasMore = true; customersPage.pageSize = 15; - customerListService.search(new PageRequest(0, 15, 'companyName', Direction.DESCENDANT)) + customerListService + .search(new PageRequest(0, 15, 'companyName', Direction.DESCENDANT)) .subscribe((response) => expect(response).toEqual(expectedCustomersPage.values), fail); let req = httpTestingController.expectOne( - '/fake-api/customers?page=0&size=15&orderBy=companyName&direction=DESC&embedded=OWNER,TENANT'); + '/fake-api/customers?page=0&size=15&orderBy=companyName&direction=DESC&embedded=OWNER,TENANT', + ); expect(req.request.method).toEqual('GET'); req.flush(customersPage); customersPage.pageNum = 1; customersPage.hasMore = false; - customerListService.loadMore().subscribe( - (response) => expect(response).toEqual(expectedCustomersPage.values.concat(expectedCustomersPage.values)), - fail - ); - req = httpTestingController.expectOne( - '/fake-api/customers?page=1&size=15&orderBy=companyName&direction=DESC&embedded=OWNER,TENANT'); + customerListService + .loadMore() + .subscribe((response) => expect(response).toEqual(expectedCustomersPage.values.concat(expectedCustomersPage.values)), fail); + req = httpTestingController.expectOne('/fake-api/customers?page=1&size=15&orderBy=companyName&direction=DESC&embedded=OWNER,TENANT'); expect(req.request.method).toEqual('GET'); req.flush(customersPage); }); @@ -372,10 +363,7 @@ describe('CustomerListService', () => { expect(req.request.method).toEqual('GET'); req.flush(customersPage); - customerListService.loadMore().subscribe( - (response) => expect(response).toEqual(expectedCustomersPage.values), - fail - ); + customerListService.loadMore().subscribe((response) => expect(response).toEqual(expectedCustomersPage.values), fail); httpTestingController.expectNone('/fake-api/customers?page=1&size=20&orderBy=code&direction=ASC&embedded=OWNER,TENANT'); }); @@ -385,13 +373,10 @@ describe('CustomerListService', () => { it('should return true', () => { customersPage.hasMore = true; - customerListService.search().subscribe( - (response) => { - expect(response).toEqual(expectedCustomersPage.values); - expect(customerListService.canLoadMore).toBeTruthy(); - }, - fail - ); + customerListService.search().subscribe((response) => { + expect(response).toEqual(expectedCustomersPage.values); + expect(customerListService.canLoadMore).toBeTruthy(); + }, fail); const req = httpTestingController.expectOne('/fake-api/customers?page=0&size=20&orderBy=code&direction=ASC&embedded=OWNER,TENANT'); expect(req.request.method).toEqual('GET'); req.flush(customersPage); diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-list/customer-list.service.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-list/customer-list.service.ts index 5e367fa9ec9..a338fea13d4 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-list/customer-list.service.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-list/customer-list.service.ts @@ -43,49 +43,50 @@ import { Customer, DEFAULT_PAGE_SIZE, Direction, Owner, PageRequest, PaginatedRe import { CustomerApiService } from '../../core/api/customer-api.service'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class CustomerListService extends SearchService { - - constructor(http: HttpClient, private customerApi: CustomerApiService) { + constructor( + http: HttpClient, + private customerApi: CustomerApiService, + ) { super(http, customerApi, 'OWNER,TENANT'); } search(pageRequest: PageRequest = new PageRequest(0, DEFAULT_PAGE_SIZE, 'code', Direction.ASCENDANT)): Observable { this.pageRequest = pageRequest; - return this.customerApi.getAllPaginated(this.pageRequest, 'OWNER,TENANT') - .pipe( - map((paginated: PaginatedResponse) => { - this.data = paginated.values.map((customer) => this.transformCustomer(customer)); - this.pageRequest.page = paginated.pageNum; - this.hasMore = paginated.hasMore; + return this.customerApi.getAllPaginated(this.pageRequest, 'OWNER,TENANT').pipe( + map((paginated: PaginatedResponse) => { + this.data = paginated.values.map((customer) => this.transformCustomer(customer)); + this.pageRequest.page = paginated.pageNum; + this.hasMore = paginated.hasMore; - return this.data; - }) - ); + return this.data; + }), + ); } loadMore(): Observable { - if (!this.hasMore) { return of(this.data); } + if (!this.hasMore) { + return of(this.data); + } this.pageRequest.page += 1; - return this.customerApi.getAllPaginated(this.pageRequest, 'OWNER,TENANT') - .pipe( - map((paginated: PaginatedResponse) => { - this.data = this.data.concat(paginated.values.map((customer) => this.transformCustomer(customer))); - this.pageRequest.page = paginated.pageNum; - this.hasMore = paginated.hasMore; + return this.customerApi.getAllPaginated(this.pageRequest, 'OWNER,TENANT').pipe( + map((paginated: PaginatedResponse) => { + this.data = this.data.concat(paginated.values.map((customer) => this.transformCustomer(customer))); + this.pageRequest.page = paginated.pageNum; + this.hasMore = paginated.hasMore; - return this.data; - }) - ); + return this.data; + }), + ); } private transformCustomer(customer: Customer): Customer { return { - id: customer.id, identifier: customer.identifier, enabled: customer.enabled, @@ -105,14 +106,12 @@ export class CustomerListService extends SearchService { readonly: customer.readonly, hasCustomGraphicIdentity: customer.hasCustomGraphicIdentity, themeColors: customer.themeColors, - gdprAlert : customer.gdprAlert, - gdprAlertDelay : customer.gdprAlertDelay, - + gdprAlert: customer.gdprAlert, + gdprAlertDelay: customer.gdprAlertDelay, }; } private filteredOwners(customer: Customer): Owner[] { return customer.owners; } - } diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-list/owner-list/owner-list.component.html b/ui/ui-frontend/projects/identity/src/app/customer/customer-list/owner-list/owner-list.component.html index d37375581b1..1dd083f3ab1 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-list/owner-list/owner-list.component.html +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-list/owner-list/owner-list.component.html @@ -1,45 +1,53 @@
      -
      -
      -
      {{'CUSTOMER.OWNER.CODE' | translate}}
      -
      {{'CUSTOMER.OWNER.NAME' | translate}}
      -
      {{'CUSTOMER.OWNER.SAFE_CODE' | translate}}
      -
      -
      +
      +
      +
      {{ 'CUSTOMER.OWNER.CODE' | translate }}
      +
      {{ 'CUSTOMER.OWNER.NAME' | translate }}
      +
      {{ 'CUSTOMER.OWNER.SAFE_CODE' | translate }}
      +
      +
      -
      -
      -
      -
      -
      -
      -
      {{ getOwner(tenant?.ownerId)?.code }}
      -
      {{ getOwner(tenant?.ownerId)?.name }}
      -
      {{ tenant?.identifier }}
      +
      +
      +
      +
      +
      +
      {{ getOwner(tenant?.ownerId)?.code }}
      +
      {{ getOwner(tenant?.ownerId)?.name }}
      +
      {{ tenant?.identifier }}
      +
      -
      -
      -
      - -
      -
      {{ owner?.code }}
      -
      {{ owner?.name }}
      -
      -
      - -
      +
      +
      +
      + +
      +
      {{ owner?.code }}
      +
      {{ owner?.name }}
      +
      +
      +
      +
      @@ -52,6 +60,6 @@ - + diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-list/owner-list/owner-list.component.scss b/ui/ui-frontend/projects/identity/src/app/customer/customer-list/owner-list/owner-list.component.scss index e077c05aa82..fe8bbc5f4f0 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-list/owner-list/owner-list.component.scss +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-list/owner-list/owner-list.component.scss @@ -1,4 +1,4 @@ :host { - display: block; - width: 100%; + display: block; + width: 100%; } diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-list/owner-list/owner-list.component.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-list/owner-list/owner-list.component.ts index ec602cf7b36..668962b09a9 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-list/owner-list/owner-list.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-list/owner-list/owner-list.component.ts @@ -49,15 +49,16 @@ import { TenantService } from '../../tenant.service'; @Component({ selector: 'app-owner-list', templateUrl: './owner-list.component.html', - styleUrls: ['./owner-list.component.scss'] + styleUrls: ['./owner-list.component.scss'], }) export class OwnerListComponent implements OnDestroy, OnInit { - @Input() set customer(customer: Customer) { this._customer = customer; } - get customer(): Customer { return this._customer; } + get customer(): Customer { + return this._customer; + } private _customer: Customer = null; @Output() ownerClick = new EventEmitter(); @@ -74,12 +75,12 @@ export class OwnerListComponent implements OnDestroy, OnInit { private ownerService: OwnerService, private tenantService: TenantService, private customerDataService: CustomerDataService, - ) { } + ) {} ngOnInit() { this.filteredData(this.customerDataService.tenants); - this.customerDataService.tenantsUpdated$.subscribe((tenants) => { + this.customerDataService.tenantsUpdated$.subscribe((tenants) => { this.filteredData(tenants); }); @@ -104,13 +105,15 @@ export class OwnerListComponent implements OnDestroy, OnInit { openCreateOwnerDialog() { const dialogRef = this.dialog.open(OwnerCreateComponent, { data: { - customer: this.customer + customer: this.customer, }, disableClose: true, - panelClass: 'vitamui-modal' + panelClass: 'vitamui-modal', }); - dialogRef.afterClosed().pipe(filter((result) => !!result)) - .subscribe((result: { owner?: Owner, tenant?: Tenant }) => { + dialogRef + .afterClosed() + .pipe(filter((result) => !!result)) + .subscribe((result: { owner?: Owner; tenant?: Tenant }) => { if (result.owner) { this.customer.owners = this.customer.owners.concat([result.owner]); this.filteredData(this.myTenants); @@ -123,9 +126,9 @@ export class OwnerListComponent implements OnDestroy, OnInit { filteredData(tenants: Tenant[]) { if (tenants) { - - this.myTenants = tenants.sort((a, b) => a.identifier - b.identifier) - .filter((tenant: Tenant) => tenant.customerId === this.customer.id); + this.myTenants = tenants + .sort((a, b) => a.identifier - b.identifier) + .filter((tenant: Tenant) => tenant.customerId === this.customer.id); const ownersIds: string[] = this.myTenants.map((tenant: Tenant) => tenant.ownerId); @@ -150,12 +153,13 @@ export class OwnerListComponent implements OnDestroy, OnInit { const dialogRef = this.dialog.open(TenantCreateComponent, { disableClose: true, data: { owner }, - panelClass: 'vitamui-modal' - }); - dialogRef.afterClosed().pipe(filter((result) => !!result)) - .subscribe((newTenant: Tenant) => { - this.customerDataService.addTenants([newTenant]); + panelClass: 'vitamui-modal', }); + dialogRef + .afterClosed() + .pipe(filter((result) => !!result)) + .subscribe((newTenant: Tenant) => { + this.customerDataService.addTenants([newTenant]); + }); } - } diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/customer-popup.component.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/customer-popup.component.ts index 930d966df4a..399d8cb8f16 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/customer-popup.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/customer-popup.component.ts @@ -41,21 +41,18 @@ import { Customer } from 'ui-frontend-common'; @Component({ selector: 'app-customer-popup', - template: '' + template: '', }) export class CustomerPopupComponent implements OnInit { - customer: Customer; constructor(private route: ActivatedRoute) { this.customer = this.route.snapshot.data.customer; } - ngOnInit() { - } + ngOnInit() {} closePopup() { window.close(); } - } diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/customer-preview.component.html b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/customer-preview.component.html index 9c5d9990850..3fb8cda8daf 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/customer-preview.component.html +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/customer-preview.component.html @@ -1,26 +1,39 @@ - + -
      - - - - +
      + + + + - - - + + + - - - + + + - - - + + + - - - - -
      + + + +
      +
      diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/customer-preview.component.scss b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/customer-preview.component.scss index 5eab20161a2..afb9dfaef88 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/customer-preview.component.scss +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/customer-preview.component.scss @@ -1,7 +1,7 @@ .no-padding { - padding: 0; + padding: 0; } .pointer { - cursor: pointer; + cursor: pointer; } diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/customer-preview.component.spec.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/customer-preview.component.spec.ts index d47b58616d6..6a5dcb6d080 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/customer-preview.component.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/customer-preview.component.spec.ts @@ -79,12 +79,14 @@ describe('CustomerPreviewComponent', () => { let testhost: TestHostComponent; let fixture: ComponentFixture; - beforeEach(waitForAsync((() => { + beforeEach(waitForAsync(() => { const customerServiceSpy = { - updated: new Subject() + updated: new Subject(), + }; + const startupServiceStub = { + getPortalUrl: () => 'https://dev.vitamui.com', + getConfigStringValue: () => 'https://dev.vitamui.com/identity', }; - const startupServiceStub = { getPortalUrl: () => 'https://dev.vitamui.com', - getConfigStringValue: () => 'https://dev.vitamui.com/identity' }; TestBed.configureTestingModule({ imports: [ MatMenuModule, @@ -93,7 +95,7 @@ describe('CustomerPreviewComponent', () => { ReactiveFormsModule, VitamUICommonTestModule, HttpClientTestingModule, - LoggerModule.forRoot() + LoggerModule.forRoot(), ], declarations: [ TestHostComponent, @@ -106,12 +108,11 @@ describe('CustomerPreviewComponent', () => { { provide: CustomerService, useValue: customerServiceSpy }, { provide: StartupService, useValue: startupServiceStub }, { provide: WINDOW_LOCATION, useValue: {} }, - { provide: ENVIRONMENT, useValue: environment } + { provide: ENVIRONMENT, useValue: environment }, ], - schemas: [NO_ERRORS_SCHEMA] - }) - .compileComponents(); - }))); + schemas: [NO_ERRORS_SCHEMA], + }).compileComponents(); + })); beforeEach(() => { fixture = TestBed.createComponent(TestHostComponent); @@ -131,9 +132,7 @@ describe('CustomerPreviewComponent', () => { expect(openSpy).toHaveBeenCalledWith( 'https://dev.vitamui.com/identity/customer/11', 'detailPopup', - 'width=584, height=713, resizable=no, location=no' + 'width=584, height=713, resizable=no, location=no', ); }); - }); - diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/customer-preview.component.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/customer-preview.component.ts index b2edac0cec2..2d1347c9012 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/customer-preview.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/customer-preview.component.ts @@ -43,31 +43,34 @@ import { CustomerService } from '../../core/customer.service'; @Component({ selector: 'app-customer-preview', templateUrl: './customer-preview.component.html', - styleUrls: ['./customer-preview.component.scss'] + styleUrls: ['./customer-preview.component.scss'], }) export class CustomerPreviewComponent implements OnInit, OnDestroy { - @Input() customer: Customer; @Input() isPopup: boolean; @Output() previewClose = new EventEmitter(); @Input() gdprReadOnlyStatus: boolean; - customerUpdatedSub: Subscription; - constructor(private customerService: CustomerService, private startupService: StartupService) {} + constructor( + private customerService: CustomerService, + private startupService: StartupService, + ) {} ngOnInit() { this.customerUpdatedSub = this.customerService.updated.subscribe((updatedCustomer: Customer) => { this.customer = updatedCustomer; }); - } openPopup() { - window.open(this.startupService.getConfigStringValue('UI_URL') - + '/customer/' + this.customer.id, 'detailPopup', 'width=584, height=713, resizable=no, location=no'); + window.open( + this.startupService.getConfigStringValue('UI_URL') + '/customer/' + this.customer.id, + 'detailPopup', + 'width=584, height=713, resizable=no, location=no', + ); this.emitClose(); } @@ -80,11 +83,9 @@ export class CustomerPreviewComponent implements OnInit, OnDestroy { } filterEvents(event: any): boolean { - - return event.outDetail && ( - event.outDetail.includes('EXT_VITAMUI_UPDATE_CUSTOMER') || - event.outDetail.includes('EXT_VITAMUI_CREATE_CUSTOMER') + return ( + event.outDetail && + (event.outDetail.includes('EXT_VITAMUI_UPDATE_CUSTOMER') || event.outDetail.includes('EXT_VITAMUI_CREATE_CUSTOMER')) ); } - } diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/customer-preview.module.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/customer-preview.module.ts index c52f144a218..ea59b2d9b81 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/customer-preview.module.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/customer-preview.module.ts @@ -49,7 +49,7 @@ import { RouterModule } from '@angular/router'; import { VitamUICommonModule } from 'ui-frontend-common'; import { SharedModule } from '../../shared/shared.module'; -import {CustomerColorsInputModule} from '../customer-create/customer-colors-input/customer-colors-input.module'; +import { CustomerColorsInputModule } from '../customer-create/customer-colors-input/customer-colors-input.module'; import { CustomerPreviewComponent } from './customer-preview.component'; import { GraphicIdentityTabComponent } from './graphic-identity-tab/graphic-identity-tab.component'; import { GraphicIdentityUpdateComponent } from './graphic-identity-tab/graphic-identity-update/graphic-identity-update.component'; @@ -84,7 +84,7 @@ import { CustomParamsModule } from '../../shared/custom-params/custom-params.mod MatTooltipModule, MatProgressSpinnerModule, VitamUICommonModule, - CustomParamsModule + CustomParamsModule, ], declarations: [ CustomerPreviewComponent, @@ -99,10 +99,10 @@ import { CustomParamsModule } from '../../shared/custom-params/custom-params.mod HomepageMessageTabComponent, HomepageMessageUpdateComponent, HomepageMessageComponent, - HomepageMessageTranslationComponent + HomepageMessageTranslationComponent, ], - exports: [ CustomerPreviewComponent, GraphicIdentityComponent, HomepageMessageComponent, HomepageMessageTranslationComponent], + exports: [CustomerPreviewComponent, GraphicIdentityComponent, HomepageMessageComponent, HomepageMessageTranslationComponent], entryComponents: [IdentityProviderCreateComponent, GraphicIdentityUpdateComponent, HomepageMessageUpdateComponent], - providers: [IdentityProviderService] + providers: [IdentityProviderService], }) -export class CustomerPreviewModule { } +export class CustomerPreviewModule {} diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/graphic-identity-tab.component.html b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/graphic-identity-tab.component.html index 7c78560e1f0..74e168e9e1b 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/graphic-identity-tab.component.html +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/graphic-identity-tab.component.html @@ -2,61 +2,65 @@
      - -
      {{ 'CUSTOMER.GRAPHIC_IDENTITY.LOGO_PORTAL_TITLE' | translate }} +
      - +
      - +
      - -
      {{ 'CUSTOMER.GRAPHIC_IDENTITY.LOGO_HEADER_TITLE' | translate }} +
      - +
      - -
      {{ 'CUSTOMER.GRAPHIC_IDENTITY.LOGO_FOOTER_TITLE' | translate }} +
      - +
      - - {{theme.colors[colorName]}} + + {{ theme.colors[colorName] }}
      - + [style.background-color]="theme.colors[colorName + light] | safeStyle" + >
      - +
      - - {{theme.colors[THEME_COLORS.VITAMUI_TERTIARY]}} + + {{ theme.colors[THEME_COLORS.VITAMUI_TERTIARY] }}
      @@ -65,8 +69,8 @@
      - - {{theme.colors[THEME_COLORS.VITAMUI_HEADER_FOOTER]}} + + {{ theme.colors[THEME_COLORS.VITAMUI_HEADER_FOOTER] }}
      @@ -75,8 +79,8 @@
      - - {{theme.colors[THEME_COLORS.VITAMUI_BACKGROUND]}} + + {{ theme.colors[THEME_COLORS.VITAMUI_BACKGROUND] }}
      diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/graphic-identity-tab.component.scss b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/graphic-identity-tab.component.scss index d5c065e775f..851f580c7f0 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/graphic-identity-tab.component.scss +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/graphic-identity-tab.component.scss @@ -1,14 +1,12 @@ @import '~ui-frontend-common/sass/variables/colors'; :host { - .label-color { display: flex; flex-direction: column; } - - label+* { + label + * { text-overflow: ellipsis; white-space: nowrap; overflow: hidden; @@ -24,4 +22,4 @@ position: relative; top: 10px; } -} \ No newline at end of file +} diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/graphic-identity-tab.component.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/graphic-identity-tab.component.ts index e6cb106b477..757cec64f2c 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/graphic-identity-tab.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/graphic-identity-tab.component.ts @@ -34,7 +34,7 @@ * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ -import {Component, Input, OnDestroy, OnInit} from '@angular/core'; +import { Component, Input, OnDestroy, OnInit } from '@angular/core'; import { MatDialog } from '@angular/material/dialog'; import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; @@ -46,23 +46,26 @@ import { LogosSafeResourceUrl } from './logos-safe-resource-url.interface'; @Component({ selector: 'app-graphic-identity-tab', templateUrl: './graphic-identity-tab.component.html', - styleUrls: ['./graphic-identity-tab.component.scss'] + styleUrls: ['./graphic-identity-tab.component.scss'], }) export class GraphicIdentityTabComponent implements OnInit, OnDestroy { - @Input() set customer(customer: Customer) { this._customer = customer; this.resetTab(this.customer); } - get customer(): Customer { return this._customer; } + get customer(): Customer { + return this._customer; + } private _customer: Customer; @Input() set readOnly(readOnly: boolean) { this._readonly = readOnly; } - get readonly(): boolean { return this._readonly; } + get readonly(): boolean { + return this._readonly; + } private _readonly: boolean; private destroy = new Subject(); @@ -70,12 +73,14 @@ export class GraphicIdentityTabComponent implements OnInit, OnDestroy { public customerLogos: LogosSafeResourceUrl = {}; public theme: Theme; - public COLOR_NAME: {[colorId: string]: string}; + public COLOR_NAME: { [colorId: string]: string }; public THEME_COLORS = ThemeColorType; - constructor(private customerService: CustomerService, private dialog: MatDialog, - private themeService: ThemeService) { - } + constructor( + private customerService: CustomerService, + private dialog: MatDialog, + private themeService: ThemeService, + ) {} ngOnDestroy(): void { this.destroy.next(); } @@ -84,21 +89,18 @@ export class GraphicIdentityTabComponent implements OnInit, OnDestroy { this.COLOR_NAME = this.themeService.getBaseColors(); } - private majTheme(colors: {[colorId: string]: string}): Theme { + private majTheme(colors: { [colorId: string]: string }): Theme { return { colors, }; } private resetTab(customer: Customer): void { - if (customer.hasCustomGraphicIdentity) { const colors = this.themeService.getThemeColors(customer.themeColors); this.theme = this.majTheme(colors); } else { - this.theme = this.majTheme( - this.themeService.getThemeColors(this.themeService.defaultTheme.colors) - ); + this.theme = this.majTheme(this.themeService.getThemeColors(this.themeService.defaultTheme.colors)); this.theme.headerUrl = this.themeService.defaultTheme.headerUrl; this.theme.portalUrl = this.themeService.defaultTheme.portalUrl; this.theme.footerUrl = this.themeService.defaultTheme.footerUrl; @@ -106,21 +108,22 @@ export class GraphicIdentityTabComponent implements OnInit, OnDestroy { if (customer.hasCustomGraphicIdentity) { this.isLoading = true; } - this.customerService.getLogos(customer.id) - .pipe(takeUntil(this.destroy)) - .subscribe((logos: LogosSafeResourceUrl[]) => { - this.customerLogos = { - headerUrl: logos[0], - footerUrl: logos[1], - portalUrl: logos[2], - }; - if (customer.hasCustomGraphicIdentity) { - this.theme.headerUrl = this.customerLogos.headerUrl; - this.theme.footerUrl = this.customerLogos.footerUrl; - this.theme.portalUrl = this.customerLogos.portalUrl; - } - this.isLoading = false; - }); + this.customerService + .getLogos(customer.id) + .pipe(takeUntil(this.destroy)) + .subscribe((logos: LogosSafeResourceUrl[]) => { + this.customerLogos = { + headerUrl: logos[0], + footerUrl: logos[1], + portalUrl: logos[2], + }; + if (customer.hasCustomGraphicIdentity) { + this.theme.headerUrl = this.customerLogos.headerUrl; + this.theme.footerUrl = this.customerLogos.footerUrl; + this.theme.portalUrl = this.customerLogos.portalUrl; + } + this.isLoading = false; + }); this.themeService.overloadLocalTheme(this.theme.colors, 'div.vitamui-sidepanel'); } @@ -128,7 +131,7 @@ export class GraphicIdentityTabComponent implements OnInit, OnDestroy { const dialogRef = this.dialog.open(GraphicIdentityUpdateComponent, { panelClass: 'vitamui-modal', disableClose: true, - data: { customer: this.customer, logos: this.customerLogos } + data: { customer: this.customer, logos: this.customerLogos }, }); dialogRef.afterClosed().subscribe(); } diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/graphic-identity-update/graphic-identity-update.component.html b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/graphic-identity-update/graphic-identity-update.component.html index f9e76cb709a..3daeb264fe7 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/graphic-identity-update/graphic-identity-update.component.html +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/graphic-identity-update/graphic-identity-update.component.html @@ -1,10 +1,14 @@
      - +
      - - + +
      -
      \ No newline at end of file +
      diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/graphic-identity-update/graphic-identity-update.component.scss b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/graphic-identity-update/graphic-identity-update.component.scss index ca7953929d1..fe9a5ec77d9 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/graphic-identity-update/graphic-identity-update.component.scss +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/graphic-identity-update/graphic-identity-update.component.scss @@ -1,5 +1,5 @@ :host { - .content { - padding: 30px 60px 60px 60px; - } -} \ No newline at end of file + .content { + padding: 30px 60px 60px 60px; + } +} diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/graphic-identity-update/graphic-identity-update.component.spec.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/graphic-identity-update/graphic-identity-update.component.spec.ts index 074d8c9c646..324ec7c3312 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/graphic-identity-update/graphic-identity-update.component.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/graphic-identity-update/graphic-identity-update.component.spec.ts @@ -117,23 +117,21 @@ describe('GraphicIdentityUpdateComponent', () => { let component: GraphicIdentityUpdateComponent; let fixture: ComponentFixture; - beforeEach( - waitForAsync(() => { - const matDialogRefSpy = jasmine.createSpyObj('MatDialogRef', ['close']); - const snackBarSpy = jasmine.createSpyObj('VitamUISnackBarService', ['open']); - TestBed.configureTestingModule({ - imports: [ReactiveFormsModule, HttpClientTestingModule, VitamUICommonTestModule, InjectorModule, LoggerModule.forRoot()], - declarations: [CustomerColorsInputStubComponent, GraphicIdentityUpdateComponent], - providers: [ - { provide: MatDialogRef, useValue: matDialogRefSpy }, - { provide: MAT_DIALOG_DATA, useValue: { customer: expectedCustomer, logo: null } }, - { provide: BASE_URL, useValue: '/fake-api' }, - { provide: VitamUISnackBarService, useValue: snackBarSpy }, - { provide: ENVIRONMENT, useValue: environment }, - ], - }).compileComponents(); - }) - ); + beforeEach(waitForAsync(() => { + const matDialogRefSpy = jasmine.createSpyObj('MatDialogRef', ['close']); + const snackBarSpy = jasmine.createSpyObj('VitamUISnackBarService', ['open']); + TestBed.configureTestingModule({ + imports: [ReactiveFormsModule, HttpClientTestingModule, VitamUICommonTestModule, InjectorModule, LoggerModule.forRoot()], + declarations: [CustomerColorsInputStubComponent, GraphicIdentityUpdateComponent], + providers: [ + { provide: MatDialogRef, useValue: matDialogRefSpy }, + { provide: MAT_DIALOG_DATA, useValue: { customer: expectedCustomer, logo: null } }, + { provide: BASE_URL, useValue: '/fake-api' }, + { provide: VitamUISnackBarService, useValue: snackBarSpy }, + { provide: ENVIRONMENT, useValue: environment }, + ], + }).compileComponents(); + })); beforeEach(() => { fixture = TestBed.createComponent(GraphicIdentityUpdateComponent); diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/graphic-identity-update/graphic-identity-update.component.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/graphic-identity-update/graphic-identity-update.component.ts index 20ad071505e..95518c14d3b 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/graphic-identity-update/graphic-identity-update.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/graphic-identity-update/graphic-identity-update.component.ts @@ -46,13 +46,14 @@ import { LogosSafeResourceUrl } from './../logos-safe-resource-url.interface'; @Component({ selector: 'app-graphic-identity-update', templateUrl: './graphic-identity-update.component.html', - styleUrls: ['./graphic-identity-update.component.scss'] + styleUrls: ['./graphic-identity-update.component.scss'], }) export class GraphicIdentityUpdateComponent implements OnInit, OnDestroy { - private destroy = new Subject(); private _customForm: FormGroup; - public get customForm(): FormGroup { return this._customForm; } + public get customForm(): FormGroup { + return this._customForm; + } public set customForm(form: FormGroup) { this._customForm = form; this.disabled = !(this._customForm && this._customForm.valid); @@ -65,7 +66,7 @@ export class GraphicIdentityUpdateComponent implements OnInit, OnDestroy { constructor( public dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) public data: { customer: Customer, logos: LogosSafeResourceUrl }, + @Inject(MAT_DIALOG_DATA) public data: { customer: Customer; logos: LogosSafeResourceUrl }, private customerService: CustomerService, ) {} @@ -82,18 +83,19 @@ export class GraphicIdentityUpdateComponent implements OnInit, OnDestroy { } public updateGraphicIdentity(): void { - if (this.customForm.valid) { - this.customerService.patch(this.customForm.value, this.logos) - .pipe(takeUntil(this.destroy)) - .subscribe( - () => { - this.dialogRef.close(true); - }, - (error) => { - this.dialogRef.close(false); - console.error(error); - }); + this.customerService + .patch(this.customForm.value, this.logos) + .pipe(takeUntil(this.destroy)) + .subscribe( + () => { + this.dialogRef.close(true); + }, + (error) => { + this.dialogRef.close(false); + console.error(error); + }, + ); } } } diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/graphic-identity/graphic-identity-form/graphic-identity-form.component.scss b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/graphic-identity/graphic-identity-form/graphic-identity-form.component.scss index 768b4d78ddd..a7a5290131a 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/graphic-identity/graphic-identity-form/graphic-identity-form.component.scss +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/graphic-identity/graphic-identity-form/graphic-identity-form.component.scss @@ -5,15 +5,15 @@ margin-top: 0; } - ::ng-deep .color-header-footer > * > .drag-and-drop-area { + ::ng-deep .color-header-footer > * > .drag-and-drop-area { background-color: var(--vitamui-header-footer); } - ::ng-deep .color-background > * > .drag-and-drop-area { + ::ng-deep .color-background > * > .drag-and-drop-area { background-color: var(--vitamui-background); } - ::ng-deep .image-area-big > * > .drag-and-drop-area > .image-area { + ::ng-deep .image-area-big > * > .drag-and-drop-area > .image-area { height: 230px; width: 410px; max-width: 100%; @@ -24,7 +24,7 @@ } } - ::ng-deep .image-area-small > * > .drag-and-drop-area > .image-area { + ::ng-deep .image-area-small > * > .drag-and-drop-area > .image-area { width: 200px; } @@ -32,51 +32,51 @@ margin-top: 40px; margin-bottom: 20px; } - + .container-color { - min-width: 295px; + min-width: 295px; } - + .cancel { - margin-left: 10px; + margin-left: 10px; } span { - font-weight: bold; + font-weight: bold; } vitamui-common-input { - width: 47%; + width: 47%; } vitamui-common-textarea + small { - text-align: end; - color: var(--vitamui-grey-900); + text-align: end; + color: var(--vitamui-grey-900); } .form-group { margin-top: 40px; margin-bottom: 20px; } - + .container-color { - margin-right: 80px; + margin-right: 80px; } - + .cancel { - margin-left: 10px; + margin-left: 10px; } span { - font-weight: bold; + font-weight: bold; } vitamui-common-input { - width: 47%; + width: 47%; } vitamui-common-textarea + small { - text-align: end; - color: var(--vitamui-grey-900); + text-align: end; + color: var(--vitamui-grey-900); } -} \ No newline at end of file +} diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/graphic-identity/graphic-identity.component.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/graphic-identity/graphic-identity.component.ts index 6f6544ecf60..e6d1ee170ef 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/graphic-identity/graphic-identity.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/graphic-identity/graphic-identity.component.ts @@ -78,7 +78,7 @@ export class GraphicIdentityComponent implements OnInit, OnDestroy { constructor( public dialogRef: MatDialogRef, private formBuilder: FormBuilder, - private themeService: ThemeService + private themeService: ThemeService, ) {} ngOnDestroy(): void { diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/logos-safe-resource-url.interface.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/logos-safe-resource-url.interface.ts index 9afe9f53004..aacf753a995 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/logos-safe-resource-url.interface.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/logos-safe-resource-url.interface.ts @@ -1,7 +1,7 @@ import { SafeResourceUrl } from '@angular/platform-browser'; export interface LogosSafeResourceUrl { - headerUrl?: SafeResourceUrl; - footerUrl?: SafeResourceUrl; - portalUrl?: SafeResourceUrl; - } + headerUrl?: SafeResourceUrl; + footerUrl?: SafeResourceUrl; + portalUrl?: SafeResourceUrl; +} diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/homepage-message-tab/homepage-message-tab.component.html b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/homepage-message-tab/homepage-message-tab.component.html index 5ec735e574b..44dc19dda95 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/homepage-message-tab/homepage-message-tab.component.html +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/homepage-message-tab/homepage-message-tab.component.html @@ -1,31 +1,34 @@
      - +
      - - {{portalTitle}} + + {{ portalTitle }}
      - - {{portalMessage}} + + {{ portalMessage }}
      -
      +
      -
      - - {{item.value}} -
      -
      - - {{portalMessages[item.key]}} -
      +
      + + {{ item.value }} +
      +
      + + {{ portalMessages[item.key] }} +
      - diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/homepage-message-tab/homepage-message-tab.component.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/homepage-message-tab/homepage-message-tab.component.ts index 8233aa01c4c..d6a3ae018fe 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/homepage-message-tab/homepage-message-tab.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/homepage-message-tab/homepage-message-tab.component.ts @@ -50,9 +50,8 @@ export class HomepageMessageTabComponent implements OnInit, OnDestroy { private dialog: MatDialog, private startupService: StartupService, private authService: AuthService, - private userInfoService: UserInfoService - ) { - } + private userInfoService: UserInfoService, + ) {} ngOnDestroy(): void { this.destroy.next(); @@ -66,8 +65,8 @@ export class HomepageMessageTabComponent implements OnInit, OnDestroy { } private resetTab(customer: Customer): void { - const title = this.startupService.getConfigStringValue('PORTAL_MESSAGE') - const message = this.startupService.getConfigStringValue('PORTAL_TITLE') + const title = this.startupService.getConfigStringValue('PORTAL_MESSAGE'); + const message = this.startupService.getConfigStringValue('PORTAL_TITLE'); if (customer) { if (customer.language) { @@ -81,8 +80,8 @@ export class HomepageMessageTabComponent implements OnInit, OnDestroy { } } - this.portalTitle = (this.portalTitles && this.portalTitles[this.language]) ? (this.portalTitles[this.language]) : title; - this.portalMessage = (this.portalMessages && this.portalMessages[this.language]) ? this.portalMessages[this.language] : message; + this.portalTitle = this.portalTitles && this.portalTitles[this.language] ? this.portalTitles[this.language] : title; + this.portalMessage = this.portalMessages && this.portalMessages[this.language] ? this.portalMessages[this.language] : message; } openUpdateHomepageMessage() { diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/homepage-message-tab/homepage-message-update/homepage-message-update.component.html b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/homepage-message-tab/homepage-message-update/homepage-message-update.component.html index 4a06434a0df..40d6fcd0d49 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/homepage-message-tab/homepage-message-update/homepage-message-update.component.html +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/homepage-message-tab/homepage-message-update/homepage-message-update.component.html @@ -1,15 +1,16 @@
      - - + -
      - - -
      -
      \ No newline at end of file +
      + + +
      +
      diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/homepage-message-tab/homepage-message-update/homepage-message-update.component.scss b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/homepage-message-tab/homepage-message-update/homepage-message-update.component.scss index ca7953929d1..fe9a5ec77d9 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/homepage-message-tab/homepage-message-update/homepage-message-update.component.scss +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/homepage-message-tab/homepage-message-update/homepage-message-update.component.scss @@ -1,5 +1,5 @@ :host { - .content { - padding: 30px 60px 60px 60px; - } -} \ No newline at end of file + .content { + padding: 30px 60px 60px 60px; + } +} diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/homepage-message-tab/homepage-message-update/homepage-message-update.component.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/homepage-message-tab/homepage-message-update/homepage-message-update.component.ts index 16b215e96b3..b57aa98d4a5 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/homepage-message-tab/homepage-message-update/homepage-message-update.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/homepage-message-tab/homepage-message-update/homepage-message-update.component.ts @@ -9,16 +9,16 @@ import { CustomerService } from '../../../../core/customer.service'; @Component({ selector: 'app-homepage-message-update', templateUrl: './homepage-message-update.component.html', - styleUrls: ['./homepage-message-update.component.scss'] + styleUrls: ['./homepage-message-update.component.scss'], }) - export class HomepageMessageUpdateComponent implements OnInit, OnDestroy { - private destroy = new Subject(); // tslint:disable-next-line: variable-name private _customForm: FormGroup; - public get customForm(): FormGroup { return this._customForm; } + public get customForm(): FormGroup { + return this._customForm; + } public set customForm(form: FormGroup) { this._customForm = form; this.disabled = !(this._customForm && this._customForm.valid && this.checkValidation(this._customForm.value.translations)); @@ -38,14 +38,13 @@ export class HomepageMessageUpdateComponent implements OnInit, OnDestroy { public dialogRef: MatDialogRef, @Inject(MAT_DIALOG_DATA) public data: { customer: Customer }, private customerService: CustomerService, - private confirmDialogService: ConfirmDialogService + private confirmDialogService: ConfirmDialogService, ) {} ngOnDestroy(): void { this.destroy.next(); } - ngOnInit() { - } + ngOnInit() {} onCancel() { if (this.customForm.dirty) { @@ -57,28 +56,36 @@ export class HomepageMessageUpdateComponent implements OnInit, OnDestroy { private checkValidation(forms: FormGroup[]): boolean { let isValid = true; - forms.forEach(((x) => {if (!x.valid) { isValid = false; }})); + forms.forEach((x) => { + if (!x.valid) { + isValid = false; + } + }); return isValid; } public updateHomepageMessage(): void { if (this.customForm.valid && this.checkValidation(this.customForm.value.translations)) { - const form = {...{ - id : this.customForm.get('id').value, - portalTitles: this.portalTitles, - portalMessages: this.portalMessages - }}; - - this.customerService.patch(form) - .pipe(takeUntil(this.destroy)) - .subscribe( - () => { - this.dialogRef.close(true); + const form = { + ...{ + id: this.customForm.get('id').value, + portalTitles: this.portalTitles, + portalMessages: this.portalMessages, }, - (error: any) => { - this.dialogRef.close(false); - console.error(error); - }); + }; + + this.customerService + .patch(form) + .pipe(takeUntil(this.destroy)) + .subscribe( + () => { + this.dialogRef.close(true); + }, + (error: any) => { + this.dialogRef.close(false); + console.error(error); + }, + ); } } } diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/homepage-message-tab/homepage-message/homepage-message-translation/homepage-message-translation.html b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/homepage-message-tab/homepage-message/homepage-message-translation/homepage-message-translation.html index 365ae810e31..80d4488c882 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/homepage-message-tab/homepage-message/homepage-message-translation/homepage-message-translation.html +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/homepage-message-tab/homepage-message/homepage-message-translation/homepage-message-translation.html @@ -1,57 +1,73 @@ -
      - + + + + {{ 'COMMON.LANGUAGE.'+option.key | translate}} + +
      + keyboard_arrow_up + keyboard_arrow_down +
      +
      - - - - {{ 'COMMON.LANGUAGE.'+option.key | translate}} - - -
      - keyboard_arrow_up - keyboard_arrow_down -
      -
      - + +
      - -
      - -
      - - + + - {{ 'COMMON.ERROR.REQUIRED' | translate }} - + " + > + {{ 'COMMON.ERROR.REQUIRED' | translate }} + - - + - {{ 'COMMON.ERROR.REQUIRED' | translate }} - - {{ form.get("portalMessage")?.value?.length }} {{ - "CUSTOMER.HOMEPAGE_MESSAGE.PORTAL_MESSAGE_LENGTH" | translate }} -
      - \ No newline at end of file + " + > + {{ 'COMMON.ERROR.REQUIRED' | translate }} + + {{ form.get("portalMessage")?.value?.length }} {{ "CUSTOMER.HOMEPAGE_MESSAGE.PORTAL_MESSAGE_LENGTH" | translate }} +
      + diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/homepage-message-tab/homepage-message/homepage-message-translation/homepage-message-translation.scss b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/homepage-message-tab/homepage-message/homepage-message-translation/homepage-message-translation.scss index 4ab54a4f82c..22e0c81cd1e 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/homepage-message-tab/homepage-message/homepage-message-translation/homepage-message-translation.scss +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/homepage-message-tab/homepage-message/homepage-message-translation/homepage-message-translation.scss @@ -1,3 +1,3 @@ .vitamui-input { - width: 100% !important; -} \ No newline at end of file + width: 100% !important; +} diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/homepage-message-tab/homepage-message/homepage-message-translation/homepage-message-translation.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/homepage-message-tab/homepage-message/homepage-message-translation/homepage-message-translation.ts index 97ba4a028f2..e6cabe6648b 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/homepage-message-tab/homepage-message/homepage-message-translation/homepage-message-translation.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/homepage-message-tab/homepage-message/homepage-message-translation/homepage-message-translation.ts @@ -1,48 +1,46 @@ - import { Component, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core'; import { FormGroup } from '@angular/forms'; import { Subscription } from 'rxjs'; import { Option } from 'ui-frontend-common'; @Component({ - selector: 'app-homepage-message-translation', - templateUrl: './homepage-message-translation.html', - styleUrls: ['./homepage-message-translation.scss'] + selector: 'app-homepage-message-translation', + templateUrl: './homepage-message-translation.html', + styleUrls: ['./homepage-message-translation.scss'], }) export class HomepageMessageTranslationComponent implements OnInit, OnDestroy { + @Input() + public form: FormGroup; - @Input() - public form: FormGroup; - - @Input() - public index: number; + @Input() + public index: number; - @Input() - public languages: Option[]; + @Input() + public languages: Option[]; - @Output() - public formChange = new EventEmitter<{form: FormGroup}>(); + @Output() + public formChange = new EventEmitter<{ form: FormGroup }>(); - @Output() - public formRemove = new EventEmitter<{form: FormGroup}>(); + @Output() + public formRemove = new EventEmitter<{ form: FormGroup }>(); - private subscription: Subscription; + private subscription: Subscription; - constructor() { } + constructor() {} - ngOnInit() { - this.subscription = this.form.valueChanges.subscribe(() => { - this.formChange.emit({form: this.form}); - }); - } + ngOnInit() { + this.subscription = this.form.valueChanges.subscribe(() => { + this.formChange.emit({ form: this.form }); + }); + } - ngOnDestroy() { - if (this.subscription) { - this.subscription.unsubscribe(); - } + ngOnDestroy() { + if (this.subscription) { + this.subscription.unsubscribe(); } + } - public onRemove(): void { - this.formRemove.emit({form: this.form}); - } + public onRemove(): void { + this.formRemove.emit({ form: this.form }); + } } diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/homepage-message-tab/homepage-message/homepage-message.component.html b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/homepage-message-tab/homepage-message/homepage-message.component.html index a54ecc60512..3857f14e10a 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/homepage-message-tab/homepage-message/homepage-message.component.html +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/homepage-message-tab/homepage-message/homepage-message.component.html @@ -2,41 +2,57 @@
      - {{ "CUSTOMER.HOMEPAGE_MESSAGE.TITLE" | translate }} + {{ 'CUSTOMER.HOMEPAGE_MESSAGE.TITLE' | translate }}
      - - - {{ 'COMMON.ERROR.REQUIRED' | translate }} + + + {{ 'COMMON.ERROR.REQUIRED' | translate }} - - - {{ 'COMMON.ERROR.REQUIRED' | translate }} + + + {{ 'COMMON.ERROR.REQUIRED' | translate }} - {{ homepageMessageForm.get("portalMessage")?.value?.length }} - {{ - "CUSTOMER.HOMEPAGE_MESSAGE.PORTAL_MESSAGE_LENGTH" | translate - }} - + {{ homepageMessageForm.get('portalMessage')?.value?.length }} + {{ 'CUSTOMER.HOMEPAGE_MESSAGE.PORTAL_MESSAGE_LENGTH' | translate }}
      - +
      - +
      -
      - \ No newline at end of file + diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/homepage-message-tab/homepage-message/homepage-message.component.scss b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/homepage-message-tab/homepage-message/homepage-message.component.scss index a7cc85ff390..fe9a5ec77d9 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/homepage-message-tab/homepage-message/homepage-message.component.scss +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/homepage-message-tab/homepage-message/homepage-message.component.scss @@ -1,5 +1,5 @@ :host { - .content { - padding: 30px 60px 60px 60px; - } + .content { + padding: 30px 60px 60px 60px; + } } diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/homepage-message-tab/homepage-message/homepage-message.component.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/homepage-message-tab/homepage-message/homepage-message.component.ts index 1871beb99b8..8716b7de705 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/homepage-message-tab/homepage-message/homepage-message.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/homepage-message-tab/homepage-message/homepage-message.component.ts @@ -1,12 +1,4 @@ -import { - AfterViewInit, - Component, - EventEmitter, - Input, - OnDestroy, - OnInit, - Output, -} from '@angular/core'; +import { AfterViewInit, Component, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { MatDialogRef } from '@angular/material/dialog'; import { Subject } from 'rxjs'; @@ -25,13 +17,13 @@ export class HomepageMessageComponent implements OnInit, OnDestroy, AfterViewIni @Output() public formToSend = new EventEmitter<{ - form: FormGroup, + form: FormGroup; portalTitles: { [language: string]: string; - }, + }; portalMessages: { [language: string]: string; - } + }; }>(); public languages: Option[]; @@ -39,8 +31,8 @@ export class HomepageMessageComponent implements OnInit, OnDestroy, AfterViewIni public customerForm: FormGroup; private language: string; - private portalTitles: { [language: string]: string; } = {}; - private portalMessages: { [language: string]: string; } = {}; + private portalTitles: { [language: string]: string } = {}; + private portalMessages: { [language: string]: string } = {}; private destroy = new Subject(); constructor( @@ -49,31 +41,34 @@ export class HomepageMessageComponent implements OnInit, OnDestroy, AfterViewIni private startupService: StartupService, private authService: AuthService, private languageService: LanguageService, - private userInfoService: UserInfoService - ) { } + private userInfoService: UserInfoService, + ) {} ngOnInit() { this.homepageMessageForm = this.formBuilder.group({ id: null, portalTitle: ['', [Validators.required]], portalMessage: ['', [Validators.required, Validators.maxLength(500)]], - translations: this.formBuilder.array([]) + translations: this.formBuilder.array([]), }); const userInfosId = this.authService.user.userInfoId; this.userInfoService.get(userInfosId).subscribe((userInfo) => { this.language = userInfo.language; - }); + }); } ngAfterViewInit() { - this.languageService.getAvailableLanguagesOptions().pipe(take(1)).subscribe((options: Option[]) => { - this.languages = options; - this.setMessages(); - this.formToSend.emit({ form: this.homepageMessageForm, portalTitles: this.portalTitles, portalMessages: this.portalMessages }); - this.homepageMessageForm.valueChanges.pipe(takeUntil(this.destroy)).subscribe(() => { - this.sendForm(); + this.languageService + .getAvailableLanguagesOptions() + .pipe(take(1)) + .subscribe((options: Option[]) => { + this.languages = options; + this.setMessages(); + this.formToSend.emit({ form: this.homepageMessageForm, portalTitles: this.portalTitles, portalMessages: this.portalMessages }); + this.homepageMessageForm.valueChanges.pipe(takeUntil(this.destroy)).subscribe(() => { + this.sendForm(); + }); }); - }); } ngOnDestroy(): void { @@ -102,14 +97,14 @@ export class HomepageMessageComponent implements OnInit, OnDestroy, AfterViewIni } } - const defaultTitle = (this.portalTitles && this.portalTitles[this.language]) ? (this.portalTitles[this.language]) : title; - const defaultMessage = (this.portalMessages && this.portalMessages[this.language]) ? this.portalMessages[this.language] : message; + const defaultTitle = this.portalTitles && this.portalTitles[this.language] ? this.portalTitles[this.language] : title; + const defaultMessage = this.portalMessages && this.portalMessages[this.language] ? this.portalMessages[this.language] : message; this.homepageMessageForm.get('id').patchValue(idCustomer); this.homepageMessageForm.get('portalTitle').patchValue(defaultTitle); this.homepageMessageForm.get('portalMessage').patchValue(defaultMessage); - this.languages.forEach(l => { + this.languages.forEach((l) => { if (this.portalTitles[l.key] && this.portalMessages[l.key] && this.language !== l.key) { const translation = this.formBuilder.group({ language: [l.key, Validators.required], @@ -155,14 +150,14 @@ export class HomepageMessageComponent implements OnInit, OnDestroy, AfterViewIni const forms = this.homepageMessageForm.get('translations').value; - forms.forEach(((form: FormGroup) => { + forms.forEach((form: FormGroup) => { const language = form.get('language').value; const title = form.get('portalTitle').value; const message = form.get('portalMessage').value; titles[language] = title; messages[language] = message; - })); + }); this.portalTitles = titles; this.portalMessages = messages; @@ -174,17 +169,19 @@ export class HomepageMessageComponent implements OnInit, OnDestroy, AfterViewIni const values = forms.map((x: FormGroup) => x.get('language').value); - return this.languages.filter(x => { - return (x.key !== this.language && values.indexOf(x.key) < 0); + return this.languages.filter((x) => { + return x.key !== this.language && values.indexOf(x.key) < 0; }); } public isLanguageSet(): boolean { const forms = this.homepageMessageForm.get('translations').value; let isValid = true; - forms.forEach(((f: FormGroup) => { - if (!f.get('language').valid) { isValid = false; } - })); + forms.forEach((f: FormGroup) => { + if (!f.get('language').valid) { + isValid = false; + } + }); return isValid; } } diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/information-tab/information-tab.component.html b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/information-tab/information-tab.component.html index 4de495ca268..7599933cb62 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/information-tab/information-tab.component.html +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/information-tab/information-tab.component.html @@ -7,17 +7,21 @@ [validator]="form?.get('code')?.validator" [asyncValidator]="form?.get('code')?.asyncValidator" > - {{'COMMON.ERROR.REQUIRED' | translate}} - {{'COMMON.ERROR.WRONG_FORMAT' | translate}} - {{ 'COMMON.ERROR.STRING_MAX_LENGTH' | translate: { max: customerCodeMaxLength } }} - {{'CUSTOMER.INFORMATIONS.CODE_ALREADY_EXIST' | translate}} + {{ 'COMMON.ERROR.REQUIRED' | translate }} + {{ 'COMMON.ERROR.WRONG_FORMAT' | translate }} + {{ + 'COMMON.ERROR.STRING_MAX_LENGTH' | translate: { max: customerCodeMaxLength } + }} + {{ + 'CUSTOMER.INFORMATIONS.CODE_ALREADY_EXIST' | translate + }}
      @@ -34,8 +38,7 @@ [validator]="form?.get('name')?.validator" [asyncValidator]="form?.get('name')?.asyncValidator" > - {{'COMMON.ERROR.REQUIRED' | translate}} - + {{ 'COMMON.ERROR.REQUIRED' | translate }}
      @@ -46,8 +49,7 @@ [validator]="form?.get('companyName')?.validator" [asyncValidator]="form?.get('companyName')?.asyncValidator" > - {{'COMMON.ERROR.REQUIRED' | translate}} - + {{ 'COMMON.ERROR.REQUIRED' | translate }}
      @@ -57,13 +59,12 @@
      - {{'COMMON.ERROR.REQUIRED' | translate}} - + {{ 'COMMON.ERROR.REQUIRED' | translate }}
      @@ -77,8 +78,7 @@ [validator]="form?.get('address.zipCode')?.validator" [asyncValidator]="form?.get('address.zipCode')?.asyncValidator" > - {{'COMMON.ERROR.REQUIRED' | translate}} - + {{ 'COMMON.ERROR.REQUIRED' | translate }}
      @@ -89,8 +89,7 @@ [validator]="form?.get('address.city')?.validator" [asyncValidator]="form?.get('address.city')?.asyncValidator" > - {{'COMMON.ERROR.REQUIRED' | translate}} - + {{ 'COMMON.ERROR.REQUIRED' | translate }}
      @@ -101,7 +100,8 @@ formControlName="country" [label]="'COMMON.ADRESS.COUNTRY' | translate" [validator]="form?.get('address.country')?.validator" - [asyncValidator]="form?.get('address.country')?.asyncValidator"> + [asyncValidator]="form?.get('address.country')?.asyncValidator" + > @@ -141,10 +141,22 @@ [validator]="form?.get('passwordRevocationDelay')?.validator" [asyncValidator]="form?.get('passwordRevocationDelay')?.asyncValidator" > - - - - + + + +
      @@ -157,9 +169,18 @@ [validator]="form?.get('otp')?.validator" [asyncValidator]="form?.get('otp')?.asyncValidator" > - - - + + +
      @@ -177,43 +198,37 @@
      -
      - + Alerte sur les utilisateurs inactifs -
      - - - Champ - obligatoire et il faut une valeur supérieure à 0 + Champ obligatoire et il faut une valeur supérieure à 0 - Format - incorrecte + Format incorrecte - Il - faut une valeur supérieure à 0 + Il faut une valeur supérieure à 0 -
      - - - diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/information-tab/information-tab.component.spec.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/information-tab/information-tab.component.spec.ts index b8cdce53ad6..a7b6f3109b5 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/information-tab/information-tab.component.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/information-tab/information-tab.component.spec.ts @@ -133,57 +133,55 @@ describe('Customer InformationTabComponent', () => { let testhost: TestHostComponent; let fixture: ComponentFixture; - beforeEach( - waitForAsync(() => { - expectedCustomer = { - id: '11', - identifier: '11', - code: '011000', - name: 'Kouygues Telecom', - companyName: 'Kouygues Telecom', - enabled: true, - readonly: false, - hasCustomGraphicIdentity: false, - language: 'FRENCH', - passwordRevocationDelay: 1, - otp: OtpState.OPTIONAL, - idp: false, - emailDomains: ['kouygues.com'], - defaultEmailDomain: 'kouygues.com', - address: { - street: '13 rue faubourg', - zipCode: '75009', - city: 'paris', - country: 'france', - }, - internalCode: '1', - owners: [], - themeColors: {}, - portalMessages: {}, - portalTitles: {}, - gdprAlert: false, - gdprAlertDelay: 72, - }; - const customerServiceSpy = jasmine.createSpyObj('CustomerService', { patch: of({}) }); - const customerCreateValidatorsSpy = jasmine.createSpyObj('CustomerCreateValidators', { - uniqueCode: () => of(null), - uniqueDomain: () => of(null), - }); + beforeEach(waitForAsync(() => { + expectedCustomer = { + id: '11', + identifier: '11', + code: '011000', + name: 'Kouygues Telecom', + companyName: 'Kouygues Telecom', + enabled: true, + readonly: false, + hasCustomGraphicIdentity: false, + language: 'FRENCH', + passwordRevocationDelay: 1, + otp: OtpState.OPTIONAL, + idp: false, + emailDomains: ['kouygues.com'], + defaultEmailDomain: 'kouygues.com', + address: { + street: '13 rue faubourg', + zipCode: '75009', + city: 'paris', + country: 'france', + }, + internalCode: '1', + owners: [], + themeColors: {}, + portalMessages: {}, + portalTitles: {}, + gdprAlert: false, + gdprAlertDelay: 72, + }; + const customerServiceSpy = jasmine.createSpyObj('CustomerService', { patch: of({}) }); + const customerCreateValidatorsSpy = jasmine.createSpyObj('CustomerCreateValidators', { + uniqueCode: () => of(null), + uniqueDomain: () => of(null), + }); - TestBed.configureTestingModule({ - imports: [ReactiveFormsModule, NoopAnimationsModule, VitamUICommonTestModule, HttpClientTestingModule, LoggerModule.forRoot()], - declarations: [InformationTabComponent, TestHostComponent, EditableDomainInputStubComponent, CustomerColorsInputStubComponent], - providers: [ - { provide: WINDOW_LOCATION, useValue: window.location }, - { provide: BASE_URL, useValue: '/fake-api' }, - { provide: StartupService, useValue: { getConfigNumberValue: () => 100 } }, - { provide: CustomerService, useValue: customerServiceSpy }, - { provide: CustomerCreateValidators, useValue: customerCreateValidatorsSpy }, - { provide: CountryService, useValue: { getAvailableCountries: () => EMPTY } }, - ], - }).compileComponents(); - }) - ); + TestBed.configureTestingModule({ + imports: [ReactiveFormsModule, NoopAnimationsModule, VitamUICommonTestModule, HttpClientTestingModule, LoggerModule.forRoot()], + declarations: [InformationTabComponent, TestHostComponent, EditableDomainInputStubComponent, CustomerColorsInputStubComponent], + providers: [ + { provide: WINDOW_LOCATION, useValue: window.location }, + { provide: BASE_URL, useValue: '/fake-api' }, + { provide: StartupService, useValue: { getConfigNumberValue: () => 100 } }, + { provide: CustomerService, useValue: customerServiceSpy }, + { provide: CustomerCreateValidators, useValue: customerCreateValidatorsSpy }, + { provide: CountryService, useValue: { getAvailableCountries: () => EMPTY } }, + ], + }).compileComponents(); + })); beforeEach(() => { fixture = TestBed.createComponent(TestHostComponent); diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/information-tab/information-tab.component.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/information-tab/information-tab.component.ts index beca1a352a6..f041bc3153d 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/information-tab/information-tab.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/information-tab/information-tab.component.ts @@ -39,7 +39,7 @@ import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { Subscription } from 'rxjs'; import { merge, of } from 'rxjs'; import { catchError, debounceTime, filter, map, switchMap } from 'rxjs/operators'; -import { CountryOption, CountryService, Customer, diff, OtpState, StartupService } from 'ui-frontend-common'; +import { CountryOption, CountryService, Customer, diff, OtpState, StartupService } from 'ui-frontend-common'; import { extend, isEmpty } from 'underscore'; import { CustomerService } from '../../../core/customer.service'; @@ -50,30 +50,30 @@ const UPDATE_DEBOUNCE_TIME = 200; @Component({ selector: 'app-information-tab', templateUrl: './information-tab.component.html', - styleUrls: ['./information-tab.component.scss'] + styleUrls: ['./information-tab.component.scss'], }) export class InformationTabComponent implements OnInit, OnDestroy { public readonly form: FormGroup; public maxStreetLength: number; public customerCodeMaxLength = CUSTOMER_CODE_MAX_LENGTH; previousValue: { - code: string, - identifier: string, - name: string, - companyName: string, - passwordRevocationDelay: number, - otp: OtpState, + code: string; + identifier: string; + name: string; + companyName: string; + passwordRevocationDelay: number; + otp: OtpState; address: { - street: string, - zipCode: string, - city: string, - country: string, - }, - language: string, - emailDomains: string[], - defaultEmailDomain: string - gdprAlert: boolean, - gdprAlertDelay: number, + street: string; + zipCode: string; + city: string; + country: string; + }; + language: string; + emailDomains: string[]; + defaultEmailDomain: string; + gdprAlert: boolean; + gdprAlertDelay: number; }; @Input() @@ -82,13 +82,16 @@ export class InformationTabComponent implements OnInit, OnDestroy { this.resetForm(this.customer); } - get customer(): Customer { return this._customer; } + get customer(): Customer { + return this._customer; + } // tslint:disable-next-line:variable-name private _customer: Customer; // tslint:disable-next-line:variable-name private _gdprReadOnlyStatus: boolean; - get gdprReadOnlyStatus(): boolean { return this._gdprReadOnlyStatus; } - + get gdprReadOnlyStatus(): boolean { + return this._gdprReadOnlyStatus; + } @Input() set readOnly(readOnly: boolean) { @@ -104,16 +107,14 @@ export class InformationTabComponent implements OnInit, OnDestroy { } } - @Input() - set gdprReadOnlyStatus(gdprReadOnlyStatus : boolean){ + set gdprReadOnlyStatus(gdprReadOnlyStatus: boolean) { this._gdprReadOnlyStatus = gdprReadOnlyStatus; - if(gdprReadOnlyStatus ) { + if (gdprReadOnlyStatus) { this.form.get('gdprAlertDelay').disable({ emitEvent: false }); this.form.get('gdprAlert').disable({ emitEvent: false }); } - }; - + } private sub: Subscription; @@ -124,7 +125,7 @@ export class InformationTabComponent implements OnInit, OnDestroy { private customerService: CustomerService, private customerCreateValidators: CustomerCreateValidators, private countryService: CountryService, - private startupService: StartupService + private startupService: StartupService, ) { this.maxStreetLength = this.startupService.getConfigNumberValue('MAX_STREET_LENGTH'); this.form = this.formBuilder.group({ @@ -150,33 +151,29 @@ export class InformationTabComponent implements OnInit, OnDestroy { emailDomains: [null, Validators.required], defaultEmailDomain: [null, Validators.required], gdprAlert: false, - gdprAlertDelay: [ - 72, - [Validators.required, Validators.min(1), Validators.pattern(/^[0-9]{1,20}$/)]] + gdprAlertDelay: [72, [Validators.required, Validators.min(1), Validators.pattern(/^[0-9]{1,20}$/)]], }); } ngOnInit() { - this.form.valueChanges.subscribe((data) => console.log(data)) - + this.form.valueChanges.subscribe((data) => console.log(data)); + this.sub = merge(this.form.statusChanges, this.form.valueChanges) - .pipe( - debounceTime(UPDATE_DEBOUNCE_TIME), - filter(() => this.form.valid), - map(() => diff(this.form.value, this.previousValue)), - filter((formData) => !isEmpty(formData)), - map((formData) => extend({ id: this.customer.id }, formData)), - switchMap((formData) => this.customerService.patch(formData).pipe(catchError(() => of(null)))) - ) - .subscribe((customer: Customer) => this.resetForm(customer)); + .pipe( + debounceTime(UPDATE_DEBOUNCE_TIME), + filter(() => this.form.valid), + map(() => diff(this.form.value, this.previousValue)), + filter((formData) => !isEmpty(formData)), + map((formData) => extend({ id: this.customer.id }, formData)), + switchMap((formData) => this.customerService.patch(formData).pipe(catchError(() => of(null)))), + ) + .subscribe((customer: Customer) => this.resetForm(customer)); this.countryService.getAvailableCountries().subscribe((values: CountryOption[]) => { this.countries = values; }); - } - ngOnDestroy() { if (this.sub) { this.sub.unsubscribe(); @@ -190,5 +187,4 @@ export class InformationTabComponent implements OnInit, OnDestroy { this.form.reset(customer, { emitEvent: false }); this.previousValue = this.form.value; } - } diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/sso-tab/identity-provider-create/identity-provider-create.component.spec.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/sso-tab/identity-provider-create/identity-provider-create.component.spec.ts index c3e7a9b423b..44e3a65a886 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/sso-tab/identity-provider-create/identity-provider-create.component.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/sso-tab/identity-provider-create/identity-provider-create.component.spec.ts @@ -35,7 +35,6 @@ * knowledge of the CeCILL-C license and that you accept its terms. */ - import { Component, forwardRef, Input, ViewChild } from '@angular/core'; import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { ControlValueAccessor, NG_VALUE_ACCESSOR, ReactiveFormsModule } from '@angular/forms'; @@ -53,14 +52,16 @@ import { IdentityProviderCreateComponent } from './identity-provider-create.comp @Component({ selector: 'app-pattern', template: '', - providers: [{ - provide: NG_VALUE_ACCESSOR, - useExisting: forwardRef(() => PatternStubComponent), - multi: true - }] + providers: [ + { + provide: NG_VALUE_ACCESSOR, + useExisting: forwardRef(() => PatternStubComponent), + multi: true, + }, + ], }) class PatternStubComponent implements ControlValueAccessor { - @Input() options: Array<{ value: string, disabled?: boolean }>; + @Input() options: Array<{ value: string; disabled?: boolean }>; @Input() vitamuiMiniMode = false; @ViewChild('select', { static: true }) select: MatSelect; @@ -70,7 +71,6 @@ class PatternStubComponent implements ControlValueAccessor { registerOnTouched() {} } - describe('IdentityProviderCreateComponent', () => { let component: IdentityProviderCreateComponent; let fixture: ComponentFixture; @@ -92,15 +92,14 @@ describe('IdentityProviderCreateComponent', () => { NoopAnimationsModule, VitamUICommonTestModule, ], - declarations: [ IdentityProviderCreateComponent, PatternStubComponent ], + declarations: [IdentityProviderCreateComponent, PatternStubComponent], providers: [ { provide: MatDialogRef, useValue: matDialogRefSpy }, { provide: MAT_DIALOG_DATA, useValue: { customer: { id: '42', name: 'OwnerName' } } }, { provide: IdentityProviderService, useValue: identityProviderServiceSpy }, { provide: ConfirmDialogService, useValue: { listenToEscapeKeyPress: () => EMPTY } }, - ] - }) - .compileComponents(); + ], + }).compileComponents(); })); beforeEach(() => { @@ -114,22 +113,21 @@ describe('IdentityProviderCreateComponent', () => { }); describe('Class', () => { - it('should call dialogRef.close', () => { - const matDialogRef = TestBed.inject(MatDialogRef); + const matDialogRef = TestBed.inject(MatDialogRef); component.onCancel(); expect(matDialogRef.close).toHaveBeenCalled(); }); it('should not call idpService.create()', () => { - const idpService = TestBed.inject(IdentityProviderService); + const idpService = TestBed.inject(IdentityProviderService); component.onSubmit(); expect(idpService.create).not.toHaveBeenCalled(); }); it('should call idpService.create()', () => { - const idpService = TestBed.inject(IdentityProviderService); - const matDialogRef = TestBed.inject(MatDialogRef); + const idpService = TestBed.inject(IdentityProviderService); + const matDialogRef = TestBed.inject(MatDialogRef); component.form.setValue({ customerId: '1234', name: 'Test IDP', @@ -141,7 +139,7 @@ describe('IdentityProviderCreateComponent', () => { identifierAttribute: '', authnRequestBinding: AuthnRequestBindingEnum.POST, autoProvisioningEnabled: true, - protocoleType: "SAML" + protocoleType: 'SAML', }); component.keystore = keystore; component.idpMetadata = idpMetadata; @@ -168,8 +166,8 @@ describe('IdentityProviderCreateComponent', () => { }); it('should set an error', () => { - const idpService = TestBed.inject(IdentityProviderService); - const matDialogRef = TestBed.inject(MatDialogRef); + const idpService = TestBed.inject(IdentityProviderService); + const matDialogRef = TestBed.inject(MatDialogRef); idpService.create = jasmine.createSpy().and.returnValue(observableThrowError({ error: { error: 'INVALID_KEYSTORE_PASSWORD' } })); component.form.setValue({ customerId: '1234', @@ -182,7 +180,7 @@ describe('IdentityProviderCreateComponent', () => { identifierAttribute: '', authnRequestBinding: AuthnRequestBindingEnum.POST, autoProvisioningEnabled: true, - protocoleType:'SAML' + protocoleType: 'SAML', }); component.keystore = keystore; component.idpMetadata = idpMetadata; @@ -194,14 +192,12 @@ describe('IdentityProviderCreateComponent', () => { }); describe('DOM', () => { - it('should have a title', () => { const elTitle = fixture.nativeElement.querySelector('.large'); expect(elTitle.textContent).toContain('CUSTOMER.SSO.MODAL.TITLE "OwnerName"'); }); it('should have all the inputs', () => { - const elEnabled = fixture.nativeElement.querySelector('vitamui-common-slide-toggle[formControlName=enabled]'); expect(elEnabled).toBeTruthy(); expect(elEnabled.textContent).toContain('CUSTOMER.SSO.ACTIVE_SWITCH'); @@ -218,7 +214,6 @@ describe('IdentityProviderCreateComponent', () => { const elAutoProvision = fixture.nativeElement.querySelector('vitamui-common-slide-toggle[formControlName=autoProvisioningEnabled]'); expect(elAutoProvision).toBeTruthy(); expect(elAutoProvision.textContent).toContain('CUSTOMER.SSO.AUTO_PROVISIONING'); - }); it('should have a submit button', () => { @@ -236,7 +231,7 @@ describe('IdentityProviderCreateComponent', () => { identifierAttribute: '', authnRequestBinding: AuthnRequestBindingEnum.POST, autoProvisioningEnabled: true, - protocoleType: "SAML", + protocoleType: 'SAML', }); component.keystore = keystore; component.idpMetadata = idpMetadata; @@ -254,7 +249,5 @@ describe('IdentityProviderCreateComponent', () => { elCancel.click(); expect(component.onCancel).toHaveBeenCalledTimes(1); }); - }); - }); diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/sso-tab/identity-provider-create/identity-provider-create.component.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/sso-tab/identity-provider-create/identity-provider-create.component.ts index 98f9f850a37..406a66fb7d1 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/sso-tab/identity-provider-create/identity-provider-create.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/sso-tab/identity-provider-create/identity-provider-create.component.ts @@ -65,21 +65,19 @@ export class IdentityProviderCreateComponent implements OnInit, OnDestroy { @Inject(MAT_DIALOG_DATA) public data: { customer: Customer; domains: Array<{ value: string; disabled: boolean }> }, private formBuilder: FormBuilder, private identityProviderService: IdentityProviderService, - private confirmDialogService: ConfirmDialogService + private confirmDialogService: ConfirmDialogService, ) { this.samlSpecificControls = this.initializeSamlControls(); this.oidcSpecificControls = this.initializeOIDCControls(); this.commonControls = this.initializeCommonControls(); - this.form= this.formBuilder.group({ + this.form = this.formBuilder.group({ ...this.commonControls.controls, - ...this.samlSpecificControls.controls - }) + ...this.samlSpecificControls.controls, + }); } ngOnInit() { - this.keyPressSubscription = this.confirmDialogService - .listenToEscapeKeyPress(this.dialogRef) - .subscribe(() => this.onCancel()); + this.keyPressSubscription = this.confirmDialogService.listenToEscapeKeyPress(this.dialogRef).subscribe(() => this.onCancel()); this.form.get('protocoleType').setValue(ProtocoleType.SAML); } @@ -89,7 +87,7 @@ export class IdentityProviderCreateComponent implements OnInit, OnDestroy { case ProtocoleType.CERTIFICAT: this.stepCount = 1; this.form = this.formBuilder.group({ - ...this.commonControls.controls + ...this.commonControls.controls, }); break; @@ -171,7 +169,7 @@ export class IdentityProviderCreateComponent implements OnInit, OnDestroy { if (response && response.error && response.error.error && response.error.error === 'INVALID_KEYSTORE_PASSWORD') { this.form.get('keystorePassword').setErrors({ badPassword: true }); } - } + }, ); } diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/sso-tab/identity-provider-details/identity-provider-details.component.html b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/sso-tab/identity-provider-details/identity-provider-details.component.html index 11f02356a89..83db8dfa81c 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/sso-tab/identity-provider-details/identity-provider-details.component.html +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/sso-tab/identity-provider-details/identity-provider-details.component.html @@ -98,7 +98,7 @@ 'CUSTOMER.SSO.AUTO_PROVISIONING' | translate }}
      -
      +
      -
      +
      - {{ 'COMMON.ERROR.REQUIRED' | translate }} + {{ 'COMMON.ERROR.REQUIRED' | translate }}
      @@ -148,7 +148,7 @@ [validator]="form?.get('clientSecret')?.validator" [label]="'CUSTOMER.SSO.CLIENT_SECRET' | translate" > - {{ 'COMMON.ERROR.REQUIRED' | translate }} + {{ 'COMMON.ERROR.REQUIRED' | translate }}
      @@ -159,13 +159,14 @@ [validator]="form?.get('discoveryUrl')?.validator" [label]="'CUSTOMER.SSO.URL_DISCOVERY' | translate" > - {{ 'COMMON.ERROR.REQUIRED' | translate }} + {{ 'COMMON.ERROR.REQUIRED' | translate }}
      - + +
      @@ -183,13 +184,13 @@
      - {{'CUSTOMER.SSO.STATEFUL' | translate}} + {{ 'CUSTOMER.SSO.STATEFUL' | translate }}
      - {{'CUSTOMER.SSO.USE_NONCE' | translate}} + {{ 'CUSTOMER.SSO.USE_NONCE' | translate }}
      - {{'CUSTOMER.SSO.USE_PKCE' | translate}} + {{ 'CUSTOMER.SSO.USE_PKCE' | translate }}
      diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/sso-tab/identity-provider-details/identity-provider-details.component.scss b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/sso-tab/identity-provider-details/identity-provider-details.component.scss index 56a097db90e..f96182eb493 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/sso-tab/identity-provider-details/identity-provider-details.component.scss +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/sso-tab/identity-provider-details/identity-provider-details.component.scss @@ -1,3 +1,3 @@ .pattern-row { - padding-bottom: 10px; -} \ No newline at end of file + padding-bottom: 10px; +} diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/sso-tab/identity-provider-details/identity-provider-details.component.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/sso-tab/identity-provider-details/identity-provider-details.component.ts index b9396aafb97..b814e8e9f4c 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/sso-tab/identity-provider-details/identity-provider-details.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/sso-tab/identity-provider-details/identity-provider-details.component.ts @@ -139,7 +139,7 @@ export class IdentityProviderDetailsComponent implements OnInit { constructor( private formBuilder: FormBuilder, private identityProviderService: IdentityProviderService, - private snackBarService: VitamUISnackBarService + private snackBarService: VitamUISnackBarService, ) { this.commonsControls = this.initializeCommonControls(); this.specificSamlControls = this.initializeSamlControls(); @@ -201,7 +201,7 @@ export class IdentityProviderDetailsComponent implements OnInit { map(() => this.diff(this.form.value, this.previousValue)), filter((formData) => !isEmpty(formData)), map((formData) => extend({ id: this.identityProvider.id }, formData)), - switchMap((formData) => this.identityProviderService.patch(formData)) + switchMap((formData) => this.identityProviderService.patch(formData)), ) .subscribe(() => { this.previousValue = this.form.value; @@ -210,7 +210,7 @@ export class IdentityProviderDetailsComponent implements OnInit { .pipe( debounceTime(UPDATE_DEBOUNCE_TIME), filter(() => this.idpMetadata.valid), - switchMap(() => this.identityProviderService.updateMetadataFile(this.identityProvider.id, this.idpMetadata.value)) + switchMap(() => this.identityProviderService.updateMetadataFile(this.identityProvider.id, this.idpMetadata.value)), ) .subscribe(); } diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/sso-tab/identity-provider.service.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/sso-tab/identity-provider.service.ts index ac4620c5f9f..43d3a72b40a 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/sso-tab/identity-provider.service.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/sso-tab/identity-provider.service.ts @@ -45,96 +45,91 @@ import { ProviderApiService } from './provider-api.service'; @Injectable() export class IdentityProviderService { - updated = new Subject(); constructor( private providerApi: ProviderApiService, private snackBarService: VitamUISnackBarService, - private startupService: StartupService - ) { } + private startupService: StartupService, + ) {} create(idp: IdentityProvider): Observable { - return this.providerApi.create(idp) - .pipe( - map((newIDP: IdentityProvider) => this.addMetadataUrl(newIDP)), - tap( - (newIDP: IdentityProvider) => { - this.snackBarService.open({ - message: 'SHARED.SNACKBAR.PROVIDER_CREATE', - translateParams:{ - param1: newIDP.name, - } - }); - }, - (error) => { + return this.providerApi.create(idp).pipe( + map((newIDP: IdentityProvider) => this.addMetadataUrl(newIDP)), + tap( + (newIDP: IdentityProvider) => { + this.snackBarService.open({ + message: 'SHARED.SNACKBAR.PROVIDER_CREATE', + translateParams: { + param1: newIDP.name, + }, + }); + }, + (error) => { this.snackBarService.open({ message: error.error.message, translate: false }); - } - ) - ); + }, + ), + ); } - patch(idp: { id: string, [key: string]: any }): Observable { - return this.providerApi.patch(idp) - .pipe( - map((updatedIdp: IdentityProvider) => this.addMetadataUrl(updatedIdp)), - tap((updatedIdp: IdentityProvider) => this.updated.next(updatedIdp)), - tap( - (updatedIdp: IdentityProvider) => { - this.snackBarService.open({ - message: 'SHARED.SNACKBAR.PROVIDER_UPDATE', - translateParams:{ - param1: updatedIdp.name, - } - }); - }, - (error) => { + patch(idp: { id: string; [key: string]: any }): Observable { + return this.providerApi.patch(idp).pipe( + map((updatedIdp: IdentityProvider) => this.addMetadataUrl(updatedIdp)), + tap((updatedIdp: IdentityProvider) => this.updated.next(updatedIdp)), + tap( + (updatedIdp: IdentityProvider) => { + this.snackBarService.open({ + message: 'SHARED.SNACKBAR.PROVIDER_UPDATE', + translateParams: { + param1: updatedIdp.name, + }, + }); + }, + (error) => { this.snackBarService.open({ message: error.error.message, translate: false }); - } - ) - ); + }, + ), + ); } updateMetadataFile(id: string, idpMetadata: File): Observable { - return this.providerApi.patchProviderIdpMetadata(id, idpMetadata) - .pipe( - map((updatedIdp: IdentityProvider) => this.addMetadataUrl(updatedIdp)), - tap((updatedIdp: IdentityProvider) => this.updated.next(updatedIdp)), - tap( - (updatedIdp: IdentityProvider) => { - this.snackBarService.open({ - message: 'SHARED.SNACKBAR.PROVIDER_UPDATE', - translateParams:{ - param1: updatedIdp.name, - } - }); - }, - (error) => { - this.snackBarService.open({ message: error.error.message, translate: false }); - } - ) - ); + return this.providerApi.patchProviderIdpMetadata(id, idpMetadata).pipe( + map((updatedIdp: IdentityProvider) => this.addMetadataUrl(updatedIdp)), + tap((updatedIdp: IdentityProvider) => this.updated.next(updatedIdp)), + tap( + (updatedIdp: IdentityProvider) => { + this.snackBarService.open({ + message: 'SHARED.SNACKBAR.PROVIDER_UPDATE', + translateParams: { + param1: updatedIdp.name, + }, + }); + }, + (error) => { + this.snackBarService.open({ message: error.error.message, translate: false }); + }, + ), + ); } updateKeystore(id: string, file: File, password: string): Observable { - return this.providerApi.patchProviderKeystore(id, file, password) - .pipe( - map((updatedIdp: IdentityProvider) => this.addMetadataUrl(updatedIdp)), - tap((updatedIdp: IdentityProvider) => this.updated.next(updatedIdp)), - tap( - (updatedIdp: IdentityProvider) => { - this.snackBarService.open({ - message: 'SHARED.SNACKBAR.PROVIDER_UPDATE', - translateParams:{ - param1: updatedIdp.name, - } - }); - }, - (error) => { - this.snackBarService.open({ message: error.error.message, translate: false }); - } - ) - ); + return this.providerApi.patchProviderKeystore(id, file, password).pipe( + map((updatedIdp: IdentityProvider) => this.addMetadataUrl(updatedIdp)), + tap((updatedIdp: IdentityProvider) => this.updated.next(updatedIdp)), + tap( + (updatedIdp: IdentityProvider) => { + this.snackBarService.open({ + message: 'SHARED.SNACKBAR.PROVIDER_UPDATE', + translateParams: { + param1: updatedIdp.name, + }, + }); + }, + (error) => { + this.snackBarService.open({ message: error.error.message, translate: false }); + }, + ), + ); } getAll(customerId?: string): Observable { @@ -147,21 +142,19 @@ export class IdentityProviderService { const httpParams = new HttpParams().set('criteria', JSON.stringify(query)); - return this.providerApi.getAll(httpParams) - .pipe( - map((identityProviders) => { - return identityProviders.map((identityProvider) => this.addMetadataUrl(identityProvider)); - }) - ); + return this.providerApi.getAll(httpParams).pipe( + map((identityProviders) => { + return identityProviders.map((identityProvider) => this.addMetadataUrl(identityProvider)); + }), + ); } getDomainByCustomerId(customerId: string): Observable { - return this.getAll(customerId) - .pipe( - map((identityProviders: IdentityProvider[]) => { - return identityProviders.reduce((acc, idp) => acc.concat(idp.patterns.map((p) => p.replace('.*@', ''))), []); - }) - ); + return this.getAll(customerId).pipe( + map((identityProviders: IdentityProvider[]) => { + return identityProviders.reduce((acc, idp) => acc.concat(idp.patterns.map((p) => p.replace('.*@', ''))), []); + }), + ); } private addMetadataUrl(identityProvider: IdentityProvider): IdentityProvider { @@ -169,5 +162,4 @@ export class IdentityProviderService { return identityProvider; } - } diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/sso-tab/provider-api.service.spec.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/sso-tab/provider-api.service.spec.ts index 88486f5325e..0e639328d47 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/sso-tab/provider-api.service.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/sso-tab/provider-api.service.spec.ts @@ -41,14 +41,12 @@ import { BASE_URL } from 'ui-frontend-common'; import { ProviderApiService } from './provider-api.service'; describe('ProviderApiService', () => { - beforeEach(() => TestBed.configureTestingModule({ - imports: [ - HttpClientTestingModule, - ], - providers: [ - { provide: BASE_URL, useValue: '/fake-api' }, - ] - })); + beforeEach(() => + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule], + providers: [{ provide: BASE_URL, useValue: '/fake-api' }], + }), + ); it('should be created', () => { const service: ProviderApiService = TestBed.inject(ProviderApiService); diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/sso-tab/provider-api.service.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/sso-tab/provider-api.service.ts index 5fa5ff630eb..68788e0c74d 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/sso-tab/provider-api.service.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/sso-tab/provider-api.service.ts @@ -77,13 +77,12 @@ export class ProviderApiService extends BaseHttpClient { useState: identityProvider.useState, useNonce: identityProvider.useNonce, usePkce: identityProvider.usePkce, - }) + }), ); return this.http.post(this.apiUrl, formData, { headers }); } - patch(partialIDP: { id: string; [key: string]: any }, headers?: HttpHeaders): Observable { return super.patch(partialIDP, headers); } @@ -101,7 +100,7 @@ export class ProviderApiService extends BaseHttpClient { identityProviderId: string, keystore: File, keystorePassword: string, - headers?: HttpHeaders + headers?: HttpHeaders, ): Observable { const formData = new FormData(); diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/sso-tab/sso-tab-const.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/sso-tab/sso-tab-const.ts index b7b78316b85..a06a893a31e 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/sso-tab/sso-tab-const.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/sso-tab/sso-tab-const.ts @@ -1,23 +1,23 @@ const JWS_ALGORITHMS = [ - '', - 'HS256', - 'HS384', - 'HS512', - 'RS256', - 'RS384', - 'RS512', - 'ES256', - 'ES256K', - 'ES384', - 'ES512', - 'PS256', - 'PS384', - 'PS512', - ]; + '', + 'HS256', + 'HS384', + 'HS512', + 'RS256', + 'RS384', + 'RS512', + 'ES256', + 'ES256K', + 'ES384', + 'ES512', + 'PS256', + 'PS384', + 'PS512', +]; export enum ProtocoleType { SAML = 'SAML', OIDC = 'OIDC', CERTIFICAT = 'CERTIFICAT', } -export default JWS_ALGORITHMS; \ No newline at end of file +export default JWS_ALGORITHMS; diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/sso-tab/sso-tab.component.html b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/sso-tab/sso-tab.component.html index e096d7ba86a..aaba460ed19 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/sso-tab/sso-tab.component.html +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/sso-tab/sso-tab.component.html @@ -1,39 +1,47 @@
      - -
      {{provider?.name}}
      + +
      {{ provider?.name }}
      - -
      {{'CUSTOMER.SSO.TYPE_INTERNAL' | translate}}
      -
      {{'CUSTOMER.SSO.TYPE_EXTERNAL' | translate}}
      + +
      {{ 'CUSTOMER.SSO.TYPE_INTERNAL' | translate }}
      +
      {{ 'CUSTOMER.SSO.TYPE_EXTERNAL' | translate }}
      - -
      {{pattern}}
      + +
      {{ pattern }}
      -
      {{'CUSTOMER.SSO.STATUS_ACTIVE' | translate}}
      -
      {{'CUSTOMER.SSO.STATUS_INACTIVE' | translate}}
      +
      {{ 'CUSTOMER.SSO.STATUS_ACTIVE' | translate }}
      +
      {{ 'CUSTOMER.SSO.STATUS_INACTIVE' | translate }}
      - + file_download - {{'CUSTOMER.SSO.METADATA' | translate}} + {{ 'CUSTOMER.SSO.METADATA' | translate }}
      @@ -42,12 +50,17 @@
      - - +
      -
      \ No newline at end of file +
      diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/sso-tab/sso-tab.component.scss b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/sso-tab/sso-tab.component.scss index b16c7bb88b5..dd721bf378c 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/sso-tab/sso-tab.component.scss +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/sso-tab/sso-tab.component.scss @@ -1,83 +1,83 @@ @import '~ui-frontend-common/sass/variables/colors'; :host { - .vitamui-panel-content { - padding: 0!important; - } + .vitamui-panel-content { + padding: 0 !important; + } } button.back { - margin-bottom: 30px; + margin-bottom: 30px; } .vitamui-panel { - .vitamui-panel-content { - padding: 30px 60px 0 40px; - overflow: visible; - height: 100%; - width: 100%; - transform: none; - } + .vitamui-panel-content { + padding: 30px 60px 0 40px; + overflow: visible; + height: 100%; + width: 100%; + transform: none; + } } button.btn { - margin-bottom: 20px; + margin-bottom: 20px; } .provider-list { - width: 100%; - font-size: 14px; + width: 100%; + font-size: 14px; - .provider-item-content { - border-radius: 5px; - background-color: var(--vitamui-grey-100); - color: var(--vitamui-grey-900); - min-height: 60px; - width: 90%; - cursor: pointer; + .provider-item-content { + border-radius: 5px; + background-color: var(--vitamui-grey-100); + color: var(--vitamui-grey-900); + min-height: 60px; + width: 90%; + cursor: pointer; - div { - font-weight: 500; - } - - label { - font-weight: normal; - } + div { + font-weight: 500; } - .provider-item-centered { - align-self: center; + label { + font-weight: normal; } + } + + .provider-item-centered { + align-self: center; + } - .provider-item-link { - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - height: 60px; - border-radius: 3px; - border: solid 1px var(--vitamui-primary); - margin-left: 10px; - color: var(--vitamui-primary); - font-size: 9px; - text-align: center; - text-decoration: none; + .provider-item-link { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + height: 60px; + border-radius: 3px; + border: solid 1px var(--vitamui-primary); + margin-left: 10px; + color: var(--vitamui-primary); + font-size: 9px; + text-align: center; + text-decoration: none; - &.disabled { - opacity: 0.4; - pointer-events: none; - } + &.disabled { + opacity: 0.4; + pointer-events: none; } + } - .provider-status { - font-size: 14px; - font-weight: bold; - color: var(--vitamui-grey-600); - width: 100%; - text-align: right; + .provider-status { + font-size: 14px; + font-weight: bold; + color: var(--vitamui-grey-600); + width: 100%; + text-align: right; - &.active { - color: $green; - } + &.active { + color: $green; } -} \ No newline at end of file + } +} diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/sso-tab/sso-tab.component.spec.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/sso-tab/sso-tab.component.spec.ts index 86552cd2540..4d4e1cde75f 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/sso-tab/sso-tab.component.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/sso-tab/sso-tab.component.spec.ts @@ -60,7 +60,7 @@ class MatTooltipStubDirective { } @Component({ - template: `` + template: ``, }) class TestHostComponent { customer: Customer = { @@ -75,28 +75,20 @@ class TestHostComponent { language: 'FRENCH', passwordRevocationDelay: 9, otp: OtpState.OPTIONAL, - emailDomains: [ - 'vitamui.com', - '1test.com', - 'test2.com', - 'test3.com', - 'test4.com', - 'test5.com', - 'test6.com', - ], + emailDomains: ['vitamui.com', '1test.com', 'test2.com', 'test3.com', 'test4.com', 'test5.com', 'test6.com'], defaultEmailDomain: '1test.com', address: { street: '73 rue du Faubourg Poissonnière ', zipCode: '75009', city: 'Paris', - country: 'DK' + country: 'DK', }, owners: [], themeColors: {}, - gdprAlert : false, - gdprAlertDelay : 72, + gdprAlert: false, + gdprAlertDelay: 72, portalMessages: {}, - portalTitles: {} + portalTitles: {}, }; @ViewChild(SsoTabComponent, { static: false }) component: SsoTabComponent; } @@ -119,7 +111,7 @@ describe('SsoTabComponent', () => { keystorePassword: null, privateKeyPassword: null, idpMetadata: null, - spMetadata: null + spMetadata: null, }, { id: '5ad5f14e894e6a414edc7b91dc194c3187f143cbb7593242769a1706fd03d3f3', @@ -132,7 +124,7 @@ describe('SsoTabComponent', () => { keystorePassword: null, privateKeyPassword: null, idpMetadata: null, - spMetadata: null + spMetadata: null, }, { id: '5af95fae636f9114e074100590122991ac38418595cd0dab684fee3bccacd2dd', @@ -145,7 +137,7 @@ describe('SsoTabComponent', () => { keystorePassword: 'test', privateKeyPassword: 'test', idpMetadata: null, - spMetadata: null + spMetadata: null, }, ]; @@ -154,24 +146,19 @@ describe('SsoTabComponent', () => { TestBed.configureTestingModule({ imports: [VitamUICommonTestModule], - declarations: [ - SsoTabComponent, - IdentityProviderDetailsStubComponent, - TestHostComponent, - MatTooltipStubDirective, - ], + declarations: [SsoTabComponent, IdentityProviderDetailsStubComponent, TestHostComponent, MatTooltipStubDirective], providers: [ { provide: MatDialog, useValue: matDialogSpy }, { - provide: IdentityProviderService, useValue: { + provide: IdentityProviderService, + useValue: { getAll: () => of(providers), getDomainByCustomerId: () => of(['test1.com', 'test2.com']), - updated: new Subject() - } + updated: new Subject(), + }, }, - ] - }) - .compileComponents(); + ], + }).compileComponents(); })); beforeEach(() => { @@ -195,9 +182,7 @@ describe('SsoTabComponent', () => { }); describe('DOM', () => { - describe('Button "Create IDP"', () => { - it('should exist', () => { const elButton = fixture.nativeElement.querySelector('button'); expect(elButton).toBeTruthy(); @@ -227,20 +212,18 @@ describe('SsoTabComponent', () => { const elButton = fixture.nativeElement.querySelector('button'); expect(elButton).toBeFalsy(); }); - }); describe('Providers List', () => { - it('should display the list of providers', () => { const elProviders = fixture.nativeElement.querySelectorAll('.provider-item-content'); expect(elProviders.length).toBe(3); elProviders.forEach((elProvider: HTMLElement, index: number) => { expect(elProvider.textContent).toContain(providers[index].name); - expect(elProvider.textContent).toContain(providers[index].internal - ? 'CUSTOMER.SSO.TYPE_INTERNAL' : 'CUSTOMER.SSO.TYPE_EXTERNAL'); - expect(elProvider.textContent).toContain(providers[index].enabled - ? 'CUSTOMER.SSO.STATUS_ACTIVE' : 'CUSTOMER.SSO.STATUS_INACTIVE'); + expect(elProvider.textContent).toContain(providers[index].internal ? 'CUSTOMER.SSO.TYPE_INTERNAL' : 'CUSTOMER.SSO.TYPE_EXTERNAL'); + expect(elProvider.textContent).toContain( + providers[index].enabled ? 'CUSTOMER.SSO.STATUS_ACTIVE' : 'CUSTOMER.SSO.STATUS_INACTIVE', + ); }); }); @@ -253,7 +236,6 @@ describe('SsoTabComponent', () => { }); describe('Provider Details', () => { - it('should not show if no provider is selected', () => { const elProviderDetails = fixture.nativeElement.querySelector('app-identity-provider-details'); expect(elProviderDetails).toBeFalsy(); @@ -276,8 +258,6 @@ describe('SsoTabComponent', () => { elButton.click(); expect(testhost.component.selectedIdentityProvider).toBeFalsy(); }); - }); - }); }); diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/sso-tab/sso-tab.component.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/sso-tab/sso-tab.component.ts index 822b905c62f..f50bfc99c41 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/sso-tab/sso-tab.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/sso-tab/sso-tab.component.ts @@ -50,38 +50,27 @@ import { IdentityProviderService } from './identity-provider.service'; animations: [ trigger('panelTransition', [ state('previous', style({ transform: 'translate3d(-100%, 0, 0)' })), - state('next', style({ transform: 'translate3d(100%, 0, 0)' })), + state('next', style({ transform: 'translate3d(100%, 0, 0)' })), state('current', style({ transform: 'translate3d(0, 0, 0)' })), transition('* <=> current', animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)')), ]), trigger('slideLeftTransition', [ - transition(':enter', [ - style({ transform: 'translate3d(-100%, 0, 0)' }), - animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)'), - ]), - transition(':leave', [ - animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)', style({ transform: 'translate3d(-100%, 0, 0)' })), - ]), + transition(':enter', [style({ transform: 'translate3d(-100%, 0, 0)' }), animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)')]), + transition(':leave', [animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)', style({ transform: 'translate3d(-100%, 0, 0)' }))]), ]), trigger('slideRightTransition', [ state('*', style({ transform: 'translate3d(0, 0, 0)' })), - transition(':enter', [ - style({ transform: 'translate3d(100%, 0, 0)' }), - animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)'), - ]), - transition(':leave', [ - animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)', style({ transform: 'translate3d(100%, 0, 0)' })), - ]), + transition(':enter', [style({ transform: 'translate3d(100%, 0, 0)' }), animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)')]), + transition(':leave', [animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)', style({ transform: 'translate3d(100%, 0, 0)' }))]), ]), - ] + ], }) export class SsoTabComponent implements OnDestroy, OnInit { - providers: IdentityProvider[]; panel1Position = 'current'; panel2Position = 'next'; selectedIdentityProvider: IdentityProvider; - domains: Array<{ value: string, disabled: boolean }> = []; + domains: Array<{ value: string; disabled: boolean }> = []; @Input() set customer(customer: Customer) { @@ -95,14 +84,19 @@ export class SsoTabComponent implements OnDestroy, OnInit { }); this.refreshAvailableDomains(); } - get customer(): Customer { return this._customer; } + get customer(): Customer { + return this._customer; + } private _customer: Customer; @Input() readOnly: boolean; private updatedProviderSub: Subscription; - constructor(public dialog: MatDialog, private identityProviderService: IdentityProviderService) { } + constructor( + public dialog: MatDialog, + private identityProviderService: IdentityProviderService, + ) {} ngOnInit() { this.updatedProviderSub = this.identityProviderService.updated.subscribe((updatedProvider: IdentityProvider) => { @@ -122,10 +116,10 @@ export class SsoTabComponent implements OnDestroy, OnInit { const dialogRef = this.dialog.open(IdentityProviderCreateComponent, { data: { customer: this.customer, - domains: this.domains + domains: this.domains, }, disableClose: true, - panelClass: 'vitamui-modal' + panelClass: 'vitamui-modal', }); dialogRef.afterClosed().subscribe((result: IdentityProvider) => { if (result) { @@ -150,5 +144,4 @@ export class SsoTabComponent implements OnDestroy, OnInit { }); }); } - } diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-resolver.service.spec.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-resolver.service.spec.ts index 663d3abd27f..9841e97d6aa 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-resolver.service.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-resolver.service.spec.ts @@ -35,7 +35,6 @@ * knowledge of the CeCILL-C license and that you accept its terms. */ - import { inject, TestBed } from '@angular/core/testing'; import { ActivatedRouteSnapshot, Router } from '@angular/router'; import { of } from 'rxjs'; @@ -46,7 +45,7 @@ import { CustomerResolver } from './customer-resolver.service'; const expectedCustomer: Customer = { id: '11', - identifier : '11', + identifier: '11', code: '011000', name: 'Kouygues Telecom', companyName: 'Kouygues Telecom', @@ -57,22 +56,20 @@ const expectedCustomer: Customer = { passwordRevocationDelay: 1, otp: OtpState.OPTIONAL, idp: false, - emailDomains: [ - 'kouygues.com', - ], + emailDomains: ['kouygues.com'], defaultEmailDomain: 'kouygues.com', address: { street: '13 rue faubourg', zipCode: '75009', city: 'paris', - country: 'france' + country: 'france', }, owners: [], themeColors: {}, - gdprAlert : false, - gdprAlertDelay : 72, + gdprAlert: false, + gdprAlertDelay: 72, portalMessages: {}, - portalTitles: {} + portalTitles: {}, }; describe('CustomerResolver', () => { @@ -83,11 +80,7 @@ describe('CustomerResolver', () => { const routerSpy = jasmine.createSpyObj('Router', ['navigate']); TestBed.configureTestingModule({ - providers: [ - CustomerResolver, - { provide: CustomerService, useValue: customerServiceSpy }, - { provide: Router, useValue: routerSpy }, - ] + providers: [CustomerResolver, { provide: CustomerService, useValue: customerServiceSpy }, { provide: Router, useValue: routerSpy }], }); customerResolver = TestBed.inject(CustomerResolver); @@ -123,5 +116,4 @@ describe('CustomerResolver', () => { expect(route.paramMap.get).toHaveBeenCalledWith('id'); expect(customerService.get).toHaveBeenCalledWith('42'); }); - }); diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-resolver.service.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-resolver.service.ts index 72684052384..b76a517c185 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-resolver.service.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-resolver.service.ts @@ -44,25 +44,25 @@ import { CustomerService } from '../core/customer.service'; @Injectable() export class CustomerResolver implements Resolve { - - constructor(private customerService: CustomerService, private router: Router) { } + constructor( + private customerService: CustomerService, + private router: Router, + ) {} resolve(route: ActivatedRouteSnapshot): Observable { const id = route.paramMap.get('id'); - return this.customerService.get(id) - .pipe( - take(1), - map((customer: Customer) => { - if (customer) { - return customer; - } else { - this.router.navigate(['/']); + return this.customerService.get(id).pipe( + take(1), + map((customer: Customer) => { + if (customer) { + return customer; + } else { + this.router.navigate(['/']); - return null; - } - }) - ); + return null; + } + }), + ); } - } diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-routing.module.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-routing.module.ts index ee1e2f0090f..b3c64155234 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-routing.module.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-routing.module.ts @@ -48,13 +48,13 @@ const routes: Route[] = [ { path: '', component: CustomerComponent, - pathMatch: 'full' + pathMatch: 'full', }, { path: ':id', component: CustomerPopupComponent, resolve: { customer: CustomerResolver }, - data: { isPopup: true, appId: 'CUSTOMERS_APP' } + data: { isPopup: true, appId: 'CUSTOMERS_APP' }, }, { path: 'owner/:id', @@ -67,18 +67,12 @@ const routes: Route[] = [ component: OwnerPopupComponent, resolve: { tenant: TenantResolver }, data: { isPopup: true, appId: 'CUSTOMERS_APP' }, - } + }, ]; - @NgModule({ declarations: [], - imports: [ - CommonModule, - RouterModule.forChild(routes) - ], - exports: [ - RouterModule - ] + imports: [CommonModule, RouterModule.forChild(routes)], + exports: [RouterModule], }) -export class CustomerRoutingModule { } +export class CustomerRoutingModule {} diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer.component.html b/ui/ui-frontend/projects/identity/src/app/customer/customer.component.html index c7ac7f7a362..ab504f303c6 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer.component.html +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer.component.html @@ -1,26 +1,39 @@ - + - +
      - {{'CUSTOMER.HOME.TITLE' | translate}} + {{ 'CUSTOMER.HOME.TITLE' | translate }}
      - +
      diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer.component.spec.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer.component.spec.ts index c4886093077..42d604ff8d5 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer.component.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer.component.spec.ts @@ -35,7 +35,6 @@ * knowledge of the CeCILL-C license and that you accept its terms. */ - import { Component, EventEmitter, Input, Output } from '@angular/core'; import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { EMPTY, of } from 'rxjs'; @@ -57,17 +56,19 @@ let component: CustomerComponent; let fixture: ComponentFixture; class Page { - - get customerList() { return fixture.nativeElement.querySelector('app-customer-list'); } - get createCustomer() { return fixture.nativeElement.querySelector('.vitamui-heading button:first-child'); } - + get customerList() { + return fixture.nativeElement.querySelector('app-customer-list'); + } + get createCustomer() { + return fixture.nativeElement.querySelector('.vitamui-heading button:first-child'); + } } let page: Page; @Component({ selector: 'app-customer-list', template: '' }) class CustomerListStubComponent { - search() { } + search() {} } @Component({ selector: 'app-customer-preview', template: '' }) @@ -86,37 +87,23 @@ class OwnerPreviewStubComponent { describe('CustomerComponent', () => { const customerServiceSpy = { - getGdprReadOnlySettingStatus: () => of(true) + getGdprReadOnlySettingStatus: () => of(true), }; - beforeEach(waitForAsync(() => { const matDialogSpy = jasmine.createSpyObj('MatDialog', ['open']); matDialogSpy.open.and.returnValue({ afterClosed: () => of(true) }); TestBed.configureTestingModule({ - imports: [ - MatMenuModule, - MatSidenavModule, - NoopAnimationsModule, - VitamUICommonTestModule, - InjectorModule, - LoggerModule.forRoot() - ], - declarations: [ - CustomerComponent, - CustomerListStubComponent, - CustomerPreviewStubComponent, - OwnerPreviewStubComponent, - ], + imports: [MatMenuModule, MatSidenavModule, NoopAnimationsModule, VitamUICommonTestModule, InjectorModule, LoggerModule.forRoot()], + declarations: [CustomerComponent, CustomerListStubComponent, CustomerPreviewStubComponent, OwnerPreviewStubComponent], providers: [ { provide: CustomerService, useValue: customerServiceSpy }, { provide: MatDialog, useValue: matDialogSpy }, { provide: ActivatedRoute, useValue: { data: EMPTY } }, - { provide: ENVIRONMENT, useValue: environment } - ] - }) - .compileComponents(); + { provide: ENVIRONMENT, useValue: environment }, + ], + }).compileComponents(); })); beforeEach(() => { @@ -141,7 +128,10 @@ describe('CustomerComponent', () => { it('should open a modal with CustomerCreateComponent', () => { const matDialogSpy = TestBed.get(MatDialog); page.createCustomer.click(); - expect(matDialogSpy.open).toHaveBeenCalledWith(CustomerCreateComponent, { data: { gdprReadOnlySettingStatus: true }, panelClass: 'vitamui-modal', disableClose: true }); + expect(matDialogSpy.open).toHaveBeenCalledWith(CustomerCreateComponent, { + data: { gdprReadOnlySettingStatus: true }, + panelClass: 'vitamui-modal', + disableClose: true, + }); }); - }); diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer.component.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer.component.ts index 80ea5af54f9..5b38cfbcba1 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer.component.ts @@ -46,10 +46,9 @@ import { CustomerListComponent } from './customer-list/customer-list.component'; @Component({ selector: 'app-customer', templateUrl: './customer.component.html', - styleUrls: ['./customer.component.scss'] + styleUrls: ['./customer.component.scss'], }) export class CustomerComponent extends SidenavPage { - public customers: Customer[]; public previewType: 'CUSTOMER' | 'OWNER' | 'TENANT'; public owner: Owner; @@ -57,26 +56,33 @@ export class CustomerComponent extends SidenavPage { @ViewChild(CustomerListComponent, { static: true }) customerListComponent: CustomerListComponent; - constructor(private dialog: MatDialog, public route: ActivatedRoute, public globalEventService: GlobalEventService, public customerService: CustomerService) { + constructor( + private dialog: MatDialog, + public route: ActivatedRoute, + public globalEventService: GlobalEventService, + public customerService: CustomerService, + ) { super(route, globalEventService); } ngOnInit() { - this.customerService.getGdprReadOnlySettingStatus().subscribe(settingStatus => { + this.customerService.getGdprReadOnlySettingStatus().subscribe((settingStatus) => { this.gdprReadOnlySettingStatus = settingStatus; }); - } + } openCreateCustomerDialog() { - const dialogRef = this.dialog.open(CustomerCreateComponent, - { - data: { - gdprReadOnlySettingStatus: this.gdprReadOnlySettingStatus - }, - panelClass: 'vitamui-modal', - disableClose: true }); + const dialogRef = this.dialog.open(CustomerCreateComponent, { + data: { + gdprReadOnlySettingStatus: this.gdprReadOnlySettingStatus, + }, + panelClass: 'vitamui-modal', + disableClose: true, + }); dialogRef.afterClosed().subscribe((result) => { - if (result) { this.refreshList(); } + if (result) { + this.refreshList(); + } }); } @@ -97,7 +103,9 @@ export class CustomerComponent extends SidenavPage { } private refreshList() { - if (!this.customerListComponent) { return; } + if (!this.customerListComponent) { + return; + } this.customerListComponent.searchCustomersOrderedByCode(); } } diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer.data.service.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer.data.service.ts index f86764383b6..070659bdc2a 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer.data.service.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer.data.service.ts @@ -41,7 +41,6 @@ import { Tenant } from 'ui-frontend-common'; @Injectable() export class CustomerDataService { - private tenantsUpdatedSource = new BehaviorSubject([]); // tslint:disable-next-line: variable-name @@ -55,7 +54,7 @@ export class CustomerDataService { this._tenants = tenant; } - constructor() { } + constructor() {} addTenants(tenants: Tenant[]) { this._tenants = Array.from(new Set([...this.tenants, ...tenants])); @@ -73,5 +72,4 @@ export class CustomerDataService { get tenantsUpdated$(): Observable { return this.tenantsUpdatedSource.asObservable(); } - } diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer.module.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer.module.ts index 8589740a15f..731359b326f 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer.module.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer.module.ts @@ -73,21 +73,10 @@ import { TenantService } from './tenant.service'; OwnerCreateModule, TenantCreateModule, MatSidenavModule, - CustomerRoutingModule + CustomerRoutingModule, ], - declarations: [ - CustomerComponent, - CustomerPopupComponent - ], - exports: [ ], - providers: [ - CustomerResolver, - CustomerService, - CustomerDataService, - OwnerResolver, - OwnerService, - TenantResolver, - TenantService, - ] + declarations: [CustomerComponent, CustomerPopupComponent], + exports: [], + providers: [CustomerResolver, CustomerService, CustomerDataService, OwnerResolver, OwnerService, TenantResolver, TenantService], }) -export class CustomerModule { } +export class CustomerModule {} diff --git a/ui/ui-frontend/projects/identity/src/app/customer/owner-api.service.spec.ts b/ui/ui-frontend/projects/identity/src/app/customer/owner-api.service.spec.ts index a2a54d4f99f..d7b987b8357 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/owner-api.service.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/owner-api.service.spec.ts @@ -41,14 +41,12 @@ import { BASE_URL } from 'ui-frontend-common'; import { OwnerApiService } from './owner-api.service'; describe('OwnerApiService', () => { - beforeEach(() => TestBed.configureTestingModule({ - imports: [ - HttpClientTestingModule, - ], - providers: [ - { provide: BASE_URL, useValue: '/fake-api' }, - ] - })); + beforeEach(() => + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule], + providers: [{ provide: BASE_URL, useValue: '/fake-api' }], + }), + ); it('should be created', () => { const service: OwnerApiService = TestBed.inject(OwnerApiService); diff --git a/ui/ui-frontend/projects/identity/src/app/customer/owner-api.service.ts b/ui/ui-frontend/projects/identity/src/app/customer/owner-api.service.ts index 5ea045c2b46..fa89ceb20d4 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/owner-api.service.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/owner-api.service.ts @@ -41,10 +41,9 @@ import { Observable } from 'rxjs'; import { BaseHttpClient, BASE_URL, Owner } from 'ui-frontend-common'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class OwnerApiService extends BaseHttpClient { - constructor(http: HttpClient, @Inject(BASE_URL) baseUrl: string) { super(http, baseUrl + '/owners'); } @@ -53,7 +52,7 @@ export class OwnerApiService extends BaseHttpClient { return super.getOne(id); } - checkExistsByParam(params: Array<{ key: string, value: string }>): Observable { + checkExistsByParam(params: Array<{ key: string; value: string }>): Observable { return super.checkExistsByParam(params); } @@ -61,8 +60,7 @@ export class OwnerApiService extends BaseHttpClient { return super.create(owner); } - patch(partialOwner: { id: string, [key: string]: any }): Observable { + patch(partialOwner: { id: string; [key: string]: any }): Observable { return super.patch(partialOwner); } - } diff --git a/ui/ui-frontend/projects/identity/src/app/customer/owner-create/owner-create.component.html b/ui/ui-frontend/projects/identity/src/app/customer/owner-create/owner-create.component.html index deea2cd2885..03c30d814d1 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/owner-create/owner-create.component.html +++ b/ui/ui-frontend/projects/identity/src/app/customer/owner-create/owner-create.component.html @@ -2,18 +2,22 @@
      - +
      -
      {{'CUSTOMER.OWNER.CREATE.TITLE' | translate}} "{{data?.customer?.name}}"
      +
      {{ 'CUSTOMER.OWNER.CREATE.TITLE' | translate }} "{{ data?.customer?.name }}"
      - - - + + +
      @@ -22,20 +26,28 @@
      -
      {{'CUSTOMER.OWNER.MODAL.SAFE_TITLE' | translate}} "{{ownerForm?.value?.owner?.name}}"
      +
      {{ 'CUSTOMER.OWNER.MODAL.SAFE_TITLE' | translate }} "{{ ownerForm?.value?.owner?.name }}"
      - {{'COMMON.ERROR.REQUIRED' | translate}} - {{'CUSTOMER.OWNER.MODAL.NAME_ALREADY_EXIST' | translate}} + {{ + 'COMMON.ERROR.REQUIRED' | translate + }} + {{ + 'CUSTOMER.OWNER.MODAL.NAME_ALREADY_EXIST' | translate + }}
      - - + +
      diff --git a/ui/ui-frontend/projects/identity/src/app/customer/owner-create/owner-create.component.spec.ts b/ui/ui-frontend/projects/identity/src/app/customer/owner-create/owner-create.component.spec.ts index a0fbfe06c4d..c48e80649d9 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/owner-create/owner-create.component.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/owner-create/owner-create.component.spec.ts @@ -52,11 +52,13 @@ import { OwnerCreateComponent } from './owner-create.component'; @Component({ selector: 'app-owner-form', template: '', - providers: [{ - provide: NG_VALUE_ACCESSOR, - useExisting: forwardRef(() => OwnerFormStubComponent), - multi: true, - }] + providers: [ + { + provide: NG_VALUE_ACCESSOR, + useExisting: forwardRef(() => OwnerFormStubComponent), + multi: true, + }, + ], }) class OwnerFormStubComponent implements ControlValueAccessor { @Input() customerId: any; @@ -74,7 +76,7 @@ describe('OwnerCreateComponent', () => { beforeEach(waitForAsync(() => { owner = { id: '5ad5f14c894e6a414edc7b67', - identifier : '1', + identifier: '1', customerId: '5ad5f14c894e6a414edc7b6438c3dd882b4145bb8a8a240726d66d64c9e878bc', name: 'Mr Président', code: '02234512', @@ -83,30 +85,22 @@ describe('OwnerCreateComponent', () => { street: '22-30 Avenue de WAGRAM', zipCode: '75008', city: 'Paris', - country: 'France' + country: 'France', }, - readonly : false + readonly: false, }; const matDialogRefSpy = jasmine.createSpyObj('MatDialogRef', ['close']); const ownerServiceSpy = jasmine.createSpyObj('OwnerService', { create: of(owner) }); const ownerFormValidatorsSpy = jasmine.createSpyObj('OwnerFormValidators', { uniqueCode: () => of(null) }); const tenantFormValidatorsSpy = jasmine.createSpyObj('TenantFormValidators', { - uniqueName: () => of(null) + uniqueName: () => of(null), }); const tenantServiceSpy = jasmine.createSpyObj('TenantService', { create: of({}) }); TestBed.configureTestingModule({ - imports: [ - MatProgressBarModule, - ReactiveFormsModule, - NoopAnimationsModule, - VitamUICommonTestModule, - ], - declarations: [ - OwnerCreateComponent, - OwnerFormStubComponent, - ], + imports: [MatProgressBarModule, ReactiveFormsModule, NoopAnimationsModule, VitamUICommonTestModule], + declarations: [OwnerCreateComponent, OwnerFormStubComponent], providers: [ { provide: MatDialogRef, useValue: matDialogRefSpy }, { provide: MAT_DIALOG_DATA, useValue: { customer: { id: '42', name: 'OwnerName' } } }, @@ -116,16 +110,14 @@ describe('OwnerCreateComponent', () => { { provide: TenantService, useValue: tenantServiceSpy }, { provide: ConfirmDialogService, useValue: { listenToEscapeKeyPress: () => EMPTY } }, ], - schemas: [NO_ERRORS_SCHEMA] - }) - .compileComponents(); + schemas: [NO_ERRORS_SCHEMA], + }).compileComponents(); })); beforeEach(() => { fixture = TestBed.createComponent(OwnerCreateComponent); component = fixture.componentInstance; fixture.detectChanges(); - }); it('should create', () => { @@ -133,20 +125,20 @@ describe('OwnerCreateComponent', () => { }); it('should call dialogRef.close', () => { - const matDialogRef = TestBed.inject(MatDialogRef); + const matDialogRef = TestBed.inject(MatDialogRef); component.onCancel(); expect(matDialogRef.close).toHaveBeenCalledTimes(1); }); it('should not call ownerService.create()', () => { - const ownerService = TestBed.inject(OwnerService); + const ownerService = TestBed.inject(OwnerService); component.onOwnerSubmit(); expect(ownerService.create).toHaveBeenCalledTimes(0); }); it('should call ownerService.create()', () => { - const ownerService = TestBed.inject(OwnerService); - const matDialogRef = TestBed.inject(MatDialogRef); + const ownerService = TestBed.inject(OwnerService); + const matDialogRef = TestBed.inject(MatDialogRef); component.ownerForm.setValue({ owner }); component.onOwnerSubmit(); expect(ownerService.create).toHaveBeenCalledTimes(1); @@ -154,21 +146,21 @@ describe('OwnerCreateComponent', () => { }); it('should not call tenantService.create()', () => { - const tenantService = TestBed.inject(TenantService); + const tenantService = TestBed.inject(TenantService); component.onTenantSubmit(); expect(tenantService.create).not.toHaveBeenCalled(); }); it('should call tenantService.create()', () => { - const tenantService = TestBed.inject(TenantService); - const matDialogRef = TestBed.inject(MatDialogRef); + const tenantService = TestBed.inject(TenantService); + const matDialogRef = TestBed.inject(MatDialogRef); component.ownerForm.setValue({ owner }); const tenant = { name: 'tenant name', ownerId: owner.id, customerId: '42', enabled: true }; component.tenantForm.setValue(tenant); component.onTenantSubmit(); expect(tenantService.create).toHaveBeenCalledWith( { name: tenant.name, ownerId: tenant.ownerId, customerId: tenant.customerId, enabled: tenant.enabled }, - owner.name + owner.name, ); expect(matDialogRef.close).toHaveBeenCalledTimes(1); }); diff --git a/ui/ui-frontend/projects/identity/src/app/customer/owner-create/owner-create.component.ts b/ui/ui-frontend/projects/identity/src/app/customer/owner-create/owner-create.component.ts index 08267bc71d0..0e1e11c5a62 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/owner-create/owner-create.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/owner-create/owner-create.component.ts @@ -46,10 +46,9 @@ import { TenantService } from '../tenant.service'; @Component({ selector: 'app-owner-create', templateUrl: './owner-create.component.html', - styleUrls: ['./owner-create.component.scss'] + styleUrls: ['./owner-create.component.scss'], }) export class OwnerCreateComponent implements OnInit, OnDestroy { - public ownerForm: FormGroup; public tenantForm: FormGroup; public stepIndex = 0; @@ -63,22 +62,18 @@ export class OwnerCreateComponent implements OnInit, OnDestroy { private ownerService: OwnerService, private tenantService: TenantService, private tenantFormValidators: TenantFormValidators, - private confirmDialogService: ConfirmDialogService - ) { } + private confirmDialogService: ConfirmDialogService, + ) {} ngOnInit() { this.ownerForm = this.formBuilder.group({ - owner: [null, Validators.required] + owner: [null, Validators.required], }); this.tenantForm = this.formBuilder.group({ - name: [ - null, - [Validators.required], - this.tenantFormValidators.uniqueName(), - ], + name: [null, [Validators.required], this.tenantFormValidators.uniqueName()], ownerId: [null], customerId: [this.data.customer.id], - enabled: [true, Validators.required] + enabled: [true, Validators.required], }); this.keyPressSubscription = this.confirmDialogService.listenToEscapeKeyPress(this.dialogRef).subscribe(() => this.onCancel()); } @@ -96,17 +91,22 @@ export class OwnerCreateComponent implements OnInit, OnDestroy { } onOwnerSubmit() { - if (this.ownerForm.pending || this.ownerForm.invalid) { return; } + if (this.ownerForm.pending || this.ownerForm.invalid) { + return; + } this.ownerService.create(this.ownerForm.value.owner).subscribe( (newOwner: Owner) => this.dialogRef.close({ owner: newOwner }), (error) => { // TODO console.error(error); - }); + }, + ); } onTenantSubmit() { - if (this.ownerForm.pending || this.ownerForm.invalid || this.tenantForm.pending || this.tenantForm.invalid) { return; } + if (this.ownerForm.pending || this.ownerForm.invalid || this.tenantForm.pending || this.tenantForm.invalid) { + return; + } this.ownerService.create(this.ownerForm.value.owner).subscribe( (newOwner) => { this.tenantForm.get('ownerId').setValue(newOwner.id); @@ -117,13 +117,13 @@ export class OwnerCreateComponent implements OnInit, OnDestroy { (error) => { console.error(error); this.dialogRef.close(); - } + }, ); }, (error) => { // TODO console.error(error); - }); + }, + ); } - } diff --git a/ui/ui-frontend/projects/identity/src/app/customer/owner-create/owner-create.module.ts b/ui/ui-frontend/projects/identity/src/app/customer/owner-create/owner-create.module.ts index d233f89cc69..d3942c06a82 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/owner-create/owner-create.module.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/owner-create/owner-create.module.ts @@ -44,14 +44,8 @@ import { OwnerFormModule } from '../owner-form/owner-form.module'; import { OwnerCreateComponent } from './owner-create.component'; @NgModule({ - imports: [ - CommonModule, - MatProgressBarModule, - ReactiveFormsModule, - OwnerFormModule, - VitamUICommonModule, - ], + imports: [CommonModule, MatProgressBarModule, ReactiveFormsModule, OwnerFormModule, VitamUICommonModule], declarations: [OwnerCreateComponent], entryComponents: [OwnerCreateComponent], }) -export class OwnerCreateModule { } +export class OwnerCreateModule {} diff --git a/ui/ui-frontend/projects/identity/src/app/customer/owner-form/owner-form.component.html b/ui/ui-frontend/projects/identity/src/app/customer/owner-form/owner-form.component.html index 0792900aa76..a7716c5752d 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/owner-form/owner-form.component.html +++ b/ui/ui-frontend/projects/identity/src/app/customer/owner-form/owner-form.component.html @@ -1,33 +1,72 @@ - {{'COMMON.ERROR.REQUIRED' | translate}} - {{ 'COMMON.ERROR.WRONG_FORMAT' | translate }} - {{ 'COMMON.ERROR.STRING_MAX_LENGTH' | translate: { max: ownerCodeMaxLength } }} - {{'CUSTOMER.OWNER.MODAL.CODE_ALREADY_EXIST' | translate}} + {{ + 'COMMON.ERROR.REQUIRED' | translate + }} + {{ + 'COMMON.ERROR.WRONG_FORMAT' | translate + }} + {{ + 'COMMON.ERROR.STRING_MAX_LENGTH' | translate: { max: ownerCodeMaxLength } + }} + {{ + 'CUSTOMER.OWNER.MODAL.CODE_ALREADY_EXIST' | translate + }}
      - - {{'COMMON.ERROR.REQUIRED' | translate}} + + {{ + 'COMMON.ERROR.REQUIRED' | translate + }} - - {{'COMMON.ERROR.REQUIRED' | translate}} + + {{ + 'COMMON.ERROR.REQUIRED' | translate + }}
      - +
      - - + + - {{country.name}} + {{ country.name }}
      @@ -38,5 +77,10 @@
      - + diff --git a/ui/ui-frontend/projects/identity/src/app/customer/owner-form/owner-form.component.spec.ts b/ui/ui-frontend/projects/identity/src/app/customer/owner-form/owner-form.component.spec.ts index 1ef3faa8443..2091911a513 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/owner-form/owner-form.component.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/owner-form/owner-form.component.spec.ts @@ -1,4 +1,3 @@ - /* * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2020) * and the signatories of the "VITAM - Accord du Contributeur" agreement. @@ -36,7 +35,6 @@ * knowledge of the CeCILL-C license and that you accept its terms. */ - import { HttpClientTestingModule } from '@angular/common/http/testing'; import { Component, ViewChild } from '@angular/core'; import { ComponentFixture, fakeAsync, TestBed, tick, waitForAsync } from '@angular/core/testing'; @@ -52,7 +50,7 @@ import { OwnerService } from '../owner.service'; import { OwnerFormComponent } from './owner-form.component'; import { OwnerFormValidators } from './owner-form.validators'; -@Component({ template: `` }) +@Component({ template: `` }) class TesthostComponent { owner: Owner = null; customerId = '4242'; @@ -66,7 +64,7 @@ describe('OwnerFormComponent', () => { beforeEach(waitForAsync(() => { const ownerServiceSpy = jasmine.createSpyObj('OwnerService', { create: of({}) }); const ownerFormValidatorsSpy = jasmine.createSpyObj('OwnerFormValidators', { - uniqueCode: () => timer(10).pipe(map(() => null)) + uniqueCode: () => timer(10).pipe(map(() => null)), }); TestBed.configureTestingModule({ @@ -79,17 +77,16 @@ describe('OwnerFormComponent', () => { HttpClientTestingModule, LoggerModule.forRoot(), ], - declarations: [ OwnerFormComponent, TesthostComponent ], + declarations: [OwnerFormComponent, TesthostComponent], providers: [ { provide: WINDOW_LOCATION, useValue: window.location }, { provide: BASE_URL, useValue: '/fake-api' }, { provide: OwnerService, useValue: ownerServiceSpy }, { provide: OwnerFormValidators, useValue: ownerFormValidatorsSpy }, - { provide: StartupService, useValue: { getConfigNumberValue: () => 100 }}, + { provide: StartupService, useValue: { getConfigNumberValue: () => 100 } }, { provide: CountryService, useValue: { getAvailableCountries: () => EMPTY } }, - ] - }) - .compileComponents(); + ], + }).compileComponents(); })); beforeEach(() => { @@ -118,10 +115,10 @@ describe('OwnerFormComponent', () => { street: 'Street name', zipCode: '2134', city: 'Paris', - country: 'FR' + country: 'FR', }, internalCode: null, - readonly : false + readonly: false, }; testhost.ownerFormComponent.form.get('code').setValue(owner.code); @@ -147,9 +144,9 @@ describe('OwnerFormComponent', () => { street: 'Street name', zipCode: '2134', city: 'Paris', - country: 'FR' + country: 'FR', }, - readonly : false + readonly: false, }; testhost.ownerFormComponent.form.get('code').setValue(owner.code); @@ -180,10 +177,10 @@ describe('OwnerFormComponent', () => { street: 'Street name', zipCode: '2134', city: 'Paris', - country: 'FR' + country: 'FR', }, internalCode: null, - readonly : false + readonly: false, }; testhost.ownerFormComponent.form.get('code').setValue(owner.code); diff --git a/ui/ui-frontend/projects/identity/src/app/customer/owner-form/owner-form.component.ts b/ui/ui-frontend/projects/identity/src/app/customer/owner-form/owner-form.component.ts index 87468ebb6df..ed1bec65fc0 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/owner-form/owner-form.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/owner-form/owner-form.component.ts @@ -47,14 +47,14 @@ import { ALPHA_NUMERIC_REGEX, OwnerFormValidators, OWNER_CODE_MAX_LENGTH } from export const OWNER_FORM_VALUE_ACCESSOR: any = { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => OwnerFormComponent), - multi: true + multi: true, }; @Component({ selector: 'app-owner-form', templateUrl: './owner-form.component.html', styleUrls: ['./owner-form.component.scss'], - providers: [OWNER_FORM_VALUE_ACCESSOR] + providers: [OWNER_FORM_VALUE_ACCESSOR], }) export class OwnerFormComponent implements ControlValueAccessor, OnDestroy, OnInit { public form: FormGroup; @@ -67,11 +67,15 @@ export class OwnerFormComponent implements ControlValueAccessor, OnDestroy, OnIn @Input() set customerId(customerId: string) { this._customerId = customerId; - if (!this.form) { return; } + if (!this.form) { + return; + } this.form.get('customerId').setValue(customerId); } - get customerId() { return this._customerId; } + get customerId() { + return this._customerId; + } // tslint:disable-next-line:variable-name private _customerId: string; @@ -81,14 +85,16 @@ export class OwnerFormComponent implements ControlValueAccessor, OnDestroy, OnIn this._customerInfo = customerInfo; if (customerInfo && this.form) { this.form.patchValue({ - code: customerInfo.code, - name: customerInfo.name, - companyName: customerInfo.companyName, - }); + code: customerInfo.code, + name: customerInfo.name, + companyName: customerInfo.companyName, + }); } } - get customerInfo() { return this._customerInfo; } + get customerInfo() { + return this._customerInfo; + } // tslint:disable-next-line:variable-name private _customerInfo: any; @@ -96,7 +102,7 @@ export class OwnerFormComponent implements ControlValueAccessor, OnDestroy, OnIn private formBuilder: FormBuilder, private ownerFormValidators: OwnerFormValidators, private countryService: CountryService, - private startupService: StartupService + private startupService: StartupService, ) { this.maxStreetLength = this.startupService.getConfigNumberValue('MAX_STREET_LENGTH'); this.form = this.formBuilder.group({ @@ -117,7 +123,7 @@ export class OwnerFormComponent implements ControlValueAccessor, OnDestroy, OnIn city: null, country: 'FR', }), - readonly: false + readonly: false, }); } @@ -139,20 +145,22 @@ export class OwnerFormComponent implements ControlValueAccessor, OnDestroy, OnIn writeValue(owner: Owner) { this.sub.unsubscribe(); - this.form.reset(owner || { - customerId: this.customerId, - code: null, - name: null, - companyName: null, - internalCode: null, - address: { - street: null, - zipCode: null, - city: null, - country: 'FR' + this.form.reset( + owner || { + customerId: this.customerId, + code: null, + name: null, + companyName: null, + internalCode: null, + address: { + street: null, + zipCode: null, + city: null, + country: 'FR', + }, + readonly: false, }, - readonly: false - }); + ); this.subscribeToValueChanges(); } @@ -168,10 +176,9 @@ export class OwnerFormComponent implements ControlValueAccessor, OnDestroy, OnIn subscribeToValueChanges() { this.sub = merge(this.form.statusChanges, this.form.valueChanges) .pipe( - map(() => this.form.pending || this.form.invalid ? null : this.form.value), - distinctUntilChanged() + map(() => (this.form.pending || this.form.invalid ? null : this.form.value)), + distinctUntilChanged(), ) .subscribe((value) => this.onChange(value)); } - } diff --git a/ui/ui-frontend/projects/identity/src/app/customer/owner-form/owner-form.module.ts b/ui/ui-frontend/projects/identity/src/app/customer/owner-form/owner-form.module.ts index 37796f06dd9..6a833ce0197 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/owner-form/owner-form.module.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/owner-form/owner-form.module.ts @@ -46,15 +46,9 @@ import { OwnerFormComponent } from './owner-form.component'; import { OwnerFormValidators } from './owner-form.validators'; @NgModule({ - imports: [ - CommonModule, - MatFormFieldModule, - MatSelectModule, - ReactiveFormsModule, - VitamUICommonModule, - ], + imports: [CommonModule, MatFormFieldModule, MatSelectModule, ReactiveFormsModule, VitamUICommonModule], declarations: [OwnerFormComponent], exports: [OwnerFormComponent], - providers: [OwnerFormValidators, TenantFormValidators] + providers: [OwnerFormValidators, TenantFormValidators], }) -export class OwnerFormModule { } +export class OwnerFormModule {} diff --git a/ui/ui-frontend/projects/identity/src/app/customer/owner-form/owner-form.validators.spec.ts b/ui/ui-frontend/projects/identity/src/app/customer/owner-form/owner-form.validators.spec.ts index b23401f5c8c..b456e7a4a72 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/owner-form/owner-form.validators.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/owner-form/owner-form.validators.spec.ts @@ -38,13 +38,13 @@ import { ɵisObservable as isObservable, ɵisPromise as isPromise } from '@angular/core'; import { fakeAsync, tick } from '@angular/core/testing'; import { FormControl } from '@angular/forms'; -import { from, Observable, of } from 'rxjs'; +import { from, Observable, of } from 'rxjs'; import { OwnerFormValidators } from './owner-form.validators'; function toObservable(r: any): Observable { const obs = isPromise(r) ? from(r) : r; - if (!(isObservable(obs))) { + if (!isObservable(obs)) { throw new Error(`Expected validator to return Promise or Observable.`); } @@ -52,7 +52,6 @@ function toObservable(r: any): Observable { } describe('Owner Form Validators', () => { - it('should return null', fakeAsync(() => { const ownerServiceSpy = jasmine.createSpyObj('OwnerService', ['exists']); ownerServiceSpy.exists.and.returnValue(of(false)); @@ -96,5 +95,4 @@ describe('Owner Form Validators', () => { tick(400); expect(ownerServiceSpy.exists).toHaveBeenCalledWith('111111'); })); - }); diff --git a/ui/ui-frontend/projects/identity/src/app/customer/owner-form/owner-form.validators.ts b/ui/ui-frontend/projects/identity/src/app/customer/owner-form/owner-form.validators.ts index 08da620a5ea..a5483753c01 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/owner-form/owner-form.validators.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/owner-form/owner-form.validators.ts @@ -36,7 +36,7 @@ */ import { Injectable } from '@angular/core'; import { AbstractControl, AsyncValidatorFn } from '@angular/forms'; -import { of , timer } from 'rxjs'; +import { of, timer } from 'rxjs'; import { map, switchMap, take } from 'rxjs/operators'; import { OwnerService } from '../owner.service'; @@ -46,20 +46,17 @@ export const ALPHA_NUMERIC_REGEX = /^[a-zA-Z0-9]*$/; @Injectable() export class OwnerFormValidators { + private debounceTime = 400; - private debounceTime = 400; - - constructor(private ownerService: OwnerService) {} - - uniqueCode = (codeToIgnore?: string): AsyncValidatorFn => { - return (control: AbstractControl) => { - return timer(this.debounceTime) - .pipe( - switchMap(() => control.value !== codeToIgnore ? this.ownerService.exists(control.value) : of(false)), - take(1), - map((exists: boolean) => exists ? { uniqueCode: true } : null) - ); - }; - } + constructor(private ownerService: OwnerService) {} + uniqueCode = (codeToIgnore?: string): AsyncValidatorFn => { + return (control: AbstractControl) => { + return timer(this.debounceTime).pipe( + switchMap(() => (control.value !== codeToIgnore ? this.ownerService.exists(control.value) : of(false))), + take(1), + map((exists: boolean) => (exists ? { uniqueCode: true } : null)), + ); + }; + }; } diff --git a/ui/ui-frontend/projects/identity/src/app/customer/owner-preview/information-tab/information-tab.component.html b/ui/ui-frontend/projects/identity/src/app/customer/owner-preview/information-tab/information-tab.component.html index 0b46ed51cbd..b85a97e708e 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/owner-preview/information-tab/information-tab.component.html +++ b/ui/ui-frontend/projects/identity/src/app/customer/owner-preview/information-tab/information-tab.component.html @@ -1,34 +1,56 @@
      - - {{'COMMON.ERROR.REQUIRED' | translate}} + + {{ 'COMMON.ERROR.REQUIRED' | translate }} {{ 'COMMON.ERROR.WRONG_FORMAT' | translate }} - {{ 'COMMON.ERROR.STRING_MAX_LENGTH' | translate: { max: ownerCodeMaxLength } }} - {{'CUSTOMER.OWNER.MODAL.CODE_ALREADY_EXIST' | translate}} + {{ + 'COMMON.ERROR.STRING_MAX_LENGTH' | translate: { max: ownerCodeMaxLength } + }} + {{ + 'CUSTOMER.OWNER.MODAL.CODE_ALREADY_EXIST' | translate + }}
      - +
      - - {{'COMMON.ERROR.REQUIRED' | translate}} + + {{ 'COMMON.ERROR.REQUIRED' | translate }}
      - - {{'COMMON.ERROR.REQUIRED' | translate}} + [asyncValidator]="ownerForm?.get('companyName')?.asyncValidator" + > + {{ 'COMMON.ERROR.REQUIRED' | translate }}
      @@ -36,8 +58,11 @@
      - +
      @@ -77,50 +102,65 @@
      - -
      {{tenant?.identifier}}
      + +
      {{ tenant?.identifier }}
      - - {{'COMMON.ERROR.REQUIRED' | translate}} + + {{ 'COMMON.ERROR.REQUIRED' | translate }} - {{'CUSTOMER.OWNER.MODAL.NAME_ALREADY_EXIST' | translate}} + {{ 'CUSTOMER.OWNER.MODAL.NAME_ALREADY_EXIST' | translate }}
      - + [asyncValidator]="tenantForm?.get('accessContractHoldingIdentifier')?.asyncValidator" + >
      - + [asyncValidator]="tenantForm?.get('ingestContractHoldingIdentifier')?.asyncValidator" + >
      - + [asyncValidator]="tenantForm?.get('accessContractLogbookIdentifier')?.asyncValidator" + >
      - + [asyncValidator]="tenantForm?.get('itemIngestContractIdentifier')?.asyncValidator" + >
      diff --git a/ui/ui-frontend/projects/identity/src/app/customer/owner-preview/information-tab/information-tab.component.scss b/ui/ui-frontend/projects/identity/src/app/customer/owner-preview/information-tab/information-tab.component.scss index b050fa8fce7..3742fca53e6 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/owner-preview/information-tab/information-tab.component.scss +++ b/ui/ui-frontend/projects/identity/src/app/customer/owner-preview/information-tab/information-tab.component.scss @@ -1,3 +1,3 @@ .mat-divider { - margin-bottom: 20px; + margin-bottom: 20px; } diff --git a/ui/ui-frontend/projects/identity/src/app/customer/owner-preview/information-tab/information-tab.component.spec.ts b/ui/ui-frontend/projects/identity/src/app/customer/owner-preview/information-tab/information-tab.component.spec.ts index cc323f922d2..f496902c6c5 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/owner-preview/information-tab/information-tab.component.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/owner-preview/information-tab/information-tab.component.spec.ts @@ -61,10 +61,10 @@ const expectedOwner: Owner = { street: '73 rue du Faubourg Poissonnière ', zipCode: '75009', city: 'Paris', - country: 'France' + country: 'France', }, internalCode: '1', - readonly : false + readonly: false, }; const expectedTenant: Tenant = { @@ -75,16 +75,16 @@ const expectedTenant: Tenant = { identifier: 7, enabled: true, proof: true, - readonly : false, + readonly: false, accessContractHoldingIdentifier: 'AC-000001', accessContractLogbookIdentifier: 'AC-000002', ingestContractHoldingIdentifier: 'IC-000001', - itemIngestContractIdentifier: 'IC-000001' + itemIngestContractIdentifier: 'IC-000001', }; const owner = { id: '5ad5f14c894e6a414edc7b62', - identifier : '5ad5f14c894e6a414edc7b62', + identifier: '5ad5f14c894e6a414edc7b62', customerId: '42', name: 'Emmanuel Deviller', code: '10234501', @@ -93,20 +93,14 @@ const owner = { street: '73 rue du Faubourg Poissonnière ', zipCode: '75009', city: 'Paris', - country: 'France' + country: 'France', }, internalCode: '1', - readonly : false + readonly: false, }; @Component({ - template: ` - - ` + template: ` `, }) class TestHostComponent { tenant: Tenant; @@ -124,11 +118,11 @@ describe('Owner InformationTabComponent', () => { const ownerServiceSpy = { get: () => of(owner), patch: () => of(owner), - updated: new Subject() + updated: new Subject(), }; const ownerFormValidatorsSpy = jasmine.createSpyObj('OwnerFormValidators', { uniqueCode: () => of(null) }); const tenantFormValidatorsSpy = jasmine.createSpyObj('TenantFormValidators', { - uniqueName: () => of(null) + uniqueName: () => of(null), }); TestBed.configureTestingModule({ @@ -138,12 +132,9 @@ describe('Owner InformationTabComponent', () => { NoopAnimationsModule, VitamUICommonTestModule, HttpClientTestingModule, - LoggerModule.forRoot() - ], - declarations: [ - TestHostComponent, - InformationTabComponent, + LoggerModule.forRoot(), ], + declarations: [TestHostComponent, InformationTabComponent], providers: [ { provide: WINDOW_LOCATION, useValue: window.location }, { provide: BASE_URL, useValue: '/fake-api' }, @@ -151,13 +142,11 @@ describe('Owner InformationTabComponent', () => { { provide: OwnerFormValidators, useValue: ownerFormValidatorsSpy }, { provide: TenantFormValidators, useValue: tenantFormValidatorsSpy }, { provide: TenantService, useValue: { patch: () => of(expectedTenant) } }, - { provide: StartupService, useValue: { getConfigNumberValue: () => 100 }}, + { provide: StartupService, useValue: { getConfigNumberValue: () => 100 } }, { provide: VitamUISnackBarService, useValue: { instant: () => EMPTY } }, { provide: CountryService, useValue: { getAvailableCountries: () => EMPTY } }, - - ] - }) - .compileComponents(); + ], + }).compileComponents(); })); beforeEach(() => { @@ -199,9 +188,9 @@ describe('Owner InformationTabComponent', () => { street: null, zipCode: null, city: null, - country: null + country: null, }, - internalCode: null + internalCode: null, }); expect(testhost.component.ownerForm.get('id').valid).toBeFalsy('id'); expect(testhost.component.ownerForm.get('customerId').valid).toBeFalsy('customerId'); @@ -245,7 +234,7 @@ describe('Owner InformationTabComponent', () => { city: expectedOwner.address.city, country: expectedOwner.address.country, }, - internalCode: expectedOwner.internalCode + internalCode: expectedOwner.internalCode, }); expect(testhost.component.ownerForm.valid).toBeTruthy(); }); @@ -277,7 +266,7 @@ describe('Owner InformationTabComponent', () => { ingestContractHoldingIdentifier: null, itemIngestContractIdentifier: null, accessContractHoldingIdentifier: null, - accessContractLogbookIdentifier: null + accessContractLogbookIdentifier: null, }); expect(testhost.component.tenantForm.get('id').valid).toBeFalsy('id'); expect(testhost.component.tenantForm.get('customerId').valid).toBeFalsy('customerId'); @@ -298,10 +287,9 @@ describe('Owner InformationTabComponent', () => { ingestContractHoldingIdentifier: expectedTenant.ingestContractHoldingIdentifier, itemIngestContractIdentifier: expectedTenant.itemIngestContractIdentifier, accessContractHoldingIdentifier: expectedTenant.accessContractHoldingIdentifier, - accessContractLogbookIdentifier: expectedTenant.accessContractLogbookIdentifier + accessContractLogbookIdentifier: expectedTenant.accessContractLogbookIdentifier, }); expect(testhost.component.tenantForm.valid).toBeTruthy(); }); - }); }); diff --git a/ui/ui-frontend/projects/identity/src/app/customer/owner-preview/information-tab/information-tab.component.ts b/ui/ui-frontend/projects/identity/src/app/customer/owner-preview/information-tab/information-tab.component.ts index 9fc748030ae..ee75c5d17a2 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/owner-preview/information-tab/information-tab.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/owner-preview/information-tab/information-tab.component.ts @@ -99,7 +99,7 @@ export class InformationTabComponent implements OnChanges, OnInit { private tenantService: TenantService, private tenantFormValidators: TenantFormValidators, private countryService: CountryService, - private startupService: StartupService + private startupService: StartupService, ) { this.maxStreetLength = this.startupService.getConfigNumberValue('MAX_STREET_LENGTH'); this.ownerForm = this.formBuilder.group({ @@ -143,7 +143,7 @@ export class InformationTabComponent implements OnChanges, OnInit { map(() => diff(this.ownerForm.value, this.previousOwner)), filter((formData) => !isEmpty(formData)), map((formData) => extend({ id: this.owner.id }, formData)), - switchMap((formData) => this.ownerService.patch(formData).pipe(catchError(() => of(null)))) + switchMap((formData) => this.ownerService.patch(formData).pipe(catchError(() => of(null)))), ) .subscribe((owner: Owner) => this.resetOwnerForm(owner)); @@ -153,7 +153,7 @@ export class InformationTabComponent implements OnChanges, OnInit { map(() => diff(this.tenantForm.value, this.previousTenant)), filter((formData) => !isEmpty(formData)), map((formData) => extend({ id: this.tenant.id }, formData)), - switchMap((formData) => this.tenantService.patch(formData, this.ownerForm.value.name).pipe(catchError(() => of(null)))) + switchMap((formData) => this.tenantService.patch(formData, this.ownerForm.value.name).pipe(catchError(() => of(null)))), ) .subscribe((tenant: Tenant) => { this.resetTenantForm(tenant); diff --git a/ui/ui-frontend/projects/identity/src/app/customer/owner-preview/owner-operation-history-tab/owner-operation-history-tab.component.html b/ui/ui-frontend/projects/identity/src/app/customer/owner-preview/owner-operation-history-tab/owner-operation-history-tab.component.html index dc79556b1b4..71a77723060 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/owner-preview/owner-operation-history-tab/owner-operation-history-tab.component.html +++ b/ui/ui-frontend/projects/identity/src/app/customer/owner-preview/owner-operation-history-tab/owner-operation-history-tab.component.html @@ -1,9 +1,9 @@
      -
      {{'COMMON.HISTORY.NO_HISTORY' | translate}}
      +
      {{ 'COMMON.HISTORY.NO_HISTORY' | translate }}
      - +
      diff --git a/ui/ui-frontend/projects/identity/src/app/customer/owner-preview/owner-operation-history-tab/owner-operation-history-tab.component.spec.ts b/ui/ui-frontend/projects/identity/src/app/customer/owner-preview/owner-operation-history-tab/owner-operation-history-tab.component.spec.ts index b116cc88072..5f49f4d83bd 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/owner-preview/owner-operation-history-tab/owner-operation-history-tab.component.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/owner-preview/owner-operation-history-tab/owner-operation-history-tab.component.spec.ts @@ -36,8 +36,8 @@ */ import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; -import {NO_ERRORS_SCHEMA} from '@angular/core'; -import {AuthService, LogbookService} from 'ui-frontend-common'; +import { NO_ERRORS_SCHEMA } from '@angular/core'; +import { AuthService, LogbookService } from 'ui-frontend-common'; import { VitamUICommonTestModule } from 'ui-frontend-common/testing'; import { OwnerOperationHistoryTabComponent } from './owner-operation-history-tab.component'; @@ -48,14 +48,13 @@ describe('OwnerOperationHistoryTabComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [VitamUICommonTestModule], - declarations: [ OwnerOperationHistoryTabComponent ], + declarations: [OwnerOperationHistoryTabComponent], providers: [ - { provide: AuthService, useValue: {}}, - { provide: LogbookService, useValue: {}}, + { provide: AuthService, useValue: {} }, + { provide: LogbookService, useValue: {} }, ], schemas: [NO_ERRORS_SCHEMA], - }) - .compileComponents(); + }).compileComponents(); })); beforeEach(() => { diff --git a/ui/ui-frontend/projects/identity/src/app/customer/owner-preview/owner-operation-history-tab/owner-operation-history-tab.component.ts b/ui/ui-frontend/projects/identity/src/app/customer/owner-preview/owner-operation-history-tab/owner-operation-history-tab.component.ts index a3382f2c16f..43d7d24c459 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/owner-preview/owner-operation-history-tab/owner-operation-history-tab.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/owner-preview/owner-operation-history-tab/owner-operation-history-tab.component.ts @@ -34,17 +34,16 @@ * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ -import {Component, Input, OnChanges, SimpleChanges} from '@angular/core'; +import { Component, Input, OnChanges, SimpleChanges } from '@angular/core'; import { AuthService, Event, LogbookService } from 'ui-frontend-common'; const EVENT_LIMIT = 100; @Component({ selector: 'app-owner-operation-history-tab', templateUrl: './owner-operation-history-tab.component.html', - styleUrls: ['./owner-operation-history-tab.component.scss'] + styleUrls: ['./owner-operation-history-tab.component.scss'], }) export class OwnerOperationHistoryTabComponent implements OnChanges { - @Input() id: string; @Input() identifier: string; @Input() externalParamId: string; @@ -53,11 +52,14 @@ export class OwnerOperationHistoryTabComponent implements OnChanges { events: Event[] = []; loading = false; - constructor(private authService: AuthService, private logbookService: LogbookService) { } + constructor( + private authService: AuthService, + private logbookService: LogbookService, + ) {} ngOnChanges(changes: SimpleChanges) { if (changes.hasOwnProperty('id') || changes.hasOwnProperty('externalParamId')) { - if (this.id && this.externalParamId ) { + if (this.id && this.externalParamId) { this.initEvent(); } } @@ -72,10 +74,9 @@ export class OwnerOperationHistoryTabComponent implements OnChanges { this.logbookService.listHistoryForOwner(this.id, this.identifier, this.externalParamId, tenantIdentifier).subscribe( (results) => { this.loading = false; - this.events = results.filter((event) => this.filter ? this.filter(event) : true).slice(0, EVENT_LIMIT); + this.events = results.filter((event) => (this.filter ? this.filter(event) : true)).slice(0, EVENT_LIMIT); }, - () => this.loading = false + () => (this.loading = false), ); } - } diff --git a/ui/ui-frontend/projects/identity/src/app/customer/owner-preview/owner-popup.component.ts b/ui/ui-frontend/projects/identity/src/app/customer/owner-preview/owner-popup.component.ts index 40fabf3d859..055adb089b7 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/owner-preview/owner-popup.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/owner-preview/owner-popup.component.ts @@ -42,30 +42,30 @@ import { OwnerService } from '../owner.service'; @Component({ selector: 'app-owner-popup', - template: '' + template: '', }) export class OwnerPopupComponent implements OnInit { - owner: Owner; tenant: Tenant; - constructor(private route: ActivatedRoute, private ownerService: OwnerService) { + constructor( + private route: ActivatedRoute, + private ownerService: OwnerService, + ) { if (this.route.snapshot.data.tenant) { this.tenant = this.route.snapshot.data.tenant; this.owner = this.route.snapshot.data.owner; if (!this.owner) { - this.ownerService.get(this.tenant.ownerId).subscribe((owner) => this.owner = owner); + this.ownerService.get(this.tenant.ownerId).subscribe((owner) => (this.owner = owner)); } } else { this.owner = this.route.snapshot.data.owner; } } - ngOnInit() { - } + ngOnInit() {} closePopup() { window.close(); } - } diff --git a/ui/ui-frontend/projects/identity/src/app/customer/owner-preview/owner-preview.component.html b/ui/ui-frontend/projects/identity/src/app/customer/owner-preview/owner-preview.component.html index 91a756c2646..1919592c75e 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/owner-preview/owner-preview.component.html +++ b/ui/ui-frontend/projects/identity/src/app/customer/owner-preview/owner-preview.component.html @@ -1,18 +1,28 @@ + (onclose)="emitClose()" +>
      - + - + -
      \ No newline at end of file +
      diff --git a/ui/ui-frontend/projects/identity/src/app/customer/owner-preview/owner-preview.component.spec.ts b/ui/ui-frontend/projects/identity/src/app/customer/owner-preview/owner-preview.component.spec.ts index 88703f29852..0631ed046f8 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/owner-preview/owner-preview.component.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/owner-preview/owner-preview.component.spec.ts @@ -68,19 +68,18 @@ describe('OwnerPreviewComponent', () => { NoopAnimationsModule, HttpClientTestingModule, LoggerModule.forRoot(), - VitamUICommonTestModule + VitamUICommonTestModule, ], - declarations: [ OwnerPreviewComponent, InformationTabStubComponent ], + declarations: [OwnerPreviewComponent, InformationTabStubComponent], providers: [ { provide: WINDOW_LOCATION, useValue: {} }, { provide: BASE_URL, useValue: '/fake-api' }, { provide: ENVIRONMENT, useValue: environment }, { provide: TranslateService, useValue: { instant: () => EMPTY } }, - { provide: VitamUISnackBarService, useValue: { instant: () => EMPTY } } + { provide: VitamUISnackBarService, useValue: { instant: () => EMPTY } }, ], - schemas: [NO_ERRORS_SCHEMA] - }) - .compileComponents(); + schemas: [NO_ERRORS_SCHEMA], + }).compileComponents(); })); beforeEach(() => { @@ -92,5 +91,4 @@ describe('OwnerPreviewComponent', () => { it('should create', () => { expect(component).toBeTruthy(); }); - }); diff --git a/ui/ui-frontend/projects/identity/src/app/customer/owner-preview/owner-preview.component.ts b/ui/ui-frontend/projects/identity/src/app/customer/owner-preview/owner-preview.component.ts index f435b790585..48bc06d7613 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/owner-preview/owner-preview.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/owner-preview/owner-preview.component.ts @@ -41,10 +41,9 @@ import { Owner, StartupService, Tenant } from 'ui-frontend-common'; @Component({ selector: 'app-owner-preview', templateUrl: './owner-preview.component.html', - styleUrls: ['./owner-preview.component.scss'] + styleUrls: ['./owner-preview.component.scss'], }) export class OwnerPreviewComponent { - @Input() owner: Owner; @Input() tenant: Tenant; @Input() isPopup: boolean; @@ -54,8 +53,11 @@ export class OwnerPreviewComponent { openPopup() { const url = this.tenant ? '/customer/tenant/' + this.tenant.id : '/customer/owner/' + this.owner.id; - window.open(this.startupService.getConfigStringValue('UI_URL') - + url, 'detailPopup', 'width=584, height=713, resizable=no, location=no'); + window.open( + this.startupService.getConfigStringValue('UI_URL') + url, + 'detailPopup', + 'width=584, height=713, resizable=no, location=no', + ); this.emitClose(); } @@ -64,13 +66,12 @@ export class OwnerPreviewComponent { } filterEvents(event: any): boolean { - - return event.outDetail && ( - event.outDetail.includes('EXT_VITAMUI_UPDATE_OWNER') || - event.outDetail.includes('EXT_VITAMUI_CREATE_OWNER') || - event.outDetail.includes('EXT_VITAMUI_CREATE_TENANT') || - event.outDetail.includes('EXT_VITAMUI_UPDATE_TENANT') + return ( + event.outDetail && + (event.outDetail.includes('EXT_VITAMUI_UPDATE_OWNER') || + event.outDetail.includes('EXT_VITAMUI_CREATE_OWNER') || + event.outDetail.includes('EXT_VITAMUI_CREATE_TENANT') || + event.outDetail.includes('EXT_VITAMUI_UPDATE_TENANT')) ); } - } diff --git a/ui/ui-frontend/projects/identity/src/app/customer/owner-preview/owner-preview.module.ts b/ui/ui-frontend/projects/identity/src/app/customer/owner-preview/owner-preview.module.ts index 177a78b8aac..fff533776ca 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/owner-preview/owner-preview.module.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/owner-preview/owner-preview.module.ts @@ -48,7 +48,7 @@ import { InformationTabComponent } from './information-tab/information-tab.compo import { OwnerPopupComponent } from './owner-popup.component'; import { OwnerPreviewComponent } from './owner-preview.component'; -import {MatProgressSpinnerModule} from '@angular/material/progress-spinner'; +import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; import { OwnerOperationHistoryTabComponent } from './owner-operation-history-tab/owner-operation-history-tab.component'; @NgModule({ @@ -64,6 +64,6 @@ import { OwnerOperationHistoryTabComponent } from './owner-operation-history-tab ], declarations: [OwnerPopupComponent, OwnerPreviewComponent, InformationTabComponent, OwnerOperationHistoryTabComponent], exports: [OwnerPopupComponent, OwnerPreviewComponent], - providers: [TenantFormValidators] + providers: [TenantFormValidators], }) -export class OwnerPreviewModule { } +export class OwnerPreviewModule {} diff --git a/ui/ui-frontend/projects/identity/src/app/customer/owner-resolver.service.spec.ts b/ui/ui-frontend/projects/identity/src/app/customer/owner-resolver.service.spec.ts index cdfd22bdd0c..02ed638b4c3 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/owner-resolver.service.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/owner-resolver.service.spec.ts @@ -45,7 +45,7 @@ import { OwnerService } from './owner.service'; const expectedOwner: Owner = { id: '5ad5f14c894e6a414edc7b63', - identifier : '5ad5f14c894e6a414edc7b63', + identifier: '5ad5f14c894e6a414edc7b63', customerId: '42', name: 'Julien Cornille', code: '10234665', @@ -54,9 +54,9 @@ const expectedOwner: Owner = { street: '73 rue du Faubourg Poissonnière ', zipCode: '75009', city: 'Paris', - country: 'France' + country: 'France', }, - readonly : false + readonly: false, }; describe('OwnerResolver', () => { @@ -67,11 +67,7 @@ describe('OwnerResolver', () => { const routerSpy = jasmine.createSpyObj('Router', ['navigate']); TestBed.configureTestingModule({ - providers: [ - OwnerResolver, - { provide: OwnerService, useValue: ownerServiceSpy }, - { provide: Router, useValue: routerSpy }, - ], + providers: [OwnerResolver, { provide: OwnerService, useValue: ownerServiceSpy }, { provide: Router, useValue: routerSpy }], }); ownerResolver = TestBed.inject(OwnerResolver); diff --git a/ui/ui-frontend/projects/identity/src/app/customer/owner-resolver.service.ts b/ui/ui-frontend/projects/identity/src/app/customer/owner-resolver.service.ts index 202d97d0416..980ac0d511b 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/owner-resolver.service.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/owner-resolver.service.ts @@ -45,25 +45,25 @@ import { OwnerService } from './owner.service'; @Injectable() export class OwnerResolver implements Resolve { - - constructor(private ownerService: OwnerService, private router: Router) { } + constructor( + private ownerService: OwnerService, + private router: Router, + ) {} resolve(route: ActivatedRouteSnapshot): Observable { const id = route.paramMap.get('id'); - return this.ownerService.get(id) - .pipe( - take(1), - map((owner: Owner) => { - if (owner) { - return owner; - } else { - this.router.navigate(['/']); + return this.ownerService.get(id).pipe( + take(1), + map((owner: Owner) => { + if (owner) { + return owner; + } else { + this.router.navigate(['/']); - return null; - } - }) - ); + return null; + } + }), + ); } - } diff --git a/ui/ui-frontend/projects/identity/src/app/customer/owner.service.spec.ts b/ui/ui-frontend/projects/identity/src/app/customer/owner.service.spec.ts index 322fa911e92..54be3793322 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/owner.service.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/owner.service.spec.ts @@ -48,7 +48,7 @@ import { EMPTY } from 'rxjs'; const expectedOwner: Owner = { id: '42', - identifier : '42', + identifier: '42', customerId: '43', name: 'Julien Cornille', code: '10234665', @@ -57,9 +57,9 @@ const expectedOwner: Owner = { street: '73 rue du Faubourg Poissonnière ', zipCode: '75009', city: 'Paris', - country: 'France' + country: 'France', }, - readonly : false + readonly: false, }; describe('OwnerService', () => { @@ -75,7 +75,7 @@ describe('OwnerService', () => { { provide: VitamUISnackBarService, useValue: snackBarSpy }, { provide: BASE_URL, useValue: '/fake-api' }, { provide: TranslateService, useValue: { instant: () => EMPTY } }, - ] + ], }); httpTestingController = TestBed.inject(HttpTestingController as Type); @@ -95,18 +95,15 @@ describe('OwnerService', () => { it('should call /fake-api/owners and display a success message', () => { const snackBarService = TestBed.inject(VitamUISnackBarService); - ownerService.create(expectedOwner).subscribe( - (response: Owner) => { - expect(response).toEqual(expectedOwner); - expect(snackBarService.open).toHaveBeenCalledWith({ - message: 'SHARED.SNACKBAR.OWNER_CREATE', - translateParams: { - param1: expectedOwner.name, - } - }); - }, - fail - ); + ownerService.create(expectedOwner).subscribe((response: Owner) => { + expect(response).toEqual(expectedOwner); + expect(snackBarService.open).toHaveBeenCalledWith({ + message: 'SHARED.SNACKBAR.OWNER_CREATE', + translateParams: { + param1: expectedOwner.name, + }, + }); + }, fail); const req = httpTestingController.expectOne('/fake-api/owners'); expect(req.request.method).toEqual('POST'); req.flush(expectedOwner); @@ -114,14 +111,11 @@ describe('OwnerService', () => { it('should display an error message', () => { const snackBarService = TestBed.inject(VitamUISnackBarService); - ownerService.create(expectedOwner).subscribe( - fail, - () => { - expect(snackBarService.open).toHaveBeenCalledWith({ message: 'Expected message', translate: false}); - } - ); + ownerService.create(expectedOwner).subscribe(fail, () => { + expect(snackBarService.open).toHaveBeenCalledWith({ message: 'Expected message', translate: false }); + }); const req = httpTestingController.expectOne('/fake-api/owners'); expect(req.request.method).toEqual('POST'); - req.flush({ message: 'Expected message' }, {status: 400, statusText: 'Bad request'}); + req.flush({ message: 'Expected message' }, { status: 400, statusText: 'Bad request' }); }); }); diff --git a/ui/ui-frontend/projects/identity/src/app/customer/owner.service.ts b/ui/ui-frontend/projects/identity/src/app/customer/owner.service.ts index ef36fcc607d..a66a2c87c9a 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/owner.service.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/owner.service.ts @@ -43,32 +43,33 @@ import { OwnerApiService } from './owner-api.service'; @Injectable() export class OwnerService { - updated = new Subject(); - constructor(private ownerApi: OwnerApiService, private snackBarService: VitamUISnackBarService) { } + constructor( + private ownerApi: OwnerApiService, + private snackBarService: VitamUISnackBarService, + ) {} get(id: string): Observable { return this.ownerApi.getOne(id); } create(owner: Owner): Observable { - return this.ownerApi.create(owner) - .pipe( - tap( - (newOwner: Owner) => { - this.snackBarService.open({ - message: 'SHARED.SNACKBAR.OWNER_CREATE', - translateParams:{ - param1: newOwner.name, - } - }); - }, - (error) => { - this.snackBarService.open({ message: error.error.message, translate: false }); - } - ) - ); + return this.ownerApi.create(owner).pipe( + tap( + (newOwner: Owner) => { + this.snackBarService.open({ + message: 'SHARED.SNACKBAR.OWNER_CREATE', + translateParams: { + param1: newOwner.name, + }, + }); + }, + (error) => { + this.snackBarService.open({ message: error.error.message, translate: false }); + }, + ), + ); } exists(code: string): Observable { @@ -76,28 +77,27 @@ export class OwnerService { const criterionCode: Criterion = { key: 'code', value: code, operator: Operators.equals }; criterionArray.push(criterionCode); const query: SearchQuery = { criteria: criterionArray }; - const params = [{key : 'criteria', value: JSON.stringify(query)}]; + const params = [{ key: 'criteria', value: JSON.stringify(query) }]; return this.ownerApi.checkExistsByParam(params); } - patch(partialOwner: { id: string, [key: string]: any }): Observable { - return this.ownerApi.patch(partialOwner) - .pipe( - tap((updatedOwner: Owner) => this.updated.next(updatedOwner)), - tap( - (updatedOwner: Owner) => { - this.snackBarService.open({ - message: 'SHARED.SNACKBAR.OWNER_UPDATE', - translateParams:{ - param1: updatedOwner.name, - } - }); - }, - (error) => { - this.snackBarService.open({ message: error.error.message, translate: false }); - } - ) - ); + patch(partialOwner: { id: string; [key: string]: any }): Observable { + return this.ownerApi.patch(partialOwner).pipe( + tap((updatedOwner: Owner) => this.updated.next(updatedOwner)), + tap( + (updatedOwner: Owner) => { + this.snackBarService.open({ + message: 'SHARED.SNACKBAR.OWNER_UPDATE', + translateParams: { + param1: updatedOwner.name, + }, + }); + }, + (error) => { + this.snackBarService.open({ message: error.error.message, translate: false }); + }, + ), + ); } } diff --git a/ui/ui-frontend/projects/identity/src/app/customer/tenant-api.service.spec.ts b/ui/ui-frontend/projects/identity/src/app/customer/tenant-api.service.spec.ts index f86445b531e..8162ee6b09d 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/tenant-api.service.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/tenant-api.service.spec.ts @@ -41,14 +41,12 @@ import { BASE_URL } from 'ui-frontend-common'; import { TenantApiService } from './tenant-api.service'; describe('TenantApiService', () => { - beforeEach(() => TestBed.configureTestingModule({ - imports: [ - HttpClientTestingModule, - ], - providers: [ - { provide: BASE_URL, useValue: '/fake-api' }, - ] - })); + beforeEach(() => + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule], + providers: [{ provide: BASE_URL, useValue: '/fake-api' }], + }), + ); it('should be created', () => { const service: TenantApiService = TestBed.inject(TenantApiService); diff --git a/ui/ui-frontend/projects/identity/src/app/customer/tenant-api.service.ts b/ui/ui-frontend/projects/identity/src/app/customer/tenant-api.service.ts index 7d62dc21245..14594c506a8 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/tenant-api.service.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/tenant-api.service.ts @@ -41,10 +41,9 @@ import { Observable } from 'rxjs'; import { BaseHttpClient, BASE_URL, Tenant } from 'ui-frontend-common'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class TenantApiService extends BaseHttpClient { - constructor(http: HttpClient, @Inject(BASE_URL) baseUrl: string) { super(http, baseUrl + '/tenants'); } @@ -61,12 +60,11 @@ export class TenantApiService extends BaseHttpClient { return super.create(tenant); } - patch(partialTenant: { id: string, [key: string]: any }): Observable { + patch(partialTenant: { id: string; [key: string]: any }): Observable { return super.patch(partialTenant); } - checkExistsByParam(params: Array<{ key: string, value: string }>): Observable { + checkExistsByParam(params: Array<{ key: string; value: string }>): Observable { return super.checkExistsByParam(params); } - } diff --git a/ui/ui-frontend/projects/identity/src/app/customer/tenant-create/tenant-create.component.html b/ui/ui-frontend/projects/identity/src/app/customer/tenant-create/tenant-create.component.html index 5d0f1ee5b99..55a327d3eba 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/tenant-create/tenant-create.component.html +++ b/ui/ui-frontend/projects/identity/src/app/customer/tenant-create/tenant-create.component.html @@ -4,13 +4,13 @@
      -
      {{'CUSTOMER.OWNER.MODAL.SAFE_TITLE' | translate}} "{{data?.owner?.name}}"
      +
      {{ 'CUSTOMER.OWNER.MODAL.SAFE_TITLE' | translate }} "{{ data?.owner?.name }}"
      - - + +
      diff --git a/ui/ui-frontend/projects/identity/src/app/customer/tenant-create/tenant-create.component.spec.ts b/ui/ui-frontend/projects/identity/src/app/customer/tenant-create/tenant-create.component.spec.ts index 2508432f9f0..b222f5d190c 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/tenant-create/tenant-create.component.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/tenant-create/tenant-create.component.spec.ts @@ -56,26 +56,20 @@ describe('TenantCreateComponent', () => { const matDialogRefSpy = jasmine.createSpyObj('MatDialogRef', ['close']); const tenantServiceSpy = jasmine.createSpyObj('TenantService', { create: of({}) }); const tenantFormValidatorsSpy = jasmine.createSpyObj('TenantFormValidators', { - uniqueName: () => of(null) + uniqueName: () => of(null), }); TestBed.configureTestingModule({ - imports: [ - MatProgressBarModule, - NoopAnimationsModule, - ReactiveFormsModule, - VitamUICommonTestModule, - ], - declarations: [ TenantCreateComponent ], + imports: [MatProgressBarModule, NoopAnimationsModule, ReactiveFormsModule, VitamUICommonTestModule], + declarations: [TenantCreateComponent], providers: [ { provide: MatDialogRef, useValue: matDialogRefSpy }, { provide: MAT_DIALOG_DATA, useValue: { owner: { id: '42', name: 'OwnerName', customerId: '424242', enabled: true } } }, { provide: TenantService, useValue: tenantServiceSpy }, { provide: TenantFormValidators, useValue: tenantFormValidatorsSpy }, { provide: ConfirmDialogService, useValue: { listenToEscapeKeyPress: () => EMPTY } }, - ] - }) - .compileComponents(); + ], + }).compileComponents(); })); beforeEach(() => { @@ -89,7 +83,7 @@ describe('TenantCreateComponent', () => { }); it('should call dialogRef.close', () => { - const matDialogRef = TestBed.inject(MatDialogRef); + const matDialogRef = TestBed.inject(MatDialogRef); component.onCancel(); expect(matDialogRef.close).toHaveBeenCalled(); }); @@ -99,20 +93,21 @@ describe('TenantCreateComponent', () => { name: 'toto', customerId: '424242', ownerId: '42', - enabled: true + enabled: true, }; const tenantServiceSpy = TestBed.inject(TenantService); component.form.setValue(tenant); component.onSubmit(); expect(tenantServiceSpy.create).toHaveBeenCalledWith( - { - name: tenant.name, - customerId: tenant.customerId, - ownerId: tenant.ownerId, - enabled: tenant.enabled - }, - 'OwnerName'); + { + name: tenant.name, + customerId: tenant.customerId, + ownerId: tenant.ownerId, + enabled: tenant.enabled, + }, + 'OwnerName', + ); }); it('should not call create()', () => { diff --git a/ui/ui-frontend/projects/identity/src/app/customer/tenant-create/tenant-create.component.ts b/ui/ui-frontend/projects/identity/src/app/customer/tenant-create/tenant-create.component.ts index d90db80e658..49f78fe1d9d 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/tenant-create/tenant-create.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/tenant-create/tenant-create.component.ts @@ -47,10 +47,9 @@ import { TenantFormValidators } from './tenant-form.validators'; @Component({ selector: 'app-tenant-create', templateUrl: './tenant-create.component.html', - styleUrls: ['./tenant-create.component.scss'] + styleUrls: ['./tenant-create.component.scss'], }) export class TenantCreateComponent implements OnInit, OnDestroy { - form: FormGroup; private keyPressSubscription: Subscription; @@ -61,19 +60,15 @@ export class TenantCreateComponent implements OnInit, OnDestroy { private formBuilder: FormBuilder, private tenantService: TenantService, private tenantFormValidators: TenantFormValidators, - private confirmDialogService: ConfirmDialogService - ) { } + private confirmDialogService: ConfirmDialogService, + ) {} ngOnInit() { this.form = this.formBuilder.group({ ownerId: [this.data.owner.id], customerId: [this.data.owner.customerId], - name: [ - null, - [Validators.required], - this.tenantFormValidators.uniqueName(), - ], - enabled: [true, Validators.required] + name: [null, [Validators.required], this.tenantFormValidators.uniqueName()], + enabled: [true, Validators.required], }); this.keyPressSubscription = this.confirmDialogService.listenToEscapeKeyPress(this.dialogRef).subscribe(() => this.onCancel()); } @@ -91,7 +86,9 @@ export class TenantCreateComponent implements OnInit, OnDestroy { } onSubmit() { - if (this.form.pending || this.form.invalid) { return; } + if (this.form.pending || this.form.invalid) { + return; + } this.tenantService.create(this.form.value, this.data.owner.name).subscribe( (newTenant: Tenant) => { this.dialogRef.close(newTenant); @@ -99,7 +96,7 @@ export class TenantCreateComponent implements OnInit, OnDestroy { (error) => { console.error(error); this.dialogRef.close(null); - }); + }, + ); } - } diff --git a/ui/ui-frontend/projects/identity/src/app/customer/tenant-create/tenant-create.module.ts b/ui/ui-frontend/projects/identity/src/app/customer/tenant-create/tenant-create.module.ts index cfe7f1c1d36..3f297d05ece 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/tenant-create/tenant-create.module.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/tenant-create/tenant-create.module.ts @@ -44,14 +44,9 @@ import { TenantCreateComponent } from './tenant-create.component'; import { TenantFormValidators } from './tenant-form.validators'; @NgModule({ - imports: [ - CommonModule, - MatProgressBarModule, - ReactiveFormsModule, - VitamUICommonModule, - ], + imports: [CommonModule, MatProgressBarModule, ReactiveFormsModule, VitamUICommonModule], declarations: [TenantCreateComponent], entryComponents: [TenantCreateComponent], - providers: [TenantFormValidators] + providers: [TenantFormValidators], }) -export class TenantCreateModule { } +export class TenantCreateModule {} diff --git a/ui/ui-frontend/projects/identity/src/app/customer/tenant-create/tenant-form.validators.spec.ts b/ui/ui-frontend/projects/identity/src/app/customer/tenant-create/tenant-form.validators.spec.ts index e46371dd73e..03a054269e8 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/tenant-create/tenant-form.validators.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/tenant-create/tenant-form.validators.spec.ts @@ -38,13 +38,13 @@ import { ɵisObservable as isObservable, ɵisPromise as isPromise } from '@angular/core'; import { fakeAsync, tick } from '@angular/core/testing'; import { FormControl } from '@angular/forms'; -import { from, Observable, of } from 'rxjs'; +import { from, Observable, of } from 'rxjs'; import { TenantFormValidators } from './tenant-form.validators'; function toObservable(r: any): Observable { const obs = isPromise(r) ? from(r) : r; - if (!(isObservable(obs))) { + if (!isObservable(obs)) { throw new Error(`Expected validator to return Promise or Observable.`); } @@ -52,7 +52,6 @@ function toObservable(r: any): Observable { } describe('Tenant Form Validators', () => { - it('should return null', fakeAsync(() => { const tenantServiceSpy = jasmine.createSpyObj('TenantService', ['exists']); tenantServiceSpy.exists.and.returnValue(of(false)); @@ -96,5 +95,4 @@ describe('Tenant Form Validators', () => { tick(400); expect(tenantServiceSpy.exists).toHaveBeenCalledWith('name'); })); - }); diff --git a/ui/ui-frontend/projects/identity/src/app/customer/tenant-create/tenant-form.validators.ts b/ui/ui-frontend/projects/identity/src/app/customer/tenant-create/tenant-form.validators.ts index 91f2026f526..94b8f9e10ad 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/tenant-create/tenant-form.validators.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/tenant-create/tenant-form.validators.ts @@ -36,27 +36,24 @@ */ import { Injectable } from '@angular/core'; import { AbstractControl, AsyncValidatorFn } from '@angular/forms'; -import { of , timer } from 'rxjs'; +import { of, timer } from 'rxjs'; import { map, switchMap, take } from 'rxjs/operators'; import { TenantService } from '../tenant.service'; @Injectable() export class TenantFormValidators { + private debounceTime = 400; - private debounceTime = 400; - - constructor(private tenantService: TenantService) {} - - uniqueName = (nameToIgnore?: string): AsyncValidatorFn => { - return (control: AbstractControl) => { - return timer(this.debounceTime) - .pipe( - switchMap(() => control.value !== nameToIgnore ? this.tenantService.exists(control.value) : of(false)), - take(1), - map((exists: boolean) => exists ? { uniqueName: true } : null) - ); - }; - } + constructor(private tenantService: TenantService) {} + uniqueName = (nameToIgnore?: string): AsyncValidatorFn => { + return (control: AbstractControl) => { + return timer(this.debounceTime).pipe( + switchMap(() => (control.value !== nameToIgnore ? this.tenantService.exists(control.value) : of(false))), + take(1), + map((exists: boolean) => (exists ? { uniqueName: true } : null)), + ); + }; + }; } diff --git a/ui/ui-frontend/projects/identity/src/app/customer/tenant-resolver.service.spec.ts b/ui/ui-frontend/projects/identity/src/app/customer/tenant-resolver.service.spec.ts index e3014595eea..5b2772a558e 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/tenant-resolver.service.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/tenant-resolver.service.spec.ts @@ -52,10 +52,10 @@ const expectedTenant: Tenant = { enabled: true, proof: true, accessContractHoldingIdentifier: 'AC-000001', - readonly : false, + readonly: false, accessContractLogbookIdentifier: 'AC-000002', ingestContractHoldingIdentifier: 'IC-000001', - itemIngestContractIdentifier: 'IC-000001' + itemIngestContractIdentifier: 'IC-000001', }; describe('TenantResolver', () => { @@ -66,11 +66,7 @@ describe('TenantResolver', () => { const routerSpy = jasmine.createSpyObj('Router', ['navigate']); TestBed.configureTestingModule({ - providers: [ - TenantResolver, - { provide: TenantService, useValue: tenantServiceSpy }, - { provide: Router, useValue: routerSpy }, - ], + providers: [TenantResolver, { provide: TenantService, useValue: tenantServiceSpy }, { provide: Router, useValue: routerSpy }], }); tenantResolver = TestBed.inject(TenantResolver); diff --git a/ui/ui-frontend/projects/identity/src/app/customer/tenant-resolver.service.ts b/ui/ui-frontend/projects/identity/src/app/customer/tenant-resolver.service.ts index 127e1d35d83..420619c1a87 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/tenant-resolver.service.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/tenant-resolver.service.ts @@ -44,25 +44,25 @@ import { TenantService } from './tenant.service'; @Injectable() export class TenantResolver implements Resolve { - - constructor(private tenantService: TenantService, private router: Router) { } + constructor( + private tenantService: TenantService, + private router: Router, + ) {} resolve(route: ActivatedRouteSnapshot): Observable { const id = route.paramMap.get('id'); - return this.tenantService.get(id) - .pipe( - take(1), - map((tenant: Tenant) => { - if (tenant) { - return tenant; - } else { - this.router.navigate(['/']); + return this.tenantService.get(id).pipe( + take(1), + map((tenant: Tenant) => { + if (tenant) { + return tenant; + } else { + this.router.navigate(['/']); - return null; - } - }) - ); + return null; + } + }), + ); } - } diff --git a/ui/ui-frontend/projects/identity/src/app/customer/tenant.service.spec.ts b/ui/ui-frontend/projects/identity/src/app/customer/tenant.service.spec.ts index 016d6815efd..9bacdfa3ef1 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/tenant.service.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/tenant.service.spec.ts @@ -47,7 +47,6 @@ import { TranslateService } from '@ngx-translate/core'; import { Type } from '@angular/core'; - const expectedTenant: Tenant = { id: '42', customerId: '43', @@ -60,7 +59,7 @@ const expectedTenant: Tenant = { accessContractHoldingIdentifier: 'AC-000001', accessContractLogbookIdentifier: 'AC-000002', ingestContractHoldingIdentifier: 'IC-000001', - itemIngestContractIdentifier: 'IC-000001' + itemIngestContractIdentifier: 'IC-000001', }; const expectedOwner: Owner = { @@ -75,8 +74,8 @@ const expectedOwner: Owner = { street: '73 rue du Faubourg Poissonnière ', zipCode: '75009', city: 'Paris', - country: 'France' - } + country: 'France', + }, }; const expectedTenants = [ @@ -92,7 +91,7 @@ const expectedTenants = [ accessContractHoldingIdentifier: 'AC-000001', accessContractLogbookIdentifier: 'AC-000002', ingestContractHoldingIdentifier: 'IC-000001', - itemIngestContractIdentifier: 'IC-000001' + itemIngestContractIdentifier: 'IC-000001', }, { id: '1', @@ -106,7 +105,7 @@ const expectedTenants = [ accessContractHoldingIdentifier: 'AC-000001', accessContractLogbookIdentifier: 'AC-000002', ingestContractHoldingIdentifier: 'IC-000001', - itemIngestContractIdentifier: 'IC-000001' + itemIngestContractIdentifier: 'IC-000001', }, { id: '2', @@ -120,7 +119,7 @@ const expectedTenants = [ accessContractHoldingIdentifier: 'AC-000001', accessContractLogbookIdentifier: 'AC-000002', ingestContractHoldingIdentifier: 'IC-000001', - itemIngestContractIdentifier: 'IC-000001' + itemIngestContractIdentifier: 'IC-000001', }, ]; @@ -137,7 +136,7 @@ describe('TenantService', () => { { provide: BASE_URL, useValue: '/fake-api' }, { provide: TranslateService, useValue: { instant: () => EMPTY } }, { provide: VitamUISnackBarService, useValue: snackBarSpy }, - ] + ], }); httpTestingController = TestBed.inject(HttpTestingController as Type); @@ -167,20 +166,17 @@ describe('TenantService', () => { it('should call /fake-api/tenants and display a success message', () => { const snackBar = TestBed.inject(VitamUISnackBarService); - tenantService.create(expectedTenant, expectedOwner.name).subscribe( - (response: Tenant) => { - expect(response).toEqual(expectedTenant); - expect(snackBar.open).toHaveBeenCalledWith({ - message: 'SHARED.SNACKBAR.SAFE_CREATE', - translateParams:{ - param1: expectedTenant.name, - param2: expectedOwner.name, - }, - icon: 'vitamui-icon-safe' - }); - }, - fail - ); + tenantService.create(expectedTenant, expectedOwner.name).subscribe((response: Tenant) => { + expect(response).toEqual(expectedTenant); + expect(snackBar.open).toHaveBeenCalledWith({ + message: 'SHARED.SNACKBAR.SAFE_CREATE', + translateParams: { + param1: expectedTenant.name, + param2: expectedOwner.name, + }, + icon: 'vitamui-icon-safe', + }); + }, fail); const req = httpTestingController.expectOne('/fake-api/tenants'); expect(req.request.method).toEqual('POST'); req.flush(expectedTenant); @@ -188,33 +184,26 @@ describe('TenantService', () => { it('should display an error message', () => { const snackBar = TestBed.inject(VitamUISnackBarService); - tenantService.create(expectedTenant, expectedOwner.name).subscribe( - fail, - () => { - expect(snackBar.open).toHaveBeenCalledWith({ - message: 'SHARED.SNACKBAR.SAFE_CREATE_ERROR', - icon: 'vitamui-icon-danger' - }); - } - ); + tenantService.create(expectedTenant, expectedOwner.name).subscribe(fail, () => { + expect(snackBar.open).toHaveBeenCalledWith({ + message: 'SHARED.SNACKBAR.SAFE_CREATE_ERROR', + icon: 'vitamui-icon-danger', + }); + }); const req = httpTestingController.expectOne('/fake-api/tenants'); expect(req.request.method).toEqual('POST'); req.flush({ message: 'Expected message' }, { status: 400, statusText: 'Bad request' }); }); it('should return true if the tenant exists', () => { - tenantService.exists('tenantName').subscribe( - (found) => { - expect(found).toBeTruthy(); - }, - fail - ); - - const criterionArray: any[] = [ { key: 'name', value: 'tenantName', operator: Operators.equals }]; + tenantService.exists('tenantName').subscribe((found) => { + expect(found).toBeTruthy(); + }, fail); + + const criterionArray: any[] = [{ key: 'name', value: 'tenantName', operator: Operators.equals }]; const query: SearchQuery = { criteria: criterionArray }; const req = httpTestingController.expectOne('/fake-api/tenants/check?criteria=' + encodeURI(JSON.stringify(query))); expect(req.request.method).toEqual('HEAD'); req.flush(''); }); - }); diff --git a/ui/ui-frontend/projects/identity/src/app/customer/tenant.service.ts b/ui/ui-frontend/projects/identity/src/app/customer/tenant.service.ts index 9ad40e5d030..fe1a6d7f36a 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/tenant.service.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/tenant.service.ts @@ -45,10 +45,12 @@ import { TenantApiService } from './tenant-api.service'; @Injectable() export class TenantService { - updated = new Subject(); - constructor(private tenantApi: TenantApiService, private snackBarService: VitamUISnackBarService) {} + constructor( + private tenantApi: TenantApiService, + private snackBarService: VitamUISnackBarService, + ) {} get(id: string): Observable { return this.tenantApi.getOne(id); @@ -68,49 +70,47 @@ export class TenantService { } create(tenant: Tenant, ownerName: string): Observable { - return this.tenantApi.create(tenant) - .pipe( - tap( - (newTenant: Tenant) => { - this.snackBarService.open({ - message: 'SHARED.SNACKBAR.SAFE_CREATE', - translateParams:{ - param1: newTenant.name, - param2: ownerName, - }, - icon: 'vitamui-icon-safe' - }); - }, - () => { - this.snackBarService.open({ - message: 'SHARED.SNACKBAR.SAFE_CREATE_ERROR', - icon: 'vitamui-icon-danger' - }); - } - ) - ); + return this.tenantApi.create(tenant).pipe( + tap( + (newTenant: Tenant) => { + this.snackBarService.open({ + message: 'SHARED.SNACKBAR.SAFE_CREATE', + translateParams: { + param1: newTenant.name, + param2: ownerName, + }, + icon: 'vitamui-icon-safe', + }); + }, + () => { + this.snackBarService.open({ + message: 'SHARED.SNACKBAR.SAFE_CREATE_ERROR', + icon: 'vitamui-icon-danger', + }); + }, + ), + ); } - patch(partialTenant: { id: string, [key: string]: any }, ownerName: string): Observable { - return this.tenantApi.patch(partialTenant) - .pipe( - tap((updatedTenant: Tenant) => this.updated.next(updatedTenant)), - tap( - (updatedTenant: Tenant) => { - this.snackBarService.open({ - message: 'SHARED.SNACKBAR.SAFE_UPDATE', - translateParams:{ - param1: updatedTenant.name, - param2: ownerName, - }, - icon: 'vitamui-icon-safe' - }); - }, - (error) => { - this.snackBarService.open({ message: error.error.message, translate: false }); - } - ) - ); + patch(partialTenant: { id: string; [key: string]: any }, ownerName: string): Observable { + return this.tenantApi.patch(partialTenant).pipe( + tap((updatedTenant: Tenant) => this.updated.next(updatedTenant)), + tap( + (updatedTenant: Tenant) => { + this.snackBarService.open({ + message: 'SHARED.SNACKBAR.SAFE_UPDATE', + translateParams: { + param1: updatedTenant.name, + param2: ownerName, + }, + icon: 'vitamui-icon-safe', + }); + }, + (error) => { + this.snackBarService.open({ message: error.error.message, translate: false }); + }, + ), + ); } exists(name: string): Observable { @@ -118,9 +118,8 @@ export class TenantService { const criterionCode: Criterion = { key: 'name', value: name, operator: Operators.equals }; criterionArray.push(criterionCode); const query: SearchQuery = { criteria: criterionArray }; - const params = [{key : 'criteria', value: JSON.stringify(query)}]; + const params = [{ key: 'criteria', value: JSON.stringify(query) }]; return this.tenantApi.checkExistsByParam(params); } - } diff --git a/ui/ui-frontend/projects/identity/src/app/external-param-profile/external-param-profile-create/external-param-profile-create.component.html b/ui/ui-frontend/projects/identity/src/app/external-param-profile/external-param-profile-create/external-param-profile-create.component.html index 5152921e92a..b3c6a3a3a0a 100644 --- a/ui/ui-frontend/projects/identity/src/app/external-param-profile/external-param-profile-create/external-param-profile-create.component.html +++ b/ui/ui-frontend/projects/identity/src/app/external-param-profile/external-param-profile-create/external-param-profile-create.component.html @@ -26,7 +26,8 @@ > {{ 'COMMON.ERROR.REQUIRED' | translate }} + >{{ 'COMMON.ERROR.REQUIRED' | translate }} { console.error(error); - } + }, ); } diff --git a/ui/ui-frontend/projects/identity/src/app/external-param-profile/external-param-profile-detail/external-param-profile-detail.component.html b/ui/ui-frontend/projects/identity/src/app/external-param-profile/external-param-profile-detail/external-param-profile-detail.component.html index bb017971801..66fd224d58b 100644 --- a/ui/ui-frontend/projects/identity/src/app/external-param-profile/external-param-profile-detail/external-param-profile-detail.component.html +++ b/ui/ui-frontend/projects/identity/src/app/external-param-profile/external-param-profile-detail/external-param-profile-detail.component.html @@ -9,11 +9,19 @@
      - + - + diff --git a/ui/ui-frontend/projects/identity/src/app/external-param-profile/external-param-profile-detail/external-param-profile-detail.component.spec.ts b/ui/ui-frontend/projects/identity/src/app/external-param-profile/external-param-profile-detail/external-param-profile-detail.component.spec.ts index 2fbf8665884..fa869ccb37f 100644 --- a/ui/ui-frontend/projects/identity/src/app/external-param-profile/external-param-profile-detail/external-param-profile-detail.component.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/external-param-profile/external-param-profile-detail/external-param-profile-detail.component.spec.ts @@ -34,30 +34,28 @@ * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ -import {HttpClientTestingModule} from '@angular/common/http/testing'; -import {Component,Input,NO_ERRORS_SCHEMA} from '@angular/core'; -import {ComponentFixture,TestBed} from '@angular/core/testing'; -import {MatMenuModule} from '@angular/material/menu'; -import {MatTabsModule} from '@angular/material/tabs'; -import {NoopAnimationsModule} from '@angular/platform-browser/animations'; -import {Observable, of, Subject} from 'rxjs'; -import {AuthService,BASE_URL,LoggerModule,WINDOW_LOCATION} from 'ui-frontend-common'; -import {environment} from '../../../environments/environment.prod'; -import {TestHostComponent} from '../../shared/domains-input/domains-input.component.spec'; -import {ExternalParamProfileService} from '../external-param-profile.service'; -import {ExternalParamProfileDetailComponent} from './external-param-profile-detail.component'; -import {TranslateLoader,TranslateModule} from '@ngx-translate/core'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { Component, Input, NO_ERRORS_SCHEMA } from '@angular/core'; +import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { MatMenuModule } from '@angular/material/menu'; +import { MatTabsModule } from '@angular/material/tabs'; +import { NoopAnimationsModule } from '@angular/platform-browser/animations'; +import { Observable, of, Subject } from 'rxjs'; +import { AuthService, BASE_URL, LoggerModule, WINDOW_LOCATION } from 'ui-frontend-common'; +import { environment } from '../../../environments/environment.prod'; +import { TestHostComponent } from '../../shared/domains-input/domains-input.component.spec'; +import { ExternalParamProfileService } from '../external-param-profile.service'; +import { ExternalParamProfileDetailComponent } from './external-param-profile-detail.component'; +import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; - -@Component({selector: 'app-information-tab',template: ''}) +@Component({ selector: 'app-information-tab', template: '' }) class InformationTabStubComponent { // @Input() profile: ExternalParamProfile; @Input() readOnly: boolean; @Input() tenantIdentifier: string; - } -const translations: any={TEST: 'Mock translate test'}; +const translations: any = { TEST: 'Mock translate test' }; class FakeLoader implements TranslateLoader { getTranslation(): Observable { @@ -65,48 +63,43 @@ class FakeLoader implements TranslateLoader { } } - -describe('ExternalParamProfilDetailComponent',() => { +describe('ExternalParamProfilDetailComponent', () => { let component: ExternalParamProfileDetailComponent; let fixture: ComponentFixture; - const authServiceMock={user: {level: ''}}; + const authServiceMock = { user: { level: '' } }; beforeEach(async () => { await TestBed.configureTestingModule({ imports: [ TranslateModule.forRoot({ - loader: {provide: TranslateLoader,useClass: FakeLoader} + loader: { provide: TranslateLoader, useClass: FakeLoader }, }), MatMenuModule, MatTabsModule, NoopAnimationsModule, HttpClientTestingModule, - LoggerModule.forRoot() - ], - declarations: [ - TestHostComponent, - ExternalParamProfileDetailComponent, - InformationTabStubComponent, + LoggerModule.forRoot(), ], + declarations: [TestHostComponent, ExternalParamProfileDetailComponent, InformationTabStubComponent], providers: [ - {provide: ExternalParamProfileService,useValue: {updated: new Subject()}}, - {provide: AuthService,useValue: authServiceMock}, - {provide: WINDOW_LOCATION,useValue: {}}, - {provide: BASE_URL,useValue: '/fake-api'}, - {provide: environment,useValue: environment} + { provide: ExternalParamProfileService, useValue: { updated: new Subject() } }, + { provide: AuthService, useValue: authServiceMock }, + { provide: WINDOW_LOCATION, useValue: {} }, + { provide: BASE_URL, useValue: '/fake-api' }, + { provide: environment, useValue: environment }, ], - schemas: [NO_ERRORS_SCHEMA] + schemas: [NO_ERRORS_SCHEMA], }).compileComponents(); }); beforeEach(() => { - fixture=TestBed.createComponent(ExternalParamProfileDetailComponent); - component=fixture.componentInstance; + fixture = TestBed.createComponent(ExternalParamProfileDetailComponent); + component = fixture.componentInstance; fixture.detectChanges(); }); - it('should create',() => { + it('should create', () => { expect(component).toBeTruthy(); }); }); diff --git a/ui/ui-frontend/projects/identity/src/app/external-param-profile/external-param-profile-detail/external-param-profile-detail.component.ts b/ui/ui-frontend/projects/identity/src/app/external-param-profile/external-param-profile-detail/external-param-profile-detail.component.ts index c5b8d652238..95539970a58 100644 --- a/ui/ui-frontend/projects/identity/src/app/external-param-profile/external-param-profile-detail/external-param-profile-detail.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/external-param-profile/external-param-profile-detail/external-param-profile-detail.component.ts @@ -34,36 +34,39 @@ * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ -import {Component,EventEmitter,Input,OnDestroy,OnInit,Output} from '@angular/core'; -import {Subscription} from 'rxjs'; -import {Event,ExternalParamProfile} from 'ui-frontend-common'; -import {ExternalParamProfileService} from '../external-param-profile.service'; -import {SharedService} from '../shared.service'; +import { Component, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core'; +import { Subscription } from 'rxjs'; +import { Event, ExternalParamProfile } from 'ui-frontend-common'; +import { ExternalParamProfileService } from '../external-param-profile.service'; +import { SharedService } from '../shared.service'; @Component({ selector: 'app-external-param-profile-detail', templateUrl: './external-param-profile-detail.component.html', styleUrls: ['./external-param-profile-detail.component.css'], }) -export class ExternalParamProfileDetailComponent implements OnInit,OnDestroy { +export class ExternalParamProfileDetailComponent implements OnInit, OnDestroy { @Input() externalParamProfile: ExternalParamProfile; @Input() tenantIdentifier: string; @Input() isPopup: boolean; - @Output() externalParamProfileClose=new EventEmitter(); + @Output() externalParamProfileClose = new EventEmitter(); readOnly: boolean; externalParamProfileUpdateSub: Subscription; - constructor(private sharedService: SharedService,private externalParamProfileServiceService: ExternalParamProfileService) { + constructor( + private sharedService: SharedService, + private externalParamProfileServiceService: ExternalParamProfileService, + ) { this.sharedService.getReadOnly().subscribe((readOnly) => { - this.readOnly=readOnly; + this.readOnly = readOnly; }); } ngOnInit(): void { - this.externalParamProfileUpdateSub=this.externalParamProfileServiceService.updated.subscribe((externalParamProfile) => { - if(externalParamProfile) { + this.externalParamProfileUpdateSub = this.externalParamProfileServiceService.updated.subscribe((externalParamProfile) => { + if (externalParamProfile) { this.externalParamProfileServiceService.getOne(externalParamProfile.idProfile).subscribe((newExternalParamProfile) => { - this.externalParamProfile=newExternalParamProfile; + this.externalParamProfile = newExternalParamProfile; }); } }); @@ -79,8 +82,8 @@ export class ExternalParamProfileDetailComponent implements OnInit,OnDestroy { filterEvents(event: Event): boolean { return ( - event.outDetail&& - (event.outDetail.includes('EXT_VITAMUI_CREATE_EXTERNAL_PARAM_PROFILE')|| + event.outDetail && + (event.outDetail.includes('EXT_VITAMUI_CREATE_EXTERNAL_PARAM_PROFILE') || event.outDetail.includes('EXT_VITAMUI_UPDATE_EXTERNAL_PARAM_PROFILE')) ); } diff --git a/ui/ui-frontend/projects/identity/src/app/external-param-profile/external-param-profile-detail/information-tab/information-tab.component.ts b/ui/ui-frontend/projects/identity/src/app/external-param-profile/external-param-profile-detail/information-tab/information-tab.component.ts index de61446d810..d409dd1015d 100644 --- a/ui/ui-frontend/projects/identity/src/app/external-param-profile/external-param-profile-detail/information-tab/information-tab.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/external-param-profile/external-param-profile-detail/information-tab/information-tab.component.ts @@ -45,13 +45,13 @@ import { ExternalParamProfileValidators } from '../../external-param-profile.val @Component({ selector: 'app-information-tab', - templateUrl: './information-tab.component.html' + templateUrl: './information-tab.component.html', }) export class InformationTabComponent implements OnDestroy, OnInit, OnChanges { constructor( private formBuilder: FormBuilder, private externalParamProfileService: ExternalParamProfileService, - private externalParamProfileValidators: ExternalParamProfileValidators + private externalParamProfileValidators: ExternalParamProfileValidators, ) {} form: FormGroup; permissionForm: FormGroup; @@ -113,11 +113,11 @@ export class InformationTabComponent implements OnDestroy, OnInit, OnChanges { idExternalParam: this.externalParamProfile.idExternalParam, idProfile: this.externalParamProfile.idProfile, }, - formData - ) + formData, + ), ), switchMap((formData) => this.externalParamProfileService.patch(formData).pipe(catchError((error) => of(error)))), - catchError((error) => of(error)) + catchError((error) => of(error)), ) .subscribe((externalParamProfile: ExternalParamProfile) => this.resetForm(this.form, externalParamProfile, this.readOnly)); } @@ -135,8 +135,8 @@ export class InformationTabComponent implements OnDestroy, OnInit, OnChanges { this.externalParamProfileValidators.nameExists( +this.tenantIdentifier, ApplicationId.EXTERNAL_PARAM_PROFILE_APP, - externalParamProfile.name - ) + externalParamProfile.name, + ), ); } } diff --git a/ui/ui-frontend/projects/identity/src/app/external-param-profile/external-param-profile-detail/thresholds-tab/thresholds-tab.component.html b/ui/ui-frontend/projects/identity/src/app/external-param-profile/external-param-profile-detail/thresholds-tab/thresholds-tab.component.html index 1f388c552c9..3141aff659e 100644 --- a/ui/ui-frontend/projects/identity/src/app/external-param-profile/external-param-profile-detail/thresholds-tab/thresholds-tab.component.html +++ b/ui/ui-frontend/projects/identity/src/app/external-param-profile/external-param-profile-detail/thresholds-tab/thresholds-tab.component.html @@ -1,18 +1,18 @@
      - + {{ 'EXTERNAL_PARAM_PROFILE.USE_PLATFORM_BULK_OPERATIONS_THRESHOLD_TITLE' | translate }}
      - + {{ 'EXTERNAL_PARAM_PROFILE.MAX_BULK_OPERATIONS_THRESHOLD_VALUES' | translate: { threshold: thresholdValue | number } }} @@ -25,9 +25,14 @@
      -
      +
      -
      diff --git a/ui/ui-frontend/projects/identity/src/app/external-param-profile/external-param-profile-detail/thresholds-tab/thresholds-tab.component.ts b/ui/ui-frontend/projects/identity/src/app/external-param-profile/external-param-profile-detail/thresholds-tab/thresholds-tab.component.ts index 743402c59d6..a965fef5d68 100644 --- a/ui/ui-frontend/projects/identity/src/app/external-param-profile/external-param-profile-detail/thresholds-tab/thresholds-tab.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/external-param-profile/external-param-profile-detail/thresholds-tab/thresholds-tab.component.ts @@ -34,23 +34,22 @@ * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ -import {Component, Input, OnChanges, OnDestroy, OnInit, SimpleChanges} from '@angular/core'; -import {FormBuilder, FormGroup} from '@angular/forms'; -import {Subscription} from 'rxjs'; -import {diff, ExternalParamProfile} from 'ui-frontend-common'; -import {extend, isEmpty} from 'underscore'; -import {ExternalParamProfileService} from '../../external-param-profile.service'; +import { Component, Input, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core'; +import { FormBuilder, FormGroup } from '@angular/forms'; +import { Subscription } from 'rxjs'; +import { diff, ExternalParamProfile } from 'ui-frontend-common'; +import { extend, isEmpty } from 'underscore'; +import { ExternalParamProfileService } from '../../external-param-profile.service'; @Component({ selector: 'app-thresholds-tab', - templateUrl: './thresholds-tab.component.html' + templateUrl: './thresholds-tab.component.html', }) export class ThresholdsTabComponent implements OnDestroy, OnInit, OnChanges { constructor( private formBuilder: FormBuilder, - private externalParamProfileService: ExternalParamProfileService - ) { - } + private externalParamProfileService: ExternalParamProfileService, + ) {} form: FormGroup; previousValue: ExternalParamProfile; @@ -63,13 +62,12 @@ export class ThresholdsTabComponent implements OnDestroy, OnInit, OnChanges { private updateFormSub: Subscription; - private static initFormActivationState(form: FormGroup, readOnly: boolean) { if (readOnly) { - form.disable({emitEvent: false}); + form.disable({ emitEvent: false }); return; } - form.enable({emitEvent: false}); + form.enable({ emitEvent: false }); } ngOnInit() { @@ -100,9 +98,8 @@ export class ThresholdsTabComponent implements OnDestroy, OnInit, OnChanges { }); } - private resetForm(form: FormGroup, externalParamProfile: ExternalParamProfile, readOnly: boolean) { - form.reset(externalParamProfile, {emitEvent: false}); + form.reset(externalParamProfile, { emitEvent: false }); ThresholdsTabComponent.initFormActivationState(form, readOnly); } @@ -115,20 +112,16 @@ export class ThresholdsTabComponent implements OnDestroy, OnInit, OnChanges { idExternalParam: this.externalParamProfile.idExternalParam, idProfile: this.externalParamProfile.idProfile, }, - updated + updated, ); if (updated.usePlatformThreshold) { delete updated.bulkOperationsThreshold; } - this.externalParamProfileService - .patch(updated) - .subscribe((externalParamProfile: ExternalParamProfile) => { - this.resetForm(this.form, externalParamProfile, this.readOnly); - this.isUpdated = false; - } - ); + this.externalParamProfileService.patch(updated).subscribe((externalParamProfile: ExternalParamProfile) => { + this.resetForm(this.form, externalParamProfile, this.readOnly); + this.isUpdated = false; + }); } } - } diff --git a/ui/ui-frontend/projects/identity/src/app/external-param-profile/external-param-profile-list/external-param-profile-list.component.spec.ts b/ui/ui-frontend/projects/identity/src/app/external-param-profile/external-param-profile-list/external-param-profile-list.component.spec.ts index ebd4663bb81..5599b98c4b6 100644 --- a/ui/ui-frontend/projects/identity/src/app/external-param-profile/external-param-profile-list/external-param-profile-list.component.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/external-param-profile/external-param-profile-list/external-param-profile-list.component.spec.ts @@ -34,23 +34,22 @@ * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ -import {CUSTOM_ELEMENTS_SCHEMA} from '@angular/core'; -import {ComponentFixture,TestBed} from '@angular/core/testing'; -import {ReactiveFormsModule} from '@angular/forms'; -import {MatButtonToggleModule} from '@angular/material/button-toggle'; -import {MatDialogRef,MAT_DIALOG_DATA} from '@angular/material/dialog'; -import {MatProgressBarModule} from '@angular/material/progress-bar'; -import {TranslateLoader,TranslateModule} from '@ngx-translate/core'; -import {Observable,of,Subject} from 'rxjs'; -import {CollapseModule} from 'ui-frontend-common'; -import {VitamUICommonTestModule} from 'ui-frontend-common/testing'; -import {ProfileValidators} from '../../hierarchy/profile.validators'; -import {ProfileService} from '../../profile/profile.service'; -import {ExternalParamProfileService} from '../external-param-profile.service'; -import {ExternalParamProfileListComponent} from './external-param-profile-list.component'; +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { ReactiveFormsModule } from '@angular/forms'; +import { MatButtonToggleModule } from '@angular/material/button-toggle'; +import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; +import { MatProgressBarModule } from '@angular/material/progress-bar'; +import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; +import { Observable, of, Subject } from 'rxjs'; +import { CollapseModule } from 'ui-frontend-common'; +import { VitamUICommonTestModule } from 'ui-frontend-common/testing'; +import { ProfileValidators } from '../../hierarchy/profile.validators'; +import { ProfileService } from '../../profile/profile.service'; +import { ExternalParamProfileService } from '../external-param-profile.service'; +import { ExternalParamProfileListComponent } from './external-param-profile-list.component'; - -const translations: any={TEST: 'Mock translate test'}; +const translations: any = { TEST: 'Mock translate test' }; class FakeLoader implements TranslateLoader { getTranslation(): Observable { @@ -58,55 +57,52 @@ class FakeLoader implements TranslateLoader { } } -describe('ExternalParamProfileListComponent',() => { +describe('ExternalParamProfileListComponent', () => { let component: ExternalParamProfileListComponent; let fixture: ComponentFixture; - const matDialogRefSpy=jasmine.createSpyObj('MatDialogRef',['close']); - const profileServiceSpy=jasmine.createSpyObj('ProfileService',{create: of({})}); - const profileValidatorsSpy=jasmine.createSpyObj('ProfileValidators',{create: of({})}); - + const matDialogRefSpy = jasmine.createSpyObj('MatDialogRef', ['close']); + const profileServiceSpy = jasmine.createSpyObj('ProfileService', { create: of({}) }); + const profileValidatorsSpy = jasmine.createSpyObj('ProfileValidators', { create: of({}) }); - const externalParamListServiceSpy={ + const externalParamListServiceSpy = { search: () => of([]), canLoadMore: true, loadMore: () => of([]), - updated: new Subject() + updated: new Subject(), }; beforeEach(async () => { await TestBed.configureTestingModule({ imports: [ TranslateModule.forRoot({ - loader: {provide: TranslateLoader,useClass: FakeLoader} + loader: { provide: TranslateLoader, useClass: FakeLoader }, }), ReactiveFormsModule, MatProgressBarModule, CollapseModule, MatButtonToggleModule, - VitamUICommonTestModule - + VitamUICommonTestModule, ], declarations: [ExternalParamProfileListComponent], providers: [ - {provide: MatDialogRef,useValue: matDialogRefSpy}, - {provide: ExternalParamProfileService,useValue: externalParamListServiceSpy}, - {provide: MAT_DIALOG_DATA,useValue: {}}, - {provide: ProfileService,useValue: profileServiceSpy}, - {provide: ProfileValidators,useValue: profileValidatorsSpy}, + { provide: MatDialogRef, useValue: matDialogRefSpy }, + { provide: ExternalParamProfileService, useValue: externalParamListServiceSpy }, + { provide: MAT_DIALOG_DATA, useValue: {} }, + { provide: ProfileService, useValue: profileServiceSpy }, + { provide: ProfileValidators, useValue: profileValidatorsSpy }, ], - schemas: [CUSTOM_ELEMENTS_SCHEMA] - }) - .compileComponents(); + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }).compileComponents(); }); beforeEach(() => { - fixture=TestBed.createComponent(ExternalParamProfileListComponent); - component=fixture.componentInstance; + fixture = TestBed.createComponent(ExternalParamProfileListComponent); + component = fixture.componentInstance; fixture.detectChanges(); }); - it('should create',() => { + it('should create', () => { expect(component).toBeTruthy(); }); -}); \ No newline at end of file +}); diff --git a/ui/ui-frontend/projects/identity/src/app/external-param-profile/external-param-profile-list/external-param-profile-list.component.ts b/ui/ui-frontend/projects/identity/src/app/external-param-profile/external-param-profile-list/external-param-profile-list.component.ts index 224fe703e75..9e9c29fb32c 100644 --- a/ui/ui-frontend/projects/identity/src/app/external-param-profile/external-param-profile-list/external-param-profile-list.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/external-param-profile/external-param-profile-list/external-param-profile-list.component.ts @@ -76,7 +76,7 @@ export class ExternalParamProfileListComponent extends InfiniteScrollTable {{ 'EXTERNAL_PARAM_PROFILE.TITLE' | translate }} - + diff --git a/ui/ui-frontend/projects/identity/src/app/external-param-profile/external-param-profile.component.spec.ts b/ui/ui-frontend/projects/identity/src/app/external-param-profile/external-param-profile.component.spec.ts index 3f0dcbbbd87..f8f67fd5d07 100644 --- a/ui/ui-frontend/projects/identity/src/app/external-param-profile/external-param-profile.component.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/external-param-profile/external-param-profile.component.spec.ts @@ -34,20 +34,19 @@ * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ -import {CUSTOM_ELEMENTS_SCHEMA} from '@angular/core'; -import {ComponentFixture,TestBed} from '@angular/core/testing'; -import {MatDialogModule} from '@angular/material/dialog'; -import {MatMenuModule} from '@angular/material/menu'; -import {MatSidenavModule} from '@angular/material/sidenav'; -import {NoopAnimationsModule} from '@angular/platform-browser/animations'; -import {RouterTestingModule} from '@angular/router/testing'; -import {InjectorModule,LoggerModule} from 'ui-frontend-common'; -import {VitamUICommonTestModule} from 'ui-frontend-common/testing'; -import {ExternalParamProfileComponent} from './external-param-profile.component'; -import {ExternalParamProfileService} from './external-param-profile.service'; +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { MatDialogModule } from '@angular/material/dialog'; +import { MatMenuModule } from '@angular/material/menu'; +import { MatSidenavModule } from '@angular/material/sidenav'; +import { NoopAnimationsModule } from '@angular/platform-browser/animations'; +import { RouterTestingModule } from '@angular/router/testing'; +import { InjectorModule, LoggerModule } from 'ui-frontend-common'; +import { VitamUICommonTestModule } from 'ui-frontend-common/testing'; +import { ExternalParamProfileComponent } from './external-param-profile.component'; +import { ExternalParamProfileService } from './external-param-profile.service'; - -describe('ExternalParamProfileComponent',() => { +describe('ExternalParamProfileComponent', () => { let component: ExternalParamProfileComponent; let fixture: ComponentFixture; @@ -62,23 +61,20 @@ describe('ExternalParamProfileComponent',() => { NoopAnimationsModule, MatSidenavModule, MatDialogModule, - MatMenuModule - ], - providers: [ - {provide: ExternalParamProfileService,useValue: {}} + MatMenuModule, ], - schemas: [CUSTOM_ELEMENTS_SCHEMA] - }) - .compileComponents(); + providers: [{ provide: ExternalParamProfileService, useValue: {} }], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }).compileComponents(); }); beforeEach(() => { - fixture=TestBed.createComponent(ExternalParamProfileComponent); - component=fixture.componentInstance; + fixture = TestBed.createComponent(ExternalParamProfileComponent); + component = fixture.componentInstance; fixture.detectChanges(); }); - it('should create',() => { + it('should create', () => { expect(component).toBeTruthy(); }); }); diff --git a/ui/ui-frontend/projects/identity/src/app/external-param-profile/external-param-profile.component.ts b/ui/ui-frontend/projects/identity/src/app/external-param-profile/external-param-profile.component.ts index c9b4d666540..060d79c1d66 100644 --- a/ui/ui-frontend/projects/identity/src/app/external-param-profile/external-param-profile.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/external-param-profile/external-param-profile.component.ts @@ -34,13 +34,13 @@ * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ -import {Component,OnInit,ViewChild} from '@angular/core'; -import {MatDialog} from '@angular/material/dialog'; -import {ActivatedRoute} from '@angular/router'; -import {ExternalParamProfile,GlobalEventService,SidenavPage} from 'ui-frontend-common'; -import {ExternalParamProfileCreateComponent} from './external-param-profile-create/external-param-profile-create.component'; -import {ExternalParamProfileListComponent} from './external-param-profile-list/external-param-profile-list.component'; -import {ExternalParamProfileService} from './external-param-profile.service'; +import { Component, OnInit, ViewChild } from '@angular/core'; +import { MatDialog } from '@angular/material/dialog'; +import { ActivatedRoute } from '@angular/router'; +import { ExternalParamProfile, GlobalEventService, SidenavPage } from 'ui-frontend-common'; +import { ExternalParamProfileCreateComponent } from './external-param-profile-create/external-param-profile-create.component'; +import { ExternalParamProfileListComponent } from './external-param-profile-list/external-param-profile-list.component'; +import { ExternalParamProfileService } from './external-param-profile.service'; @Component({ selector: 'app-external-param-profile', @@ -51,42 +51,42 @@ export class ExternalParamProfileComponent extends SidenavPage { - this.tenantIdentifier=params.tenantIdentifier; + this.tenantIdentifier = params.tenantIdentifier; }); } onSearchSubmit(search: string) { - this.search=search; + this.search = search; } openExternalParamProfilCreateDialog() { - const dialogRef=this.dialog.open(ExternalParamProfileCreateComponent,{ + const dialogRef = this.dialog.open(ExternalParamProfileCreateComponent, { panelClass: 'vitamui-modal', disableClose: true, - data: {tenantIdentifier: this.tenantIdentifier}, + data: { tenantIdentifier: this.tenantIdentifier }, }); dialogRef.afterClosed().subscribe((result) => { - if(result) { + if (result) { this.refreshList(); } }); } private refreshList() { - if(!this.externalParamProfileListComponent) { + if (!this.externalParamProfileListComponent) { return; } this.externalParamProfileListComponent.search(); diff --git a/ui/ui-frontend/projects/identity/src/app/external-param-profile/external-param-profile.module.ts b/ui/ui-frontend/projects/identity/src/app/external-param-profile/external-param-profile.module.ts index 9f0a8ee3de9..07be9b869a2 100644 --- a/ui/ui-frontend/projects/identity/src/app/external-param-profile/external-param-profile.module.ts +++ b/ui/ui-frontend/projects/identity/src/app/external-param-profile/external-param-profile.module.ts @@ -82,7 +82,7 @@ import { SharedService } from './shared.service'; ExternalParamProfileCreateComponent, ExternalParamProfileDetailComponent, InformationTabComponent, - ThresholdsTabComponent + ThresholdsTabComponent, ], providers: [ExternalParamProfileValidators, ProfileValidators, SharedService], }) diff --git a/ui/ui-frontend/projects/identity/src/app/external-param-profile/external-param-profile.service.ts b/ui/ui-frontend/projects/identity/src/app/external-param-profile/external-param-profile.service.ts index b4b842e4c4f..0940d95f06e 100644 --- a/ui/ui-frontend/projects/identity/src/app/external-param-profile/external-param-profile.service.ts +++ b/ui/ui-frontend/projects/identity/src/app/external-param-profile/external-param-profile.service.ts @@ -60,7 +60,7 @@ export class ExternalParamProfileService extends SearchService this.snackBarService.open({ message: error.error.message, translate: false }) - ) + (error) => this.snackBarService.open({ message: error.error.message, translate: false }), + ), ); } @@ -103,8 +103,8 @@ export class ExternalParamProfileService extends SearchService this.snackBarService.open({ message: error.error.message, translate: false }) - ) + (error) => this.snackBarService.open({ message: error.error.message, translate: false }), + ), ); } diff --git a/ui/ui-frontend/projects/identity/src/app/external-param-profile/external-param-profile.validators.ts b/ui/ui-frontend/projects/identity/src/app/external-param-profile/external-param-profile.validators.ts index 814cfabbe69..484c4510d60 100644 --- a/ui/ui-frontend/projects/identity/src/app/external-param-profile/external-param-profile.validators.ts +++ b/ui/ui-frontend/projects/identity/src/app/external-param-profile/external-param-profile.validators.ts @@ -52,10 +52,10 @@ export class ExternalParamProfileValidators { switchMap(() => control.value !== nameToIgnore ? this.externalParamProfileService.exists(tenantIdentifier, applicationName, control.value) - : of(false) + : of(false), ), take(1), - map((exists: boolean) => (exists ? { nameExists: true } : null)) + map((exists: boolean) => (exists ? { nameExists: true } : null)), ); }; }; diff --git a/ui/ui-frontend/projects/identity/src/app/external-param-profile/shared.service.ts b/ui/ui-frontend/projects/identity/src/app/external-param-profile/shared.service.ts index a8dccc0ee62..9a3fa41d896 100644 --- a/ui/ui-frontend/projects/identity/src/app/external-param-profile/shared.service.ts +++ b/ui/ui-frontend/projects/identity/src/app/external-param-profile/shared.service.ts @@ -39,7 +39,7 @@ import { BehaviorSubject, Observable } from 'rxjs'; import { Profile } from 'ui-frontend-common'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class SharedService { private sourceProfile = new BehaviorSubject(null); diff --git a/ui/ui-frontend/projects/identity/src/app/group/group-create/group-create.component.html b/ui/ui-frontend/projects/identity/src/app/group/group-create/group-create.component.html index b5a7d9b33b0..191b96a8c81 100644 --- a/ui/ui-frontend/projects/identity/src/app/group/group-create/group-create.component.html +++ b/ui/ui-frontend/projects/identity/src/app/group/group-create/group-create.component.html @@ -1,90 +1,118 @@ -
      - +
      -
      {{'GROUP.INFORMATIONS.MODAL.TITLE' | translate}}
      - - {{'GROUP.INFORMATIONS.INACTIVE_SWITCH' | translate}} - {{'GROUP.INFORMATIONS.ACTIVE_SWITCH' | translate}} +
      {{ 'GROUP.INFORMATIONS.MODAL.TITLE' | translate }}
      + + {{ 'GROUP.INFORMATIONS.INACTIVE_SWITCH' | translate }} + {{ 'GROUP.INFORMATIONS.ACTIVE_SWITCH' | translate }} -
      - - - {{'COMMON.ERROR.REQUIRED' | translate}} - {{'GROUP.INFORMATIONS.MODAL.EXISTING_NAME' | translate}} - - -
      - -
      - - {{'COMMON.ERROR.REQUIRED' | translate}} - -
      +
      + + + {{ + 'COMMON.ERROR.REQUIRED' | translate + }} + {{ + 'GROUP.INFORMATIONS.MODAL.EXISTING_NAME' | translate + }} + + +
      -
      -
      -
      {{'GROUP.INFORMATIONS.LEVEL' | translate}}
      -
      {{authService.user.level}}
      -
      +
      + + {{ + 'COMMON.ERROR.REQUIRED' | translate + }} + +
      -
      - - - {{'COMMON.ERROR.REQUIRED' | translate}} - {{'GROUP.INFORMATIONS.MODAL.WRONG_FORMAT' | translate}} - - - -
      +
      +
      +
      {{ 'GROUP.INFORMATIONS.LEVEL' | translate }}
      +
      {{ authService.user.level }}
      - -
      - - + +
      + + + {{ + 'COMMON.ERROR.REQUIRED' | translate + }} + {{ 'GROUP.INFORMATIONS.MODAL.WRONG_FORMAT' | translate }} + + +
      - + +
      + + +
      +
      +
      -
      {{'GROUP.INFORMATIONS.MODAL.PROVISIONNING_GROUP' | translate}} “{{ form.get('name').value }}”
      -
      {{'GROUP.INFORMATIONS.LEVEL' | translate}} : {{ form.get('level').value }}
      - +
      + {{ 'GROUP.INFORMATIONS.MODAL.PROVISIONNING_GROUP' | translate }} “{{ form.get('name').value }}” +
      +
      + {{ 'GROUP.INFORMATIONS.LEVEL' | translate }} : {{ form.get('level').value }} +
      +
      - - + +
      -
      {{'GROUP.INFORMATIONS.MODAL.UNITS_INFORMATION' | translate}}
      - +
      {{ 'GROUP.INFORMATIONS.MODAL.UNITS_INFORMATION' | translate }}
      +
      - - + +
      diff --git a/ui/ui-frontend/projects/identity/src/app/group/group-create/group-create.component.spec.ts b/ui/ui-frontend/projects/identity/src/app/group/group-create/group-create.component.spec.ts index 61e7a4a00e8..8913ea853e2 100644 --- a/ui/ui-frontend/projects/identity/src/app/group/group-create/group-create.component.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/group/group-create/group-create.component.spec.ts @@ -53,11 +53,13 @@ import { GroupCreateComponent } from './group-create.component'; @Component({ selector: 'app-profiles-form', template: '', - providers: [{ - provide: NG_VALUE_ACCESSOR, - useExisting: forwardRef(() => ProfilesFormStubComponent), - multi: true, - }] + providers: [ + { + provide: NG_VALUE_ACCESSOR, + useExisting: forwardRef(() => ProfilesFormStubComponent), + multi: true, + }, + ], }) class ProfilesFormStubComponent implements ControlValueAccessor { @Input() level: string; @@ -69,11 +71,13 @@ class ProfilesFormStubComponent implements ControlValueAccessor { @Component({ selector: 'app-units-form', template: '', - providers: [{ - provide: NG_VALUE_ACCESSOR, - useExisting: forwardRef(() => UnitsFormStubComponent), - multi: true, - }] + providers: [ + { + provide: NG_VALUE_ACCESSOR, + useExisting: forwardRef(() => UnitsFormStubComponent), + multi: true, + }, + ], }) class UnitsFormStubComponent implements ControlValueAccessor { writeValue() {} @@ -87,28 +91,29 @@ const expectedGroup: Group = { enabled: true, name: 'Group Name', description: 'Group Description', - level : '', + level: '', usersCount: 0, profileIds: ['profile1', 'profile2'], profiles: [], units: [], - readonly : false, + readonly: false, }; let fixture: ComponentFixture; let component: GroupCreateComponent; class Page { - - get submit() { return fixture.nativeElement.querySelector('button[type=submit]'); } - control(name: string) { return fixture.nativeElement.querySelector('[formControlName=' + name + ']'); } - + get submit() { + return fixture.nativeElement.querySelector('button[type=submit]'); + } + control(name: string) { + return fixture.nativeElement.querySelector('[formControlName=' + name + ']'); + } } let page: Page; describe('GroupCreateComponent', () => { - beforeEach(waitForAsync(() => { const matDialogRefSpy = jasmine.createSpyObj('MatDialogRef', ['close']); const profileGroupServiceSpy = jasmine.createSpyObj('GroupService', { create: of({}) }); @@ -116,18 +121,14 @@ describe('GroupCreateComponent', () => { TestBed.configureTestingModule({ imports: [ - MatProgressBarModule, - ReactiveFormsModule, - NoopAnimationsModule, - VitamUICommonTestModule, - LevelInputModule, - TranslateModule.forRoot(), - ], - declarations: [ - ProfilesFormStubComponent, - UnitsFormStubComponent, - GroupCreateComponent, + MatProgressBarModule, + ReactiveFormsModule, + NoopAnimationsModule, + VitamUICommonTestModule, + LevelInputModule, + TranslateModule.forRoot(), ], + declarations: [ProfilesFormStubComponent, UnitsFormStubComponent, GroupCreateComponent], providers: [ { provide: MatDialogRef, useValue: matDialogRefSpy }, { provide: MAT_DIALOG_DATA, useValue: {} }, @@ -137,9 +138,8 @@ describe('GroupCreateComponent', () => { { provide: GroupValidators, useValue: groupValidatorsSpy }, { provide: ConfirmDialogService, useValue: { listenToEscapeKeyPress: () => EMPTY } }, ], - schemas: [NO_ERRORS_SCHEMA] - }) - .compileComponents(); + schemas: [NO_ERRORS_SCHEMA], + }).compileComponents(); })); beforeEach(() => { @@ -170,7 +170,7 @@ describe('GroupCreateComponent', () => { enabled: expectedGroup.enabled, description: expectedGroup.description, profileIds: expectedGroup.profileIds, - units: expectedGroup.units + units: expectedGroup.units, }); fixture.detectChanges(); expect(page.submit.attributes.disabled).toBeFalsy(); @@ -190,13 +190,12 @@ describe('GroupCreateComponent', () => { enabled: expectedGroup.enabled, description: expectedGroup.description, profileIds: expectedGroup.profileIds, - units: expectedGroup.units + units: expectedGroup.units, }); expect(component.form.valid).toBeTruthy(); }); describe('Validators', () => { - describe('fields', () => { it('should be required', () => { expect(setControlValue('name', '').invalid).toBeTruthy('name'); @@ -208,7 +207,6 @@ describe('GroupCreateComponent', () => { expect(setControlValue('profileIds', '').invalid).toBeTruthy('profileIds'); expect(setControlValue('profileIds', []).invalid).toBeTruthy('profileIds'); expect(setControlValue('profileIds', ['test1']).valid).toBeTruthy('profileIds'); - }); }); @@ -223,20 +221,20 @@ describe('GroupCreateComponent', () => { describe('Component', () => { it('should call dialogRef.close', () => { - const matDialogRef = TestBed.inject(MatDialogRef); + const matDialogRef = TestBed.inject(MatDialogRef); component.onCancel(); expect(matDialogRef.close).toHaveBeenCalledTimes(1); }); it('should not call create()', () => { - const groupService = TestBed.inject(GroupService); + const groupService = TestBed.inject(GroupService); component.onSubmit(); expect(groupService.create).toHaveBeenCalledTimes(0); }); it('should call create()', () => { - const groupService = TestBed.inject(GroupService); - const matDialogRef = TestBed.inject(MatDialogRef); + const groupService = TestBed.inject(GroupService); + const matDialogRef = TestBed.inject(MatDialogRef); component.form.setValue({ customerId: expectedGroup.customerId, name: expectedGroup.name, @@ -244,12 +242,11 @@ describe('GroupCreateComponent', () => { enabled: expectedGroup.enabled, description: expectedGroup.description, profileIds: expectedGroup.profileIds, - units: expectedGroup.units + units: expectedGroup.units, }); component.onSubmit(); expect(groupService.create).toHaveBeenCalledTimes(1); expect(matDialogRef.close).toHaveBeenCalledTimes(1); }); }); - }); diff --git a/ui/ui-frontend/projects/identity/src/app/group/group-create/group-create.component.ts b/ui/ui-frontend/projects/identity/src/app/group/group-create/group-create.component.ts index a07a08d609f..b4b2e25e515 100644 --- a/ui/ui-frontend/projects/identity/src/app/group/group-create/group-create.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/group/group-create/group-create.component.ts @@ -38,30 +38,23 @@ import { Component, Inject, OnDestroy, OnInit } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; import { Subscription } from 'rxjs'; -import { AuthService, buildValidators, collapseAnimation, ConfirmDialogService , rotateAnimation} from 'ui-frontend-common'; - +import { AuthService, buildValidators, collapseAnimation, ConfirmDialogService, rotateAnimation } from 'ui-frontend-common'; import { GroupService } from '../group.service'; import { GroupValidators } from '../group.validators'; - @Component({ selector: 'app-group-create', templateUrl: './group-create.component.html', styleUrls: ['./group-create.component.scss'], - animations: [ - collapseAnimation, - rotateAnimation, - ] + animations: [collapseAnimation, rotateAnimation], }) export class GroupCreateComponent implements OnInit, OnDestroy { - form: FormGroup; public stepIndex = 0; public stepCount = 3; subLevelIsRequired: boolean; - private keyPressSubscription: Subscription; constructor( @@ -71,18 +64,18 @@ export class GroupCreateComponent implements OnInit, OnDestroy { private formBuilder: FormBuilder, private groupService: GroupService, private groupValidators: GroupValidators, - private confirmDialogService: ConfirmDialogService + private confirmDialogService: ConfirmDialogService, ) {} ngOnInit() { this.form = this.formBuilder.group({ name: [null, Validators.required, this.groupValidators.nameExists(this.authService.user.customerId)], - enabled : [true], - level : ['', buildValidators(this.authService.user)], + enabled: [true], + level: ['', buildValidators(this.authService.user)], description: [null, Validators.required], profileIds: [null, Validators.required], customerId: [this.authService.user.customerId], - units: [null] + units: [null], }); this.keyPressSubscription = this.confirmDialogService.listenToEscapeKeyPress(this.dialogRef).subscribe(() => this.onCancel()); @@ -101,17 +94,19 @@ export class GroupCreateComponent implements OnInit, OnDestroy { } onSubmit() { - if (this.form.invalid) { return; } + if (this.form.invalid) { + return; + } this.groupService.create(this.form.getRawValue()).subscribe( () => this.dialogRef.close(true), (error) => { console.error(error); - }); + }, + ); } firstStepInvalid(): boolean { - return this.form.get('name').invalid || - this.form.get('description').invalid || this.form.get('level').invalid; + return this.form.get('name').invalid || this.form.get('description').invalid || this.form.get('level').invalid; } secondStepInvalid(): boolean { @@ -121,5 +116,4 @@ export class GroupCreateComponent implements OnInit, OnDestroy { formValid(): boolean { return this.form.pending || this.form.invalid; } - } diff --git a/ui/ui-frontend/projects/identity/src/app/group/group-create/group-create.module.ts b/ui/ui-frontend/projects/identity/src/app/group/group-create/group-create.module.ts index 2028b0090dd..4041d24ce01 100644 --- a/ui/ui-frontend/projects/identity/src/app/group/group-create/group-create.module.ts +++ b/ui/ui-frontend/projects/identity/src/app/group/group-create/group-create.module.ts @@ -65,9 +65,7 @@ import { GroupCreateComponent } from './group-create.component'; VitamUICommonModule, UnitsFormModule, ], - declarations: [ - GroupCreateComponent, - ], - entryComponents: [GroupCreateComponent] + declarations: [GroupCreateComponent], + entryComponents: [GroupCreateComponent], }) -export class GroupCreateModule { } +export class GroupCreateModule {} diff --git a/ui/ui-frontend/projects/identity/src/app/group/group-list/group-criteria-builder.util.ts b/ui/ui-frontend/projects/identity/src/app/group/group-list/group-criteria-builder.util.ts index 32a12e339cf..2acf6278ba1 100644 --- a/ui/ui-frontend/projects/identity/src/app/group/group-list/group-criteria-builder.util.ts +++ b/ui/ui-frontend/projects/identity/src/app/group/group-list/group-criteria-builder.util.ts @@ -37,7 +37,6 @@ import { buildCriteriaFromFilters, Criterion, Operators, SearchQuery } from 'ui-frontend-common'; const GROUP_FILTER_CONVERTER: Readonly<{ [key: string]: (values: any[]) => Array }> = { - status: (statusList: string[]): Criterion[] => { if (statusList.length === 0) { return []; @@ -66,7 +65,7 @@ const GROUP_FILTER_CONVERTER: Readonly<{ [key: string]: (values: any[]) => Array } return [{ key: 'level', value: levelList, operator: Operators.in }]; - } + }, }; export function buildCriteriaFromGroupFilters(filterMap: { [key: string]: any[] }): Array { diff --git a/ui/ui-frontend/projects/identity/src/app/group/group-list/group-list.component.html b/ui/ui-frontend/projects/identity/src/app/group/group-list/group-list.component.html index c969ca98cef..d5340fb3e67 100644 --- a/ui/ui-frontend/projects/identity/src/app/group/group-list/group-list.component.html +++ b/ui/ui-frontend/projects/identity/src/app/group/group-list/group-list.component.html @@ -10,38 +10,63 @@
      - {{'GROUP.HOME.RESULTS_TABLE.STATUS_FILTER.ACTIVE' | translate}} + {{ 'GROUP.HOME.RESULTS_TABLE.STATUS_FILTER.ACTIVE' | translate }}
      - {{'GROUP.HOME.RESULTS_TABLE.STATUS_FILTER.INACTIVE' | translate}} + {{ 'GROUP.HOME.RESULTS_TABLE.STATUS_FILTER.INACTIVE' | translate }}
      - +
      - {{'GROUP.HOME.RESULTS_TABLE.NAME' | translate}} - + {{ 'GROUP.HOME.RESULTS_TABLE.NAME' | translate }} +
      - {{'COMMON.ID' | translate}} - + {{ 'COMMON.ID' | translate }} +
      - {{'GROUP.HOME.RESULTS_TABLE.DESCRIPTION' | translate}} - + {{ 'GROUP.HOME.RESULTS_TABLE.DESCRIPTION' | translate }} +
      - @@ -51,12 +76,18 @@ [options]="levelFilterOptions" (filterChange)="onFilterChange('level', $event)" (filterClose)="levelFilterTrigger?.close()" - [emptyValueOption]="'GROUP.HOME.RESULTS_TABLE.EMPTY_LEVEL' | translate"> + [emptyValueOption]="'GROUP.HOME.RESULTS_TABLE.EMPTY_LEVEL' | translate" + > - {{'GROUP.HOME.RESULTS_TABLE.LEVEL' | translate}} - + {{ 'GROUP.HOME.RESULTS_TABLE.LEVEL' | translate }} +
      @@ -64,31 +95,29 @@
      - - +
      {{ group.name }}
      {{ group.identifier }}
      -
      {{ group.description | truncate:50 }}
      +
      {{ group.description | truncate: 50 }}
      {{ group.level }}
      -
      -
      -
      +
      +
      +
      -
      {{'COMMON.NO_RESULT' | translate}}
      -
      +
      {{ 'COMMON.NO_RESULT' | translate }}
      + - +
      - {{'COMMON.SHOW_MORE_RESULTS' | translate}} + {{ 'COMMON.SHOW_MORE_RESULTS' | translate }}
      @@ -96,4 +125,4 @@
      -
      + diff --git a/ui/ui-frontend/projects/identity/src/app/group/group-list/group-list.component.scss b/ui/ui-frontend/projects/identity/src/app/group/group-list/group-list.component.scss index 9fc90ad3352..c5c0d49aa41 100644 --- a/ui/ui-frontend/projects/identity/src/app/group/group-list/group-list.component.scss +++ b/ui/ui-frontend/projects/identity/src/app/group/group-list/group-list.component.scss @@ -1,5 +1,5 @@ .vitamui-table-body { - .vitamui-icon-keys { - padding-left: 2rem; - } -} \ No newline at end of file + .vitamui-icon-keys { + padding-left: 2rem; + } +} diff --git a/ui/ui-frontend/projects/identity/src/app/group/group-list/group-list.component.spec.ts b/ui/ui-frontend/projects/identity/src/app/group/group-list/group-list.component.spec.ts index a6c7a92a663..f6fac93e368 100644 --- a/ui/ui-frontend/projects/identity/src/app/group/group-list/group-list.component.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/group/group-list/group-list.component.spec.ts @@ -42,10 +42,10 @@ import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; import { By } from '@angular/platform-browser'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { Router } from '@angular/router'; -import {of, Subject} from 'rxjs'; +import { of, Subject } from 'rxjs'; -import {Group, TableFilterModule} from 'ui-frontend-common'; -import {OrderByButtonModule} from 'ui-frontend-common'; +import { Group, TableFilterModule } from 'ui-frontend-common'; +import { OrderByButtonModule } from 'ui-frontend-common'; import { InfiniteScrollStubDirective, VitamUICommonTestModule } from 'ui-frontend-common/testing'; import { GroupService } from '../group.service'; import { GroupListComponent } from './group-list.component'; @@ -71,13 +71,21 @@ let component: GroupListComponent; let fixture: ComponentFixture; class Page { - - get table() { return fixture.nativeElement.querySelector('.vitamui-table'); } - get columns() { return fixture.nativeElement.querySelectorAll('.vitamui-table-head > .align-items-center'); } - get rows() { return fixture.nativeElement.querySelectorAll('.vitamui-row'); } - get loadMoreButton() { return fixture.nativeElement.querySelector('.vitamui-table-message > .clickable'); } - get infiniteScroll() { return fixture.debugElement.query(By.directive(InfiniteScrollStubDirective)); } - + get table() { + return fixture.nativeElement.querySelector('.vitamui-table'); + } + get columns() { + return fixture.nativeElement.querySelectorAll('.vitamui-table-head > .align-items-center'); + } + get rows() { + return fixture.nativeElement.querySelectorAll('.vitamui-row'); + } + get loadMoreButton() { + return fixture.nativeElement.querySelector('.vitamui-table-message > .clickable'); + } + get infiniteScroll() { + return fixture.debugElement.query(By.directive(InfiniteScrollStubDirective)); + } } let page: Page; @@ -85,7 +93,6 @@ let groups: Group[]; const levels: string[] = ['level1', 'level2']; describe('GroupListComponent', () => { - beforeEach(waitForAsync(() => { groups = [ { @@ -95,23 +102,23 @@ describe('GroupListComponent', () => { name: 'Profile Group Name 1', description: 'Profile Group Description 2', usersCount: 0, - level : '', + level: '', profileIds: [], profiles: [], units: [], - readonly : false + readonly: false, }, { id: '2', customerId: '4242442', name: 'Profile Group Name 2', description: 'Profile Group Description 2', - level : '', + level: '', usersCount: 0, profileIds: [], profiles: [], units: [], - readonly : false + readonly: false, }, ]; @@ -120,38 +127,25 @@ describe('GroupListComponent', () => { canLoadMore: true, loadMore: () => of(groups), updated: new Subject(), - getNonEmptyLevels: () => of(levels) + getNonEmptyLevels: () => of(levels), }; const matDialogSpy = jasmine.createSpyObj('MatDialog', ['open']); const routerSpy = jasmine.createSpyObj('Router', ['navigate']); matDialogSpy.open.and.returnValue({ afterClosed: () => of(true) }); TestBed.configureTestingModule({ - imports: [ - MatProgressSpinnerModule, - NoopAnimationsModule, - VitamUICommonTestModule, - TableFilterModule, - OrderByButtonModule - ], - declarations: [ - GroupListComponent, - CollapseStubDirective, - CollapseTriggerForStubDirective, - OwnerListStubComponent - ], + imports: [MatProgressSpinnerModule, NoopAnimationsModule, VitamUICommonTestModule, TableFilterModule, OrderByButtonModule], + declarations: [GroupListComponent, CollapseStubDirective, CollapseTriggerForStubDirective, OwnerListStubComponent], providers: [ { provide: GroupService, useValue: groupListServiceSpy }, { provide: MatDialog, useValue: matDialogSpy }, { provide: Router, useValue: routerSpy }, - ] - }) - .compileComponents(); + ], + }).compileComponents(); const groupService = TestBed.inject(GroupService); spyOn(groupService, 'search').and.callThrough(); spyOn(groupService, 'loadMore').and.callThrough(); - })); beforeEach(() => { @@ -199,7 +193,7 @@ describe('GroupListComponent', () => { }); it('should hide the "load more" button ', () => { - TestBed.inject(GroupService); + TestBed.inject(GroupService); fixture.detectChanges(); expect(page.loadMoreButton).toBeFalsy(); }); @@ -230,5 +224,4 @@ describe('GroupListComponent', () => { const cells = page.rows[index].querySelectorAll('div'); expect(cells.length).toBe(5); } - }); diff --git a/ui/ui-frontend/projects/identity/src/app/group/group-list/group-list.component.ts b/ui/ui-frontend/projects/identity/src/app/group/group-list/group-list.component.ts index 1182e5ce687..d46a1fff70c 100644 --- a/ui/ui-frontend/projects/identity/src/app/group/group-list/group-list.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/group/group-list/group-list.component.ts @@ -35,12 +35,13 @@ * knowledge of the CeCILL-C license and that you accept its terms. */ -import {Component, EventEmitter, Inject, Input, LOCALE_ID, OnDestroy, OnInit, Output} from '@angular/core'; -import {merge, Subject, Subscription} from 'rxjs'; +import { Component, EventEmitter, Inject, Input, LOCALE_ID, OnDestroy, OnInit, Output } from '@angular/core'; +import { merge, Subject, Subscription } from 'rxjs'; import { buildCriteriaFromSearch, - collapseAnimation, DEFAULT_PAGE_SIZE, + collapseAnimation, + DEFAULT_PAGE_SIZE, Direction, Group, InfiniteScrollTable, @@ -49,19 +50,15 @@ import { SearchQuery, } from 'ui-frontend-common'; import { GroupService } from '../group.service'; -import {buildCriteriaFromGroupFilters} from './group-criteria-builder.util'; +import { buildCriteriaFromGroupFilters } from './group-criteria-builder.util'; @Component({ selector: 'app-group-list', templateUrl: './group-list.component.html', styleUrls: ['./group-list.component.scss'], - animations: [ - collapseAnimation, - rotateAnimation, - ] + animations: [collapseAnimation, rotateAnimation], }) export class GroupListComponent extends InfiniteScrollTable implements OnDestroy, OnInit { - @Output() groupClick = new EventEmitter(); private updatedGroupSub: Subscription; @@ -73,17 +70,11 @@ export class GroupListComponent extends InfiniteScrollTable implements On } // tslint:disable-next-line:variable-name private _search: string; - private readonly searchKeys = [ - 'identifier', - 'name', - 'level', - 'description', - 'units' - ]; + private readonly searchKeys = ['identifier', 'name', 'level', 'description', 'units']; filterMap: { [key: string]: any[] } = { status: ['ENABLED'], - level: null + level: null, }; orderBy = 'name'; @@ -93,10 +84,12 @@ export class GroupListComponent extends InfiniteScrollTable implements On private readonly orderChange = new Subject(); private readonly searchChange = new Subject(); - levelFilterOptions: Array<{ value: string, label: string }> = []; + levelFilterOptions: Array<{ value: string; label: string }> = []; - constructor(public groupService: GroupService, - @Inject(LOCALE_ID) private locale: string) { + constructor( + public groupService: GroupService, + @Inject(LOCALE_ID) private locale: string, + ) { super(groupService); } @@ -109,23 +102,18 @@ export class GroupListComponent extends InfiniteScrollTable implements On if (profileGroupIndex > -1) { this.dataSource[profileGroupIndex] = updatedGroup; } - }); const searchCriteriaChange = merge(this.searchChange, this.filterChange, this.orderChange); searchCriteriaChange.subscribe(() => { const query: SearchQuery = { - criteria: [ - ...buildCriteriaFromGroupFilters(this.filterMap), - ...buildCriteriaFromSearch(this._search, this.searchKeys) - ] + criteria: [...buildCriteriaFromGroupFilters(this.filterMap), ...buildCriteriaFromSearch(this._search, this.searchKeys)], }; const pageRequest = new PageRequest(0, DEFAULT_PAGE_SIZE, this.orderBy, this.direction, JSON.stringify(query)); this.search(pageRequest); }); - } onFilterChange(key: string, values: any[]) { @@ -143,13 +131,12 @@ export class GroupListComponent extends InfiniteScrollTable implements On private refreshLevelOptions(query?: SearchQuery) { this.groupService.getNonEmptyLevels(query).subscribe((levels: string[]) => { - this.levelFilterOptions = levels.map((level: string) => ({value: level, label: level })); + this.levelFilterOptions = levels.map((level: string) => ({ value: level, label: level })); this.levelFilterOptions.sort(sortByLabel(this.locale)); }); } } - function sortByLabel(locale: string): (a: { label: string }, b: { label: string }) => number { return (a: { label: string }, b: { label: string }) => a.label.localeCompare(b.label, locale); } diff --git a/ui/ui-frontend/projects/identity/src/app/group/group-list/group-list.module.ts b/ui/ui-frontend/projects/identity/src/app/group/group-list/group-list.module.ts index 1ff07fdf5c6..b249d7de30c 100644 --- a/ui/ui-frontend/projects/identity/src/app/group/group-list/group-list.module.ts +++ b/ui/ui-frontend/projects/identity/src/app/group/group-list/group-list.module.ts @@ -45,19 +45,8 @@ import { SharedModule } from '../../shared/shared.module'; import { GroupListComponent } from './group-list.component'; @NgModule({ - imports: [ - CommonModule, - SharedModule, - RouterModule, - MatRippleModule, - MatProgressSpinnerModule, - VitamUICommonModule, - ], - declarations: [ - GroupListComponent, - ], - exports: [ - GroupListComponent, - ] + imports: [CommonModule, SharedModule, RouterModule, MatRippleModule, MatProgressSpinnerModule, VitamUICommonModule], + declarations: [GroupListComponent], + exports: [GroupListComponent], }) -export class GroupListModule { } +export class GroupListModule {} diff --git a/ui/ui-frontend/projects/identity/src/app/group/group-preview/group-popup.component.ts b/ui/ui-frontend/projects/identity/src/app/group/group-preview/group-popup.component.ts index 0d2b14bb9da..1fe8fe84081 100644 --- a/ui/ui-frontend/projects/identity/src/app/group/group-preview/group-popup.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/group/group-preview/group-popup.component.ts @@ -41,21 +41,18 @@ import { Group } from 'ui-frontend-common'; @Component({ selector: 'app-group-popup', - template: '' + template: '', }) export class GroupPopupComponent implements OnInit { - group: Group; constructor(private route: ActivatedRoute) { this.group = this.route.snapshot.data.group; } - ngOnInit() { - } + ngOnInit() {} closePopup() { window.close(); } - } diff --git a/ui/ui-frontend/projects/identity/src/app/group/group-preview/group-preview.component.html b/ui/ui-frontend/projects/identity/src/app/group/group-preview/group-preview.component.html index 8b724938504..55c26798e5f 100644 --- a/ui/ui-frontend/projects/identity/src/app/group/group-preview/group-preview.component.html +++ b/ui/ui-frontend/projects/identity/src/app/group/group-preview/group-preview.component.html @@ -2,7 +2,8 @@ [title]="group?.name" [icon]="'vitamui-icon-keys'" [badge]="group?.enabled ? 'green' : 'grey'" - (onclose)="emitClose()"> + (onclose)="emitClose()" +>
      @@ -14,9 +15,14 @@ - + - + -
      \ No newline at end of file +
      diff --git a/ui/ui-frontend/projects/identity/src/app/group/group-preview/group-preview.component.ts b/ui/ui-frontend/projects/identity/src/app/group/group-preview/group-preview.component.ts index cf5b59ab60e..8a646af3120 100644 --- a/ui/ui-frontend/projects/identity/src/app/group/group-preview/group-preview.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/group/group-preview/group-preview.component.ts @@ -38,16 +38,14 @@ import { Component, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Output, S import { Subscription } from 'rxjs'; import { AuthService, Group, isLevelAllowed, StartupService } from 'ui-frontend-common'; - import { GroupService } from '../group.service'; @Component({ selector: 'app-group-preview', templateUrl: './group-preview.component.html', - styleUrls: ['./group-preview.component.scss'] + styleUrls: ['./group-preview.component.scss'], }) export class GroupPreviewComponent implements OnInit, OnDestroy, OnChanges { - @Input() isPopup: boolean; @Input() group: Group; @@ -58,15 +56,16 @@ export class GroupPreviewComponent implements OnInit, OnDestroy, OnChanges { public groupUsersCount: number; constructor( - private groupService: GroupService, private authService: AuthService, - private startupService: StartupService + private groupService: GroupService, + private authService: AuthService, + private startupService: StartupService, ) {} ngOnInit(): void { - if(this.group) { + if (this.group) { this.groupService.get(this.group.id).subscribe((groupRetrieved) => { this.group = groupRetrieved; - this.groupService.updated.next(groupRetrieved) + this.groupService.updated.next(groupRetrieved); }); } @@ -79,17 +78,20 @@ export class GroupPreviewComponent implements OnInit, OnDestroy, OnChanges { ngOnChanges(changes: SimpleChanges): void { if (changes.hasOwnProperty('group')) { - if(this.group) { + if (this.group) { this.groupService.get(this.group.id).subscribe((groupRetrieved) => { this.group = groupRetrieved; - this.groupService.updated.next(groupRetrieved) + this.groupService.updated.next(groupRetrieved); }); } } } openPopup() { - window.open(this.startupService.getConfigStringValue('UI_URL') - + '/group/' + this.group.id, 'detailPopup', 'width=584, height=713, resizable=no, location=no'); + window.open( + this.startupService.getConfigStringValue('UI_URL') + '/group/' + this.group.id, + 'detailPopup', + 'width=584, height=713, resizable=no, location=no', + ); this.emitClose(); } @@ -108,9 +110,8 @@ export class GroupPreviewComponent implements OnInit, OnDestroy, OnChanges { } filterEvents(event: any): boolean { - return event.outDetail && ( - event.outDetail.includes('EXT_VITAMUI_CREATE_GROUP') || - event.outDetail.includes('EXT_VITAMUI_UPDATE_GROUP') + return ( + event.outDetail && (event.outDetail.includes('EXT_VITAMUI_CREATE_GROUP') || event.outDetail.includes('EXT_VITAMUI_UPDATE_GROUP')) ); } } diff --git a/ui/ui-frontend/projects/identity/src/app/group/group-preview/group-preview.module.ts b/ui/ui-frontend/projects/identity/src/app/group/group-preview/group-preview.module.ts index d92f5e9f240..f4ddaeb109b 100644 --- a/ui/ui-frontend/projects/identity/src/app/group/group-preview/group-preview.module.ts +++ b/ui/ui-frontend/projects/identity/src/app/group/group-preview/group-preview.module.ts @@ -65,7 +65,7 @@ import { ProfilesTabComponent } from './profiles-tab/profiles-tab.component'; MatProgressBarModule, ReactiveFormsModule, VitamUICommonModule, - UnitsFormModule + UnitsFormModule, ], declarations: [ GroupPopupComponent, @@ -77,6 +77,6 @@ import { ProfilesTabComponent } from './profiles-tab/profiles-tab.component'; ], exports: [GroupPreviewComponent], providers: [GroupValidators], - entryComponents: [ProfilesEditComponent] + entryComponents: [ProfilesEditComponent], }) -export class GroupPreviewModule { } +export class GroupPreviewModule {} diff --git a/ui/ui-frontend/projects/identity/src/app/group/group-preview/information-tab/information-tab.component.html b/ui/ui-frontend/projects/identity/src/app/group/group-preview/information-tab/information-tab.component.html index 579499ca698..cf4d3b4cab5 100644 --- a/ui/ui-frontend/projects/identity/src/app/group/group-preview/information-tab/information-tab.component.html +++ b/ui/ui-frontend/projects/identity/src/app/group/group-preview/information-tab/information-tab.component.html @@ -1,34 +1,54 @@
      - - {{'GROUP.INFORMATIONS.INACTIVE_SWITCH' | translate}} - {{'GROUP.INFORMATIONS.ACTIVE_SWITCH' | translate}} + + {{ 'GROUP.INFORMATIONS.INACTIVE_SWITCH' | translate }} + {{ 'GROUP.INFORMATIONS.ACTIVE_SWITCH' | translate }}
      -
      - - -
      +
      + +
      +
      - - {{'COMMON.ERROR.REQUIRED' | translate}} - {{'GROUP.INFORMATIONS.EXISTING_NAME' | translate}} + + {{ 'COMMON.ERROR.REQUIRED' | translate }} + {{ 'GROUP.INFORMATIONS.EXISTING_NAME' | translate }}
      - - {{'COMMON.ERROR.REQUIRED' | translate}} + [asyncValidator]="form?.get('description')?.asyncValidator" + > + {{ 'COMMON.ERROR.REQUIRED' | translate }}
      @@ -36,19 +56,25 @@
      - -
      {{authService.user.level}}
      + +
      {{ authService.user.level }}
      -
      +
      - {{'COMMON.ERROR.REQUIRED' | translate}} - {{'GROUP.INFORMATIONS.WRONG_FORMAT' | translate}} + [validator]="form?.get('level')?.validator" + > + {{ 'COMMON.ERROR.REQUIRED' | translate }} + {{ 'GROUP.INFORMATIONS.WRONG_FORMAT' | translate }}
      @@ -58,11 +84,11 @@
      -
      -
      {{'GROUP.INFORMATIONS.UNITS_TABLE_TITLE' | translate}}
      -
      {{ unit}}
      +
      +
      {{ 'GROUP.INFORMATIONS.UNITS_TABLE_TITLE' | translate }}
      +
      {{ unit }}
      diff --git a/ui/ui-frontend/projects/identity/src/app/group/group-preview/information-tab/information-tab.component.spec.ts b/ui/ui-frontend/projects/identity/src/app/group/group-preview/information-tab/information-tab.component.spec.ts index 31b2a645905..bc815e85295 100644 --- a/ui/ui-frontend/projects/identity/src/app/group/group-preview/information-tab/information-tab.component.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/group/group-preview/information-tab/information-tab.component.spec.ts @@ -76,38 +76,36 @@ describe('Profile Group InformationTabComponent', () => { const matDialogSpy = jasmine.createSpyObj('MatDialog', ['open']); matDialogSpy.open.and.returnValue({ afterClosed: () => of(true) }); - beforeEach( - waitForAsync(() => { - expectedGroup = { - id: '42', - enabled: true, - identifier: '1', - customerId: '4242442', - name: 'Group Name', - description: 'Group Description', - level: '', - usersCount: 0, - profileIds: [], - profiles: [], - units: [], - readonly: false, - }; + beforeEach(waitForAsync(() => { + expectedGroup = { + id: '42', + enabled: true, + identifier: '1', + customerId: '4242442', + name: 'Group Name', + description: 'Group Description', + level: '', + usersCount: 0, + profileIds: [], + profiles: [], + units: [], + readonly: false, + }; - TestBed.configureTestingModule({ - imports: [ReactiveFormsModule, VitamUICommonTestModule, LoggerModule.forRoot(), HttpClientTestingModule], - declarations: [InformationTabComponent, TestHostComponent, MatTooltipStubDirective], - providers: [ - { provide: WINDOW_LOCATION, useValue: window.location }, - { provide: BASE_URL, useValue: '/fake-api' }, - { provide: MatDialog, useValue: matDialogSpy }, - { provide: GroupService, useValue: groupServiceSpy }, - { provide: GroupValidators, useValue: groupValidatorsSpy }, - { provide: AuthService, useValue: authServiceMock }, - { provide: CountryService, useValue: { getAvailableCountries: () => EMPTY } }, - ], - }).compileComponents(); - }) - ); + TestBed.configureTestingModule({ + imports: [ReactiveFormsModule, VitamUICommonTestModule, LoggerModule.forRoot(), HttpClientTestingModule], + declarations: [InformationTabComponent, TestHostComponent, MatTooltipStubDirective], + providers: [ + { provide: WINDOW_LOCATION, useValue: window.location }, + { provide: BASE_URL, useValue: '/fake-api' }, + { provide: MatDialog, useValue: matDialogSpy }, + { provide: GroupService, useValue: groupServiceSpy }, + { provide: GroupValidators, useValue: groupValidatorsSpy }, + { provide: AuthService, useValue: authServiceMock }, + { provide: CountryService, useValue: { getAvailableCountries: () => EMPTY } }, + ], + }).compileComponents(); + })); beforeEach(() => { fixture = TestBed.createComponent(TestHostComponent); diff --git a/ui/ui-frontend/projects/identity/src/app/group/group-preview/information-tab/information-tab.component.ts b/ui/ui-frontend/projects/identity/src/app/group/group-preview/information-tab/information-tab.component.ts index dcda627c5c9..e152a7254d0 100644 --- a/ui/ui-frontend/projects/identity/src/app/group/group-preview/information-tab/information-tab.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/group/group-preview/information-tab/information-tab.component.ts @@ -53,18 +53,17 @@ const DEBOUNCE_TIME = 200; @Component({ selector: 'app-information-tab', templateUrl: './information-tab.component.html', - styleUrls: ['./information-tab.component.scss'] + styleUrls: ['./information-tab.component.scss'], }) export class InformationTabComponent implements OnDestroy, OnChanges { - form: FormGroup; groupsCount: number; previousValue: { - id: string, + id: string; enabled: boolean; - name: string, - level: string, - description: string, + name: string; + level: string; + description: string; }; private updateSub: Subscription; @@ -78,15 +77,15 @@ export class InformationTabComponent implements OnDestroy, OnChanges { private groupService: GroupService, private groupValidators: GroupValidators, public authService: AuthService, - private dialog: MatDialog + private dialog: MatDialog, ) { this.form = this.formBuilder.group({ id: [null, Validators.required], - identifier: [{value: null, disabled : true}, Validators.required], + identifier: [{ value: null, disabled: true }, Validators.required], enabled: [false], name: [null, Validators.required], description: [null, Validators.required], - level: [null, buildValidators(this.authService.user)] + level: [null, buildValidators(this.authService.user)], }); this.updateSub = merge(this.form.valueChanges, this.form.statusChanges) @@ -95,17 +94,16 @@ export class InformationTabComponent implements OnDestroy, OnChanges { map(() => diff(this.form.value, this.previousValue)), filter((formData) => !isEmpty(formData)), map((formData) => extend({ id: this.group.id }, formData)), - switchMap((formData) => this.groupService.patch(formData).pipe(catchError(() => of(null)))) + switchMap((formData) => this.groupService.patch(formData).pipe(catchError(() => of(null)))), ) - .subscribe(() => this.previousValue = this.form.value); - + .subscribe(() => (this.previousValue = this.form.value)); } ngOnChanges(changes: SimpleChanges) { if (changes.hasOwnProperty('group') || changes.hasOwnProperty('readOnly')) { if (this.group) { - this.resetForm(this.form, this.group, this.readOnly); - this.previousValue = this.form.value; + this.resetForm(this.form, this.group, this.readOnly); + this.previousValue = this.form.value; } } } @@ -129,13 +127,13 @@ export class InformationTabComponent implements OnDestroy, OnChanges { } form.enable({ emitEvent: false }); - form.get('identifier').disable({emitEvent: false}); + form.get('identifier').disable({ emitEvent: false }); if (group.usersCount) { - this.form.get('enabled').disable({emitEvent : false}); + this.form.get('enabled').disable({ emitEvent: false }); } if (group.profileIds && group.profileIds.length) { - this.form.get('level').disable({emitEvent : false}); + this.form.get('level').disable({ emitEvent: false }); } } @@ -150,12 +148,11 @@ export class InformationTabComponent implements OnDestroy, OnChanges { }, autoFocus: false, disableClose: true, - panelClass: 'vitamui-modal' + panelClass: 'vitamui-modal', }); } getUnits(group: Group): string[] { return group?.units?.sort((a: any, b: any) => a.localeCompare(b)); } - } diff --git a/ui/ui-frontend/projects/identity/src/app/group/group-preview/information-tab/units-edit/units-edit.component.html b/ui/ui-frontend/projects/identity/src/app/group/group-preview/information-tab/units-edit/units-edit.component.html index 16448ee84df..c2ba22bc90f 100644 --- a/ui/ui-frontend/projects/identity/src/app/group/group-preview/information-tab/units-edit/units-edit.component.html +++ b/ui/ui-frontend/projects/identity/src/app/group/group-preview/information-tab/units-edit/units-edit.component.html @@ -1,20 +1,19 @@
      - +
      - +
      - - -
      -
      {{'GROUP.INFORMATIONS.MODAL.UPDATE_UNITS' | translate}} "{{ data?.group?.name }}"
      - - -
      - - -
      -
      -
      -
      + + +
      +
      {{ 'GROUP.INFORMATIONS.MODAL.UPDATE_UNITS' | translate }} "{{ data?.group?.name }}"
      + + +
      + + +
      +
      +
      +
      - \ No newline at end of file diff --git a/ui/ui-frontend/projects/identity/src/app/group/group-preview/information-tab/units-edit/units-edit.component.spec.ts b/ui/ui-frontend/projects/identity/src/app/group/group-preview/information-tab/units-edit/units-edit.component.spec.ts index de084d219bd..5d2b4eefd49 100644 --- a/ui/ui-frontend/projects/identity/src/app/group/group-preview/information-tab/units-edit/units-edit.component.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/group/group-preview/information-tab/units-edit/units-edit.component.spec.ts @@ -69,24 +69,22 @@ describe('UnitsEditComponent', () => { let component: UnitsEditComponent; let fixture: ComponentFixture; - beforeEach( - waitForAsync(() => { - const matDialogRefSpy = jasmine.createSpyObj('MatDialogRef', ['close']); + beforeEach(waitForAsync(() => { + const matDialogRefSpy = jasmine.createSpyObj('MatDialogRef', ['close']); - TestBed.configureTestingModule({ - imports: [HttpClientTestingModule, MatProgressBarModule, ReactiveFormsModule, NoopAnimationsModule, VitamUICommonTestModule], - declarations: [UnitsEditComponent, UnitsFormStubComponent], - providers: [ - { provide: MAT_DIALOG_DATA, useValue: { group: { id: '42', name: 'Test', units: [] } } }, - { provide: MatDialogRef, useValue: matDialogRefSpy }, - { provide: GroupService, useValue: { patch: () => of({ result: 'test' }) } }, - { provide: BASE_URL, useValue: '/fake-api' }, - { provide: ConfirmDialogService, useValue: { listenToEscapeKeyPress: () => EMPTY } }, - ], - schemas: [NO_ERRORS_SCHEMA], - }).compileComponents(); - }) - ); + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule, MatProgressBarModule, ReactiveFormsModule, NoopAnimationsModule, VitamUICommonTestModule], + declarations: [UnitsEditComponent, UnitsFormStubComponent], + providers: [ + { provide: MAT_DIALOG_DATA, useValue: { group: { id: '42', name: 'Test', units: [] } } }, + { provide: MatDialogRef, useValue: matDialogRefSpy }, + { provide: GroupService, useValue: { patch: () => of({ result: 'test' }) } }, + { provide: BASE_URL, useValue: '/fake-api' }, + { provide: ConfirmDialogService, useValue: { listenToEscapeKeyPress: () => EMPTY } }, + ], + schemas: [NO_ERRORS_SCHEMA], + }).compileComponents(); + })); beforeEach(() => { fixture = TestBed.createComponent(UnitsEditComponent); diff --git a/ui/ui-frontend/projects/identity/src/app/group/group-preview/information-tab/units-edit/units-edit.component.ts b/ui/ui-frontend/projects/identity/src/app/group/group-preview/information-tab/units-edit/units-edit.component.ts index a6bc77c9c04..9880cd5f3f7 100644 --- a/ui/ui-frontend/projects/identity/src/app/group/group-preview/information-tab/units-edit/units-edit.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/group/group-preview/information-tab/units-edit/units-edit.component.ts @@ -48,10 +48,9 @@ import { GroupService } from '../../../group.service'; @Component({ selector: 'app-units-edit', templateUrl: './units-edit.component.html', - styleUrls: ['./units-edit.component.css'] + styleUrls: ['./units-edit.component.css'], }) export class UnitsEditComponent implements OnInit, OnDestroy { - form: FormGroup; private keyPressSubscription: Subscription; @@ -61,32 +60,37 @@ export class UnitsEditComponent implements OnInit, OnDestroy { @Inject(MAT_DIALOG_DATA) public data: { group: Group }, private groupService: GroupService, private confirmDialogService: ConfirmDialogService, - formBuilder: FormBuilder - ) { - this.form = formBuilder.group({ - units: [this.data.group.units] - }); - } + formBuilder: FormBuilder, + ) { + this.form = formBuilder.group({ + units: [this.data.group.units], + }); + } - ngOnInit() { - this.keyPressSubscription = this.confirmDialogService.listenToEscapeKeyPress(this.dialogRef).subscribe(() => this.onCancel()); - } + ngOnInit() { + this.keyPressSubscription = this.confirmDialogService.listenToEscapeKeyPress(this.dialogRef).subscribe(() => this.onCancel()); + } - ngOnDestroy() { - this.keyPressSubscription.unsubscribe(); - } + ngOnDestroy() { + this.keyPressSubscription.unsubscribe(); + } - onSubmit() { - if (this.form.pristine || this.form.invalid) { return; } - this.groupService.patch({ id: this.data.group.id, units: this.form.value.units}).pipe(take(1)).subscribe( + onSubmit() { + if (this.form.pristine || this.form.invalid) { + return; + } + this.groupService + .patch({ id: this.data.group.id, units: this.form.value.units }) + .pipe(take(1)) + .subscribe( (response) => this.dialogRef.close(response), (error) => { console.error(error); - }); - } - - onCancel() { - this.form.dirty ? this.confirmDialogService.confirmBeforeClosing(this.dialogRef) : this.dialogRef.close(); - } + }, + ); + } + onCancel() { + this.form.dirty ? this.confirmDialogService.confirmBeforeClosing(this.dialogRef) : this.dialogRef.close(); + } } diff --git a/ui/ui-frontend/projects/identity/src/app/group/group-preview/profiles-tab/profiles-edit/profiles-edit.component.html b/ui/ui-frontend/projects/identity/src/app/group/group-preview/profiles-tab/profiles-edit/profiles-edit.component.html index f1950cca5e9..3d12abd3691 100644 --- a/ui/ui-frontend/projects/identity/src/app/group/group-preview/profiles-tab/profiles-edit/profiles-edit.component.html +++ b/ui/ui-frontend/projects/identity/src/app/group/group-preview/profiles-tab/profiles-edit/profiles-edit.component.html @@ -3,19 +3,18 @@
      - - + + +
      +
      {{ 'GROUP.PROFILE.MODAL.TITLE' | translate }} "{{ data?.group?.name }}"
      -
      -
      {{'GROUP.PROFILE.MODAL.TITLE' | translate}} "{{ data?.group?.name }}"
      + - - -
      - - -
      -
      - - +
      + + +
      +
      +
      +
      diff --git a/ui/ui-frontend/projects/identity/src/app/group/group-preview/profiles-tab/profiles-edit/profiles-edit.component.spec.ts b/ui/ui-frontend/projects/identity/src/app/group/group-preview/profiles-tab/profiles-edit/profiles-edit.component.spec.ts index 1919e4b03ea..038bb299166 100644 --- a/ui/ui-frontend/projects/identity/src/app/group/group-preview/profiles-tab/profiles-edit/profiles-edit.component.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/group/group-preview/profiles-tab/profiles-edit/profiles-edit.component.spec.ts @@ -52,18 +52,20 @@ import { ProfilesEditComponent } from './profiles-edit.component'; @Component({ selector: 'app-profiles-form', template: '', - providers: [{ - provide: NG_VALUE_ACCESSOR, - useExisting: forwardRef(() => ProfilesFormStubComponent), - multi: true, - }] + providers: [ + { + provide: NG_VALUE_ACCESSOR, + useExisting: forwardRef(() => ProfilesFormStubComponent), + multi: true, + }, + ], }) class ProfilesFormStubComponent { @Input() level: any; writeValue() {} - registerOnChange() { } - registerOnTouched() { } + registerOnChange() {} + registerOnTouched() {} } describe('ProfilesEditComponent', () => { @@ -74,14 +76,8 @@ describe('ProfilesEditComponent', () => { const matDialogRefSpy = jasmine.createSpyObj('MatDialogRef', ['close']); TestBed.configureTestingModule({ - imports: [ - HttpClientTestingModule, - MatProgressBarModule, - ReactiveFormsModule, - NoopAnimationsModule, - VitamUICommonTestModule - ], - declarations: [ ProfilesEditComponent, ProfilesFormStubComponent ], + imports: [HttpClientTestingModule, MatProgressBarModule, ReactiveFormsModule, NoopAnimationsModule, VitamUICommonTestModule], + declarations: [ProfilesEditComponent, ProfilesFormStubComponent], providers: [ { provide: MAT_DIALOG_DATA, useValue: { group: { id: '42', name: 'Test', profileIds: [] } } }, { provide: MatDialogRef, useValue: matDialogRefSpy }, @@ -89,9 +85,8 @@ describe('ProfilesEditComponent', () => { { provide: BASE_URL, useValue: '/fake-api' }, { provide: ConfirmDialogService, useValue: { listenToEscapeKeyPress: () => EMPTY } }, ], - schemas: [NO_ERRORS_SCHEMA] - }) - .compileComponents(); + schemas: [NO_ERRORS_SCHEMA], + }).compileComponents(); })); beforeEach(() => { @@ -105,7 +100,6 @@ describe('ProfilesEditComponent', () => { }); describe('DOM', () => { - it('should have a title', () => { const elTitle = fixture.nativeElement.querySelector('.text, .large'); expect(elTitle).toBeTruthy(); @@ -137,11 +131,9 @@ describe('ProfilesEditComponent', () => { elCancel.click(); expect(component.onCancel).toHaveBeenCalledTimes(1); }); - }); describe('Component', () => { - it('should call groupService.patch', () => { const groupService = TestBed.inject(GroupService); spyOn(groupService, 'patch').and.callThrough(); @@ -174,6 +166,5 @@ describe('ProfilesEditComponent', () => { component.onCancel(); expect(matDialogRefSpy.close).toHaveBeenCalledTimes(1); }); - }); }); diff --git a/ui/ui-frontend/projects/identity/src/app/group/group-preview/profiles-tab/profiles-edit/profiles-edit.component.ts b/ui/ui-frontend/projects/identity/src/app/group/group-preview/profiles-tab/profiles-edit/profiles-edit.component.ts index a4679aa5422..4346a348d09 100644 --- a/ui/ui-frontend/projects/identity/src/app/group/group-preview/profiles-tab/profiles-edit/profiles-edit.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/group/group-preview/profiles-tab/profiles-edit/profiles-edit.component.ts @@ -44,10 +44,9 @@ import { GroupService } from '../../../group.service'; @Component({ selector: 'app-profiles-edit', templateUrl: './profiles-edit.component.html', - styleUrls: ['./profiles-edit.component.scss'] + styleUrls: ['./profiles-edit.component.scss'], }) export class ProfilesEditComponent implements OnInit, OnDestroy { - form: FormGroup; public stepIndex = 0; @@ -60,10 +59,10 @@ export class ProfilesEditComponent implements OnInit, OnDestroy { @Inject(MAT_DIALOG_DATA) public data: { group: Group }, private groupService: GroupService, private confirmDialogService: ConfirmDialogService, - formBuilder: FormBuilder + formBuilder: FormBuilder, ) { this.form = formBuilder.group({ - profileIds: [this.data.group.profileIds, Validators.required] + profileIds: [this.data.group.profileIds, Validators.required], }); } @@ -76,12 +75,15 @@ export class ProfilesEditComponent implements OnInit, OnDestroy { } onSubmit() { - if (this.form.pristine || this.form.invalid) { return; } - this.groupService.patch({ id: this.data.group.id, profileIds: this.form.value.profileIds}).subscribe( + if (this.form.pristine || this.form.invalid) { + return; + } + this.groupService.patch({ id: this.data.group.id, profileIds: this.form.value.profileIds }).subscribe( (response) => this.dialogRef.close(response), (error) => { console.error(error); - }); + }, + ); } onCancel() { @@ -91,5 +93,4 @@ export class ProfilesEditComponent implements OnInit, OnDestroy { this.dialogRef.close(); } } - } diff --git a/ui/ui-frontend/projects/identity/src/app/group/group-preview/profiles-tab/profiles-tab.component.html b/ui/ui-frontend/projects/identity/src/app/group/group-preview/profiles-tab/profiles-tab.component.html index 0b2bfd6979d..ca47e8ad1f6 100644 --- a/ui/ui-frontend/projects/identity/src/app/group/group-preview/profiles-tab/profiles-tab.component.html +++ b/ui/ui-frontend/projects/identity/src/app/group/group-preview/profiles-tab/profiles-tab.component.html @@ -1,16 +1,18 @@
      {{ 'APPLICATION.' + profile.appId + '.NAME' | translate }}
      -
      {{ profile?.tenantName }} : {{ profile?.profileName | titlecase}}
      +
      {{ profile?.tenantName }} : {{ profile?.profileName | titlecase }}
      - +
      -
      \ No newline at end of file +
      diff --git a/ui/ui-frontend/projects/identity/src/app/group/group-preview/profiles-tab/profiles-tab.component.spec.ts b/ui/ui-frontend/projects/identity/src/app/group/group-preview/profiles-tab/profiles-tab.component.spec.ts index 01f16f557d5..884710638b5 100644 --- a/ui/ui-frontend/projects/identity/src/app/group/group-preview/profiles-tab/profiles-tab.component.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/group/group-preview/profiles-tab/profiles-tab.component.spec.ts @@ -54,9 +54,7 @@ class MatTooltipStubDirective { } @Component({ - template: ` - - ` + template: ` `, }) class TesthostComponent { readOnly = false; @@ -66,7 +64,7 @@ class TesthostComponent { customerId: '42', name: 'Profile Group Name', level: 'level', - usersCount : 0, + usersCount: 0, description: 'Profile Group Description', profileIds: [], units: [], @@ -85,7 +83,7 @@ class TesthostComponent { tenantIdentifier: 1, roles: [], externalParamId: null, - readonly: false + readonly: false, }, { id: '2', @@ -101,7 +99,7 @@ class TesthostComponent { tenantIdentifier: 2, roles: [], externalParamId: null, - readonly: false + readonly: false, }, { id: '3', @@ -117,10 +115,10 @@ class TesthostComponent { tenantIdentifier: 1, roles: [], externalParamId: null, - readonly: false + readonly: false, }, ], - readonly: true + readonly: true, }; } @@ -129,31 +127,31 @@ const expectedApp = [ id: 'CUSTOMERS_APP', identifier: 'CUSTOMERS_APP', name: 'Organisations', - url: '' + url: '', }, { id: 'ARCHIVE_APP', identifier: 'ARCHIVE_APP', name: 'Archives', - url: '' + url: '', }, { id: 'USERS_APP', identifier: 'USERS_APP', name: 'Utilisateurs', - url: '' + url: '', }, { id: 'GROUPS_APP', identifier: 'GROUPS_APP', name: 'Groupes de profils', - url: '' + url: '', }, { id: 'PROFILES_APP', identifier: 'PROFILES_APP', name: 'Profils APP Utilisateurs', - url: '' + url: '', }, ]; @@ -165,15 +163,14 @@ describe('ProfilesTabComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports : [ VitamUICommonTestModule ], - declarations: [ ProfilesTabComponent, TesthostComponent, MatTooltipStubDirective ], + imports: [VitamUICommonTestModule], + declarations: [ProfilesTabComponent, TesthostComponent, MatTooltipStubDirective], providers: [ { provide: MatDialog, useValue: matDialogSpy }, { provide: GroupService, useValue: { updated: new Subject() } }, { provide: ApplicationService, useValue: { list: () => of(expectedApp), buildApplications: () => expectedApp } }, - ] - }) - .compileComponents(); + ], + }).compileComponents(); })); beforeEach(() => { @@ -198,7 +195,7 @@ describe('ProfilesTabComponent', () => { }, autoFocus: false, disableClose: true, - panelClass: 'vitamui-modal' + panelClass: 'vitamui-modal', }); }); @@ -234,7 +231,7 @@ describe('ProfilesTabComponent', () => { tenantIdentifier: 2, roles: [], externalParamId: null, - readonly: false + readonly: false, }, { id: '2', @@ -250,7 +247,7 @@ describe('ProfilesTabComponent', () => { tenantIdentifier: 2, roles: [], externalParamId: null, - readonly: false + readonly: false, }, { id: '3', @@ -266,10 +263,10 @@ describe('ProfilesTabComponent', () => { tenantIdentifier: 2, roles: [], externalParamId: null, - readonly: false + readonly: false, }, ], - readonly: true + readonly: true, }; fixture.detectChanges(); const elList = fixture.nativeElement.querySelector('.vitamui-profile-list'); @@ -278,9 +275,9 @@ describe('ProfilesTabComponent', () => { expect(elRows.length).toBe(3); testhost.group.profiles.forEach((profile: any, index: number) => { const elDetails = elRows[index]; - expect(elDetails.textContent).toContain(profile.tenantName + ' : ' + - profile.name.charAt(0).toUpperCase() + profile.name.substr(1).toLowerCase()); + expect(elDetails.textContent).toContain( + profile.tenantName + ' : ' + profile.name.charAt(0).toUpperCase() + profile.name.substr(1).toLowerCase(), + ); }); }); - }); diff --git a/ui/ui-frontend/projects/identity/src/app/group/group-preview/profiles-tab/profiles-tab.component.ts b/ui/ui-frontend/projects/identity/src/app/group/group-preview/profiles-tab/profiles-tab.component.ts index 66f98505281..ebacba1bf5b 100644 --- a/ui/ui-frontend/projects/identity/src/app/group/group-preview/profiles-tab/profiles-tab.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/group/group-preview/profiles-tab/profiles-tab.component.ts @@ -34,7 +34,7 @@ * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ -import { Component, Input, OnDestroy, OnInit} from '@angular/core'; +import { Component, Input, OnDestroy, OnInit } from '@angular/core'; import { MatDialog } from '@angular/material/dialog'; import { Subscription } from 'rxjs'; import { Group, Profile } from 'ui-frontend-common'; @@ -44,19 +44,21 @@ import { ProfilesEditComponent } from './profiles-edit/profiles-edit.component'; @Component({ selector: 'app-profiles-tab', templateUrl: './profiles-tab.component.html', - styleUrls: ['./profiles-tab.component.scss'] + styleUrls: ['./profiles-tab.component.scss'], }) export class ProfilesTabComponent implements OnInit, OnDestroy { - @Input() group: Group; @Input() readOnly: boolean; profilesDisplay: any[]; updatedGroup: Subscription; - public groupProfiles: Profile []; + public groupProfiles: Profile[]; - constructor(private dialog: MatDialog, private groupService: GroupService) { } + constructor( + private dialog: MatDialog, + private groupService: GroupService, + ) {} ngOnInit() { this.initializeProfilesList(this.group?.profiles); @@ -66,7 +68,7 @@ export class ProfilesTabComponent implements OnInit, OnDestroy { }); } - initializeProfilesList(groupProfiles: Profile []): void { + initializeProfilesList(groupProfiles: Profile[]): void { this.profilesDisplay = []; if (groupProfiles) { groupProfiles.forEach((profile) => @@ -75,8 +77,8 @@ export class ProfilesTabComponent implements OnInit, OnDestroy { appId: profile.applicationName, tenantName: profile.tenantName, profileName: profile.name, - description: profile.description - }) + description: profile.description, + }), ); this.profilesDisplay.sort((first, second) => { @@ -99,12 +101,11 @@ export class ProfilesTabComponent implements OnInit, OnDestroy { }, autoFocus: false, disableClose: true, - panelClass: 'vitamui-modal' + panelClass: 'vitamui-modal', }); } ngOnDestroy() { this.updatedGroup.unsubscribe(); } - } diff --git a/ui/ui-frontend/projects/identity/src/app/group/group-resolver.service.spec.ts b/ui/ui-frontend/projects/identity/src/app/group/group-resolver.service.spec.ts index 1893df90941..2432ccabc41 100644 --- a/ui/ui-frontend/projects/identity/src/app/group/group-resolver.service.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/group/group-resolver.service.spec.ts @@ -48,12 +48,12 @@ const expectedGroup: Group = { customerId: '4242442', name: 'Group Name', description: 'Group Description', - level : '', + level: '', usersCount: 0, profileIds: [], profiles: [], units: [], - readonly : false + readonly: false, }; describe('GroupResolver', () => { @@ -64,11 +64,7 @@ describe('GroupResolver', () => { const routerSpy = jasmine.createSpyObj('Router', ['navigate']); TestBed.configureTestingModule({ - providers: [ - GroupResolver, - { provide: GroupService, useValue: profileGroupServiceSpy }, - { provide: Router, useValue: routerSpy }, - ] + providers: [GroupResolver, { provide: GroupService, useValue: profileGroupServiceSpy }, { provide: Router, useValue: routerSpy }], }); groupResolver = TestBed.inject(GroupResolver); @@ -104,5 +100,4 @@ describe('GroupResolver', () => { expect(route.paramMap.get).toHaveBeenCalledWith('id'); expect(profileGroupService.get).toHaveBeenCalledWith('42'); }); - }); diff --git a/ui/ui-frontend/projects/identity/src/app/group/group-resolver.service.ts b/ui/ui-frontend/projects/identity/src/app/group/group-resolver.service.ts index e2711021154..383a4388e4f 100644 --- a/ui/ui-frontend/projects/identity/src/app/group/group-resolver.service.ts +++ b/ui/ui-frontend/projects/identity/src/app/group/group-resolver.service.ts @@ -44,25 +44,25 @@ import { GroupService } from './group.service'; @Injectable() export class GroupResolver implements Resolve { - - constructor(private groupService: GroupService, private router: Router) { } + constructor( + private groupService: GroupService, + private router: Router, + ) {} resolve(route: ActivatedRouteSnapshot): Observable { const id = route.paramMap.get('id'); - return this.groupService.get(id) - .pipe( - take(1), - map((group: Group) => { - if (group) { - return group; - } else { - this.router.navigate(['/']); + return this.groupService.get(id).pipe( + take(1), + map((group: Group) => { + if (group) { + return group; + } else { + this.router.navigate(['/']); - return null; - } - }) - ); + return null; + } + }), + ); } - } diff --git a/ui/ui-frontend/projects/identity/src/app/group/group-routing.module.ts b/ui/ui-frontend/projects/identity/src/app/group/group-routing.module.ts index 3f33aaf4764..7ce3caffdfb 100644 --- a/ui/ui-frontend/projects/identity/src/app/group/group-routing.module.ts +++ b/ui/ui-frontend/projects/identity/src/app/group/group-routing.module.ts @@ -45,24 +45,19 @@ const routes: Route[] = [ { path: '', component: GroupComponent, - pathMatch: 'full' + pathMatch: 'full', }, { path: ':id', component: GroupPopupComponent, resolve: { group: GroupResolver }, - data: { isPopup: true, appId: 'GROUPS_APP' } - } + data: { isPopup: true, appId: 'GROUPS_APP' }, + }, ]; @NgModule({ declarations: [], - imports: [ - CommonModule, - RouterModule.forChild(routes) - ], - exports: [ - RouterModule - ] + imports: [CommonModule, RouterModule.forChild(routes)], + exports: [RouterModule], }) -export class GroupRoutingModule { } +export class GroupRoutingModule {} diff --git a/ui/ui-frontend/projects/identity/src/app/group/group.component.html b/ui/ui-frontend/projects/identity/src/app/group/group.component.html index 3af927f3460..194790877d2 100644 --- a/ui/ui-frontend/projects/identity/src/app/group/group.component.html +++ b/ui/ui-frontend/projects/identity/src/app/group/group.component.html @@ -6,12 +6,12 @@
      - {{'GROUP.HOME.TITLE' | translate}} + {{ 'GROUP.HOME.TITLE' | translate }}
      @@ -20,4 +20,4 @@
      - \ No newline at end of file + diff --git a/ui/ui-frontend/projects/identity/src/app/group/group.component.spec.ts b/ui/ui-frontend/projects/identity/src/app/group/group.component.spec.ts index d60cb11f26b..0912fa9a9bb 100644 --- a/ui/ui-frontend/projects/identity/src/app/group/group.component.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/group/group.component.spec.ts @@ -35,11 +35,11 @@ * knowledge of the CeCILL-C license and that you accept its terms. */ -import {Component, Input} from '@angular/core'; +import { Component, Input } from '@angular/core'; import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { ActivatedRoute } from '@angular/router'; import { EMPTY, of } from 'rxjs'; -import {ENVIRONMENT, Group, InjectorModule, LoggerModule, SearchBarModule} from 'ui-frontend-common'; +import { ENVIRONMENT, Group, InjectorModule, LoggerModule, SearchBarModule } from 'ui-frontend-common'; import { environment } from './../../environments/environment'; import { MatDialog } from '@angular/material/dialog'; @@ -54,20 +54,21 @@ let component: GroupComponent; let fixture: ComponentFixture; class Page { - - get groupList() { return fixture.nativeElement.querySelector('app-group-list'); } - get createGroup() { return fixture.nativeElement.querySelector('button'); } - + get groupList() { + return fixture.nativeElement.querySelector('app-group-list'); + } + get createGroup() { + return fixture.nativeElement.querySelector('button'); + } } let page: Page; @Component({ selector: 'app-group-list', template: '' }) class GroupListStubComponent { - @Input('search') searchText: string; - search() { } + search() {} } @Component({ selector: 'app-group-preview', template: '' }) @@ -77,7 +78,6 @@ class GroupPreviewStubComponent { } describe('GroupComponent', () => { - beforeEach(waitForAsync(() => { const matDialogSpy = jasmine.createSpyObj('MatDialog', ['open']); matDialogSpy.open.and.returnValue({ afterClosed: () => of(true) }); @@ -90,20 +90,15 @@ describe('GroupComponent', () => { VitamUICommonTestModule, InjectorModule, SearchBarModule, - LoggerModule.forRoot() - ], - declarations: [ - GroupComponent, - GroupListStubComponent, - GroupPreviewStubComponent, + LoggerModule.forRoot(), ], + declarations: [GroupComponent, GroupListStubComponent, GroupPreviewStubComponent], providers: [ { provide: MatDialog, useValue: matDialogSpy }, { provide: ActivatedRoute, useValue: { data: EMPTY } }, - { provide: ENVIRONMENT, useValue: environment } - ] - }) - .compileComponents(); + { provide: ENVIRONMENT, useValue: environment }, + ], + }).compileComponents(); })); beforeEach(() => { @@ -131,5 +126,4 @@ describe('GroupComponent', () => { expect(matDialogSpy.open).toHaveBeenCalledTimes(1); expect(matDialogSpy.open).toHaveBeenCalledWith(GroupCreateComponent, { panelClass: 'vitamui-modal', disableClose: true }); }); - }); diff --git a/ui/ui-frontend/projects/identity/src/app/group/group.component.ts b/ui/ui-frontend/projects/identity/src/app/group/group.component.ts index 68c0c9420e8..213b73926dd 100644 --- a/ui/ui-frontend/projects/identity/src/app/group/group.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/group/group.component.ts @@ -45,32 +45,39 @@ import { GroupListComponent } from './group-list/group-list.component'; @Component({ selector: 'app-group', templateUrl: './group.component.html', - styleUrls: ['./group.component.scss'] + styleUrls: ['./group.component.scss'], }) export class GroupComponent extends SidenavPage { - public groups: Group[]; public search: string; @ViewChild(GroupListComponent, { static: true }) groupListComponent: GroupListComponent; - constructor(public route: ActivatedRoute, public globalEventService: GlobalEventService, private dialog: MatDialog) { + constructor( + public route: ActivatedRoute, + public globalEventService: GlobalEventService, + private dialog: MatDialog, + ) { super(route, globalEventService); } public openCreateGroupDialog(): void { const dialogRef = this.dialog.open(GroupCreateComponent, { panelClass: 'vitamui-modal', disableClose: true }); dialogRef.afterClosed().subscribe((result) => { - if (result) { this.refreshList(); } + if (result) { + this.refreshList(); + } }); } public onSearchSubmit(search: string): void { - this.search = search; + this.search = search; } private refreshList(): void { - if (!this.groupListComponent) { return; } + if (!this.groupListComponent) { + return; + } this.groupListComponent.search(); } } diff --git a/ui/ui-frontend/projects/identity/src/app/group/group.module.ts b/ui/ui-frontend/projects/identity/src/app/group/group.module.ts index 697af56b966..c6e5747694d 100644 --- a/ui/ui-frontend/projects/identity/src/app/group/group.module.ts +++ b/ui/ui-frontend/projects/identity/src/app/group/group.module.ts @@ -63,14 +63,9 @@ import { GroupService } from './group.service'; MatMenuModule, HttpClientModule, MatSidenavModule, - GroupRoutingModule + GroupRoutingModule, ], - declarations: [ - GroupComponent - ], - providers: [ - GroupResolver, - GroupService, - ] + declarations: [GroupComponent], + providers: [GroupResolver, GroupService], }) -export class GroupModule { } +export class GroupModule {} diff --git a/ui/ui-frontend/projects/identity/src/app/group/group.service.spec.ts b/ui/ui-frontend/projects/identity/src/app/group/group.service.spec.ts index b6d4e16e154..1657698226d 100644 --- a/ui/ui-frontend/projects/identity/src/app/group/group.service.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/group/group.service.spec.ts @@ -51,11 +51,7 @@ describe('GroupService', () => { TestBed.configureTestingModule({ imports: [HttpClientTestingModule], - providers: [ - GroupService, - { provide: VitamUISnackBarService, useValue: snackBarSpy }, - { provide: BASE_URL, useValue: '/fake-api' }, - ] + providers: [GroupService, { provide: VitamUISnackBarService, useValue: snackBarSpy }, { provide: BASE_URL, useValue: '/fake-api' }], }); httpTestingController = TestBed.inject(HttpTestingController as Type); @@ -68,39 +64,29 @@ describe('GroupService', () => { it('should call /fake-api/groups?page=0&size=20&orderBy=name&direction=ASC', () => { groupService.search().subscribe((response) => expect(response).toEqual([]), fail); - const req = httpTestingController.expectOne( - '/fake-api/groups?page=0&size=20&orderBy=name&direction=ASC' - ); + const req = httpTestingController.expectOne('/fake-api/groups?page=0&size=20&orderBy=name&direction=ASC'); expect(req.request.method).toEqual('GET'); const result: any = { values: [] }; req.flush(result); }); it('should call /fake-api/groups?page=42&size=15&orderBy=name&direction=DESC', () => { - groupService.search(new PageRequest(42, 15, 'name', Direction.DESCENDANT)) - .subscribe((response) => expect(response).toEqual([]), fail); - const req = httpTestingController.expectOne( - '/fake-api/groups?page=42&size=15&orderBy=name&direction=DESC'); + groupService.search(new PageRequest(42, 15, 'name', Direction.DESCENDANT)).subscribe((response) => expect(response).toEqual([]), fail); + const req = httpTestingController.expectOne('/fake-api/groups?page=42&size=15&orderBy=name&direction=DESC'); expect(req.request.method).toEqual('GET'); const result: any = { values: [] }; req.flush(result); }); it('should call /fake-api/groups?page=0&size=15&orderBy=&direction=DESC', () => { - groupService.search(new PageRequest(0, 15, '', Direction.DESCENDANT)) - .subscribe((response) => expect(response).toEqual([null]), fail); - let req = httpTestingController.expectOne( - '/fake-api/groups?page=0&size=15&orderBy=&direction=DESC'); + groupService.search(new PageRequest(0, 15, '', Direction.DESCENDANT)).subscribe((response) => expect(response).toEqual([null]), fail); + let req = httpTestingController.expectOne('/fake-api/groups?page=0&size=15&orderBy=&direction=DESC'); expect(req.request.method).toEqual('GET'); let result: any = { pageNum: 0, hasMore: true, pageSize: 15, values: [null] }; req.flush(result); - groupService.loadMore().subscribe( - (response) => expect(response).toEqual([null, null]), - fail - ); - req = httpTestingController.expectOne( - '/fake-api/groups?page=1&size=15&orderBy=&direction=DESC'); + groupService.loadMore().subscribe((response) => expect(response).toEqual([null, null]), fail); + req = httpTestingController.expectOne('/fake-api/groups?page=1&size=15&orderBy=&direction=DESC'); expect(req.request.method).toEqual('GET'); result = { pageNum: 1, pageSize: 15, hasMore: false, values: [null] }; req.flush(result); @@ -113,10 +99,7 @@ describe('GroupService', () => { const result: any = { hasMore: false, pageSize: 20, pageNum: 0, values: [null] }; req.flush(result); - groupService.loadMore().subscribe( - (response) => expect(response).toEqual([null]), - fail - ); + groupService.loadMore().subscribe((response) => expect(response).toEqual([null]), fail); httpTestingController.expectNone('/fake-api/groups?page=1&size=20&orderBy=name&direction=ASC'); }); @@ -125,13 +108,10 @@ describe('GroupService', () => { }); it('should return true', () => { - groupService.search().subscribe( - (response) => { - expect(response).toEqual([null]); - expect(groupService.canLoadMore).toBeTruthy(); - }, - fail - ); + groupService.search().subscribe((response) => { + expect(response).toEqual([null]); + expect(groupService.canLoadMore).toBeTruthy(); + }, fail); const req = httpTestingController.expectOne('/fake-api/groups?page=0&size=20&orderBy=name&direction=ASC'); expect(req.request.method).toEqual('GET'); const result: any = { hasMore: true, values: [null] }; @@ -141,31 +121,28 @@ describe('GroupService', () => { it('should call /fake-api/groups and display a success message', () => { const snackBar = TestBed.inject(VitamUISnackBarService); const expectedGroup: Group = { - id: '1', - customerId: '4242442', - name: 'Group Name', - description: 'Group Description', - level : '', - usersCount: 0, - profileIds: [], - profiles: [], - units: [], - readonly : false, + id: '1', + customerId: '4242442', + name: 'Group Name', + description: 'Group Description', + level: '', + usersCount: 0, + profileIds: [], + profiles: [], + units: [], + readonly: false, }; - groupService.create(expectedGroup).subscribe( - (response: Group) => { - expect(response).toEqual(expectedGroup); - expect(snackBar.open).toHaveBeenCalledTimes(1); - expect(snackBar.open).toHaveBeenCalledWith({ - message: 'SHARED.SNACKBAR.GROUP_CREATE', - translateParams:{ - param1: expectedGroup.name, - }, - icon: 'vitamui-icon-keys' - }); - }, - fail - ); + groupService.create(expectedGroup).subscribe((response: Group) => { + expect(response).toEqual(expectedGroup); + expect(snackBar.open).toHaveBeenCalledTimes(1); + expect(snackBar.open).toHaveBeenCalledWith({ + message: 'SHARED.SNACKBAR.GROUP_CREATE', + translateParams: { + param1: expectedGroup.name, + }, + icon: 'vitamui-icon-keys', + }); + }, fail); const req = httpTestingController.expectOne('/fake-api/groups'); expect(req.request.method).toEqual('POST'); req.flush(expectedGroup); @@ -174,41 +151,38 @@ describe('GroupService', () => { it('should display an error message', () => { const snackBar = TestBed.inject(VitamUISnackBarService); const expectedProfileGroup: Group = { - id: '1', - customerId: '4242442', - name: 'Group Name', - description: 'Group Description', - level : '', - usersCount: 0, - profileIds: [], - profiles: [], - units: [], - readonly : false, + id: '1', + customerId: '4242442', + name: 'Group Name', + description: 'Group Description', + level: '', + usersCount: 0, + profileIds: [], + profiles: [], + units: [], + readonly: false, }; - groupService.create(expectedProfileGroup).subscribe( - fail, - () => { - expect(snackBar.open).toHaveBeenCalledTimes(1); - expect(snackBar.open).toHaveBeenCalledWith({message: 'Expected message', translate: false}); - } - ); + groupService.create(expectedProfileGroup).subscribe(fail, () => { + expect(snackBar.open).toHaveBeenCalledTimes(1); + expect(snackBar.open).toHaveBeenCalledWith({ message: 'Expected message', translate: false }); + }); const req = httpTestingController.expectOne('/fake-api/groups'); expect(req.request.method).toEqual('POST'); - req.flush({ message: 'Expected message' }, {status: 400, statusText: 'Bad request'}); + req.flush({ message: 'Expected message' }, { status: 400, statusText: 'Bad request' }); }); it('should call /fake-api/groups/42?embedded=ALL', () => { const expectedProfileGroup: Group = { - id: '1', - customerId: '4242442', - name: 'Group Name', - description: 'Group Description', - level : '', - usersCount: 0, - profileIds: [], - profiles: [], - units: [], - readonly : false, + id: '1', + customerId: '4242442', + name: 'Group Name', + description: 'Group Description', + level: '', + usersCount: 0, + profileIds: [], + profiles: [], + units: [], + readonly: false, }; groupService.get('42').subscribe((profileGroup) => expect(profileGroup).toEqual(expectedProfileGroup), fail); const req = httpTestingController.expectOne('/fake-api/groups/42?embedded=ALL'); @@ -217,15 +191,14 @@ describe('GroupService', () => { }); it('should return true if the profiles group exists', () => { - groupService.exists('4242', 'profileGroupName').subscribe( - (found) => { - expect(found).toBeTruthy(); - }, - fail - ); + groupService.exists('4242', 'profileGroupName').subscribe((found) => { + expect(found).toBeTruthy(); + }, fail); - const criterionArray: any[] = [ { key: 'customerId', value: '4242', operator: Operators.equals }, - { key: 'name', value: 'profileGroupName', operator: Operators.equals }]; + const criterionArray: any[] = [ + { key: 'customerId', value: '4242', operator: Operators.equals }, + { key: 'name', value: 'profileGroupName', operator: Operators.equals }, + ]; const query: SearchQuery = { criteria: criterionArray }; const req = httpTestingController.expectOne('/fake-api/groups/check?criteria=' + encodeURI(JSON.stringify(query))); expect(req.request.method).toEqual('HEAD'); @@ -233,14 +206,13 @@ describe('GroupService', () => { }); it('should return false if the profiles group does not exist', () => { - groupService.exists('4242', 'profileGroupName').subscribe( - (found) => { - expect(found).toBeFalsy(); - }, - fail - ); - const criterionArray: any[] = [ { key: 'customerId', value: '4242', operator: Operators.equals }, - { key: 'name', value: 'profileGroupName', operator: Operators.equals }]; + groupService.exists('4242', 'profileGroupName').subscribe((found) => { + expect(found).toBeFalsy(); + }, fail); + const criterionArray: any[] = [ + { key: 'customerId', value: '4242', operator: Operators.equals }, + { key: 'name', value: 'profileGroupName', operator: Operators.equals }, + ]; const query: SearchQuery = { criteria: criterionArray }; const req = httpTestingController.expectOne('/fake-api/groups/check?criteria=' + encodeURI(JSON.stringify(query))); expect(req.request.method).toEqual('HEAD'); @@ -248,16 +220,13 @@ describe('GroupService', () => { }); it('should return true if the group exists', () => { - groupService.unitExists('customerId', 'unit1').subscribe( - (found) => { - expect(found).toBeTruthy(); - }, - fail - ); + groupService.unitExists('customerId', 'unit1').subscribe((found) => { + expect(found).toBeTruthy(); + }, fail); const criterionArray: any[] = [ { key: 'units', value: 'unit1', operator: Operators.equalsIgnoreCase }, - { key: 'customerId', value: 'customerId', operator: Operators.equals } + { key: 'customerId', value: 'customerId', operator: Operators.equals }, ]; const query: SearchQuery = { criteria: criterionArray }; const req = httpTestingController.expectOne('/fake-api/groups/check?criteria=' + encodeURI(JSON.stringify(query))); @@ -266,16 +235,13 @@ describe('GroupService', () => { }); it('should return false if the group does not exist', () => { - groupService.unitExists('customerId', 'unit1').subscribe( - (found) => { - expect(found).toBeFalsy(); - }, - fail - ); + groupService.unitExists('customerId', 'unit1').subscribe((found) => { + expect(found).toBeFalsy(); + }, fail); const criterionArray: any[] = [ { key: 'units', value: 'unit1', operator: Operators.equalsIgnoreCase }, - { key: 'customerId', value: 'customerId', operator: Operators.equals } - ]; + { key: 'customerId', value: 'customerId', operator: Operators.equals }, + ]; const query: SearchQuery = { criteria: criterionArray }; const req = httpTestingController.expectOne('/fake-api/groups/check?criteria=' + encodeURI(JSON.stringify(query))); expect(req.request.method).toEqual('HEAD'); @@ -285,32 +251,29 @@ describe('GroupService', () => { it('should call PATCH /fake-api/groups/42', () => { const snackBar = TestBed.inject(VitamUISnackBarService); const expectedProfileGroup: Group = { - id: '1', - customerId: '4242442', - name: 'Group Name', - description: 'Group Description', - level : '', - usersCount: 0, - profileIds: [], - profiles: [], - units: [], - readonly : false + id: '1', + customerId: '4242442', + name: 'Group Name', + description: 'Group Description', + level: '', + usersCount: 0, + profileIds: [], + profiles: [], + units: [], + readonly: false, }; groupService.updated.subscribe((profileGroup) => expect(profileGroup).toEqual(expectedProfileGroup), fail); - groupService.patch({ id: '42', name: expectedProfileGroup.name }).subscribe( - (profileGroup) => { - expect(profileGroup).toEqual(expectedProfileGroup); - expect(snackBar.open).toHaveBeenCalledTimes(1); - expect(snackBar.open).toHaveBeenCalledWith({ - message: 'SHARED.SNACKBAR.GROUP_UPDATE', - translateParams:{ - param1: expectedProfileGroup.name, - }, - icon: 'vitamui-icon-keys' - }); - }, - fail - ); + groupService.patch({ id: '42', name: expectedProfileGroup.name }).subscribe((profileGroup) => { + expect(profileGroup).toEqual(expectedProfileGroup); + expect(snackBar.open).toHaveBeenCalledTimes(1); + expect(snackBar.open).toHaveBeenCalledWith({ + message: 'SHARED.SNACKBAR.GROUP_UPDATE', + translateParams: { + param1: expectedProfileGroup.name, + }, + icon: 'vitamui-icon-keys', + }); + }, fail); const req = httpTestingController.expectOne('/fake-api/groups/42'); expect(req.request.method).toEqual('PATCH'); expect(req.request.body).toEqual({ id: '42', name: expectedProfileGroup.name }); @@ -321,28 +284,23 @@ describe('GroupService', () => { // tslint:disable-next-line: deprecation const snackBar = TestBed.inject(VitamUISnackBarService); const expectedGroup: Group = { - id: '1', - customerId: '4242442', - name: 'Group Name', - description: 'Group Description', - level : '', - usersCount: 0, - profileIds: [], - profiles: [], - units: [], - readonly : false + id: '1', + customerId: '4242442', + name: 'Group Name', + description: 'Group Description', + level: '', + usersCount: 0, + profileIds: [], + profiles: [], + units: [], + readonly: false, }; - groupService.patch({ id: '42', name: expectedGroup.name }).subscribe( - fail, - () => { - expect(snackBar.open).toHaveBeenCalledTimes(1); - expect(snackBar.open).toHaveBeenCalledWith({message: 'Expected message', translate: false}); - - } - ); + groupService.patch({ id: '42', name: expectedGroup.name }).subscribe(fail, () => { + expect(snackBar.open).toHaveBeenCalledTimes(1); + expect(snackBar.open).toHaveBeenCalledWith({ message: 'Expected message', translate: false }); + }); const req = httpTestingController.expectOne('/fake-api/groups/42'); expect(req.request.method).toEqual('PATCH'); - req.flush({ message: 'Expected message' }, {status: 400, statusText: 'Bad request'}); + req.flush({ message: 'Expected message' }, { status: 400, statusText: 'Bad request' }); }); - }); diff --git a/ui/ui-frontend/projects/identity/src/app/group/group.service.ts b/ui/ui-frontend/projects/identity/src/app/group/group.service.ts index 9459b1cc501..bfb06688f3d 100644 --- a/ui/ui-frontend/projects/identity/src/app/group/group.service.ts +++ b/ui/ui-frontend/projects/identity/src/app/group/group.service.ts @@ -35,7 +35,7 @@ * knowledge of the CeCILL-C license and that you accept its terms. */ import { Observable, Subject } from 'rxjs'; -import {map, tap} from 'rxjs/operators'; +import { map, tap } from 'rxjs/operators'; import { Criterion, Group, Operators, SearchQuery, SearchService, VitamUISnackBarService } from 'ui-frontend-common'; import { HttpClient, HttpParams } from '@angular/common/http'; @@ -44,34 +44,36 @@ import { Injectable } from '@angular/core'; import { GroupApiService } from '../core/api/group-api.service'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class GroupService extends SearchService { - updated = new Subject(); - constructor(private groupApi: GroupApiService, private snackBarService: VitamUISnackBarService, http: HttpClient) { + constructor( + private groupApi: GroupApiService, + private snackBarService: VitamUISnackBarService, + http: HttpClient, + ) { super(http, groupApi); } create(group: Group) { - return this.groupApi.create(group) - .pipe( - tap( - (response: Group) => { - this.snackBarService.open({ - message: 'SHARED.SNACKBAR.GROUP_CREATE', - translateParams:{ - param1: response.name, - }, - icon: 'vitamui-icon-keys' - }); - }, - (error) => { - this.snackBarService.open({ message: error.error.message, translate: false }); - } - ) - ); + return this.groupApi.create(group).pipe( + tap( + (response: Group) => { + this.snackBarService.open({ + message: 'SHARED.SNACKBAR.GROUP_CREATE', + translateParams: { + param1: response.name, + }, + icon: 'vitamui-icon-keys', + }); + }, + (error) => { + this.snackBarService.open({ message: error.error.message, translate: false }); + }, + ), + ); } get(id: string): Observable { @@ -79,7 +81,6 @@ export class GroupService extends SearchService { } exists(customerId: string, name: string): Observable { - const criterionArray: Criterion[] = []; if (customerId) { criterionArray.push({ key: 'customerId', value: customerId, operator: Operators.equals }); @@ -89,7 +90,7 @@ export class GroupService extends SearchService { } const query: SearchQuery = { criteria: criterionArray }; - const params = [{key : 'criteria', value: JSON.stringify(query)}]; + const params = [{ key: 'criteria', value: JSON.stringify(query) }]; return this.groupApi.checkExistsByParam(params); } @@ -99,30 +100,29 @@ export class GroupService extends SearchService { criteria.push({ key: 'units', value: unit, operator: Operators.equalsIgnoreCase }); criteria.push({ key: 'customerId', value: customerId, operator: Operators.equals }); const query: SearchQuery = { criteria }; - const params = [{key : 'criteria', value: JSON.stringify(query)}]; + const params = [{ key: 'criteria', value: JSON.stringify(query) }]; return this.groupApi.checkExistsByParam(params); } - patch(groupPartial: { id: string, [key: string]: any }): Observable { - return this.groupApi.patch(groupPartial) - .pipe( - tap((updatedGroup: Group) => this.updated.next(updatedGroup)), - tap( - (response: Group) => { - this.snackBarService.open({ - message: 'SHARED.SNACKBAR.GROUP_UPDATE', - translateParams:{ - param1: response.name, - }, - icon: 'vitamui-icon-keys' - }); - }, - (error) => { - this.snackBarService.open({ message: error.error.message, translate: false }); - } - ) - ); + patch(groupPartial: { id: string; [key: string]: any }): Observable { + return this.groupApi.patch(groupPartial).pipe( + tap((updatedGroup: Group) => this.updated.next(updatedGroup)), + tap( + (response: Group) => { + this.snackBarService.open({ + message: 'SHARED.SNACKBAR.GROUP_UPDATE', + translateParams: { + param1: response.name, + }, + icon: 'vitamui-icon-keys', + }); + }, + (error) => { + this.snackBarService.open({ message: error.error.message, translate: false }); + }, + ), + ); } getAll(enabled?: boolean): Observable { @@ -136,16 +136,13 @@ export class GroupService extends SearchService { let params = new HttpParams(); if (criterionArray.length > 0) { - params = params.set('criteria', JSON.stringify(query)); + params = params.set('criteria', JSON.stringify(query)); } return this.groupApi.getAllByParams(params); } getNonEmptyLevels(query: SearchQuery) { - return this.groupApi.getLevels(query) - .pipe( - map((levels) => levels.filter((l) => !!l)) - ); + return this.groupApi.getLevels(query).pipe(map((levels) => levels.filter((l) => !!l))); } } diff --git a/ui/ui-frontend/projects/identity/src/app/group/group.validators.spec.ts b/ui/ui-frontend/projects/identity/src/app/group/group.validators.spec.ts index a502fba2c27..82620d3e3b1 100644 --- a/ui/ui-frontend/projects/identity/src/app/group/group.validators.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/group/group.validators.spec.ts @@ -44,7 +44,7 @@ import { GroupValidators } from './group.validators'; function toObservable(r: any): Observable { const obs = isPromise(r) ? from(r) : r; - if (!(isObservable(obs))) { + if (!isObservable(obs)) { throw new Error(`Expected validator to return Promise or Observable.`); } @@ -52,7 +52,6 @@ function toObservable(r: any): Observable { } describe('ProfileGroupValidators nameExist', () => { - it('should return null', fakeAsync(() => { const groupServiceSpy = jasmine.createSpyObj('GroupService', ['exists']); groupServiceSpy.exists.and.returnValue(of(false)); @@ -99,7 +98,6 @@ describe('ProfileGroupValidators nameExist', () => { }); describe('ProfileGroupValidators unitExists', () => { - it('should return null', fakeAsync(() => { const groupServiceSpy = jasmine.createSpyObj('GroupService', ['unitExists']); groupServiceSpy.unitExists.and.returnValue(of(false)); diff --git a/ui/ui-frontend/projects/identity/src/app/group/group.validators.ts b/ui/ui-frontend/projects/identity/src/app/group/group.validators.ts index 5dcfc7d0540..15c4240efc8 100644 --- a/ui/ui-frontend/projects/identity/src/app/group/group.validators.ts +++ b/ui/ui-frontend/projects/identity/src/app/group/group.validators.ts @@ -43,33 +43,32 @@ import { GroupService } from './group.service'; @Injectable() export class GroupValidators { + private debounceTime = 400; - private debounceTime = 400; + constructor(private groupService: GroupService) {} - constructor(private groupService: GroupService) {} + nameExists = (customerId: string, nameToIgnore?: string): AsyncValidatorFn => { + return (control: AbstractControl) => { + return timer(this.debounceTime).pipe( + switchMap(() => (control.value !== nameToIgnore ? this.groupService.exists(customerId, control.value) : of(false))), + take(1), + map((exists: boolean) => (exists ? { nameExists: true } : null)), + ); + }; + }; - nameExists = (customerId: string, nameToIgnore?: string): AsyncValidatorFn => { - return (control: AbstractControl) => { - return timer(this.debounceTime).pipe( - switchMap(() => control.value !== nameToIgnore ? this.groupService.exists(customerId, control.value) : of(false)), - take(1), - map((exists: boolean) => exists ? { nameExists: true } : null) - ); - }; - } - - unitExists = (customerId: string, unitToIgnore: string[] = []): AsyncValidatorFn => { - return (control: AbstractControl) => { - return timer(this.debounceTime).pipe( - switchMap(() => { - if (!control.value?.trim()) { - return of(false); - } - return !unitToIgnore.includes(control.value) ? this.groupService.unitExists(customerId, control.value.trim()) : of(false); } - ), - take(1), - map((exists: boolean) => exists ? { unitExists: true } : null) - ); - }; - } + unitExists = (customerId: string, unitToIgnore: string[] = []): AsyncValidatorFn => { + return (control: AbstractControl) => { + return timer(this.debounceTime).pipe( + switchMap(() => { + if (!control.value?.trim()) { + return of(false); + } + return !unitToIgnore.includes(control.value) ? this.groupService.unitExists(customerId, control.value.trim()) : of(false); + }), + take(1), + map((exists: boolean) => (exists ? { unitExists: true } : null)), + ); + }; + }; } diff --git a/ui/ui-frontend/projects/identity/src/app/group/units-form/units-form.component.html b/ui/ui-frontend/projects/identity/src/app/group/units-form/units-form.component.html index 57887b53083..caf7bbb0d90 100644 --- a/ui/ui-frontend/projects/identity/src/app/group/units-form/units-form.component.html +++ b/ui/ui-frontend/projects/identity/src/app/group/units-form/units-form.component.html @@ -1,37 +1,44 @@
      - - - - {{'GROUP.UNITS_FORM.UNIT_ALREADY_EXIST' | translate }} - - - {{'GROUP.UNITS_FORM.UNIT_ALREADY_ADDED' | translate }} - - - + + + + {{ 'GROUP.UNITS_FORM.UNIT_ALREADY_EXIST' | translate }} + + + {{ 'GROUP.UNITS_FORM.UNIT_ALREADY_ADDED' | translate }} + + +
      - +
      -
      -
      -
      -
      -
      {{unit}}
      -
      - -
      +
      +
      +
      +
      +
      {{ unit }}
      +
      +
      -
      \ No newline at end of file +
      +
      diff --git a/ui/ui-frontend/projects/identity/src/app/group/units-form/units-form.component.scss b/ui/ui-frontend/projects/identity/src/app/group/units-form/units-form.component.scss index 23c18733609..d27be34cc5e 100644 --- a/ui/ui-frontend/projects/identity/src/app/group/units-form/units-form.component.scss +++ b/ui/ui-frontend/projects/identity/src/app/group/units-form/units-form.component.scss @@ -1,13 +1,13 @@ .d-flex { - > div:first-of-type { - width: 65%; - - > div { - height: 60px; - } + > div:first-of-type { + width: 65%; + + > div { + height: 60px; } - - > div:last-of-type { - width: 25%; - } -} \ No newline at end of file + } + + > div:last-of-type { + width: 25%; + } +} diff --git a/ui/ui-frontend/projects/identity/src/app/group/units-form/units-form.component.ts b/ui/ui-frontend/projects/identity/src/app/group/units-form/units-form.component.ts index 83a285a8462..873ceec8d81 100644 --- a/ui/ui-frontend/projects/identity/src/app/group/units-form/units-form.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/group/units-form/units-form.component.ts @@ -44,7 +44,7 @@ import { GroupValidators } from '../group.validators'; export const UNITS_FORM_VALUE_ACCESSOR: any = { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => UnitsFormComponent), - multi: true + multi: true, }; /** @@ -54,10 +54,9 @@ export const UNITS_FORM_VALUE_ACCESSOR: any = { selector: 'app-units-form', templateUrl: './units-form.component.html', styleUrls: ['./units-form.component.scss'], - providers: [UNITS_FORM_VALUE_ACCESSOR] + providers: [UNITS_FORM_VALUE_ACCESSOR], }) -export class UnitsFormComponent implements ControlValueAccessor, OnInit { - +export class UnitsFormComponent implements ControlValueAccessor, OnInit { units: string[] = []; removedUnits: string[] = []; @@ -66,9 +65,7 @@ export class UnitsFormComponent implements ControlValueAccessor, OnInit { @Input() customer: string; - constructor( - private groupValidators: GroupValidators, - ) { } + constructor(private groupValidators: GroupValidators) {} onChange = (_: any) => {}; onTouched = () => {}; @@ -86,8 +83,11 @@ export class UnitsFormComponent implements ControlValueAccessor, OnInit { } ngOnInit(): void { - this.unitControl = new FormControl('', [this.unitAlreadyAdd.bind(this)], - this.groupValidators.unitExists(this.customer, this.removedUnits)); + this.unitControl = new FormControl( + '', + [this.unitAlreadyAdd.bind(this)], + this.groupValidators.unitExists(this.customer, this.removedUnits), + ); } /** @@ -127,13 +127,12 @@ export class UnitsFormComponent implements ControlValueAccessor, OnInit { unitAlreadyAdd(control: AbstractControl): ValidationErrors { const unit: string = control.value; - if (unit && this.units.map(u => u.toLocaleLowerCase()).includes(unit.trim().toLocaleLowerCase())) { - return { - unitAlreadyAdd: true - }; + if (unit && this.units.map((u) => u.toLocaleLowerCase()).includes(unit.trim().toLocaleLowerCase())) { + return { + unitAlreadyAdd: true, + }; } return null; } - } diff --git a/ui/ui-frontend/projects/identity/src/app/group/units-form/units-form.module.ts b/ui/ui-frontend/projects/identity/src/app/group/units-form/units-form.module.ts index 58f4b128899..8d0436992f9 100644 --- a/ui/ui-frontend/projects/identity/src/app/group/units-form/units-form.module.ts +++ b/ui/ui-frontend/projects/identity/src/app/group/units-form/units-form.module.ts @@ -44,22 +44,9 @@ import { MatTooltipModule } from '@angular/material/tooltip'; import { VitamUICommonModule } from 'ui-frontend-common'; import { UnitsFormComponent } from './units-form.component'; - - @NgModule({ - imports: [ - CommonModule, - CommonModule, - ReactiveFormsModule, - MatSelectModule, - MatTooltipModule, - VitamUICommonModule, - ], - declarations: [ - UnitsFormComponent, - ], - exports: [ - UnitsFormComponent, - ] + imports: [CommonModule, CommonModule, ReactiveFormsModule, MatSelectModule, MatTooltipModule, VitamUICommonModule], + declarations: [UnitsFormComponent], + exports: [UnitsFormComponent], }) -export class UnitsFormModule { } +export class UnitsFormModule {} diff --git a/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-create/hierarchy-create.component.html b/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-create/hierarchy-create.component.html index ff5ee0a835a..57b2225d3cc 100644 --- a/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-create/hierarchy-create.component.html +++ b/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-create/hierarchy-create.component.html @@ -4,40 +4,45 @@
      -
      {{'HIERARCHY.INFORMATIONS.MODAL.TITLE' | translate}}
      +
      {{ 'HIERARCHY.INFORMATIONS.MODAL.TITLE' | translate }}
      - {{'HIERARCHY.INFORMATIONS.INACTIVE_SWITCH' | translate}} - {{'HIERARCHY.INFORMATIONS.ACTIVE_SWITCH' | translate}} + {{ 'HIERARCHY.INFORMATIONS.INACTIVE_SWITCH' | translate }} + {{ 'HIERARCHY.INFORMATIONS.ACTIVE_SWITCH' | translate }}
      -
      {{'HIERARCHY.INFORMATIONS.LEVEL' | translate}}
      -
      {{authService.user.level}}
      +
      {{ 'HIERARCHY.INFORMATIONS.LEVEL' | translate }}
      +
      {{ authService.user.level }}
      - {{'COMMON.ERROR.REQUIRED' | translate}} + {{ 'COMMON.ERROR.REQUIRED' | translate }} - {{'HIERARCHY.INFORMATIONS.MODAL.WRONG_FORMAT' | translate}} + {{ 'HIERARCHY.INFORMATIONS.MODAL.WRONG_FORMAT' | translate }}
      -
      {{'HIERARCHY.INFORMATIONS.MODAL.DUPLICATE_PROFILE' | translate}}
      - - +
      {{ 'HIERARCHY.INFORMATIONS.MODAL.DUPLICATE_PROFILE' | translate }}
      + +
      - - + +
      diff --git a/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-create/hierarchy-create.component.spec.ts b/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-create/hierarchy-create.component.spec.ts index 081d089af5d..4849228430a 100644 --- a/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-create/hierarchy-create.component.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-create/hierarchy-create.component.spec.ts @@ -50,11 +50,13 @@ import { HierarchyCreateComponent } from './hierarchy-create.component'; @Component({ selector: 'app-profiles-form', template: '', - providers: [{ - provide: NG_VALUE_ACCESSOR, - useExisting: forwardRef(() => ProfilesFormStubComponent), - multi: true, - }] + providers: [ + { + provide: NG_VALUE_ACCESSOR, + useExisting: forwardRef(() => ProfilesFormStubComponent), + multi: true, + }, + ], }) class ProfilesFormStubComponent implements ControlValueAccessor { @Input() applicationNameExclude: string[]; @@ -68,34 +70,29 @@ let fixture: ComponentFixture; let component: HierarchyCreateComponent; describe('HierarchyCreateComponent', () => { - beforeEach(waitForAsync(() => { const matDialogRefSpy = jasmine.createSpyObj('MatDialogRef', ['close']); const hierarchyServiceSpy = jasmine.createSpyObj('GroupService', { create: of({}) }); TestBed.configureTestingModule({ imports: [ - MatProgressBarModule, - ReactiveFormsModule, - NoopAnimationsModule, - VitamUICommonTestModule, - LevelInputModule, - TranslateModule.forRoot(), - ], - declarations: [ - ProfilesFormStubComponent, - HierarchyCreateComponent, + MatProgressBarModule, + ReactiveFormsModule, + NoopAnimationsModule, + VitamUICommonTestModule, + LevelInputModule, + TranslateModule.forRoot(), ], + declarations: [ProfilesFormStubComponent, HierarchyCreateComponent], providers: [ { provide: MatDialogRef, useValue: matDialogRefSpy }, - { provide: MAT_DIALOG_DATA, useValue: {tenantId : 10} }, + { provide: MAT_DIALOG_DATA, useValue: { tenantId: 10 } }, { provide: AuthService, useValue: { user: { customerId: '4242442' } } }, - { provide : HierarchyService, useValue: hierarchyServiceSpy }, + { provide: HierarchyService, useValue: hierarchyServiceSpy }, { provide: ConfirmDialogService, useValue: { listenToEscapeKeyPress: () => EMPTY } }, ], - schemas: [] - }) - .compileComponents(); + schemas: [], + }).compileComponents(); })); beforeEach(() => { @@ -107,5 +104,4 @@ describe('HierarchyCreateComponent', () => { it('should create', () => { expect(component).toBeTruthy(); }); - }); diff --git a/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-create/hierarchy-create.component.ts b/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-create/hierarchy-create.component.ts index 7daacf418ef..f8cc758c901 100644 --- a/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-create/hierarchy-create.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-create/hierarchy-create.component.ts @@ -42,13 +42,14 @@ import { AuthService, buildValidators, collapseAnimation, - ConfirmDialogService, Operators, Profile, + ConfirmDialogService, + Operators, + Profile, rotateAnimation, - SearchQuery + SearchQuery, } from 'ui-frontend-common'; import { HierarchyService } from '../hierarchy.service'; - @Component({ selector: 'app-hierarchy-create', templateUrl: './hierarchy-create.component.html', @@ -68,7 +69,7 @@ export class HierarchyCreateComponent implements OnInit, OnDestroy { public authService: AuthService, private formBuilder: FormBuilder, private hierarchyService: HierarchyService, - private confirmDialogService: ConfirmDialogService + private confirmDialogService: ConfirmDialogService, ) {} ngOnInit() { @@ -79,9 +80,7 @@ export class HierarchyCreateComponent implements OnInit, OnDestroy { customerId: [this.authService.user.customerId], }); - this.keyPressSubscription = this.confirmDialogService - .listenToEscapeKeyPress(this.dialogRef) - .subscribe(() => this.onCancel()); + this.keyPressSubscription = this.confirmDialogService.listenToEscapeKeyPress(this.dialogRef).subscribe(() => this.onCancel()); } ngOnDestroy() { @@ -115,7 +114,10 @@ export class HierarchyCreateComponent implements OnInit, OnDestroy { observables.push(this.hierarchyService.create(profile)); }); - forkJoin(observables).subscribe(() => this.dialogRef.close(true), () => this.dialogRef.close()); + forkJoin(observables).subscribe( + () => this.dialogRef.close(true), + () => this.dialogRef.close(), + ); }); } diff --git a/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-create/hierarchy-create.module.ts b/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-create/hierarchy-create.module.ts index 566d210a73e..6932306dccc 100644 --- a/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-create/hierarchy-create.module.ts +++ b/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-create/hierarchy-create.module.ts @@ -62,10 +62,8 @@ import { HierarchyCreateComponent } from './hierarchy-create.component'; ReactiveFormsModule, MatDialogModule, ], - declarations: [ - HierarchyCreateComponent, - ], + declarations: [HierarchyCreateComponent], exports: [HierarchyCreateComponent], entryComponents: [HierarchyCreateComponent], }) -export class HierarchyCreateModule { } +export class HierarchyCreateModule {} diff --git a/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-detail/hierarchy-detail.component.html b/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-detail/hierarchy-detail.component.html index 933addc8644..c60fc03e22a 100644 --- a/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-detail/hierarchy-detail.component.html +++ b/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-detail/hierarchy-detail.component.html @@ -3,7 +3,8 @@ [subtitle]="'(' + profile?.identifier + ')'" [icon]="'vitamui-icon-admin-key'" [badge]="profile?.enabled ? 'green' : 'grey'" - (onclose)="emitClose()"> + (onclose)="emitClose()" +>
      @@ -12,8 +13,12 @@ - + -
      \ No newline at end of file +
      diff --git a/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-detail/hierarchy-detail.component.spec.ts b/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-detail/hierarchy-detail.component.spec.ts index 675d12a65f8..986b0026434 100644 --- a/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-detail/hierarchy-detail.component.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-detail/hierarchy-detail.component.spec.ts @@ -74,14 +74,14 @@ class TestHostComponent { describe('HierarchyDetailComponent', () => { let testhost: TestHostComponent; let fixture: ComponentFixture; - const authServiceMock = { user : { level: ''}}; + const authServiceMock = { user: { level: '' } }; const expectedProfile = { id: '42', name: 'Profile Name', description: 'description', - level : '', - groupsCount : 1, + level: '', + groupsCount: 1, applicationName: 'USERS_APP', enabled: true, usersCount: 0, @@ -98,22 +98,20 @@ describe('HierarchyDetailComponent', () => { street: 'rue des bois', zipCode: '75019', city: 'Paris', - country: 'FRANCE' + country: 'FRANCE', }, customerId: 'customer_id', - readonly : false + readonly: false, }, ownerId: 'owner_id', customerId: 'customer_id', enabled: true, proof: false, - readonly : false + readonly: false, }, tenantIdentifier: '42', - roles: [ - 'role_name', - ], - readonly : false + roles: ['role_name'], + readonly: false, }; beforeEach(waitForAsync(() => { @@ -124,26 +122,20 @@ describe('HierarchyDetailComponent', () => { NoopAnimationsModule, HttpClientTestingModule, LoggerModule.forRoot(), - VitamUICommonTestModule - ], - declarations: [ - TestHostComponent, - HierarchyDetailComponent, - SidePanelStubComponent, - InformationTabStubComponent, + VitamUICommonTestModule, ], + declarations: [TestHostComponent, HierarchyDetailComponent, SidePanelStubComponent, InformationTabStubComponent], providers: [ { provide: ActivatedRoute, useValue: { data: of({ isPopup: true, profile: expectedProfile }) } }, { provide: HierarchyService, useValue: { updated: new Subject() } }, - { provide: AuthService, useValue: authServiceMock}, + { provide: AuthService, useValue: authServiceMock }, { provide: WINDOW_LOCATION, useValue: {} }, { provide: BASE_URL, useValue: '/fake-api' }, { provide: ENVIRONMENT, useValue: environment }, - { provide: TranslateService, useValue: { instant: () => EMPTY } } + { provide: TranslateService, useValue: { instant: () => EMPTY } }, ], - schemas: [NO_ERRORS_SCHEMA] - }) - .compileComponents(); + schemas: [NO_ERRORS_SCHEMA], + }).compileComponents(); })); beforeEach(() => { @@ -158,18 +150,14 @@ describe('HierarchyDetailComponent', () => { }); describe('DOM', () => { - it('should have a header', () => { const elTitle = fixture.nativeElement.querySelector('vitamui-common-sidenav-header'); expect(elTitle).toBeTruthy(); }); it('should have a mat-tab-group', () => { - const elTabGroup = fixture.nativeElement - .querySelector('.mat-tab-group'); + const elTabGroup = fixture.nativeElement.querySelector('.mat-tab-group'); expect(elTabGroup).toBeTruthy(); }); - }); - }); diff --git a/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-detail/hierarchy-detail.component.ts b/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-detail/hierarchy-detail.component.ts index 6267ae053c1..c409988d46d 100644 --- a/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-detail/hierarchy-detail.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-detail/hierarchy-detail.component.ts @@ -43,13 +43,12 @@ import { HierarchyService } from '../hierarchy.service'; @Component({ selector: 'app-hierarchy-detail', templateUrl: './hierarchy-detail.component.html', - styleUrls: ['./hierarchy-detail.component.scss'] + styleUrls: ['./hierarchy-detail.component.scss'], }) export class HierarchyDetailComponent implements OnInit, OnDestroy { - @Input() set id(id: string) { - this.hierarchyService.get(id).subscribe((profile) => this.profile = profile); + this.hierarchyService.get(id).subscribe((profile) => (this.profile = profile)); } @Input() profile: Profile; @Input() isPopup: boolean; @@ -59,14 +58,15 @@ export class HierarchyDetailComponent implements OnInit, OnDestroy { profileUpdateSub: Subscription; constructor( - private hierarchyService: HierarchyService, private authService: AuthService, - private startupService: StartupService + private hierarchyService: HierarchyService, + private authService: AuthService, + private startupService: StartupService, ) {} ngOnInit() { this.profileUpdateSub = this.hierarchyService.updated.subscribe((updatedProfile) => { if (updatedProfile) { - this.profile = updatedProfile; + this.profile = updatedProfile; } }); } @@ -76,8 +76,11 @@ export class HierarchyDetailComponent implements OnInit, OnDestroy { } openPopup() { - window.open(this.startupService.getConfigStringValue('UI_URL') - + '/profile-hierarchy/' + this.profile.id, 'detailPopup', 'width=584, height=713, resizable=no, location=no'); + window.open( + this.startupService.getConfigStringValue('UI_URL') + '/profile-hierarchy/' + this.profile.id, + 'detailPopup', + 'width=584, height=713, resizable=no, location=no', + ); this.emitClose(); } @@ -92,10 +95,8 @@ export class HierarchyDetailComponent implements OnInit, OnDestroy { } filterEvents(event: Event): boolean { - return event.outDetail && ( - event.outDetail.includes('EXT_VITAMUI_CREATE_PROFILE') || - event.outDetail.includes('EXT_VITAMUI_UPDATE_PROFILE') + return ( + event.outDetail && (event.outDetail.includes('EXT_VITAMUI_CREATE_PROFILE') || event.outDetail.includes('EXT_VITAMUI_UPDATE_PROFILE')) ); } - } diff --git a/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-detail/hierarchy-detail.module.ts b/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-detail/hierarchy-detail.module.ts index d03ad850cc3..1a0a6f3db10 100644 --- a/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-detail/hierarchy-detail.module.ts +++ b/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-detail/hierarchy-detail.module.ts @@ -48,17 +48,9 @@ import { HierarchyPopupComponent } from './hierarchy-popup.component'; import { InformationTabComponent } from './information-tab/information-tab.component'; @NgModule({ - imports: [ - CommonModule, - SharedModule, - MatMenuModule, - MatTabsModule, - MatTooltipModule, - ReactiveFormsModule, - VitamUICommonModule, - ], + imports: [CommonModule, SharedModule, MatMenuModule, MatTabsModule, MatTooltipModule, ReactiveFormsModule, VitamUICommonModule], declarations: [HierarchyPopupComponent, HierarchyDetailComponent, InformationTabComponent], exports: [HierarchyDetailComponent], - providers: [ProfileValidators] + providers: [ProfileValidators], }) -export class HierarchyDetailModule { } +export class HierarchyDetailModule {} diff --git a/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-detail/hierarchy-popup.component.ts b/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-detail/hierarchy-popup.component.ts index bc7bf560828..f010f32f2ee 100644 --- a/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-detail/hierarchy-popup.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-detail/hierarchy-popup.component.ts @@ -41,21 +41,18 @@ import { Profile } from 'ui-frontend-common'; @Component({ selector: 'app-hierarchy-popup', - template: '' + template: '', }) export class HierarchyPopupComponent implements OnInit { - profile: Profile; constructor(private route: ActivatedRoute) { this.profile = this.route.snapshot.data.profile; } - ngOnInit() { - } + ngOnInit() {} closePopup() { window.close(); } - } diff --git a/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-detail/information-tab/information-tab.component.html b/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-detail/information-tab/information-tab.component.html index b67724cf3c1..a01f3e52f92 100644 --- a/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-detail/information-tab/information-tab.component.html +++ b/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-detail/information-tab/information-tab.component.html @@ -1,22 +1,25 @@
      - - - {{'HIERARCHY.INFORMATIONS.INACTIVE_SWITCH' | translate}} - {{'HIERARCHY.INFORMATIONS.ACTIVE_SWITCH' | translate}} + + {{ 'HIERARCHY.INFORMATIONS.INACTIVE_SWITCH' | translate }} + {{ 'HIERARCHY.INFORMATIONS.ACTIVE_SWITCH' | translate }}
      -
      - - -
      +
      + + +
      @@ -28,20 +31,27 @@ [validator]="form?.get('name')?.validator" [asyncValidator]="form?.get('name')?.asyncValidator" > - {{'COMMON.ERROR.REQUIRED' | translate}} - {{'HIERARCHY.INFORMATIONS.EXISTING_NAME' | translate}} + {{ 'COMMON.ERROR.REQUIRED' | translate }} + {{ + 'HIERARCHY.INFORMATIONS.EXISTING_NAME' | translate + }}
      -
      +
      - -
      {{userLevel}}
      + +
      {{ userLevel }}
      -
      +
      - {{'COMMON.ERROR.REQUIRED' | translate}} - {{'HIERARCHY.INFORMATIONS.WRONG_FORMAT' | translate}} + {{ 'COMMON.ERROR.REQUIRED' | translate }} + {{ + 'HIERARCHY.INFORMATIONS.WRONG_FORMAT' | translate + }}
      @@ -63,7 +75,7 @@ [label]="'HIERARCHY.INFORMATIONS.DESCRIPTION' | translate" [validator]="form?.get('description')?.validator" > - {{'COMMON.ERROR.REQUIRED' | translate}} + {{ 'COMMON.ERROR.REQUIRED' | translate }}
      diff --git a/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-detail/information-tab/information-tab.component.spec.ts b/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-detail/information-tab/information-tab.component.spec.ts index 5331d1eb77d..2d8d7e64c4b 100644 --- a/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-detail/information-tab/information-tab.component.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-detail/information-tab/information-tab.component.spec.ts @@ -1,4 +1,3 @@ - /* * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2020) * and the signatories of the "VITAM - Accord du Contributeur" agreement. @@ -58,34 +57,36 @@ class MatTooltipStubDirective { @Component({ selector: 'app-editable-textarea', template: '{{value}}', - providers: [{ - provide: NG_VALUE_ACCESSOR, - useExisting: forwardRef(() => EditableTextAreaStubComponent), - multi: true - }] + providers: [ + { + provide: NG_VALUE_ACCESSOR, + useExisting: forwardRef(() => EditableTextAreaStubComponent), + multi: true, + }, + ], }) class EditableTextAreaStubComponent implements ControlValueAccessor { @Input() validator: Validator; @Input() asyncValidator: AsyncValidator; value: string; - writeValue(value: string) { this.value = value; } + writeValue(value: string) { + this.value = value; + } registerOnChange() {} registerOnTouched() {} } @Component({ - template: ` - - ` + template: ` `, }) class TestHostComponent { profile: Profile = { id: '1', name: 'ProfileName', description: 'Profile description...', - level : '', + level: '', customerId: 'customerId', - groupsCount : 1, + groupsCount: 1, enabled: true, usersCount: 42, tenantName: 'tenant name', @@ -93,17 +94,17 @@ class TestHostComponent { applicationName: 'CUSTOMERS_APP', roles: [ { - name: 'ROLE_MFA_USERS' + name: 'ROLE_MFA_USERS', }, { - name: 'ROLE_UPDATE_STANDARD_USERS' + name: 'ROLE_UPDATE_STANDARD_USERS', }, { - name: 'ROLE_GENERIC_USERS' + name: 'ROLE_GENERIC_USERS', }, ], - readonly : false, - externalParamId: null + readonly: false, + externalParamId: null, }; readOnly = false; @@ -117,27 +118,18 @@ describe('Hierarchy InformationTabComponent', () => { beforeEach(waitForAsync(() => { const hierarchyServiceMock = { update: of({}), updated: new Subject() }; const profileValidatorsSpy = jasmine.createSpyObj('ProfileValidators', { nameExists: () => of(null) }); - const authServiceMock = { user : { level: ''}}; + const authServiceMock = { user: { level: '' } }; TestBed.configureTestingModule({ - imports: [ - ReactiveFormsModule, - VitamUICommonTestModule, - ], - declarations: [ - InformationTabComponent, - TestHostComponent, - EditableTextAreaStubComponent, - MatTooltipStubDirective, - ], + imports: [ReactiveFormsModule, VitamUICommonTestModule], + declarations: [InformationTabComponent, TestHostComponent, EditableTextAreaStubComponent, MatTooltipStubDirective], providers: [ { provide: HierarchyService, useValue: hierarchyServiceMock }, { provide: ProfileValidators, useValue: profileValidatorsSpy }, { provide: AuthService, useValue: authServiceMock }, { provide: CountryService, useValue: {} }, - ] - }) - .compileComponents(); + ], + }).compileComponents(); })); beforeEach(() => { @@ -151,7 +143,6 @@ describe('Hierarchy InformationTabComponent', () => { }); describe('DOM', () => { - it('should have all the fields', () => { let element = fixture.nativeElement.querySelector('vitamui-common-editable-input[formControlName=name]'); expect(element).toBeTruthy('name input'); @@ -167,12 +158,9 @@ describe('Hierarchy InformationTabComponent', () => { expect(element).toBeTruthy('enabled toggle'); expect(element.textContent).toContain('HIERARCHY.INFORMATIONS.ACTIVE_SWITCH'); }); - }); describe('Component', () => { - // TODO }); - }); diff --git a/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-detail/information-tab/information-tab.component.ts b/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-detail/information-tab/information-tab.component.ts index 3370b0ff0eb..7d5d2d6e6e5 100644 --- a/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-detail/information-tab/information-tab.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-detail/information-tab/information-tab.component.ts @@ -49,17 +49,16 @@ const DEBOUNCE_TIME = 400; @Component({ selector: 'app-information-tab', templateUrl: './information-tab.component.html', - styleUrls: ['./information-tab.component.scss'] + styleUrls: ['./information-tab.component.scss'], }) export class InformationTabComponent implements OnDestroy, OnInit, OnChanges { - form: FormGroup; userLevel: string; previousValue: { - name: string, - level: string, - description: string, - enabled: boolean, + name: string; + level: string; + description: string; + enabled: boolean; }; @Input() profile: Profile; @@ -72,35 +71,33 @@ export class InformationTabComponent implements OnDestroy, OnInit, OnChanges { private formBuilder: FormBuilder, private hierarchyService: HierarchyService, private profileValidators: ProfileValidators, - private authService: AuthService + private authService: AuthService, ) { this.userLevel = this.authService.user.level; this.form = this.formBuilder.group({ name: [null, Validators.required], - identifier: [{value: null, disabled : true}, Validators.required], + identifier: [{ value: null, disabled: true }, Validators.required], description: [null, Validators.required], level: [null, buildValidators(this.authService.user)], - enabled: null + enabled: null, }); this.updateSub = merge(this.form.valueChanges, this.form.statusChanges) - .pipe( - debounceTime(DEBOUNCE_TIME), - map(() => diff(this.form.value, this.previousValue)), - filter((formData) => !isEmpty(formData)), - map((formData) => extend({ id: this.profile.id , customerId: this.profile.customerId, - tenantIdentifier: this.profile.tenantIdentifier}, - formData)), - switchMap((formData) => { - return this.hierarchyService.patch(formData).pipe(catchError(() => of(null))); - }) - ) - .subscribe((profile) => this.resetForm(this.form, profile, this.readOnly) - ); + .pipe( + debounceTime(DEBOUNCE_TIME), + map(() => diff(this.form.value, this.previousValue)), + filter((formData) => !isEmpty(formData)), + map((formData) => + extend({ id: this.profile.id, customerId: this.profile.customerId, tenantIdentifier: this.profile.tenantIdentifier }, formData), + ), + switchMap((formData) => { + return this.hierarchyService.patch(formData).pipe(catchError(() => of(null))); + }), + ) + .subscribe((profile) => this.resetForm(this.form, profile, this.readOnly)); } - ngOnInit() { - } + ngOnInit() {} ngOnDestroy() { this.updateSub.unsubscribe(); @@ -109,8 +106,8 @@ export class InformationTabComponent implements OnDestroy, OnInit, OnChanges { ngOnChanges(changes: SimpleChanges) { if (changes.hasOwnProperty('profile') || changes.hasOwnProperty('readOnly')) { if (this.profile) { - this.resetForm(this.form, this.profile, this.readOnly); - this.previousValue = this.form.value; + this.resetForm(this.form, this.profile, this.readOnly); + this.previousValue = this.form.value; } } } @@ -123,7 +120,11 @@ export class InformationTabComponent implements OnDestroy, OnInit, OnChanges { } private initFormValidators(form: FormGroup, profile: Profile) { - form.get('name').setAsyncValidators(this.profileValidators.nameExists(profile.tenantIdentifier, profile.level, profile.applicationName, profile.name)); + form + .get('name') + .setAsyncValidators( + this.profileValidators.nameExists(profile.tenantIdentifier, profile.level, profile.applicationName, profile.name), + ); } private initFormActivationState(form: FormGroup, profile: Profile, readOnly: boolean) { @@ -135,11 +136,10 @@ export class InformationTabComponent implements OnDestroy, OnInit, OnChanges { form.enable({ emitEvent: false }); - form.get('identifier').disable({emitEvent : false}); + form.get('identifier').disable({ emitEvent: false }); if (profile.groupsCount && profile.groupsCount > 0) { - form.get('enabled').disable({emitEvent : false}); - form.get('level').disable({emitEvent : false}); + form.get('enabled').disable({ emitEvent: false }); + form.get('level').disable({ emitEvent: false }); } } - } diff --git a/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-list/hierarchy-list.component.html b/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-list/hierarchy-list.component.html index 8c4b7bfcf98..0d04e234f42 100644 --- a/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-list/hierarchy-list.component.html +++ b/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-list/hierarchy-list.component.html @@ -2,26 +2,27 @@
      -
      {{'HIERARCHY.HOME.RESULTS_TABLE.NAME' | translate}}
      -
      {{'HIERARCHY.HOME.RESULTS_TABLE.APP' | translate}}
      -
      {{'HIERARCHY.HOME.RESULTS_TABLE.DESCRIPTION' | translate}}
      -
      {{'HIERARCHY.HOME.RESULTS_TABLE.LEVEL' | translate}}
      -
      {{'COMMON.ID' | translate}}
      -
      {{'HIERARCHY.HOME.RESULTS_TABLE.USERS_NUMBER' | translate}}
      +
      {{ 'HIERARCHY.HOME.RESULTS_TABLE.NAME' | translate }}
      +
      {{ 'HIERARCHY.HOME.RESULTS_TABLE.APP' | translate }}
      +
      {{ 'HIERARCHY.HOME.RESULTS_TABLE.DESCRIPTION' | translate }}
      +
      {{ 'HIERARCHY.HOME.RESULTS_TABLE.LEVEL' | translate }}
      +
      {{ 'COMMON.ID' | translate }}
      +
      {{ 'HIERARCHY.HOME.RESULTS_TABLE.USERS_NUMBER' | translate }}
      -
      {{ profile.name }}
      {{ 'APPLICATION.' + profile.applicationName + '.NAME' | translate }}
      -
      {{ profile.description | truncate:50 }}
      +
      {{ profile.description | truncate: 50 }}
      {{ profile.level }}
      {{ profile.identifier }}
      {{ profile.usersCount }}
      @@ -30,18 +31,18 @@
      -
      -
      -
      +
      +
      +
      -
      {{'COMMON.NO_RESULT' | translate}}
      -
      +
      {{ 'COMMON.NO_RESULT' | translate }}
      + - +
      - {{'COMMON.SHOW_MORE_RESULTS' | translate}} + {{ 'COMMON.SHOW_MORE_RESULTS' | translate }}
      diff --git a/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-list/hierarchy-list.component.spec.ts b/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-list/hierarchy-list.component.spec.ts index 0336a0713ee..28e303c4b5b 100644 --- a/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-list/hierarchy-list.component.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-list/hierarchy-list.component.spec.ts @@ -45,37 +45,36 @@ import { VitamUICommonTestModule } from 'ui-frontend-common/testing'; import { HierarchyService } from '../hierarchy.service'; import { HierarchyListComponent } from './hierarchy-list.component'; - const expectedApp = [ { id: 'CUSTOMERS_APP', identifier: 'CUSTOMERS_APP', name: 'Organisations', - url: '' + url: '', }, { id: 'ARCHIVE_APP', identifier: 'ARCHIVE_APP', name: 'Archives', - url: '' + url: '', }, { id: 'USERS_APP', identifier: 'USERS_APP', name: 'Utilisateurs', - url: '' + url: '', }, { id: 'GROUPS_APP', identifier: 'GROUPS_APP', name: 'Groupes de profils', - url: '' + url: '', }, { id: 'PROFILES_APP', identifier: 'PROFILES_APP', name: 'Profils APP Utilisateurs', - url: '' + url: '', }, ]; @@ -88,24 +87,20 @@ describe('HierarchyListComponent', () => { search: () => of([]), canLoadMore: true, loadMore: () => of([]), - updated: new Subject() + updated: new Subject(), }; const routerSpy = jasmine.createSpyObj('Router', ['navigate']); TestBed.configureTestingModule({ - imports: [ - MatProgressSpinnerModule, - VitamUICommonTestModule, - ], - declarations: [ HierarchyListComponent ], + imports: [MatProgressSpinnerModule, VitamUICommonTestModule], + declarations: [HierarchyListComponent], providers: [ { provide: HierarchyService, useValue: hierarchyListServiceSpy }, { provide: Router, useValue: routerSpy }, - { provide: ActivatedRoute, useValue: {paramMap : EMPTY}}, + { provide: ActivatedRoute, useValue: { paramMap: EMPTY } }, { provide: ApplicationService, useValue: { applications: expectedApp } }, - ] - }) - .compileComponents(); + ], + }).compileComponents(); })); beforeEach(() => { diff --git a/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-list/hierarchy-list.component.ts b/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-list/hierarchy-list.component.ts index b49a7f6cfa8..2e0158ed34f 100644 --- a/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-list/hierarchy-list.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-list/hierarchy-list.component.ts @@ -37,8 +37,15 @@ import { merge, Subject, Subscription } from 'rxjs'; import { debounceTime, distinctUntilChanged, filter, map, tap } from 'rxjs/operators'; import { - ApplicationId, buildCriteriaFromSearch, Criterion, Direction, - InfiniteScrollTable, Operators, PageRequest, Profile, SearchQuery + ApplicationId, + buildCriteriaFromSearch, + Criterion, + Direction, + InfiniteScrollTable, + Operators, + PageRequest, + Profile, + SearchQuery, } from 'ui-frontend-common'; import { Component, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core'; @@ -52,10 +59,9 @@ const FILTER_DEBOUNCE_TIME_MS = 400; @Component({ selector: 'app-hierarchy-list', templateUrl: './hierarchy-list.component.html', - styleUrls: ['./hierarchy-list.component.scss'] + styleUrls: ['./hierarchy-list.component.scss'], }) export class HierarchyListComponent extends InfiniteScrollTable implements OnDestroy, OnInit { - @Input('search') set searchText(searchText: string) { this._searchText = searchText; @@ -72,7 +78,10 @@ export class HierarchyListComponent extends InfiniteScrollTable impleme private readonly orderChange = new Subject(); private readonly searchKeys = ['name', 'description', 'identifier']; - constructor(public hierarchyService: HierarchyService, private route: ActivatedRoute) { + constructor( + public hierarchyService: HierarchyService, + private route: ActivatedRoute, + ) { super(hierarchyService); this.updatedProfileSub = this.hierarchyService.updated.subscribe((updatedProfile: Profile) => { const profileIndex = this.dataSource.findIndex((profile) => updatedProfile.id === profile.id); @@ -108,8 +117,9 @@ export class HierarchyListComponent extends InfiniteScrollTable impleme }), ); - const searchCriteriaChange = merge(tenantChange, this.searchChange, this.filterChange, this.orderChange) - .pipe(debounceTime(FILTER_DEBOUNCE_TIME_MS)); + const searchCriteriaChange = merge(tenantChange, this.searchChange, this.filterChange, this.orderChange).pipe( + debounceTime(FILTER_DEBOUNCE_TIME_MS), + ); searchCriteriaChange.subscribe(() => this.search()); } @@ -123,20 +133,16 @@ export class HierarchyListComponent extends InfiniteScrollTable impleme { key: 'applicationName', value: [ApplicationId.USERS_APP], - operator: Operators.notin + operator: Operators.notin, }, { key: 'externalParamId', value: null, operator: Operators.equals }, - { key: 'tenantIdentifier', value: this.tenantIdentifier, operator: Operators.equals } + { key: 'tenantIdentifier', value: this.tenantIdentifier, operator: Operators.equals }, ]; const query: SearchQuery = { - criteria: [ - ...defaultCriteria, - ...buildCriteriaFromSearch(this._searchText, this.searchKeys), - ] + criteria: [...defaultCriteria, ...buildCriteriaFromSearch(this._searchText, this.searchKeys)], }; super.search(new PageRequest(0, DEFAULT_PAGE_SIZE, 'name', Direction.ASCENDANT, JSON.stringify(query))); } - } diff --git a/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-list/hierarchy-list.module.ts b/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-list/hierarchy-list.module.ts index 1e5d13d32a3..cfe62f138ef 100644 --- a/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-list/hierarchy-list.module.ts +++ b/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-list/hierarchy-list.module.ts @@ -43,13 +43,8 @@ import { SharedModule } from '../../shared/shared.module'; import { HierarchyListComponent } from './hierarchy-list.component'; @NgModule({ - imports: [ - CommonModule, - SharedModule, - MatProgressSpinnerModule, - VitamUICommonModule, - ], + imports: [CommonModule, SharedModule, MatProgressSpinnerModule, VitamUICommonModule], declarations: [HierarchyListComponent], - exports: [HierarchyListComponent] + exports: [HierarchyListComponent], }) -export class HierarchyListModule { } +export class HierarchyListModule {} diff --git a/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-resolver.service.ts b/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-resolver.service.ts index a2b3512ab02..817887f53b2 100644 --- a/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-resolver.service.ts +++ b/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-resolver.service.ts @@ -43,28 +43,28 @@ import { Profile } from 'ui-frontend-common'; import { HierarchyService } from './hierarchy.service'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) -export class HierarchyResolver implements Resolve { - - constructor(private hierarchyService: HierarchyService, private router: Router) { } +export class HierarchyResolver implements Resolve { + constructor( + private hierarchyService: HierarchyService, + private router: Router, + ) {} resolve(route: ActivatedRouteSnapshot): Observable { const id = route.paramMap.get('id'); - return this.hierarchyService.get(id) - .pipe( - take(1), - map((profile: Profile) => { - if (profile) { - return profile; - } else { - this.router.navigate(['/']); + return this.hierarchyService.get(id).pipe( + take(1), + map((profile: Profile) => { + if (profile) { + return profile; + } else { + this.router.navigate(['/']); - return null; - } - }) - ); + return null; + } + }), + ); } - } diff --git a/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-routing.module.ts b/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-routing.module.ts index 88b49b17f42..95900e0b105 100644 --- a/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-routing.module.ts +++ b/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy-routing.module.ts @@ -46,13 +46,13 @@ const routes: Route[] = [ { path: '', redirectTo: 'tenant', - pathMatch: 'full' + pathMatch: 'full', }, { path: 'tenant', component: VitamUITenantSelectComponent, canActivate: [TenantSelectionGuard], - pathMatch: 'full' + pathMatch: 'full', }, { path: 'tenant/:tenantIdentifier', @@ -63,19 +63,13 @@ const routes: Route[] = [ path: ':id', component: HierarchyPopupComponent, resolve: { profile: HierarchyResolver }, - data: { isPopup: true, appId: 'HIERARCHY_PROFILE_APP' } + data: { isPopup: true, appId: 'HIERARCHY_PROFILE_APP' }, }, ]; - @NgModule({ declarations: [], - imports: [ - CommonModule, - RouterModule.forChild(routes) - ], - exports: [ - RouterModule - ] + imports: [CommonModule, RouterModule.forChild(routes)], + exports: [RouterModule], }) -export class HierarchyRoutingModule { } +export class HierarchyRoutingModule {} diff --git a/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy.component.html b/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy.component.html index 328b5f2ad00..f250a51e7be 100644 --- a/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy.component.html +++ b/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy.component.html @@ -6,12 +6,12 @@
      - {{'HIERARCHY.HOME.TITLE' | translate}} + {{ 'HIERARCHY.HOME.TITLE' | translate }}
      diff --git a/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy.component.ts b/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy.component.ts index 4560c2f87c8..cd24939e0d6 100644 --- a/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy.component.ts @@ -44,36 +44,42 @@ import { HierarchyListComponent } from './hierarchy-list/hierarchy-list.componen @Component({ selector: 'app-hierarchy', templateUrl: './hierarchy.component.html', - styleUrls: ['./hierarchy.component.scss'] + styleUrls: ['./hierarchy.component.scss'], }) export class HierarchyComponent extends SidenavPage implements OnInit { - public profiles: Profile[]; public search: string; private tenantIdentifier: number; @ViewChild(HierarchyListComponent, { static: true }) hierarchyListComponent: HierarchyListComponent; - constructor(public dialog: MatDialog, private route: ActivatedRoute, public globalEventService: GlobalEventService) { + constructor( + public dialog: MatDialog, + private route: ActivatedRoute, + public globalEventService: GlobalEventService, + ) { super(route, globalEventService); } ngOnInit() { this.route.paramMap.subscribe((paramMap) => { this.tenantIdentifier = +paramMap.get('tenantIdentifier'); - }); + }); } public openHierarchyDuplicateDialog(): void { - this.dialog.open(HierarchyCreateComponent, { - panelClass: 'vitamui-modal', - disableClose: true, - data: { tenantId: this.tenantIdentifier } - }).afterClosed().subscribe((result) => { + this.dialog + .open(HierarchyCreateComponent, { + panelClass: 'vitamui-modal', + disableClose: true, + data: { tenantId: this.tenantIdentifier }, + }) + .afterClosed() + .subscribe((result) => { if (result) { this.refreshList(); } - }); + }); } public onSearchSubmit(search: string): void { @@ -85,5 +91,4 @@ export class HierarchyComponent extends SidenavPage implements OnInit { this.hierarchyListComponent.search(); } } - } diff --git a/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy.module.ts b/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy.module.ts index 39394582c93..10801220967 100644 --- a/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy.module.ts +++ b/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy.module.ts @@ -63,12 +63,9 @@ import { HierarchyComponent } from './hierarchy.component'; MatProgressBarModule, ReactiveFormsModule, MatSidenavModule, - HierarchyRoutingModule + HierarchyRoutingModule, ], declarations: [HierarchyComponent], - providers: [ - HierarchyService, - HierarchyResolver, - ] + providers: [HierarchyService, HierarchyResolver], }) -export class HierarchyModule { } +export class HierarchyModule {} diff --git a/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy.service.spec.ts b/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy.service.spec.ts index b43c939448c..676a580de44 100644 --- a/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy.service.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy.service.spec.ts @@ -51,10 +51,9 @@ describe('HierarchyService', () => { HierarchyService, { provide: VitamUISnackBarService, useValue: snackBarSpy }, { provide: BASE_URL, useValue: '/fake-api' }, - ] + ], }); - } - ); + }); it('should be created', () => { const service: HierarchyService = TestBed.inject(HierarchyService); diff --git a/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy.service.ts b/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy.service.ts index 75bf91b33a0..c45b5145364 100644 --- a/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy.service.ts +++ b/ui/ui-frontend/projects/identity/src/app/hierarchy/hierarchy.service.ts @@ -42,26 +42,28 @@ import { tap } from 'rxjs/operators'; import { Criterion, Operators, Profile, ProfileApiService, SearchQuery, SearchService, VitamUISnackBarService } from 'ui-frontend-common'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) -export class HierarchyService extends SearchService { - +export class HierarchyService extends SearchService { updated = new Subject(); - constructor(private profileApi: ProfileApiService, http: HttpClient, private snackBarService: VitamUISnackBarService) { + constructor( + private profileApi: ProfileApiService, + http: HttpClient, + private snackBarService: VitamUISnackBarService, + ) { super(http, profileApi, 'ALL'); } setTenantId(tenantIdentifier: number) { - this.headers = new HttpHeaders({ 'X-Tenant-Id': tenantIdentifier.toString()}); + this.headers = new HttpHeaders({ 'X-Tenant-Id': tenantIdentifier.toString() }); } getAllByParams(query: SearchQuery, headers?: HttpHeaders) { - const params = new HttpParams().set('criteria', JSON.stringify(query)); + const params = new HttpParams().set('criteria', JSON.stringify(query)); return this.profileApi.getAllByParams(params, headers); } - get(id: string): Observable { return this.profileApi.getOneWithEmbedded(id, 'ALL', this.headers); } @@ -71,51 +73,49 @@ export class HierarchyService extends SearchService { const criterionName: Criterion = { key: 'name', value: name, operator: Operators.equalsIgnoreCase }; const criterionTenantIdentifier: Criterion = { key: 'tenantIdentifier', value: tenantIdentifier, operator: Operators.equals }; const criterionLevel: Criterion = { key: 'level', value: level, operator: Operators.equals }; - const criterionApplicationName: Criterion = { key: 'applicationName', value: applicationName, operator: Operators.equals}; + const criterionApplicationName: Criterion = { key: 'applicationName', value: applicationName, operator: Operators.equals }; criterionArray.push(criterionName, criterionTenantIdentifier, criterionLevel, criterionApplicationName); const query: SearchQuery = { criteria: criterionArray }; - const params = [{key : 'criteria', value: JSON.stringify(query)}]; + const params = [{ key: 'criteria', value: JSON.stringify(query) }]; return this.profileApi.checkExistsByParam(params, this.headers); } - patch(data: { id: string, [key: string]: any }): Observable { - return this.profileApi.patch(data, this.headers) - .pipe( - tap((response) => this.updated.next(response)), - tap( - (response) => { - this.snackBarService.open({ - message: 'SHARED.SNACKBAR.PROFILE_UPDATE', - translateParams:{ - param1: response.name, - } - }); - }, - (error) => { - this.snackBarService.open({ message: error.error.message, translate: false }); - } - ) - ); + patch(data: { id: string; [key: string]: any }): Observable { + return this.profileApi.patch(data, this.headers).pipe( + tap((response) => this.updated.next(response)), + tap( + (response) => { + this.snackBarService.open({ + message: 'SHARED.SNACKBAR.PROFILE_UPDATE', + translateParams: { + param1: response.name, + }, + }); + }, + (error) => { + this.snackBarService.open({ message: error.error.message, translate: false }); + }, + ), + ); } create(profile: Profile) { - return this.profileApi.create(profile, this.headers).pipe( tap( (response: Profile) => { this.snackBarService.open({ message: 'SHARED.SNACKBAR.PROFILE_CREATE_ERROR', - translateParams:{ - param1: response.name, - } + translateParams: { + param1: response.name, + }, }); }, (error) => { this.snackBarService.open({ message: error.error.message, translate: false }); - } - ) + }, + ), ); } } diff --git a/ui/ui-frontend/projects/identity/src/app/hierarchy/profile.validators.ts b/ui/ui-frontend/projects/identity/src/app/hierarchy/profile.validators.ts index 2282cf16204..c828eba870c 100644 --- a/ui/ui-frontend/projects/identity/src/app/hierarchy/profile.validators.ts +++ b/ui/ui-frontend/projects/identity/src/app/hierarchy/profile.validators.ts @@ -43,19 +43,21 @@ import { HierarchyService } from './hierarchy.service'; @Injectable() export class ProfileValidators { + private debounceTime = 400; - private debounceTime = 400; - - constructor(private rngProfileService: HierarchyService) {} - - nameExists = (tenantIdentifier: number, level: string, applicationName: string, nameToIgnore?: string): AsyncValidatorFn => { - return (control: AbstractControl) => { - return timer(this.debounceTime).pipe( - switchMap(() => control.value !== nameToIgnore ? this.rngProfileService.exists(tenantIdentifier, level, applicationName, control.value) : of(false)), - take(1), - map((exists: boolean) => exists ? { nameExists: true } : null) - ); - }; - } + constructor(private rngProfileService: HierarchyService) {} + nameExists = (tenantIdentifier: number, level: string, applicationName: string, nameToIgnore?: string): AsyncValidatorFn => { + return (control: AbstractControl) => { + return timer(this.debounceTime).pipe( + switchMap(() => + control.value !== nameToIgnore + ? this.rngProfileService.exists(tenantIdentifier, level, applicationName, control.value) + : of(false), + ), + take(1), + map((exists: boolean) => (exists ? { nameExists: true } : null)), + ); + }; + }; } diff --git a/ui/ui-frontend/projects/identity/src/app/profile/profile-create/profile-create.component.html b/ui/ui-frontend/projects/identity/src/app/profile/profile-create/profile-create.component.html index 87620c55c18..7e88a467391 100644 --- a/ui/ui-frontend/projects/identity/src/app/profile/profile-create/profile-create.component.html +++ b/ui/ui-frontend/projects/identity/src/app/profile/profile-create/profile-create.component.html @@ -1,53 +1,90 @@
      - +
      -
      -
      {{'USER_PROFILE.INFORMATIONS.MODAL.TITLE' | translate}}
      +
      +
      {{ 'USER_PROFILE.INFORMATIONS.MODAL.TITLE' | translate }}
      -
      - - {{'USER_PROFILE.INFORMATIONS.INACTIVE_SWITCH' | translate}} - {{'USER_PROFILE.INFORMATIONS.ACTIVE_SWITCH' | translate}} - -
      +
      + + {{ 'USER_PROFILE.INFORMATIONS.INACTIVE_SWITCH' | translate }} + {{ 'USER_PROFILE.INFORMATIONS.ACTIVE_SWITCH' | translate }} + +
      - - {{'COMMON.ERROR.REQUIRED' | translate}} - {{'USER_PROFILE.INFORMATIONS.MODAL.EXISTING_NAME' | translate}} - + + {{ + 'COMMON.ERROR.REQUIRED' | translate + }} + {{ + 'USER_PROFILE.INFORMATIONS.MODAL.EXISTING_NAME' | translate + }} + - - {{'COMMON.ERROR.REQUIRED' | translate}} - + + {{ 'COMMON.ERROR.REQUIRED' | translate }} + -
      -
      -
      {{'USER_PROFILE.INFORMATIONS.LEVEL' | translate}}
      -
      {{authService.user.level}}
      -
      - - {{'COMMON.ERROR.REQUIRED' | translate}} - {{'USER_PROFILE.INFORMATIONS.MODAL.WRONG_FORMAT' | translate}} - -
      +
      +
      +
      {{ 'USER_PROFILE.INFORMATIONS.LEVEL' | translate }}
      +
      {{ authService.user.level }}
      +
      + + {{ 'COMMON.ERROR.REQUIRED' | translate }} + {{ 'USER_PROFILE.INFORMATIONS.MODAL.WRONG_FORMAT' | translate }} + +
      - - {{'USER_PROFILE.INFORMATIONS.STRONG_AUTHENT' | translate}} - {{'USER_PROFILE.INFORMATIONS.USERS_CREATION' | translate}} - {{'USER_PROFILE.INFORMATIONS.MODIF_INFORMATIONS' | translate}} - {{'USER_PROFILE.INFORMATIONS.ANONYMOUS' | translate}} - {{'USER_PROFILE.INFORMATIONS.USERS_MANAGEMENT' | translate}} - + + {{ + 'USER_PROFILE.INFORMATIONS.STRONG_AUTHENT' | translate + }} + {{ + 'USER_PROFILE.INFORMATIONS.USERS_CREATION' | translate + }} + {{ + 'USER_PROFILE.INFORMATIONS.MODIF_INFORMATIONS' | translate + }} + {{ + 'USER_PROFILE.INFORMATIONS.ANONYMOUS' | translate + }} + {{ + 'USER_PROFILE.INFORMATIONS.USERS_MANAGEMENT' | translate + }} + -
      - - -
      +
      + +
      +
      diff --git a/ui/ui-frontend/projects/identity/src/app/profile/profile-create/profile-create.component.spec.ts b/ui/ui-frontend/projects/identity/src/app/profile/profile-create/profile-create.component.spec.ts index 34413086199..78971ba977d 100644 --- a/ui/ui-frontend/projects/identity/src/app/profile/profile-create/profile-create.component.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/profile/profile-create/profile-create.component.spec.ts @@ -58,17 +58,11 @@ describe('ProfileCreateComponent', () => { const profileServiceSpy = jasmine.createSpyObj('ProfileService', { create: of({}) }); const startupServiceSpy = jasmine.createSpyObj('StartupService', { create: of({}) }); const customerServiceSpy = jasmine.createSpyObj('CustomerService', { create: of({}) }); - const profileValidatorsSpy = jasmine.createSpyObj('ProfileValidators', { create: of({})}); + const profileValidatorsSpy = jasmine.createSpyObj('ProfileValidators', { create: of({}) }); TestBed.configureTestingModule({ - imports: [ - ReactiveFormsModule, - MatProgressBarModule, - CollapseModule, - MatButtonToggleModule, - VitamUICommonTestModule, - ], - declarations: [ ProfileCreateComponent, GroupDetailComponent ], + imports: [ReactiveFormsModule, MatProgressBarModule, CollapseModule, MatButtonToggleModule, VitamUICommonTestModule], + declarations: [ProfileCreateComponent, GroupDetailComponent], providers: [ { provide: MatDialogRef, useValue: matDialogRefSpy }, { provide: MAT_DIALOG_DATA, useValue: {} }, @@ -76,9 +70,8 @@ describe('ProfileCreateComponent', () => { { provide: StartupService, useValue: startupServiceSpy }, { provide: CustomerService, useValue: customerServiceSpy }, { provide: ProfileValidators, useValue: profileValidatorsSpy }, - ] - }) - .compileComponents(); + ], + }).compileComponents(); })); beforeEach(() => { diff --git a/ui/ui-frontend/projects/identity/src/app/profile/profile-create/profile-create.component.ts b/ui/ui-frontend/projects/identity/src/app/profile/profile-create/profile-create.component.ts index c39712719de..54039564646 100644 --- a/ui/ui-frontend/projects/identity/src/app/profile/profile-create/profile-create.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/profile/profile-create/profile-create.component.ts @@ -36,7 +36,15 @@ */ import { Subscription } from 'rxjs'; import { - ApplicationId, AuthService, AuthUser, buildValidators, collapseAnimation, ConfirmDialogService, Group, Profile, Role + ApplicationId, + AuthService, + AuthUser, + buildValidators, + collapseAnimation, + ConfirmDialogService, + Group, + Profile, + Role, } from 'ui-frontend-common'; import { Component, Inject, OnDestroy, OnInit } from '@angular/core'; @@ -51,15 +59,12 @@ import { ProfileValidators } from '../profile.validators'; selector: 'app-profile-create', templateUrl: './profile-create.component.html', styleUrls: ['./profile-create.component.scss'], - animations: [ - collapseAnimation, - ] + animations: [collapseAnimation], }) export class ProfileCreateComponent implements OnInit, OnDestroy { - adminProfileForm: FormGroup; tenantWithProofId: string; - selectedProfileGroups: Group [] = []; + selectedProfileGroups: Group[] = []; selectedProfileGroupsId: string[] = []; userLevel: string; subLevelIsRequired: boolean; @@ -75,20 +80,19 @@ export class ProfileCreateComponent implements OnInit, OnDestroy { public customerService: CustomerService, public profileValidators: ProfileValidators, private formBuilder: FormBuilder, - private confirmDialogService: ConfirmDialogService - )  { + private confirmDialogService: ConfirmDialogService, + ) { this.adminProfileForm = this.formBuilder.group({ enabled: true, name: [null, Validators.required], description: [null, Validators.required], - level: ['', buildValidators(this.authService.user)], + level: ['', buildValidators(this.authService.user)], customerId: [this.authService.user.customerId], applicationName: 'USERS_APP', tenantIdentifier: this.tenantWithProofId, - roles : [[{name : this.roleEnum.ROLE_GET_USERS}, - {name : this.roleEnum.ROLE_GET_GROUPS}, - {name : this.roleEnum.ROLE_GET_USER_INFOS} - ]] + roles: [ + [{ name: this.roleEnum.ROLE_GET_USERS }, { name: this.roleEnum.ROLE_GET_GROUPS }, { name: this.roleEnum.ROLE_GET_USER_INFOS }], + ], }); } @@ -97,12 +101,14 @@ export class ProfileCreateComponent implements OnInit, OnDestroy { this.tenantWithProofId = user.proofTenantIdentifier; this.adminProfileForm.get('tenantIdentifier').setValue(this.tenantWithProofId); - this.adminProfileForm.get('name') - .setAsyncValidators(this.profileValidators.nameExists(Number(this.tenantWithProofId), '', ApplicationId.USERS_APP)); + this.adminProfileForm + .get('name') + .setAsyncValidators(this.profileValidators.nameExists(Number(this.tenantWithProofId), '', ApplicationId.USERS_APP)); this.adminProfileForm.get('level').valueChanges.subscribe((level) => { - this.adminProfileForm.get('name'). - setAsyncValidators(this.profileValidators.nameExists(Number(this.tenantWithProofId), level, ApplicationId.USERS_APP)); + this.adminProfileForm + .get('name') + .setAsyncValidators(this.profileValidators.nameExists(Number(this.tenantWithProofId), level, ApplicationId.USERS_APP)); this.adminProfileForm.get('name').updateValueAndValidity(); }); @@ -122,18 +128,19 @@ export class ProfileCreateComponent implements OnInit, OnDestroy { } firstStepInvalid(): boolean { - return this.adminProfileForm.get('name').invalid || this.adminProfileForm.get('name').pending || - this.adminProfileForm.get('description').invalid || this.adminProfileForm.get('description').pending - || this.adminProfileForm.get('level').invalid; + return ( + this.adminProfileForm.get('name').invalid || + this.adminProfileForm.get('name').pending || + this.adminProfileForm.get('description').invalid || + this.adminProfileForm.get('description').pending || + this.adminProfileForm.get('level').invalid + ); } completeUpdateRoles(profile: Profile) { // add ROLE_UPDATE_USERS when an user can update standard informations or MFA data // remove ROLE_UPDATE_USERS when an user can't update standard informations and MFA data - const userUpdateRolesNames = [ - Role.ROLE_MFA_USERS.toString(), - Role.ROLE_UPDATE_STANDARD_USERS.toString(), - ]; + const userUpdateRolesNames = [Role.ROLE_MFA_USERS.toString(), Role.ROLE_UPDATE_STANDARD_USERS.toString()]; const hasUpdateRole = profile.roles.some((r: any) => userUpdateRolesNames.includes(r.name)); const roleUpdateUsersIndex = profile.roles.findIndex((role: any) => role.name === Role.ROLE_UPDATE_USERS); @@ -159,9 +166,7 @@ export class ProfileCreateComponent implements OnInit, OnDestroy { } completeCreateRoles(profile: Profile) { - const userCreateRolesNames = [ - Role.ROLE_CREATE_USERS.toString(), - ]; + const userCreateRolesNames = [Role.ROLE_CREATE_USERS.toString()]; const hasUserCreateRole = profile.roles.some((r: any) => userCreateRolesNames.includes(r.name)); const userCreateInfoRoleIndex = profile.roles.findIndex((role: any) => role.name === Role.ROLE_CREATE_USER_INFOS); @@ -171,12 +176,14 @@ export class ProfileCreateComponent implements OnInit, OnDestroy { profile.roles.push({ name: Role.ROLE_CREATE_USER_INFOS }); } } else if (userCreateInfoRoleIndex !== -1) { - profile.roles.splice(userCreateInfoRoleIndex, 1) + profile.roles.splice(userCreateInfoRoleIndex, 1); } } onSubmit() { - if (this.adminProfileForm.invalid) { return; } + if (this.adminProfileForm.invalid) { + return; + } const profile: Profile = this.adminProfileForm.getRawValue(); this.completeUpdateRoles(profile); this.completeCreateRoles(profile); @@ -184,6 +191,7 @@ export class ProfileCreateComponent implements OnInit, OnDestroy { () => this.dialogRef.close(true), (error) => { console.error(error); - }); + }, + ); } } diff --git a/ui/ui-frontend/projects/identity/src/app/profile/profile-create/profile-create.module.ts b/ui/ui-frontend/projects/identity/src/app/profile/profile-create/profile-create.module.ts index f75ea9c6965..b87f73a87b2 100644 --- a/ui/ui-frontend/projects/identity/src/app/profile/profile-create/profile-create.module.ts +++ b/ui/ui-frontend/projects/identity/src/app/profile/profile-create/profile-create.module.ts @@ -65,10 +65,7 @@ import { ProfileCreateComponent } from './profile-create.component'; VitamUICommonModule, RoleToggleModule, ], - declarations: [ - ProfileCreateComponent, - ], + declarations: [ProfileCreateComponent], entryComponents: [ProfileCreateComponent], - }) -export class ProfileCreateModule { } +export class ProfileCreateModule {} diff --git a/ui/ui-frontend/projects/identity/src/app/profile/profile-detail/information-tab/information-tab.component.html b/ui/ui-frontend/projects/identity/src/app/profile/profile-detail/information-tab/information-tab.component.html index a584ef3c45f..67fe3bfd263 100644 --- a/ui/ui-frontend/projects/identity/src/app/profile/profile-detail/information-tab/information-tab.component.html +++ b/ui/ui-frontend/projects/identity/src/app/profile/profile-detail/information-tab/information-tab.component.html @@ -1,20 +1,25 @@ -
      - - {{'USER_PROFILE.INFORMATIONS.INACTIVE_SWITCH' | translate}} - {{'USER_PROFILE.INFORMATIONS.ACTIVE_SWITCH' | translate}} + + + {{ 'USER_PROFILE.INFORMATIONS.INACTIVE_SWITCH' | translate }} + {{ 'USER_PROFILE.INFORMATIONS.ACTIVE_SWITCH' | translate }}
      -
      - - -
      +
      + + +
      @@ -24,31 +29,42 @@ maxlength="100" [label]="'USER_PROFILE.INFORMATIONS.NAME' | translate" [validator]="form?.get('name')?.validator" - [asyncValidator]="form?.get('name')?.asyncValidator"> - {{'COMMON.ERROR.REQUIRED' | translate}} - {{'USER_PROFILE.INFORMATIONS.EXISTING_NAME' | translate}} + [asyncValidator]="form?.get('name')?.asyncValidator" + > + {{ 'COMMON.ERROR.REQUIRED' | translate }} + {{ + 'USER_PROFILE.INFORMATIONS.EXISTING_NAME' | translate + }}
      -
      -
      - -
      {{userLevel}}
      -
      -
      -
      - - {{'COMMON.ERROR.REQUIRED' | translate}} - {{'USER_PROFILE.INFORMATIONS.WRONG_FORMAT' | translate}} - -
      +
      +
      + +
      {{ userLevel }}
      +
      +
      +
      + + {{ 'COMMON.ERROR.REQUIRED' | translate }} + {{ + 'USER_PROFILE.INFORMATIONS.WRONG_FORMAT' | translate + }} + +
      @@ -57,19 +73,30 @@ formControlName="description" maxlength="380" [label]="'USER_PROFILE.INFORMATIONS.DESCRIPTION' | translate" - [validator]="form?.get('description')?.validator"> - {{'COMMON.ERROR.REQUIRED' | translate}} + [validator]="form?.get('description')?.validator" + > + {{ 'COMMON.ERROR.REQUIRED' | translate }}
      - - {{'USER_PROFILE.INFORMATIONS.STRONG_AUTHENT' | translate}} - {{'USER_PROFILE.INFORMATIONS.USERS_CREATION' | translate}} - {{'USER_PROFILE.INFORMATIONS.MODIF_INFORMATIONS' | translate}} - {{'USER_PROFILE.INFORMATIONS.ANONYMOUS' | translate}} - {{'USER_PROFILE.INFORMATIONS.USERS_MANAGEMENT' | translate}} - + + {{ + 'USER_PROFILE.INFORMATIONS.STRONG_AUTHENT' | translate + }} + {{ + 'USER_PROFILE.INFORMATIONS.USERS_CREATION' | translate + }} + {{ + 'USER_PROFILE.INFORMATIONS.MODIF_INFORMATIONS' | translate + }} + {{ + 'USER_PROFILE.INFORMATIONS.ANONYMOUS' | translate + }} + + {{ 'USER_PROFILE.INFORMATIONS.USERS_MANAGEMENT' | translate }} +
      diff --git a/ui/ui-frontend/projects/identity/src/app/profile/profile-detail/information-tab/information-tab.component.ts b/ui/ui-frontend/projects/identity/src/app/profile/profile-detail/information-tab/information-tab.component.ts index cb29f13db71..ec9d47f7d7a 100644 --- a/ui/ui-frontend/projects/identity/src/app/profile/profile-detail/information-tab/information-tab.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/profile/profile-detail/information-tab/information-tab.component.ts @@ -48,19 +48,18 @@ import { ProfileValidators } from '../../profile.validators'; @Component({ selector: 'app-information-tab', templateUrl: './information-tab.component.html', - styleUrls: ['./information-tab.component.scss'] + styleUrls: ['./information-tab.component.scss'], }) export class InformationTabComponent implements OnDestroy, OnInit, OnChanges { - form: FormGroup; permissionForm: FormGroup; groupsCount: boolean; userLevel: string; previousValue: { - name: string, - level: string, - description: string, - enabled: boolean, + name: string; + level: string; + description: string; + enabled: boolean; roles: any[]; }; @@ -80,11 +79,11 @@ export class InformationTabComponent implements OnDestroy, OnInit, OnChanges { ) { this.form = this.formBuilder.group({ name: [null, Validators.required], - identifier: [{value: null, disabled : true}, Validators.required], + identifier: [{ value: null, disabled: true }, Validators.required], description: [null, Validators.required], enabled: false, level: [null, buildValidators(this.authService.user)], - roles : [] + roles: [], }); this.updateFormSub = this.form.valueChanges @@ -92,10 +91,10 @@ export class InformationTabComponent implements OnDestroy, OnInit, OnChanges { map(() => diff(this.form.value, this.previousValue)), filter((formData) => !isEmpty(formData)), map((formData) => this.completeRoles(formData)), - map((formData) => extend({ id: this.profile.id , customerId: this.profile.customerId, - tenantIdentifier: this.profile.tenantIdentifier}, - formData)), - switchMap((formData) => this.rngProfileService.patch(formData).pipe(catchError(() => of(null)))) + map((formData) => + extend({ id: this.profile.id, customerId: this.profile.customerId, tenantIdentifier: this.profile.tenantIdentifier }, formData), + ), + switchMap((formData) => this.rngProfileService.patch(formData).pipe(catchError(() => of(null)))), ) .subscribe((profile) => { this.resetForm(this.form, profile, this.readOnly); @@ -107,18 +106,15 @@ export class InformationTabComponent implements OnDestroy, OnInit, OnChanges { } private completeRoles(data: { [key: string]: any }): { [key: string]: any } { - const updatedData = this.completeUpdateRoles(data); - return this.completeCreateRoles(updatedData); + const updatedData = this.completeUpdateRoles(data); + return this.completeCreateRoles(updatedData); } private completeUpdateRoles(data: { [key: string]: any }): { [key: string]: any } { // add ROLE_UPDATE_USERS when an user can update standard informations or MFA data // remove ROLE_UPDATE_USERS when an user can't update standard informations and MFA data if (data.roles) { - const userUpdateRolesNames = [ - Role.ROLE_MFA_USERS.toString(), - Role.ROLE_UPDATE_STANDARD_USERS.toString(), - ]; + const userUpdateRolesNames = [Role.ROLE_MFA_USERS.toString(), Role.ROLE_UPDATE_STANDARD_USERS.toString()]; const hasUpdateRole = data.roles.some((r: any) => userUpdateRolesNames.includes(r.name)); const roleUpdateUsersIndex = data.roles.findIndex((role: any) => role.name === Role.ROLE_UPDATE_USERS); @@ -148,9 +144,7 @@ export class InformationTabComponent implements OnDestroy, OnInit, OnChanges { private completeCreateRoles(data: { [key: string]: any }): { [key: string]: any } { if (data.roles) { - const useCreateRolesNames = [ - Role.ROLE_CREATE_USERS.toString(), - ]; + const useCreateRolesNames = [Role.ROLE_CREATE_USERS.toString()]; const hasUserCreateRole = data.roles.some((r: any) => useCreateRolesNames.includes(r.name)); const userCreateInfoRoleIndex = data.roles.findIndex((role: any) => role.name === Role.ROLE_CREATE_USER_INFOS); @@ -173,8 +167,8 @@ export class InformationTabComponent implements OnDestroy, OnInit, OnChanges { ngOnChanges(changes: SimpleChanges) { if (changes.hasOwnProperty('profile') || changes.hasOwnProperty('readOnly')) { if (this.profile) { - this.resetForm(this.form, this.profile, this.readOnly); - this.previousValue = this.form.value; + this.resetForm(this.form, this.profile, this.readOnly); + this.previousValue = this.form.value; } } } @@ -187,8 +181,11 @@ export class InformationTabComponent implements OnDestroy, OnInit, OnChanges { } private initFormValidators(form: FormGroup, profile: Profile) { - form.get('name').setAsyncValidators(this.profileValidators - .nameExists(profile.tenantIdentifier, profile.level, profile.applicationName, profile.name)); + form + .get('name') + .setAsyncValidators( + this.profileValidators.nameExists(profile.tenantIdentifier, profile.level, profile.applicationName, profile.name), + ); } private initCustomFormActivationState(form: FormGroup, profile: Profile, readOnly: boolean) { @@ -197,8 +194,8 @@ export class InformationTabComponent implements OnDestroy, OnInit, OnChanges { form.get('identifier').disable({ emitEvent: false }); if (profile.groupsCount && profile.groupsCount > 0) { - this.form.get('enabled').disable({emitEvent : false}); - this.form.get('level').disable({emitEvent : false}); + this.form.get('enabled').disable({ emitEvent: false }); + this.form.get('level').disable({ emitEvent: false }); } } diff --git a/ui/ui-frontend/projects/identity/src/app/profile/profile-detail/profile-detail.component.html b/ui/ui-frontend/projects/identity/src/app/profile/profile-detail/profile-detail.component.html index 2af9d43a0c2..c005cbd09d7 100644 --- a/ui/ui-frontend/projects/identity/src/app/profile/profile-detail/profile-detail.component.html +++ b/ui/ui-frontend/projects/identity/src/app/profile/profile-detail/profile-detail.component.html @@ -2,7 +2,8 @@ [title]="profile?.name" [icon]="'vitamui-icon-gestion-de-profil'" [badge]="profile?.enabled ? 'green' : 'grey'" - (onclose)="emitClose()"> + (onclose)="emitClose()" +>
      @@ -10,10 +11,14 @@ - + - + -
      \ No newline at end of file +
      diff --git a/ui/ui-frontend/projects/identity/src/app/profile/profile-detail/profile-detail.component.spec.ts b/ui/ui-frontend/projects/identity/src/app/profile/profile-detail/profile-detail.component.spec.ts index 1746bc56cbb..d64df7f377e 100644 --- a/ui/ui-frontend/projects/identity/src/app/profile/profile-detail/profile-detail.component.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/profile/profile-detail/profile-detail.component.spec.ts @@ -58,7 +58,7 @@ class InformationTabStubComponent { @Input() readOnly: boolean; } -@Component({ selector: 'app-profile-group-tab', template: ''}) +@Component({ selector: 'app-profile-group-tab', template: '' }) class ProfileGroupTabStubComponent { @Input() profile: Profile; @Input() readOnly: boolean; @@ -81,14 +81,14 @@ class TestHostComponent { describe('ProfileDetailComponent', () => { let testhost: TestHostComponent; let fixture: ComponentFixture; - const authServiceMock = { user : { level: ''}}; + const authServiceMock = { user: { level: '' } }; const expectedProfile = { id: '42', name: 'Profile Name', description: 'description', - level : '', - groupsCount : 0, + level: '', + groupsCount: 0, applicationName: 'USERS_APP', enabled: true, usersCount: 0, @@ -105,22 +105,20 @@ describe('ProfileDetailComponent', () => { street: 'rue des bois', zipCode: '75019', city: 'Paris', - country: 'FRANCE' + country: 'FRANCE', }, customerId: 'customer_id', - readonly : false + readonly: false, }, ownerId: 'owner_id', customerId: 'customer_id', enabled: true, proof: false, - readonly : false + readonly: false, }, tenantIdentifier: '42', - roles: [ - 'role_name', - ], - readonly : false + roles: ['role_name'], + readonly: false, }; beforeEach(waitForAsync(() => { @@ -131,7 +129,7 @@ describe('ProfileDetailComponent', () => { NoopAnimationsModule, HttpClientTestingModule, LoggerModule.forRoot(), - VitamUICommonTestModule + VitamUICommonTestModule, ], declarations: [ TestHostComponent, @@ -143,15 +141,14 @@ describe('ProfileDetailComponent', () => { providers: [ { provide: ActivatedRoute, useValue: { data: of({ isPopup: true, profile: expectedProfile }) } }, { provide: ProfileService, useValue: { updated: new Subject() } }, - { provide: AuthService, useValue: authServiceMock}, + { provide: AuthService, useValue: authServiceMock }, { provide: WINDOW_LOCATION, useValue: {} }, { provide: BASE_URL, useValue: '/fake-api' }, { provide: ENVIRONMENT, useValue: environment }, - { provide: TranslateService, useValue: { instant: () => EMPTY } } + { provide: TranslateService, useValue: { instant: () => EMPTY } }, ], - schemas: [NO_ERRORS_SCHEMA] - }) - .compileComponents(); + schemas: [NO_ERRORS_SCHEMA], + }).compileComponents(); })); beforeEach(() => { @@ -166,18 +163,14 @@ describe('ProfileDetailComponent', () => { }); describe('DOM', () => { - it('should have a header', () => { const elTitle = fixture.nativeElement.querySelector('vitamui-common-sidenav-header'); expect(elTitle).toBeTruthy(); }); it('should have a mat-tab-group', () => { - const elTabGroup = fixture.nativeElement - .querySelector('.mat-tab-group'); + const elTabGroup = fixture.nativeElement.querySelector('.mat-tab-group'); expect(elTabGroup).toBeTruthy(); }); - }); - }); diff --git a/ui/ui-frontend/projects/identity/src/app/profile/profile-detail/profile-detail.component.ts b/ui/ui-frontend/projects/identity/src/app/profile/profile-detail/profile-detail.component.ts index 02f1479e47b..5326cfbaaa4 100644 --- a/ui/ui-frontend/projects/identity/src/app/profile/profile-detail/profile-detail.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/profile/profile-detail/profile-detail.component.ts @@ -57,7 +57,11 @@ export class ProfileDetailComponent implements OnInit, OnDestroy { profileUpdateSub: Subscription; - constructor(private rngProfileService: ProfileService, private authService: AuthService, private startupService: StartupService) {} + constructor( + private rngProfileService: ProfileService, + private authService: AuthService, + private startupService: StartupService, + ) {} ngOnInit(): void { this.profileUpdateSub = this.rngProfileService.updated.subscribe((updatedProfile) => { @@ -73,7 +77,7 @@ export class ProfileDetailComponent implements OnInit, OnDestroy { window.open( this.startupService.getConfigStringValue('UI_URL') + '/profile/' + this.profile.id, 'detailPopup', - 'width=584, height=713, resizable=no, location=no' + 'width=584, height=713, resizable=no, location=no', ); this.emitClose(); } diff --git a/ui/ui-frontend/projects/identity/src/app/profile/profile-detail/profile-detail.module.ts b/ui/ui-frontend/projects/identity/src/app/profile/profile-detail/profile-detail.module.ts index 56425744f47..5ba2aaae721 100644 --- a/ui/ui-frontend/projects/identity/src/app/profile/profile-detail/profile-detail.module.ts +++ b/ui/ui-frontend/projects/identity/src/app/profile/profile-detail/profile-detail.module.ts @@ -61,6 +61,6 @@ import { ProfilePopupComponent } from './profile-popup.component'; ], declarations: [ProfilePopupComponent, ProfileDetailComponent, InformationTabComponent], exports: [ProfileDetailComponent], - providers: [ProfileValidators] + providers: [ProfileValidators], }) -export class ProfileDetailModule { } +export class ProfileDetailModule {} diff --git a/ui/ui-frontend/projects/identity/src/app/profile/profile-detail/profile-popup.component.ts b/ui/ui-frontend/projects/identity/src/app/profile/profile-detail/profile-popup.component.ts index 0c86e1178f0..42daaf038e0 100644 --- a/ui/ui-frontend/projects/identity/src/app/profile/profile-detail/profile-popup.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/profile/profile-detail/profile-popup.component.ts @@ -41,21 +41,18 @@ import { Profile } from 'ui-frontend-common'; @Component({ selector: 'app-profile-popup', - template: '' + template: '', }) export class ProfilePopupComponent implements OnInit { - profile: Profile; constructor(private route: ActivatedRoute) { this.profile = this.route.snapshot.data.profile; } - ngOnInit() { - } + ngOnInit() {} closePopup() { window.close(); } - } diff --git a/ui/ui-frontend/projects/identity/src/app/profile/profile-list/profile-list.component.html b/ui/ui-frontend/projects/identity/src/app/profile/profile-list/profile-list.component.html index 26825016d9e..1e840362cf8 100644 --- a/ui/ui-frontend/projects/identity/src/app/profile/profile-list/profile-list.component.html +++ b/ui/ui-frontend/projects/identity/src/app/profile/profile-list/profile-list.component.html @@ -2,24 +2,25 @@
      -
      {{'USER_PROFILE.HOME.RESULTS_TABLE.NAME' | translate}}
      -
      {{'COMMON.ID' | translate}}
      -
      {{'USER_PROFILE.HOME.RESULTS_TABLE.DESCRIPTION' | translate}}
      -
      {{'USER_PROFILE.HOME.RESULTS_TABLE.LEVEL' | translate}}
      -
      {{'USER_PROFILE.HOME.RESULTS_TABLE.USERS_NUMBER' | translate}}
      +
      {{ 'USER_PROFILE.HOME.RESULTS_TABLE.NAME' | translate }}
      +
      {{ 'COMMON.ID' | translate }}
      +
      {{ 'USER_PROFILE.HOME.RESULTS_TABLE.DESCRIPTION' | translate }}
      +
      {{ 'USER_PROFILE.HOME.RESULTS_TABLE.LEVEL' | translate }}
      +
      {{ 'USER_PROFILE.HOME.RESULTS_TABLE.USERS_NUMBER' | translate }}
      -
      {{ profile.name }}
      {{ profile.identifier }}
      -
      {{ profile.description | truncate:50 }}
      +
      {{ profile.description | truncate: 50 }}
      {{ profile.level }}
      {{ profile.usersCount }}
      @@ -27,18 +28,18 @@
      -
      -
      -
      +
      +
      +
      -
      {{'COMMON.NO_RESULT' | translate}}
      -
      +
      {{ 'COMMON.NO_RESULT' | translate }}
      + - +
      - A{{'COMMON.SHOW_MORE_RESULTS' | translate}} + A{{ 'COMMON.SHOW_MORE_RESULTS' | translate }}
      diff --git a/ui/ui-frontend/projects/identity/src/app/profile/profile-list/profile-list.component.ts b/ui/ui-frontend/projects/identity/src/app/profile/profile-list/profile-list.component.ts index ab79d525920..d268b682f67 100644 --- a/ui/ui-frontend/projects/identity/src/app/profile/profile-list/profile-list.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/profile/profile-list/profile-list.component.ts @@ -47,7 +47,7 @@ import { Operators, PageRequest, Profile, - SearchQuery + SearchQuery, } from 'ui-frontend-common'; import { ProfileService } from '../profile.service'; @@ -56,10 +56,9 @@ const FILTER_DEBOUNCE_TIME_MS = 400; @Component({ selector: 'app-profile-list', templateUrl: './profile-list.component.html', - styleUrls: ['./profile-list.component.scss'] + styleUrls: ['./profile-list.component.scss'], }) export class ProfileListComponent extends InfiniteScrollTable implements OnDestroy, OnInit { - @Input('search') set searchText(searchText: string) { this._searchText = searchText; @@ -106,11 +105,10 @@ export class ProfileListComponent extends InfiniteScrollTable implement } ngOnInit() { - const searchCriteriaChange = merge(this.searchChange, this.filterChange, this.orderChange) - .pipe( - startWith(null), - debounceTime(FILTER_DEBOUNCE_TIME_MS) - ); + const searchCriteriaChange = merge(this.searchChange, this.filterChange, this.orderChange).pipe( + startWith(null), + debounceTime(FILTER_DEBOUNCE_TIME_MS), + ); searchCriteriaChange.subscribe(() => this.search()); } @@ -122,14 +120,10 @@ export class ProfileListComponent extends InfiniteScrollTable implement search() { const defaultCriterion: Criterion = { key: 'applicationName', value: ApplicationId.USERS_APP, operator: Operators.equals }; const query: SearchQuery = { - criteria: [ - defaultCriterion, - ...buildCriteriaFromSearch(this._searchText, this.searchKeys), - ] + criteria: [defaultCriterion, ...buildCriteriaFromSearch(this._searchText, this.searchKeys)], }; const pageRequest = new PageRequest(0, DEFAULT_PAGE_SIZE, this.orderBy, this.direction, JSON.stringify(query)); super.search(pageRequest); } - } diff --git a/ui/ui-frontend/projects/identity/src/app/profile/profile-list/profile-list.module.ts b/ui/ui-frontend/projects/identity/src/app/profile/profile-list/profile-list.module.ts index 4632ab0ff2f..73c6cfb4b7a 100644 --- a/ui/ui-frontend/projects/identity/src/app/profile/profile-list/profile-list.module.ts +++ b/ui/ui-frontend/projects/identity/src/app/profile/profile-list/profile-list.module.ts @@ -43,13 +43,8 @@ import { SharedModule } from '../../shared/shared.module'; import { ProfileListComponent } from './profile-list.component'; @NgModule({ - imports: [ - CommonModule, - SharedModule, - MatProgressSpinnerModule, - VitamUICommonModule - ], + imports: [CommonModule, SharedModule, MatProgressSpinnerModule, VitamUICommonModule], declarations: [ProfileListComponent], - exports: [ProfileListComponent] + exports: [ProfileListComponent], }) -export class ProfileListModule { } +export class ProfileListModule {} diff --git a/ui/ui-frontend/projects/identity/src/app/profile/profile-resolver.service.spec.ts b/ui/ui-frontend/projects/identity/src/app/profile/profile-resolver.service.spec.ts index d381b8d85df..e194ec3ca68 100644 --- a/ui/ui-frontend/projects/identity/src/app/profile/profile-resolver.service.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/profile/profile-resolver.service.spec.ts @@ -35,7 +35,6 @@ * knowledge of the CeCILL-C license and that you accept its terms. */ - import { inject, TestBed } from '@angular/core/testing'; import { ActivatedRouteSnapshot, Router } from '@angular/router'; import { of } from 'rxjs'; @@ -48,17 +47,17 @@ const expectedProfile: Profile = { id: '42', name: 'Profile Name', description: 'Profile Description', - level : '', - customerId : 'customerId', - groupsCount : 1, + level: '', + customerId: 'customerId', + groupsCount: 1, applicationName: 'USERS_APP', enabled: true, usersCount: 0, tenantName: 'Nom du tenant', tenantIdentifier: 420, roles: [], - readonly : false, - externalParamId : null + readonly: false, + externalParamId: null, }; describe('ProfileResolver', () => { @@ -69,11 +68,7 @@ describe('ProfileResolver', () => { const routerSpy = jasmine.createSpyObj('Router', ['navigate']); TestBed.configureTestingModule({ - providers: [ - ProfileResolver, - { provide: ProfileService, useValue: profileServiceSpy }, - { provide: Router, useValue: routerSpy }, - ] + providers: [ProfileResolver, { provide: ProfileService, useValue: profileServiceSpy }, { provide: Router, useValue: routerSpy }], }); profileResolver = TestBed.inject(ProfileResolver); diff --git a/ui/ui-frontend/projects/identity/src/app/profile/profile-resolver.service.ts b/ui/ui-frontend/projects/identity/src/app/profile/profile-resolver.service.ts index 4d965bcf7f9..52fb1f00865 100644 --- a/ui/ui-frontend/projects/identity/src/app/profile/profile-resolver.service.ts +++ b/ui/ui-frontend/projects/identity/src/app/profile/profile-resolver.service.ts @@ -43,28 +43,28 @@ import { Profile } from 'ui-frontend-common'; import { ProfileService } from './profile.service'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) -export class ProfileResolver implements Resolve { - - constructor(private rngProfileService: ProfileService, private router: Router) { } +export class ProfileResolver implements Resolve { + constructor( + private rngProfileService: ProfileService, + private router: Router, + ) {} resolve(route: ActivatedRouteSnapshot): Observable { const id = route.paramMap.get('id'); - return this.rngProfileService.get(id) - .pipe( - take(1), - map((profile: Profile) => { - if (profile) { - return profile; - } else { - this.router.navigate(['/']); + return this.rngProfileService.get(id).pipe( + take(1), + map((profile: Profile) => { + if (profile) { + return profile; + } else { + this.router.navigate(['/']); - return null; - } - }) - ); + return null; + } + }), + ); } - } diff --git a/ui/ui-frontend/projects/identity/src/app/profile/profile-routing.module.ts b/ui/ui-frontend/projects/identity/src/app/profile/profile-routing.module.ts index fa35ef51760..08395b4ef1c 100644 --- a/ui/ui-frontend/projects/identity/src/app/profile/profile-routing.module.ts +++ b/ui/ui-frontend/projects/identity/src/app/profile/profile-routing.module.ts @@ -41,31 +41,23 @@ import { ProfilePopupComponent } from './profile-detail/profile-popup.component' import { ProfileResolver } from './profile-resolver.service'; import { ProfileComponent } from './profile.component'; - const routes: Route[] = [ { path: '', component: ProfileComponent, - pathMatch: 'full' - + pathMatch: 'full', }, { path: ':id', component: ProfilePopupComponent, resolve: { profile: ProfileResolver }, - data: { isPopup: true, appId: 'PROFILES_APP' } - } + data: { isPopup: true, appId: 'PROFILES_APP' }, + }, ]; - @NgModule({ declarations: [], - imports: [ - CommonModule, - RouterModule.forChild(routes) - ], - exports: [ - RouterModule - ] + imports: [CommonModule, RouterModule.forChild(routes)], + exports: [RouterModule], }) -export class ProfileRoutingModule { } +export class ProfileRoutingModule {} diff --git a/ui/ui-frontend/projects/identity/src/app/profile/profile.component.html b/ui/ui-frontend/projects/identity/src/app/profile/profile.component.html index 10c7ee30150..aebccc32ae7 100644 --- a/ui/ui-frontend/projects/identity/src/app/profile/profile.component.html +++ b/ui/ui-frontend/projects/identity/src/app/profile/profile.component.html @@ -6,16 +6,15 @@
      - {{'USER_PROFILE.HOME.TITLE' | translate}} + {{ 'USER_PROFILE.HOME.TITLE' | translate }} - + - -
      + +
      diff --git a/ui/ui-frontend/projects/identity/src/app/profile/profile.component.ts b/ui/ui-frontend/projects/identity/src/app/profile/profile.component.ts index e25276882b0..cdc7f6fa6d1 100644 --- a/ui/ui-frontend/projects/identity/src/app/profile/profile.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/profile/profile.component.ts @@ -46,22 +46,27 @@ import { ProfileListComponent } from './profile-list/profile-list.component'; @Component({ selector: 'app-profile', templateUrl: './profile.component.html', - styleUrls: ['./profile.component.scss'] + styleUrls: ['./profile.component.scss'], }) export class ProfileComponent extends SidenavPage { - public search: string; @ViewChild(ProfileListComponent, { static: true }) profileListComponent: ProfileListComponent; - constructor(public dialog: MatDialog, public route: ActivatedRoute, public globalEventService: GlobalEventService) { + constructor( + public dialog: MatDialog, + public route: ActivatedRoute, + public globalEventService: GlobalEventService, + ) { super(route, globalEventService); } openProfilAdminCreateDialog() { const dialogRef = this.dialog.open(ProfileCreateComponent, { panelClass: 'vitamui-modal', disableClose: true }); dialogRef.afterClosed().subscribe((result) => { - if (result) { this.refreshList(); } + if (result) { + this.refreshList(); + } }); } @@ -70,9 +75,10 @@ export class ProfileComponent extends SidenavPage { } private refreshList() { - if (!this.profileListComponent) { return; } + if (!this.profileListComponent) { + return; + } this.profileListComponent.search(); } - } diff --git a/ui/ui-frontend/projects/identity/src/app/profile/profile.module.ts b/ui/ui-frontend/projects/identity/src/app/profile/profile.module.ts index 5e92d7dcd94..19b287e740e 100644 --- a/ui/ui-frontend/projects/identity/src/app/profile/profile.module.ts +++ b/ui/ui-frontend/projects/identity/src/app/profile/profile.module.ts @@ -73,9 +73,6 @@ import { ProfileService } from './profile.service'; ProfileRoutingModule, ], declarations: [ProfileComponent], - providers: [ - ProfileResolver, - ProfileService, - ] + providers: [ProfileResolver, ProfileService], }) -export class ProfileModule { } +export class ProfileModule {} diff --git a/ui/ui-frontend/projects/identity/src/app/profile/profile.service.spec.ts b/ui/ui-frontend/projects/identity/src/app/profile/profile.service.spec.ts index 5eb9c95f958..d9165f7b446 100644 --- a/ui/ui-frontend/projects/identity/src/app/profile/profile.service.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/profile/profile.service.spec.ts @@ -50,11 +50,7 @@ describe('ProfileService', () => { TestBed.configureTestingModule({ imports: [HttpClientTestingModule], - providers: [ - ProfileService, - { provide: VitamUISnackBarService, useValue: snackBarSpy }, - { provide: BASE_URL, useValue: '/fake-api' }, - ] + providers: [ProfileService, { provide: VitamUISnackBarService, useValue: snackBarSpy }, { provide: BASE_URL, useValue: '/fake-api' }], }); httpTestingController = TestBed.inject(HttpTestingController as Type); @@ -68,20 +64,20 @@ describe('ProfileService', () => { describe('get', () => { it('should call /fake-api/profiles/42', () => { const expectedProfile: Profile = { - id: '42', - name: 'Profile Name', - description: 'Profile Description', - applicationName: 'USERS_APP', - level : '', - customerId: 'customerId', - groupsCount : 1, - enabled: true, - usersCount: 0, - tenantName: 'tenant name', - tenantIdentifier: 420, - roles: [], - readonly : false, - externalParamId : null + id: '42', + name: 'Profile Name', + description: 'Profile Description', + applicationName: 'USERS_APP', + level: '', + customerId: 'customerId', + groupsCount: 1, + enabled: true, + usersCount: 0, + tenantName: 'tenant name', + tenantIdentifier: 420, + roles: [], + readonly: false, + externalParamId: null, }; rngProfileService.get('42').subscribe((profile) => expect(profile).toEqual(expectedProfile), fail); const req = httpTestingController.expectOne('/fake-api/profiles/42?embedded=ALL'); @@ -98,35 +94,32 @@ describe('ProfileService', () => { name: 'Profile Group Name', }; const expectedResponse: Profile = { - id: '42', - name: 'Profile Group Name', - description: 'Profile Group Description', - level : '', - customerId: 'customerId', - groupsCount : 1, - applicationName: 'USERS_APP', - enabled: true, - usersCount: 42, - tenantName: 'tenant name', - tenantIdentifier: 420, - roles: [], - readonly : false, - externalParamId : null + id: '42', + name: 'Profile Group Name', + description: 'Profile Group Description', + level: '', + customerId: 'customerId', + groupsCount: 1, + applicationName: 'USERS_APP', + enabled: true, + usersCount: 42, + tenantName: 'tenant name', + tenantIdentifier: 420, + roles: [], + readonly: false, + externalParamId: null, }; rngProfileService.updated.subscribe((profileGroup) => expect(profileGroup).toEqual(expectedResponse), fail); - rngProfileService.patch(expectedRequest).subscribe( - (profileGroup) => { - expect(profileGroup).toEqual(expectedResponse); - expect(snackBar.open).toHaveBeenCalledWith({ - message: 'SHARED.SNACKBAR.PROFILE_UPDATE', - translateParams:{ - param1: expectedResponse.name, - }, - icon: 'vitamui-icon-admin-key' - }); - }, - fail - ); + rngProfileService.patch(expectedRequest).subscribe((profileGroup) => { + expect(profileGroup).toEqual(expectedResponse); + expect(snackBar.open).toHaveBeenCalledWith({ + message: 'SHARED.SNACKBAR.PROFILE_UPDATE', + translateParams: { + param1: expectedResponse.name, + }, + icon: 'vitamui-icon-admin-key', + }); + }, fail); const req = httpTestingController.expectOne('/fake-api/profiles/42'); expect(req.request.method).toEqual('PATCH'); expect(req.request.body).toEqual(expectedRequest); @@ -139,16 +132,13 @@ describe('ProfileService', () => { id: '42', name: 'Profile Group Name', }; - rngProfileService.patch(expectedRequest).subscribe( - fail, - () => { - expect(snackBar.open).toHaveBeenCalledTimes(1); - expect(snackBar.open).toHaveBeenCalledWith({message: 'Expected message', translate: false}); - } - ); + rngProfileService.patch(expectedRequest).subscribe(fail, () => { + expect(snackBar.open).toHaveBeenCalledTimes(1); + expect(snackBar.open).toHaveBeenCalledWith({ message: 'Expected message', translate: false }); + }); const req = httpTestingController.expectOne('/fake-api/profiles/42'); expect(req.request.method).toEqual('PATCH'); - req.flush({ message: 'Expected message' }, {status: 400, statusText: 'Bad request'}); + req.flush({ message: 'Expected message' }, { status: 400, statusText: 'Bad request' }); }); }); }); diff --git a/ui/ui-frontend/projects/identity/src/app/profile/profile.service.ts b/ui/ui-frontend/projects/identity/src/app/profile/profile.service.ts index 466bbdfe09c..ff52e586331 100644 --- a/ui/ui-frontend/projects/identity/src/app/profile/profile.service.ts +++ b/ui/ui-frontend/projects/identity/src/app/profile/profile.service.ts @@ -37,20 +37,31 @@ import { Observable, Subject } from 'rxjs'; import { tap } from 'rxjs/operators'; import { - AdminUserProfile, Criterion, Operators, Profile, ProfileApiService, Role, SearchQuery, SearchService, VitamUISnackBarService + AdminUserProfile, + Criterion, + Operators, + Profile, + ProfileApiService, + Role, + SearchQuery, + SearchService, + VitamUISnackBarService, } from 'ui-frontend-common'; import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class ProfileService extends SearchService { - updated = new Subject(); - constructor(private profileApi: ProfileApiService, private snackBarService: VitamUISnackBarService, http: HttpClient) { + constructor( + private profileApi: ProfileApiService, + private snackBarService: VitamUISnackBarService, + http: HttpClient, + ) { super(http, profileApi, 'ALL'); } @@ -63,53 +74,51 @@ export class ProfileService extends SearchService { const criterionName: Criterion = { key: 'name', value: name, operator: Operators.equalsIgnoreCase }; const criterionTenantIdentifier: Criterion = { key: 'tenantIdentifier', value: tenantIdentifier, operator: Operators.equals }; const criterionLevel: Criterion = { key: 'level', value: level, operator: Operators.equals }; - const criterionApplicationName: Criterion = { key: 'applicationName', value: applicationName, operator: Operators.equals}; + const criterionApplicationName: Criterion = { key: 'applicationName', value: applicationName, operator: Operators.equals }; criterionArray.push(criterionName, criterionTenantIdentifier, criterionLevel, criterionApplicationName); const query: SearchQuery = { criteria: criterionArray }; - const params = [{key : 'criteria', value: JSON.stringify(query)}]; + const params = [{ key: 'criteria', value: JSON.stringify(query) }]; return this.profileApi.checkExistsByParam(params, this.headers); } - patch(data: { id: string, [key: string]: any }): Observable { - return this.profileApi.patch(data) - .pipe( - tap((response) => this.updated.next(response)), - tap( - (response) => { - this.snackBarService.open({ - message: 'SHARED.SNACKBAR.PROFILE_UPDATE', - translateParams:{ - param1: response.name, - }, - icon: 'vitamui-icon-admin-key' - }); - }, - (error) => { - this.snackBarService.open({ message: error.error.message, translate: false }); - } - ) - ); + patch(data: { id: string; [key: string]: any }): Observable { + return this.profileApi.patch(data).pipe( + tap((response) => this.updated.next(response)), + tap( + (response) => { + this.snackBarService.open({ + message: 'SHARED.SNACKBAR.PROFILE_UPDATE', + translateParams: { + param1: response.name, + }, + icon: 'vitamui-icon-admin-key', + }); + }, + (error) => { + this.snackBarService.open({ message: error.error.message, translate: false }); + }, + ), + ); } create(profile: Profile) { - return this.profileApi.create(profile) - .pipe( - tap( - (response: Profile) => { - this.snackBarService.open({ - message: 'SHARED.SNACKBAR.PROFILE_CREATE', - translateParams:{ - param1: response.name, - } - }); - }, - (error) => { - this.snackBarService.open({ message: error.error.message, translate: false }); - } - ) - ); + return this.profileApi.create(profile).pipe( + tap( + (response: Profile) => { + this.snackBarService.open({ + message: 'SHARED.SNACKBAR.PROFILE_CREATE', + translateParams: { + param1: response.name, + }, + }); + }, + (error) => { + this.snackBarService.open({ message: error.error.message, translate: false }); + }, + ), + ); } /** @@ -117,8 +126,7 @@ export class ProfileService extends SearchService { * @param roles List of roles. * @returns The list of linked roles. */ - convertToAdminUserProfile(roles: Array<{ name: string; }>): AdminUserProfile { - + convertToAdminUserProfile(roles: Array<{ name: string }>): AdminUserProfile { const adminUserProfile: AdminUserProfile = { multifactorAllowed: false, createUser: false, @@ -148,7 +156,7 @@ export class ProfileService extends SearchService { return adminUserProfile; } - private hasRole(roles: Array<{ name: string; }>, role: Role): boolean { + private hasRole(roles: Array<{ name: string }>, role: Role): boolean { return roles.some((element) => element.name === role); } } diff --git a/ui/ui-frontend/projects/identity/src/app/profile/profile.validators.spec.ts b/ui/ui-frontend/projects/identity/src/app/profile/profile.validators.spec.ts index ba3e0aea1a5..98d557302e8 100644 --- a/ui/ui-frontend/projects/identity/src/app/profile/profile.validators.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/profile/profile.validators.spec.ts @@ -44,7 +44,7 @@ import { ProfileValidators } from './profile.validators'; function toObservable(r: any): Observable { const obs = isPromise(r) ? from(r) : r; - if (!(isObservable(obs))) { + if (!isObservable(obs)) { throw new Error(`Expected validator to return Promise or Observable.`); } @@ -52,7 +52,6 @@ function toObservable(r: any): Observable { } describe('ProfileValidators', () => { - it('should return null', fakeAsync(() => { const profileServiceSpy = jasmine.createSpyObj('ProfileService', ['exists']); profileServiceSpy.exists.and.returnValue(of(false)); @@ -96,5 +95,4 @@ describe('ProfileValidators', () => { tick(400); expect(profileServiceSpy.exists).toHaveBeenCalledWith(42, 'TEST', 'USERS_APP', '111111'); })); - }); diff --git a/ui/ui-frontend/projects/identity/src/app/profile/profile.validators.ts b/ui/ui-frontend/projects/identity/src/app/profile/profile.validators.ts index c91c8d6ffd4..504139fb333 100644 --- a/ui/ui-frontend/projects/identity/src/app/profile/profile.validators.ts +++ b/ui/ui-frontend/projects/identity/src/app/profile/profile.validators.ts @@ -43,19 +43,21 @@ import { ProfileService } from './profile.service'; @Injectable() export class ProfileValidators { + private debounceTime = 400; - private debounceTime = 400; - - constructor(private rngProfileService: ProfileService) {} - - nameExists = (tenantIdentifier: number, level: string, applicationName: string, nameToIgnore?: string): AsyncValidatorFn => { - return (control: AbstractControl) => { - return timer(this.debounceTime).pipe( - switchMap(() => control.value !== nameToIgnore ? this.rngProfileService.exists(tenantIdentifier, level, applicationName, control.value) : of(false)), - take(1), - map((exists: boolean) => exists ? { nameExists: true } : null) - ); - }; - } + constructor(private rngProfileService: ProfileService) {} + nameExists = (tenantIdentifier: number, level: string, applicationName: string, nameToIgnore?: string): AsyncValidatorFn => { + return (control: AbstractControl) => { + return timer(this.debounceTime).pipe( + switchMap(() => + control.value !== nameToIgnore + ? this.rngProfileService.exists(tenantIdentifier, level, applicationName, control.value) + : of(false), + ), + take(1), + map((exists: boolean) => (exists ? { nameExists: true } : null)), + ); + }; + }; } diff --git a/ui/ui-frontend/projects/identity/src/app/shared/custom-params/custom-params.component.scss b/ui/ui-frontend/projects/identity/src/app/shared/custom-params/custom-params.component.scss index 901d34d423c..35961f3a2ce 100644 --- a/ui/ui-frontend/projects/identity/src/app/shared/custom-params/custom-params.component.scss +++ b/ui/ui-frontend/projects/identity/src/app/shared/custom-params/custom-params.component.scss @@ -1,66 +1,66 @@ $anim-timing: 150ms ease-out; :host { - width: 100%; - display: block; + width: 100%; + display: block; } mat-chip i, mat-chip span { - vertical-align: middle; + vertical-align: middle; } .list-input-control { - // margin-bottom: 20px; - display: flex; - align-items: center; - justify-content: stretch; + // margin-bottom: 20px; + display: flex; + align-items: center; + justify-content: stretch; - .list-input-wrapper { - position: relative; - margin-right: 15px; - flex-grow: 0.5; + .list-input-wrapper { + position: relative; + margin-right: 15px; + flex-grow: 0.5; - mat-spinner { - position: absolute; - right: 12px; - top: 12px; - } + mat-spinner { + position: absolute; + right: 12px; + top: 12px; } + } } .vitamui-chip-list { - margin-top: 0.5rem; - margin-bottom: 0.5rem; + margin-top: 0.5rem; + margin-bottom: 0.5rem; } :host.list-input-mini { - .list-input-control { - button, input { - height: 34px; - border-radius: 17px; - } - - > span { - font-size: 18px; - } + .list-input-control { + button, + input { + height: 34px; + border-radius: 17px; + } - mat-spinner { - right: 8px; - top: 8px; - } + > span { + font-size: 18px; } - .vitamui-chip-list { - padding-left: 27px; + mat-spinner { + right: 8px; + top: 8px; } + } + .vitamui-chip-list { + padding-left: 27px; + } } .required-marker { - color: red; + color: red; } .vitamui-input { - width: 45% !important; -} \ No newline at end of file + width: 45% !important; +} diff --git a/ui/ui-frontend/projects/identity/src/app/shared/custom-params/custom-params.component.ts b/ui/ui-frontend/projects/identity/src/app/shared/custom-params/custom-params.component.ts index 8949f8e79df..fa821322972 100644 --- a/ui/ui-frontend/projects/identity/src/app/shared/custom-params/custom-params.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/shared/custom-params/custom-params.component.ts @@ -81,10 +81,10 @@ export class CustomParamsComponent implements AfterContentInit, ControlValueAcce } writeValue(values: any) { - if(values!=null && values!= undefined) - Object.keys(values).forEach(key=>{ - this.values.set(key,values[key]); - }) + if (values != null && values != undefined) + Object.keys(values).forEach((key) => { + this.values.set(key, values[key]); + }); } registerOnChange(fn: (_: any) => void) { diff --git a/ui/ui-frontend/projects/identity/src/app/shared/custom-params/custom-params.module.ts b/ui/ui-frontend/projects/identity/src/app/shared/custom-params/custom-params.module.ts index 969cc17c815..d8bd7e31ab0 100644 --- a/ui/ui-frontend/projects/identity/src/app/shared/custom-params/custom-params.module.ts +++ b/ui/ui-frontend/projects/identity/src/app/shared/custom-params/custom-params.module.ts @@ -42,16 +42,9 @@ import { TranslateModule } from '@ngx-translate/core'; import { VitamUICommonModule } from 'ui-frontend-common'; import { CustomParamsComponent } from './custom-params.component'; - @NgModule({ - imports: [ - CommonModule, - ReactiveFormsModule, - MatProgressSpinnerModule, - TranslateModule, - VitamUICommonModule - ], + imports: [CommonModule, ReactiveFormsModule, MatProgressSpinnerModule, TranslateModule, VitamUICommonModule], declarations: [CustomParamsComponent], - exports: [CustomParamsComponent] + exports: [CustomParamsComponent], }) -export class CustomParamsModule { } +export class CustomParamsModule {} diff --git a/ui/ui-frontend/projects/identity/src/app/shared/domains-input/domains-input.component.spec.ts b/ui/ui-frontend/projects/identity/src/app/shared/domains-input/domains-input.component.spec.ts index d33211dbc89..0f8a73911f6 100644 --- a/ui/ui-frontend/projects/identity/src/app/shared/domains-input/domains-input.component.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/shared/domains-input/domains-input.component.spec.ts @@ -35,7 +35,6 @@ * knowledge of the CeCILL-C license and that you accept its terms. */ - import { Component, NO_ERRORS_SCHEMA, ViewChild } from '@angular/core'; import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; @@ -47,7 +46,7 @@ import { input } from 'ui-frontend-common/testing'; import { CustomerCreateValidators } from '../../customer/customer-create/customer-create.validators'; import { DomainsInputComponent } from './domains-input.component'; -@Component({ template: ''}) +@Component({ template: '' }) export class TestHostComponent { @ViewChild(DomainsInputComponent, { static: false }) component: DomainsInputComponent; domains: string[]; @@ -58,27 +57,15 @@ let testhost: TestHostComponent; let fixture: ComponentFixture; describe('DomainsInputComponent', () => { - beforeEach(waitForAsync(() => { - const customerCreateValidatorsSpy = jasmine.createSpyObj( - 'CustomerCreateValidators', - { uniqueDomain: of(null) } - ); + const customerCreateValidatorsSpy = jasmine.createSpyObj('CustomerCreateValidators', { uniqueDomain: of(null) }); TestBed.configureTestingModule({ - imports: [ - FormsModule, - ReactiveFormsModule, - MatProgressSpinnerModule, - TranslateModule.forRoot() - ], - declarations: [ TestHostComponent, DomainsInputComponent ], - providers: [ - { provide: CustomerCreateValidators, useValue: customerCreateValidatorsSpy }, - ], - schemas: [NO_ERRORS_SCHEMA] - }) - .compileComponents(); + imports: [FormsModule, ReactiveFormsModule, MatProgressSpinnerModule, TranslateModule.forRoot()], + declarations: [TestHostComponent, DomainsInputComponent], + providers: [{ provide: CustomerCreateValidators, useValue: customerCreateValidatorsSpy }], + schemas: [NO_ERRORS_SCHEMA], + }).compileComponents(); })); beforeEach(() => { @@ -92,11 +79,7 @@ describe('DomainsInputComponent', () => { }); it('should have a list of domains', waitForAsync(() => { - testhost.domains = [ - 'toto.titi', - 'titi.tutu', - 'tata.tete', - ]; + testhost.domains = ['toto.titi', 'titi.tutu', 'tata.tete']; fixture.detectChanges(); fixture.whenStable().then(() => { fixture.detectChanges(); diff --git a/ui/ui-frontend/projects/identity/src/app/shared/domains-input/domains-input.component.ts b/ui/ui-frontend/projects/identity/src/app/shared/domains-input/domains-input.component.ts index 0fe53294147..0fafcf446f3 100644 --- a/ui/ui-frontend/projects/identity/src/app/shared/domains-input/domains-input.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/shared/domains-input/domains-input.component.ts @@ -35,7 +35,6 @@ * knowledge of the CeCILL-C license and that you accept its terms. */ - import { ENTER } from '@angular/cdk/keycodes'; import { Component, EventEmitter, forwardRef, Input, Output } from '@angular/core'; import { ControlValueAccessor, FormControl, NG_VALUE_ACCESSOR, Validators } from '@angular/forms'; @@ -45,17 +44,16 @@ import { CustomerCreateValidators } from '../../customer/customer-create/custome export const DOMAINS_INPUT_ACCESSOR: any = { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => DomainsInputComponent), - multi: true + multi: true, }; @Component({ selector: 'app-domains-input', templateUrl: './domains-input.component.html', styleUrls: ['./domains-input.component.scss'], - providers: [DOMAINS_INPUT_ACCESSOR] + providers: [DOMAINS_INPUT_ACCESSOR], }) export class DomainsInputComponent implements ControlValueAccessor { - @Input() placeholder: string; @Input() selected: string; @Input() spinnerDiameter = 25; @@ -72,8 +70,8 @@ export class DomainsInputComponent implements ControlValueAccessor { constructor(private customerCreateValidators: CustomerCreateValidators) { this.control = new FormControl( null, - [ Validators.required, Validators.pattern(/^\s*([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}\s*$/) ], - this.customerCreateValidators.uniqueDomain + [Validators.required, Validators.pattern(/^\s*([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}\s*$/)], + this.customerCreateValidators.uniqueDomain, ); } @@ -90,9 +88,13 @@ export class DomainsInputComponent implements ControlValueAccessor { } add(): void { - if (this.control.invalid || this.control.pending) { return; } + if (this.control.invalid || this.control.pending) { + return; + } const domain = this.control.value.trim(); - if (this.domains.includes(domain)) { return; } + if (this.domains.includes(domain)) { + return; + } this.domains.push(domain); this.onChange(this.domains); this.control.reset(); @@ -125,5 +127,4 @@ export class DomainsInputComponent implements ControlValueAccessor { get domainExists(): boolean { return this.domains.includes((this.control.value || '').trim()); } - } diff --git a/ui/ui-frontend/projects/identity/src/app/shared/domains-input/domains-input.module.ts b/ui/ui-frontend/projects/identity/src/app/shared/domains-input/domains-input.module.ts index e55365abf07..3556c1f85a6 100644 --- a/ui/ui-frontend/projects/identity/src/app/shared/domains-input/domains-input.module.ts +++ b/ui/ui-frontend/projects/identity/src/app/shared/domains-input/domains-input.module.ts @@ -43,13 +43,8 @@ import { VitamUICommonModule } from 'ui-frontend-common'; import { DomainsInputComponent } from './domains-input.component'; @NgModule({ - imports: [ - CommonModule, - ReactiveFormsModule, - MatProgressSpinnerModule, - VitamUICommonModule - ], + imports: [CommonModule, ReactiveFormsModule, MatProgressSpinnerModule, VitamUICommonModule], declarations: [DomainsInputComponent], - exports: [DomainsInputComponent] + exports: [DomainsInputComponent], }) -export class DomainsInputModule { } +export class DomainsInputModule {} diff --git a/ui/ui-frontend/projects/identity/src/app/shared/editable-field/editable-custom-params/editable-custom-params.component.html b/ui/ui-frontend/projects/identity/src/app/shared/editable-field/editable-custom-params/editable-custom-params.component.html index bbf033a9d3e..2839d18716c 100644 --- a/ui/ui-frontend/projects/identity/src/app/shared/editable-field/editable-custom-params/editable-custom-params.component.html +++ b/ui/ui-frontend/projects/identity/src/app/shared/editable-field/editable-custom-params/editable-custom-params.component.html @@ -2,9 +2,9 @@
      - + -
      {{ domain.key }} : {{ domain.value }}
      +
      {{ domain.key }} : {{ domain.value }}
      - +
      edit @@ -41,5 +42,4 @@ -
      -
      +
      diff --git a/ui/ui-frontend/projects/identity/src/app/shared/editable-field/editable-domain-input/editable-domain-input.component.html b/ui/ui-frontend/projects/identity/src/app/shared/editable-field/editable-domain-input/editable-domain-input.component.html index 8d574295eae..a2ab3f26b37 100644 --- a/ui/ui-frontend/projects/identity/src/app/shared/editable-field/editable-domain-input/editable-domain-input.component.html +++ b/ui/ui-frontend/projects/identity/src/app/shared/editable-field/editable-domain-input/editable-domain-input.component.html @@ -2,26 +2,27 @@
      - - -
      - {{domain}} {{'SHARED.DOMAIN_INPUT.DEFAULT_DOMAIN' | translate}} -
      -
      -
      - + + +
      + {{ domain }} + {{ 'SHARED.DOMAIN_INPUT.DEFAULT_DOMAIN' | translate }}
      +
      +
      + +
      edit
      - +
      @@ -35,15 +36,17 @@ [cdkConnectedOverlayPositions]="positions" >
      - +
      - +
      - {{domain}} {{'SHARED.DOMAIN_INPUT.DEFAULT_DOMAIN' | translate}} + {{ domain }} {{ 'SHARED.DOMAIN_INPUT.DEFAULT_DOMAIN' | translate }}
      diff --git a/ui/ui-frontend/projects/identity/src/app/shared/editable-field/editable-domain-input/editable-domain-input.component.spec.ts b/ui/ui-frontend/projects/identity/src/app/shared/editable-field/editable-domain-input/editable-domain-input.component.spec.ts index d414403556d..d647b10674f 100644 --- a/ui/ui-frontend/projects/identity/src/app/shared/editable-field/editable-domain-input/editable-domain-input.component.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/shared/editable-field/editable-domain-input/editable-domain-input.component.spec.ts @@ -42,19 +42,19 @@ import { ComponentFixture, inject, TestBed, waitForAsync } from '@angular/core/t import { ControlValueAccessor, FormsModule, NG_VALUE_ACCESSOR, ReactiveFormsModule, Validators } from '@angular/forms'; import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; import { VitamUICommonTestModule } from 'ui-frontend-common/testing'; -import { - CustomerCreateValidators -} from '../../../customer/customer-create/customer-create.validators'; +import { CustomerCreateValidators } from '../../../customer/customer-create/customer-create.validators'; import { EditableDomainInputComponent } from './editable-domain-input.component'; @Component({ selector: 'app-domains-input', template: '', - providers: [{ - provide: NG_VALUE_ACCESSOR, - useExisting: forwardRef(() => DomainInputStubComponent), - multi: true - }] + providers: [ + { + provide: NG_VALUE_ACCESSOR, + useExisting: forwardRef(() => DomainInputStubComponent), + multi: true, + }, + ], }) class DomainInputStubComponent implements ControlValueAccessor { @Input() placeholder: string; @@ -70,7 +70,7 @@ class DomainInputStubComponent implements ControlValueAccessor { @Component({ template: ` - ` + `, }) class TesthostComponent { value: string[]; @@ -86,30 +86,17 @@ describe('EditableDomainInputComponent', () => { let overlayContainerElement: HTMLElement; beforeEach(waitForAsync(() => { - const customerCreateValidatorsSpy = jasmine.createSpyObj( - 'CustomerCreateValidators', - { uniqueCode: () => of(null), uniqueDomain: () => of(null) + const customerCreateValidatorsSpy = jasmine.createSpyObj('CustomerCreateValidators', { + uniqueCode: () => of(null), + uniqueDomain: () => of(null), }); TestBed.configureTestingModule({ - imports: [ - OverlayModule, - FormsModule, - ReactiveFormsModule, - MatProgressSpinnerModule, - VitamUICommonTestModule - ], - declarations: [ - TesthostComponent, - EditableDomainInputComponent, - DomainInputStubComponent - ], - providers: [ - { provide: CustomerCreateValidators, useValue: customerCreateValidatorsSpy } - ], - schemas: [NO_ERRORS_SCHEMA] - }) - .compileComponents(); + imports: [OverlayModule, FormsModule, ReactiveFormsModule, MatProgressSpinnerModule, VitamUICommonTestModule], + declarations: [TesthostComponent, EditableDomainInputComponent, DomainInputStubComponent], + providers: [{ provide: CustomerCreateValidators, useValue: customerCreateValidatorsSpy }], + schemas: [NO_ERRORS_SCHEMA], + }).compileComponents(); inject([OverlayContainer], (oc: OverlayContainer) => { overlayContainerElement = oc.getContainerElement(); @@ -127,7 +114,6 @@ describe('EditableDomainInputComponent', () => { }); describe('DOM', () => { - it('should call enterEditMode() on click', () => { spyOn(testhost.component, 'enterEditMode'); const element = fixture.nativeElement.querySelector('.editable-field'); @@ -146,7 +132,7 @@ describe('EditableDomainInputComponent', () => { fixture.whenStable().then(() => { fixture.detectChanges(); const elDomains = fixture.nativeElement.querySelectorAll( - '.editable-field .editable-field-content .editable-field-text-content > div' + '.editable-field .editable-field-content .editable-field-text-content > div', ); expect(elDomains.length).toBe(3); expect(elDomains[0].textContent).toContain(testhost.value[0]); @@ -162,7 +148,7 @@ describe('EditableDomainInputComponent', () => { fixture.whenStable().then(() => { fixture.detectChanges(); const elDomains = fixture.nativeElement.querySelectorAll( - '.editable-field .editable-field-content .editable-field-text-content > div' + '.editable-field .editable-field-content .editable-field-text-content > div', ); expect(elDomains.length).toBe(4); expect(elDomains[1].textContent).toContain('SHARED.DOMAIN_INPUT.DEFAULT_DOMAIN'); @@ -217,11 +203,9 @@ describe('EditableDomainInputComponent', () => { const elSpinner = fixture.nativeElement.querySelector('.editable-field mat-spinner'); expect(elSpinner).toBeFalsy(); }); - }); describe('Class', () => { - it('should set the control value', waitForAsync(() => { testhost.value = ['test1.com', 'test2.com']; fixture.detectChanges(); @@ -338,6 +322,5 @@ describe('EditableDomainInputComponent', () => { testhost.component.cancel(); expect(testhost.defaultValue).toBe('default.com'); }); - }); }); diff --git a/ui/ui-frontend/projects/identity/src/app/shared/editable-field/editable-domain-input/editable-domain-input.component.ts b/ui/ui-frontend/projects/identity/src/app/shared/editable-field/editable-domain-input/editable-domain-input.component.ts index 9ba5e0a69c7..ecab9bde806 100644 --- a/ui/ui-frontend/projects/identity/src/app/shared/editable-field/editable-domain-input/editable-domain-input.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/shared/editable-field/editable-domain-input/editable-domain-input.component.ts @@ -43,22 +43,23 @@ import { EditableFieldComponent } from 'ui-frontend-common'; export const EDITABLE_DOMAIN_INPUT_VALUE_ACCESSOR: any = { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => EditableDomainInputComponent), - multi: true + multi: true, }; @Component({ selector: 'app-editable-domain-input', templateUrl: './editable-domain-input.component.html', - providers: [EDITABLE_DOMAIN_INPUT_VALUE_ACCESSOR] + providers: [EDITABLE_DOMAIN_INPUT_VALUE_ACCESSOR], }) export class EditableDomainInputComponent extends EditableFieldComponent { - @Input() set defaultDomain(defaultDomain: string) { this._defaultDomain = defaultDomain; this.selected = defaultDomain; } - get defaultDomain(): string { return this._defaultDomain; } + get defaultDomain(): string { + return this._defaultDomain; + } private _defaultDomain: string; @Output() defaultDomainChange = new EventEmitter(); @@ -68,7 +69,7 @@ export class EditableDomainInputComponent extends EditableFieldComponent { private domainInputClicked = false; get canConfirm(): boolean { - return this.editMode && !this.control.pending && this.control.valid && (this.control.dirty || (this.selected !== this.defaultDomain)); + return this.editMode && !this.control.pending && this.control.valid && (this.control.dirty || this.selected !== this.defaultDomain); } constructor(elementRef: ElementRef) { @@ -76,7 +77,9 @@ export class EditableDomainInputComponent extends EditableFieldComponent { } confirm() { - if (!this.canConfirm) { return; } + if (!this.canConfirm) { + return; + } super.confirm(); this.defaultDomain = this.selected; this.defaultDomainChange.emit(this.defaultDomain); @@ -88,7 +91,9 @@ export class EditableDomainInputComponent extends EditableFieldComponent { } onClick(target: HTMLElement) { - if (!this.editMode) { return; } + if (!this.editMode) { + return; + } if (this.domainInputClicked) { this.domainInputClicked = false; @@ -104,5 +109,4 @@ export class EditableDomainInputComponent extends EditableFieldComponent { onDomainInputClick() { this.domainInputClicked = true; } - } diff --git a/ui/ui-frontend/projects/identity/src/app/shared/editable-field/editable-field.module.ts b/ui/ui-frontend/projects/identity/src/app/shared/editable-field/editable-field.module.ts index 179812ad87d..57f9883006f 100644 --- a/ui/ui-frontend/projects/identity/src/app/shared/editable-field/editable-field.module.ts +++ b/ui/ui-frontend/projects/identity/src/app/shared/editable-field/editable-field.module.ts @@ -65,19 +65,9 @@ import { EditablePatternsComponent } from './editable-patterns/editable-patterns LevelInputModule, PatternModule, VitamUICommonModule, - CustomParamsModule + CustomParamsModule, ], - declarations: [ - EditableDomainInputComponent, - EditablePatternsComponent, - EditableKeystoreComponent, - EditableCustomParamsComponent, - ], - exports: [ - EditableDomainInputComponent, - EditablePatternsComponent, - EditableKeystoreComponent, - EditableCustomParamsComponent, - ] + declarations: [EditableDomainInputComponent, EditablePatternsComponent, EditableKeystoreComponent, EditableCustomParamsComponent], + exports: [EditableDomainInputComponent, EditablePatternsComponent, EditableKeystoreComponent, EditableCustomParamsComponent], }) -export class EditableFieldModule { } +export class EditableFieldModule {} diff --git a/ui/ui-frontend/projects/identity/src/app/shared/editable-field/editable-keystore/editable-keystore.component.html b/ui/ui-frontend/projects/identity/src/app/shared/editable-field/editable-keystore/editable-keystore.component.html index 705f3bfd16c..ba2a20fc6ce 100644 --- a/ui/ui-frontend/projects/identity/src/app/shared/editable-field/editable-keystore/editable-keystore.component.html +++ b/ui/ui-frontend/projects/identity/src/app/shared/editable-field/editable-keystore/editable-keystore.component.html @@ -1,32 +1,33 @@ -
      - - {{ originValue?.name }} -
      -
      - - -
      -
      - -
      - {{'SHARED.EDITABLE_FIELD.WRONG_PASSWORD' | translate}} -
      + + {{ originValue?.name }} +
      +
      + + +
      +
      + +
      + {{ + 'SHARED.EDITABLE_FIELD.WRONG_PASSWORD' | translate + }}
      +
      @@ -42,14 +43,15 @@ [cdkConnectedOverlayPositions]="positions" >
      - +
      -
      - +
      {{ originValue?.name }}
      diff --git a/ui/ui-frontend/projects/identity/src/app/shared/editable-field/editable-keystore/editable-keystore.component.scss b/ui/ui-frontend/projects/identity/src/app/shared/editable-field/editable-keystore/editable-keystore.component.scss index e61959f6459..ad2d3937b68 100644 --- a/ui/ui-frontend/projects/identity/src/app/shared/editable-field/editable-keystore/editable-keystore.component.scss +++ b/ui/ui-frontend/projects/identity/src/app/shared/editable-field/editable-keystore/editable-keystore.component.scss @@ -1,17 +1,17 @@ .editable-field-control { - flex-direction: column; + flex-direction: column; } .vitamui-input-file { - margin-top: 5px; - margin-bottom: 10px; + margin-top: 5px; + margin-bottom: 10px; } input.vitamui-input { - width: 100%; - padding: 0px 17px; + width: 100%; + padding: 0px 17px; } .vitamui-input-errors { - padding: 4px 17px; + padding: 4px 17px; } diff --git a/ui/ui-frontend/projects/identity/src/app/shared/editable-field/editable-keystore/editable-keystore.component.spec.ts b/ui/ui-frontend/projects/identity/src/app/shared/editable-field/editable-keystore/editable-keystore.component.spec.ts index 6653c277a5f..f4e7fdcbe8a 100644 --- a/ui/ui-frontend/projects/identity/src/app/shared/editable-field/editable-keystore/editable-keystore.component.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/shared/editable-field/editable-keystore/editable-keystore.component.spec.ts @@ -35,7 +35,6 @@ * knowledge of the CeCILL-C license and that you accept its terms. */ - import { OverlayContainer, OverlayModule } from '@angular/cdk/overlay'; import { Component, ViewChild } from '@angular/core'; import { ComponentFixture, inject, TestBed, waitForAsync } from '@angular/core/testing'; @@ -48,11 +47,8 @@ import { input, VitamUICommonTestModule } from 'ui-frontend-common/testing'; import { IdentityProviderService } from '../../../customer/customer-preview/sso-tab/identity-provider.service'; import { EditableKeystoreComponent } from './editable-keystore.component'; - @Component({ - template: ` - - ` + template: ` `, }) class TesthostComponent { identityProvider: IdentityProvider = { @@ -66,9 +62,9 @@ class TesthostComponent { idpMetadata: null, patterns: ['test1.com', 'test2.com'], enabled: true, - readonly : false, + readonly: false, authnRequestBinding: AuthnRequestBindingEnum.POST, - autoProvisioningEnabled: false + autoProvisioningEnabled: false, }; disabled: boolean; @ViewChild(EditableKeystoreComponent, { static: false }) component: EditableKeystoreComponent; @@ -81,21 +77,10 @@ describe('EditableKeystoreComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [ - ReactiveFormsModule, - OverlayModule, - VitamUICommonTestModule, - NoopAnimationsModule, - ], - declarations: [ - TesthostComponent, - EditableKeystoreComponent, - ], - providers: [ - { provide: IdentityProviderService, useValue: { updateKeystore: () => of(null) } }, - ] - }) - .compileComponents(); + imports: [ReactiveFormsModule, OverlayModule, VitamUICommonTestModule, NoopAnimationsModule], + declarations: [TesthostComponent, EditableKeystoreComponent], + providers: [{ provide: IdentityProviderService, useValue: { updateKeystore: () => of(null) } }], + }).compileComponents(); inject([OverlayContainer], (oc: OverlayContainer) => { overlayContainerElement = oc.getContainerElement(); @@ -113,7 +98,6 @@ describe('EditableKeystoreComponent', () => { }); describe('DOM', () => { - it('should call enterEditMode() on click', () => { spyOn(testhost.component, 'enterEditMode'); const element = fixture.nativeElement.querySelector('.editable-field'); @@ -181,11 +165,9 @@ describe('EditableKeystoreComponent', () => { expect(elError).toBeTruthy(); expect(elError.textContent).toContain('SHARED.EDITABLE_FIELD.WRONG_PASSWORD'); }); - }); describe('Class', () => { - describe('canConfirm', () => { it('should return true when the edit mode is active, the file and password are set', () => { testhost.component.editMode = true; @@ -293,6 +275,5 @@ describe('EditableKeystoreComponent', () => { expect(testhost.component.control.value).toBeNull(); }); }); - }); }); diff --git a/ui/ui-frontend/projects/identity/src/app/shared/editable-field/editable-keystore/editable-keystore.component.ts b/ui/ui-frontend/projects/identity/src/app/shared/editable-field/editable-keystore/editable-keystore.component.ts index 780c381ef0e..82cc44cfedf 100644 --- a/ui/ui-frontend/projects/identity/src/app/shared/editable-field/editable-keystore/editable-keystore.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/shared/editable-field/editable-keystore/editable-keystore.component.ts @@ -38,17 +38,14 @@ import { EditableFieldComponent, IdentityProvider, newFile } from 'ui-frontend-c import { Component, ElementRef, Input, ViewChild } from '@angular/core'; -import { - IdentityProviderService -} from '../../../customer/customer-preview/sso-tab/identity-provider.service'; +import { IdentityProviderService } from '../../../customer/customer-preview/sso-tab/identity-provider.service'; @Component({ selector: 'app-editable-keystore', templateUrl: './editable-keystore.component.html', - styleUrls: ['./editable-keystore.component.scss'] + styleUrls: ['./editable-keystore.component.scss'], }) export class EditableKeystoreComponent extends EditableFieldComponent { - @Input() identityProvider: IdentityProvider; file: File; @@ -56,9 +53,14 @@ export class EditableKeystoreComponent extends EditableFieldComponent { @ViewChild('fileInput', { static: false }) fileInput: ElementRef; - get canConfirm() { return this.editMode && !!this.file && this.control.valid; } + get canConfirm() { + return this.editMode && !!this.file && this.control.valid; + } - constructor(private identityProviderService: IdentityProviderService, elementRef: ElementRef) { + constructor( + private identityProviderService: IdentityProviderService, + elementRef: ElementRef, + ) { super(elementRef); } @@ -67,25 +69,27 @@ export class EditableKeystoreComponent extends EditableFieldComponent { } confirm() { - if (!this.canConfirm) { return; } - this.identityProviderService.updateKeystore(this.identityProvider.id, this.file, this.control.value) - .subscribe( + if (!this.canConfirm) { + return; + } + this.identityProviderService.updateKeystore(this.identityProvider.id, this.file, this.control.value).subscribe( () => { this.originValue = this.file; this.cancel(); }, () => { this.control.setErrors({ badPassword: true }); - }); - + }, + ); } cancel() { - if (!this.editMode) { return; } + if (!this.editMode) { + return; + } this.editMode = false; this.file = null; this.fileInput.nativeElement.value = null; this.control.reset(); } - } diff --git a/ui/ui-frontend/projects/identity/src/app/shared/editable-field/editable-patterns/editable-patterns.component.html b/ui/ui-frontend/projects/identity/src/app/shared/editable-field/editable-patterns/editable-patterns.component.html index 0edd7e3f975..fec753b196d 100644 --- a/ui/ui-frontend/projects/identity/src/app/shared/editable-field/editable-patterns/editable-patterns.component.html +++ b/ui/ui-frontend/projects/identity/src/app/shared/editable-field/editable-patterns/editable-patterns.component.html @@ -2,13 +2,13 @@
      - - -
      {{pattern}}
      -
      -
      - -
      + + +
      {{ pattern }}
      +
      +
      + +
      edit
      @@ -26,13 +26,15 @@ [cdkConnectedOverlayPositions]="positions" >
      - +
      - -
      {{pattern}}
      + +
      {{ pattern }}
      diff --git a/ui/ui-frontend/projects/identity/src/app/shared/editable-field/editable-patterns/editable-patterns.component.spec.ts b/ui/ui-frontend/projects/identity/src/app/shared/editable-field/editable-patterns/editable-patterns.component.spec.ts index 4ffdf1b915c..ab1b4395f6f 100644 --- a/ui/ui-frontend/projects/identity/src/app/shared/editable-field/editable-patterns/editable-patterns.component.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/shared/editable-field/editable-patterns/editable-patterns.component.spec.ts @@ -49,14 +49,16 @@ import { EditablePatternsComponent } from './editable-patterns.component'; @Component({ selector: 'app-pattern', template: '', - providers: [{ - provide: NG_VALUE_ACCESSOR, - useExisting: forwardRef(() => PatternStubComponent), - multi: true - }] + providers: [ + { + provide: NG_VALUE_ACCESSOR, + useExisting: forwardRef(() => PatternStubComponent), + multi: true, + }, + ], }) class PatternStubComponent implements ControlValueAccessor { - @Input() options: Array<{ value: string, disabled?: boolean }>; + @Input() options: Array<{ value: string; disabled?: boolean }>; @Input() vitamuiMiniMode = false; @ViewChild('select', { static: true }) select: MatSelect; @@ -67,22 +69,16 @@ class PatternStubComponent implements ControlValueAccessor { } @Component({ - template: ` - - ` + template: ` `, }) class TesthostComponent { value: string[]; options = [ - { value: 'test1.com', disabled: false }, - { value: 'test2.com', disabled: false }, - { value: 'test3.com', disabled: false }, - { value: 'test4.com', disabled: true }, - { value: 'test5.com', disabled: true }, + { value: 'test1.com', disabled: false }, + { value: 'test2.com', disabled: false }, + { value: 'test3.com', disabled: false }, + { value: 'test4.com', disabled: true }, + { value: 'test5.com', disabled: true }, ]; label = 'Test label'; @ViewChild(EditablePatternsComponent, { static: false }) component: EditablePatternsComponent; @@ -95,21 +91,9 @@ describe('EditablePatternsComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [ - FormsModule, - ReactiveFormsModule, - OverlayModule, - MatProgressSpinnerModule, - NoopAnimationsModule, - VitamUICommonTestModule, - ], - declarations: [ - TesthostComponent, - EditablePatternsComponent, - PatternStubComponent - ] - }) - .compileComponents(); + imports: [FormsModule, ReactiveFormsModule, OverlayModule, MatProgressSpinnerModule, NoopAnimationsModule, VitamUICommonTestModule], + declarations: [TesthostComponent, EditablePatternsComponent, PatternStubComponent], + }).compileComponents(); inject([OverlayContainer], (oc: OverlayContainer) => { overlayContainerElement = oc.getContainerElement(); @@ -127,7 +111,6 @@ describe('EditablePatternsComponent', () => { }); describe('DOM', () => { - it('should call enterEditMode() on click', () => { spyOn(testhost.component, 'enterEditMode'); const element = fixture.nativeElement.querySelector('.editable-field'); @@ -146,7 +129,7 @@ describe('EditablePatternsComponent', () => { fixture.whenStable().then(() => { fixture.detectChanges(); const elPatterns = fixture.nativeElement.querySelectorAll( - '.editable-field .editable-field-content .editable-field-text-content > div' + '.editable-field .editable-field-content .editable-field-text-content > div', ); expect(elPatterns.length).toBe(2); expect(elPatterns[0].textContent).toContain(testhost.value[0]); @@ -198,11 +181,9 @@ describe('EditablePatternsComponent', () => { const elSpinner = fixture.nativeElement.querySelector('.editable-field mat-spinner'); expect(elSpinner).toBeFalsy(); }); - }); describe('Class', () => { - it('should set the control value', waitForAsync(() => { testhost.value = ['test1.com', 'test3.com']; fixture.detectChanges(); diff --git a/ui/ui-frontend/projects/identity/src/app/shared/editable-field/editable-patterns/editable-patterns.component.ts b/ui/ui-frontend/projects/identity/src/app/shared/editable-field/editable-patterns/editable-patterns.component.ts index 108a9cc0711..2f488663008 100644 --- a/ui/ui-frontend/projects/identity/src/app/shared/editable-field/editable-patterns/editable-patterns.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/shared/editable-field/editable-patterns/editable-patterns.component.ts @@ -43,17 +43,16 @@ import { PatternComponent } from '../../pattern/pattern.component'; export const EDITABLE_PATTERNS_INPUT_VALUE_ACCESSOR: any = { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => EditablePatternsComponent), - multi: true + multi: true, }; @Component({ selector: 'app-editable-patterns', templateUrl: './editable-patterns.component.html', - providers: [EDITABLE_PATTERNS_INPUT_VALUE_ACCESSOR] + providers: [EDITABLE_PATTERNS_INPUT_VALUE_ACCESSOR], }) export class EditablePatternsComponent extends EditableFieldComponent { - - @Input() options: Array<{ value: string, disabled: boolean }>; + @Input() options: Array<{ value: string; disabled: boolean }>; @ViewChild(PatternComponent, { static: false }) pattern: PatternComponent; @@ -64,7 +63,9 @@ export class EditablePatternsComponent extends EditableFieldComponent { } onClick(target: HTMLElement) { - if (!this.editMode) { return; } + if (!this.editMode) { + return; + } if (this.patternClicked) { this.patternClicked = false; @@ -90,5 +91,4 @@ export class EditablePatternsComponent extends EditableFieldComponent { protected isInside(target: HTMLElement, element: HTMLElement): boolean { return element && (target === element || element.contains(target)); } - } diff --git a/ui/ui-frontend/projects/identity/src/app/shared/pattern/pattern.component.html b/ui/ui-frontend/projects/identity/src/app/shared/pattern/pattern.component.html index 9f9f0b57a08..8208c6ca459 100644 --- a/ui/ui-frontend/projects/identity/src/app/shared/pattern/pattern.component.html +++ b/ui/ui-frontend/projects/identity/src/app/shared/pattern/pattern.component.html @@ -1,8 +1,12 @@
      - + - {{ option.value }} {{'SHARED.PATTERN_ALREADY_USED' | translate}} + {{ option.value }} {{ 'SHARED.PATTERN_ALREADY_USED' | translate }} @@ -12,14 +16,14 @@
      -
      -
      {{pattern}}
      +
      {{ pattern }}
      clear
      diff --git a/ui/ui-frontend/projects/identity/src/app/shared/pattern/pattern.component.scss b/ui/ui-frontend/projects/identity/src/app/shared/pattern/pattern.component.scss index bf6ca8459a6..313b218cdda 100644 --- a/ui/ui-frontend/projects/identity/src/app/shared/pattern/pattern.component.scss +++ b/ui/ui-frontend/projects/identity/src/app/shared/pattern/pattern.component.scss @@ -1,21 +1,21 @@ :host::ng-deep { - mat-form-field { - width: 50%; - } + mat-form-field { + width: 50%; + } - .mat-form-field-wrapper { - width: 83%; - } + .mat-form-field-wrapper { + width: 83%; + } - .mat-form-field-flex { - height: 100%; - } + .mat-form-field-flex { + height: 100%; + } - .mat-form-field-infix { - padding: 0.5rem 0rem!important; - } + .mat-form-field-infix { + padding: 0.5rem 0rem !important; + } - .mat-form-field-label span { - line-height: 15px; - } + .mat-form-field-label span { + line-height: 15px; + } } diff --git a/ui/ui-frontend/projects/identity/src/app/shared/pattern/pattern.component.spec.ts b/ui/ui-frontend/projects/identity/src/app/shared/pattern/pattern.component.spec.ts index 8b4144775a3..23cd433bbcb 100644 --- a/ui/ui-frontend/projects/identity/src/app/shared/pattern/pattern.component.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/shared/pattern/pattern.component.spec.ts @@ -46,7 +46,7 @@ import { VitamUICommonTestModule } from 'ui-frontend-common/testing'; import { PatternComponent } from './pattern.component'; @Component({ - template: `` + template: ``, }) class TestHostComponent { patterns: string[]; @@ -66,16 +66,9 @@ describe('PatternComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [ - FormsModule, - ReactiveFormsModule, - MatSelectModule, - NoopAnimationsModule, - VitamUICommonTestModule - ], - declarations: [ PatternComponent, TestHostComponent ] - }) - .compileComponents(); + imports: [FormsModule, ReactiveFormsModule, MatSelectModule, NoopAnimationsModule, VitamUICommonTestModule], + declarations: [PatternComponent, TestHostComponent], + }).compileComponents(); })); beforeEach(() => { @@ -268,7 +261,5 @@ describe('PatternComponent', () => { elAddButton.click(); expect(testhost.component.add).toHaveBeenCalled(); }); - }); - }); diff --git a/ui/ui-frontend/projects/identity/src/app/shared/pattern/pattern.component.ts b/ui/ui-frontend/projects/identity/src/app/shared/pattern/pattern.component.ts index d3648503340..024a8f3d4a5 100644 --- a/ui/ui-frontend/projects/identity/src/app/shared/pattern/pattern.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/shared/pattern/pattern.component.ts @@ -42,18 +42,17 @@ import { MatSelect } from '@angular/material/select'; export const PATTERN_VALUE_ACCESSOR: any = { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => PatternComponent), - multi: true + multi: true, }; @Component({ selector: 'app-pattern', templateUrl: './pattern.component.html', styleUrls: ['./pattern.component.scss'], - providers: [PATTERN_VALUE_ACCESSOR] + providers: [PATTERN_VALUE_ACCESSOR], }) export class PatternComponent implements ControlValueAccessor { - - @Input() options: Array<{ value: string, disabled?: boolean }>; + @Input() options: Array<{ value: string; disabled?: boolean }>; @Input() vitamuiMiniMode = false; @ViewChild('select', { static: true }) select: MatSelect; @@ -79,7 +78,9 @@ export class PatternComponent implements ControlValueAccessor { } add() { - if (!this.controlValueValid()) { return; } + if (!this.controlValueValid()) { + return; + } this.patterns.push(this.control.value); this.onChange(this.patterns); if (this.enabledOptions.length <= 0 && this.control.enabled) { @@ -95,11 +96,11 @@ export class PatternComponent implements ControlValueAccessor { } } - get availableOptions(): Array<{ value: string, disabled?: boolean }> { + get availableOptions(): Array<{ value: string; disabled?: boolean }> { return (this.options || []).filter((option) => this.isAvailable(option.value)); } - get enabledOptions(): Array<{ value: string, disabled?: boolean }> { + get enabledOptions(): Array<{ value: string; disabled?: boolean }> { return this.availableOptions.filter((option) => !option.disabled); } @@ -110,5 +111,4 @@ export class PatternComponent implements ControlValueAccessor { isAvailable(value: string): boolean { return !this.patterns.includes(value); } - } diff --git a/ui/ui-frontend/projects/identity/src/app/shared/pattern/pattern.module.ts b/ui/ui-frontend/projects/identity/src/app/shared/pattern/pattern.module.ts index fbcf73bf6d4..1e056372f41 100644 --- a/ui/ui-frontend/projects/identity/src/app/shared/pattern/pattern.module.ts +++ b/ui/ui-frontend/projects/identity/src/app/shared/pattern/pattern.module.ts @@ -43,13 +43,8 @@ import { TranslateModule } from '@ngx-translate/core'; import { PatternComponent } from './pattern.component'; @NgModule({ - imports: [ - CommonModule, - ReactiveFormsModule, - MatSelectModule, - TranslateModule - ], + imports: [CommonModule, ReactiveFormsModule, MatSelectModule, TranslateModule], declarations: [PatternComponent], - exports: [PatternComponent] + exports: [PatternComponent], }) -export class PatternModule { } +export class PatternModule {} diff --git a/ui/ui-frontend/projects/identity/src/app/shared/profiles-form/option-tree.interface.ts b/ui/ui-frontend/projects/identity/src/app/shared/profiles-form/option-tree.interface.ts index fb468449492..e276867bb4f 100644 --- a/ui/ui-frontend/projects/identity/src/app/shared/profiles-form/option-tree.interface.ts +++ b/ui/ui-frontend/projects/identity/src/app/shared/profiles-form/option-tree.interface.ts @@ -35,10 +35,8 @@ * knowledge of the CeCILL-C license and that you accept its terms. */ export interface OptionTree { - - key: string; - label: string; - info?: string; - children?: OptionTree[]; - + key: string; + label: string; + info?: string; + children?: OptionTree[]; } diff --git a/ui/ui-frontend/projects/identity/src/app/shared/profiles-form/profiles-form.component.html b/ui/ui-frontend/projects/identity/src/app/shared/profiles-form/profiles-form.component.html index c5d706587a2..93c53d8abb0 100644 --- a/ui/ui-frontend/projects/identity/src/app/shared/profiles-form/profiles-form.component.html +++ b/ui/ui-frontend/projects/identity/src/app/shared/profiles-form/profiles-form.component.html @@ -1,17 +1,24 @@
      - - {{ - 'COMMON.ERROR.REQUIRED' | translate - }} - {{ - 'COMMON.INCORRECT_VALUE' | translate - }} - - - + + {{ + 'COMMON.ERROR.REQUIRED' | translate + }} + {{ + 'COMMON.INCORRECT_VALUE' | translate + }} + + + {{ 'COMMON.ERROR.REQUIRED' | translate }} @@ -19,21 +26,27 @@ 'COMMON.INCORRECT_VALUE' | translate }} - - - {{ - 'COMMON.ERROR.REQUIRED' | translate - }} - {{ - 'COMMON.INCORRECT_VALUE' | translate - }} - + + + {{ + 'COMMON.ERROR.REQUIRED' | translate + }} + {{ + 'COMMON.INCORRECT_VALUE' | translate + }} +
      - + @@ -43,17 +56,17 @@
      -
      {{'GROUP.PROFILE.MODAL.APP' | translate}}
      -
      {{'GROUP.PROFILE.MODAL.SAFE' | translate}}
      -
      {{'GROUP.PROFILE.MODAL.PROFILE' | translate}}
      +
      {{ 'GROUP.PROFILE.MODAL.APP' | translate }}
      +
      {{ 'GROUP.PROFILE.MODAL.SAFE' | translate }}
      +
      {{ 'GROUP.PROFILE.MODAL.PROFILE' | translate }}
      -
      +
      {{ getApplicationFromId(id)?.name }}
      {{ getProfileFromId(id)?.tenantName }}
      {{ getProfileFromId(id)?.name }}
      -
      +
      diff --git a/ui/ui-frontend/projects/identity/src/app/shared/profiles-form/profiles-form.component.spec.ts b/ui/ui-frontend/projects/identity/src/app/shared/profiles-form/profiles-form.component.spec.ts index 535d80471de..decc16c4dcd 100644 --- a/ui/ui-frontend/projects/identity/src/app/shared/profiles-form/profiles-form.component.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/shared/profiles-form/profiles-form.component.spec.ts @@ -35,7 +35,6 @@ * knowledge of the CeCILL-C license and that you accept its terms. */ - import { Component, Directive, Input, NO_ERRORS_SCHEMA, ViewChild } from '@angular/core'; import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; @@ -56,7 +55,7 @@ const expectedProfiles = [ applicationName: 'CUSTOMERS_APP', tenantIdentifier: 1, tenantName: 'tenant 1', - tenant: { id: '11', name: 'tenant 1', identifier: 1 } + tenant: { id: '11', name: 'tenant 1', identifier: 1 }, }, { id: '2', @@ -65,7 +64,7 @@ const expectedProfiles = [ applicationName: 'CUSTOMERS_APP', tenantIdentifier: 2, tenantName: 'tenant 2', - tenant: { id: '22', name: 'tenant 2', identifier: 2 } + tenant: { id: '22', name: 'tenant 2', identifier: 2 }, }, { id: '3', @@ -74,7 +73,7 @@ const expectedProfiles = [ applicationName: 'USERS_APP', tenantIdentifier: 1, tenantName: 'tenant 1', - tenant: { id: '11', name: 'tenant 1', identifier: 1 } + tenant: { id: '11', name: 'tenant 1', identifier: 1 }, }, { id: '4', @@ -83,7 +82,7 @@ const expectedProfiles = [ applicationName: 'GROUPS_APP', tenantIdentifier: 3, tenantName: 'tenant 3', - tenant: { id: '33', name: 'tenant 3', identifier: 3 } + tenant: { id: '33', name: 'tenant 3', identifier: 3 }, }, { id: '5', @@ -92,7 +91,7 @@ const expectedProfiles = [ applicationName: 'PROFILES_APP', tenantIdentifier: 4, tenantName: 'tenant 4', - tenant: { id: '44', name: 'tenant 4', identifier: 4 } + tenant: { id: '44', name: 'tenant 4', identifier: 4 }, }, { id: '6', @@ -101,42 +100,46 @@ const expectedProfiles = [ applicationName: 'CUSTOMERS_APP', tenantIdentifier: 1, tenantName: 'tenant 1', - tenant: { id: '11', name: 'tenant 1', identifier: 1 } + tenant: { id: '11', name: 'tenant 1', identifier: 1 }, }, ]; const expectedApp = { - APPLICATION_CONFIGURATION: [ - { - id: 'CUSTOMERS_APP', - identifier: 'CUSTOMERS_APP', - name: 'Organisations', - url: '' - }, { - id: 'ARCHIVE_APP', - identifier: 'ARCHIVE_APP', - name: 'Archives', - url: '' - }, { - id: 'USERS_APP', - identifier: 'USERS_APP', - name: 'Utilisateurs', - url: '' - }, { - id: 'GROUPS_APP', - identifier: 'GROUPS_APP', - name: 'Groupes de profils', - url: '' - }, { - id: 'PROFILES_APP', - identifier: 'PROFILES_APP', - name: 'Profils APP Utilisateurs', - url: '' - }, - ], CATEGORY_CONFIGURATION: {} + APPLICATION_CONFIGURATION: [ + { + id: 'CUSTOMERS_APP', + identifier: 'CUSTOMERS_APP', + name: 'Organisations', + url: '', + }, + { + id: 'ARCHIVE_APP', + identifier: 'ARCHIVE_APP', + name: 'Archives', + url: '', + }, + { + id: 'USERS_APP', + identifier: 'USERS_APP', + name: 'Utilisateurs', + url: '', + }, + { + id: 'GROUPS_APP', + identifier: 'GROUPS_APP', + name: 'Groupes de profils', + url: '', + }, + { + id: 'PROFILES_APP', + identifier: 'PROFILES_APP', + name: 'Profils APP Utilisateurs', + url: '', + }, + ], + CATEGORY_CONFIGURATION: {}, }; - @Directive({ selector: '[matTooltip]' }) class MatTooltipStubDirective { @Input() matTooltip: any; @@ -145,9 +148,7 @@ class MatTooltipStubDirective { } @Component({ - template: ` - - ` + template: ` `, }) class TesthostComponent { profiles: string[]; @@ -170,16 +171,14 @@ describe('ProfilesFormComponent', () => { VitamUIAutocompleteModule, VitamUICommonTestModule, ], - declarations: [ ProfilesFormComponent, TesthostComponent, MatTooltipStubDirective ], + declarations: [ProfilesFormComponent, TesthostComponent, MatTooltipStubDirective], providers: [ { provide: ProfileService, useValue: { list: () => of(expectedProfiles) } }, { provide: ApplicationApiService, useValue: { getAllByParams: () => of(expectedApp) } }, { provide: ApplicationService, useValue: { list: () => of(expectedApp), buildApplications: () => expectedApp } }, ], - schemas: [NO_ERRORS_SCHEMA] - }) - .compileComponents(); - + schemas: [NO_ERRORS_SCHEMA], + }).compileComponents(); })); beforeEach(() => { @@ -193,7 +192,6 @@ describe('ProfilesFormComponent', () => { }); describe('DOM', () => { - it('should have 3 select inputs', () => { const elInputs = fixture.nativeElement.querySelectorAll('vitamui-common-vitamui-autocomplete'); expect(elInputs.length).toBe(3); @@ -229,13 +227,10 @@ describe('ProfilesFormComponent', () => { elDelButton.click(); expect(testhost.component.remove).toHaveBeenCalledWith(0); }); - }); describe('Component', () => { - it('should fill the application tree', () => { - expect(testhost.component.applications).toEqual([ { key: 'GROUPS_APP', @@ -244,11 +239,9 @@ describe('ProfilesFormComponent', () => { { key: '3', label: 'tenant 3', - children: [ - { key: expectedProfiles[3].id, label: expectedProfiles[3].name, info: expectedProfiles[3].description }, - ] + children: [{ key: expectedProfiles[3].id, label: expectedProfiles[3].name, info: expectedProfiles[3].description }], }, - ] + ], }, { key: 'CUSTOMERS_APP', @@ -260,16 +253,14 @@ describe('ProfilesFormComponent', () => { children: [ { key: expectedProfiles[0].id, label: expectedProfiles[0].name, info: expectedProfiles[0].description }, { key: expectedProfiles[5].id, label: expectedProfiles[5].name, info: expectedProfiles[5].description }, - ] + ], }, { key: '2', label: 'tenant 2', - children: [ - { key: expectedProfiles[1].id, label: expectedProfiles[1].name, info: expectedProfiles[1].description }, - ] + children: [{ key: expectedProfiles[1].id, label: expectedProfiles[1].name, info: expectedProfiles[1].description }], }, - ] + ], }, { key: 'PROFILES_APP', @@ -278,11 +269,9 @@ describe('ProfilesFormComponent', () => { { key: '4', label: 'tenant 4', - children: [ - { key: expectedProfiles[4].id, label: expectedProfiles[4].name, info: expectedProfiles[4].description }, - ] + children: [{ key: expectedProfiles[4].id, label: expectedProfiles[4].name, info: expectedProfiles[4].description }], }, - ] + ], }, { key: 'USERS_APP', @@ -291,11 +280,9 @@ describe('ProfilesFormComponent', () => { { key: '1', label: 'tenant 1', - children: [ - { key: expectedProfiles[2].id, label: expectedProfiles[2].name, info: expectedProfiles[2].description }, - ] + children: [{ key: expectedProfiles[2].id, label: expectedProfiles[2].name, info: expectedProfiles[2].description }], }, - ] + ], }, ]); }); @@ -363,7 +350,5 @@ describe('ProfilesFormComponent', () => { expect(testhost.component.filteredTenants[0].key).toBe('1'); }); })); - }); - }); diff --git a/ui/ui-frontend/projects/identity/src/app/shared/profiles-form/profiles-form.component.ts b/ui/ui-frontend/projects/identity/src/app/shared/profiles-form/profiles-form.component.ts index 7692bf1a33a..25db7388b90 100644 --- a/ui/ui-frontend/projects/identity/src/app/shared/profiles-form/profiles-form.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/shared/profiles-form/profiles-form.component.ts @@ -46,17 +46,16 @@ import { OptionTree } from './option-tree.interface'; export const PROFILES_FORM_VALUE_ACCESSOR: any = { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => ProfilesFormComponent), - multi: true + multi: true, }; @Component({ selector: 'app-profiles-form', templateUrl: './profiles-form.component.html', styleUrls: ['./profiles-form.component.scss'], - providers: [PROFILES_FORM_VALUE_ACCESSOR] + providers: [PROFILES_FORM_VALUE_ACCESSOR], }) export class ProfilesFormComponent implements ControlValueAccessor, OnInit { - profiles: Profile[] = []; profileIds: string[] = []; applicationsDetails: Application[] = []; @@ -68,7 +67,7 @@ export class ProfilesFormComponent implements ControlValueAccessor, OnInit { @Input() tenantIdentifier: number; - @Input() applicationNameExclude: string []; + @Input() applicationNameExclude: string[]; @Input() set level(level: string) { this._level = level; @@ -92,25 +91,25 @@ export class ProfilesFormComponent implements ControlValueAccessor, OnInit { @ViewChild('profileInput', { static: true }) profileInput: VitamUIAutocompleteComponent; @ViewChild('addButton', { static: true }) addButton: ElementRef; - constructor(private rngProfileService: ProfileService, private appApiService: ApplicationApiService) { - - } + constructor( + private rngProfileService: ProfileService, + private appApiService: ApplicationApiService, + ) {} ngOnInit(): void { this.getProfiles(); - this.appSelect.valueChanges - .subscribe(() => { - this.filterTenants(); - if (this.filteredTenants.length === 1) { - this.tenantSelect.setValue(this.filteredTenants[0].key); - } else { - this.tenantSelect.setValue(null); - if (!this.tenantIdentifier) { - setTimeout(() => this.tenantInput.focus(), 0); - } + this.appSelect.valueChanges.subscribe(() => { + this.filterTenants(); + if (this.filteredTenants.length === 1) { + this.tenantSelect.setValue(this.filteredTenants[0].key); + } else { + this.tenantSelect.setValue(null); + if (!this.tenantIdentifier) { + setTimeout(() => this.tenantInput.focus(), 0); } - this.toggleSelects(); - }); + } + this.toggleSelects(); + }); this.tenantSelect.valueChanges.subscribe(() => { this.filterProfiles(); if (this.filteredProfiles.length === 1) { @@ -129,15 +128,18 @@ export class ProfilesFormComponent implements ControlValueAccessor, OnInit { getProfiles() { const params = new HttpParams().set('filterApp', 'false'); - this.appApiService.getAllByParams(params).pipe( - tap((applications) => this.applicationsDetails = applications.APPLICATION_CONFIGURATION), - switchMap(( ) => this.rngProfileService.list(this.level, this.tenantIdentifier, this.applicationNameExclude)) - ).subscribe((profiles) => { - this.profiles = profiles; - this.profileIds = this.profileIds.sort(byApplicationName(this.profiles, this.applicationsDetails)); - this.updateApplicationTree(); - this.loading = false; - }); + this.appApiService + .getAllByParams(params) + .pipe( + tap((applications) => (this.applicationsDetails = applications.APPLICATION_CONFIGURATION)), + switchMap(() => this.rngProfileService.list(this.level, this.tenantIdentifier, this.applicationNameExclude)), + ) + .subscribe((profiles) => { + this.profiles = profiles; + this.profileIds = this.profileIds.sort(byApplicationName(this.profiles, this.applicationsDetails)); + this.updateApplicationTree(); + this.loading = false; + }); } onChange = (_: any) => {}; @@ -157,8 +159,12 @@ export class ProfilesFormComponent implements ControlValueAccessor, OnInit { } add() { - if (!this.profileSelect.value) { return; } - if (this.profileIds.includes(this.profileSelect.value)) { return; } + if (!this.profileSelect.value) { + return; + } + if (this.profileIds.includes(this.profileSelect.value)) { + return; + } this.profileIds.push(this.profileSelect.value); this.profileIds = this.profileIds.sort(byApplicationName(this.profiles, this.applicationsDetails)); this.updateApplicationTree(); @@ -180,7 +186,7 @@ export class ProfilesFormComponent implements ControlValueAccessor, OnInit { if (profileToDisplay) { return this.applicationsDetails.find((app) => app.identifier === profileToDisplay.applicationName); } else { - return { name: 'Non défini'}; + return { name: 'Non défini' }; } } @@ -194,8 +200,9 @@ export class ProfilesFormComponent implements ControlValueAccessor, OnInit { this.profiles .filter((profile) => profile.applicationName) .filter((profile) => { - const foundProfile = selectedProfiles.find((p) => p.applicationName === profile.applicationName - && p.tenantIdentifier === profile.tenantIdentifier); + const foundProfile = selectedProfiles.find( + (p) => p.applicationName === profile.applicationName && p.tenantIdentifier === profile.tenantIdentifier, + ); return !foundProfile; }) @@ -231,7 +238,7 @@ export class ProfilesFormComponent implements ControlValueAccessor, OnInit { } else { this.tenantSelect.disable({ emitEvent: false }); } - if (this.filteredProfiles.length > 0 ) { + if (this.filteredProfiles.length > 0) { this.profileSelect.enable({ emitEvent: false }); } else { this.profileSelect.disable({ emitEvent: false }); @@ -241,7 +248,9 @@ export class ProfilesFormComponent implements ControlValueAccessor, OnInit { private buildApplicationOption(profile: Profile): OptionTree { const application = this.applicationsDetails.find((app) => app.identifier === profile.applicationName); let appLabel = ''; - if (application) { appLabel = this.applicationsDetails.find((app) => app.identifier === application.identifier).name; } + if (application) { + appLabel = this.applicationsDetails.find((app) => app.identifier === application.identifier).name; + } return { key: profile.applicationName, @@ -250,9 +259,9 @@ export class ProfilesFormComponent implements ControlValueAccessor, OnInit { { key: profile.tenantIdentifier.toString(), label: profile.tenantName, - children: [{ key: profile.id, label: this.getProfileLabel(profile), info: profile.description }] + children: [{ key: profile.id, label: this.getProfileLabel(profile), info: profile.description }], }, - ] + ], }; } @@ -266,11 +275,10 @@ export class ProfilesFormComponent implements ControlValueAccessor, OnInit { } private buildTenantOption(profile: Profile): OptionTree { - return { key: profile.tenantIdentifier.toString(), label: profile.tenantName, - children: [{ key: profile.id, label: this.getProfileLabel(profile), info: profile.description }] + children: [{ key: profile.id, label: this.getProfileLabel(profile), info: profile.description }], }; } @@ -287,7 +295,6 @@ export class ProfilesFormComponent implements ControlValueAccessor, OnInit { resetTree() { this.appSelect.setValue(null); } - } function byApplicationName(profiles: Profile[], applications: Application[]): (idA: string, idB: string) => number { diff --git a/ui/ui-frontend/projects/identity/src/app/shared/profiles-form/profiles-form.module.ts b/ui/ui-frontend/projects/identity/src/app/shared/profiles-form/profiles-form.module.ts index 61c715eea27..5993ee37285 100644 --- a/ui/ui-frontend/projects/identity/src/app/shared/profiles-form/profiles-form.module.ts +++ b/ui/ui-frontend/projects/identity/src/app/shared/profiles-form/profiles-form.module.ts @@ -45,16 +45,9 @@ import { ProfileService, VitamUICommonModule } from 'ui-frontend-common'; import { ProfilesFormComponent } from './profiles-form.component'; @NgModule({ - imports: [ - CommonModule, - ReactiveFormsModule, - MatProgressSpinnerModule, - MatSelectModule, - MatTooltipModule, - VitamUICommonModule, - ], + imports: [CommonModule, ReactiveFormsModule, MatProgressSpinnerModule, MatSelectModule, MatTooltipModule, VitamUICommonModule], declarations: [ProfilesFormComponent], exports: [ProfilesFormComponent], - providers: [ProfileService] + providers: [ProfileService], }) -export class ProfilesFormModule { } +export class ProfilesFormModule {} diff --git a/ui/ui-frontend/projects/identity/src/app/shared/shared.module.ts b/ui/ui-frontend/projects/identity/src/app/shared/shared.module.ts index 84b4c694a0e..cd56293d23d 100644 --- a/ui/ui-frontend/projects/identity/src/app/shared/shared.module.ts +++ b/ui/ui-frontend/projects/identity/src/app/shared/shared.module.ts @@ -37,7 +37,7 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; -import {CollapseModule, LevelInputModule, TableFilterModule} from 'ui-frontend-common'; +import { CollapseModule, LevelInputModule, TableFilterModule } from 'ui-frontend-common'; import { DomainsInputModule } from './domains-input'; import { EditableFieldModule } from './editable-field'; import { PatternModule } from './pattern'; @@ -62,6 +62,6 @@ import { ProfilesFormModule } from './profiles-form/profiles-form.module'; ProfilesFormModule, LevelInputModule, TableFilterModule, - ] + ], }) -export class SharedModule { } +export class SharedModule {} diff --git a/ui/ui-frontend/projects/identity/src/app/shared/vitamui-snack-bar/vitamui-snack-bar.service.ts b/ui/ui-frontend/projects/identity/src/app/shared/vitamui-snack-bar/vitamui-snack-bar.service.ts index 717ddcf00bb..f163ff1ffe1 100644 --- a/ui/ui-frontend/projects/identity/src/app/shared/vitamui-snack-bar/vitamui-snack-bar.service.ts +++ b/ui/ui-frontend/projects/identity/src/app/shared/vitamui-snack-bar/vitamui-snack-bar.service.ts @@ -48,26 +48,24 @@ import { Injector, Optional, SkipSelf, - TemplateRef + TemplateRef, } from '@angular/core'; import { MatSnackBarConfig, MatSnackBarContainer, MatSnackBarRef, MAT_SNACK_BAR_DATA, SimpleSnackBar } from '@angular/material/snack-bar'; import { take, takeUntil } from 'rxjs/operators'; -export const MAT_SNACK_BAR_DEFAULT_OPTIONS = - new InjectionToken('mat-snack-bar-default-options', { - providedIn: 'root', - factory: MAT_SNACK_BAR_DEFAULT_OPTIONS_FACTORY, - }); +export const MAT_SNACK_BAR_DEFAULT_OPTIONS = new InjectionToken('mat-snack-bar-default-options', { + providedIn: 'root', + factory: MAT_SNACK_BAR_DEFAULT_OPTIONS_FACTORY, +}); export function MAT_SNACK_BAR_DEFAULT_OPTIONS_FACTORY(): MatSnackBarConfig { return new MatSnackBarConfig(); } @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class VitamUISnackBar { - /** * Reference to the current snack bar in the view *at this level* (in the Angular injector tree). * If there is a parent snack-bar service, all operations should delegate to that parent @@ -96,7 +94,8 @@ export class VitamUISnackBar { private _injector: Injector, private _breakpointObserver: BreakpointObserver, @Optional() @SkipSelf() private _parentSnackBar: VitamUISnackBar, - @Inject(MAT_SNACK_BAR_DEFAULT_OPTIONS) private _defaultConfig: MatSnackBarConfig) { } + @Inject(MAT_SNACK_BAR_DEFAULT_OPTIONS) private _defaultConfig: MatSnackBarConfig, + ) {} /** * Creates and dispatches a snack bar with a custom component for the content, removing any @@ -105,8 +104,7 @@ export class VitamUISnackBar { * @param component Component to be instantiated. * @param config Extra configuration for the snack bar. */ - openFromComponent(component: ComponentType, config?: MatSnackBarConfig): - MatSnackBarRef { + openFromComponent(component: ComponentType, config?: MatSnackBarConfig): MatSnackBarRef { return this._attach(component, config) as MatSnackBarRef; } @@ -117,8 +115,7 @@ export class VitamUISnackBar { * @param template Template to be instantiated. * @param config Extra configuration for the snack bar. */ - openFromTemplate(template: TemplateRef, config?: MatSnackBarConfig): - MatSnackBarRef> { + openFromTemplate(template: TemplateRef, config?: MatSnackBarConfig): MatSnackBarRef> { return this._attach(template, config); } @@ -128,8 +125,7 @@ export class VitamUISnackBar { * @param action The label for the snackbar action. * @param config Additional configuration options for the snackbar. */ - open(message: string, action: string = '', config?: MatSnackBarConfig): - MatSnackBarRef { + open(message: string, action: string = '', config?: MatSnackBarConfig): MatSnackBarRef { const mergedConfig = { ...this._defaultConfig, ...config }; mergedConfig.data = { message, action }; @@ -150,17 +146,14 @@ export class VitamUISnackBar { /** * Attaches the snack bar container component to the overlay. */ - private _attachSnackBarContainer(overlayRef: OverlayRef, - config: MatSnackBarConfig): MatSnackBarContainer { - + private _attachSnackBarContainer(overlayRef: OverlayRef, config: MatSnackBarConfig): MatSnackBarContainer { const userInjector = config && config.viewContainerRef && config.viewContainerRef.injector; const injector = Injector.create({ parent: userInjector || this._injector, - providers: [{provide: MatSnackBarConfig, useValue: config}] + providers: [{ provide: MatSnackBarConfig, useValue: config }], }); - const containerPortal = - new ComponentPortal(MatSnackBarContainer, config.viewContainerRef, injector); + const containerPortal = new ComponentPortal(MatSnackBarContainer, config.viewContainerRef, injector); const containerRef: ComponentRef = overlayRef.attach(containerPortal); containerRef.instance.snackBarConfig = config; @@ -170,9 +163,7 @@ export class VitamUISnackBar { /** * Places a new component or a template as the content of the snack bar container. */ - private _attach(content: ComponentType | TemplateRef, userConfig?: MatSnackBarConfig): - MatSnackBarRef> { - + private _attach(content: ComponentType | TemplateRef, userConfig?: MatSnackBarConfig): MatSnackBarRef> { const config = { ...new MatSnackBarConfig(), ...this._defaultConfig, ...userConfig }; const overlayRef = this._createOverlay(config); const container = this._attachSnackBarContainer(overlayRef, config); @@ -181,7 +172,7 @@ export class VitamUISnackBar { if (content instanceof TemplateRef) { const portal = new TemplatePortal(content, null, { $implicit: config.data, - snackBarRef + snackBarRef, } as any); snackBarRef.instance = container.attachTemplatePortal(portal); @@ -193,15 +184,16 @@ export class VitamUISnackBar { snackBarRef.instance = contentRef.instance; } - this._breakpointObserver.observe(Breakpoints.Handset).pipe( - takeUntil(overlayRef.detachments().pipe(take(1))) - ).subscribe((state) => { - if (state.matches) { - overlayRef.overlayElement.classList.add('mat-snack-bar-handset'); - } else { - overlayRef.overlayElement.classList.remove('mat-snack-bar-handset'); - } - }); + this._breakpointObserver + .observe(Breakpoints.Handset) + .pipe(takeUntil(overlayRef.detachments().pipe(take(1)))) + .subscribe((state) => { + if (state.matches) { + overlayRef.overlayElement.classList.add('mat-snack-bar-handset'); + } else { + overlayRef.overlayElement.classList.remove('mat-snack-bar-handset'); + } + }); this._animateSnackBar(snackBarRef, config); this._openedSnackBarRef = snackBarRef; @@ -244,10 +236,10 @@ export class VitamUISnackBar { const positionStrategy = this._overlay.position().global(); const isRtl = config.direction === 'rtl'; - const isLeft = ( + const isLeft = config.horizontalPosition === 'left' || (config.horizontalPosition === 'start' && !isRtl) || - (config.horizontalPosition === 'end' && isRtl)); + (config.horizontalPosition === 'end' && isRtl); const isRight = !isLeft && config.horizontalPosition !== 'center'; if (isLeft) { positionStrategy.left('0'); @@ -274,18 +266,15 @@ export class VitamUISnackBar { * @param config Config that was used to create the snack bar. * @param snackBarRef Reference to the snack bar. */ - private _createInjector( - config: MatSnackBarConfig, - snackBarRef: MatSnackBarRef): Injector { - + private _createInjector(config: MatSnackBarConfig, snackBarRef: MatSnackBarRef): Injector { const userInjector = config && config.viewContainerRef && config.viewContainerRef.injector; return Injector.create({ parent: userInjector || this._injector, providers: [ - {provide: MatSnackBarRef, useValue: snackBarRef}, - {provide: MAT_SNACK_BAR_DATA, useValue: config.data} - ] + { provide: MatSnackBarRef, useValue: snackBarRef }, + { provide: MAT_SNACK_BAR_DATA, useValue: config.data }, + ], }); } } diff --git a/ui/ui-frontend/projects/identity/src/app/subrogation/customer-select.service.spec.ts b/ui/ui-frontend/projects/identity/src/app/subrogation/customer-select.service.spec.ts index 8e7a66ab581..16a31d7b922 100644 --- a/ui/ui-frontend/projects/identity/src/app/subrogation/customer-select.service.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/subrogation/customer-select.service.spec.ts @@ -57,8 +57,8 @@ describe('CustomerSelectService', () => { CustomerSelectService, { provide: AuthService, useValue: authStubService }, { provide: BASE_URL, useValue: '/fake-api' }, - { provide: ENVIRONMENT, useValue: environment } - ] + { provide: ENVIRONMENT, useValue: environment }, + ], }); httpTestingController = TestBed.inject(HttpTestingController as Type); @@ -71,15 +71,12 @@ describe('CustomerSelectService', () => { it('should call /fake-api/customers with the right params', () => { const subrogeable = true; - searchService.getAll(true).subscribe( - (response) => { - expect(response).toEqual([ - { value: 'idteamvitamui', label: '000000 - teamvitamui' }, - { value: 'idtotal', label: '000001 - total' }, - ]); - }, - fail - ); + searchService.getAll(true).subscribe((response) => { + expect(response).toEqual([ + { value: 'idteamvitamui', label: '000000 - teamvitamui' }, + { value: 'idtotal', label: '000001 - total' }, + ]); + }, fail); const criterionArray: any[] = [{ key: 'subrogeable', value: subrogeable, operator: Operators.equals }]; const query: SearchQuery = { criteria: criterionArray }; @@ -93,12 +90,9 @@ describe('CustomerSelectService', () => { it('should return an empty list if the API returns an error', () => { const subrogeable = true; - searchService.getAll(true).subscribe( - (response) => { - expect(response).toEqual([]); - }, - fail - ); + searchService.getAll(true).subscribe((response) => { + expect(response).toEqual([]); + }, fail); const criterionArray: any[] = [{ key: 'subrogeable', value: subrogeable, operator: Operators.equals }]; const query: SearchQuery = { criteria: criterionArray }; @@ -110,12 +104,9 @@ describe('CustomerSelectService', () => { it('should return an empty list if the API returns nothing', () => { const subrogeable = true; - searchService.getAll(true).subscribe( - (response) => { - expect(response).toEqual([]); - }, - fail - ); + searchService.getAll(true).subscribe((response) => { + expect(response).toEqual([]); + }, fail); const criterionArray: any[] = [{ key: 'subrogeable', value: subrogeable, operator: Operators.equals }]; const query: SearchQuery = { criteria: criterionArray }; diff --git a/ui/ui-frontend/projects/identity/src/app/subrogation/customer-select.service.ts b/ui/ui-frontend/projects/identity/src/app/subrogation/customer-select.service.ts index 111299653af..4f7650089c9 100644 --- a/ui/ui-frontend/projects/identity/src/app/subrogation/customer-select.service.ts +++ b/ui/ui-frontend/projects/identity/src/app/subrogation/customer-select.service.ts @@ -44,32 +44,30 @@ import { Injectable } from '@angular/core'; import { CustomerApiService } from '../core/api/customer-api.service'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class CustomerSelectService { - private customers: Customer[]; - constructor(private customerApi: CustomerApiService) { } + constructor(private customerApi: CustomerApiService) {} getAll(subrogeable: boolean): Observable { - const criterionArray: any[] = [ { key: 'subrogeable', value: subrogeable, operator: Operators.equals }]; + const criterionArray: any[] = [{ key: 'subrogeable', value: subrogeable, operator: Operators.equals }]; const query: SearchQuery = { criteria: criterionArray }; const httpParams = new HttpParams().set('criteria', JSON.stringify(query)); - return this.customerApi.getAllByParams(httpParams) - .pipe( - catchError(() => of([])), - map((results) => { - this.customers = results; - return (results || []).map((c: { id: string, code: string, name: string }) => { - const label = c.code + ' - ' + c.name; + return this.customerApi.getAllByParams(httpParams).pipe( + catchError(() => of([])), + map((results) => { + this.customers = results; + return (results || []).map((c: { id: string; code: string; name: string }) => { + const label = c.code + ' - ' + c.name; - return { value: c.id, label }; - }); - }) - ); + return { value: c.id, label }; + }); + }), + ); } getCustomers(): Customer[] { diff --git a/ui/ui-frontend/projects/identity/src/app/subrogation/subrogate-user/subrogate-user-list/subrogate-user-list.component.html b/ui/ui-frontend/projects/identity/src/app/subrogation/subrogate-user/subrogate-user-list/subrogate-user-list.component.html index ebecc49aafa..ec9c4f72422 100644 --- a/ui/ui-frontend/projects/identity/src/app/subrogation/subrogate-user/subrogate-user-list/subrogate-user-list.component.html +++ b/ui/ui-frontend/projects/identity/src/app/subrogation/subrogate-user/subrogate-user-list/subrogate-user-list.component.html @@ -2,9 +2,9 @@
      -
      {{'SUBROGATION.HOME.RESULTS_TABLE.NAME' | translate}}
      -
      {{'SUBROGATION.HOME.RESULTS_TABLE.CRITICITY' | translate}}
      -
      {{'SUBROGATION.HOME.RESULTS_TABLE.GROUP' | translate}}
      +
      {{ 'SUBROGATION.HOME.RESULTS_TABLE.NAME' | translate }}
      +
      {{ 'SUBROGATION.HOME.RESULTS_TABLE.CRITICITY' | translate }}
      +
      {{ 'SUBROGATION.HOME.RESULTS_TABLE.GROUP' | translate }}
      ID
      @@ -13,9 +13,15 @@
      -
      {{ subrogableUser?.lastname }} {{ subrogableUser?.firstname }}
      @@ -40,21 +46,30 @@
      {{ getGroup(subrogableUser)?.name }}
      {{ subrogableUser?.identifier }}
      -
      - {{'SUBROGATION.HOME.SUBROGATION_WIP' | translate}} - - {{'SUBROGATION.HOME.SUBROGATE_BY' | translate : {param1: subrogableUser.superUserEmail} }} +
      + {{ 'SUBROGATION.HOME.SUBROGATION_WIP' | translate }} + + {{ 'SUBROGATION.HOME.SUBROGATE_BY' | translate: { param1: subrogableUser.superUserEmail } }}
      @@ -62,18 +77,18 @@
      -
      -
      -
      +
      +
      +
      -
      {{'COMMON.NO_RESULT' | translate}}
      -
      +
      {{ 'COMMON.NO_RESULT' | translate }}
      + - +
      - {{'COMMON.SHOW_MORE_RESULTS' | translate}} + {{ 'COMMON.SHOW_MORE_RESULTS' | translate }}
      @@ -81,4 +96,4 @@
      -
      \ No newline at end of file + diff --git a/ui/ui-frontend/projects/identity/src/app/subrogation/subrogate-user/subrogate-user-list/subrogate-user-list.component.scss b/ui/ui-frontend/projects/identity/src/app/subrogation/subrogate-user/subrogate-user-list/subrogate-user-list.component.scss index b6a3160d3ab..602cfc4edb5 100644 --- a/ui/ui-frontend/projects/identity/src/app/subrogation/subrogate-user/subrogate-user-list/subrogate-user-list.component.scss +++ b/ui/ui-frontend/projects/identity/src/app/subrogation/subrogate-user/subrogate-user-list/subrogate-user-list.component.scss @@ -1,32 +1,31 @@ @import '~ui-frontend-common/sass/variables/colors'; .criticity-column { - display: flex; - align-items: center; + display: flex; + align-items: center; } #rectangle-criticity-high { - width: 20px; - height: 10px; - border-radius: 3px; - background: var(--vitamui-grey); - margin-right: 5px; + width: 20px; + height: 10px; + border-radius: 3px; + background: var(--vitamui-grey); + margin-right: 5px; } #rectangle-criticity-low { - width: 20px; - height: 10px; - border-radius: 3px; - background: var(--vitamui-grey-300); - margin-right: 5px; + width: 20px; + height: 10px; + border-radius: 3px; + background: var(--vitamui-grey-300); + margin-right: 5px; } .user-in-subrogation-label { - color: red; + color: red; } - .user-current-in-subrogation-label { - color: red; - margin-left: 20px; + color: red; + margin-left: 20px; } diff --git a/ui/ui-frontend/projects/identity/src/app/subrogation/subrogate-user/subrogate-user-list/subrogate-user-list.component.ts b/ui/ui-frontend/projects/identity/src/app/subrogation/subrogate-user/subrogate-user-list/subrogate-user-list.component.ts index 0ee021d2195..9bc2ad1b04d 100644 --- a/ui/ui-frontend/projects/identity/src/app/subrogation/subrogate-user/subrogate-user-list/subrogate-user-list.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/subrogation/subrogate-user/subrogate-user-list/subrogate-user-list.component.ts @@ -36,8 +36,21 @@ */ import { forkJoin, Observable, Subject } from 'rxjs'; import { - ApplicationId, AuthService, AuthUser, buildCriteriaFromSearch, Criterion, DEFAULT_PAGE_SIZE, Direction, - Group, InfiniteScrollTable, Operators, PageRequest, Profile, SearchQuery, SubrogationModalService, SubrogationUser + ApplicationId, + AuthService, + AuthUser, + buildCriteriaFromSearch, + Criterion, + DEFAULT_PAGE_SIZE, + Direction, + Group, + InfiniteScrollTable, + Operators, + PageRequest, + Profile, + SearchQuery, + SubrogationModalService, + SubrogationUser, } from 'ui-frontend-common'; import { Component, Input, OnDestroy, OnInit } from '@angular/core'; @@ -53,10 +66,9 @@ const MAXIMUM_CRITICALITY = 2; @Component({ selector: 'app-subrogate-user-list', templateUrl: './subrogate-user-list.component.html', - styleUrls: ['./subrogate-user-list.component.scss'] + styleUrls: ['./subrogate-user-list.component.scss'], }) export class SubrogateUserListComponent extends InfiniteScrollTable implements OnDestroy, OnInit { - @Input() emailDomains: string[]; // tslint:disable-next-line:no-input-rename @@ -68,22 +80,14 @@ export class SubrogateUserListComponent extends InfiniteScrollTable = []; + private groups: Array<{ id: string; group: any }> = []; overridePendingChange: true; loaded = false; customerId: string; currenteUser: AuthUser; private readonly searchChange = new Subject(); - private readonly searchKeys = [ - 'firstname', - 'lastname', - 'email', - 'mobile', - 'phone', - 'identifier' - ]; - + private readonly searchKeys = ['firstname', 'lastname', 'email', 'mobile', 'phone', 'identifier']; constructor( public subrogationService: SubrogationService, @@ -96,15 +100,13 @@ export class SubrogateUserListComponent extends InfiniteScrollTable this.refreshDataList()); // when the list is reloaded, we retrieve the groups . this.updatedData.subscribe(() => { - - const groupIds = new Set (this.dataSource.map((subrogationUser: SubrogationUser) => subrogationUser.groupId)); + const groupIds = new Set(this.dataSource.map((subrogationUser: SubrogationUser) => subrogationUser.groupId)); const observables = new Array>(); groupIds.forEach((groupId) => { @@ -121,17 +123,18 @@ export class SubrogateUserListComponent extends InfiniteScrollTable !subrogationUser.criticality) - .forEach(((subrogationUser: SubrogationUser) => { - const subrogateUserGroup = this.getGroup(subrogationUser); - const subroUser = subrogations.find((s) => s.surrogate === subrogationUser.email); - if (subroUser && subroUser.superUser) { - subrogationUser.superUserEmail = subroUser.superUser; - } - if (subrogateUserGroup) { - subrogationUser.criticality = this.computeCriticality(subrogateUserGroup.profiles); - } - })); + this.dataSource + .filter((subrogationUser: SubrogationUser) => !subrogationUser.criticality) + .forEach((subrogationUser: SubrogationUser) => { + const subrogateUserGroup = this.getGroup(subrogationUser); + const subroUser = subrogations.find((s) => s.surrogate === subrogationUser.email); + if (subroUser && subroUser.superUser) { + subrogationUser.superUserEmail = subroUser.superUser; + } + if (subrogateUserGroup) { + subrogationUser.criticality = this.computeCriticality(subrogateUserGroup.profiles); + } + }); this.loaded = true; this.pending = false; @@ -164,7 +167,7 @@ export class SubrogateUserListComponent extends InfiniteScrollTable { const query: SearchQuery = { - criteria: [ - ...this._getCriterionArrayToCustomer(), - ...buildCriteriaFromSearch(this._searchText, this.searchKeys) - ] + criteria: [...this._getCriterionArrayToCustomer(), ...buildCriteriaFromSearch(this._searchText, this.searchKeys)], }; this._search(query); @@ -196,12 +196,13 @@ export class SubrogateUserListComponent extends InfiniteScrollTable
      - {{'SUBROGATION.HOME.TITLE' | translate}} + {{ 'SUBROGATION.HOME.TITLE' | translate }} - -
      + +
      diff --git a/ui/ui-frontend/projects/identity/src/app/subrogation/subrogate-user/subrogate-user.component.spec.ts b/ui/ui-frontend/projects/identity/src/app/subrogation/subrogate-user/subrogate-user.component.spec.ts index 0f57077fda3..0d9442ccec6 100644 --- a/ui/ui-frontend/projects/identity/src/app/subrogation/subrogate-user/subrogate-user.component.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/subrogation/subrogate-user/subrogate-user.component.spec.ts @@ -48,12 +48,9 @@ describe('SubrogateUserComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [VitamUICommonTestModule], - declarations: [ SubrogateUserComponent ], - providers: [ - { provide: ActivatedRoute, useValue: { data: EMPTY } }, - ] - }) - .compileComponents(); + declarations: [SubrogateUserComponent], + providers: [{ provide: ActivatedRoute, useValue: { data: EMPTY } }], + }).compileComponents(); })); beforeEach(() => { diff --git a/ui/ui-frontend/projects/identity/src/app/subrogation/subrogate-user/subrogate-user.component.ts b/ui/ui-frontend/projects/identity/src/app/subrogation/subrogate-user/subrogate-user.component.ts index 8095394b18e..3d2ab2a8570 100644 --- a/ui/ui-frontend/projects/identity/src/app/subrogation/subrogate-user/subrogate-user.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/subrogation/subrogate-user/subrogate-user.component.ts @@ -45,17 +45,16 @@ import { CustomerSelectionService, GlobalEventService, MenuOption, - SubrogationModalService + SubrogationModalService, } from 'ui-frontend-common'; import { CustomerSelectService } from '../customer-select.service'; @Component({ selector: 'app-subrogate-user', templateUrl: './subrogate-user.component.html', - styleUrls: ['./subrogate-user.component.scss'] + styleUrls: ['./subrogate-user.component.scss'], }) export class SubrogateUserComponent extends AppRootComponent implements OnInit, OnDestroy { - public customer: Customer; public customers: MenuOption[]; public search: string; @@ -69,33 +68,38 @@ export class SubrogateUserComponent extends AppRootComponent implements OnInit, private route: ActivatedRoute, private subrogationModalService: SubrogationModalService, private customerSelectService: CustomerSelectService, - private customerSelectionService: CustomerSelectionService + private customerSelectionService: CustomerSelectionService, ) { super(route); } ngOnInit() { - this.customerSelectService.getAll(true).pipe(switchMap((options) => { - this.customers = options; - this.customerSelectionService.setCustomers(options); - return this.route.paramMap; - })).subscribe((paramMap) => { - const routeCustomerId = paramMap.get('customerId'); - const currentCustomerId = this.customerSelectionService.getSelectedCustomerId(); + this.customerSelectService + .getAll(true) + .pipe( + switchMap((options) => { + this.customers = options; + this.customerSelectionService.setCustomers(options); + return this.route.paramMap; + }), + ) + .subscribe((paramMap) => { + const routeCustomerId = paramMap.get('customerId'); + const currentCustomerId = this.customerSelectionService.getSelectedCustomerId(); - if (!currentCustomerId || currentCustomerId !== routeCustomerId) { - this.customerSelectionService.setCustomerId(routeCustomerId); - this.updateCustomer(routeCustomerId); - } else { - this.updateCustomer(currentCustomerId); - } + if (!currentCustomerId || currentCustomerId !== routeCustomerId) { + this.customerSelectionService.setCustomerId(routeCustomerId); + this.updateCustomer(routeCustomerId); + } else { + this.updateCustomer(currentCustomerId); + } - this.globalEventService.customerEvent.pipe(takeUntil(this.destroyer$)).subscribe((customerId: string) => { - if (!this.customer || this.customer.identifier !== customerId) { - this.changeCustomer(customerId); - } - }); - }); + this.globalEventService.customerEvent.pipe(takeUntil(this.destroyer$)).subscribe((customerId: string) => { + if (!this.customer || this.customer.identifier !== customerId) { + this.changeCustomer(customerId); + } + }); + }); } ngOnDestroy() { @@ -118,8 +122,7 @@ export class SubrogateUserComponent extends AppRootComponent implements OnInit, private updateCustomer(customerId: string): void { const customers = this.customerSelectService.getCustomers(); if (customers) { - this.customer = customers.find(value => value.id === customerId); + this.customer = customers.find((value) => value.id === customerId); } } - } diff --git a/ui/ui-frontend/projects/identity/src/app/subrogation/subrogation-resolver.service.spec.ts b/ui/ui-frontend/projects/identity/src/app/subrogation/subrogation-resolver.service.spec.ts index a7f5de7ac8f..d2d6bbf1e10 100644 --- a/ui/ui-frontend/projects/identity/src/app/subrogation/subrogation-resolver.service.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/subrogation/subrogation-resolver.service.spec.ts @@ -40,7 +40,6 @@ import { CustomerSelectService } from './customer-select.service'; import { SubrogationResolver } from './subrogation-resolver.service'; describe('SubrogationResolverService', () => { - beforeEach(() => { const customerSearchServiceSpy = jasmine.createSpyObj('CustomerSelectService', ['search']); const routerSpy = jasmine.createSpyObj('Router', ['navigate']); @@ -50,7 +49,7 @@ describe('SubrogationResolverService', () => { SubrogationResolver, { provide: CustomerSelectService, useValue: customerSearchServiceSpy }, { provide: Router, useValue: routerSpy }, - ] + ], }); }); diff --git a/ui/ui-frontend/projects/identity/src/app/subrogation/subrogation-resolver.service.ts b/ui/ui-frontend/projects/identity/src/app/subrogation/subrogation-resolver.service.ts index 1ac9747b15e..01501bf36ba 100644 --- a/ui/ui-frontend/projects/identity/src/app/subrogation/subrogation-resolver.service.ts +++ b/ui/ui-frontend/projects/identity/src/app/subrogation/subrogation-resolver.service.ts @@ -44,24 +44,25 @@ import { Resolve, Router } from '@angular/router'; import { CustomerSelectService } from './customer-select.service'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class SubrogationResolver implements Resolve { - - constructor(private customerSearchService: CustomerSelectService, private router: Router) { } + constructor( + private customerSearchService: CustomerSelectService, + private router: Router, + ) {} resolve(): Observable { - return this.customerSearchService.getAll(true) - .pipe( - map((customers: MenuOption[]) => { - if (customers) { - return customers; - } else { - this.router.navigate(['/']); + return this.customerSearchService.getAll(true).pipe( + map((customers: MenuOption[]) => { + if (customers) { + return customers; + } else { + this.router.navigate(['/']); - return null; - } - }) - ); + return null; + } + }), + ); } } diff --git a/ui/ui-frontend/projects/identity/src/app/subrogation/subrogation-routing.module.ts b/ui/ui-frontend/projects/identity/src/app/subrogation/subrogation-routing.module.ts index 9668bba47c5..741fbdfce9a 100644 --- a/ui/ui-frontend/projects/identity/src/app/subrogation/subrogation-routing.module.ts +++ b/ui/ui-frontend/projects/identity/src/app/subrogation/subrogation-routing.module.ts @@ -41,12 +41,11 @@ import { VitamUICustomerSelectComponent } from 'ui-frontend-common'; import { SubrogateUserComponent } from './subrogate-user/subrogate-user.component'; import { SubrogationResolver } from './subrogation-resolver.service'; - const routes: Route[] = [ { path: '', redirectTo: 'customer', - pathMatch: 'full' + pathMatch: 'full', }, { path: 'customer', @@ -56,18 +55,12 @@ const routes: Route[] = [ { path: 'customer/:customerId', component: SubrogateUserComponent, - } + }, ]; - @NgModule({ declarations: [], - imports: [ - CommonModule, - RouterModule.forChild(routes), - ], - exports: [ - RouterModule - ] + imports: [CommonModule, RouterModule.forChild(routes)], + exports: [RouterModule], }) -export class SubrogationRoutingModule { } +export class SubrogationRoutingModule {} diff --git a/ui/ui-frontend/projects/identity/src/app/subrogation/subrogation.module.ts b/ui/ui-frontend/projects/identity/src/app/subrogation/subrogation.module.ts index e993211d1d7..ab7ad9523f5 100644 --- a/ui/ui-frontend/projects/identity/src/app/subrogation/subrogation.module.ts +++ b/ui/ui-frontend/projects/identity/src/app/subrogation/subrogation.module.ts @@ -62,15 +62,9 @@ import { SubrogationService } from './subrogation.service'; MatProgressSpinnerModule, MatProgressBarModule, ReactiveFormsModule, - SubrogationRoutingModule + SubrogationRoutingModule, ], - declarations: [ - SubrogateUserListComponent, - SubrogateUserComponent - ], - providers: [ - SubrogationResolver, - SubrogationService, - ] + declarations: [SubrogateUserListComponent, SubrogateUserComponent], + providers: [SubrogationResolver, SubrogationService], }) -export class SubrogationModule { } +export class SubrogationModule {} diff --git a/ui/ui-frontend/projects/identity/src/app/subrogation/subrogation.service.spec.ts b/ui/ui-frontend/projects/identity/src/app/subrogation/subrogation.service.spec.ts index 7c937d9ba4c..1f1ce6feaa1 100644 --- a/ui/ui-frontend/projects/identity/src/app/subrogation/subrogation.service.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/subrogation/subrogation.service.spec.ts @@ -41,15 +41,10 @@ import { BASE_URL, WINDOW_LOCATION } from 'ui-frontend-common'; import { SubrogationService } from './subrogation.service'; describe('SubrogationService', () => { - beforeEach(() => { TestBed.configureTestingModule({ imports: [HttpClientTestingModule], - providers: [ - SubrogationService, - { provide: BASE_URL, useValue: '/fake-api' }, - { provide: WINDOW_LOCATION, useValue: {} }, - ] + providers: [SubrogationService, { provide: BASE_URL, useValue: '/fake-api' }, { provide: WINDOW_LOCATION, useValue: {} }], }); }); diff --git a/ui/ui-frontend/projects/identity/src/app/subrogation/subrogation.service.ts b/ui/ui-frontend/projects/identity/src/app/subrogation/subrogation.service.ts index 3a14c46a68a..ecb1c33bbd7 100644 --- a/ui/ui-frontend/projects/identity/src/app/subrogation/subrogation.service.ts +++ b/ui/ui-frontend/projects/identity/src/app/subrogation/subrogation.service.ts @@ -36,8 +36,14 @@ */ import { Observable } from 'rxjs'; import { - Criterion, Group, Operators, SearchQuery, SearchService, Subrogation, SubrogationApiService, - SubrogationUser + Criterion, + Group, + Operators, + SearchQuery, + SearchService, + Subrogation, + SubrogationApiService, + SubrogationUser, } from 'ui-frontend-common'; import { HttpClient, HttpParams } from '@angular/common/http'; @@ -46,11 +52,14 @@ import { Injectable } from '@angular/core'; import { UserGenericApiService } from './user-generic-api.service'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class SubrogationService extends SearchService { - - constructor(http: HttpClient, userGenericApi: UserGenericApiService, private subrogationApiService: SubrogationApiService) { + constructor( + http: HttpClient, + userGenericApi: UserGenericApiService, + private subrogationApiService: SubrogationApiService, + ) { super(http, userGenericApi); } @@ -68,5 +77,4 @@ export class SubrogationService extends SearchService { return this.subrogationApiService.getAllByParams(params); } - } diff --git a/ui/ui-frontend/projects/identity/src/app/subrogation/user-generic-api.service.spec.ts b/ui/ui-frontend/projects/identity/src/app/subrogation/user-generic-api.service.spec.ts index 45de7ce1d28..a6110c20a21 100644 --- a/ui/ui-frontend/projects/identity/src/app/subrogation/user-generic-api.service.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/subrogation/user-generic-api.service.spec.ts @@ -41,14 +41,12 @@ import { BASE_URL } from 'ui-frontend-common'; import { UserGenericApiService } from './user-generic-api.service'; describe('UserGenericApiService', () => { - beforeEach(() => TestBed.configureTestingModule({ - imports: [ - HttpClientTestingModule, - ], - providers: [ - { provide: BASE_URL, useValue: '/fake-api' }, - ] - })); + beforeEach(() => + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule], + providers: [{ provide: BASE_URL, useValue: '/fake-api' }], + }), + ); it('should be created', () => { const service: UserGenericApiService = TestBed.inject(UserGenericApiService); diff --git a/ui/ui-frontend/projects/identity/src/app/subrogation/user-generic-api.service.ts b/ui/ui-frontend/projects/identity/src/app/subrogation/user-generic-api.service.ts index 4226a767b88..33c90aeb218 100644 --- a/ui/ui-frontend/projects/identity/src/app/subrogation/user-generic-api.service.ts +++ b/ui/ui-frontend/projects/identity/src/app/subrogation/user-generic-api.service.ts @@ -41,10 +41,9 @@ import { Observable } from 'rxjs'; import { BaseHttpClient, BASE_URL, PageRequest, PaginatedResponse, SubrogationUser } from 'ui-frontend-common'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class UserGenericApiService extends BaseHttpClient { - constructor(http: HttpClient, @Inject(BASE_URL) baseUrl: string) { super(http, baseUrl + '/subrogations/users/generic'); } @@ -52,5 +51,4 @@ export class UserGenericApiService extends BaseHttpClient { getAllPaginated(pageRequest: PageRequest, embedded?: string, headers?: HttpHeaders): Observable> { return super.getAllPaginated(pageRequest, embedded, headers); } - } diff --git a/ui/ui-frontend/projects/identity/src/app/user/group-attribution/group-attribution.component.html b/ui/ui-frontend/projects/identity/src/app/user/group-attribution/group-attribution.component.html index 8e1fa104740..ae961cc3280 100644 --- a/ui/ui-frontend/projects/identity/src/app/user/group-attribution/group-attribution.component.html +++ b/ui/ui-frontend/projects/identity/src/app/user/group-attribution/group-attribution.component.html @@ -4,10 +4,12 @@
      - +
      - - + +
      diff --git a/ui/ui-frontend/projects/identity/src/app/user/group-attribution/group-attribution.component.ts b/ui/ui-frontend/projects/identity/src/app/user/group-attribution/group-attribution.component.ts index 1c18e563d6d..84cf91b3e33 100644 --- a/ui/ui-frontend/projects/identity/src/app/user/group-attribution/group-attribution.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/user/group-attribution/group-attribution.component.ts @@ -46,7 +46,7 @@ import { UserService } from '../user.service'; export const GROUP_ATTRIBUTION_VALUE_ACCESSOR: any = { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => GroupAttributionComponent), - multi: true + multi: true, }; @Component({ @@ -56,8 +56,6 @@ export const GROUP_ATTRIBUTION_VALUE_ACCESSOR: any = { providers: [GROUP_ATTRIBUTION_VALUE_ACCESSOR], }) export class GroupAttributionComponent implements OnInit { - - user: User; activeGroups: GroupSelection[]; selectedGroupName: string; @@ -75,7 +73,8 @@ export class GroupAttributionComponent implements OnInit { constructor( private userService: UserService, public dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) public data: any) { } + @Inject(MAT_DIALOG_DATA) public data: any, + ) {} public ngOnInit(): void { this.user = this.data[0]; @@ -84,9 +83,8 @@ export class GroupAttributionComponent implements OnInit { } public resetActiveGroups(): void { - this.activeGroups = this.data[this.CUSTOMER_ACTIVE_PROFILE_GROUPS_INDEX]; - this.activeGroups.sort((a, b) => a.name.toUpperCase() < b.name.toUpperCase() ? -1 : 1); + this.activeGroups.sort((a, b) => (a.name.toUpperCase() < b.name.toUpperCase() ? -1 : 1)); if (this.data[1]) { this.selectedGroupName = this.data[1].name; const selectedGroup = this.activeGroups.find((group) => group.id === this.data[1].id); @@ -96,24 +94,23 @@ export class GroupAttributionComponent implements OnInit { } } - updateGroup(event: any) { - const selectedGroup: GroupSelection = event; - this.selectedGroupName = selectedGroup.name; - this.user.groupId = selectedGroup.id; - this.user.level = selectedGroup.level; + updateGroup(event: any) { + const selectedGroup: GroupSelection = event; + this.selectedGroupName = selectedGroup.name; + this.user.groupId = selectedGroup.id; + this.user.level = selectedGroup.level; } public saveUserUpdate(): void { - this.userService.patch({ id: this.user.id, groupId: this.user.groupId }) - .subscribe( - () => this.dialogRef.close(true), - (error) => { - console.error(error); - }); + this.userService.patch({ id: this.user.id, groupId: this.user.groupId }).subscribe( + () => this.dialogRef.close(true), + (error) => { + console.error(error); + }, + ); } public onCancel(): void { this.dialogRef.close(); } - } diff --git a/ui/ui-frontend/projects/identity/src/app/user/group-attribution/group-attribution.module.ts b/ui/ui-frontend/projects/identity/src/app/user/group-attribution/group-attribution.module.ts index f787f2cb8c9..cf580a7b66b 100644 --- a/ui/ui-frontend/projects/identity/src/app/user/group-attribution/group-attribution.module.ts +++ b/ui/ui-frontend/projects/identity/src/app/user/group-attribution/group-attribution.module.ts @@ -39,30 +39,15 @@ import { NgModule } from '@angular/core'; import { MatTooltipModule } from '@angular/material/tooltip'; import { VitamUICommonModule } from 'ui-frontend-common'; -import {CollapseDirectiveModule, SearchBarModule} from 'ui-frontend-common'; +import { CollapseDirectiveModule, SearchBarModule } from 'ui-frontend-common'; import { SharedModule } from '../../shared/shared.module'; import { GroupAttributionComponent } from './group-attribution.component'; import { GroupDetailComponent } from './group-detail/group-detail.component'; -import {GroupListComponent} from './group-list/group-list.component'; +import { GroupListComponent } from './group-list/group-list.component'; @NgModule({ - imports: [ - CommonModule, - SharedModule, - MatTooltipModule, - CollapseDirectiveModule, - SearchBarModule, - VitamUICommonModule, - ], - declarations: [ - GroupAttributionComponent, - GroupDetailComponent, - GroupListComponent, - ], - exports: [ - GroupAttributionComponent, - GroupDetailComponent, - GroupListComponent, - ] + imports: [CommonModule, SharedModule, MatTooltipModule, CollapseDirectiveModule, SearchBarModule, VitamUICommonModule], + declarations: [GroupAttributionComponent, GroupDetailComponent, GroupListComponent], + exports: [GroupAttributionComponent, GroupDetailComponent, GroupListComponent], }) -export class GroupAttributionModule { } +export class GroupAttributionModule {} diff --git a/ui/ui-frontend/projects/identity/src/app/user/group-attribution/group-detail/group-detail.component.html b/ui/ui-frontend/projects/identity/src/app/user/group-attribution/group-detail/group-detail.component.html index 9bbc86a68b9..1b62df80616 100644 --- a/ui/ui-frontend/projects/identity/src/app/user/group-attribution/group-detail/group-detail.component.html +++ b/ui/ui-frontend/projects/identity/src/app/user/group-attribution/group-detail/group-detail.component.html @@ -1,8 +1,8 @@
      -
      {{'USER.GROUP.DESCRIPTION' | translate}}
      -
      {{'USER.GROUP.LEVEL' | translate}}
      -
      {{'USER.GROUP.PROFILE' | translate}}
      +
      {{ 'USER.GROUP.DESCRIPTION' | translate }}
      +
      {{ 'USER.GROUP.LEVEL' | translate }}
      +
      {{ 'USER.GROUP.PROFILE' | translate }}
      @@ -11,14 +11,19 @@
      {{ group?.description }}
      {{ group?.level }}
      -
      +
      {{ profile?.name | titlecase }}
      - +
      diff --git a/ui/ui-frontend/projects/identity/src/app/user/group-attribution/group-detail/group-detail.component.ts b/ui/ui-frontend/projects/identity/src/app/user/group-attribution/group-detail/group-detail.component.ts index efa729554c6..35420fee92d 100644 --- a/ui/ui-frontend/projects/identity/src/app/user/group-attribution/group-detail/group-detail.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/user/group-attribution/group-detail/group-detail.component.ts @@ -41,22 +41,21 @@ import { GroupService } from '../../../group/group.service'; @Component({ selector: 'app-group-detail', templateUrl: './group-detail.component.html', - styleUrls: ['./group-detail.component.scss'] + styleUrls: ['./group-detail.component.scss'], }) -export class GroupDetailComponent implements OnInit { - +export class GroupDetailComponent implements OnInit { @Input() group: Group; public displayedGroup: Group; - public groupProfiles: Profile []; + public groupProfiles: Profile[]; - constructor(private groupService: GroupService) { } + constructor(private groupService: GroupService) {} ngOnInit(): void { this.getGroupProfiles(this.group); } getGroupProfiles(group: Group) { - if(group){ + if (group) { this.groupService.get(group.id).subscribe((groupRetrieved) => { this.groupProfiles = groupRetrieved.profiles; }); diff --git a/ui/ui-frontend/projects/identity/src/app/user/group-attribution/group-list/group-list.component.html b/ui/ui-frontend/projects/identity/src/app/user/group-attribution/group-list/group-list.component.html index 086b1b2a315..d55ed6653ee 100644 --- a/ui/ui-frontend/projects/identity/src/app/user/group-attribution/group-list/group-list.component.html +++ b/ui/ui-frontend/projects/identity/src/app/user/group-attribution/group-list/group-list.component.html @@ -1,24 +1,41 @@ -
      {{'USER.GROUP.MODAL.AUTORISATION_STEP.TITLE' | translate}}
      +
      {{ 'USER.GROUP.MODAL.AUTORISATION_STEP.TITLE' | translate }}
      - +
      -
      {{'USER.GROUP.MODAL.AUTORISATION_STEP.ATTRIBUATE_GROUP' | translate}} :
       {{ groupName }} +
      {{ 'USER.GROUP.MODAL.AUTORISATION_STEP.ATTRIBUATE_GROUP' | translate }} :
      +  {{ groupName }}
      -
      {{'USER.GROUP.MODAL.AUTORISATION_STEP.RESULTS_TABLE.GROUP_LABEL' | translate}}
      +
      {{ 'USER.GROUP.MODAL.AUTORISATION_STEP.RESULTS_TABLE.GROUP_LABEL' | translate }}
      -
      -
      -
      {{group?.name}}
      - +
      +
      +
      {{ group?.name }}
      +
      diff --git a/ui/ui-frontend/projects/identity/src/app/user/group-attribution/group-list/group-list.component.ts b/ui/ui-frontend/projects/identity/src/app/user/group-attribution/group-list/group-list.component.ts index cf224bed6bf..e3af3fe8fd4 100644 --- a/ui/ui-frontend/projects/identity/src/app/user/group-attribution/group-list/group-list.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/user/group-attribution/group-list/group-list.component.ts @@ -96,7 +96,7 @@ export class GroupListComponent implements OnInit { this.groups = this.groups.filter( (group) => group.name.toLocaleLowerCase().includes(text.toLocaleLowerCase()) || - group.description.toLocaleLowerCase().includes(text.toLocaleLowerCase()) + group.description.toLocaleLowerCase().includes(text.toLocaleLowerCase()), ); } } diff --git a/ui/ui-frontend/projects/identity/src/app/user/user-create/user-create.component.ts b/ui/ui-frontend/projects/identity/src/app/user/user-create/user-create.component.ts index 76faa04977c..a8c69f6e2cb 100644 --- a/ui/ui-frontend/projects/identity/src/app/user/user-create/user-create.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/user/user-create/user-create.component.ts @@ -40,7 +40,16 @@ import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; import { Subscription } from 'rxjs'; import { - AdminUserProfile, AuthService, ConfirmDialogService, CountryOption, CountryService, Customer, Group, isRootLevel, OtpState, StartupService + AdminUserProfile, + AuthService, + ConfirmDialogService, + CountryOption, + CountryService, + Customer, + Group, + isRootLevel, + OtpState, + StartupService, } from 'ui-frontend-common'; import { UserInfo } from 'ui-frontend-common'; import { GroupSelection } from './../group-selection.interface'; @@ -53,15 +62,15 @@ import { UserCreateValidators } from './user-create.validators'; const LAST_STEP_INDEX = 2; -const emailValidator: RegExp = /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/; +const emailValidator: RegExp = + /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/; @Component({ selector: 'app-user-create', templateUrl: './user-create.component.html', - styleUrls: ['./user-create.component.scss'] + styleUrls: ['./user-create.component.scss'], }) export class UserCreateComponent implements OnInit, OnDestroy { - public maxStreetLength: number; public form: FormGroup; public formEmail: FormGroup; @@ -79,7 +88,7 @@ export class UserCreateComponent implements OnInit, OnDestroy { constructor( public dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) public data: { userInfo: AdminUserProfile, customer: Customer, groups: Group[] }, + @Inject(MAT_DIALOG_DATA) public data: { userInfo: AdminUserProfile; customer: Customer; groups: Group[] }, private formBuilder: FormBuilder, private userService: UserService, private userInfoService: UserInfoService, @@ -87,8 +96,8 @@ export class UserCreateComponent implements OnInit, OnDestroy { private userCreateValidators: UserCreateValidators, private confirmDialogService: ConfirmDialogService, private countryService: CountryService, - private startupService: StartupService - ) { } + private startupService: StartupService, + ) {} ngOnInit() { this.fullGroup = this.data.groups; @@ -99,7 +108,7 @@ export class UserCreateComponent implements OnInit, OnDestroy { description: group.description, selected: false, profiles: group.profiles, - level: group.level + level: group.level, }; }) as GroupSelection[]; @@ -108,25 +117,20 @@ export class UserCreateComponent implements OnInit, OnDestroy { this.groups = this.groups.filter((group: GroupSelection) => group.id !== this.authService.user.groupId); } - this.groups.sort((a, b) => a.name.toUpperCase() < b.name.toUpperCase() ? -1 : a.name.toUpperCase() > b.name.toUpperCase() ? 1 : 0); + this.groups.sort((a, b) => (a.name.toUpperCase() < b.name.toUpperCase() ? -1 : a.name.toUpperCase() > b.name.toUpperCase() ? 1 : 0)); this.customer = this.data.customer; this.connectedUserInfo = this.data.userInfo; this.formEmail = this.formBuilder.group({ emailFirstPart: null, - domain: [this.customer.emailDomains[0]] + domain: [this.customer.emailDomains[0]], }); this.form = this.formBuilder.group( { - enabled: true, - email: [null, [ - Validators.required, - Validators.pattern(emailValidator) - ], - this.userCreateValidators.uniqueEmail()], + email: [null, [Validators.required, Validators.pattern(emailValidator)], this.userCreateValidators.uniqueEmail()], firstname: [null, Validators.required], lastname: [null, Validators.required], mobile: [null, [Validators.pattern(/^[+]{1}[0-9]{11,12}$/)]], @@ -134,10 +138,12 @@ export class UserCreateComponent implements OnInit, OnDestroy { domain: [this.customer.emailDomains[0], Validators.required], groupId: [null, Validators.required], customerId: this.authService.user.customerId, - otp: [{ - value: this.customer.otp !== OtpState.DEACTIVATED, - disabled: this.customer.otp !== OtpState.OPTIONAL - }], + otp: [ + { + value: this.customer.otp !== OtpState.DEACTIVATED, + disabled: this.customer.otp !== OtpState.OPTIONAL, + }, + ], type: [{ value: 'NOMINATIVE', disabled: !this.connectedUserInfo.genericAllowed }], subrogeable: false, status: null, @@ -146,36 +152,38 @@ export class UserCreateComponent implements OnInit, OnDestroy { street: [null, Validators.maxLength(this.maxStreetLength)], zipCode: [null], city: [null], - country: ['FR'] + country: ['FR'], }), internalCode: [null], siteCode: [null], centerCode: [null], - autoProvisioningEnabled: false + autoProvisioningEnabled: false, }, - { validator: UserValidators.missingPhoneNumber } + { validator: UserValidators.missingPhoneNumber }, ); this.applyUserProfile(); this.onChanges(); this.keyPressSubscription = this.confirmDialogService.listenToEscapeKeyPress(this.dialogRef).subscribe(() => this.onCancel()); - this.form.get('address').valueChanges.pipe( - map((value) => !value.street && !value.zipCode && !value.city), - distinctUntilChanged() - ).subscribe((addressEmpty) => { - this.addressEmpty = addressEmpty; - if (addressEmpty) { - this.form.get('address.street').clearValidators(); - this.form.get('address.zipCode').clearValidators(); - this.form.get('address.city').clearValidators(); - } else { - this.form.get('address.street').setValidators(Validators.required); - this.form.get('address.zipCode').setValidators(Validators.required); - this.form.get('address.city').setValidators(Validators.required); - } - this.form.get('address').updateValueAndValidity({ emitEvent: false }); - }); - + this.form + .get('address') + .valueChanges.pipe( + map((value) => !value.street && !value.zipCode && !value.city), + distinctUntilChanged(), + ) + .subscribe((addressEmpty) => { + this.addressEmpty = addressEmpty; + if (addressEmpty) { + this.form.get('address.street').clearValidators(); + this.form.get('address.zipCode').clearValidators(); + this.form.get('address.city').clearValidators(); + } else { + this.form.get('address.street').setValidators(Validators.required); + this.form.get('address.zipCode').setValidators(Validators.required); + this.form.get('address.city').setValidators(Validators.required); + } + this.form.get('address').updateValueAndValidity({ emitEvent: false }); + }); this.countryService.getAvailableCountries().subscribe((values: CountryOption[]) => { this.countries = values; @@ -193,18 +201,12 @@ export class UserCreateComponent implements OnInit, OnDestroy { this.form.get('groupId').setValidators(null); this.form.updateValueAndValidity({ emitEvent: false }); } else if (this.connectedUserInfo.type === 'LIST') { - this.groups = this.connectedUserInfo.profilGroup - .map((group) => { - const profilGroup = this.groups.find((g) => g.id === group.id); - return Object({ id: group.id, - name: group.name, - description: group.description, - selected: false, - profiles: profilGroup?.profiles }); - }); - this.groups.sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0); + this.groups = this.connectedUserInfo.profilGroup.map((group) => { + const profilGroup = this.groups.find((g) => g.id === group.id); + return Object({ id: group.id, name: group.name, description: group.description, selected: false, profiles: profilGroup?.profiles }); + }); + this.groups.sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0)); } - } onCancel() { @@ -216,31 +218,29 @@ export class UserCreateComponent implements OnInit, OnDestroy { } onSubmit() { - if (this.form.invalid) { return; } + if (this.form.invalid) { + return; + } this.creating = true; let status = ''; - this.form.get('enabled').value ? status = 'ENABLED' : status = 'DISABLED'; + this.form.get('enabled').value ? (status = 'ENABLED') : (status = 'DISABLED'); this.form.get('status').setValue(status); - this.userInfoService - .create({ id: null, language: this.customer.language }) - .subscribe( - (response: UserInfo) => { - this.form.get('userInfoId').setValue(response.id); - this.userService.create(this.form.getRawValue()).subscribe( - () => this.dialogRef.close(true), - (error) => { - this.creating = false; - console.error(error); - } - ); - }, - (error) => { - this.creating = false; - console.error(error); - } + this.userInfoService.create({ id: null, language: this.customer.language }).subscribe( + (response: UserInfo) => { + this.form.get('userInfoId').setValue(response.id); + this.userService.create(this.form.getRawValue()).subscribe( + () => this.dialogRef.close(true), + (error) => { + this.creating = false; + console.error(error); + }, + ); + }, + (error) => { + this.creating = false; + console.error(error); + }, ); - - } onChanges(): void { @@ -250,17 +250,24 @@ export class UserCreateComponent implements OnInit, OnDestroy { } firstStepInvalid(): boolean { - return this.form.pending || - this.form.get('email').invalid || this.form.get('email').pending || + return ( + this.form.pending || + this.form.get('email').invalid || + this.form.get('email').pending || this.form.get('firstname').invalid || this.form.get('lastname').invalid || this.form.get('domain').invalid || - this.form.get('enabled').invalid; + this.form.get('enabled').invalid + ); } public thirdStepInvalid(): boolean { - return this.form.get('address').pending || this.form.get('address').invalid || - this.form.get('internalCode').pending || this.form.get('internalCode').invalid; + return ( + this.form.get('address').pending || + this.form.get('address').invalid || + this.form.get('internalCode').pending || + this.form.get('internalCode').invalid + ); } passGroupStep() { @@ -277,5 +284,4 @@ export class UserCreateComponent implements OnInit, OnDestroy { const groupId = selectedGroup.id; this.form.patchValue({ groupId }); } - } diff --git a/ui/ui-frontend/projects/identity/src/app/user/user-create/user-create.module.ts b/ui/ui-frontend/projects/identity/src/app/user/user-create/user-create.module.ts index 1fd4e8d66d6..d115d93bd04 100644 --- a/ui/ui-frontend/projects/identity/src/app/user/user-create/user-create.module.ts +++ b/ui/ui-frontend/projects/identity/src/app/user/user-create/user-create.module.ts @@ -61,10 +61,8 @@ import { UserCreateValidators } from './user-create.validators'; GroupAttributionModule, VitamUICommonModule, ], - declarations: [ - UserCreateComponent, - ], + declarations: [UserCreateComponent], entryComponents: [UserCreateComponent], - providers: [UserCreateValidators] + providers: [UserCreateValidators], }) -export class UserCreateModule { } +export class UserCreateModule {} diff --git a/ui/ui-frontend/projects/identity/src/app/user/user-create/user-create.validators.ts b/ui/ui-frontend/projects/identity/src/app/user/user-create/user-create.validators.ts index 51ebda2979a..74e6d9eee56 100644 --- a/ui/ui-frontend/projects/identity/src/app/user/user-create/user-create.validators.ts +++ b/ui/ui-frontend/projects/identity/src/app/user/user-create/user-create.validators.ts @@ -43,20 +43,17 @@ import { UserService } from '../user.service'; @Injectable() export class UserCreateValidators { - private debounceTime = 400; - constructor(private userService: UserService) { } + constructor(private userService: UserService) {} uniqueEmail = (emailToCheck?: string): AsyncValidatorFn => { return (control: AbstractControl): Observable => { - return timer(this.debounceTime) - .pipe( - switchMap(() => control.value !== emailToCheck ? this.userService.exists(control.value) : of(false)), - take(1), - map((exists: boolean) => exists ? { uniqueEmail: true } : null) - ); + return timer(this.debounceTime).pipe( + switchMap(() => (control.value !== emailToCheck ? this.userService.exists(control.value) : of(false))), + take(1), + map((exists: boolean) => (exists ? { uniqueEmail: true } : null)), + ); }; - } - + }; } diff --git a/ui/ui-frontend/projects/identity/src/app/user/user-info.service.ts b/ui/ui-frontend/projects/identity/src/app/user/user-info.service.ts index 9535b879aa9..ebcab358725 100644 --- a/ui/ui-frontend/projects/identity/src/app/user/user-info.service.ts +++ b/ui/ui-frontend/projects/identity/src/app/user/user-info.service.ts @@ -40,22 +40,19 @@ import { Observable, Subject } from 'rxjs'; import { EMPTY } from 'rxjs'; import { tap } from 'rxjs/operators'; import { User, VitamUISnackBarService } from 'ui-frontend-common'; -import { - BaseUserInfoApiService, SearchService -} from 'ui-frontend-common'; +import { BaseUserInfoApiService, SearchService } from 'ui-frontend-common'; import { UserInfo } from 'ui-frontend-common'; @Injectable({ providedIn: 'root' }) export class UserInfoService extends SearchService { - userInfoUpdated = new Subject(); constructor( private userInfoServiceApi: BaseUserInfoApiService, private snackBarService: VitamUISnackBarService, - http: HttpClient + http: HttpClient, ) { super(http, { getAllPaginated: () => EMPTY }, ''); } @@ -64,7 +61,6 @@ export class UserInfoService extends SearchService { return this.userInfoServiceApi.create(userInfo); } - get(id: string): Observable { return this.userInfoServiceApi.getOne(id); } @@ -73,26 +69,24 @@ export class UserInfoService extends SearchService { return this.userInfoServiceApi.getMyUserInfo(); } - patch(partialUser: { id: string, [key: string]: any }, user: User): Observable { + patch(partialUser: { id: string; [key: string]: any }, user: User): Observable { return this.userInfoServiceApi.patch(partialUser).pipe( tap((response) => this.userInfoUpdated.next(response)), tap( () => { this.snackBarService.open({ message: 'SHARED.SNACKBAR.PROFILE_UPDATE', - translateParams:{ + translateParams: { param1: user.firstname, param2: user.lastname, }, - icon: 'vitamui-icon-key' + icon: 'vitamui-icon-key', }); }, (error) => { this.snackBarService.open({ message: error.error.message, translate: false }); - } - ) + }, + ), ); } - - } diff --git a/ui/ui-frontend/projects/identity/src/app/user/user-list/user-criteria-builder.util.ts b/ui/ui-frontend/projects/identity/src/app/user/user-list/user-criteria-builder.util.ts index ab2c8fcbf4e..6cc3b0339ea 100644 --- a/ui/ui-frontend/projects/identity/src/app/user/user-list/user-criteria-builder.util.ts +++ b/ui/ui-frontend/projects/identity/src/app/user/user-list/user-criteria-builder.util.ts @@ -39,7 +39,7 @@ import { buildCriteriaFromFilters, Criterion, Operators, SearchQuery } from 'ui- const USER_FILTER_CONVERTER: Readonly<{ [key: string]: (values: any[]) => Array }> = { status: (statusList: string[]): SearchQuery[] => { const statusFilters = statusList.filter((status) => status !== 'GENERIC'); - const andCriterionList: Criterion [] = []; + const andCriterionList: Criterion[] = []; if (statusFilters.length > 0) { andCriterionList.push({ key: 'status', value: statusFilters, operator: Operators.in }); @@ -47,9 +47,7 @@ const USER_FILTER_CONVERTER: Readonly<{ [key: string]: (values: any[]) => Array< const genericFilter = statusList.find((status) => status === 'GENERIC'); if (genericFilter) { - andCriterionList.push( - { key: 'type', value: 'GENERIC', operator: Operators.equals } - ); + andCriterionList.push({ key: 'type', value: 'GENERIC', operator: Operators.equals }); } return [{ queryOperator: 'AND', criteria: andCriterionList }]; @@ -71,7 +69,7 @@ const USER_FILTER_CONVERTER: Readonly<{ [key: string]: (values: any[]) => Array< } return [{ key: 'groupId', value: groupList, operator: Operators.in }]; - } + }, }; export function buildCriteriaFromUserFilters(filterMap: { [key: string]: any[] }) { diff --git a/ui/ui-frontend/projects/identity/src/app/user/user-list/user-list.component.html b/ui/ui-frontend/projects/identity/src/app/user/user-list/user-list.component.html index 7c4b810f82e..b234a92e47e 100644 --- a/ui/ui-frontend/projects/identity/src/app/user/user-list/user-list.component.html +++ b/ui/ui-frontend/projects/identity/src/app/user/user-list/user-list.component.html @@ -2,98 +2,133 @@
      - - +
      - {{'USER.HOME.RESULTS_TABLE.STATUS_FILTER.ACTIVE' | translate}} + {{ 'USER.HOME.RESULTS_TABLE.STATUS_FILTER.ACTIVE' | translate }}
      - {{'USER.HOME.RESULTS_TABLE.STATUS_FILTER.BLOCKED' | translate}} + {{ 'USER.HOME.RESULTS_TABLE.STATUS_FILTER.BLOCKED' | translate }}
      - {{'USER.HOME.RESULTS_TABLE.STATUS_FILTER.INACTIVE' | translate}} + {{ 'USER.HOME.RESULTS_TABLE.STATUS_FILTER.INACTIVE' | translate }}
      - {{'USER.HOME.RESULTS_TABLE.STATUS_FILTER.DELETED' | translate}} + {{ 'USER.HOME.RESULTS_TABLE.STATUS_FILTER.DELETED' | translate }}
      - +
      - {{'USER.HOME.RESULTS_TABLE.STATUS_FILTER.GENERIC' | translate}} + {{ 'USER.HOME.RESULTS_TABLE.STATUS_FILTER.GENERIC' | translate }}
      - - - + +
      -
      {{'USER.HOME.RESULTS_TABLE.NAME' | translate}} - +
      + {{ 'USER.HOME.RESULTS_TABLE.NAME' | translate }} +
      -
      {{'COMMON.ID' | translate}} - +
      + {{ 'COMMON.ID' | translate }} +
      -
      {{'USER.HOME.RESULTS_TABLE.LAST_CONNEXION' | translate}} - +
      + {{ 'USER.HOME.RESULTS_TABLE.LAST_CONNEXION' | translate }} +
      - - + - {{'USER.HOME.RESULTS_TABLE.GROUP_LEVEL' | translate}} - + {{ 'USER.HOME.RESULTS_TABLE.GROUP_LEVEL' | translate }} +
      - - + - {{'USER.HOME.RESULTS_TABLE.GROUP' | translate}} + {{ 'USER.HOME.RESULTS_TABLE.GROUP' | translate }}
      - -
      @@ -102,45 +137,41 @@
      - +
      - +
      - +
      -
      x
      +
      + x +
      -
      {{ user?.lastname | uppercase }} {{ user?.firstname }}
      +
      {{ user?.lastname | uppercase }} {{ user?.firstname }}
      {{ user?.identifier }}
      -
      {{ user?.lastConnection|date:'dd/MM/yyyy'|empty}}
      +
      {{ user?.lastConnection | date: 'dd/MM/yyyy' | empty }}
      {{ user?.level }}
      {{ getGroup(user)?.name }}
      -
      -
      -
      -
      -
      - - +
      diff --git a/ui/ui-frontend/projects/identity/src/app/user/user-list/user-list.component.scss b/ui/ui-frontend/projects/identity/src/app/user/user-list/user-list.component.scss index 131fb9b39f9..9281ef2e588 100644 --- a/ui/ui-frontend/projects/identity/src/app/user/user-list/user-list.component.scss +++ b/ui/ui-frontend/projects/identity/src/app/user/user-list/user-list.component.scss @@ -1,5 +1,5 @@ -@import "~ui-frontend-common/sass/variables/colors"; -@import "~ui-frontend-common/sass/mixins/elevation"; +@import '~ui-frontend-common/sass/variables/colors'; +@import '~ui-frontend-common/sass/mixins/elevation'; .parent { position: relative; @@ -49,7 +49,7 @@ vitamui-common-table-filter-option .vitamui-icon { } } -.vitamui-table-head{ +.vitamui-table-head { > div { display: flex; align-items: center; @@ -57,7 +57,7 @@ vitamui-common-table-filter-option .vitamui-icon { } } .padding-user { - padding-left: 2.5rem; + padding-left: 2.5rem; } .text-right { diff --git a/ui/ui-frontend/projects/identity/src/app/user/user-list/user-list.component.ts b/ui/ui-frontend/projects/identity/src/app/user/user-list/user-list.component.ts index a7364dec513..5ee78e763ae 100644 --- a/ui/ui-frontend/projects/identity/src/app/user/user-list/user-list.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/user/user-list/user-list.component.ts @@ -37,36 +37,50 @@ import { merge, Subject, Subscription } from 'rxjs'; import { debounceTime } from 'rxjs/operators'; import { - AdminUserProfile, ApplicationId, AuthService, buildCriteriaFromSearch, collapseAnimation, DEFAULT_PAGE_SIZE, - Direction, Group, InfiniteScrollTable, PageRequest, Role, rotateAnimation, SearchQuery, User, VitamUISnackBarService + AdminUserProfile, + ApplicationId, + AuthService, + buildCriteriaFromSearch, + collapseAnimation, + DEFAULT_PAGE_SIZE, + Direction, + Group, + InfiniteScrollTable, + PageRequest, + Role, + rotateAnimation, + SearchQuery, + User, + VitamUISnackBarService, } from 'ui-frontend-common'; import { - Component, ElementRef, EventEmitter, Inject, Input, LOCALE_ID, OnDestroy, OnInit, Output, - TemplateRef, ViewChild + Component, + ElementRef, + EventEmitter, + Inject, + Input, + LOCALE_ID, + OnDestroy, + OnInit, + Output, + TemplateRef, + ViewChild, } from '@angular/core'; import { CustomerService } from '../../core/customer.service'; import { UserService } from '../user.service'; import { buildCriteriaFromUserFilters } from './user-criteria-builder.util'; - const FILTER_DEBOUNCE_TIME_MS = 400; @Component({ selector: 'app-user-list', templateUrl: './user-list.component.html', styleUrls: ['./user-list.component.scss'], - animations: [ - collapseAnimation, - rotateAnimation, - ] + animations: [collapseAnimation, rotateAnimation], }) - export class UserListComponent extends InfiniteScrollTable implements OnDestroy, OnInit { - - - @Input('search') set searchText(searchText: string) { this._searchText = searchText; @@ -86,30 +100,25 @@ export class UserListComponent extends InfiniteScrollTable implements OnDe level: null, group: null, }; - groupFilterOptions: Array<{ value: string, label: string }> = []; - levelFilterOptions: Array<{ value: string, label: string }> = []; + groupFilterOptions: Array<{ value: string; label: string }> = []; + levelFilterOptions: Array<{ value: string; label: string }> = []; orderBy = 'lastname'; direction = Direction.ASCENDANT; - genericUserRole: Readonly<{ appId: ApplicationId, tenantIdentifier: number, roles: Role[] }>; + genericUserRole: Readonly<{ appId: ApplicationId; tenantIdentifier: number; roles: Role[] }>; totalMonth: number; isInactifUsers = false; - private userGroups: Array<{ id: string, group: any }> = []; + private userGroups: Array<{ id: string; group: any }> = []; private updatedUserSub: Subscription; private readonly filterChange = new Subject<{ [key: string]: any[] }>(); private readonly searchChange = new Subject(); private readonly orderChange = new Subject(); - private readonly searchKeys = [ - 'firstname', - 'lastname', - 'email', - 'mobile', - 'phone', - 'identifier', - ]; + private readonly searchKeys = ['firstname', 'lastname', 'email', 'mobile', 'phone', 'identifier']; @Input() - get connectedUserInfo(): AdminUserProfile { return this._connectedUserInfo; } + get connectedUserInfo(): AdminUserProfile { + return this._connectedUserInfo; + } set connectedUserInfo(userInfo: AdminUserProfile) { this._connectedUserInfo = userInfo; } @@ -117,7 +126,9 @@ export class UserListComponent extends InfiniteScrollTable implements OnDe private _connectedUserInfo: AdminUserProfile; @Input() - get groups(): Group[] { return this._groups; } + get groups(): Group[] { + return this._groups; + } set groups(groupList: Group[]) { this._groups = groupList; if (groupList) { @@ -143,7 +154,7 @@ export class UserListComponent extends InfiniteScrollTable implements OnDe this.genericUserRole = { appId: ApplicationId.USERS_APP, tenantIdentifier: +this.authService.user.proofTenantIdentifier, - roles: [Role.ROLE_GENERIC_USERS] + roles: [Role.ROLE_GENERIC_USERS], }; } @@ -160,15 +171,11 @@ export class UserListComponent extends InfiniteScrollTable implements OnDe } }); - const searchCriteriaChange = merge(this.searchChange, this.filterChange, this.orderChange) - .pipe(debounceTime(FILTER_DEBOUNCE_TIME_MS)); + const searchCriteriaChange = merge(this.searchChange, this.filterChange, this.orderChange).pipe(debounceTime(FILTER_DEBOUNCE_TIME_MS)); searchCriteriaChange.subscribe(() => { const query: SearchQuery = { - criteria: [ - ...buildCriteriaFromUserFilters(this.filterMap), - ...buildCriteriaFromSearch(this._searchText, this.searchKeys), - ] + criteria: [...buildCriteriaFromUserFilters(this.filterMap), ...buildCriteriaFromSearch(this._searchText, this.searchKeys)], }; const pageRequest = new PageRequest(0, DEFAULT_PAGE_SIZE, this.orderBy, this.direction, JSON.stringify(query)); @@ -180,14 +187,14 @@ export class UserListComponent extends InfiniteScrollTable implements OnDe const groupIds = new Set(this.dataSource.map((user: User) => user.groupId)); groupIds.forEach((groupId) => { - const existingGroup = this.userGroups.find((group) => group.id === groupId); - if (!existingGroup) { - const newGroup = groups.find((group) => group.id === groupId); - if (newGroup) { - this.userGroups.push({ id: newGroup.id, group: newGroup }); - } + const existingGroup = this.userGroups.find((group) => group.id === groupId); + if (!existingGroup) { + const newGroup = groups.find((group) => group.id === groupId); + if (newGroup) { + this.userGroups.push({ id: newGroup.id, group: newGroup }); } - }); + } + }); this.groupFilterOptions = this.userGroups.map((group) => ({ value: group.id, label: group.group.name })); this.groupFilterOptions.sort(sortByLabel(this.locale)); } @@ -222,39 +229,38 @@ export class UserListComponent extends InfiniteScrollTable implements OnDe if (user.status === 'REMOVED') { this.snackBarService.open({ message: 'SHARED.SNACKBAR.USER_ALREADY_DELETED', - icon: 'vitamui-icon-bank' + icon: 'vitamui-icon-bank', }); } else { this.userClick.emit(user); } } - checkInactifUsers() { - this.customerService.getMyCustomer().subscribe((customer) => { if (customer.gdprAlert) { - - this.dataSource.filter((user: User) => user.status === 'DISABLED' && user.disablingDate !== null).forEach((u: User) => { - - this.totalMonth = ((new Date().getFullYear()) - (new Date(u.disablingDate)).getFullYear()) * 12 - - (new Date(u.disablingDate)).getMonth() + (new Date().getMonth()); - - if (this.totalMonth > customer.gdprAlertDelay && u.email.split('@')[1] === customer.defaultEmailDomain) { - this.isInactifUsers = true; - } - }); + this.dataSource + .filter((user: User) => user.status === 'DISABLED' && user.disablingDate !== null) + .forEach((u: User) => { + this.totalMonth = + (new Date().getFullYear() - new Date(u.disablingDate).getFullYear()) * 12 - + new Date(u.disablingDate).getMonth() + + new Date().getMonth(); + + if (this.totalMonth > customer.gdprAlertDelay && u.email.split('@')[1] === customer.defaultEmailDomain) { + this.isInactifUsers = true; + } + }); if (this.isInactifUsers) { this.snackBarService.open({ message: 'SHARED.SNACKBAR.USER_TO_DELETE', - icon: 'vitamui-icon-bank' + icon: 'vitamui-icon-bank', }); } } }); } - } function sortByLabel(locale: string): (a: { label: string }, b: { label: string }) => number { diff --git a/ui/ui-frontend/projects/identity/src/app/user/user-list/user-list.module.ts b/ui/ui-frontend/projects/identity/src/app/user/user-list/user-list.module.ts index 38b8d6e0f9f..da6eba8b59d 100644 --- a/ui/ui-frontend/projects/identity/src/app/user/user-list/user-list.module.ts +++ b/ui/ui-frontend/projects/identity/src/app/user/user-list/user-list.module.ts @@ -46,19 +46,8 @@ import { SharedModule } from '../../shared/shared.module'; import { UserListComponent } from './user-list.component'; @NgModule({ - imports: [ - CommonModule, - RouterModule, - MatProgressSpinnerModule, - VitamUICommonModule, - SharedModule, - MatSelectModule, - ], - declarations: [ - UserListComponent, - ], - exports: [ - UserListComponent, - ] + imports: [CommonModule, RouterModule, MatProgressSpinnerModule, VitamUICommonModule, SharedModule, MatSelectModule], + declarations: [UserListComponent], + exports: [UserListComponent], }) -export class UserListModule { } +export class UserListModule {} diff --git a/ui/ui-frontend/projects/identity/src/app/user/user-preview/user-group-tab/user-group-tab.component.html b/ui/ui-frontend/projects/identity/src/app/user/user-preview/user-group-tab/user-group-tab.component.html index b3c0021e9ab..7ec7b2bb0bc 100644 --- a/ui/ui-frontend/projects/identity/src/app/user/user-preview/user-group-tab/user-group-tab.component.html +++ b/ui/ui-frontend/projects/identity/src/app/user/user-preview/user-group-tab/user-group-tab.component.html @@ -1,39 +1,40 @@
      - - + -
      +
      -

      {{'USER.GROUP.GROUP' | translate}}

      -

      {{ userGroup?.name }}

      +

      {{ 'USER.GROUP.GROUP' | translate }}

      +

      {{ userGroup?.name }}

      -

      {{'USER.GROUP.LEVEL' | translate}}

      -

      {{ userGroup?.level }}

      +

      {{ 'USER.GROUP.LEVEL' | translate }}

      +

      {{ userGroup?.level }}

      -

      {{'USER.GROUP.DESCRIPTION' | translate}}

      -

      {{ userGroup?.description }}

      +

      {{ 'USER.GROUP.DESCRIPTION' | translate }}

      +

      {{ userGroup?.description }}

      -
      +
      -

      {{'USER.GROUP.PROFILE' | translate}}

      -
      +

      {{ 'USER.GROUP.PROFILE' | translate }}

      +
      -
      {{ profile?.name }}
      +
      {{ profile?.name }}
      - +
      -
      +
      diff --git a/ui/ui-frontend/projects/identity/src/app/user/user-preview/user-group-tab/user-group-tab.component.ts b/ui/ui-frontend/projects/identity/src/app/user/user-preview/user-group-tab/user-group-tab.component.ts index 5b4808a08bd..c1e7ea4c6ce 100644 --- a/ui/ui-frontend/projects/identity/src/app/user/user-preview/user-group-tab/user-group-tab.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/user/user-preview/user-group-tab/user-group-tab.component.ts @@ -51,12 +51,13 @@ import { UserService } from '../../user.service'; styleUrls: ['./user-group-tab.component.scss'], }) export class UserGroupTabComponent implements OnInit, OnChanges, OnDestroy { - @Input() set user(user: User) { - this._user = user; + this._user = user; + } + get user(): User { + return this._user; } - get user(): User { return this._user; } private _user: User; @Input() @@ -67,18 +68,24 @@ export class UserGroupTabComponent implements OnInit, OnChanges, OnDestroy { this.showUpdateButton = true; } } - get readOnly(): boolean { return this._readOnly; } + get readOnly(): boolean { + return this._readOnly; + } private _readOnly: boolean; @Input() set userInfo(userInfo: AdminUserProfile) { this._userInfo = userInfo; } - get userInfo() { return this._userInfo; } + get userInfo() { + return this._userInfo; + } private _userInfo: AdminUserProfile; @Input() - get groups(): Group[] { return this._groups; } + get groups(): Group[] { + return this._groups; + } set groups(groupList: Group[]) { this._groups = groupList; } @@ -90,7 +97,7 @@ export class UserGroupTabComponent implements OnInit, OnChanges, OnDestroy { activeGroups: GroupSelection[]; userGroup: Group; showUpdateButton: boolean; - public groupProfiles: Profile [] = []; + public groupProfiles: Profile[] = []; private destroy = new Subject(); @@ -113,7 +120,7 @@ export class UserGroupTabComponent implements OnInit, OnChanges, OnDestroy { } getGroupProfiles() { - if(this.userGroup) { + if (this.userGroup) { this.groupService.get(this.userGroup.id).subscribe((groupRetrieved) => { this.groupProfiles = groupRetrieved.profiles; }); @@ -121,25 +128,36 @@ export class UserGroupTabComponent implements OnInit, OnChanges, OnDestroy { } getUserProfileDetail() { - this.activeGroups = this.groups.map((group) => Object({ id: group.id, name: group.name, - description: group.description, - level: group.level, - selected: false, profiles: group.profiles })); - if (!isRootLevel(this.authService.user)) { + this.activeGroups = this.groups.map((group) => + Object({ + id: group.id, + name: group.name, + description: group.description, + level: group.level, + selected: false, + profiles: group.profiles, + }), + ); + if (!isRootLevel(this.authService.user)) { this.activeGroups = this.activeGroups.filter((g) => g.id !== this.authService.user.groupId); - } - if (this.user.groupId) { - this.userGroup = this.groups.find((group) => group.id === this.user.groupId); - } + } + if (this.user.groupId) { + this.userGroup = this.groups.find((group) => group.id === this.user.groupId); + } } - getAttributableGroups(): GroupSelection [] { + getAttributableGroups(): GroupSelection[] { if (this.userInfo.type === 'LIST') { this.activeGroups = []; this.userInfo.profilGroup.forEach((displayGroup) => { const profilGroup = this.groups.find((group) => group.id === displayGroup.id); - const simplifiedGroup = Object({ id: displayGroup.id, name: displayGroup.name, - description: displayGroup.description, selected: false, profiles: profilGroup?.profiles}); + const simplifiedGroup = Object({ + id: displayGroup.id, + name: displayGroup.name, + description: displayGroup.description, + selected: false, + profiles: profilGroup?.profiles, + }); this.activeGroups.push(simplifiedGroup); }); } @@ -152,19 +170,21 @@ export class UserGroupTabComponent implements OnInit, OnChanges, OnDestroy { const dialogRef = this.groupAttrDialog.open(GroupAttributionComponent, { panelClass: 'vitamui-modal', disableClose: true, - data: [this.user, this.userGroup, this.activeGroups] + data: [this.user, this.userGroup, this.activeGroups], }); dialogRef.afterClosed().subscribe((result) => { - if (result) { this.refreshTab(); } + if (result) { + this.refreshTab(); + } }); } refreshTab() { this.userService.get(this.user.id).subscribe( - (response) => this.user = response, + (response) => (this.user = response), (error) => { console.error(error); - }); + }, + ); } - } diff --git a/ui/ui-frontend/projects/identity/src/app/user/user-preview/user-information-tab/user-information-tab.component.html b/ui/ui-frontend/projects/identity/src/app/user/user-preview/user-information-tab/user-information-tab.component.html index 7c96b727a28..7bc9cd484d6 100644 --- a/ui/ui-frontend/projects/identity/src/app/user/user-preview/user-information-tab/user-information-tab.component.html +++ b/ui/ui-frontend/projects/identity/src/app/user/user-preview/user-information-tab/user-information-tab.component.html @@ -1,64 +1,87 @@
      -

      {{'USER.INFORMATIONS.ACTIVE_SWITCH' | translate}}

      -

      {{'USER.INFORMATIONS.INACTIVE_SWITCH' | translate}} -

      +

      {{ 'USER.INFORMATIONS.ACTIVE_SWITCH' | translate }}

      +

      {{ 'USER.INFORMATIONS.INACTIVE_SWITCH' | translate }}

      - {{'USER.INFORMATIONS.BLOCKED_ACCOUNT' | translate}} ({{'USER.INFORMATIONS.BLOCKED_ACCOUNT_SINCE' | translate}} {{ user?.lastConnection | dateTime: 'medium' }}) + {{ 'USER.INFORMATIONS.BLOCKED_ACCOUNT' | translate }} + ({{ 'USER.INFORMATIONS.BLOCKED_ACCOUNT_SINCE' | translate }} {{ user?.lastConnection | dateTime: 'medium' }})

      - {{'USER.INFORMATIONS.ERASED_ACCOUNT' | translate}}

      + {{ 'USER.INFORMATIONS.ERASED_ACCOUNT' | translate }} +

      - +
      - - {{'COMMON.ERROR.REQUIRED' | translate}} + + {{ 'COMMON.ERROR.REQUIRED' | translate }}
      - - {{'COMMON.ERROR.REQUIRED' | translate}} + + {{ 'COMMON.ERROR.REQUIRED' | translate }}
      - - {{'COMMON.ERROR.REQUIRED' | translate}} - + + {{ 'COMMON.ERROR.REQUIRED' | translate }} - {{'USER.INFORMATIONS.MAIL_ALREADY_EXIST' | translate}} + {{ 'USER.INFORMATIONS.MAIL_ALREADY_EXIST' | translate }}
      - - {{'COMMON.ERROR.REQUIRED' | translate}} - {{'USER.INFORMATIONS.PHONE_FIELD_FORMAT' | translate}} + + {{ 'COMMON.ERROR.REQUIRED' | translate }} + {{ 'USER.INFORMATIONS.PHONE_FIELD_FORMAT' | translate }}
      - - {{'USER.INFORMATIONS.PHONE_FIELD_FORMAT' | translate}} + + {{ 'USER.INFORMATIONS.PHONE_FIELD_FORMAT' | translate }}
      @@ -66,34 +89,51 @@
      - - {{'COMMON.ERROR.REQUIRED' | translate}} + [asyncValidator]="form?.get('address.street')?.asyncValidator" + > + {{ 'COMMON.ERROR.REQUIRED' | translate }}
      - - {{'COMMON.ERROR.REQUIRED' | translate}} + + {{ 'COMMON.ERROR.REQUIRED' | translate }}
      - - {{'COMMON.ERROR.REQUIRED' | translate}} + + {{ 'COMMON.ERROR.REQUIRED' | translate }}
      - + @@ -114,12 +154,17 @@
      - +
      -
      - +
      +
      +
      @@ -131,16 +176,25 @@
      - +
      - + - +
      @@ -149,15 +203,19 @@
      - {{'USER.INFORMATIONS.ALLOW_SUBROGATION' | translate}} + {{ 'USER.INFORMATIONS.ALLOW_SUBROGATION' | translate }}
      - {{'USER.INFORMATIONS.VALIDATIONS' | translate}} + matTooltipClass="vitamui-tooltip" + >{{ 'USER.INFORMATIONS.VALIDATIONS' | translate }}
      @@ -165,13 +223,13 @@
      - {{'USER.INFORMATIONS.ACTIVATE_AUTO_PROVISIONING' | translate}} + {{ 'USER.INFORMATIONS.ACTIVATE_AUTO_PROVISIONING' | translate }}

      ATTENTION

      - L'utilisateur que vous cherchez est déja supprimé + L'utilisateur que vous cherchez est déja supprimé
      - diff --git a/ui/ui-frontend/projects/identity/src/app/user/user-preview/user-information-tab/user-information-tab.component.scss b/ui/ui-frontend/projects/identity/src/app/user/user-preview/user-information-tab/user-information-tab.component.scss index b1623e0d1d7..18653fe40ae 100644 --- a/ui/ui-frontend/projects/identity/src/app/user/user-preview/user-information-tab/user-information-tab.component.scss +++ b/ui/ui-frontend/projects/identity/src/app/user/user-preview/user-information-tab/user-information-tab.component.scss @@ -1,20 +1,19 @@ @import '~ui-frontend-common/sass/variables/colors'; .form-group { - padding-bottom: 30px; + padding-bottom: 30px; - label{ - - padding-right: 30px; - font-size: 16px; - font-weight: 500; - font-style: normal; - line-height: normal; - letter-spacing: normal; - text-align: left; - } + label { + padding-right: 30px; + font-size: 16px; + font-weight: 500; + font-style: normal; + line-height: normal; + letter-spacing: normal; + text-align: left; + } } .status-warning { - color: $red; + color: $red; } diff --git a/ui/ui-frontend/projects/identity/src/app/user/user-preview/user-information-tab/user-information-tab.component.spec.ts b/ui/ui-frontend/projects/identity/src/app/user/user-preview/user-information-tab/user-information-tab.component.spec.ts index a696cd92d5e..84c910a9c91 100644 --- a/ui/ui-frontend/projects/identity/src/app/user/user-preview/user-information-tab/user-information-tab.component.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/user/user-preview/user-information-tab/user-information-tab.component.spec.ts @@ -62,7 +62,7 @@ let expectedUser: User = { mobile: '', userInfoId: '', phone: '', - level : '', + level: '', groupId: 'profile_group_id', customerId: '42', otp: false, @@ -71,25 +71,25 @@ let expectedUser: User = { subrogeable: false, nbFailedAttempts: 0, lastConnection: '2018-07-04T16:00:00.126+02:00', - readonly : false, + readonly: false, address: { - street: '13 rue faubourg', - zipCode: '75009', - city: 'paris', - country: 'france' + street: '13 rue faubourg', + zipCode: '75009', + city: 'paris', + country: 'france', }, siteCode: '001', - disablingDate : null, + disablingDate: null, centerCode: '000001', - autoProvisioningEnabled: false + autoProvisioningEnabled: false, }; let userInfolanguage: UserInfo = { - id : '1', - language: 'fr' - }; + id: '1', + language: 'fr', +}; let expectedCustomer: Customer = { id: 'idCustomer', - identifier : '1', + identifier: '1', enabled: true, readonly: false, hasCustomGraphicIdentity: false, @@ -103,33 +103,33 @@ let expectedCustomer: Customer = { street: '85 rue des bois', zipCode: '75013', city: 'Paris', - country: 'France' + country: 'France', }, language: 'FRENCH', - emailDomains: [ - 'domain.com', - ], + emailDomains: ['domain.com'], defaultEmailDomain: 'domain.com', - owners: [{ - id: 'znvuzhvyvg', - identifier : '41', - code: '254791', - name: 'owner name', - companyName: 'company name', - address: { - street: '85 rue des bois', - zipCode: '75013', - city: 'Paris', - country: 'France' + owners: [ + { + id: 'znvuzhvyvg', + identifier: '41', + code: '254791', + name: 'owner name', + companyName: 'company name', + address: { + street: '85 rue des bois', + zipCode: '75013', + city: 'Paris', + country: 'France', + }, + customerId: 'idCustomer', + readonly: false, }, - customerId: 'idCustomer', - readonly : false - }], + ], themeColors: {}, - gdprAlert : false, - gdprAlertDelay : 72, + gdprAlert: false, + gdprAlertDelay: 72, portalMessages: {}, - portalTitles: {} + portalTitles: {}, }; let expectedAdminUserProfile: AdminUserProfile = { @@ -140,11 +140,13 @@ let expectedAdminUserProfile: AdminUserProfile = { standardAttrsAllowed: true, type: 'type', profilGroupIds: ['profile_group_id'], - profilGroup: [{ - id: 'profile_group_id', - name: 'profile_group_name', - description: 'Une description du profil group' - }] + profilGroup: [ + { + id: 'profile_group_id', + name: 'profile_group_name', + description: 'Une description du profil group', + }, + ], }; @Directive({ selector: '[matTooltip]' }) @@ -155,15 +157,20 @@ class MatTooltipStubDirective { } @Component({ - // tslint:disable-next-line: max-line-length - template: `` + // tslint:disable-next-line: max-line-length + template: ``, }) class TestHostComponent { - user = expectedUser; - customer = expectedCustomer; - readOnly = false; - adminUserProfile = expectedAdminUserProfile; - userInfo = userInfolanguage; + user = expectedUser; + customer = expectedCustomer; + readOnly = false; + adminUserProfile = expectedAdminUserProfile; + userInfo = userInfolanguage; @ViewChild(UserInfoTabComponent, { static: false }) component: UserInfoTabComponent; } @@ -182,7 +189,7 @@ describe('UserInfoTabComponent', () => { mobile: '', userInfoId: '', phone: '', - level : '', + level: '', groupId: 'profile_group_id', customerId: '42', otp: false, @@ -191,21 +198,21 @@ describe('UserInfoTabComponent', () => { subrogeable: false, nbFailedAttempts: 0, lastConnection: '2018-07-04T16:00:00.126+02:00', - readonly : false, + readonly: false, address: { - street: '13 rue faubourg', - zipCode: '75009', - city: 'paris', - country: 'france' + street: '13 rue faubourg', + zipCode: '75009', + city: 'paris', + country: 'france', }, siteCode: '001', - disablingDate : null, + disablingDate: null, centerCode: '000001', - autoProvisioningEnabled: false + autoProvisioningEnabled: false, }; expectedCustomer = { id: 'idCustomer', - identifier : '41', + identifier: '41', enabled: true, readonly: false, hasCustomGraphicIdentity: false, @@ -219,33 +226,33 @@ describe('UserInfoTabComponent', () => { street: '85 rue des bois', zipCode: '75013', city: 'Paris', - country: 'France' + country: 'France', }, language: 'FRENCH', - emailDomains: [ - 'domain.com', - ], + emailDomains: ['domain.com'], defaultEmailDomain: 'domain.com', - owners: [{ - id: 'znvuzhvyvg', - identifier : '41', - code: '254791', - name: 'owner name', - companyName: 'company name', - address: { - street: '85 rue des bois', - zipCode: '75013', - city: 'Paris', - country: 'France' + owners: [ + { + id: 'znvuzhvyvg', + identifier: '41', + code: '254791', + name: 'owner name', + companyName: 'company name', + address: { + street: '85 rue des bois', + zipCode: '75013', + city: 'Paris', + country: 'France', + }, + customerId: 'idCustomer', + readonly: false, }, - customerId: 'idCustomer', - readonly : false - }], + ], themeColors: {}, - gdprAlert : false, - gdprAlertDelay : 72, + gdprAlert: false, + gdprAlertDelay: 72, portalMessages: {}, - portalTitles: {} + portalTitles: {}, }; expectedAdminUserProfile = { multifactorAllowed: true, @@ -255,23 +262,22 @@ describe('UserInfoTabComponent', () => { standardAttrsAllowed: true, type: 'type', profilGroupIds: ['profile_group_id'], - profilGroup: [{ - id: 'profile_group_id', - name: 'profile_group_name', - description: 'Une description du profil group' - }] + profilGroup: [ + { + id: 'profile_group_id', + name: 'profile_group_name', + description: 'Une description du profil group', + }, + ], }; userInfolanguage = { - id : '1', - language: 'fr' + id: '1', + language: 'fr', }; const userServiceSpy = jasmine.createSpyObj('UserService', { patch: of({}) }); const userInfoServiceSpy = jasmine.createSpyObj('UserInfoService', { patch: of({}) }); - const userCreateValidatorsSpy = jasmine.createSpyObj( - 'userCreateValidators', - { uniqueEmail: () => of(null) } - ); + const userCreateValidatorsSpy = jasmine.createSpyObj('userCreateValidators', { uniqueEmail: () => of(null) }); TestBed.configureTestingModule({ imports: [ @@ -280,9 +286,9 @@ describe('UserInfoTabComponent', () => { MatButtonToggleModule, VitamUICommonTestModule, LoggerModule.forRoot(), - HttpClientTestingModule + HttpClientTestingModule, ], - declarations: [ UserInfoTabComponent, TestHostComponent, MatTooltipStubDirective ], + declarations: [UserInfoTabComponent, TestHostComponent, MatTooltipStubDirective], providers: [ { provide: WINDOW_LOCATION, useValue: window.location }, { provide: BASE_URL, useValue: '/fake-api' }, @@ -291,9 +297,8 @@ describe('UserInfoTabComponent', () => { { provide: UserCreateValidators, useValue: userCreateValidatorsSpy }, { provide: AuthService, useValue: { user: {} } }, { provide: CountryService, useValue: { getAvailableCountries: () => EMPTY } }, - ] - }) - .compileComponents(); + ], + }).compileComponents(); })); beforeEach(() => { @@ -324,7 +329,6 @@ describe('UserInfoTabComponent', () => { expect(testhost.component.form.get('code')).toBeDefined(); }); - it('should have the email validator', () => { const emailControl = testhost.component.form.get('email'); emailControl.setValue('name'); @@ -335,7 +339,6 @@ describe('UserInfoTabComponent', () => { expect(emailControl.valid).toBeTruthy(); }); - it('should disable then enable the form', () => { testhost.readOnly = true; fixture.detectChanges(); diff --git a/ui/ui-frontend/projects/identity/src/app/user/user-preview/user-information-tab/user-information-tab.component.ts b/ui/ui-frontend/projects/identity/src/app/user/user-preview/user-information-tab/user-information-tab.component.ts index b74094229e4..105576cd4c9 100644 --- a/ui/ui-frontend/projects/identity/src/app/user/user-preview/user-information-tab/user-information-tab.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/user/user-preview/user-information-tab/user-information-tab.component.ts @@ -106,7 +106,7 @@ export class UserInfoTabComponent implements OnChanges, OnInit { private formBuilder: FormBuilder, private userCreateValidators: UserCreateValidators, private countryService: CountryService, - private startupService: StartupService + private startupService: StartupService, ) { this.maxStreetLength = this.startupService.getConfigNumberValue('MAX_STREET_LENGTH'); this.form = this.formBuilder.group({ @@ -154,7 +154,7 @@ export class UserInfoTabComponent implements OnChanges, OnInit { map(() => diff(this.form.getRawValue(), this.previousValue)), filter((formData) => !isEmpty(formData)), map((formData) => extend({ id: this.user.id }, formData)), - switchMap((formData) => this.userService.patch(formData).pipe(catchError(() => of(null)))) + switchMap((formData) => this.userService.patch(formData).pipe(catchError(() => of(null)))), ) .subscribe((user: User) => this.resetForm(this.form, user, this.customer, this.adminUserProfile, this.readOnly)); @@ -164,7 +164,7 @@ export class UserInfoTabComponent implements OnChanges, OnInit { map(() => diff(this.userInfoForm.getRawValue(), this.previousUserInfoValue)), filter((formData) => !isEmpty(formData)), map((formData) => extend({ id: this.userInfo.id }, formData)), - switchMap((formData) => this.userInfoService.patch(formData, this.user).pipe(catchError(() => of(null)))) + switchMap((formData) => this.userInfoService.patch(formData, this.user).pipe(catchError(() => of(null)))), ) .subscribe((userInfo: UserInfo) => this.resetUserInfoForm(this.form, userInfo)); diff --git a/ui/ui-frontend/projects/identity/src/app/user/user-preview/user-popup.component.ts b/ui/ui-frontend/projects/identity/src/app/user/user-preview/user-popup.component.ts index cfb748ad026..5e84bd153e5 100644 --- a/ui/ui-frontend/projects/identity/src/app/user/user-preview/user-popup.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/user/user-preview/user-popup.component.ts @@ -43,23 +43,23 @@ import { CustomerService } from '../../core/customer.service'; @Component({ selector: 'app-profile-group-popup', - template: '' + template: '', }) export class UserPopupComponent implements OnInit { - user: User; customer: Customer; - constructor(private route: ActivatedRoute, private customerService: CustomerService) { - this.customerService.getMyCustomer().subscribe((customer) => this.customer = customer); + constructor( + private route: ActivatedRoute, + private customerService: CustomerService, + ) { + this.customerService.getMyCustomer().subscribe((customer) => (this.customer = customer)); this.user = this.route.snapshot.data.user; } - ngOnInit() { - } + ngOnInit() {} closePopup() { window.close(); } - } diff --git a/ui/ui-frontend/projects/identity/src/app/user/user-preview/user-preview.component.html b/ui/ui-frontend/projects/identity/src/app/user/user-preview/user-preview.component.html index 703f9b6c891..b433601b7fd 100644 --- a/ui/ui-frontend/projects/identity/src/app/user/user-preview/user-preview.component.html +++ b/ui/ui-frontend/projects/identity/src/app/user/user-preview/user-preview.component.html @@ -1,65 +1,98 @@ - - - - - + (onclose)="emitClose()" +> + + + + +
      - + - + - - + +
      -

      {{'USER.OTHER_ACTION.DESACTIVATE_MESSAGE' | translate : { param1: user?.firstname, param2: user?.lastname, param3: user?.email } }} - +

      + {{ 'USER.OTHER_ACTION.DESACTIVATE_MESSAGE' | translate: { param1: user?.firstname, param2: user?.lastname, param3: user?.email } }} +

      - - + +
      -

      {{'USER.OTHER_ACTION.REACTIVATE_MESSAGE' | translate : { param1: user?.firstname, param2: user?.lastname, param3: user?.email } }}

      -

      {{'USER.OTHER_ACTION.REACTIVATE_MESSAGE' | translate : { param1: user?.firstname, param2: user?.lastname, param3: user?.email } }}

      +

      + {{ 'USER.OTHER_ACTION.REACTIVATE_MESSAGE' | translate: { param1: user?.firstname, param2: user?.lastname, param3: user?.email } }} +

      +

      + {{ 'USER.OTHER_ACTION.REACTIVATE_MESSAGE' | translate: { param1: user?.firstname, param2: user?.lastname, param3: user?.email } }} +

      - - + +
      -

      Vous allez procéder à l'effacement des données personnelles de l'utilisateur - {{user?.firstname}} {{user?.lastname}}. Cette action ne peut pas être annulée, voulez-vous confirmer ? +

      + Vous allez procéder à l'effacement des données personnelles de l'utilisateur {{ user?.firstname }} {{ user?.lastname }}. Cette action + ne peut pas être annulée, voulez-vous confirmer ?

      - - + +
      diff --git a/ui/ui-frontend/projects/identity/src/app/user/user-preview/user-preview.component.ts b/ui/ui-frontend/projects/identity/src/app/user/user-preview/user-preview.component.ts index d34437e2158..7e86fde774d 100644 --- a/ui/ui-frontend/projects/identity/src/app/user/user-preview/user-preview.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/user/user-preview/user-preview.component.ts @@ -111,27 +111,23 @@ export class UserPreviewComponent implements OnDestroy, OnInit { // tslint:disable-next-line:variable-name private _groups: Group[]; - - constructor( + constructor( private matDialog: MatDialog, private userService: UserService, private authService: AuthService, public userApi: UserApiService, private startupService: StartupService, public groupService: GroupService, - private userInfoService: UserInfoService - ) { } + private userInfoService: UserInfoService, + ) {} ngOnInit() { - this.connectedUserInfo = this.userService.getUserProfileInfo(this.authService.user); this.userUpdatedSub = this.userService.userUpdated.subscribe((updatedUser: User) => { this.user = updatedUser; }); - } - ngOnDestroy() { this.userUpdatedSub.unsubscribe(); } @@ -140,12 +136,12 @@ export class UserPreviewComponent implements OnDestroy, OnInit { window.open( this.startupService.getConfigStringValue('UI_URL') + '/user/' + this.user.id, 'detailPopup', - 'width=584, height=713, resizable=no, location=no' + 'width=584, height=713, resizable=no, location=no', ); this.emitClose(); } - updateStatus( status: string) { + updateStatus(status: string) { let dialogToOpen; if (status === 'ENABLED') { dialogToOpen = this.confirmEnabledUserDialog; @@ -153,15 +149,14 @@ export class UserPreviewComponent implements OnDestroy, OnInit { dialogToOpen = this.confirmDisabledUserDialog; } const dialogRef = this.matDialog.open(dialogToOpen, { panelClass: 'vitamui-dialog' }); - dialogRef.afterClosed() - .pipe(filter((result) => !!result)) - .subscribe(() => { - this.userService.patch({id: this.user.id, status }) - .subscribe((user) => { - this.user = user; + dialogRef + .afterClosed() + .pipe(filter((result) => !!result)) + .subscribe(() => { + this.userService.patch({ id: this.user.id, status }).subscribe((user) => { + this.user = user; + }); }); - - }); } levelNotAllowed(): boolean { @@ -228,8 +223,6 @@ export class UserPreviewComponent implements OnDestroy, OnInit { this.user = user; this.emitClose(); }); - }); } - } diff --git a/ui/ui-frontend/projects/identity/src/app/user/user-preview/user-preview.module.ts b/ui/ui-frontend/projects/identity/src/app/user/user-preview/user-preview.module.ts index c7bdfd8dc1b..36e74fc3c6c 100644 --- a/ui/ui-frontend/projects/identity/src/app/user/user-preview/user-preview.module.ts +++ b/ui/ui-frontend/projects/identity/src/app/user/user-preview/user-preview.module.ts @@ -65,13 +65,8 @@ import { UserPreviewComponent } from './user-preview.component'; MatDialogModule, VitamUICommonModule, ], - declarations: [ - UserPopupComponent, - UserPreviewComponent, - UserInfoTabComponent, - UserGroupTabComponent, - ], + declarations: [UserPopupComponent, UserPreviewComponent, UserInfoTabComponent, UserGroupTabComponent], exports: [UserPreviewComponent], - entryComponents: [GroupAttributionComponent] + entryComponents: [GroupAttributionComponent], }) -export class UserPreviewModule { } +export class UserPreviewModule {} diff --git a/ui/ui-frontend/projects/identity/src/app/user/user-resolver.service.ts b/ui/ui-frontend/projects/identity/src/app/user/user-resolver.service.ts index 7bc91ca5777..439cb179fe5 100644 --- a/ui/ui-frontend/projects/identity/src/app/user/user-resolver.service.ts +++ b/ui/ui-frontend/projects/identity/src/app/user/user-resolver.service.ts @@ -44,25 +44,25 @@ import { UserService } from './user.service'; @Injectable() export class UserResolver implements Resolve { - - constructor(private userService: UserService, private router: Router) { } + constructor( + private userService: UserService, + private router: Router, + ) {} resolve(route: ActivatedRouteSnapshot): Observable { const id = route.paramMap.get('id'); - return this.userService.get(id) - .pipe( - take(1), - map((user: User) => { - if (user) { - return user; - } else { - this.router.navigate(['/']); + return this.userService.get(id).pipe( + take(1), + map((user: User) => { + if (user) { + return user; + } else { + this.router.navigate(['/']); - return null; - } - }) - ); + return null; + } + }), + ); } - } diff --git a/ui/ui-frontend/projects/identity/src/app/user/user-routing.module.ts b/ui/ui-frontend/projects/identity/src/app/user/user-routing.module.ts index 7ff768e1a04..53549509b35 100644 --- a/ui/ui-frontend/projects/identity/src/app/user/user-routing.module.ts +++ b/ui/ui-frontend/projects/identity/src/app/user/user-routing.module.ts @@ -44,24 +44,18 @@ import { UserComponent } from './user.component'; const routes: Route[] = [ { path: '', - component: UserComponent + component: UserComponent, }, { path: ':id', component: UserPopupComponent, - resolve: { user: UserResolver } - } + resolve: { user: UserResolver }, + }, ]; - @NgModule({ declarations: [], - imports: [ - CommonModule, - RouterModule.forChild(routes) - ], - exports: [ - RouterModule - ] + imports: [CommonModule, RouterModule.forChild(routes)], + exports: [RouterModule], }) -export class UserRoutingModule { } +export class UserRoutingModule {} diff --git a/ui/ui-frontend/projects/identity/src/app/user/user.component.html b/ui/ui-frontend/projects/identity/src/app/user/user.component.html index 5b4005e9697..0f20709b3da 100644 --- a/ui/ui-frontend/projects/identity/src/app/user/user.component.html +++ b/ui/ui-frontend/projects/identity/src/app/user/user.component.html @@ -1,28 +1,32 @@ - +
      - {{'USER.HOME.TITLE' | translate}} + {{ 'USER.HOME.TITLE' | translate }}
      - +
      -
      \ No newline at end of file + diff --git a/ui/ui-frontend/projects/identity/src/app/user/user.component.ts b/ui/ui-frontend/projects/identity/src/app/user/user.component.ts index 94e78d9f128..659a44c273e 100644 --- a/ui/ui-frontend/projects/identity/src/app/user/user.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/user/user.component.ts @@ -38,9 +38,18 @@ import { Component, OnInit, ViewChild } from '@angular/core'; import { MatDialog } from '@angular/material/dialog'; import { ActivatedRoute } from '@angular/router'; -import { AdminUserProfile, AuthService, Customer, DEFAULT_PAGE_SIZE, Direction, GlobalEventService, +import { + AdminUserProfile, + AuthService, + Customer, + DEFAULT_PAGE_SIZE, + Direction, + GlobalEventService, Group, - PageRequest, SidenavPage, User } from 'ui-frontend-common'; + PageRequest, + SidenavPage, + User, +} from 'ui-frontend-common'; import { CustomerService } from '../core/customer.service'; import { GroupService } from '../group/group.service'; import { UserCreateComponent } from './user-create/user-create.component'; @@ -50,10 +59,9 @@ import { UserService } from './user.service'; @Component({ selector: 'app-user', templateUrl: './user.component.html', - styleUrls: ['./user.component.scss'] + styleUrls: ['./user.component.scss'], }) export class UserComponent extends SidenavPage implements OnInit { - users: User[]; connectedUserInfo: AdminUserProfile; customer: Customer; @@ -75,19 +83,23 @@ export class UserComponent extends SidenavPage implements OnInit { } ngOnInit() { - this.customerService.getMyCustomer().subscribe((customer) => this.customer = customer); + this.customerService.getMyCustomer().subscribe((customer) => (this.customer = customer)); this.connectedUserInfo = this.userService.getUserProfileInfo(this.authService.user); - this.groupService.getAll(true).subscribe((data: Group[]) => {this.groups = data; }); + this.groupService.getAll(true).subscribe((data: Group[]) => { + this.groups = data; + }); } openCreateUserDialog() { const dialogRef = this.dialog.open(UserCreateComponent, { panelClass: 'vitamui-modal', disableClose: true, - data: { userInfo: this.connectedUserInfo, customer: this.customer, groups: this.groups } + data: { userInfo: this.connectedUserInfo, customer: this.customer, groups: this.groups }, }); dialogRef.afterClosed().subscribe((result) => { - if (result) { this.refreshList(); } + if (result) { + this.refreshList(); + } }); } @@ -96,8 +108,9 @@ export class UserComponent extends SidenavPage implements OnInit { } private refreshList() { - if (!this.userListComponent) { return; } + if (!this.userListComponent) { + return; + } this.userListComponent.search(new PageRequest(0, DEFAULT_PAGE_SIZE, 'lastname', Direction.ASCENDANT)); } - } diff --git a/ui/ui-frontend/projects/identity/src/app/user/user.module.ts b/ui/ui-frontend/projects/identity/src/app/user/user.module.ts index 43d75d0f165..02df28f70f1 100644 --- a/ui/ui-frontend/projects/identity/src/app/user/user.module.ts +++ b/ui/ui-frontend/projects/identity/src/app/user/user.module.ts @@ -68,16 +68,9 @@ import { UserService } from './user.service'; GroupAttributionModule, MatSidenavModule, FormsModule, - UserRoutingModule + UserRoutingModule, ], - declarations: [ - UserComponent, - ], - providers: [ - UserResolver, - UserService, - ProfileService, - GroupService - ] + declarations: [UserComponent], + providers: [UserResolver, UserService, ProfileService, GroupService], }) -export class UserModule { } +export class UserModule {} diff --git a/ui/ui-frontend/projects/identity/src/app/user/user.service.spec.ts b/ui/ui-frontend/projects/identity/src/app/user/user.service.spec.ts index ee8123fefa6..a89e91b0230 100644 --- a/ui/ui-frontend/projects/identity/src/app/user/user.service.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/user/user.service.spec.ts @@ -46,13 +46,7 @@ describe('UserService', () => { const snackBarSpy = jasmine.createSpyObj('VitamUISnackBarService', ['open']); TestBed.configureTestingModule({ imports: [HttpClientTestingModule], - providers: [ - UserService, - StartupService, - { provide: VitamUISnackBarService, useValue: snackBarSpy }, - ] + providers: [UserService, StartupService, { provide: VitamUISnackBarService, useValue: snackBarSpy }], }); - }); - }); diff --git a/ui/ui-frontend/projects/identity/src/app/user/user.service.ts b/ui/ui-frontend/projects/identity/src/app/user/user.service.ts index cdf28612206..a4de21a88ed 100644 --- a/ui/ui-frontend/projects/identity/src/app/user/user.service.ts +++ b/ui/ui-frontend/projects/identity/src/app/user/user.service.ts @@ -62,7 +62,7 @@ export class UserService extends SearchService { private userApi: UserApiService, private snackBarService: VitamUISnackBarService, private rngProfileService: ProfileService, - http: HttpClient + http: HttpClient, ) { super(http, userApi, ''); } @@ -82,8 +82,8 @@ export class UserService extends SearchService { }, }); }, - (error) => this.snackBarService.open({ message: error.error.message, translate: false }) - ) + (error) => this.snackBarService.open({ message: error.error.message, translate: false }), + ), ); } @@ -115,8 +115,8 @@ export class UserService extends SearchService { }, }); }, - (error) => this.snackBarService.open({ message: error.error.message, translate: false }) - ) + (error) => this.snackBarService.open({ message: error.error.message, translate: false }), + ), ); } @@ -131,8 +131,8 @@ export class UserService extends SearchService { translateParams: { param1: user.firstname, param2: user.lastname }, }); }, - (error) => this.snackBarService.open({ message: error.error.message, translate: false }) - ) + (error) => this.snackBarService.open({ message: error.error.message, translate: false }), + ), ); } diff --git a/ui/ui-frontend/projects/identity/src/app/user/user.validators.spec.ts b/ui/ui-frontend/projects/identity/src/app/user/user.validators.spec.ts index e47e1b08fb7..270d94b753f 100644 --- a/ui/ui-frontend/projects/identity/src/app/user/user.validators.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/user/user.validators.spec.ts @@ -39,36 +39,43 @@ import { FormControl, FormGroup } from '@angular/forms'; import { UserValidators } from './user.validators'; describe('UserValidators', () => { + describe('missingPhoneNumber', () => { + function testValid(value: FormGroup) { + expect( + UserValidators.missingPhoneNumber( + new FormGroup({ + phone: new FormControl(null), + mobile: new FormControl(null), + otp: new FormControl(null), + }), + ), + ).toBe(null, 'testing with "' + value + '"'); + } - describe('missingPhoneNumber', () => { - - function testValid(value: FormGroup) { - expect(UserValidators.missingPhoneNumber(new FormGroup({ - phone: new FormControl(null), - mobile: new FormControl(null), - otp: new FormControl(null) - }))).toBe(null, 'testing with "' + value + '"'); - } - - it('should return null', () => { - testValid(new FormGroup({ - phone: new FormControl(''), - mobile: new FormControl(''), - otp: new FormControl(false) - })); - testValid(new FormGroup({ - phone: new FormControl('0146596574'), - mobile: new FormControl(null), - otp: new FormControl(true) - })); - testValid(new FormGroup({ - phone: new FormControl(''), - mobile: new FormControl('0645789654'), - otp: new FormControl(true) - })); - }); - - it('should return an error object'); + it('should return null', () => { + testValid( + new FormGroup({ + phone: new FormControl(''), + mobile: new FormControl(''), + otp: new FormControl(false), + }), + ); + testValid( + new FormGroup({ + phone: new FormControl('0146596574'), + mobile: new FormControl(null), + otp: new FormControl(true), + }), + ); + testValid( + new FormGroup({ + phone: new FormControl(''), + mobile: new FormControl('0645789654'), + otp: new FormControl(true), + }), + ); }); + it('should return an error object'); + }); }); diff --git a/ui/ui-frontend/projects/identity/src/app/user/user.validators.ts b/ui/ui-frontend/projects/identity/src/app/user/user.validators.ts index e68f778951e..40204ad361a 100644 --- a/ui/ui-frontend/projects/identity/src/app/user/user.validators.ts +++ b/ui/ui-frontend/projects/identity/src/app/user/user.validators.ts @@ -37,18 +37,15 @@ import { AbstractControl, ValidationErrors } from '@angular/forms'; export class UserValidators { - static missingPhoneNumber(control: AbstractControl): ValidationErrors { if (control && control.get('otp').value) { if (!control.get('mobile').value) { - return { - missingPhoneNumber: true + missingPhoneNumber: true, }; } } return null; } - } diff --git a/ui/ui-frontend/projects/identity/src/assets/i18n/en.json b/ui/ui-frontend/projects/identity/src/assets/i18n/en.json index a6095b3fd23..dae93fc7d98 100644 --- a/ui/ui-frontend/projects/identity/src/assets/i18n/en.json +++ b/ui/ui-frontend/projects/identity/src/assets/i18n/en.json @@ -513,9 +513,9 @@ "USE_PLATFORM_BULK_OPERATIONS_THRESHOLD_TITLE": "Set plateform thresholds", "MAX_BULK_OPERATIONS_THRESHOLD_VALUES": "{{threshold}} archive units", "TABS": { - "INFORMATIONS":"Informations", - "THRESHOLDS":"Thresholds", - "HISTORY":"History" + "INFORMATIONS": "Informations", + "THRESHOLDS": "Thresholds", + "HISTORY": "History" } } } diff --git a/ui/ui-frontend/projects/identity/src/assets/i18n/fr.json b/ui/ui-frontend/projects/identity/src/assets/i18n/fr.json index 6c89c9cf38f..1e06134264b 100644 --- a/ui/ui-frontend/projects/identity/src/assets/i18n/fr.json +++ b/ui/ui-frontend/projects/identity/src/assets/i18n/fr.json @@ -512,9 +512,9 @@ "USE_PLATFORM_BULK_OPERATIONS_THRESHOLD_TITLE": "Application des seuils de plateforme", "MAX_BULK_OPERATIONS_THRESHOLD_VALUES": "{{threshold}} unités archivistiques", "TABS": { - "INFORMATIONS":"Informations", - "THRESHOLDS":"Seuils", - "HISTORY":"Historique" + "INFORMATIONS": "Informations", + "THRESHOLDS": "Seuils", + "HISTORY": "Historique" } } } diff --git a/ui/ui-frontend/projects/identity/src/environments/environment.prod.ts b/ui/ui-frontend/projects/identity/src/environments/environment.prod.ts index 98ad704ba4b..891a440c497 100644 --- a/ui/ui-frontend/projects/identity/src/environments/environment.prod.ts +++ b/ui/ui-frontend/projects/identity/src/environments/environment.prod.ts @@ -36,5 +36,5 @@ */ export const environment = { production: true, - userRefreshRate: 60000 + userRefreshRate: 60000, }; diff --git a/ui/ui-frontend/projects/identity/src/environments/environment.ts b/ui/ui-frontend/projects/identity/src/environments/environment.ts index 3a14891501d..c9d0c0cbe73 100644 --- a/ui/ui-frontend/projects/identity/src/environments/environment.ts +++ b/ui/ui-frontend/projects/identity/src/environments/environment.ts @@ -37,5 +37,5 @@ export const environment = { production: false, - userRefreshRate: 30000 + userRefreshRate: 30000, }; diff --git a/ui/ui-frontend/projects/identity/src/index.html b/ui/ui-frontend/projects/identity/src/index.html index 585244b7660..aae45c84ba6 100644 --- a/ui/ui-frontend/projects/identity/src/index.html +++ b/ui/ui-frontend/projects/identity/src/index.html @@ -1,27 +1,26 @@ - - - - + + + + - - - - - - + + + + + + + - -
      - - - - - -
      - -
      - - + +
      + + + + +
      +
      + + diff --git a/ui/ui-frontend/projects/identity/src/main.ts b/ui/ui-frontend/projects/identity/src/main.ts index 8ee228cd919..34057715490 100644 --- a/ui/ui-frontend/projects/identity/src/main.ts +++ b/ui/ui-frontend/projects/identity/src/main.ts @@ -44,5 +44,6 @@ if (environment.production) { enableProdMode(); } -platformBrowserDynamic().bootstrapModule(AppModule) +platformBrowserDynamic() + .bootstrapModule(AppModule) .catch((err) => console.log(err)); diff --git a/ui/ui-frontend/projects/identity/src/polyfills.ts b/ui/ui-frontend/projects/identity/src/polyfills.ts index e7ee820e8cd..bd96d161051 100644 --- a/ui/ui-frontend/projects/identity/src/polyfills.ts +++ b/ui/ui-frontend/projects/identity/src/polyfills.ts @@ -55,14 +55,14 @@ */ /** IE10 and IE11 requires the following for NgClass support on SVG elements */ -import 'classlist.js'; // Run `npm install --save classlist.js`. +import 'classlist.js'; // Run `npm install --save classlist.js`. /** * Web Animations `@angular/platform-browser/animations` * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). */ -import 'web-animations-js'; // Run `npm install --save web-animations-js`. +import 'web-animations-js'; // Run `npm install --save web-animations-js`. /** * By default, zone.js will patch all possible macroTask and DomEvents @@ -92,7 +92,7 @@ import './zone-flags.ts'; /*************************************************************************************************** * Zone JS is required by default for Angular itself. */ -import 'zone.js/dist/zone'; // Included with Angular CLI. +import 'zone.js/dist/zone'; // Included with Angular CLI. import '@angular/localize/init'; diff --git a/ui/ui-frontend/projects/identity/src/sass/_form.scss b/ui/ui-frontend/projects/identity/src/sass/_form.scss index a7ba18e03af..28946d04650 100644 --- a/ui/ui-frontend/projects/identity/src/sass/_form.scss +++ b/ui/ui-frontend/projects/identity/src/sass/_form.scss @@ -1,11 +1,11 @@ /** TODO DEPRECATED : REMOVE THIS CSS AT THE END OF THE REWORK **/ .vitamui-form vitamui-slide-toggle { - margin-bottom: 20px; + margin-bottom: 20px; } .form-divider { - width: 100%; - height: 2px; - background-color: #E0E0E0; + width: 100%; + height: 2px; + background-color: #e0e0e0; } diff --git a/ui/ui-frontend/projects/identity/src/sass/_profile-tag.scss b/ui/ui-frontend/projects/identity/src/sass/_profile-tag.scss index f1bd3e08a59..44d5d686726 100644 --- a/ui/ui-frontend/projects/identity/src/sass/_profile-tag.scss +++ b/ui/ui-frontend/projects/identity/src/sass/_profile-tag.scss @@ -1,20 +1,20 @@ /** TODO DEPRECATED : REMOVE THIS CSS AT THE END OF THE REWORK **/ .profile-tag { - font-size: 14px; - font-weight: 500; - font-style: normal; - line-height: normal; - letter-spacing: normal; - text-align: left; - color: var(--vitamui-grey-900); - background-color: #f8f8f8; - padding: 10px 10px 10px 10px; - margin-bottom: 10px; - white-space: nowrap; + font-size: 14px; + font-weight: 500; + font-style: normal; + line-height: normal; + letter-spacing: normal; + text-align: left; + color: var(--vitamui-grey-900); + background-color: #f8f8f8; + padding: 10px 10px 10px 10px; + margin-bottom: 10px; + white-space: nowrap; - i { - color: var(--vitamui-primary); - margin-left: 5px; - } + i { + color: var(--vitamui-primary); + margin-left: 5px; + } } diff --git a/ui/ui-frontend/projects/identity/src/sass/_tooltip.scss b/ui/ui-frontend/projects/identity/src/sass/_tooltip.scss index 31605d67099..784606642e5 100644 --- a/ui/ui-frontend/projects/identity/src/sass/_tooltip.scss +++ b/ui/ui-frontend/projects/identity/src/sass/_tooltip.scss @@ -5,43 +5,43 @@ $arrow-size: 20px; .vitamui-tooltip.mat-tooltip { - background: #E1F3F0; - font-size: 13px; - font-weight: 600; - color: #666666; - border-radius: 15px; - border: 1px solid #E1F3F0; - padding: 5px 20px; - position: relative; - overflow: visible; + background: #e1f3f0; + font-size: 13px; + font-weight: 600; + color: #666666; + border-radius: 15px; + border: 1px solid #e1f3f0; + padding: 5px 20px; + position: relative; + overflow: visible; - &:before { - content: ''; - display: block; - position: absolute; - top: 0; - left: 50%; - border-color: transparent transparent #E1F3F0 transparent; - border-width: $arrow-size * 0.5; - border-style: solid; - width: $arrow-size; - height: $arrow-size; - margin-top: $arrow-size * -1; - margin-left: $arrow-size * -0.5; - } + &:before { + content: ''; + display: block; + position: absolute; + top: 0; + left: 50%; + border-color: transparent transparent #e1f3f0 transparent; + border-width: $arrow-size * 0.5; + border-style: solid; + width: $arrow-size; + height: $arrow-size; + margin-top: $arrow-size * -1; + margin-left: $arrow-size * -0.5; + } - &:after { - content: ''; - display: block; - position: absolute; - top: 0; - left: 50%; - border-color: transparent transparent #E1F3F0 transparent; - border-width: ($arrow-size - 2px) * 0.5; - border-style: solid; - width: $arrow-size - 2px; - height: $arrow-size - 2px; - margin-top: ($arrow-size - 2px) * -1; - margin-left: ($arrow-size - 2px) * -0.5; - } + &:after { + content: ''; + display: block; + position: absolute; + top: 0; + left: 50%; + border-color: transparent transparent #e1f3f0 transparent; + border-width: ($arrow-size - 2px) * 0.5; + border-style: solid; + width: $arrow-size - 2px; + height: $arrow-size - 2px; + margin-top: ($arrow-size - 2px) * -1; + margin-left: ($arrow-size - 2px) * -0.5; + } } diff --git a/ui/ui-frontend/projects/identity/src/sass/_vitamui-tab-group.scss b/ui/ui-frontend/projects/identity/src/sass/_vitamui-tab-group.scss index 746bd520172..6bd76d01142 100644 --- a/ui/ui-frontend/projects/identity/src/sass/_vitamui-tab-group.scss +++ b/ui/ui-frontend/projects/identity/src/sass/_vitamui-tab-group.scss @@ -1,56 +1,58 @@ /** TODO DEPRECATED : REMOVE THIS CSS AT THE END OF THE REWORK **/ .account-tab-group.mat-tab-group { - .mat-tab-header { - border-bottom: none; - margin-left: 0px; - margin-top: -70px; + .mat-tab-header { + border-bottom: none; + margin-left: 0px; + margin-top: -70px; + } + + .mat-tab-label { + opacity: 1; + min-width: 200px; + height: 45px; + background-color: rgba(255, 255, 255, 0.85); + margin: 0 1px; + padding: 0 14px; + font-size: 14px; + font-weight: normal; + color: rgba(72, 80, 83, 0.3); + text-transform: uppercase; + transition: + background-color 200ms ease-out, + color 200ms ease-out; + + &:hover { + color: var(--vitamui-primary); + background-color: rgba(255, 255, 255, 0.8); } - .mat-tab-label { - opacity: 1; - min-width: 200px; - height: 45px; - background-color: rgba(255, 255, 255, 0.85); - margin: 0 1px; - padding: 0 14px; - font-size: 14px; - font-weight: normal; - color: rgba(72, 80, 83, 0.3); - text-transform: uppercase; - transition: background-color 200ms ease-out, color 200ms ease-out; - - &:hover { - color: var(--vitamui-primary); - background-color: rgba(255, 255, 255, 0.8); - } - - &:first-child { - margin-left: 0; - } - - &:last-child { - margin-right: 0; - } - - &:not(.mat-tab-disabled):focus { - background-color: rgba(255, 255, 255, 0.56); - } - - &.mat-tab-label-active, - &.mat-tab-label-active:not(.mat-tab-disabled):focus { - background-color: $white; - font-weight: bold; - color: #5e5d5d; - } + &:first-child { + margin-left: 0; } - .mat-ink-bar { - opacity: 0; + &:last-child { + margin-right: 0; } - .mat-tab-body-content { - padding: 0px; - overflow: none; + &:not(.mat-tab-disabled):focus { + background-color: rgba(255, 255, 255, 0.56); } + + &.mat-tab-label-active, + &.mat-tab-label-active:not(.mat-tab-disabled):focus { + background-color: $white; + font-weight: bold; + color: #5e5d5d; + } + } + + .mat-ink-bar { + opacity: 0; + } + + .mat-tab-body-content { + padding: 0px; + overflow: none; + } } diff --git a/ui/ui-frontend/projects/identity/src/sass/login.scss b/ui/ui-frontend/projects/identity/src/sass/login.scss index a21cba22388..076398ba44f 100644 --- a/ui/ui-frontend/projects/identity/src/sass/login.scss +++ b/ui/ui-frontend/projects/identity/src/sass/login.scss @@ -5,138 +5,138 @@ @import '~ui-frontend-common/sass/mixins/elevation'; .login-box { - position: relative; - display: block; - box-sizing: border-box; - width: 800px; - margin: 120px auto; - padding: 48px 80px; - @include vitamui-modal; - - h1 { - @include login-title; + position: relative; + display: block; + box-sizing: border-box; + width: 800px; + margin: 120px auto; + padding: 48px 80px; + @include vitamui-modal; + + h1 { + @include login-title; + } + + header p { + margin-bottom: 30px; + } + + p { + @include login-text-1; + line-height: 30px; + + small { + @include login-text-2; + font-weight: 400; } - - header p { - margin-bottom: 30px; - } - - p { - @include login-text-1; - line-height: 30px; - - small { - @include login-text-2; - font-weight: 400; - } + } + + strong { + font-weight: 500; + } + + a { + @include vitamui-link; + text-decoration: underline; + } + + input[type='text'], + input[type='email'], + input[type='password'] { + border: none; + outline: none; + border-radius: 25px; + @include dialog-elevation-dark; + transition: border-color 200ms ease-out; + height: 50px; + padding: 0 30px; + border: 1px solid transparent; + + &:focus { + border-color: $greyish-two; } - strong { - font-weight: 500; + &.ng-valid.ng-touched { + border-color: $green; } - a { - @include vitamui-link; - text-decoration: underline; + &.ng-invalid.ng-touched { + border-color: $red; } - input[type=text], - input[type=email], - input[type=password] { - border: none; - outline: none; - border-radius: 25px; - @include dialog-elevation-dark; - transition: border-color 200ms ease-out; - height: 50px; - padding: 0 30px; - border: 1px solid transparent; - - &:focus { - border-color: $greyish-two; - } - - &.ng-valid.ng-touched { - border-color: $green; - } - - &.ng-invalid.ng-touched { - border-color: $red; - } - - &[disabled] { - @include elevation-0; - opacity: 0.4; - } + &[disabled] { + @include elevation-0; + opacity: 0.4; } + } - .form-error { - @include login-error; + .form-error { + @include login-error; - i { - font-size: 36px; - vertical-align: middle; - margin-right: 10px; - } + i { + font-size: 36px; + vertical-align: middle; + margin-right: 10px; + } + } + + button.vitamui-primary { + @include button-primary; + border: none; + height: 50px; + border-radius: 25px; + background-color: var(--vitamui-primary); + @include dialog-elevation-primary; + padding: 0 30px; + transition: opacity 200ms ease-in-out; + border: 1px solid var(--vitamui-primary); + + &:focus:not([disabled]), + &:hover:not([disabled]) { + cursor: pointer; + background-color: #ff8b58; + outline: none; } - button.vitamui-primary { - @include button-primary; - border: none; - height: 50px; - border-radius: 25px; - background-color: var(--vitamui-primary); - @include dialog-elevation-primary; - padding: 0 30px; - transition: opacity 200ms ease-in-out; - border: 1px solid var(--vitamui-primary); - - &:focus:not([disabled]), - &:hover:not([disabled]) { - cursor: pointer; - background-color: #ff8b58; - outline: none; - } - - &[disabled] { - @include elevation-0; - opacity: 0.4; - } + &[disabled] { + @include elevation-0; + opacity: 0.4; } + } - .helper { - @include login-helper; - text-align: right; - transition: opacity 200ms ease-in-out; - margin: 0; + .helper { + @include login-helper; + text-align: right; + transition: opacity 200ms ease-in-out; + margin: 0; - &.hidden { - opacity: 0; - } + &.hidden { + opacity: 0; } - - button.back { - display: flex; - align-items: center; - background: transparent; - color: var(--vitamui-primary); - font-size: 14px; - font-weight: normal; - border: none; - padding: 0; - margin-top: 40px; - cursor: pointer; - - i { - display: block; - font-size: 18px; - color: var(--vitamui-primary); - background-color: #e7f5f2; - width: 30px; - height: 30px; - border-radius: 15px; - line-height: 30px; - margin-right: 10px; - } + } + + button.back { + display: flex; + align-items: center; + background: transparent; + color: var(--vitamui-primary); + font-size: 14px; + font-weight: normal; + border: none; + padding: 0; + margin-top: 40px; + cursor: pointer; + + i { + display: block; + font-size: 18px; + color: var(--vitamui-primary); + background-color: #e7f5f2; + width: 30px; + height: 30px; + border-radius: 15px; + line-height: 30px; + margin-right: 10px; } + } } diff --git a/ui/ui-frontend/projects/identity/src/test.ts b/ui/ui-frontend/projects/identity/src/test.ts index 01098602196..9c31c9f6201 100644 --- a/ui/ui-frontend/projects/identity/src/test.ts +++ b/ui/ui-frontend/projects/identity/src/test.ts @@ -37,17 +37,11 @@ import 'zone.js/dist/zone-testing'; import { getTestBed } from '@angular/core/testing'; -import { - BrowserDynamicTestingModule, - platformBrowserDynamicTesting -} from '@angular/platform-browser-dynamic/testing'; +import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing'; declare const require: any; -getTestBed().initTestEnvironment( - BrowserDynamicTestingModule, - platformBrowserDynamicTesting() -); +getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting()); const context = require.context('./', true, /\.spec\.ts$/); context.keys().map(context); diff --git a/ui/ui-frontend/projects/ingest/src/app/app.component.scss b/ui/ui-frontend/projects/ingest/src/app/app.component.scss index 5b8f5d9826a..15f8ab50ff3 100644 --- a/ui/ui-frontend/projects/ingest/src/app/app.component.scss +++ b/ui/ui-frontend/projects/ingest/src/app/app.component.scss @@ -1,3 +1,3 @@ .app-container { - padding-bottom: 50px; + padding-bottom: 50px; } diff --git a/ui/ui-frontend/projects/ingest/src/app/app.component.spec.ts b/ui/ui-frontend/projects/ingest/src/app/app.component.spec.ts index cc404f3b7be..b93f33f993a 100644 --- a/ui/ui-frontend/projects/ingest/src/app/app.component.spec.ts +++ b/ui/ui-frontend/projects/ingest/src/app/app.component.spec.ts @@ -37,7 +37,7 @@ /* tslint:disable:component-selector max-classes-per-file */ import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; -import { waitForAsync, TestBed } from '@angular/core/testing'; +import { waitForAsync, TestBed } from '@angular/core/testing'; import { MatSidenavModule } from '@angular/material/sidenav'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { Router } from '@angular/router'; @@ -53,25 +53,17 @@ class RouterOutletStubComponent {} class SubrogationBannerStubComponent {} describe('AppComponent', () => { - beforeEach(waitForAsync(() => { const startupServiceStub = { configurationLoaded: () => true, printConfiguration: () => {}, getPlatformName: () => '' }; TestBed.configureTestingModule({ - imports: [ - MatSidenavModule, - NoopAnimationsModule, - ], - declarations: [ - AppComponent, - SubrogationBannerStubComponent, - RouterOutletStubComponent, - ], + imports: [MatSidenavModule, NoopAnimationsModule], + declarations: [AppComponent, SubrogationBannerStubComponent, RouterOutletStubComponent], providers: [ { provide: StartupService, useValue: startupServiceStub }, { provide: AuthService, useValue: { userLoaded: of(null) } }, { provide: Router, useValue: { navigate: () => {} } }, ], - schemas: [ CUSTOM_ELEMENTS_SCHEMA ] + schemas: [CUSTOM_ELEMENTS_SCHEMA], }).compileComponents(); })); @@ -88,5 +80,4 @@ describe('AppComponent', () => { console.log('Title App: ', app); expect(app.title).toEqual('Ingest App'); })); - }); diff --git a/ui/ui-frontend/projects/ingest/src/app/app.component.ts b/ui/ui-frontend/projects/ingest/src/app/app.component.ts index 4ebd6acafbb..1035e0de7d2 100644 --- a/ui/ui-frontend/projects/ingest/src/app/app.component.ts +++ b/ui/ui-frontend/projects/ingest/src/app/app.component.ts @@ -41,10 +41,9 @@ import { StartupService } from 'ui-frontend-common'; @Component({ selector: 'app-root', templateUrl: './app.component.html', - styleUrls: ['./app.component.scss'] + styleUrls: ['./app.component.scss'], }) export class AppComponent implements OnInit { - title = 'Ingest App'; subrogating = false; @@ -52,7 +51,5 @@ export class AppComponent implements OnInit { titleService.setTitle(startupService.getPlatformName()); } - ngOnInit() { - } - + ngOnInit() {} } diff --git a/ui/ui-frontend/projects/ingest/src/app/app.module.ts b/ui/ui-frontend/projects/ingest/src/app/app.module.ts index c0f035e710f..b0e9c55d1c1 100644 --- a/ui/ui-frontend/projects/ingest/src/app/app.module.ts +++ b/ui/ui-frontend/projects/ingest/src/app/app.module.ts @@ -34,29 +34,29 @@ * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ -import {DatePipe, registerLocaleData} from '@angular/common'; -import {HttpBackend, HttpClient} from '@angular/common/http'; -import {default as localeFr} from '@angular/common/locales/fr'; -import {LOCALE_ID, NgModule} from '@angular/core'; -import {BrowserModule, Title} from '@angular/platform-browser'; -import {BrowserAnimationsModule} from '@angular/platform-browser/animations'; -import {ServiceWorkerModule} from '@angular/service-worker'; -import {TranslateLoader, TranslateModule} from '@ngx-translate/core'; -import {QuicklinkModule} from 'ngx-quicklink'; -import {MultiTranslateHttpLoader} from 'ngx-translate-multi-http-loader'; -import {VitamUICommonModule, WINDOW_LOCATION} from 'ui-frontend-common'; -import {environment} from '../environments/environment'; -import {AppRoutingModule} from './app-routing.module'; -import {AppComponent} from './app.component'; -import {CoreModule} from './core/core.module'; -import {HoldingFillingSchemeModule} from './holding-filling-scheme/holding-filling-scheme.module'; -import {IngestModule} from './ingest'; -import {SharedModule} from './shared/shared.module'; +import { DatePipe, registerLocaleData } from '@angular/common'; +import { HttpBackend, HttpClient } from '@angular/common/http'; +import { default as localeFr } from '@angular/common/locales/fr'; +import { LOCALE_ID, NgModule } from '@angular/core'; +import { BrowserModule, Title } from '@angular/platform-browser'; +import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; +import { ServiceWorkerModule } from '@angular/service-worker'; +import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; +import { QuicklinkModule } from 'ngx-quicklink'; +import { MultiTranslateHttpLoader } from 'ngx-translate-multi-http-loader'; +import { VitamUICommonModule, WINDOW_LOCATION } from 'ui-frontend-common'; +import { environment } from '../environments/environment'; +import { AppRoutingModule } from './app-routing.module'; +import { AppComponent } from './app.component'; +import { CoreModule } from './core/core.module'; +import { HoldingFillingSchemeModule } from './holding-filling-scheme/holding-filling-scheme.module'; +import { IngestModule } from './ingest'; +import { SharedModule } from './shared/shared.module'; export function httpLoaderFactory(httpBackend: HttpBackend): MultiTranslateHttpLoader { return new MultiTranslateHttpLoader(new HttpClient(httpBackend), [ - {prefix: './assets/shared-i18n/', suffix: '.json'}, - {prefix: './assets/i18n/', suffix: '.json'}, + { prefix: './assets/shared-i18n/', suffix: '.json' }, + { prefix: './assets/i18n/', suffix: '.json' }, ]); } @@ -82,15 +82,9 @@ registerLocaleData(localeFr, 'fr'); deps: [HttpBackend], }, }), - ServiceWorkerModule.register('ngsw-worker.js', {enabled: environment.production}), - ], - providers: [ - Title, - {provide: LOCALE_ID, useValue: 'fr'}, - {provide: WINDOW_LOCATION, useValue: window.location}, - DatePipe, + ServiceWorkerModule.register('ngsw-worker.js', { enabled: environment.production }), ], + providers: [Title, { provide: LOCALE_ID, useValue: 'fr' }, { provide: WINDOW_LOCATION, useValue: window.location }, DatePipe], bootstrap: [AppComponent], }) -export class AppModule { -} +export class AppModule {} diff --git a/ui/ui-frontend/projects/ingest/src/app/core/api/ingest-api.service.spec.ts b/ui/ui-frontend/projects/ingest/src/app/core/api/ingest-api.service.spec.ts index 40b6848c654..29a244c81e0 100644 --- a/ui/ui-frontend/projects/ingest/src/app/core/api/ingest-api.service.spec.ts +++ b/ui/ui-frontend/projects/ingest/src/app/core/api/ingest-api.service.spec.ts @@ -6,17 +6,15 @@ import { InjectorModule, LoggerModule, BASE_URL, ENVIRONMENT } from 'ui-frontend import { environment } from '../../../environments/environment.prod'; describe('IngestApiService', () => { - beforeEach(() => TestBed.configureTestingModule({ - imports: [ - HttpClientTestingModule, - InjectorModule, - LoggerModule.forRoot() - ], - providers: [ - { provide: BASE_URL, useValue: '/fake-api' }, - { provide: ENVIRONMENT, useValue: environment } - ] - })); + beforeEach(() => + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule, InjectorModule, LoggerModule.forRoot()], + providers: [ + { provide: BASE_URL, useValue: '/fake-api' }, + { provide: ENVIRONMENT, useValue: environment }, + ], + }), + ); it('should be created', () => { const service: IngestApiService = TestBed.inject(IngestApiService); expect(service).toBeTruthy(); diff --git a/ui/ui-frontend/projects/ingest/src/app/core/api/ingest-api.service.ts b/ui/ui-frontend/projects/ingest/src/app/core/api/ingest-api.service.ts index 626eff7ec4c..71bac3a4c78 100644 --- a/ui/ui-frontend/projects/ingest/src/app/core/api/ingest-api.service.ts +++ b/ui/ui-frontend/projects/ingest/src/app/core/api/ingest-api.service.ts @@ -5,10 +5,9 @@ import { Observable } from 'rxjs'; import { tap } from 'rxjs/operators'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class IngestApiService extends BaseHttpClient { - baseUrl: string; constructor(http: HttpClient, @Inject(BASE_URL) baseUrl: string) { @@ -25,25 +24,22 @@ export class IngestApiService extends BaseHttpClient { } getAllByParams(params: HttpParams, headers?: HttpHeaders) { - return super.getAllByParams(params, headers).pipe( - tap(result => result.map(ev => ev.parsedData = (ev.data != null) ? JSON.parse(ev.data) : null)) - ); + return super + .getAllByParams(params, headers) + .pipe(tap((result) => result.map((ev) => (ev.parsedData = ev.data != null ? JSON.parse(ev.data) : null)))); } getAllPaginated(pageRequest: PageRequest, embedded?: string, headers?: HttpHeaders): Observable> { - return super.getAllPaginated(pageRequest, embedded, headers).pipe( - tap(result => result.values.map(ev => ev.parsedData = (ev.data != null) ? JSON.parse(ev.data) : null)) - ); + return super + .getAllPaginated(pageRequest, embedded, headers) + .pipe(tap((result) => result.values.map((ev) => (ev.parsedData = ev.data != null ? JSON.parse(ev.data) : null)))); } getOne(id: string, headers?: HttpHeaders): Observable { - return super.getOne(id, headers).pipe( - tap(ev => ev.parsedData = (ev.data != null) ? JSON.parse(ev.data) : null) - ); + return super.getOne(id, headers).pipe(tap((ev) => (ev.parsedData = ev.data != null ? JSON.parse(ev.data) : null))); } - downloadODTReport(id : string) : Observable { + downloadODTReport(id: string): Observable { return this.http.get(`${this.apiUrl}/odtreport/${id}`, { responseType: 'blob' }); } - } diff --git a/ui/ui-frontend/projects/ingest/src/app/core/common/ingest-list.ts b/ui/ui-frontend/projects/ingest/src/app/core/common/ingest-list.ts index a7667e09aa2..218baedfab2 100644 --- a/ui/ui-frontend/projects/ingest/src/app/core/common/ingest-list.ts +++ b/ui/ui-frontend/projects/ingest/src/app/core/common/ingest-list.ts @@ -5,8 +5,12 @@ export enum IngestUploadStatus { } export class IngestInfo { - constructor(public name: string, public size: number, public sizeUploaded: number, public status: IngestUploadStatus) { - } + constructor( + public name: string, + public size: number, + public sizeUploaded: number, + public status: IngestUploadStatus, + ) {} } export class IngestList { diff --git a/ui/ui-frontend/projects/ingest/src/app/core/common/upload.component.html b/ui/ui-frontend/projects/ingest/src/app/core/common/upload.component.html index 30f2dc495cd..95e91bbace4 100644 --- a/ui/ui-frontend/projects/ingest/src/app/core/common/upload.component.html +++ b/ui/ui-frontend/projects/ingest/src/app/core/common/upload.component.html @@ -42,17 +42,17 @@

      {{ 'INGEST_ACTION.MESSAGE_IDENTIFIER.MESSAGE_LABEL_IMPORT_TYPE.BLANK_WORKFLO

      - +
      -
      {{ 'INGEST_UPLOAD.ADD_FILE' | translate }}
      +
      {{ 'INGEST_UPLOAD.ADD_FILE' | translate }}
      {{ 'INGEST_UPLOAD.BROWSE' | translate }}
      {{ 'INGEST_UPLOAD.ADD_FILE_DESCRIPTION_1' | translate }}
      + >
      {{ 'INGEST_UPLOAD.ADD_FILE_DESCRIPTION_2' | translate }}
      @@ -61,7 +61,7 @@

      {{ 'INGEST_ACTION.MESSAGE_IDENTIFIER.MESSAGE_LABEL_IMPORT_TYPE.BLANK_WORKFLO

      diff --git a/ui/ui-frontend/projects/ingest/src/app/core/common/upload.component.scss b/ui/ui-frontend/projects/ingest/src/app/core/common/upload.component.scss index ef5e582ab4a..2d3469ea56b 100644 --- a/ui/ui-frontend/projects/ingest/src/app/core/common/upload.component.scss +++ b/ui/ui-frontend/projects/ingest/src/app/core/common/upload.component.scss @@ -1,196 +1,193 @@ @import '~ui-frontend-common/sass/variables/colors'; $field-spacing: 15px; -$dark-red: #EA0101; +$dark-red: #ea0101; .header { - padding: 30px 60px 0 60px; + padding: 30px 60px 0 60px; } .content { - padding: 0px 60px 60px 60px; + padding: 0px 60px 60px 60px; } h2 { - font-size: 26px; - line-height: 46px; - margin-top: 23px; - margin-bottom: 37px; + font-size: 26px; + line-height: 46px; + margin-top: 23px; + margin-bottom: 37px; } i.icon-error { - color: red; - font-size: 40px; + color: red; + font-size: 40px; } .actions { - margin-top: 20px; - display: flex; + margin-top: 20px; + display: flex; } .actions > button:not(:last-child) { - margin-right: 20px; + margin-right: 20px; } .form-group { - padding-bottom: 30px; + padding-bottom: 30px; } .url-select { - cursor: pointer; - font-size: 30px; - color: var(--vitamui-primary); - letter-spacing: 0.1px; - white-space: nowrap; - transform-origin: left; - transition: transform 150ms ease-out; + cursor: pointer; + font-size: 30px; + color: var(--vitamui-primary); + letter-spacing: 0.1px; + white-space: nowrap; + transform-origin: left; + transition: transform 150ms ease-out; } .input-file { - display: none; + display: none; } .inline-label { - padding-top: 5px; + padding-top: 5px; } button.primary { - margin-right: 20px; + margin-right: 20px; } button.back { - margin-top: 60px; + margin-top: 60px; } button > small { - display: block; - font-size: 12px; - font-weight: 400; + display: block; + font-size: 12px; + font-weight: 400; } .hint { - color: #a5a5a5; - font-size: 15px; + color: #a5a5a5; + font-size: 15px; } .drag-and-drop-area { - width: 100%; - height: 210px; - border: 2px dashed var(--vitamui-primary); - border-radius: 6px; - box-shadow: 0px 0px 80px rgba(255, 255, 249, 0.3); - background: $white; - margin-bottom: 10px; - margin-top: -20px; - - p { - padding-top: 20px; - } + width: 100%; + height: 210px; + border: 2px dashed var(--vitamui-primary); + border-radius: 6px; + box-shadow: 0px 0px 80px rgba(255, 255, 249, 0.3); + background: $white; + margin-bottom: 10px; + margin-top: -20px; + + p { + padding-top: 20px; + } } .on-over { - border: 2px solid var(--vitamui-secondary); + border: 2px solid var(--vitamui-secondary); - p { - color: $white; - } + p { + color: $white; + } - .drop-area { - background: #5CBAA9; - opacity: 0.9; - color: $white; - } + .drop-area { + background: #5cbaa9; + opacity: 0.9; + color: $white; + } } .drag-container { - width: 100%; - height: 160px; - vertical-align: middle; - text-align: center; + width: 100%; + height: 160px; + vertical-align: middle; + text-align: center; } .drop-area { - text-align: center; - height: 156px; + text-align: center; + height: 156px; } .upload-text { - padding-top: 5%; - font-size: 15px; - line-height: 18px; - color: #a5a5a5; - text-align: center; - .upload { - color: var(--vitamui-secondary); - } - -} - -.sip-drop { - text-align: center; - margin-top: 25px; - margin-bottom: 10px; + padding-top: 5%; + font-size: 15px; + line-height: 18px; + color: #a5a5a5; + text-align: center; + .upload { + color: var(--vitamui-secondary); + } +} + +.sip-drop { + text-align: center; + margin-top: 25px; + margin-bottom: 10px; + color: var(--vitamui-primary); + font-style: normal; + font-size: 30px; + small { color: var(--vitamui-primary); - font-style: normal; - font-size: 30px; - small { - color: var(--vitamui-primary); - } -} -.sip-drop-small { - text-align: center; - margin-top: 30px; - margin-bottom: 10px; - color: var(--vitamui-primary); - font-style: normal; - font-weight: bold; - font-size: 13px; - line-height: 10px; - + } +} +.sip-drop-small { + text-align: center; + margin-top: 30px; + margin-bottom: 10px; + color: var(--vitamui-primary); + font-style: normal; + font-weight: bold; + font-size: 13px; + line-height: 10px; } .error-message { - color: $red; - font-size: 16px; - margin-top: 80px; + color: $red; + font-size: 16px; + margin-top: 80px; } -.message-success{ - padding-bottom: 50%; - padding: 34px 0px 34px 34px; +.message-success { + padding-bottom: 50%; + padding: 34px 0px 34px 34px; } .success-icon { - color:#27740A; - font-size: 50px; + color: #27740a; + font-size: 50px; } - .error-icon { - color: $dark-red; - font-size: 50px; + color: $dark-red; + font-size: 50px; } - .file-info-container { - padding: 34px 0px 34px 34px; - display: flex; - flex-direction: row; - max-width: 50%; - } +.file-info-container { + padding: 34px 0px 34px 34px; + display: flex; + flex-direction: row; + max-width: 50%; +} .file-info-class { - font-size: 14px; - line-height: 20px; - text-align: center; - margin-top: 50px; - margin-bottom: 10px; - color: #000000; - font-style: normal; - font-weight: bold; - font-size: 18px; - - small { - color: #a5a5a5; - } + font-size: 14px; + line-height: 20px; + text-align: center; + margin-top: 50px; + margin-bottom: 10px; + color: #000000; + font-style: normal; + font-weight: bold; + font-size: 18px; + + small { + color: #a5a5a5; + } } .font-class-file { -font-size: 13px; + font-size: 13px; } diff --git a/ui/ui-frontend/projects/ingest/src/app/core/common/upload.component.spec.ts b/ui/ui-frontend/projects/ingest/src/app/core/common/upload.component.spec.ts index a0250a62a7d..d08201c98c4 100644 --- a/ui/ui-frontend/projects/ingest/src/app/core/common/upload.component.spec.ts +++ b/ui/ui-frontend/projects/ingest/src/app/core/common/upload.component.spec.ts @@ -66,7 +66,7 @@ describe('UploadComponent', () => { { provide: ConfirmDialogService, useValue: { listenToEscapeKeyPress: () => EMPTY } }, { provide: UploadService, useValue: uploadServiceSpy }, { provide: StartupService, useValue: { getReferentialUrl: () => '' } }, - ] + ], }).compileComponents(); })); @@ -81,14 +81,12 @@ describe('UploadComponent', () => { }); describe('initContextIdentifier', () => { - beforeEach(() => { spyOn(console, 'error'); }); }); describe('checkFileExtension', () => { - it('should return true when extension zip is correct', () => { expect(component.checkFileExtension('correct.zip')).toBeTruthy(); }); diff --git a/ui/ui-frontend/projects/ingest/src/app/core/common/upload.component.ts b/ui/ui-frontend/projects/ingest/src/app/core/common/upload.component.ts index fa39c8f109f..2d3e6045aac 100644 --- a/ui/ui-frontend/projects/ingest/src/app/core/common/upload.component.ts +++ b/ui/ui-frontend/projects/ingest/src/app/core/common/upload.component.ts @@ -34,15 +34,15 @@ * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ -import {Component, Inject, OnInit, ViewChild} from '@angular/core'; -import {FormBuilder, FormGroup} from '@angular/forms'; -import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog'; -import {MatSnackBar} from '@angular/material/snack-bar'; -import {BytesPipe, Logger, StartupService} from 'ui-frontend-common'; +import { Component, Inject, OnInit, ViewChild } from '@angular/core'; +import { FormBuilder, FormGroup } from '@angular/forms'; +import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; +import { MatSnackBar } from '@angular/material/snack-bar'; +import { BytesPipe, Logger, StartupService } from 'ui-frontend-common'; -import {VitamUISnackBarComponent} from '../../shared/vitamui-snack-bar'; -import {IngestType} from './ingest-type.enum'; -import {UploadService} from './upload.service'; +import { VitamUISnackBarComponent } from '../../shared/vitamui-snack-bar'; +import { IngestType } from './ingest-type.enum'; +import { UploadService } from './upload.service'; const LAST_STEP_INDEX = 1; @@ -70,7 +70,7 @@ export class UploadComponent implements OnInit { public stepIndex = 0; public stepCount = 2; - @ViewChild('fileSearch', {static: false}) fileSearch: any; + @ViewChild('fileSearch', { static: false }) fileSearch: any; constructor( @Inject(MAT_DIALOG_DATA) public data: any, @@ -79,7 +79,7 @@ export class UploadComponent implements OnInit { private uploadService: UploadService, private snackBar: MatSnackBar, private startupService: StartupService, - public logger: Logger + public logger: Logger, ) { this.sipForm = this.formBuilder.group({ hasSip: null, @@ -121,7 +121,7 @@ export class UploadComponent implements OnInit { this.fileSizeString = transformer.transform(this.fileSize); if (!this.checkFileExtension(this.fileName)) { - this.message = 'Le fichier déposé n\'est pas au bon format'; + this.message = "Le fichier déposé n'est pas au bon format"; this.hasError = true; return; } @@ -144,12 +144,17 @@ export class UploadComponent implements OnInit { this.uploadService .uploadIngestV2(this.tenantIdentifier, this.fileToUpload, this.fileToUpload.name, this.contextId, (operationId) => { this.snackBar.dismiss(); - if (this.contextId === IngestType.HOLDING_SCHEME || this.contextId === IngestType.FILING_SCHEME - || this.contextId === IngestType.BLANK_TEST) { + if ( + this.contextId === IngestType.HOLDING_SCHEME || + this.contextId === IngestType.FILING_SCHEME || + this.contextId === IngestType.BLANK_TEST + ) { this.displaySnackBar({ type: 'fileUploaded', - messageKey: this.contextId === IngestType.BLANK_TEST ? 'INGEST_UPLOAD.BLANK_UPLOAD_COMPLETE_MESSAGE' - : 'INGEST_UPLOAD.UPLOAD_COMPLETE_MESSAGE', + messageKey: + this.contextId === IngestType.BLANK_TEST + ? 'INGEST_UPLOAD.BLANK_UPLOAD_COMPLETE_MESSAGE' + : 'INGEST_UPLOAD.UPLOAD_COMPLETE_MESSAGE', buttonAction: () => this.goToOperation(operationId), buttonMessageKey: 'INGEST_UPLOAD.TO_OPERATION_APP', }); @@ -165,7 +170,7 @@ export class UploadComponent implements OnInit { }, (error: any) => { this.message = error.message; - } + }, ); } diff --git a/ui/ui-frontend/projects/ingest/src/app/core/common/upload.module.ts b/ui/ui-frontend/projects/ingest/src/app/core/common/upload.module.ts index 3058eca0455..c0620fec001 100644 --- a/ui/ui-frontend/projects/ingest/src/app/core/common/upload.module.ts +++ b/ui/ui-frontend/projects/ingest/src/app/core/common/upload.module.ts @@ -61,12 +61,10 @@ import { SharedModule } from '../../shared/shared.module'; MatSnackBarModule, ReactiveFormsModule, VitamUICommonModule, - MatProgressBarModule - ], - declarations: [ - UploadComponent, + MatProgressBarModule, ], + declarations: [UploadComponent], entryComponents: [UploadComponent], - providers: [UploadService] + providers: [UploadService], }) -export class UploadModule { } +export class UploadModule {} diff --git a/ui/ui-frontend/projects/ingest/src/app/core/common/upload.service.ts b/ui/ui-frontend/projects/ingest/src/app/core/common/upload.service.ts index 93c9aeb7de9..14e88a90776 100644 --- a/ui/ui-frontend/projects/ingest/src/app/core/common/upload.service.ts +++ b/ui/ui-frontend/projects/ingest/src/app/core/common/upload.service.ts @@ -34,13 +34,13 @@ * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ -import {HttpClient, HttpEvent, HttpEventType, HttpHeaders, HttpRequest} from '@angular/common/http'; -import {Injectable} from '@angular/core'; -import {BehaviorSubject, Observable} from 'rxjs'; +import { HttpClient, HttpEvent, HttpEventType, HttpHeaders, HttpRequest } from '@angular/common/http'; +import { Injectable } from '@angular/core'; +import { BehaviorSubject, Observable } from 'rxjs'; -import {IngestApiService} from '../api/ingest-api.service'; -import {IngestInfo, IngestList, IngestUploadStatus} from './ingest-list'; -import {IngestType} from './ingest-type.enum'; +import { IngestApiService } from '../api/ingest-api.service'; +import { IngestInfo, IngestList, IngestUploadStatus } from './ingest-list'; +import { IngestType } from './ingest-type.enum'; const tenantKey = 'X-Tenant-Id'; const contextIdKey = 'X-Context-Id'; @@ -50,7 +50,10 @@ const actionKey = 'X-Action'; export class UploadService { uploadStatus = new BehaviorSubject(new IngestList()); - constructor(private ingestApiService: IngestApiService, private httpClient: HttpClient) {} + constructor( + private ingestApiService: IngestApiService, + private httpClient: HttpClient, + ) {} filesStatus(): BehaviorSubject { return this.uploadStatus; @@ -76,7 +79,7 @@ export class UploadService { contextId: IngestType, action: string, file: Blob, - fileName: string + fileName: string, ): Observable> { let headers = new HttpHeaders(); headers = headers.set(tenantKey, tenantIdentifier.toString()); @@ -101,7 +104,7 @@ export class UploadService { file: Blob, fileName: string, type: IngestType, - callback?: (operationId: string) => any + callback?: (operationId: string) => any, ): Observable { let progressPercent = 0; this.addNewUploadFile(fileName, new IngestInfo(fileName, file.size, 0, IngestUploadStatus.WIP)); @@ -123,7 +126,7 @@ export class UploadService { (error) => { this.updateFileStatus(fileName, IngestUploadStatus.ERROR); console.log('ERROR: ', error); - } + }, ); return this.uploadStatus; } diff --git a/ui/ui-frontend/projects/ingest/src/app/core/core.module.ts b/ui/ui-frontend/projects/ingest/src/app/core/core.module.ts index 15bf72a34c4..912295ba019 100644 --- a/ui/ui-frontend/projects/ingest/src/app/core/core.module.ts +++ b/ui/ui-frontend/projects/ingest/src/app/core/core.module.ts @@ -41,22 +41,15 @@ import { BASE_URL, ENVIRONMENT, InjectorModule, LoggerModule, throwIfAlreadyLoad import { environment } from '../../environments/environment'; @NgModule({ - imports: [ - HttpClientModule, - VitamUICommonModule, - InjectorModule, - LoggerModule.forRoot() - ], + imports: [HttpClientModule, VitamUICommonModule, InjectorModule, LoggerModule.forRoot()], exports: [VitamUICommonModule], providers: [ { provide: BASE_URL, useValue: './ingest-api' }, - { provide: ENVIRONMENT, useValue: environment } - ] + { provide: ENVIRONMENT, useValue: environment }, + ], }) export class CoreModule { - constructor(@Optional() @SkipSelf() parentModule: CoreModule) { throwIfAlreadyLoaded(parentModule, 'CoreModule'); } - } diff --git a/ui/ui-frontend/projects/ingest/src/app/holding-filling-scheme/holding-filling-scheme-routing.module.ts b/ui/ui-frontend/projects/ingest/src/app/holding-filling-scheme/holding-filling-scheme-routing.module.ts index bf0ad1b75e3..c7ac16eb8b4 100644 --- a/ui/ui-frontend/projects/ingest/src/app/holding-filling-scheme/holding-filling-scheme-routing.module.ts +++ b/ui/ui-frontend/projects/ingest/src/app/holding-filling-scheme/holding-filling-scheme-routing.module.ts @@ -40,36 +40,28 @@ import { Route, RouterModule } from '@angular/router'; import { VitamUITenantSelectComponent, TenantSelectionGuard, ActiveTenantGuard } from 'ui-frontend-common'; import { HoldingFillingSchemeComponent } from './holding-filling-scheme.component'; - - const routes: Route[] = [ { path: '', redirectTo: 'tenant', - pathMatch: 'full' + pathMatch: 'full', }, { path: 'tenant', component: VitamUITenantSelectComponent, pathMatch: 'full', - canActivate: [TenantSelectionGuard] + canActivate: [TenantSelectionGuard], }, { path: 'tenant/:tenantIdentifier', component: HoldingFillingSchemeComponent, - canActivate: [ActiveTenantGuard] - } + canActivate: [ActiveTenantGuard], + }, ]; - @NgModule({ declarations: [], - imports: [ - CommonModule, - RouterModule.forChild(routes) - ], - exports: [ - RouterModule - ] + imports: [CommonModule, RouterModule.forChild(routes)], + exports: [RouterModule], }) -export class HoldingFillingSchemeRoutingModule { } +export class HoldingFillingSchemeRoutingModule {} diff --git a/ui/ui-frontend/projects/ingest/src/app/holding-filling-scheme/holding-filling-scheme.component.spec.ts b/ui/ui-frontend/projects/ingest/src/app/holding-filling-scheme/holding-filling-scheme.component.spec.ts index 67135f8b3e8..2f3c9b0ce2f 100644 --- a/ui/ui-frontend/projects/ingest/src/app/holding-filling-scheme/holding-filling-scheme.component.spec.ts +++ b/ui/ui-frontend/projects/ingest/src/app/holding-filling-scheme/holding-filling-scheme.component.spec.ts @@ -34,30 +34,29 @@ * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ -import {ComponentFixture, TestBed, waitForAsync} from '@angular/core/testing'; -import {FormBuilder} from '@angular/forms'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; +import { FormBuilder } from '@angular/forms'; -import {MatNativeDateModule} from '@angular/material/core'; -import {MatDatepickerModule} from '@angular/material/datepicker'; -import {BrowserAnimationsModule, NoopAnimationsModule} from '@angular/platform-browser/animations'; -import {RouterTestingModule} from '@angular/router/testing'; +import { MatNativeDateModule } from '@angular/material/core'; +import { MatDatepickerModule } from '@angular/material/datepicker'; +import { BrowserAnimationsModule, NoopAnimationsModule } from '@angular/platform-browser/animations'; +import { RouterTestingModule } from '@angular/router/testing'; -import {Component, NO_ERRORS_SCHEMA} from '@angular/core'; -import {MatDialog, MatDialogModule} from '@angular/material/dialog'; -import {MatMenuModule} from '@angular/material/menu'; -import {MatSidenavModule} from '@angular/material/sidenav'; -import {ActivatedRoute} from '@angular/router'; -import {of} from 'rxjs'; -import {InjectorModule, LoggerModule, SearchBarModule} from 'ui-frontend-common'; -import {VitamUICommonTestModule} from 'ui-frontend-common/testing'; -import {environment} from '../../environments/environment'; -import {IngestService} from '../ingest/ingest.service'; -import {HoldingFillingSchemeComponent} from './holding-filling-scheme.component'; -import {IngestType} from "../core/common/ingest-type.enum"; +import { Component, NO_ERRORS_SCHEMA } from '@angular/core'; +import { MatDialog, MatDialogModule } from '@angular/material/dialog'; +import { MatMenuModule } from '@angular/material/menu'; +import { MatSidenavModule } from '@angular/material/sidenav'; +import { ActivatedRoute } from '@angular/router'; +import { of } from 'rxjs'; +import { InjectorModule, LoggerModule, SearchBarModule } from 'ui-frontend-common'; +import { VitamUICommonTestModule } from 'ui-frontend-common/testing'; +import { environment } from '../../environments/environment'; +import { IngestService } from '../ingest/ingest.service'; +import { HoldingFillingSchemeComponent } from './holding-filling-scheme.component'; +import { IngestType } from '../core/common/ingest-type.enum'; -@Component({selector: 'app-ingest-list', template: ''}) -class IngestListStubComponent { -} +@Component({ selector: 'app-ingest-list', template: '' }) +class IngestListStubComponent {} describe('HoldingFilingSchemeComponent', () => { let component: HoldingFillingSchemeComponent; @@ -65,12 +64,12 @@ describe('HoldingFilingSchemeComponent', () => { const ingestServiceMock = { ingest: () => of('test ingest'), - search: () => of([]) + search: () => of([]), }; beforeEach(waitForAsync(() => { const matDialogSpy = jasmine.createSpyObj('MatDialog', ['open']); - matDialogSpy.open.and.returnValue({afterClosed: () => of(true)}); + matDialogSpy.open.and.returnValue({ afterClosed: () => of(true) }); TestBed.configureTestingModule({ imports: [ MatDatepickerModule, @@ -87,23 +86,19 @@ describe('HoldingFilingSchemeComponent', () => { SearchBarModule, MatDialogModule, ], - declarations: [ - HoldingFillingSchemeComponent, - IngestListStubComponent - ], + declarations: [HoldingFillingSchemeComponent, IngestListStubComponent], providers: [ FormBuilder, - {provide: MatDialog, useValue: matDialogSpy}, - {provide: IngestService, useValue: ingestServiceMock}, + { provide: MatDialog, useValue: matDialogSpy }, + { provide: IngestService, useValue: ingestServiceMock }, { provide: ActivatedRoute, - useValue: {params: of({tenantIdentifier: 1}), data: of({appId: 'HOLDING_FILLING_SCHEME_APP'})} + useValue: { params: of({ tenantIdentifier: 1 }), data: of({ appId: 'HOLDING_FILLING_SCHEME_APP' }) }, }, - {provide: environment, useValue: environment} + { provide: environment, useValue: environment }, ], - schemas: [NO_ERRORS_SCHEMA] - }) - .compileComponents(); + schemas: [NO_ERRORS_SCHEMA], + }).compileComponents(); })); beforeEach(() => { diff --git a/ui/ui-frontend/projects/ingest/src/app/holding-filling-scheme/holding-filling-scheme.component.ts b/ui/ui-frontend/projects/ingest/src/app/holding-filling-scheme/holding-filling-scheme.component.ts index 70ec1386ba2..d35d262561d 100644 --- a/ui/ui-frontend/projects/ingest/src/app/holding-filling-scheme/holding-filling-scheme.component.ts +++ b/ui/ui-frontend/projects/ingest/src/app/holding-filling-scheme/holding-filling-scheme.component.ts @@ -34,29 +34,34 @@ * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ -import {Component, OnInit} from '@angular/core'; -import {MatDialog, MatDialogConfig} from '@angular/material/dialog'; -import {ActivatedRoute, Router} from '@angular/router'; -import {GlobalEventService, SidenavPage} from 'ui-frontend-common'; -import {IngestType} from '../core/common/ingest-type.enum'; -import {UploadComponent} from '../core/common/upload.component'; +import { Component, OnInit } from '@angular/core'; +import { MatDialog, MatDialogConfig } from '@angular/material/dialog'; +import { ActivatedRoute, Router } from '@angular/router'; +import { GlobalEventService, SidenavPage } from 'ui-frontend-common'; +import { IngestType } from '../core/common/ingest-type.enum'; +import { UploadComponent } from '../core/common/upload.component'; @Component({ selector: 'app-holding-filling-scheme', templateUrl: './holding-filling-scheme.component.html', - styleUrls: ['./holding-filling-scheme.component.scss'] + styleUrls: ['./holding-filling-scheme.component.scss'], }) export class HoldingFillingSchemeComponent extends SidenavPage implements OnInit { IngestType = IngestType; tenantIdentifier: string; - constructor(private router: Router, private route: ActivatedRoute, globalEventService: GlobalEventService, public dialog: MatDialog) { + constructor( + private router: Router, + private route: ActivatedRoute, + globalEventService: GlobalEventService, + public dialog: MatDialog, + ) { super(route, globalEventService); } ngOnInit() { - this.route.params.subscribe(params => { + this.route.params.subscribe((params) => { this.tenantIdentifier = params.tenantIdentifier; }); } @@ -69,7 +74,7 @@ export class HoldingFillingSchemeComponent extends SidenavPage implements O dialogConfig.data = { tenantIdentifier: this.tenantIdentifier, - givenContextId: type + givenContextId: type, }; const dialogRef = this.dialog.open(UploadComponent, dialogConfig); @@ -78,7 +83,6 @@ export class HoldingFillingSchemeComponent extends SidenavPage implements O } changeTenant(tenantIdentifier: number) { - this.router.navigate(['..', tenantIdentifier], {relativeTo: this.route}); + this.router.navigate(['..', tenantIdentifier], { relativeTo: this.route }); } - } diff --git a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-list/ingest-list.component.html b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-list/ingest-list.component.html index bcdcb429a69..5215acaea21 100644 --- a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-list/ingest-list.component.html +++ b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-list/ingest-list.component.html @@ -4,8 +4,7 @@
      {{ 'INGEST_LIST.ID' | translate }} - +
      @@ -31,14 +30,15 @@
      {{ 'INGEST_LIST.STATUS' | translate }}
      -
      +
      -
      - -
      +
      + +
      {{ ingest?.obIdIn }}
      @@ -57,27 +57,27 @@
      {{ 'INGEST_LIST.RESULT_STATUS.FINISHED' | translate }} -
      +
      {{ 'INGEST_LIST.RESULT.OK' | translate }}
      {{ 'INGEST_LIST.RESULT.STARTED' | translate }} -
      +
      ....
      {{ 'INGEST_LIST.RESULT_STATUS.FINISHED' | translate }} -
      +
      {{ 'INGEST_LIST.RESULT.WARNING' | translate }}
      {{ 'INGEST_LIST.RESULT_STATUS.BREAK' | translate }} -
      +
      {{ 'INGEST_LIST.RESULT.FATAL' | translate }}
      {{ 'INGEST_LIST.RESULT_STATUS.FINISHED' | translate }} -
      +
      {{ 'INGEST_LIST.RESULT.KO' | translate }}
      diff --git a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-list/ingest-list.component.scss b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-list/ingest-list.component.scss index 12a18332c18..2e130c3a416 100644 --- a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-list/ingest-list.component.scss +++ b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-list/ingest-list.component.scss @@ -1,26 +1,26 @@ -@import "~ui-frontend-common/sass/variables/colors"; -@import "~ui-frontend-common/sass/mixins/elevation"; +@import '~ui-frontend-common/sass/variables/colors'; +@import '~ui-frontend-common/sass/mixins/elevation'; span.date { - font-size: 14px; - text-align: left; - font-weight: normal; - color: var(--vitamui-grey-600); - } + font-size: 14px; + text-align: left; + font-weight: normal; + color: var(--vitamui-grey-600); +} -.vitamui-table-head{ - > div { - display: flex; - align-items: center; - flex-wrap: nowrap; - } - } - .text-center { - text-align: center; +.vitamui-table-head { + > div { + display: flex; + align-items: center; + flex-wrap: nowrap; } -.status{ - font-weight: bold; } -.text-grey{ - color: #a6a6a6; +.text-center { + text-align: center; +} +.status { + font-weight: bold; +} +.text-grey { + color: #a6a6a6; } diff --git a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-list/ingest-list.component.ts b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-list/ingest-list.component.ts index ab1f6b0545b..55e16c3da59 100644 --- a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-list/ingest-list.component.ts +++ b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-list/ingest-list.component.ts @@ -34,17 +34,12 @@ * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ -import {Component, EventEmitter, Input, OnDestroy, OnInit, Output} from '@angular/core'; -import {merge, Subject} from 'rxjs'; -import {debounceTime} from 'rxjs/operators'; -import {DEFAULT_PAGE_SIZE, Direction, InfiniteScrollTable, PageRequest} from 'ui-frontend-common'; -import {IngestService} from '../ingest.service'; -import { - IngestStatus, - ingestStatus, - ingestStatusVisualColor, - LogbookOperation -} from "../../models/logbook-event.interface"; +import { Component, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core'; +import { merge, Subject } from 'rxjs'; +import { debounceTime } from 'rxjs/operators'; +import { DEFAULT_PAGE_SIZE, Direction, InfiniteScrollTable, PageRequest } from 'ui-frontend-common'; +import { IngestService } from '../ingest.service'; +import { IngestStatus, ingestStatus, ingestStatusVisualColor, LogbookOperation } from '../../models/logbook-event.interface'; const FILTER_DEBOUNCE_TIME_MS = 400; @@ -81,7 +76,7 @@ export class IngestListComponent extends InfiniteScrollTable implements OnD if (!this.dataSource) { return; } - const index = this.dataSource.findIndex(o => o.id === ingest.id); + const index = this.dataSource.findIndex((o) => o.id === ingest.id); this.dataSource[index] = ingest; } @@ -106,7 +101,7 @@ export class IngestListComponent extends InfiniteScrollTable implements OnD ngOnInit() { this.ingestService .search( - new PageRequest(0, DEFAULT_PAGE_SIZE, this.orderBy, Direction.DESCENDANT, JSON.stringify(this.buildIngestCriteriaFromSearch())) + new PageRequest(0, DEFAULT_PAGE_SIZE, this.orderBy, Direction.DESCENDANT, JSON.stringify(this.buildIngestCriteriaFromSearch())), ) .subscribe((data: any[]) => { data.forEach((element: any) => { diff --git a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-list/ingest-list.module.ts b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-list/ingest-list.module.ts index 3eca19811dc..ff7aeb16591 100644 --- a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-list/ingest-list.module.ts +++ b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-list/ingest-list.module.ts @@ -41,16 +41,9 @@ import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; import { VitamUICommonModule } from 'ui-frontend-common'; import { IngestListComponent } from './ingest-list.component'; - @NgModule({ declarations: [IngestListComponent], - imports: [ - CommonModule, - MatProgressSpinnerModule, - VitamUICommonModule - ], - exports: [ - IngestListComponent - ] + imports: [CommonModule, MatProgressSpinnerModule, VitamUICommonModule], + exports: [IngestListComponent], }) -export class IngestListModule { } +export class IngestListModule {} diff --git a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/event-display-helper.service.ts b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/event-display-helper.service.ts index 9e559e82b4b..ae61de35c64 100644 --- a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/event-display-helper.service.ts +++ b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/event-display-helper.service.ts @@ -37,27 +37,24 @@ import { Injectable } from '@angular/core'; import { Event } from './event'; - @Injectable() export class EventDisplayHelperService { eventData: any; - constructor() { } + constructor() {} getAllEvents(ingest: any): any[] { let events = []; let rootEvent = null; let actionEvent = null; - - if (ingest.length > 0) { + if (ingest.length > 0) { for (let event of ingest) { this.eventData = this.getEventData(event); if (event.evParentId === null) { - rootEvent = new Event(this.eventData, []) + rootEvent = new Event(this.eventData, []); events.push(rootEvent); - } - else { + } else { if (event.evParentId === rootEvent.eventData.evId) { actionEvent = new Event(this.eventData, []); rootEvent.subEvents.push(actionEvent); @@ -84,7 +81,8 @@ export class EventDisplayHelperService { for (let evt of logbook.events) { if (evt.outcome !== 'OK') { this.eventData = this.getEventData(evt); - if (!evt.parentId) { // Step event + if (!evt.parentId) { + // Step event rootEvent = new Event(this.eventData, []); if (evt.evType.endsWith('.STARTED')) { events.push(rootEvent); @@ -100,14 +98,16 @@ export class EventDisplayHelperService { if (!rootEvent) { console.log('Error, step events should have a null parent id'); } - if (evt.parentId === rootEvent.eventData.evId) { // Action events + if (evt.parentId === rootEvent.eventData.evId) { + // Action events actionEvent = new Event(this.eventData, []); rootEvent.subEvents.push(actionEvent); } else { if (!actionEvent) { console.log('Error, to have treatemnt event, task event should not be null'); } - if (evt.parentId === actionEvent.eventData.evId) { // SubTask events + if (evt.parentId === actionEvent.eventData.evId) { + // SubTask events actionEvent.subEvents.push(new Event(this.eventData, [])); } } @@ -125,7 +125,7 @@ export class EventDisplayHelperService { evDateTime: event.evDateTime, evDetData: event.evDetData, outcome: event.outcome, - outMessg: event.outMessg + outMessg: event.outMessg, }; } } diff --git a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-errors-details-tab/ingest-errors-details-tab.component.spec.ts b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-errors-details-tab/ingest-errors-details-tab.component.spec.ts index 3060ceac465..94ddb33f6d8 100644 --- a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-errors-details-tab/ingest-errors-details-tab.component.spec.ts +++ b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-errors-details-tab/ingest-errors-details-tab.component.spec.ts @@ -12,18 +12,14 @@ describe('IngestErrorsDetailsTabComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - declarations: [ IngestErrorsDetailsTabComponent ], - imports: [ - HttpClientTestingModule + declarations: [IngestErrorsDetailsTabComponent], + imports: [HttpClientTestingModule], + providers: [ + { provide: IngestService, useValue: {} }, + { provide: EventDisplayHelperService, useValue: {} }, ], - providers: [{ provide: IngestService, useValue: {} }, - { provide: EventDisplayHelperService, useValue: {} } - ], - schemas: [NO_ERRORS_SCHEMA] - - - }) - .compileComponents(); + schemas: [NO_ERRORS_SCHEMA], + }).compileComponents(); }); beforeEach(() => { diff --git a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-errors-details-tab/ingest-errors-details-tab.component.ts b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-errors-details-tab/ingest-errors-details-tab.component.ts index dd4815f52fe..e4e65e77fc0 100644 --- a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-errors-details-tab/ingest-errors-details-tab.component.ts +++ b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-errors-details-tab/ingest-errors-details-tab.component.ts @@ -1,26 +1,23 @@ -import {Component, Input, OnChanges, OnInit, SimpleChanges} from '@angular/core'; -import {EventDisplayHelperService} from '../event-display-helper.service'; -import {NestedTreeControl} from '@angular/cdk/tree'; -import {MatTreeNestedDataSource} from '@angular/material/tree'; -import {Event} from '../event'; -import {LogbookOperation} from "../../../models/logbook-event.interface"; - +import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core'; +import { EventDisplayHelperService } from '../event-display-helper.service'; +import { NestedTreeControl } from '@angular/cdk/tree'; +import { MatTreeNestedDataSource } from '@angular/material/tree'; +import { Event } from '../event'; +import { LogbookOperation } from '../../../models/logbook-event.interface'; @Component({ selector: 'app-ingest-errors-details-tab', templateUrl: './ingest-errors-details-tab.component.html', - styleUrls: ['./ingest-errors-details-tab.component.css'] + styleUrls: ['./ingest-errors-details-tab.component.css'], }) export class IngestErrorsDetailsTabComponent implements OnInit, OnChanges { - @Input() ingest: LogbookOperation; ingestErrorsTreeControl: NestedTreeControl; ingestErrorsTreeDataSource: MatTreeNestedDataSource; - constructor(private eventDisplayHelper: EventDisplayHelperService) { - this.ingestErrorsTreeControl = new NestedTreeControl(node => node.subEvents); + this.ingestErrorsTreeControl = new NestedTreeControl((node) => node.subEvents); this.ingestErrorsTreeDataSource = new MatTreeNestedDataSource(); } @@ -47,8 +44,6 @@ export class IngestErrorsDetailsTabComponent implements OnInit, OnChanges { } isStepOK(event: Event) { - return event.eventData.outcome === "OK"; + return event.eventData.outcome === 'OK'; } - - } diff --git a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-information-tab/ingest-event-detail/event-display/event-display.component.html b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-information-tab/ingest-event-detail/event-display/event-display.component.html index 21bac8a7c35..f62428403dd 100644 --- a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-information-tab/ingest-event-detail/event-display/event-display.component.html +++ b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-information-tab/ingest-event-detail/event-display/event-display.component.html @@ -4,7 +4,7 @@
      - {{event.eventData.outMessg}} + {{ event.eventData.outMessg }}
      diff --git a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-information-tab/ingest-event-detail/event-display/event-display.component.scss b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-information-tab/ingest-event-detail/event-display/event-display.component.scss index 224f236e321..54ff41fcae5 100644 --- a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-information-tab/ingest-event-detail/event-display/event-display.component.scss +++ b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-information-tab/ingest-event-detail/event-display/event-display.component.scss @@ -1,36 +1,35 @@ @import '~ui-frontend-common/sass/variables/colors'; .ingestDetails { - margin-top: 10px; - text-align: left; - font-size: 14px; - word-wrap: normal; + margin-top: 10px; + text-align: left; + font-size: 14px; + word-wrap: normal; } .white-bg { - background-color: white; + background-color: white; } .bold-text { - font-weight: bold; + font-weight: bold; } .errorRow { - color: $red; + color: $red; } .warningRow { - color: $mustard-yellow + color: $mustard-yellow; } .outMessage { - font-size: 12px; - padding: 5px 0 0 0; + font-size: 12px; + padding: 5px 0 0 0; } - .no-padding { - padding: 0; + padding: 0; } .eventChild { - padding-left: 10px; -} \ No newline at end of file + padding-left: 10px; +} diff --git a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-information-tab/ingest-event-detail/event-display/event-display.component.spec.ts b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-information-tab/ingest-event-detail/event-display/event-display.component.spec.ts index 02d728b8607..034322ba9cf 100644 --- a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-information-tab/ingest-event-detail/event-display/event-display.component.spec.ts +++ b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-information-tab/ingest-event-detail/event-display/event-display.component.spec.ts @@ -34,9 +34,9 @@ * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ -import {ComponentFixture, TestBed, waitForAsync} from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; -import {EventDisplayComponent} from './event-display.component'; +import { EventDisplayComponent } from './event-display.component'; import { IngestService } from '../../../../ingest.service'; import { NO_ERRORS_SCHEMA } from '@angular/core'; @@ -47,12 +47,10 @@ describe('EventDisplayComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ declarations: [EventDisplayComponent], - imports: [ - ], + imports: [], providers: [{ provide: IngestService, useValue: {} }], - schemas: [NO_ERRORS_SCHEMA] - }) - .compileComponents(); + schemas: [NO_ERRORS_SCHEMA], + }).compileComponents(); })); beforeEach(() => { @@ -63,9 +61,10 @@ describe('EventDisplayComponent', () => { evId: 'aeeaaaaaaoem5l4iaa3lialtbt4j6yaaaaaq', evType: 'STEP_FAKE_INGEST.STARTED', outcome: 'OK', - outMessg: 'Success ingest' + outMessg: 'Success ingest', }, - subEvents: [] }; + subEvents: [], + }; fixture.detectChanges(); }); diff --git a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-information-tab/ingest-event-detail/event-display/event-display.component.ts b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-information-tab/ingest-event-detail/event-display/event-display.component.ts index 09155452a78..b1356e45c7e 100644 --- a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-information-tab/ingest-event-detail/event-display/event-display.component.ts +++ b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-information-tab/ingest-event-detail/event-display/event-display.component.ts @@ -34,22 +34,21 @@ * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ -import {Component, Input, OnInit} from '@angular/core'; +import { Component, Input, OnInit } from '@angular/core'; import { Event } from '../../../event'; @Component({ selector: 'app-vitam-event-display', templateUrl: './event-display.component.html', - styleUrls: ['./event-display.component.scss'] + styleUrls: ['./event-display.component.scss'], }) export class EventDisplayComponent implements OnInit { - @Input() event: Event; public ingestEventRowStyle = ''; public showEvDetData = false; - constructor() { } + constructor() {} ngOnInit() { this.init(); diff --git a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-information-tab/ingest-event-detail/ingest-event-detail.component.html b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-information-tab/ingest-event-detail/ingest-event-detail.component.html index 8b38ea6ad0b..1263436797d 100644 --- a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-information-tab/ingest-event-detail/ingest-event-detail.component.html +++ b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-information-tab/ingest-event-detail/ingest-event-detail.component.html @@ -6,9 +6,8 @@
      -
      +
      - -
      \ No newline at end of file +
      diff --git a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-information-tab/ingest-event-detail/ingest-event-detail.component.scss b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-information-tab/ingest-event-detail/ingest-event-detail.component.scss index 7fe06341802..d0dbbf9c104 100644 --- a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-information-tab/ingest-event-detail/ingest-event-detail.component.scss +++ b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-information-tab/ingest-event-detail/ingest-event-detail.component.scss @@ -19,4 +19,4 @@ -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; font-feature-settings: 'liga'; -} \ No newline at end of file +} diff --git a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-information-tab/ingest-event-detail/ingest-event-detail.component.spec.ts b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-information-tab/ingest-event-detail/ingest-event-detail.component.spec.ts index 91d82d0504d..cca573fa686 100644 --- a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-information-tab/ingest-event-detail/ingest-event-detail.component.spec.ts +++ b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-information-tab/ingest-event-detail/ingest-event-detail.component.spec.ts @@ -34,39 +34,38 @@ * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ -import {ComponentFixture, TestBed, waitForAsync} from '@angular/core/testing'; -import {MatMenuModule} from '@angular/material/menu'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; +import { MatMenuModule } from '@angular/material/menu'; -import {NO_ERRORS_SCHEMA} from '@angular/core'; -import {IngestService} from '../../../ingest.service'; -import {IngestEventDetailComponent} from './ingest-event-detail.component'; -import {EventDisplayHelperService} from '../../event-display-helper.service'; -import {Event} from '../../event'; -import {of} from 'rxjs'; -import {BrowserAnimationsModule} from '@angular/platform-browser/animations'; +import { NO_ERRORS_SCHEMA } from '@angular/core'; +import { IngestService } from '../../../ingest.service'; +import { IngestEventDetailComponent } from './ingest-event-detail.component'; +import { EventDisplayHelperService } from '../../event-display-helper.service'; +import { Event } from '../../event'; +import { of } from 'rxjs'; +import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; describe('IngestEventDetailComponent', () => { let component: IngestEventDetailComponent; let fixture: ComponentFixture; const eventDisplayHelperServiceSpy = jasmine.createSpyObj('EventDisplayHelperService', { - initEvents: of([]) + initEvents: of([]), }); beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ declarations: [IngestEventDetailComponent], - imports: [ - MatMenuModule, - BrowserAnimationsModule + imports: [MatMenuModule, BrowserAnimationsModule], + providers: [ + { provide: IngestService, useValue: {} }, + { + provide: EventDisplayHelperService, + useValue: eventDisplayHelperServiceSpy, + }, ], - providers: [{provide: IngestService, useValue: {}}, { - provide: EventDisplayHelperService, - useValue: eventDisplayHelperServiceSpy - }], - schemas: [NO_ERRORS_SCHEMA] - }) - .compileComponents(); + schemas: [NO_ERRORS_SCHEMA], + }).compileComponents(); })); beforeEach(() => { @@ -75,14 +74,13 @@ describe('IngestEventDetailComponent', () => { component.ingest = { id: 'aeeaaaaaaoem5lyiaa3lialtbt3j6haaaaaq', agIdExt: {}, - events: [{}] + events: [{}], }; component.events = [ - new Event({eventData: '{"some": "data1"}'}, []), - new Event({eventData: '{"some": "data2"}'}, [new Event({eventData: '{"some": "data2"}'}, [])]) + new Event({ eventData: '{"some": "data1"}' }, []), + new Event({ eventData: '{"some": "data2"}' }, [new Event({ eventData: '{"some": "data2"}' }, [])]), ]; - fixture.detectChanges(); }); diff --git a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-information-tab/ingest-event-detail/ingest-event-detail.component.ts b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-information-tab/ingest-event-detail/ingest-event-detail.component.ts index e58b03aca29..9a6c13ce0d4 100644 --- a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-information-tab/ingest-event-detail/ingest-event-detail.component.ts +++ b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-information-tab/ingest-event-detail/ingest-event-detail.component.ts @@ -34,11 +34,11 @@ * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ -import {Component, Input, OnChanges, OnInit, SimpleChanges} from '@angular/core'; -import {EventDisplayHelperService} from '../../event-display-helper.service'; -import {Event} from '../../event'; -import {animate, state, style, transition, trigger} from '@angular/animations'; -import {LogbookOperation} from "../../../../models/logbook-event.interface"; +import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core'; +import { EventDisplayHelperService } from '../../event-display-helper.service'; +import { Event } from '../../event'; +import { animate, state, style, transition, trigger } from '@angular/animations'; +import { LogbookOperation } from '../../../../models/logbook-event.interface'; @Component({ selector: 'app-ingest-event-detail', @@ -46,22 +46,20 @@ import {LogbookOperation} from "../../../../models/logbook-event.interface"; styleUrls: ['./ingest-event-detail.component.scss'], animations: [ trigger('rotateAnimation', [ - state('collapse', style({transform: 'rotate(-180deg)'})), - state('expand', style({transform: 'rotate(0deg)'})), + state('collapse', style({ transform: 'rotate(-180deg)' })), + state('expand', style({ transform: 'rotate(0deg)' })), transition('expand <=> collapse', animate('200ms ease-out')), - ]) - ] + ]), + ], }) export class IngestEventDetailComponent implements OnInit, OnChanges { - @Input() ingest: LogbookOperation; events: Event[] = []; isShown = false; - constructor(private eventDisplayHelper: EventDisplayHelperService) { - } + constructor(private eventDisplayHelper: EventDisplayHelperService) {} ngOnInit() { this.events = this.eventDisplayHelper.initEvents(this.ingest); @@ -78,14 +76,12 @@ export class IngestEventDetailComponent implements OnInit, OnChanges { } ingestMessage(ingest: any): string { - return (ingest.events !== undefined && ingest.events.length !== 0) ? - ingest.events[ingest.events.length - 1].outMessage : - ingest.outMessage; + return ingest.events !== undefined && ingest.events.length !== 0 + ? ingest.events[ingest.events.length - 1].outMessage + : ingest.outMessage; } ingestEndDate(ingest: any): string { - return (ingest.events !== undefined && ingest.events.length !== 0) ? - ingest.events[ingest.events.length - 1].dateTime : - ingest.dateTime; + return ingest.events !== undefined && ingest.events.length !== 0 ? ingest.events[ingest.events.length - 1].dateTime : ingest.dateTime; } } diff --git a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-information-tab/ingest-information-tab.component.html b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-information-tab/ingest-information-tab.component.html index 3cfa9e6c688..da4fd31a2f8 100644 --- a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-information-tab/ingest-information-tab.component.html +++ b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-information-tab/ingest-information-tab.component.html @@ -1,61 +1,61 @@ -
      +
      - +
      {{ ingest?.obIdIn }}
      - +
      {{ evDetDataDeflated?.EvDetailReq }}
      - +
      {{ ingest?.id }}
      -
      +
      - +
      {{ ingest?.evDateTime | dateTime: 'dd/MM/yyyy' }}
      - +
      {{ ingestEndDate(ingest) | dateTime: 'dd/MM/yyyy' }}
      -
      +
      - +
      {{ agIdExtDeflated?.originatingAgency }}
      - +
      {{ agIdExtDeflated?.submissionAgency }}
      -
      +
      - +
      {{ evDetDataDeflated?.ArchivalAgreement }}
      - +
      {{ evDetDataDeflated?.ArchivalProfile }}
      -
      +
      - +
      {{ evDetDataDeflated?.LegalStatus }}
      - +
      {{ ingestMessage(ingest) }}
      {{ ingestMessage(ingest) }}
      @@ -67,7 +67,7 @@
      - +
      diff --git a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-information-tab/ingest-information-tab.component.scss b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-information-tab/ingest-information-tab.component.scss index b68fa2498d1..051c48684bf 100644 --- a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-information-tab/ingest-information-tab.component.scss +++ b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-information-tab/ingest-information-tab.component.scss @@ -1,4 +1,4 @@ -@import "~ui-frontend-common/sass/variables/colors"; +@import '~ui-frontend-common/sass/variables/colors'; label { font-size: 12px; @@ -7,7 +7,7 @@ label { font-family: Mulish; box-sizing: inherit; visibility: visible; - } +} label + div { font-size: 16px; @@ -19,6 +19,6 @@ label + div { font-family: Mulish; visibility: visible; } -.status{ - font-weight: bold; +.status { + font-weight: bold; } diff --git a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-information-tab/ingest-information-tab.component.spec.ts b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-information-tab/ingest-information-tab.component.spec.ts index 9e4815b99bf..3df1f419952 100644 --- a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-information-tab/ingest-information-tab.component.spec.ts +++ b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-information-tab/ingest-information-tab.component.spec.ts @@ -48,13 +48,9 @@ describe('IngestInformationTabComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ declarations: [IngestInformationTabComponent], - imports: [ - TranslateModule.forRoot(), - VitamUICommonTestModule - ], - schemas: [NO_ERRORS_SCHEMA] - }) - .compileComponents(); + imports: [TranslateModule.forRoot(), VitamUICommonTestModule], + schemas: [NO_ERRORS_SCHEMA], + }).compileComponents(); })); beforeEach(() => { @@ -63,7 +59,7 @@ describe('IngestInformationTabComponent', () => { component.ingest = { id: 'aeeaaaaaaoem5lyiaa3lialtbt3j6haaaaaq', agIdExt: {}, - events: [{}] + events: [{}], }; fixture.detectChanges(); }); diff --git a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-information-tab/ingest-information-tab.component.ts b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-information-tab/ingest-information-tab.component.ts index 3a0459daf96..31d3d5c11f7 100644 --- a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-information-tab/ingest-information-tab.component.ts +++ b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-information-tab/ingest-information-tab.component.ts @@ -34,32 +34,31 @@ * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ -import {Component, Input, OnChanges} from '@angular/core'; +import { Component, Input, OnChanges } from '@angular/core'; import { AgIdExtDeflateJson, EvDetDataDeflateJson, ingestHasEvents, ingestLastEvent, ingestStatus, - LogbookOperation + LogbookOperation, } from '../../../models/logbook-event.interface'; @Component({ selector: 'app-ingest-information-tab', templateUrl: './ingest-information-tab.component.html', - styleUrls: ['./ingest-information-tab.component.scss'] + styleUrls: ['./ingest-information-tab.component.scss'], }) export class IngestInformationTabComponent implements OnChanges { @Input() ingest: LogbookOperation; evDetDataDeflated: EvDetDataDeflateJson; agIdExtDeflated: AgIdExtDeflateJson; - constructor() { - } + constructor() {} ngOnChanges() { - this.evDetDataDeflated = this.deflateJsonEvDetData(this.ingest) - this.agIdExtDeflated = this.deflateJsonAgIdExt(this.ingest) + this.evDetDataDeflated = this.deflateJsonEvDetData(this.ingest); + this.agIdExtDeflated = this.deflateJsonAgIdExt(this.ingest); } hasEvent(): boolean { @@ -75,7 +74,7 @@ export class IngestInformationTabComponent implements OnChanges { } getIngestStatus(ingest: LogbookOperation): string { - return ingestStatus(ingest) + return ingestStatus(ingest); } private deflateJsonEvDetData(element: LogbookOperation): EvDetDataDeflateJson { @@ -101,5 +100,4 @@ export class IngestInformationTabComponent implements OnChanges { } return element.agIdExt; } - } diff --git a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-preview.component.html b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-preview.component.html index edc7507ec24..94a86323f4e 100644 --- a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-preview.component.html +++ b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-preview.component.html @@ -12,12 +12,20 @@ mat-menu-item i18n="@@ingestPreviewDownloadManifest" (click)="downloadManifest()" - [disabled]="getIngestStatus(ingest) === IngestStatus.KO || getIngestStatus(ingest) === IngestStatus.FATAL || getIngestStatus(ingest) === IngestStatus.IN_PROGRESS"> + [disabled]=" + getIngestStatus(ingest) === IngestStatus.KO || + getIngestStatus(ingest) === IngestStatus.FATAL || + getIngestStatus(ingest) === IngestStatus.IN_PROGRESS + " + > {{ 'INGEST_DETAIL.DOWNLOAD_MANIFEST' | translate }} - diff --git a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-preview.component.scss b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-preview.component.scss index b16fa6ef2f5..9b698b7449d 100644 --- a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-preview.component.scss +++ b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-preview.component.scss @@ -10,7 +10,7 @@ } ::ng-deep .vitamui-mat-select.mat-form-field.mat-form-field-type-mat-select .mat-form-field-flex { - background-color: #FFF; + background-color: #fff; } .button-maring { diff --git a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-preview.component.spec.ts b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-preview.component.spec.ts index 014153a79e6..94148f6b2a7 100644 --- a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-preview.component.spec.ts +++ b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-preview.component.spec.ts @@ -1,16 +1,16 @@ -import {NO_ERRORS_SCHEMA, Pipe, PipeTransform} from '@angular/core'; -import {ComponentFixture, TestBed, waitForAsync} from '@angular/core/testing'; -import {MatMenuModule} from '@angular/material/menu'; +import { NO_ERRORS_SCHEMA, Pipe, PipeTransform } from '@angular/core'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; +import { MatMenuModule } from '@angular/material/menu'; -import {BASE_URL, LogbookService} from 'ui-frontend-common'; -import {IngestPreviewComponent} from './ingest-preview.component'; -import {IngestService} from '../ingest.service'; -import {HttpClientTestingModule} from '@angular/common/http/testing'; -import {TranslateModule} from '@ngx-translate/core'; -import {of} from "rxjs"; -import {LogbookOperation} from "../../models/logbook-event.interface"; +import { BASE_URL, LogbookService } from 'ui-frontend-common'; +import { IngestPreviewComponent } from './ingest-preview.component'; +import { IngestService } from '../ingest.service'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { TranslateModule } from '@ngx-translate/core'; +import { of } from 'rxjs'; +import { LogbookOperation } from '../../models/logbook-event.interface'; -@Pipe({name: 'truncate'}) +@Pipe({ name: 'truncate' }) class MockTruncatePipe implements PipeTransform { transform(value: number): number { return value; @@ -24,28 +24,25 @@ describe('IngestPreviewComponent test:', () => { const logbookOperation: LogbookOperation = { id: 'aeeaaaaaaoem5lyiaa3lialtbt3j6haaaaaq', agIdExt: {}, - events: [{}] - } + events: [{}], + }; beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ declarations: [IngestPreviewComponent, MockTruncatePipe], - imports: [ - HttpClientTestingModule, - MatMenuModule, - TranslateModule.forRoot() - ], + imports: [HttpClientTestingModule, MatMenuModule, TranslateModule.forRoot()], providers: [ - {provide: LogbookService, useValue: {}}, + { provide: LogbookService, useValue: {} }, { - provide: IngestService, useValue: { + provide: IngestService, + useValue: { getIngestOperation: () => of(logbookOperation), logbookOperationsReloaded: of([logbookOperation]), - } + }, }, - {provide: BASE_URL, useValue: '/fake-api'}], - schemas: [NO_ERRORS_SCHEMA] - }) - .compileComponents(); + { provide: BASE_URL, useValue: '/fake-api' }, + ], + schemas: [NO_ERRORS_SCHEMA], + }).compileComponents(); })); beforeEach(() => { diff --git a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-preview.component.ts b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-preview.component.ts index eb4dba3d88f..6f9ff6dade4 100644 --- a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-preview.component.ts +++ b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-preview.component.ts @@ -34,21 +34,16 @@ * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ -import {Component, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Output, SimpleChanges} from '@angular/core'; -import {first} from 'rxjs/operators'; -import {LogbookService} from 'ui-frontend-common'; -import { - IngestStatus, - ingestStatus, - ingestStatusVisualColor, - LogbookOperation -} from '../../models/logbook-event.interface'; -import {IngestService} from '../ingest.service'; +import { Component, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Output, SimpleChanges } from '@angular/core'; +import { first } from 'rxjs/operators'; +import { LogbookService } from 'ui-frontend-common'; +import { IngestStatus, ingestStatus, ingestStatusVisualColor, LogbookOperation } from '../../models/logbook-event.interface'; +import { IngestService } from '../ingest.service'; @Component({ selector: 'app-ingest-preview', templateUrl: './ingest-preview.component.html', - styleUrls: ['./ingest-preview.component.scss'] + styleUrls: ['./ingest-preview.component.scss'], }) export class IngestPreviewComponent implements OnInit, OnChanges, OnDestroy { IngestStatus = IngestStatus; @@ -58,19 +53,21 @@ export class IngestPreviewComponent implements OnInit, OnChanges, OnDestroy { @Output() previewClose = new EventEmitter(); @Output() ingestHasChanged = new EventEmitter(); - constructor(private logbookService: LogbookService, - private ingestService: IngestService,) { - } + constructor( + private logbookService: LogbookService, + private ingestService: IngestService, + ) {} ngOnChanges(changes: SimpleChanges): void { if (changes.ingestFromParent) { - this.reloadLogbookOperation() + this.reloadLogbookOperation(); } } ngOnInit() { - this.ingestService.logbookOperationsReloaded.subscribe(logbookOperations => - this.setLogbookOperationIfIfHasBeenReloaded(logbookOperations)); + this.ingestService.logbookOperationsReloaded.subscribe((logbookOperations) => + this.setLogbookOperationIfIfHasBeenReloaded(logbookOperations), + ); } ngOnDestroy() { @@ -78,25 +75,26 @@ export class IngestPreviewComponent implements OnInit, OnChanges, OnDestroy { } setLogbookOperationIfIfHasBeenReloaded(logbookOperations: LogbookOperation[]) { - const logbookOperationUpdated = logbookOperations.find(e => e.id === this.ingestFromParent.id); + const logbookOperationUpdated = logbookOperations.find((e) => e.id === this.ingestFromParent.id); if (logbookOperationUpdated) { - this.reloadLogbookOperation() + this.reloadLogbookOperation(); } } reloadLogbookOperation() { - this.ingestService.getIngestOperation(this.ingestFromParent.id) + this.ingestService + .getIngestOperation(this.ingestFromParent.id) .pipe(first()) - .subscribe(receivedLogbookOperation => { + .subscribe((receivedLogbookOperation) => { if (this.ingestFromParent.id === receivedLogbookOperation.id) { - this.updateIngest(receivedLogbookOperation) + this.updateIngest(receivedLogbookOperation); } - }) + }); } private updateIngest(logbookOperation: LogbookOperation) { this.ingest = logbookOperation; - this.ingestHasChanged.emit(this.ingest) + this.ingestHasChanged.emit(this.ingest); } emitClose() { @@ -104,9 +102,8 @@ export class IngestPreviewComponent implements OnInit, OnChanges, OnDestroy { } filterEvents(event: any): boolean { - return event.outDetail && ( - event.outDetail.includes('EXT_VITAMUI_UPDATE_INGEST') || - event.outDetail.includes('EXT_VITAMUI_CREATE_INGEST') + return ( + event.outDetail && (event.outDetail.includes('EXT_VITAMUI_UPDATE_INGEST') || event.outDetail.includes('EXT_VITAMUI_CREATE_INGEST')) ); } diff --git a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-preview.module.ts b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-preview.module.ts index 0341662c906..6ec61204ebf 100644 --- a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-preview.module.ts +++ b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-preview/ingest-preview.module.ts @@ -38,7 +38,7 @@ import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { RouterModule } from '@angular/router'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; -import { MatMenuModule} from '@angular/material/menu' ; +import { MatMenuModule } from '@angular/material/menu'; import { MatSnackBarModule } from '@angular/material/snack-bar'; import { MatDialogModule } from '@angular/material/dialog'; import { MatTooltipModule } from '@angular/material/tooltip'; @@ -46,7 +46,7 @@ import { MatTabsModule } from '@angular/material/tabs'; import { MatOptionModule } from '@angular/material/core'; import { MatSelectModule } from '@angular/material/select'; import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; -import {MatTreeModule} from '@angular/material/tree'; +import { MatTreeModule } from '@angular/material/tree'; import { IngestPreviewComponent } from './ingest-preview.component'; import { VitamUICommonModule } from 'ui-frontend-common'; @@ -56,14 +56,14 @@ import { EventDisplayHelperService } from './event-display-helper.service'; import { EventDisplayComponent } from './ingest-information-tab/ingest-event-detail/event-display/event-display.component'; import { IngestErrorsDetailsTabComponent } from './ingest-errors-details-tab/ingest-errors-details-tab.component'; - @NgModule({ declarations: [ IngestPreviewComponent, IngestInformationTabComponent, IngestEventDetailComponent, EventDisplayComponent, - IngestErrorsDetailsTabComponent], + IngestErrorsDetailsTabComponent, + ], imports: [ CommonModule, RouterModule, @@ -78,18 +78,10 @@ import { IngestErrorsDetailsTabComponent } from './ingest-errors-details-tab/ing MatOptionModule, MatTabsModule, MatTooltipModule, - MatTreeModule - ], - exports: [ - IngestPreviewComponent, - IngestInformationTabComponent, - IngestEventDetailComponent, - EventDisplayComponent + MatTreeModule, ], - providers: [ - EventDisplayHelperService - ], - schemas: [CUSTOM_ELEMENTS_SCHEMA] - + exports: [IngestPreviewComponent, IngestInformationTabComponent, IngestEventDetailComponent, EventDisplayComponent], + providers: [EventDisplayHelperService], + schemas: [CUSTOM_ELEMENTS_SCHEMA], }) -export class IngestPreviewModule { } +export class IngestPreviewModule {} diff --git a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-routing.module.ts b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-routing.module.ts index 1c9a8cfbb57..5ef0146ff67 100644 --- a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-routing.module.ts +++ b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest-routing.module.ts @@ -44,28 +44,23 @@ const routes: Route[] = [ { path: '', redirectTo: 'tenant', - pathMatch: 'full' - }, { + pathMatch: 'full', + }, + { path: 'tenant', component: VitamUITenantSelectComponent, - canActivate: [TenantSelectionGuard] + canActivate: [TenantSelectionGuard], }, { path: 'tenant/:tenantIdentifier', component: IngestComponent, - canActivate: [ActiveTenantGuard] - } + canActivate: [ActiveTenantGuard], + }, ]; - @NgModule({ declarations: [], - imports: [ - CommonModule, - RouterModule.forChild(routes) - ], - exports: [ - RouterModule - ] + imports: [CommonModule, RouterModule.forChild(routes)], + exports: [RouterModule], }) -export class IngestRoutingModule { } +export class IngestRoutingModule {} diff --git a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest.component.html b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest.component.html index 1d50897c503..a6d304592e0 100644 --- a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest.component.html +++ b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest.component.html @@ -1,9 +1,11 @@ - + @@ -42,9 +44,7 @@ - @@ -58,11 +58,10 @@ *ngIf="!dateRangeFilterForm.get('startDate').value; else showStartDate" (click)="pickerStart.open()" i18n="@@apiSupervisionStartDate" - >{{ 'INGEST_ACTION.START_DATE' | translate }}{{ 'INGEST_ACTION.START_DATE' | translate }} - {{ dateRangeFilterForm.get('startDate').value | dateTime: 'dd/MM/yyyy' }} + {{ dateRangeFilterForm.get('startDate').value | dateTime: 'dd/MM/yyyy' }} clear {{ 'INGEST_ACTION.END_DATE' | translate }}{{ 'INGEST_ACTION.END_DATE' | translate }} {{ dateRangeFilterForm.get('endDate').value | dateTime: 'dd/MM/yyyy' }} + >{{ dateRangeFilterForm.get('endDate').value | dateTime: 'dd/MM/yyyy' }} clear
      -
      +
      {{ 'INGEST_LIST.TABLE_NAME' | translate }}
      - - +
      diff --git a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest.component.spec.ts b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest.component.spec.ts index a52f7f56372..650b3b7ef25 100644 --- a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest.component.spec.ts +++ b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest.component.spec.ts @@ -34,32 +34,31 @@ * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ -import {ComponentFixture, TestBed, waitForAsync} from '@angular/core/testing'; -import {FormBuilder} from '@angular/forms'; -import {MatNativeDateModule} from '@angular/material/core'; -import {MatDatepickerModule} from '@angular/material/datepicker'; -import {BrowserAnimationsModule, NoopAnimationsModule} from '@angular/platform-browser/animations'; -import {RouterTestingModule} from '@angular/router/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; +import { FormBuilder } from '@angular/forms'; +import { MatNativeDateModule } from '@angular/material/core'; +import { MatDatepickerModule } from '@angular/material/datepicker'; +import { BrowserAnimationsModule, NoopAnimationsModule } from '@angular/platform-browser/animations'; +import { RouterTestingModule } from '@angular/router/testing'; -import {IngestComponent} from './ingest.component'; -import {InjectorModule, LoggerModule, SearchBarModule} from 'ui-frontend-common'; -import {ActivatedRoute} from '@angular/router'; -import {of} from 'rxjs'; -import {environment} from '../../environments/environment'; -import {VitamUICommonTestModule} from 'ui-frontend-common/testing'; -import {IngestService} from './ingest.service'; -import {Component, NO_ERRORS_SCHEMA} from '@angular/core'; -import {MatMenuModule} from '@angular/material/menu'; -import {MatSidenavModule} from '@angular/material/sidenav'; -import {MatDialog} from '@angular/material/dialog'; -import {IngestListComponent} from './ingest-list/ingest-list.component'; -import {UploadService} from '../core/common/upload.service'; -import {IngestType} from "../core/common/ingest-type.enum"; +import { IngestComponent } from './ingest.component'; +import { InjectorModule, LoggerModule, SearchBarModule } from 'ui-frontend-common'; +import { ActivatedRoute } from '@angular/router'; +import { of } from 'rxjs'; +import { environment } from '../../environments/environment'; +import { VitamUICommonTestModule } from 'ui-frontend-common/testing'; +import { IngestService } from './ingest.service'; +import { Component, NO_ERRORS_SCHEMA } from '@angular/core'; +import { MatMenuModule } from '@angular/material/menu'; +import { MatSidenavModule } from '@angular/material/sidenav'; +import { MatDialog } from '@angular/material/dialog'; +import { IngestListComponent } from './ingest-list/ingest-list.component'; +import { UploadService } from '../core/common/upload.service'; +import { IngestType } from '../core/common/ingest-type.enum'; -@Component({selector: 'app-ingest-list', template: ''}) +@Component({ selector: 'app-ingest-list', template: '' }) export class IngestListStubComponent { - emitOrderChange() { - } + emitOrderChange() {} } describe('IngestComponent test:', () => { @@ -68,13 +67,13 @@ describe('IngestComponent test:', () => { const ingestServiceMock = { ingest: () => of('test ingest'), - search: () => of([]) + search: () => of([]), }; - const uploadServiceSpy = jasmine.createSpyObj('UploadService', {uploadFile: of({}), filesStatus: of([])}); + const uploadServiceSpy = jasmine.createSpyObj('UploadService', { uploadFile: of({}), filesStatus: of([]) }); beforeEach(waitForAsync(() => { const matDialogSpy = jasmine.createSpyObj('MatDialog', ['open']); - matDialogSpy.open.and.returnValue({afterClosed: () => of(true)}); + matDialogSpy.open.and.returnValue({ afterClosed: () => of(true) }); TestBed.configureTestingModule({ imports: [ MatDatepickerModule, @@ -88,26 +87,22 @@ describe('IngestComponent test:', () => { LoggerModule.forRoot(), RouterTestingModule, NoopAnimationsModule, - SearchBarModule - ], - declarations: [ - IngestComponent, - IngestListStubComponent + SearchBarModule, ], + declarations: [IngestComponent, IngestListStubComponent], providers: [ FormBuilder, - {provide: MatDialog, useValue: matDialogSpy}, - {provide: IngestService, useValue: ingestServiceMock}, - {provide: UploadService, useValue: uploadServiceSpy}, + { provide: MatDialog, useValue: matDialogSpy }, + { provide: IngestService, useValue: ingestServiceMock }, + { provide: UploadService, useValue: uploadServiceSpy }, { provide: ActivatedRoute, - useValue: {params: of({tenantIdentifier: 1}), data: of({appId: 'INGEST_MANAGEMENT_APP'})} + useValue: { params: of({ tenantIdentifier: 1 }), data: of({ appId: 'INGEST_MANAGEMENT_APP' }) }, }, - {provide: environment, useValue: environment} + { provide: environment, useValue: environment }, ], - schemas: [NO_ERRORS_SCHEMA] - }) - .compileComponents(); + schemas: [NO_ERRORS_SCHEMA], + }).compileComponents(); })); beforeEach(() => { diff --git a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest.component.ts b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest.component.ts index afcbed0e3e9..78342d54ee2 100644 --- a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest.component.ts +++ b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest.component.ts @@ -34,17 +34,17 @@ * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ -import {Component, ElementRef, HostListener, OnInit, ViewChild} from '@angular/core'; -import {FormBuilder, FormGroup} from '@angular/forms'; -import {MatDialog, MatDialogConfig} from '@angular/material/dialog'; -import {ActivatedRoute, Router} from '@angular/router'; -import {AdminUserProfile, Direction, GlobalEventService, SearchBarComponent, SidenavPage} from 'ui-frontend-common'; -import {IngestList} from '../core/common/ingest-list'; -import {IngestType} from '../core/common/ingest-type.enum'; -import {UploadComponent} from '../core/common/upload.component'; -import {UploadService} from '../core/common/upload.service'; -import {LogbookOperation} from '../models/logbook-event.interface'; -import {IngestListComponent} from './ingest-list/ingest-list.component'; +import { Component, ElementRef, HostListener, OnInit, ViewChild } from '@angular/core'; +import { FormBuilder, FormGroup } from '@angular/forms'; +import { MatDialog, MatDialogConfig } from '@angular/material/dialog'; +import { ActivatedRoute, Router } from '@angular/router'; +import { AdminUserProfile, Direction, GlobalEventService, SearchBarComponent, SidenavPage } from 'ui-frontend-common'; +import { IngestList } from '../core/common/ingest-list'; +import { IngestType } from '../core/common/ingest-type.enum'; +import { UploadComponent } from '../core/common/upload.component'; +import { UploadService } from '../core/common/upload.service'; +import { LogbookOperation } from '../models/logbook-event.interface'; +import { IngestListComponent } from './ingest-list/ingest-list.component'; @Component({ selector: 'app-ingest', @@ -64,8 +64,8 @@ export class IngestComponent extends SidenavPage implements OnInit { ingestList: IngestList = new IngestList(); ingestThatHasChanged: LogbookOperation = null; - @ViewChild(SearchBarComponent, {static: true}) searchBar: SearchBarComponent; - @ViewChild(IngestListComponent, {static: true}) ingestListComponent: IngestListComponent; + @ViewChild(SearchBarComponent, { static: true }) searchBar: SearchBarComponent; + @ViewChild(IngestListComponent, { static: true }) ingestListComponent: IngestListComponent; @ViewChild('inputFile') inputFile: ElementRef; @@ -75,7 +75,7 @@ export class IngestComponent extends SidenavPage implements OnInit { globalEventService: GlobalEventService, public dialog: MatDialog, private formBuilder: FormBuilder, - private uploadSipService: UploadService + private uploadSipService: UploadService, ) { super(route, globalEventService); @@ -107,10 +107,10 @@ export class IngestComponent extends SidenavPage implements OnInit { clearDate(date: 'startDate' | 'endDate') { if (date === 'startDate') { - this.dateRangeFilterForm.get(date).reset(null, {emitEvent: false}); + this.dateRangeFilterForm.get(date).reset(null, { emitEvent: false }); this.filters.startDate = null; } else if (date === 'endDate') { - this.dateRangeFilterForm.get(date).reset(null, {emitEvent: false}); + this.dateRangeFilterForm.get(date).reset(null, { emitEvent: false }); this.filters.endDate = null; } else { console.error('clearDate() error: unknown date ' + date); @@ -162,7 +162,7 @@ export class IngestComponent extends SidenavPage implements OnInit { } changeTenant(tenantIdentifier: number) { - this.router.navigate(['..', tenantIdentifier], {relativeTo: this.route}); + this.router.navigate(['..', tenantIdentifier], { relativeTo: this.route }); } refresh() { diff --git a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest.service.ts b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest.service.ts index d4e34caf3bc..2a32a76ebcf 100644 --- a/ui/ui-frontend/projects/ingest/src/app/ingest/ingest.service.ts +++ b/ui/ui-frontend/projects/ingest/src/app/ingest/ingest.service.ts @@ -34,21 +34,20 @@ * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ -import {HttpClient, HttpHeaders} from '@angular/common/http'; -import {Injectable} from '@angular/core'; -import {Observable, Subject} from 'rxjs'; -import {SearchService} from 'ui-frontend-common'; -import {IngestApiService} from '../core/api/ingest-api.service'; -import {LogbookOperation} from "../models/logbook-event.interface"; - +import { HttpClient, HttpHeaders } from '@angular/common/http'; +import { Injectable } from '@angular/core'; +import { Observable, Subject } from 'rxjs'; +import { SearchService } from 'ui-frontend-common'; +import { IngestApiService } from '../core/api/ingest-api.service'; +import { LogbookOperation } from '../models/logbook-event.interface'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class IngestService extends SearchService { constructor( private ingestApiService: IngestApiService, - http: HttpClient + http: HttpClient, ) { super(http, ingestApiService, 'ALL'); } @@ -73,7 +72,7 @@ export class IngestService extends SearchService { } downloadODTReport(id: string) { - return this.ingestApiService.downloadODTReport(id).subscribe(file => { + return this.ingestApiService.downloadODTReport(id).subscribe((file) => { const element = document.createElement('a'); element.href = window.URL.createObjectURL(file); element.download = 'Bordereau-' + id + '.odt'; diff --git a/ui/ui-frontend/projects/ingest/src/app/models/logbook-event.interface.ts b/ui/ui-frontend/projects/ingest/src/app/models/logbook-event.interface.ts index 8c87030d5e0..071841f772e 100644 --- a/ui/ui-frontend/projects/ingest/src/app/models/logbook-event.interface.ts +++ b/ui/ui-frontend/projects/ingest/src/app/models/logbook-event.interface.ts @@ -61,19 +61,19 @@ export enum IngestStatus { //evDetData export interface EvDetDataDeflateJson { - EvDetailReq?: string, - EvDateTimeReq?: string, - ArchivalAgreement?: string, - ArchivalProfile?: string, - ServiceLevel?: string, - AcquisitionInformation?: string, - LegalStatus?: string, + EvDetailReq?: string; + EvDateTimeReq?: string; + ArchivalAgreement?: string; + ArchivalProfile?: string; + ServiceLevel?: string; + AcquisitionInformation?: string; + LegalStatus?: string; } //agIdExt export interface AgIdExtDeflateJson { - originatingAgency?: string, - submissionAgency?: string, + originatingAgency?: string; + submissionAgency?: string; } export function ingestStatus(ingest: LogbookOperation): IngestStatus { @@ -84,15 +84,15 @@ export function ingestStatus(ingest: LogbookOperation): IngestStatus { if (ingest.evType === lastEvent.evType) { return lastEvent.outcome as IngestStatus; } - return IngestStatus.IN_PROGRESS + return IngestStatus.IN_PROGRESS; } export function ingestLastEvent(ingest: LogbookOperation): LogbookEvent { - return ingest.events[ingest.events.length - 1] + return ingest.events[ingest.events.length - 1]; } export function ingestHasEvents(ingest: LogbookOperation): boolean { - return ingest.events !== undefined && ingest.events.length > 0 + return ingest.events !== undefined && ingest.events.length > 0; } export function ingestStatusVisualColor(status: IngestStatus): 'green' | 'grey' | 'orange' | 'red' | 'black' { diff --git a/ui/ui-frontend/projects/ingest/src/app/shared/shared.module.ts b/ui/ui-frontend/projects/ingest/src/app/shared/shared.module.ts index d2477cd7b9b..a8891a780e6 100644 --- a/ui/ui-frontend/projects/ingest/src/app/shared/shared.module.ts +++ b/ui/ui-frontend/projects/ingest/src/app/shared/shared.module.ts @@ -40,12 +40,7 @@ import { NgModule } from '@angular/core'; import { VitamUISnackBarModule } from './vitamui-snack-bar'; @NgModule({ - imports: [ - CommonModule, - VitamUISnackBarModule - ], - exports: [ - VitamUISnackBarModule - ] + imports: [CommonModule, VitamUISnackBarModule], + exports: [VitamUISnackBarModule], }) -export class SharedModule { } +export class SharedModule {} diff --git a/ui/ui-frontend/projects/ingest/src/app/shared/upload-tracking/upload-tracking.component.html b/ui/ui-frontend/projects/ingest/src/app/shared/upload-tracking/upload-tracking.component.html index cfa0aa5064c..125da85dfd6 100644 --- a/ui/ui-frontend/projects/ingest/src/app/shared/upload-tracking/upload-tracking.component.html +++ b/ui/ui-frontend/projects/ingest/src/app/shared/upload-tracking/upload-tracking.component.html @@ -24,7 +24,7 @@
      {{ ingestInfo.value.name }} - {{ ingestInfo.value.size |fileSize }} + {{ ingestInfo.value.size | fileSize }} {{ ingestInfo.value.sizeUploaded | number: '1.0-0' }} % diff --git a/ui/ui-frontend/projects/ingest/src/app/shared/upload-tracking/upload-tracking.component.scss b/ui/ui-frontend/projects/ingest/src/app/shared/upload-tracking/upload-tracking.component.scss index 7822bf5e467..f2dd6ef0bc7 100644 --- a/ui/ui-frontend/projects/ingest/src/app/shared/upload-tracking/upload-tracking.component.scss +++ b/ui/ui-frontend/projects/ingest/src/app/shared/upload-tracking/upload-tracking.component.scss @@ -1,25 +1,25 @@ @import '~ui-frontend-common/sass/variables/colors'; .material-icons { - color: white; - vertical-align: middle; - font-family: 'Material Icons'; - font-weight: normal; - font-style: normal; - font-size: 24px; - line-height: 1; - text-transform: none; - letter-spacing: normal; - white-space: nowrap; - direction: ltr; - -webkit-font-smoothing: antialiased; - text-rendering: optimizeLegibility; - font-feature-settings: 'liga'; + color: white; + vertical-align: middle; + font-family: 'Material Icons'; + font-weight: normal; + font-style: normal; + font-size: 24px; + line-height: 1; + text-transform: none; + letter-spacing: normal; + white-space: nowrap; + direction: ltr; + -webkit-font-smoothing: antialiased; + text-rendering: optimizeLegibility; + font-feature-settings: 'liga'; } .btn-circle { - background-color: var(--vitamui-primary); + background-color: var(--vitamui-primary); } .purcent { - color: var(--vitamui-primary); + color: var(--vitamui-primary); } diff --git a/ui/ui-frontend/projects/ingest/src/app/shared/upload-tracking/upload-tracking.component.spec.ts b/ui/ui-frontend/projects/ingest/src/app/shared/upload-tracking/upload-tracking.component.spec.ts index b964be63190..4cd516f87c1 100644 --- a/ui/ui-frontend/projects/ingest/src/app/shared/upload-tracking/upload-tracking.component.spec.ts +++ b/ui/ui-frontend/projects/ingest/src/app/shared/upload-tracking/upload-tracking.component.spec.ts @@ -55,7 +55,7 @@ describe('UploadTrackingComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - imports: [MatProgressBarModule, NoopAnimationsModule, LoggerModule.forRoot(), TranslateModule.forRoot()], + imports: [MatProgressBarModule, NoopAnimationsModule, LoggerModule.forRoot(), TranslateModule.forRoot()], declarations: [UploadTrackingComponent], providers: [FormBuilder, { provide: UploadService, useValue: UploadServiceSpy }], schemas: [NO_ERRORS_SCHEMA], diff --git a/ui/ui-frontend/projects/ingest/src/app/shared/upload-tracking/upload-tracking.module.ts b/ui/ui-frontend/projects/ingest/src/app/shared/upload-tracking/upload-tracking.module.ts index cc80c985d9b..3489778715a 100644 --- a/ui/ui-frontend/projects/ingest/src/app/shared/upload-tracking/upload-tracking.module.ts +++ b/ui/ui-frontend/projects/ingest/src/app/shared/upload-tracking/upload-tracking.module.ts @@ -44,7 +44,6 @@ import { MatProgressBarModule } from '@angular/material/progress-bar'; import { MatSelectModule } from '@angular/material/select'; import { MatSnackBarModule } from '@angular/material/snack-bar'; - import { VitamUICommonModule } from 'ui-frontend-common'; import { SharedModule } from '../../shared/shared.module'; import { UploadTrackingComponent } from './upload-tracking.component'; diff --git a/ui/ui-frontend/projects/ingest/src/app/shared/vitamui-snack-bar/vitamui-snack-bar.component.html b/ui/ui-frontend/projects/ingest/src/app/shared/vitamui-snack-bar/vitamui-snack-bar.component.html index 1f3a3e76487..d76c09fe417 100644 --- a/ui/ui-frontend/projects/ingest/src/app/shared/vitamui-snack-bar/vitamui-snack-bar.component.html +++ b/ui/ui-frontend/projects/ingest/src/app/shared/vitamui-snack-bar/vitamui-snack-bar.component.html @@ -2,10 +2,15 @@ - - {{ data?.messageKey | translate}} + + {{ data?.messageKey | translate }} - diff --git a/ui/ui-frontend/projects/ingest/src/app/shared/vitamui-snack-bar/vitamui-snack-bar.component.scss b/ui/ui-frontend/projects/ingest/src/app/shared/vitamui-snack-bar/vitamui-snack-bar.component.scss index 3c7f1fd1409..22a851dfa16 100644 --- a/ui/ui-frontend/projects/ingest/src/app/shared/vitamui-snack-bar/vitamui-snack-bar.component.scss +++ b/ui/ui-frontend/projects/ingest/src/app/shared/vitamui-snack-bar/vitamui-snack-bar.component.scss @@ -1,17 +1,17 @@ :host { - display: flex; - align-items: center; - justify-content: space-between; - height: 100%; - width: 100%; + display: flex; + align-items: center; + justify-content: space-between; + height: 100%; + width: 100%; } .btn-link { - color: white; - font-weight: bold; - margin-left: 10px; + color: white; + font-weight: bold; + margin-left: 10px; } .p-e-10 { - padding-right: 10px; + padding-right: 10px; } diff --git a/ui/ui-frontend/projects/ingest/src/app/shared/vitamui-snack-bar/vitamui-snack-bar.component.spec.ts b/ui/ui-frontend/projects/ingest/src/app/shared/vitamui-snack-bar/vitamui-snack-bar.component.spec.ts index b9aac5ebdef..4a7e4e1521b 100644 --- a/ui/ui-frontend/projects/ingest/src/app/shared/vitamui-snack-bar/vitamui-snack-bar.component.spec.ts +++ b/ui/ui-frontend/projects/ingest/src/app/shared/vitamui-snack-bar/vitamui-snack-bar.component.spec.ts @@ -45,13 +45,12 @@ describe('VitamUISnackbarComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - declarations: [ VitamUISnackBarComponent ], + declarations: [VitamUISnackBarComponent], providers: [ { provide: MAT_SNACK_BAR_DATA, useValue: {} }, { provide: MatSnackBarRef, useValue: { dismiss: () => {} } }, - ] - }) - .compileComponents(); + ], + }).compileComponents(); })); beforeEach(() => { diff --git a/ui/ui-frontend/projects/ingest/src/app/shared/vitamui-snack-bar/vitamui-snack-bar.component.ts b/ui/ui-frontend/projects/ingest/src/app/shared/vitamui-snack-bar/vitamui-snack-bar.component.ts index 32676bf43e3..e0451de37e4 100644 --- a/ui/ui-frontend/projects/ingest/src/app/shared/vitamui-snack-bar/vitamui-snack-bar.component.ts +++ b/ui/ui-frontend/projects/ingest/src/app/shared/vitamui-snack-bar/vitamui-snack-bar.component.ts @@ -40,14 +40,15 @@ import { MAT_SNACK_BAR_DATA, MatSnackBarRef } from '@angular/material/snack-bar' @Component({ selector: 'app-vitamui-snack-bar', templateUrl: './vitamui-snack-bar.component.html', - styleUrls: ['./vitamui-snack-bar.component.scss'] + styleUrls: ['./vitamui-snack-bar.component.scss'], }) export class VitamUISnackBarComponent { - - constructor(@Inject(MAT_SNACK_BAR_DATA) public data: any, private matSnackBarRef: MatSnackBarRef) {} + constructor( + @Inject(MAT_SNACK_BAR_DATA) public data: any, + private matSnackBarRef: MatSnackBarRef, + ) {} close() { this.matSnackBarRef.dismiss(); } - } diff --git a/ui/ui-frontend/projects/ingest/src/app/shared/vitamui-snack-bar/vitamui-snack-bar.module.ts b/ui/ui-frontend/projects/ingest/src/app/shared/vitamui-snack-bar/vitamui-snack-bar.module.ts index 4c1ec6b691d..2bd6420af31 100644 --- a/ui/ui-frontend/projects/ingest/src/app/shared/vitamui-snack-bar/vitamui-snack-bar.module.ts +++ b/ui/ui-frontend/projects/ingest/src/app/shared/vitamui-snack-bar/vitamui-snack-bar.module.ts @@ -40,14 +40,10 @@ import { TranslateModule } from '@ngx-translate/core'; import { VitamUISnackBarComponent } from './vitamui-snack-bar.component'; - @NgModule({ - imports: [ - CommonModule, - TranslateModule, - ], + imports: [CommonModule, TranslateModule], declarations: [VitamUISnackBarComponent], exports: [VitamUISnackBarComponent], - entryComponents: [VitamUISnackBarComponent] + entryComponents: [VitamUISnackBarComponent], }) -export class VitamUISnackBarModule { } +export class VitamUISnackBarModule {} diff --git a/ui/ui-frontend/projects/ingest/src/app/shared/vitamui-snack-bar/vitamui-snack-bar.service.ts b/ui/ui-frontend/projects/ingest/src/app/shared/vitamui-snack-bar/vitamui-snack-bar.service.ts index da0516140ee..2fd98145f2b 100644 --- a/ui/ui-frontend/projects/ingest/src/app/shared/vitamui-snack-bar/vitamui-snack-bar.service.ts +++ b/ui/ui-frontend/projects/ingest/src/app/shared/vitamui-snack-bar/vitamui-snack-bar.service.ts @@ -50,17 +50,16 @@ import { Injector, Optional, SkipSelf, - TemplateRef + TemplateRef, } from '@angular/core'; import { MAT_SNACK_BAR_DATA, MatSnackBarConfig, MatSnackBarContainer, MatSnackBarRef, SimpleSnackBar } from '@angular/material/snack-bar'; import { take, takeUntil } from 'rxjs/operators'; /** Injection token that can be used to specify default snack bar. */ -export const MAT_SNACK_BAR_DEFAULT_OPTIONS = - new InjectionToken('mat-snack-bar-default-options', { - providedIn: 'root', - factory: MAT_SNACK_BAR_DEFAULT_OPTIONS_FACTORY, - }); +export const MAT_SNACK_BAR_DEFAULT_OPTIONS = new InjectionToken('mat-snack-bar-default-options', { + providedIn: 'root', + factory: MAT_SNACK_BAR_DEFAULT_OPTIONS_FACTORY, +}); /** @docs-private */ export function MAT_SNACK_BAR_DEFAULT_OPTIONS_FACTORY(): MatSnackBarConfig { @@ -68,10 +67,9 @@ export function MAT_SNACK_BAR_DEFAULT_OPTIONS_FACTORY(): MatSnackBarConfig { } @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class VitamUISnackBar { - /** * Reference to the current snack bar in the view *at this level* (in the Angular injector tree). * If there is a parent snack-bar service, all operations should delegate to that parent @@ -107,7 +105,8 @@ export class VitamUISnackBar { // tslint:disable-next-line:variable-name @Optional() @SkipSelf() private _parentSnackBar: VitamUISnackBar, // tslint:disable-next-line:variable-name - @Inject(MAT_SNACK_BAR_DEFAULT_OPTIONS) private _defaultConfig: MatSnackBarConfig) { } + @Inject(MAT_SNACK_BAR_DEFAULT_OPTIONS) private _defaultConfig: MatSnackBarConfig, + ) {} /** * Creates and dispatches a snack bar with a custom component for the content, removing any @@ -116,8 +115,7 @@ export class VitamUISnackBar { * @param component Component to be instantiated. * @param config Extra configuration for the snack bar. */ - openFromComponent(component: ComponentType, config?: MatSnackBarConfig): - MatSnackBarRef { + openFromComponent(component: ComponentType, config?: MatSnackBarConfig): MatSnackBarRef { return this._attach(component, config) as MatSnackBarRef; } @@ -128,8 +126,7 @@ export class VitamUISnackBar { * @param template Template to be instantiated. * @param config Extra configuration for the snack bar. */ - openFromTemplate(template: TemplateRef, config?: MatSnackBarConfig): - MatSnackBarRef> { + openFromTemplate(template: TemplateRef, config?: MatSnackBarConfig): MatSnackBarRef> { return this._attach(template, config); } @@ -139,8 +136,7 @@ export class VitamUISnackBar { * @param action The label for the snackbar action. * @param config Additional configuration options for the snackbar. */ - open(message: string, action: string = '', config?: MatSnackBarConfig): - MatSnackBarRef { + open(message: string, action: string = '', config?: MatSnackBarConfig): MatSnackBarRef { const mergedConfig = { ...this._defaultConfig, ...config }; // Since the user doesn't have access to the component, we can @@ -163,16 +159,11 @@ export class VitamUISnackBar { /** * Attaches the snack bar container component to the overlay. */ - private _attachSnackBarContainer(overlayRef: OverlayRef, - config: MatSnackBarConfig): MatSnackBarContainer { - + private _attachSnackBarContainer(overlayRef: OverlayRef, config: MatSnackBarConfig): MatSnackBarContainer { const userInjector = config && config.viewContainerRef && config.viewContainerRef.injector; - const injector = new PortalInjector(userInjector || this._injector, new WeakMap([ - [MatSnackBarConfig, config], - ])); + const injector = new PortalInjector(userInjector || this._injector, new WeakMap([[MatSnackBarConfig, config]])); - const containerPortal = - new ComponentPortal(MatSnackBarContainer, config.viewContainerRef, injector); + const containerPortal = new ComponentPortal(MatSnackBarContainer, config.viewContainerRef, injector); const containerRef: ComponentRef = overlayRef.attach(containerPortal); containerRef.instance.snackBarConfig = config; @@ -182,9 +173,7 @@ export class VitamUISnackBar { /** * Places a new component or a template as the content of the snack bar container. */ - private _attach(content: ComponentType | TemplateRef, userConfig?: MatSnackBarConfig): - MatSnackBarRef> { - + private _attach(content: ComponentType | TemplateRef, userConfig?: MatSnackBarConfig): MatSnackBarRef> { const config = { ...new MatSnackBarConfig(), ...this._defaultConfig, ...userConfig }; const overlayRef = this._createOverlay(config); const container = this._attachSnackBarContainer(overlayRef, config); @@ -193,7 +182,7 @@ export class VitamUISnackBar { if (content instanceof TemplateRef) { const portal = new TemplatePortal(content, null, { $implicit: config.data, - snackBarRef + snackBarRef, } as any); snackBarRef.instance = container.attachTemplatePortal(portal); @@ -209,15 +198,16 @@ export class VitamUISnackBar { // Subscribe to the breakpoint observer and attach the mat-snack-bar-handset class as // appropriate. This class is applied to the overlay element because the overlay must expand to // fill the width of the screen for full width snackbars. - this._breakpointObserver.observe(Breakpoints.Handset).pipe( - takeUntil(overlayRef.detachments().pipe(take(1))) - ).subscribe((state) => { - if (state.matches) { - overlayRef.overlayElement.classList.add('mat-snack-bar-handset'); - } else { - overlayRef.overlayElement.classList.remove('mat-snack-bar-handset'); - } - }); + this._breakpointObserver + .observe(Breakpoints.Handset) + .pipe(takeUntil(overlayRef.detachments().pipe(take(1)))) + .subscribe((state) => { + if (state.matches) { + overlayRef.overlayElement.classList.add('mat-snack-bar-handset'); + } else { + overlayRef.overlayElement.classList.remove('mat-snack-bar-handset'); + } + }); this._animateSnackBar(snackBarRef, config); this._openedSnackBarRef = snackBarRef; @@ -268,10 +258,10 @@ export class VitamUISnackBar { const positionStrategy = this._overlay.position().global(); // Set horizontal position. const isRtl = config.direction === 'rtl'; - const isLeft = ( + const isLeft = config.horizontalPosition === 'left' || (config.horizontalPosition === 'start' && !isRtl) || - (config.horizontalPosition === 'end' && isRtl)); + (config.horizontalPosition === 'end' && isRtl); const isRight = !isLeft && config.horizontalPosition !== 'center'; if (isLeft) { positionStrategy.left('0'); @@ -303,15 +293,15 @@ export class VitamUISnackBar { * @param config Config that was used to create the snack bar. * @param snackBarRef Reference to the snack bar. */ - private _createInjector( - config: MatSnackBarConfig, - snackBarRef: MatSnackBarRef): PortalInjector { - + private _createInjector(config: MatSnackBarConfig, snackBarRef: MatSnackBarRef): PortalInjector { const userInjector = config && config.viewContainerRef && config.viewContainerRef.injector; - return new PortalInjector(userInjector || this._injector, new WeakMap([ - [MatSnackBarRef, snackBarRef], - [MAT_SNACK_BAR_DATA, config.data], - ])); + return new PortalInjector( + userInjector || this._injector, + new WeakMap([ + [MatSnackBarRef, snackBarRef], + [MAT_SNACK_BAR_DATA, config.data], + ]), + ); } } diff --git a/ui/ui-frontend/projects/ingest/src/environments/environment.prod.ts b/ui/ui-frontend/projects/ingest/src/environments/environment.prod.ts index 98ad704ba4b..891a440c497 100644 --- a/ui/ui-frontend/projects/ingest/src/environments/environment.prod.ts +++ b/ui/ui-frontend/projects/ingest/src/environments/environment.prod.ts @@ -36,5 +36,5 @@ */ export const environment = { production: true, - userRefreshRate: 60000 + userRefreshRate: 60000, }; diff --git a/ui/ui-frontend/projects/ingest/src/environments/environment.ts b/ui/ui-frontend/projects/ingest/src/environments/environment.ts index 2720a49b212..faf3a2b68d0 100644 --- a/ui/ui-frontend/projects/ingest/src/environments/environment.ts +++ b/ui/ui-frontend/projects/ingest/src/environments/environment.ts @@ -41,5 +41,5 @@ export const environment = { production: false, - userRefreshRate: 30000 + userRefreshRate: 30000, }; diff --git a/ui/ui-frontend/projects/ingest/src/index.html b/ui/ui-frontend/projects/ingest/src/index.html index 13230756671..bf95339188a 100644 --- a/ui/ui-frontend/projects/ingest/src/index.html +++ b/ui/ui-frontend/projects/ingest/src/index.html @@ -1,25 +1,24 @@ - - - Vitam-UI - + + + Vitam-UI + - - - - - + + + + + + - -
      - - - - - -
      - -
      - + +
      + + + + +
      +
      + diff --git a/ui/ui-frontend/projects/ingest/src/main.ts b/ui/ui-frontend/projects/ingest/src/main.ts index 8ee228cd919..34057715490 100644 --- a/ui/ui-frontend/projects/ingest/src/main.ts +++ b/ui/ui-frontend/projects/ingest/src/main.ts @@ -44,5 +44,6 @@ if (environment.production) { enableProdMode(); } -platformBrowserDynamic().bootstrapModule(AppModule) +platformBrowserDynamic() + .bootstrapModule(AppModule) .catch((err) => console.log(err)); diff --git a/ui/ui-frontend/projects/ingest/src/polyfills.ts b/ui/ui-frontend/projects/ingest/src/polyfills.ts index 37b2af5b73b..ba2cc7edf57 100644 --- a/ui/ui-frontend/projects/ingest/src/polyfills.ts +++ b/ui/ui-frontend/projects/ingest/src/polyfills.ts @@ -55,14 +55,14 @@ */ /** IE10 and IE11 requires the following for NgClass support on SVG elements */ -import 'classlist.js'; // Run `npm install --save classlist.js`. +import 'classlist.js'; // Run `npm install --save classlist.js`. /** * Web Animations `@angular/platform-browser/animations` * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). */ -import 'web-animations-js'; // Run `npm install --save web-animations-js`. +import 'web-animations-js'; // Run `npm install --save web-animations-js`. /** * By default, zone.js will patch all possible macroTask and DomEvents @@ -92,7 +92,7 @@ import './zone-flags.ts'; /*************************************************************************************************** * Zone JS is required by default for Angular itself. */ -import 'zone.js/dist/zone'; // Included with Angular CLI. +import 'zone.js/dist/zone'; // Included with Angular CLI. import '@angular/localize/init'; /*************************************************************************************************** diff --git a/ui/ui-frontend/projects/ingest/src/sass/_filter.scss b/ui/ui-frontend/projects/ingest/src/sass/_filter.scss index 7960761d0a0..2b343f0083b 100644 --- a/ui/ui-frontend/projects/ingest/src/sass/_filter.scss +++ b/ui/ui-frontend/projects/ingest/src/sass/_filter.scss @@ -1,4 +1,4 @@ -@import "~ui-frontend-common/sass/variables/colors"; +@import '~ui-frontend-common/sass/variables/colors'; .filter-controls { margin-top: 22px; diff --git a/ui/ui-frontend/projects/ingest/src/sass/_form.scss b/ui/ui-frontend/projects/ingest/src/sass/_form.scss index 032853c37e1..d5b5442ba7f 100644 --- a/ui/ui-frontend/projects/ingest/src/sass/_form.scss +++ b/ui/ui-frontend/projects/ingest/src/sass/_form.scss @@ -1,9 +1,9 @@ .vitamui-form vitamui-slide-toggle { - margin-bottom: 20px; + margin-bottom: 20px; } .form-divider { - width: 100%; - height: 2px; - background-color: #E0E0E0; + width: 100%; + height: 2px; + background-color: #e0e0e0; } diff --git a/ui/ui-frontend/projects/ingest/src/sass/_material-theme.scss b/ui/ui-frontend/projects/ingest/src/sass/_material-theme.scss index 8f506297ae6..ee1c7917652 100644 --- a/ui/ui-frontend/projects/ingest/src/sass/_material-theme.scss +++ b/ui/ui-frontend/projects/ingest/src/sass/_material-theme.scss @@ -13,20 +13,20 @@ // hue. Available color palettes: https://www.google.com/design/spec/style/color.html $vitamui-primary: ( - 50: var(--vitamui-primary), - 100: var(--vitamui-primary), - 200: var(--vitamui-primary), - 300: var(--vitamui-primary), - 400: var(--vitamui-primary), - 500: var(--vitamui-primary), - 600: var(--vitamui-primary), - 700: var(--vitamui-primary), - 800: var(--vitamui-primary), - 900: var(--vitamui-primary), - A100: var(--vitamui-primary), - A200: var(--vitamui-primary), - A400: var(--vitamui-primary), - A700: var(--vitamui-primary), + 50: var(--vitamui-primary), + 100: var(--vitamui-primary), + 200: var(--vitamui-primary), + 300: var(--vitamui-primary), + 400: var(--vitamui-primary), + 500: var(--vitamui-primary), + 600: var(--vitamui-primary), + 700: var(--vitamui-primary), + 800: var(--vitamui-primary), + 900: var(--vitamui-primary), + A100: var(--vitamui-primary), + A200: var(--vitamui-primary), + A400: var(--vitamui-primary), + A700: var(--vitamui-primary), contrast: ( 50: $light-primary-text, 100: $light-primary-text, @@ -42,24 +42,24 @@ $vitamui-primary: ( A200: $light-primary-text, A400: $light-primary-text, A700: $light-primary-text, - ) + ), ); $vitamui-secondary: ( - 50: var(--vitamui-secondary), - 100: var(--vitamui-secondary), - 200: var(--vitamui-secondary), - 300: var(--vitamui-secondary), - 400: var(--vitamui-secondary), - 500: var(--vitamui-secondary), - 600: var(--vitamui-secondary), - 700: var(--vitamui-secondary), - 800: var(--vitamui-secondary), - 900: var(--vitamui-secondary), - A100: var(--vitamui-secondary), - A200: var(--vitamui-secondary), - A400: var(--vitamui-secondary), - A700: var(--vitamui-secondary), + 50: var(--vitamui-secondary), + 100: var(--vitamui-secondary), + 200: var(--vitamui-secondary), + 300: var(--vitamui-secondary), + 400: var(--vitamui-secondary), + 500: var(--vitamui-secondary), + 600: var(--vitamui-secondary), + 700: var(--vitamui-secondary), + 800: var(--vitamui-secondary), + 900: var(--vitamui-secondary), + A100: var(--vitamui-secondary), + A200: var(--vitamui-secondary), + A400: var(--vitamui-secondary), + A700: var(--vitamui-secondary), contrast: ( 50: $light-primary-text, 100: $light-primary-text, @@ -75,14 +75,14 @@ $vitamui-secondary: ( A200: $light-primary-text, A400: $light-primary-text, A700: $light-primary-text, - ) + ), ); $app-primary: mat-palette($vitamui-primary); -$app-accent: mat-palette($vitamui-secondary); +$app-accent: mat-palette($vitamui-secondary); // The warn palette is optional (defaults to red). -$app-warn: mat-palette($mat-red); +$app-warn: mat-palette($mat-red); // Create the theme object (a Sass map containing all of the palettes). $app-theme: mat-light-theme($app-primary, $app-accent, $app-warn); diff --git a/ui/ui-frontend/projects/ingest/src/sass/_profile-tag.scss b/ui/ui-frontend/projects/ingest/src/sass/_profile-tag.scss index af8b73dc21b..79487ff4931 100644 --- a/ui/ui-frontend/projects/ingest/src/sass/_profile-tag.scss +++ b/ui/ui-frontend/projects/ingest/src/sass/_profile-tag.scss @@ -1,18 +1,18 @@ .profile-tag { - font-size: 15px; - font-weight: 500; - font-style: normal; - line-height: normal; - letter-spacing: normal; - text-align: left; - color: $charcoal-grey-two; - background-color: #f8f8f8; - padding: 10px 10px 10px 10px; - margin-bottom: 10px; - white-space: nowrap; + font-size: 15px; + font-weight: 500; + font-style: normal; + line-height: normal; + letter-spacing: normal; + text-align: left; + color: $charcoal-grey-two; + background-color: #f8f8f8; + padding: 10px 10px 10px 10px; + margin-bottom: 10px; + white-space: nowrap; - i { - color: var(--vitamui-secondary); - margin-left: 5px; - } + i { + color: var(--vitamui-secondary); + margin-left: 5px; + } } diff --git a/ui/ui-frontend/projects/ingest/src/sass/_vitamui-tab-group.scss b/ui/ui-frontend/projects/ingest/src/sass/_vitamui-tab-group.scss index bb839ea1638..698e218023c 100644 --- a/ui/ui-frontend/projects/ingest/src/sass/_vitamui-tab-group.scss +++ b/ui/ui-frontend/projects/ingest/src/sass/_vitamui-tab-group.scss @@ -1,54 +1,56 @@ .account-tab-group.mat-tab-group { - .mat-tab-header { - border-bottom: none; - margin-left: 0px; - margin-top: -70px; + .mat-tab-header { + border-bottom: none; + margin-left: 0px; + margin-top: -70px; + } + + .mat-tab-label { + opacity: 1; + min-width: 200px; + height: 45px; + background-color: rgba(255, 255, 255, 0.85); + margin: 0 1px; + padding: 0 14px; + font-size: 14px; + font-weight: normal; + color: rgba(72, 80, 83, 0.3); + text-transform: uppercase; + transition: + background-color 200ms ease-out, + color 200ms ease-out; + + &:hover { + color: var(--vitamui-secondary); + background-color: rgba(255, 255, 255, 0.8); } - .mat-tab-label { - opacity: 1; - min-width: 200px; - height: 45px; - background-color: rgba(255, 255, 255, 0.85); - margin: 0 1px; - padding: 0 14px; - font-size: 14px; - font-weight: normal; - color: rgba(72, 80, 83, 0.3); - text-transform: uppercase; - transition: background-color 200ms ease-out, color 200ms ease-out; - - &:hover { - color: var(--vitamui-secondary); - background-color: rgba(255, 255, 255, 0.8); - } - - &:first-child { - margin-left: 0; - } - - &:last-child { - margin-right: 0; - } - - &:not(.mat-tab-disabled):focus { - background-color: rgba(255, 255, 255, 0.56); - } - - &.mat-tab-label-active, - &.mat-tab-label-active:not(.mat-tab-disabled):focus { - background-color: $white; - font-weight: bold; - color: #5e5d5d; - } + &:first-child { + margin-left: 0; } - .mat-ink-bar { - opacity: 0; + &:last-child { + margin-right: 0; } - .mat-tab-body-content { - padding: 0px; - overflow: none; + &:not(.mat-tab-disabled):focus { + background-color: rgba(255, 255, 255, 0.56); } + + &.mat-tab-label-active, + &.mat-tab-label-active:not(.mat-tab-disabled):focus { + background-color: $white; + font-weight: bold; + color: #5e5d5d; + } + } + + .mat-ink-bar { + opacity: 0; + } + + .mat-tab-body-content { + padding: 0px; + overflow: none; + } } diff --git a/ui/ui-frontend/projects/ingest/src/sass/login.scss b/ui/ui-frontend/projects/ingest/src/sass/login.scss index 8161c6b17c2..f860a00bb32 100644 --- a/ui/ui-frontend/projects/ingest/src/sass/login.scss +++ b/ui/ui-frontend/projects/ingest/src/sass/login.scss @@ -2,138 +2,136 @@ @import '~ui-frontend-common/sass/mixins/fonts'; .login-box { - position: relative; - display: block; - box-sizing: border-box; - width: 800px; - margin: 120px auto; - padding: 48px 80px; - @include vitamui-modal; - - h1 { - @include login-title; + position: relative; + display: block; + box-sizing: border-box; + width: 800px; + margin: 120px auto; + padding: 48px 80px; + @include vitamui-modal; + + h1 { + @include login-title; + } + + header p { + margin-bottom: 30px; + } + + p { + @include login-text-1; + line-height: 30px; + + small { + @include login-text-2; + font-weight: 400; } - - header p { - margin-bottom: 30px; - } - - p { - @include login-text-1; - line-height: 30px; - - small { - @include login-text-2; - font-weight: 400; - } + } + + strong { + font-weight: 500; + } + + a { + @include vitamui-link; + text-decoration: underline; + } + + input[type='text'], + input[type='email'], + input[type='password'] { + border: none; + outline: none; + border-radius: 25px; + box-shadow: 0 0 20px 0 rgba(169, 169, 169, 0.3); + transition: border-color 200ms ease-out; + height: 50px; + padding: 0 30px; + border: 1px solid transparent; + + &:focus { + border-color: $greyish-two; } - strong { - font-weight: 500; + &.ng-valid.ng-touched { + border-color: #43ea2a; } - a { - @include vitamui-link; - text-decoration: underline; + &.ng-invalid.ng-touched { + border-color: $red; } - input[type=text], - input[type=email], - input[type=password], { - border: none; - outline: none; - border-radius: 25px; - box-shadow: 0 0 20px 0 rgba(169, 169, 169, 0.3); - transition: border-color 200ms ease-out; - height: 50px; - padding: 0 30px; - border: 1px solid transparent; - - &:focus { - border-color: $greyish-two; - } - - &.ng-valid.ng-touched { - border-color: #43ea2a; - } - - &.ng-invalid.ng-touched { - border-color: $red; - } - - &[disabled] { - opacity: 0.4; - } + &[disabled] { + opacity: 0.4; } + } - .form-error { - @include login-error; + .form-error { + @include login-error; - i { - font-size: 36px; - vertical-align: middle; - margin-right: 10px; - } + i { + font-size: 36px; + vertical-align: middle; + margin-right: 10px; + } + } + + button.vitamui-primary { + @include button-primary; + border: none; + height: 50px; + border-radius: 25px; + background-color: var(--vitamui-primary); + box-shadow: 20px 20px 40px 0 rgba(214, 208, 208, 0.5); + padding: 0 30px; + transition: opacity 200ms ease-in-out; + border: 1px solid var(--vitamui-primary); + + &:focus:not([disabled]), + &:hover:not([disabled]) { + cursor: pointer; + background-color: #ff8b58; + outline: none; } - button.vitamui-primary { - @include button-primary; - border: none; - height: 50px; - border-radius: 25px; - background-color: var(--vitamui-primary); - box-shadow: 20px 20px 40px 0 rgba(214, 208, 208, 0.5); - padding: 0 30px; - transition: opacity 200ms ease-in-out; - border: 1px solid var(--vitamui-primary); - - - - &:focus:not([disabled]), - &:hover:not([disabled]) { - cursor: pointer; - background-color: #ff8b58; - outline: none; - } - - &[disabled] { - opacity: 0.4; - } + &[disabled] { + opacity: 0.4; } + } - .helper { - @include login-helper; - text-align: right; - transition: opacity 200ms ease-in-out; - margin: 0; + .helper { + @include login-helper; + text-align: right; + transition: opacity 200ms ease-in-out; + margin: 0; - &.hidden { - opacity: 0; - } + &.hidden { + opacity: 0; } - - button.back { - display: flex; - align-items: center; - background: transparent; - color: var(--vitamui-secondary); - font-size: 14px; - font-weight: normal; - border: none; - padding: 0; - margin-top: 40px; - cursor: pointer; - - i { - display: block; - font-size: 18px; - color: var(--vitamui-secondary); - background-color: #e7f5f2; - width: 30px; - height: 30px; - border-radius: 15px; - line-height: 30px; - margin-right: 10px; - } + } + + button.back { + display: flex; + align-items: center; + background: transparent; + color: var(--vitamui-secondary); + font-size: 14px; + font-weight: normal; + border: none; + padding: 0; + margin-top: 40px; + cursor: pointer; + + i { + display: block; + font-size: 18px; + color: var(--vitamui-secondary); + background-color: #e7f5f2; + width: 30px; + height: 30px; + border-radius: 15px; + line-height: 30px; + margin-right: 10px; } + } } diff --git a/ui/ui-frontend/projects/ingest/src/test.ts b/ui/ui-frontend/projects/ingest/src/test.ts index e0d537457e1..0d0133c407c 100644 --- a/ui/ui-frontend/projects/ingest/src/test.ts +++ b/ui/ui-frontend/projects/ingest/src/test.ts @@ -38,18 +38,12 @@ import 'zone.js/dist/zone-testing'; import { getTestBed } from '@angular/core/testing'; -import { - BrowserDynamicTestingModule, - platformBrowserDynamicTesting -} from '@angular/platform-browser-dynamic/testing'; +import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing'; declare const require: any; // First, initialize the Angular testing environment. -getTestBed().initTestEnvironment( - BrowserDynamicTestingModule, - platformBrowserDynamicTesting() -); +getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting()); // Then we find all the tests. const context = require.context('./', true, /\.spec\.ts$/); diff --git a/ui/ui-frontend/projects/pastis/e2e/src/app.e2e-spec.ts b/ui/ui-frontend/projects/pastis/e2e/src/app.e2e-spec.ts index 3188db0f384..5e19168b728 100644 --- a/ui/ui-frontend/projects/pastis/e2e/src/app.e2e-spec.ts +++ b/ui/ui-frontend/projects/pastis/e2e/src/app.e2e-spec.ts @@ -16,8 +16,10 @@ describe('workspace-project App', () => { afterEach(async () => { // Assert that there are no errors emitted from the browser const logs = await browser.manage().logs().get(logging.Type.BROWSER); - expect(logs).not.toContain(jasmine.objectContaining({ - level: logging.Level.SEVERE, - } as logging.Entry)); + expect(logs).not.toContain( + jasmine.objectContaining({ + level: logging.Level.SEVERE, + } as logging.Entry), + ); }); }); diff --git a/ui/ui-frontend/projects/pastis/src/app/app-routing.module.ts b/ui/ui-frontend/projects/pastis/src/app/app-routing.module.ts index adc81ee90aa..495c0eb2fb3 100644 --- a/ui/ui-frontend/projects/pastis/src/app/app-routing.module.ts +++ b/ui/ui-frontend/projects/pastis/src/app/app-routing.module.ts @@ -42,48 +42,48 @@ import { environment } from '../environments/environment'; import { AppComponent } from './app.component'; const standalone: boolean = environment.standalone; -const routes: Route[] = standalone ? -[ - { - path: '', - loadChildren: () => import('./pastis/pastis.module').then((m) => m.PastisModule), - resolve: { userAnalytics: AnalyticsResolver }, - data: { appId: 'PASTIS_APP' }, - }, - { - path: 'pastis', - loadChildren: () => import('./pastis/pastis.module').then((m) => m.PastisModule), - resolve: { userAnalytics: AnalyticsResolver }, - data: { appId: 'PASTIS_APP' }, - }, +const routes: Route[] = standalone + ? [ + { + path: '', + loadChildren: () => import('./pastis/pastis.module').then((m) => m.PastisModule), + resolve: { userAnalytics: AnalyticsResolver }, + data: { appId: 'PASTIS_APP' }, + }, + { + path: 'pastis', + loadChildren: () => import('./pastis/pastis.module').then((m) => m.PastisModule), + resolve: { userAnalytics: AnalyticsResolver }, + data: { appId: 'PASTIS_APP' }, + }, - { path: '**', redirectTo: '' }, -] : -[ - { - path: '', - component: AppComponent, - canActivate: [AuthGuard, AppGuard], - resolve: { userAnalytics: AnalyticsResolver }, - data: { appId: 'PORTAL_APP' }, - }, - { - path: 'account', - component: AccountComponent, - canActivate: [AuthGuard, AppGuard], - resolve: { userAnalytics: AnalyticsResolver }, - data: { appId: 'ACCOUNTS_APP' }, - }, - { - path: 'pastis', - loadChildren: () => import('./pastis/pastis.module').then((m) => m.PastisModule), - canActivate: [AuthGuard, AppGuard], - resolve: { userAnalytics: AnalyticsResolver }, - data: { appId: 'PASTIS_APP' }, - }, + { path: '**', redirectTo: '' }, + ] + : [ + { + path: '', + component: AppComponent, + canActivate: [AuthGuard, AppGuard], + resolve: { userAnalytics: AnalyticsResolver }, + data: { appId: 'PORTAL_APP' }, + }, + { + path: 'account', + component: AccountComponent, + canActivate: [AuthGuard, AppGuard], + resolve: { userAnalytics: AnalyticsResolver }, + data: { appId: 'ACCOUNTS_APP' }, + }, + { + path: 'pastis', + loadChildren: () => import('./pastis/pastis.module').then((m) => m.PastisModule), + canActivate: [AuthGuard, AppGuard], + resolve: { userAnalytics: AnalyticsResolver }, + data: { appId: 'PASTIS_APP' }, + }, - { path: '**', redirectTo: '' }, -]; + { path: '**', redirectTo: '' }, + ]; @NgModule({ imports: [ diff --git a/ui/ui-frontend/projects/pastis/src/app/app.component.html b/ui/ui-frontend/projects/pastis/src/app/app.component.html index 8b54b7ff20a..ba9484cf96e 100644 --- a/ui/ui-frontend/projects/pastis/src/app/app.component.html +++ b/ui/ui-frontend/projects/pastis/src/app/app.component.html @@ -1,6 +1,6 @@ - + Profil d'Archivage Simple pour le Traitement de l'Information en Seda
      @@ -11,9 +11,9 @@ diff --git a/ui/ui-frontend/projects/pastis/src/app/app.component.scss b/ui/ui-frontend/projects/pastis/src/app/app.component.scss index ed19680d39e..19e94367290 100644 --- a/ui/ui-frontend/projects/pastis/src/app/app.component.scss +++ b/ui/ui-frontend/projects/pastis/src/app/app.component.scss @@ -14,26 +14,26 @@ mat-toolbar { font-size: 15px; font-family: Mulish; } -.separator{ +.separator { margin-top: 100px; } .logo { - max-height : 100%; - width : auto; + max-height: 100%; + width: auto; padding: 10px; } - - .footer { +.footer { position: static; left: 0; bottom: 0; width: 100%; margin-top: 50px; - box-shadow: 0 4px 16px rgba(var(--vitamui-primary-rgb), 0.4), 0 8px 32px rgba(var(--vitamui-primary-rgb), 0.2); + box-shadow: + 0 4px 16px rgba(var(--vitamui-primary-rgb), 0.4), + 0 8px 32px rgba(var(--vitamui-primary-rgb), 0.2); background-color: var(--vitamui-primary-600); - } .footer p { @@ -47,5 +47,4 @@ mat-toolbar { .pastis-footer-href { color: white; - -} \ No newline at end of file +} diff --git a/ui/ui-frontend/projects/pastis/src/app/app.component.spec.ts b/ui/ui-frontend/projects/pastis/src/app/app.component.spec.ts index 8a44b9b8687..bdda69b8bbb 100644 --- a/ui/ui-frontend/projects/pastis/src/app/app.component.spec.ts +++ b/ui/ui-frontend/projects/pastis/src/app/app.component.spec.ts @@ -43,7 +43,6 @@ import { of } from 'rxjs'; import { AuthService, StartupService } from 'ui-frontend-common'; import { AppComponent } from './app.component'; - @Component({ selector: 'router-outlet', template: '' }) class RouterOutletStubComponent {} @@ -51,25 +50,16 @@ class RouterOutletStubComponent {} class SubrogationBannerStubComponent {} describe('AppComponent', () => { - - beforeEach(async(() => { const startupServiceStub = { configurationLoaded: () => true, printConfiguration: () => {} }; TestBed.configureTestingModule({ - imports: [ - MatSidenavModule, - NoopAnimationsModule, - ], - declarations: [ - AppComponent, - SubrogationBannerStubComponent, - RouterOutletStubComponent, - ], + imports: [MatSidenavModule, NoopAnimationsModule], + declarations: [AppComponent, SubrogationBannerStubComponent, RouterOutletStubComponent], providers: [ { provide: StartupService, useValue: startupServiceStub }, { provide: AuthService, useValue: { userLoaded: of(null) } }, { provide: Router, useValue: { navigate: () => {} } }, - ] + ], }).compileComponents(); })); @@ -86,6 +76,4 @@ describe('AppComponent', () => { // console.log('Title App: ', app); expect(app.title).toEqual('Pastis Application'); })); - - }); diff --git a/ui/ui-frontend/projects/pastis/src/app/app.component.ts b/ui/ui-frontend/projects/pastis/src/app/app.component.ts index c24ca5ed662..8f9e6e9b70c 100644 --- a/ui/ui-frontend/projects/pastis/src/app/app.component.ts +++ b/ui/ui-frontend/projects/pastis/src/app/app.component.ts @@ -40,10 +40,9 @@ import { environment } from '../environments/environment'; @Component({ selector: 'app-root', templateUrl: './app.component.html', - styleUrls: ['./app.component.scss'] + styleUrls: ['./app.component.scss'], }) export class AppComponent implements OnInit { - title = 'Pastis Application'; subrogating = false; isStandalone: boolean = environment.standalone; @@ -51,9 +50,7 @@ export class AppComponent implements OnInit { constructor() { this.sedaviewRoute = document.URL.substring(document.URL.lastIndexOf('/'), document.URL.length) === '/sedaview'; - } ngOnInit() {} - } diff --git a/ui/ui-frontend/projects/pastis/src/app/core/api/api.pastis.service.ts b/ui/ui-frontend/projects/pastis/src/app/core/api/api.pastis.service.ts index 184e0912ba5..032aae42bea 100644 --- a/ui/ui-frontend/projects/pastis/src/app/core/api/api.pastis.service.ts +++ b/ui/ui-frontend/projects/pastis/src/app/core/api/api.pastis.service.ts @@ -42,19 +42,20 @@ import { BASE_URL } from 'ui-frontend-common'; import { environment } from '../../../environments/environment'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class PastisApiService { - baseUrl: string; - constructor(private http: HttpClient, @Inject(BASE_URL) baseUrl: string) { + constructor( + private http: HttpClient, + @Inject(BASE_URL) baseUrl: string, + ) { if (environment.apiServerUrl != undefined && environment.standalone) { this.baseUrl = environment.apiServerUrl; } else { this.baseUrl = baseUrl; } - } getBaseUrl() { @@ -67,7 +68,7 @@ export class PastisApiService { return this.http.get(`${this.baseUrl}${path}`, options); } - // Generic GET Method + // Generic GET Method getLocally(path: string): Observable { // console.log('On getLocally using filepath : ', `${path}`); return this.http.get(`${path}`); @@ -75,9 +76,7 @@ export class PastisApiService { // Generic PUT Method put(path: string, body: object = {}): Observable { - return this.http.put( - `${this.baseUrl}${path}`, - JSON.stringify(body)); + return this.http.put(`${this.baseUrl}${path}`, JSON.stringify(body)); } // Generic POST Method @@ -88,8 +87,6 @@ export class PastisApiService { } delete(path: string): Observable { - return this.http.delete( - `${this.baseUrl}${path}`); + return this.http.delete(`${this.baseUrl}${path}`); } - } diff --git a/ui/ui-frontend/projects/pastis/src/app/core/classes/pastis-configuration.ts b/ui/ui-frontend/projects/pastis/src/app/core/classes/pastis-configuration.ts index 69c0776d9cd..83d4dc9caf4 100644 --- a/ui/ui-frontend/projects/pastis/src/app/core/classes/pastis-configuration.ts +++ b/ui/ui-frontend/projects/pastis/src/app/core/classes/pastis-configuration.ts @@ -1,10 +1,9 @@ -import {Injectable} from '@angular/core'; -import {environment} from '../../../environments/environment'; -import {PastisApiService} from '../api/api.pastis.service'; +import { Injectable } from '@angular/core'; +import { environment } from '../../../environments/environment'; +import { PastisApiService } from '../api/api.pastis.service'; @Injectable() export class PastisConfiguration { - // routes pastis pastisEditPage: string; sedaUrl: string; @@ -38,27 +37,29 @@ export class PastisConfiguration { updateArchivalProfileUnitById: string; importProfileInExistingNotice: string; - - - constructor(private pastisApi: PastisApiService) { - } + constructor(private pastisApi: PastisApiService) {} public initConfiguration(): Promise { if (environment.apiServerUrl != undefined && environment.standalone) { return new Promise((r, e) => { - this.pastisApi.getLocally('./assets/config/config-standalone.json').subscribe((content: PastisConfiguration) => { - Object.assign(this, content); - r(this); - }, reason => e(reason)); + this.pastisApi.getLocally('./assets/config/config-standalone.json').subscribe( + (content: PastisConfiguration) => { + Object.assign(this, content); + r(this); + }, + (reason) => e(reason), + ); }); } else { return new Promise((r, e) => { - this.pastisApi.getLocally('./assets/config/config-vitam-ui.json').subscribe((content: PastisConfiguration) => { - Object.assign(this, content); - r(this); - }, reason => e(reason)); + this.pastisApi.getLocally('./assets/config/config-vitam-ui.json').subscribe( + (content: PastisConfiguration) => { + Object.assign(this, content); + r(this); + }, + (reason) => e(reason), + ); }); } } - } diff --git a/ui/ui-frontend/projects/pastis/src/app/core/core.module.ts b/ui/ui-frontend/projects/pastis/src/app/core/core.module.ts index 39a2f439e78..d48a8e05317 100644 --- a/ui/ui-frontend/projects/pastis/src/app/core/core.module.ts +++ b/ui/ui-frontend/projects/pastis/src/app/core/core.module.ts @@ -43,32 +43,32 @@ import { PastisMaterialModule } from '../material.module'; import { SharedModule } from '../shared/shared.module'; const ngxUiLoaderConfig: NgxUiLoaderConfig = { - "bgsColor": "red", - "bgsOpacity": 0.5, - "bgsPosition": "bottom-right", - "bgsSize": 60, - "bgsType": "ball-spin-clockwise", - "blur": 5, - "delay": 0, - "fgsColor": "#ffffff", - "fgsPosition": "center-center", - "fgsSize": 60, - "fgsType": "ball-spin-clockwise", - "gap": 24, - "logoPosition": "center-center", - "logoSize": 120, - "logoUrl": "assets/pastis-logo7.png", - "masterLoaderId": "master", - "overlayBorderRadius": "0", - "overlayColor": "rgba(40,40,40,0.8)", - "pbColor": "#604379", - "pbDirection": "ltr", - "pbThickness": 3, - "hasProgressBar": false, - "textColor": "#FFFFFF", - "textPosition": "center-center", - "maxTime": -1, - "minTime": 300 + bgsColor: 'red', + bgsOpacity: 0.5, + bgsPosition: 'bottom-right', + bgsSize: 60, + bgsType: 'ball-spin-clockwise', + blur: 5, + delay: 0, + fgsColor: '#ffffff', + fgsPosition: 'center-center', + fgsSize: 60, + fgsType: 'ball-spin-clockwise', + gap: 24, + logoPosition: 'center-center', + logoSize: 120, + logoUrl: 'assets/pastis-logo7.png', + masterLoaderId: 'master', + overlayBorderRadius: '0', + overlayColor: 'rgba(40,40,40,0.8)', + pbColor: '#604379', + pbDirection: 'ltr', + pbThickness: 3, + hasProgressBar: false, + textColor: '#FFFFFF', + textPosition: 'center-center', + maxTime: -1, + minTime: 300, }; @NgModule({ declarations: [], @@ -78,20 +78,14 @@ const ngxUiLoaderConfig: NgxUiLoaderConfig = { VitamUICommonModule, PastisMaterialModule, SharedModule, - NgxUiLoaderModule.forRoot(ngxUiLoaderConfig) + NgxUiLoaderModule.forRoot(ngxUiLoaderConfig), ], - exports: [ - VitamUICommonModule, - NgxUiLoaderModule - ], - providers: [ - ] + exports: [VitamUICommonModule, NgxUiLoaderModule], + providers: [], }) export class CoreModule { - constructor(@Optional() @SkipSelf() parentModule: CoreModule) { throwIfAlreadyLoaded(parentModule, 'CoreModule'); } - } diff --git a/ui/ui-frontend/projects/pastis/src/app/core/services/archival-profile-unit-api.service.ts b/ui/ui-frontend/projects/pastis/src/app/core/services/archival-profile-unit-api.service.ts index 2f04634e4f4..7f6bbf297f1 100644 --- a/ui/ui-frontend/projects/pastis/src/app/core/services/archival-profile-unit-api.service.ts +++ b/ui/ui-frontend/projects/pastis/src/app/core/services/archival-profile-unit-api.service.ts @@ -44,13 +44,10 @@ import { PastisConfiguration } from '../classes/pastis-configuration'; const HTTP_STATUS_OK = 200; - @Injectable({ - providedIn: 'root' + providedIn: 'root', }) - export class ArchivalProfileUnitApiService extends BaseHttpClient { - // @ts-ignore constructor(http: HttpClient, @Inject(BASE_URL) baseUrl: string, pastisConfiguration: PastisConfiguration) { // console.log('passage dans service archival API'); @@ -73,7 +70,7 @@ export class ArchivalProfileUnitApiService extends BaseHttpClient(this.apiUrl + archivalUnitProfile.identifier, archivalUnitProfile, { headers }); } - patch(partialAgency: { id: string, [key: string]: any }, headers?: HttpHeaders) { + patch(partialAgency: { id: string; [key: string]: any }, headers?: HttpHeaders) { return super.patch(partialAgency, headers); } @@ -82,12 +79,13 @@ export class ArchivalProfileUnitApiService extends BaseHttpClient { - return super.getHttp().post(super.getApiUrl() + '/check', agency, {observe: 'response', headers}) + return super + .getHttp() + .post(super.getApiUrl() + '/check', agency, { observe: 'response', headers }) .pipe(map((response: HttpResponse) => response.status === HTTP_STATUS_OK)); } delete(id: string, headers?: HttpHeaders) { - return super.getHttp().delete(super.getApiUrl() + '/' + id, {headers}); + return super.getHttp().delete(super.getApiUrl() + '/' + id, { headers }); } - } diff --git a/ui/ui-frontend/projects/pastis/src/app/core/services/archive-profile-api.service.ts b/ui/ui-frontend/projects/pastis/src/app/core/services/archive-profile-api.service.ts index d5fea24ebfd..fa44233a45f 100644 --- a/ui/ui-frontend/projects/pastis/src/app/core/services/archive-profile-api.service.ts +++ b/ui/ui-frontend/projects/pastis/src/app/core/services/archive-profile-api.service.ts @@ -45,12 +45,15 @@ import { PastisConfiguration } from '../classes/pastis-configuration'; const HTTP_STATUS_OK = 200; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class ArchiveProfileApiService extends BaseHttpClient { - // @ts-ignore - constructor(http: HttpClient, @Inject(BASE_URL) baseUrl: string, private pastisConfig: PastisConfiguration) { + constructor( + http: HttpClient, + @Inject(BASE_URL) baseUrl: string, + private pastisConfig: PastisConfiguration, + ) { // console.log('passage dans service archive API'); super(http, baseUrl); } @@ -59,7 +62,6 @@ export class ArchiveProfileApiService extends BaseHttpClient { return super.getAllByParams(params, headers); } - getAllPaginated(pageRequest: PageRequest, embedded?: string, headers?: HttpHeaders): Observable> { return super.getAllPaginated(pageRequest, embedded, headers); } @@ -72,10 +74,10 @@ export class ArchiveProfileApiService extends BaseHttpClient { return super.getHttp().get(super.getApiUrl() + this.pastisConfig.downloadProfile + '/' + id, { responseType: 'blob', headers }); } - uploadProfileArchivageFile(id: string, profile: FormData, headers?: HttpHeaders): Observable { - return super.getHttp().put(this.apiUrl + this.pastisConfig.importProfileInExistingNotice + '/' + id, - profile, { responseType: 'json', headers }); + return super + .getHttp() + .put(this.apiUrl + this.pastisConfig.importProfileInExistingNotice + '/' + id, profile, { responseType: 'json', headers }); } updateProfilePa(profile: Profile, headers?: HttpHeaders): Observable { @@ -83,7 +85,7 @@ export class ArchiveProfileApiService extends BaseHttpClient { return this.http.put(this.apiUrl + this.pastisConfig.archiveProfileApiPath + '/' + profile.identifier, profile, { headers }); } - patch(partialAgency: { id: string, [key: string]: any }, headers?: HttpHeaders) { + patch(partialAgency: { id: string; [key: string]: any }, headers?: HttpHeaders) { return super.patch(partialAgency, headers); } @@ -92,10 +94,11 @@ export class ArchiveProfileApiService extends BaseHttpClient { } check(profile: Profile, headers?: HttpHeaders): Observable { - return super.getHttp().post(super.getApiUrl() + this.pastisConfig.archiveProfileApiPath + '/check', - profile, { + return super + .getHttp() + .post(super.getApiUrl() + this.pastisConfig.archiveProfileApiPath + '/check', profile, { observe: 'response', - headers + headers, }) .pipe(map((response: HttpResponse) => response.status === HTTP_STATUS_OK)); } @@ -103,5 +106,4 @@ export class ArchiveProfileApiService extends BaseHttpClient { delete(id: string, headers?: HttpHeaders) { return super.getHttp().delete(super.getApiUrl() + '/' + id, { headers }); } - } diff --git a/ui/ui-frontend/projects/pastis/src/app/core/services/file.service.ts b/ui/ui-frontend/projects/pastis/src/app/core/services/file.service.ts index dcd3d794d74..a41ce2327e4 100644 --- a/ui/ui-frontend/projects/pastis/src/app/core/services/file.service.ts +++ b/ui/ui-frontend/projects/pastis/src/app/core/services/file.service.ts @@ -51,11 +51,9 @@ import { ProfileService } from './profile.service'; import { SedaService } from './seda.service'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) - export class FileService implements OnDestroy { - currentTree = new ReplaySubject(); notice = new BehaviorSubject(null); noticeEditable = new BehaviorSubject(null); @@ -76,9 +74,12 @@ export class FileService implements OnDestroy { private _profileServiceGetProfileSubscription: Subscription; - constructor(private profileService: ProfileService, private fileMetadataService: FileTreeMetadataService, - private dialog: MatDialog, private sedaService: SedaService) { - } + constructor( + private profileService: ProfileService, + private fileMetadataService: FileTreeMetadataService, + private dialog: MatDialog, + private sedaService: SedaService, + ) {} /** * Update the tree with the profile provided @@ -89,9 +90,9 @@ export class FileService implements OnDestroy { this.profileService.profileName = profileResponse.name; this.profileService.profileId = profileResponse.id; - const sedaDataArray: SedaData[] = [ this.sedaService.sedaRules[0] ]; - this.linkFileNodeToSedaData(null, [ profileResponse.profile ], sedaDataArray); - this.currentTree.next([ profileResponse.profile ]); + const sedaDataArray: SedaData[] = [this.sedaService.sedaRules[0]]; + this.linkFileNodeToSedaData(null, [profileResponse.profile], sedaDataArray); + this.currentTree.next([profileResponse.profile]); this.currentTreeLoaded = true; if (profileResponse.notice) { this.notice.next(profileResponse.notice); @@ -127,7 +128,7 @@ export class FileService implements OnDestroy { if (parent) { node.parent = parent; } - const nodeName: string = (node.name === 'xml:id') ? 'id' : node.name; + const nodeName: string = node.name === 'xml:id' ? 'id' : node.name; if (nodeName) { let sedaDataMatch: SedaData; @@ -137,7 +138,7 @@ export class FileService implements OnDestroy { sedaDataMatch = this.sedaDataArchiveUnit; } else { // Sinon on recherche la définition SEDA dans l'arbre - sedaDataMatch = sedaData.find(seda => seda.Name === nodeName); + sedaDataMatch = sedaData.find((seda) => seda.Name === nodeName); // sedaDataMatch = this.sedaService.getSedaNodeRecursively(sedaData[0],nodeName) } if (!sedaDataMatch) { @@ -156,9 +157,8 @@ export class FileService implements OnDestroy { if (sedaDataMatch.Name === 'ArchiveUnit' && this.sedaDataArchiveUnit === undefined) { this.sedaDataArchiveUnit = sedaDataMatch; // On introduit la récursivité sur les ArchivesUnit - this.sedaDataArchiveUnit.Children - .find((c: { Name: string; }) => c.Name === 'ArchiveUnit') - .Children = this.sedaDataArchiveUnit.Children; + this.sedaDataArchiveUnit.Children.find((c: { Name: string }) => c.Name === 'ArchiveUnit').Children = + this.sedaDataArchiveUnit.Children; } } node.sedaData = sedaDataMatch; @@ -176,7 +176,7 @@ export class FileService implements OnDestroy { */ updateNodeChildren(parentNode: FileNode, newChildrenNodes: FileNode[]) { for (const idx in parentNode.children) { - const childFromNewChildren = newChildrenNodes.find(newChild => newChild.id == parentNode.children[idx].id); + const childFromNewChildren = newChildrenNodes.find((newChild) => newChild.id == parentNode.children[idx].id); if (childFromNewChildren) { parentNode.children[idx] = childFromNewChildren; } @@ -192,10 +192,10 @@ export class FileService implements OnDestroy { width: popData.width, height: popData.height, data: popData, - panelClass: 'pastis-popup-modal-box' + panelClass: 'pastis-popup-modal-box', }); return new Promise((resolve, reject) => { - dialogConfirmRef.afterClosed().subscribe(data => { + dialogConfirmRef.afterClosed().subscribe((data) => { resolve(data); // console.log('The confirm dialog was closed with data : ', data); }, reject); @@ -246,7 +246,7 @@ export class FileService implements OnDestroy { * @param attributeName The name of the attribute we want to get */ getAttributeByName(fileNode: FileNode, attributeName: String): FileNode { - return fileNode.children.find(c => c.name == attributeName); + return fileNode.children.find((c) => c.name == attributeName); } /** @@ -254,7 +254,7 @@ export class FileService implements OnDestroy { * @param fileNode The concerned FileNode */ deleteAllAttributes(fileNode: FileNode): void { - fileNode.children = fileNode.children.filter(c => c.type !== TypeConstants.attribute); + fileNode.children = fileNode.children.filter((c) => c.type !== TypeConstants.attribute); } removeItem(nodesToBeDeleted: FileNode[], root: FileNode) { @@ -305,7 +305,7 @@ export class FileService implements OnDestroy { // console.log('Node clicked : ', node, '...with tab rules from service : ', rulesFromService); // console.log('The found node on filetree : ', node.sedaData); this.sedaService.selectedSedaNode.next(node.sedaData); - this.currentTree.next([ node ]); + this.currentTree.next([node]); this.sendNode(node); const dataTable = this.fileMetadataService.fillDataTable(node.sedaData, node, tabChildrenToInclude, tabChildrenToExclude); // console.log('Data revtried on click : ', dataTable); @@ -372,12 +372,10 @@ export class FileService implements OnDestroy { getComplexSedaChildrenAsFileNode(sedaElement: SedaData): FileNode[] { // Insert all children of complex elements based on SEDA definition - if (sedaElement.Element === SedaElementConstants.complex && - sedaElement.Children.length > 0) { + if (sedaElement.Element === SedaElementConstants.complex && sedaElement.Children.length > 0) { const fileNodeComplexChildren: FileNode[] = []; - sedaElement.Children.forEach((child: { Cardinality: string; Name: string; Type: string; }) => { - if (child.Cardinality === SedaCardinalityConstants.one || - child.Cardinality === SedaCardinalityConstants.oreOrMore) { + sedaElement.Children.forEach((child: { Cardinality: string; Name: string; Type: string }) => { + if (child.Cardinality === SedaCardinalityConstants.one || child.Cardinality === SedaCardinalityConstants.oreOrMore) { const aFileNode: FileNode = {} as FileNode; aFileNode.name = child.Name; aFileNode.cardinality = child.Cardinality; @@ -388,7 +386,6 @@ export class FileService implements OnDestroy { }); return fileNodeComplexChildren; } - } updateMedataTable(node: FileNode) { @@ -398,7 +395,7 @@ export class FileService implements OnDestroy { const tabChildrenToExclude = rulesFromService[1]; this.sedaService.selectedSedaNode.next(node.sedaData); const dataTable = this.fileMetadataService.fillDataTable(node.sedaData, node, tabChildrenToInclude, tabChildrenToExclude); - const hasAtLeastOneComplexChild = node.children.some(el => el.type === TypeConstants.element); + const hasAtLeastOneComplexChild = node.children.some((el) => el.type === TypeConstants.element); if (node.sedaData.Element === SedaElementConstants.complex) { this.fileMetadataService.shouldLoadMetadataTable.next(hasAtLeastOneComplexChild); @@ -425,7 +422,7 @@ export class FileService implements OnDestroy { identifier: noticeProfile.identifier, status: noticeProfile.status, name: noticeProfile.name, - description: noticeProfile.description + description: noticeProfile.description, }; this.noticeEditable.next(notice); } else { diff --git a/ui/ui-frontend/projects/pastis/src/app/core/services/notice.service.ts b/ui/ui-frontend/projects/pastis/src/app/core/services/notice.service.ts index 8488519b997..7356dfe32a1 100644 --- a/ui/ui-frontend/projects/pastis/src/app/core/services/notice.service.ts +++ b/ui/ui-frontend/projects/pastis/src/app/core/services/notice.service.ts @@ -43,11 +43,10 @@ import { ProfileDescription, ProfileDescriptionModel } from '../../models/profil import { FileService } from './file.service'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class NoticeService { - - constructor(private fileService: FileService) { } + constructor(private fileService: FileService) {} notice: Notice; @@ -59,7 +58,7 @@ export class NoticeService { }, (error) => { console.log(error); - } + }, ); } @@ -72,7 +71,7 @@ export class NoticeService { profileDescription.controlSchema = '{}'; return profileDescription; - } + } paNotice(retour: any, create: boolean): Profile { const profile = new ProfileModel(); @@ -82,7 +81,6 @@ export class NoticeService { profile.status = retour.selectedStatus; profile.format = create ? 'RNG' : retour.format; return profile; - } profileFromNotice(retour: any, edit: boolean, pua: boolean): ProfileDescription { @@ -96,7 +94,6 @@ export class NoticeService { } return profile; - } profileDescriptionToPaProfile(profileDescription: ProfileDescription): Profile { @@ -110,6 +107,4 @@ export class NoticeService { archivalProfileUnit = Object.assign(archivalProfileUnit, profileDescription); return archivalProfileUnit; } - - } diff --git a/ui/ui-frontend/projects/pastis/src/app/core/services/notification.service.ts b/ui/ui-frontend/projects/pastis/src/app/core/services/notification.service.ts index c02cdacc3b4..32ef4b64a4d 100644 --- a/ui/ui-frontend/projects/pastis/src/app/core/services/notification.service.ts +++ b/ui/ui-frontend/projects/pastis/src/app/core/services/notification.service.ts @@ -36,16 +36,18 @@ The fact that you are presently reading this means that you have had knowledge of the CeCILL-C license and that you accept its terms. */ -import {Injectable} from '@angular/core'; +import { Injectable } from '@angular/core'; import { MatSnackBar, MatSnackBarConfig, MatSnackBarHorizontalPosition, MatSnackBarVerticalPosition } from '@angular/material/snack-bar'; import { ToastrService } from 'ngx-toastr'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class NotificationService { - - constructor(private toasterService: ToastrService, private snackBar: MatSnackBar) {} + constructor( + private toasterService: ToastrService, + private snackBar: MatSnackBar, + ) {} // Toaster showSuccess(message: string) { @@ -78,8 +80,5 @@ export class NotificationService { snackBarConfig.panelClass = 'pastis-notifier-bg'; snackBarConfig.duration = duration * 1000; this.snackBar.open(message, action, snackBarConfig); -} - - - + } } diff --git a/ui/ui-frontend/projects/pastis/src/app/core/services/popup.service.ts b/ui/ui-frontend/projects/pastis/src/app/core/services/popup.service.ts index f920a2a118c..53f1a1bc4b1 100644 --- a/ui/ui-frontend/projects/pastis/src/app/core/services/popup.service.ts +++ b/ui/ui-frontend/projects/pastis/src/app/core/services/popup.service.ts @@ -39,15 +39,13 @@ import { Injectable } from '@angular/core'; import { BehaviorSubject } from 'rxjs'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class PopupService { - popUpDataBeforeClose = new BehaviorSubject(null); popUpDataAfterOpen = new BehaviorSubject(null); btnYesShoudBeDisabled = new BehaviorSubject(false); - constructor() {} getPopUpDataOnOpen() { @@ -69,5 +67,4 @@ export class PopupService { disableYesButton(condition: boolean) { condition ? this.btnYesShoudBeDisabled.next(true) : this.btnYesShoudBeDisabled.next(false); } - } diff --git a/ui/ui-frontend/projects/pastis/src/app/core/services/profile.service.ts b/ui/ui-frontend/projects/pastis/src/app/core/services/profile.service.ts index d7dc1834515..20f82f0452f 100644 --- a/ui/ui-frontend/projects/pastis/src/app/core/services/profile.service.ts +++ b/ui/ui-frontend/projects/pastis/src/app/core/services/profile.service.ts @@ -54,10 +54,9 @@ import { ArchivalProfileUnitApiService } from './archival-profile-unit-api.servi import { ArchiveProfileApiService } from './archive-profile-api.service'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class ProfileService implements OnDestroy { - public page: number; public size: number; public orderBy: string; @@ -78,11 +77,12 @@ export class ProfileService implements OnDestroy { subscription4$: Subscription; subscriptions: Subscription[] = []; - - constructor(private apiService: PastisApiService, private pastisConfig: PastisConfiguration, - private puaService: ArchivalProfileUnitApiService, - private paService: ArchiveProfileApiService) { - } + constructor( + private apiService: PastisApiService, + private pastisConfig: PastisConfiguration, + private puaService: ArchivalProfileUnitApiService, + private paService: ArchiveProfileApiService, + ) {} ngOnDestroy(): void { this.subscriptions.forEach((subscriptions) => subscriptions.unsubscribe()); @@ -173,7 +173,7 @@ export class ProfileService implements OnDestroy { headers: new HttpHeaders({ 'Content-type': 'application/json', }), - responseType: 'blob' + responseType: 'blob', }; let profile: any = cloneDeep(file[0]); @@ -190,7 +190,7 @@ export class ProfileService implements OnDestroy { fixCircularReference(node: FileNode) { node.parent = null; node.sedaData = null; - node.children.forEach(child => { + node.children.forEach((child) => { this.fixCircularReference(child); }); } @@ -201,10 +201,7 @@ export class ProfileService implements OnDestroy { this.size = pageRequest.size; this.direction = pageRequest.direction; - const params = new HttpParams() - .set('page', this.page.toString()) - .set('size', this.size.toString()) - .set('direction', this.direction); + const params = new HttpParams().set('page', this.page.toString()).set('size', this.size.toString()).set('direction', this.direction); let allProfilesPA: any; allProfilesPA = this.apiService.get(this.pastisConfig.getProfilePaginatedUrl, { params }).pipe( map((paginated: PaginatedResponse) => { @@ -212,7 +209,7 @@ export class ProfileService implements OnDestroy { this.page = paginated.pageNum; this.hasMore = paginated.hasMore; return this.data; - }) + }), ); return allProfilesPA; } @@ -223,10 +220,7 @@ export class ProfileService implements OnDestroy { this.size = pageRequest.size; this.direction = pageRequest.direction; - const params = new HttpParams() - .set('page', this.page.toString()) - .set('size', this.size.toString()) - .set('direction', this.direction); + const params = new HttpParams().set('page', this.page.toString()).set('size', this.size.toString()).set('direction', this.direction); let allProfilesPUA: any; allProfilesPUA = this.apiService.get(this.pastisConfig.getArchivalProfileUnitPaginatedUrl, { params }).pipe( map((paginated: PaginatedResponse) => { @@ -235,19 +229,18 @@ export class ProfileService implements OnDestroy { this.hasMore = paginated.hasMore; return this.data; - }) + }), ); return allProfilesPUA; } - getAllProfilesPaginated(pageRequest: PageRequest): Observable { const tabVide: ProfileDescription[] = []; this.subscription2$ = this.getAllProfilesPAPaginated(pageRequest).subscribe((data: ProfileDescription[]) => { if (data) { - data.forEach(p => p.type = ProfileType.PA); - data.forEach(p => tabVide.push(p)); + data.forEach((p) => (p.type = ProfileType.PA)); + data.forEach((p) => tabVide.push(p)); this.retrievedProfiles.next(data); } }); @@ -255,7 +248,7 @@ export class ProfileService implements OnDestroy { this.subscription1$ = this.getAllProfilesPUAPaginated(pageRequest).subscribe((data: ProfileDescription[]) => { // @ts-ignore if (data) { - data.forEach(p => p.type = ProfileType.PUA); + data.forEach((p) => (p.type = ProfileType.PUA)); this.retrievedProfiles.next(data); } }); @@ -267,7 +260,6 @@ export class ProfileService implements OnDestroy { return this.retrievedProfiles; } - getPuaProfile(id: string, headers?: HttpHeaders): Observable { return this.puaService.getOne(id, headers); } @@ -314,5 +306,4 @@ export class ProfileService implements OnDestroy { downloadProfilePaVitam(id: string) { return this.paService.download(id); } - } diff --git a/ui/ui-frontend/projects/pastis/src/app/core/services/seda.service.ts b/ui/ui-frontend/projects/pastis/src/app/core/services/seda.service.ts index 54833edc661..98661f18108 100644 --- a/ui/ui-frontend/projects/pastis/src/app/core/services/seda.service.ts +++ b/ui/ui-frontend/projects/pastis/src/app/core/services/seda.service.ts @@ -43,17 +43,16 @@ import { CardinalityValues } from '../../models/models'; import { SedaData } from '../../models/seda-data'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class SedaService { - selectedSedaNode = new BehaviorSubject(null); selectedSedaNodeParent = new BehaviorSubject(null); sedaTabNodeRootToSearch = new BehaviorSubject(null); private sedaRulesTemp: any = sedaRulesFile; public sedaRules: SedaData = this.sedaRulesTemp; - constructor() { } + constructor() {} getSedaNode(currentNode: SedaData, nameNode: string): SedaData { if (currentNode && nameNode) { @@ -133,13 +132,14 @@ export class SedaService { // If an element have an 'n' cardinality (e.g. 0-N), the element will // aways be included in the list findSelectableElementList(sedaNode: SedaData, fileNode: FileNode): SedaData[] { - const fileNodesNames = fileNode.children.map(e => e.name); - const allowedSelectableList = sedaNode.Children.filter(x => (!fileNodesNames.includes(x.Name) && - x.Cardinality !== CardinalityConstants.Obligatoire.valueOf()) - || - (fileNodesNames.includes(x.Name) && - (x.Cardinality === CardinalityConstants['Zero or More'].valueOf() || x.Cardinality === CardinalityConstants["One Or More"].valueOf()) - )); + const fileNodesNames = fileNode.children.map((e) => e.name); + const allowedSelectableList = sedaNode.Children.filter( + (x) => + (!fileNodesNames.includes(x.Name) && x.Cardinality !== CardinalityConstants.Obligatoire.valueOf()) || + (fileNodesNames.includes(x.Name) && + (x.Cardinality === CardinalityConstants['Zero or More'].valueOf() || + x.Cardinality === CardinalityConstants['One Or More'].valueOf())), + ); return allowedSelectableList; } @@ -147,7 +147,7 @@ export class SedaService { if (!clickedNode.cardinality) { return '1'; } else { - return cardlinalityValues.find(c => c.value == clickedNode.cardinality).value; + return cardlinalityValues.find((c) => c.value == clickedNode.cardinality).value; } } @@ -157,8 +157,7 @@ export class SedaService { */ getAttributes(sedaNode: SedaData, collection: string): SedaData[] { // if (!sedaNode) return; - return sedaNode.Children.filter(children => children.Element == 'Attribute' - && sedaNode.Collection === collection); + return sedaNode.Children.filter((children) => children.Element == 'Attribute' && sedaNode.Collection === collection); } isSedaNodeObligatory(nodeName: string, sedaParent: SedaData): boolean { @@ -188,9 +187,11 @@ export class SedaService { } checkSedaElementType(nodeName: string, sedaNode: SedaData): string { - if (sedaNode.Name === nodeName) { return sedaNode.Element; } + if (sedaNode.Name === nodeName) { + return sedaNode.Element; + } - const node = sedaNode.Children.find(c => c.Name === nodeName); + const node = sedaNode.Children.find((c) => c.Name === nodeName); if (node) { return node.Element; } @@ -200,7 +201,7 @@ export class SedaService { if (nodeName === sedaNode.Name) { return sedaNode; } - const childFound = sedaNode.Children.find(c => c.Name === nodeName); + const childFound = sedaNode.Children.find((c) => c.Name === nodeName); return childFound ? childFound : null; } @@ -217,9 +218,7 @@ export class SedaService { for (const fileChild of fileNode.children) { for (const sedaChild of sedaNode.Children) { if (fileChild.name === sedaChild.Name) { - fileChild.cardinality ? - cardinalities.push(fileChild.cardinality) : - cardinalities.push(sedaChild.Cardinality); + fileChild.cardinality ? cardinalities.push(fileChild.cardinality) : cardinalities.push(sedaChild.Cardinality); } } } diff --git a/ui/ui-frontend/projects/pastis/src/app/core/services/toggle-sidenav.service.ts b/ui/ui-frontend/projects/pastis/src/app/core/services/toggle-sidenav.service.ts index 704f0563f76..4d8c7991c27 100644 --- a/ui/ui-frontend/projects/pastis/src/app/core/services/toggle-sidenav.service.ts +++ b/ui/ui-frontend/projects/pastis/src/app/core/services/toggle-sidenav.service.ts @@ -39,26 +39,25 @@ import { Injectable } from '@angular/core'; import { BehaviorSubject } from 'rxjs'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class ToggleSidenavService { - - constructor() { } - isOpened = new BehaviorSubject(true); - isPending = new BehaviorSubject(false); - - show() { - this.isOpened.next(true); - } - hide() { - this.isOpened.next(false); - } - - showPending(){ - this.isPending.next(true); - } - - hidePending(){ - this.isPending.next(false); - } + constructor() {} + isOpened = new BehaviorSubject(true); + isPending = new BehaviorSubject(false); + + show() { + this.isOpened.next(true); + } + hide() { + this.isOpened.next(false); + } + + showPending() { + this.isPending.next(true); + } + + hidePending() { + this.isPending.next(false); + } } diff --git a/ui/ui-frontend/projects/pastis/src/app/json-typings.d.ts b/ui/ui-frontend/projects/pastis/src/app/json-typings.d.ts index 09eae417760..bbab69d2fb0 100644 --- a/ui/ui-frontend/projects/pastis/src/app/json-typings.d.ts +++ b/ui/ui-frontend/projects/pastis/src/app/json-typings.d.ts @@ -1,4 +1,4 @@ -declare module "*.json" { - const value: any; - export default value; -} \ No newline at end of file +declare module '*.json' { + const value: any; + export default value; +} diff --git a/ui/ui-frontend/projects/pastis/src/app/main/main.component.html b/ui/ui-frontend/projects/pastis/src/app/main/main.component.html index 049e5153cda..273d2ba35ae 100644 --- a/ui/ui-frontend/projects/pastis/src/app/main/main.component.html +++ b/ui/ui-frontend/projects/pastis/src/app/main/main.component.html @@ -1,5 +1,4 @@ -
      - +
      @@ -9,30 +8,32 @@ - - +
      - +
      -
      -
      diff --git a/ui/ui-frontend/projects/pastis/src/app/main/main.component.scss b/ui/ui-frontend/projects/pastis/src/app/main/main.component.scss index b5499f011f8..84786ecd7c3 100644 --- a/ui/ui-frontend/projects/pastis/src/app/main/main.component.scss +++ b/ui/ui-frontend/projects/pastis/src/app/main/main.component.scss @@ -1,12 +1,13 @@ -@import "../../assets/css/colors"; -@import "../../assets/css/mixins"; -@import "../../assets/css/layout"; +@import '../../assets/css/colors'; +@import '../../assets/css/mixins'; +@import '../../assets/css/layout'; -::ng-deep .vitamui-spinner.mat-progress-spinner circle, .vitamui-spinner .mat-spinner circle{ +::ng-deep .vitamui-spinner.mat-progress-spinner circle, +.vitamui-spinner .mat-spinner circle { stroke: var(--vitamui-primary) !important; } -.steackhouse{ +.steackhouse { display: block; position: absolute; right: 50%; @@ -14,25 +15,24 @@ z-index: 1000; } -.pastis-btn-show-profile{ +.pastis-btn-show-profile { position: absolute; width: 70px; height: 70px; left: -1px; top: 280px; z-index: 10001; - background-color: map-get( $colors , 'primary-500'); + background-color: map-get($colors, 'primary-500'); box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25); transition-property: all; - transition-duration: .5s; - + transition-duration: 0.5s; } -.pastis-icon-show-profile{ +.pastis-icon-show-profile { margin-bottom: 14px; margin-right: 14px; font-size: 40px; - color: #FFFFFF; + color: #ffffff; } .pastis-side-nav { @@ -47,16 +47,15 @@ @extend .pastis-slide-nav-profile; } +.pastis-toaster-font { + .pastis-toaster-font { + font-family: Mulish; + font-style: normal; + font-weight: normal; + font-size: 15px; + line-height: 20px; + /* identical to box height, or 133% */ -.pastis-toaster-font{ - .pastis-toaster-font{ - font-family: Mulish; - font-style: normal; - font-weight: normal; - font-size: 15px; - line-height: 20px; - /* identical to box height, or 133% */ - - color: black; + color: black; } } diff --git a/ui/ui-frontend/projects/pastis/src/app/main/main.component.ts b/ui/ui-frontend/projects/pastis/src/app/main/main.component.ts index f9170ef5bfa..1b3f824389e 100644 --- a/ui/ui-frontend/projects/pastis/src/app/main/main.component.ts +++ b/ui/ui-frontend/projects/pastis/src/app/main/main.component.ts @@ -35,26 +35,24 @@ same conditions as regards security. The fact that you are presently reading this means that you have had knowledge of the CeCILL-C license and that you accept its terms. */ -import {CdkTextareaAutosize} from '@angular/cdk/text-field'; -import {Component, OnDestroy, OnInit, ViewChild} from '@angular/core'; -import {ActivatedRoute, Router} from '@angular/router'; -import {ToastContainerDirective, ToastrService} from 'ngx-toastr'; -import {BehaviorSubject, ReplaySubject, Subscription} from 'rxjs'; +import { CdkTextareaAutosize } from '@angular/cdk/text-field'; +import { Component, OnDestroy, OnInit, ViewChild } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; +import { ToastContainerDirective, ToastrService } from 'ngx-toastr'; +import { BehaviorSubject, ReplaySubject, Subscription } from 'rxjs'; import { FileService } from '../core/services/file.service'; -import {ToggleSidenavService} from '../core/services/toggle-sidenav.service'; -import {FileNode, FileNodeInsertAttributeParams, FileNodeInsertParams} from '../models/file-node'; +import { ToggleSidenavService } from '../core/services/toggle-sidenav.service'; +import { FileNode, FileNodeInsertAttributeParams, FileNodeInsertParams } from '../models/file-node'; import { ProfileDescription } from '../models/profile-description.model'; import { ProfileResponse } from '../models/profile-response'; -import {EditProfileComponent} from '../profile/edit-profile/edit-profile.component'; +import { EditProfileComponent } from '../profile/edit-profile/edit-profile.component'; @Component({ selector: 'app-home', templateUrl: './main.component.html', - styleUrls: ['./main.component.scss'] + styleUrls: ['./main.component.scss'], }) export class MainComponent implements OnInit, OnDestroy { - - @ViewChild('treeSelector', { static: true }) tree: any; @ViewChild('autosize', { static: false }) autosize: CdkTextareaAutosize; @ViewChild(ToastContainerDirective, { static: true }) @@ -73,17 +71,22 @@ export class MainComponent implements OnInit, OnDestroy { private _routeParamsSubscription: Subscription; - constructor(private route: ActivatedRoute, private sideNavService: ToggleSidenavService, private toastrService: ToastrService, - public fileService: FileService, private router: Router) { + constructor( + private route: ActivatedRoute, + private sideNavService: ToggleSidenavService, + private toastrService: ToastrService, + public fileService: FileService, + private router: Router, + ) { this.uploadedProfileResponse = this.router.getCurrentNavigation().extras.state as ProfileResponse; this.uploadedProfileSelected = this.router.getCurrentNavigation().extras.state as ProfileDescription; - this.sideNavService.isOpened.subscribe(status => { + this.sideNavService.isOpened.subscribe((status) => { this.opened = status; - }) - this.pendingSub = this.sideNavService.isPending.subscribe(status=>{ + }); + this.pendingSub = this.sideNavService.isPending.subscribe((status) => { this.pending = status; - }) + }); } ngOnInit() { @@ -91,17 +94,17 @@ export class MainComponent implements OnInit, OnDestroy { this.fileService.currentTree = new ReplaySubject(); this.fileService.allData = new BehaviorSubject([]); this.toastrService.overlayContainer = this.toastContainer; - this._routeParamsSubscription = this.route.params.subscribe(params => { + this._routeParamsSubscription = this.route.params.subscribe((params) => { const profileId = params.id; // If a profileId has been defined, it is retrieved from backend if (profileId !== undefined) { if (this.uploadedProfileSelected === undefined) { - this.router.navigate(['/pastis/tenant/1'], {skipLocationChange: false}); + this.router.navigate(['/pastis/tenant/1'], { skipLocationChange: false }); } else { this.fileService.getProfileAndUpdateTree(this.uploadedProfileSelected); } } else { - // Otherwise we must have an user uploaded profile + // Otherwise we must have an user uploaded profile this.uploadedProfileResponse.id = null; this.uploadedProfileResponse.name = 'Nouveau Profil'; this.fileService.updateTreeWithProfile(this.uploadedProfileResponse); @@ -116,14 +119,13 @@ export class MainComponent implements OnInit, OnDestroy { } insertionItem($event: FileNodeInsertParams) { - const names: string[] = $event.elementsToAdd.map(e => e.Name); + const names: string[] = $event.elementsToAdd.map((e) => e.Name); this.editProfileComponent.fileTreeComponent.insertItem($event.node, names); console.log('Params : ', $event); } addNode($event: FileNode) { this.editProfileComponent.fileTreeComponent.addNewItem($event); - } insertAttribute($event: FileNodeInsertAttributeParams) { @@ -135,17 +137,14 @@ export class MainComponent implements OnInit, OnDestroy { this.editProfileComponent.fileTreeComponent.remove($event); } - duplicateNode($event: FileNode) { this.editProfileComponent.fileTreeComponent.duplicate($event); - } ngOnDestroy(): void { if (this._routeParamsSubscription != null) { this._routeParamsSubscription.unsubscribe(); } - if(this.pendingSub) this.pendingSub.unsubscribe(); + if (this.pendingSub) this.pendingSub.unsubscribe(); } - } diff --git a/ui/ui-frontend/projects/pastis/src/app/material.module.ts b/ui/ui-frontend/projects/pastis/src/app/material.module.ts index f5b77e389c5..6198581af11 100644 --- a/ui/ui-frontend/projects/pastis/src/app/material.module.ts +++ b/ui/ui-frontend/projects/pastis/src/app/material.module.ts @@ -27,7 +27,6 @@ import { MatToolbarModule } from '@angular/material/toolbar'; import { MatTooltipModule } from '@angular/material/tooltip'; import { MatTreeModule } from '@angular/material/tree'; - @NgModule({ imports: [ MatButtonModule, @@ -57,7 +56,7 @@ import { MatTreeModule } from '@angular/material/tree'; MatDialogModule, MatSnackBarModule, MatDividerModule, - MatButtonToggleModule + MatButtonToggleModule, ], exports: [ MatButtonModule, @@ -87,8 +86,7 @@ import { MatTreeModule } from '@angular/material/tree'; MatTooltipModule, MatSnackBarModule, MatDividerModule, - MatButtonToggleModule - ] + MatButtonToggleModule, + ], }) - export class PastisMaterialModule {} diff --git a/ui/ui-frontend/projects/pastis/src/app/models/archival-profile-unit.ts b/ui/ui-frontend/projects/pastis/src/app/models/archival-profile-unit.ts index 742c6e8229e..1f1340c50a8 100644 --- a/ui/ui-frontend/projects/pastis/src/app/models/archival-profile-unit.ts +++ b/ui/ui-frontend/projects/pastis/src/app/models/archival-profile-unit.ts @@ -1,4 +1,4 @@ -import {ProfileCommon} from './profile-common-models'; +import { ProfileCommon } from './profile-common-models'; export interface ArchivalProfileUnit extends ProfileCommon { controlSchema: string; diff --git a/ui/ui-frontend/projects/pastis/src/app/models/breadcrumb.ts b/ui/ui-frontend/projects/pastis/src/app/models/breadcrumb.ts index 4e4475793fc..d5cb55a1f30 100644 --- a/ui/ui-frontend/projects/pastis/src/app/models/breadcrumb.ts +++ b/ui/ui-frontend/projects/pastis/src/app/models/breadcrumb.ts @@ -1,12 +1,12 @@ import { FileNode } from './file-node'; export interface BreadcrumbDataTop { - label: string; - url?: string; - external?: boolean; + label: string; + url?: string; + external?: boolean; } export interface BreadcrumbDataMetadata { - label: string; - node?: FileNode; + label: string; + node?: FileNode; } diff --git a/ui/ui-frontend/projects/pastis/src/app/models/edit-attribute-models.ts b/ui/ui-frontend/projects/pastis/src/app/models/edit-attribute-models.ts index 0f1f244013a..61ea8c6304c 100644 --- a/ui/ui-frontend/projects/pastis/src/app/models/edit-attribute-models.ts +++ b/ui/ui-frontend/projects/pastis/src/app/models/edit-attribute-models.ts @@ -40,13 +40,13 @@ knowledge of the CeCILL-C license and that you accept its terms. * Class that stores all the data needed to display and manage an attribute in the popup */ export interface AttributeData { - nomDuChamp: string; - type: string; - valeurFixe: string; - selectedCardinality: string; // The selected cardinality for this attribute - cardinalities: string[]; // The list of all allowed cardinality for this attribute - commentaire: string; - selected: boolean; // Boolean that is linked to the checkbox, allowing to select this attribute - enumeration: string[]; - id: number; - } + nomDuChamp: string; + type: string; + valeurFixe: string; + selectedCardinality: string; // The selected cardinality for this attribute + cardinalities: string[]; // The list of all allowed cardinality for this attribute + commentaire: string; + selected: boolean; // Boolean that is linked to the checkbox, allowing to select this attribute + enumeration: string[]; + id: number; +} diff --git a/ui/ui-frontend/projects/pastis/src/app/models/file-node.ts b/ui/ui-frontend/projects/pastis/src/app/models/file-node.ts index fbef6282725..4bbcdff843b 100644 --- a/ui/ui-frontend/projects/pastis/src/app/models/file-node.ts +++ b/ui/ui-frontend/projects/pastis/src/app/models/file-node.ts @@ -43,7 +43,7 @@ import { SedaData } from './seda-data'; */ export enum TypeConstants { element = 'element', - attribute = 'attribute' + attribute = 'attribute', } /** @@ -59,7 +59,6 @@ export enum CardinalityConstants { 'Obligatoire' = '1', } - /** * Json node data with nested structure. Each node has a name and a value or a list of children */ @@ -80,7 +79,7 @@ export enum DataTypeConstants { int = 'int', language = 'language', NCName = 'NCName', - undefined = 'undefined' + undefined = 'undefined', } /** @@ -90,13 +89,13 @@ export enum ValueOrDataConstants { value = 'value', data = 'data', nsName = 'nsName', - undefined = 'undefined' + undefined = 'undefined', } export enum DateFormatType { dateType = 'DateType', date = 'date', - dateTime = "dateTime" + dateTime = 'dateTime', } export interface FileNode { @@ -126,11 +125,18 @@ export function nodeToString(node: FileNode): string { if (!node) { return; } - return '{' + - '"name": "' + node.name + '",' - + '"cardinality": "' + node.cardinality + '",' - + '"children": ' + nodesToString(node.children) - + '}'; + return ( + '{' + + '"name": "' + + node.name + + '",' + + '"cardinality": "' + + node.cardinality + + '",' + + '"children": ' + + nodesToString(node.children) + + '}' + ); } // for debug purpose @@ -138,7 +144,7 @@ export function nodesToString(nodes: FileNode[]): string { if (!nodes || nodes.length < 1) { return '[]'; } - return '[' + nodes.map(node => nodeToString(node)).join(',') + ']' + return '[' + nodes.map((node) => nodeToString(node)).join(',') + ']'; } export interface FileNodeInsertParams { @@ -156,5 +162,5 @@ export enum nodeNameToLabel { 'ArchiveTransfer' = 'PROFILE.EDIT_PROFILE.ENTETE', 'ManagementMetadata' = 'PROFILE.EDIT_PROFILE.REGLES', 'DescriptiveMetadata' = 'PROFILE.EDIT_PROFILE.UNITES_ARCHIVES', - 'DataObjectPackage' = 'PROFILE.EDIT_PROFILE.OBJETS' + 'DataObjectPackage' = 'PROFILE.EDIT_PROFILE.OBJETS', } diff --git a/ui/ui-frontend/projects/pastis/src/app/models/metadata-validator.ts b/ui/ui-frontend/projects/pastis/src/app/models/metadata-validator.ts index 8d207fa3578..9e10d9d563c 100644 --- a/ui/ui-frontend/projects/pastis/src/app/models/metadata-validator.ts +++ b/ui/ui-frontend/projects/pastis/src/app/models/metadata-validator.ts @@ -35,18 +35,15 @@ same conditions as regards security. The fact that you are presently reading this means that you have had knowledge of the CeCILL-C license and that you accept its terms. */ -import {Injectable} from '@angular/core'; -import {FormControl} from '@angular/forms'; - +import { Injectable } from '@angular/core'; +import { FormControl } from '@angular/forms'; @Injectable() export class DateValidator { - - constructor() { - } + constructor() {} static date(c: FormControl) { const dateRegEx = new RegExp(/^\d{1,2}\.\d{1,2}\.\d{4}$/); - return dateRegEx.test(c.value) ? null : {date: true}; + return dateRegEx.test(c.value) ? null : { date: true }; } } diff --git a/ui/ui-frontend/projects/pastis/src/app/models/models.ts b/ui/ui-frontend/projects/pastis/src/app/models/models.ts index fd82176fc58..9af341a6258 100644 --- a/ui/ui-frontend/projects/pastis/src/app/models/models.ts +++ b/ui/ui-frontend/projects/pastis/src/app/models/models.ts @@ -36,18 +36,18 @@ The fact that you are presently reading this means that you have had knowledge of the CeCILL-C license and that you accept its terms. */ export interface CardinalityValues { - value: string; - viewValue: string; - } + value: string; + viewValue: string; +} export interface MetadataHeaders { - id: number; - nomDuChamp: string; - nomDuChampFr: string; - nomDuChampEdit: string; - type: string; - valeurFixe: string; - cardinalite: string[]; - commentaire: string; - enumeration: string[]; - } + id: number; + nomDuChamp: string; + nomDuChampFr: string; + nomDuChampEdit: string; + type: string; + valeurFixe: string; + cardinalite: string[]; + commentaire: string; + enumeration: string[]; +} diff --git a/ui/ui-frontend/projects/pastis/src/app/models/profile-common-models.ts b/ui/ui-frontend/projects/pastis/src/app/models/profile-common-models.ts index ac44b99b3a6..6e80b09daa2 100644 --- a/ui/ui-frontend/projects/pastis/src/app/models/profile-common-models.ts +++ b/ui/ui-frontend/projects/pastis/src/app/models/profile-common-models.ts @@ -26,7 +26,7 @@ * */ -import {Id} from 'ui-frontend-common'; +import { Id } from 'ui-frontend-common'; export interface ProfileCommon extends Id { identifier: string; diff --git a/ui/ui-frontend/projects/pastis/src/app/models/profile-description.model.ts b/ui/ui-frontend/projects/pastis/src/app/models/profile-description.model.ts index 7ad6f92b51d..3720fb63a39 100644 --- a/ui/ui-frontend/projects/pastis/src/app/models/profile-description.model.ts +++ b/ui/ui-frontend/projects/pastis/src/app/models/profile-description.model.ts @@ -1,9 +1,9 @@ -import {ArchivalProfileUnit} from './archival-profile-unit'; -import {Profile} from './profile'; +import { ArchivalProfileUnit } from './archival-profile-unit'; +import { Profile } from './profile'; export interface ProfileDescription extends Partial, Partial { type: string; - isEditable?:boolean; + isEditable?: boolean; } export class ProfileDescriptionModel implements ProfileDescription { diff --git a/ui/ui-frontend/projects/pastis/src/app/models/profile-response.ts b/ui/ui-frontend/projects/pastis/src/app/models/profile-response.ts index 0177268a66f..05f4ffc2deb 100644 --- a/ui/ui-frontend/projects/pastis/src/app/models/profile-response.ts +++ b/ui/ui-frontend/projects/pastis/src/app/models/profile-response.ts @@ -2,7 +2,6 @@ import { FileNode } from './file-node'; import { ProfileDescription } from './profile-description.model'; import { ProfileType } from './profile-type.enum'; - export interface ProfileResponse { id: string; name: string; diff --git a/ui/ui-frontend/projects/pastis/src/app/models/profile.ts b/ui/ui-frontend/projects/pastis/src/app/models/profile.ts index e5dea7c513c..758ef661044 100644 --- a/ui/ui-frontend/projects/pastis/src/app/models/profile.ts +++ b/ui/ui-frontend/projects/pastis/src/app/models/profile.ts @@ -1,4 +1,4 @@ -import {ProfileCommon} from './profile-common-models'; +import { ProfileCommon } from './profile-common-models'; export interface Profile extends ProfileCommon { format: string; diff --git a/ui/ui-frontend/projects/pastis/src/app/models/pua-data.ts b/ui/ui-frontend/projects/pastis/src/app/models/pua-data.ts index 760e95db544..7bc90648f4d 100644 --- a/ui/ui-frontend/projects/pastis/src/app/models/pua-data.ts +++ b/ui/ui-frontend/projects/pastis/src/app/models/pua-data.ts @@ -1,4 +1,3 @@ - export interface PuaData { additionalProperties?: boolean; enum?: string[]; diff --git a/ui/ui-frontend/projects/pastis/src/app/models/pua-definitions.model.ts b/ui/ui-frontend/projects/pastis/src/app/models/pua-definitions.model.ts index 9f539a81d22..297a5b4f490 100644 --- a/ui/ui-frontend/projects/pastis/src/app/models/pua-definitions.model.ts +++ b/ui/ui-frontend/projects/pastis/src/app/models/pua-definitions.model.ts @@ -1,55 +1,50 @@ export class PuaDefinitions { - - 'definitions': { - 'one-one': { - 'type': 'string', - 'minItems': 1, - 'maxItems': 1 - }, - 'one-many': { - 'type': 'array', - 'minItems': 1 - }, - 'zero-one': { - 'type': 'string', - 'minItems': 0, - 'maxItems': 1 - }, - 'zero-one2': { - 'type': 'object', - 'minItems': 0, - 'maxItems': 1 - }, - 'zero-many': { - 'type': 'array', - 'minItems': 0 - }, - 'zero-many2': { - 'type': 'object', - 'minItems': 0 - }, - 'non-empty-token': { - 'type': [ - 'array' - ], - 'minLength': 1 - }, - 'non-empty-token-array': { - 'type': [ - 'object' - ], - 'items': { - 'type': 'string', - 'minLength': 1 - } - }, - 'simple-date': { - 'type': 'string', - 'pattern': '[0-9]{4}-[0-9]{2}-[0-9]{2}' - }, - 'date': { - 'type': 'string', - 'pattern': '^([0-8][0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01]))$' - } + 'definitions': { + 'one-one': { + type: 'string'; + minItems: 1; + maxItems: 1; }; + 'one-many': { + type: 'array'; + minItems: 1; + }; + 'zero-one': { + type: 'string'; + minItems: 0; + maxItems: 1; + }; + 'zero-one2': { + type: 'object'; + minItems: 0; + maxItems: 1; + }; + 'zero-many': { + type: 'array'; + minItems: 0; + }; + 'zero-many2': { + type: 'object'; + minItems: 0; + }; + 'non-empty-token': { + type: ['array']; + minLength: 1; + }; + 'non-empty-token-array': { + type: ['object']; + items: { + type: 'string'; + minLength: 1; + }; + }; + 'simple-date': { + type: 'string'; + pattern: '[0-9]{4}-[0-9]{2}-[0-9]{2}'; + }; + date: { + type: 'string'; + pattern: '^([0-8][0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01]))$'; + }; + }; } diff --git a/ui/ui-frontend/projects/pastis/src/app/models/pua.model.ts b/ui/ui-frontend/projects/pastis/src/app/models/pua.model.ts index a4227e9cc13..8ac69db6c60 100644 --- a/ui/ui-frontend/projects/pastis/src/app/models/pua.model.ts +++ b/ui/ui-frontend/projects/pastis/src/app/models/pua.model.ts @@ -1,10 +1,10 @@ -import {PuaDefinitions} from './pua-definitions.model'; +import { PuaDefinitions } from './pua-definitions.model'; import { PuaProperties } from './pua.propreties.model'; export class PUA { - '$schema': string; - 'type': 'object'; - 'additionalProperties': boolean; - 'definitions': PuaDefinitions; - 'properties': PuaProperties; - } + '$schema': string; + 'type': 'object'; + 'additionalProperties': boolean; + 'definitions': PuaDefinitions; + 'properties': PuaProperties; +} diff --git a/ui/ui-frontend/projects/pastis/src/app/models/pua.propreties.model.ts b/ui/ui-frontend/projects/pastis/src/app/models/pua.propreties.model.ts index d3c34df17d6..8ba4b58e08c 100644 --- a/ui/ui-frontend/projects/pastis/src/app/models/pua.propreties.model.ts +++ b/ui/ui-frontend/projects/pastis/src/app/models/pua.propreties.model.ts @@ -1,7 +1,7 @@ export interface PuaProperties { - 'properties': { - [name: string]: { - '$ref': '#/definitions/one-one' - } + properties: { + [name: string]: { + $ref: '#/definitions/one-one'; }; + }; } diff --git a/ui/ui-frontend/projects/pastis/src/app/models/seda-data.ts b/ui/ui-frontend/projects/pastis/src/app/models/seda-data.ts index 2b33494f01b..64aaa1d8a7d 100644 --- a/ui/ui-frontend/projects/pastis/src/app/models/seda-data.ts +++ b/ui/ui-frontend/projects/pastis/src/app/models/seda-data.ts @@ -39,50 +39,48 @@ knowledge of the CeCILL-C license and that you accept its terms. // Seda elelemtns can be attributes, simple or complex elements export enum SedaElementConstants { - attribute = 'Attribute', - simple = 'Simple', - complex = 'Complex' + attribute = 'Attribute', + simple = 'Simple', + complex = 'Complex', } // Seda choice constants : can be yes or no export enum SedaChoiceConstants { - yes = 'yes', - no = 'no', + yes = 'yes', + no = 'no', } // Seda Extensible constants : can be yes or no export enum SedaExtensibleConstants { - yes = 'yes', - no = 'no', + yes = 'yes', + no = 'no', } - export enum SedaCardinalityConstants { - 'zeroOrOne' = '0-1', - 'one' = '1', - 'oreOrMore' = '1-N', - 'zeroOrMore' = '0-N' + 'zeroOrOne' = '0-1', + 'one' = '1', + 'oreOrMore' = '1-N', + 'zeroOrMore' = '0-N', } - export enum SedaCollections { - 'object' = 'Objets', - 'header' = 'Entete', - 'rules' = 'Regles', - 'arborescent' = 'Aborescence' + 'object' = 'Objets', + 'header' = 'Entete', + 'rules' = 'Regles', + 'arborescent' = 'Aborescence', } export interface SedaData { - [key: string]: any; - Name: string; - NameFr: string; - Type: string; - Element: string; - Cardinality: string; - Definition: string; - Extensible: boolean; - Choice: boolean; - Children: SedaData[]; - Enumeration: string[]; - Collection: SedaCollections; + [key: string]: any; + Name: string; + NameFr: string; + Type: string; + Element: string; + Cardinality: string; + Definition: string; + Extensible: boolean; + Choice: boolean; + Children: SedaData[]; + Enumeration: string[]; + Collection: SedaCollections; } diff --git a/ui/ui-frontend/projects/pastis/src/app/models/vitam-ui-exception-response.model.ts b/ui/ui-frontend/projects/pastis/src/app/models/vitam-ui-exception-response.model.ts index 1255bfda463..801ee74dec9 100644 --- a/ui/ui-frontend/projects/pastis/src/app/models/vitam-ui-exception-response.model.ts +++ b/ui/ui-frontend/projects/pastis/src/app/models/vitam-ui-exception-response.model.ts @@ -26,10 +26,10 @@ */ export interface VitamUIExceptionResponse { - timestamp: string, - status: number, - error: string, - exception: string, - message: string, - args: Array + timestamp: string; + status: number; + error: string; + exception: string; + message: string; + args: Array; } diff --git a/ui/ui-frontend/projects/pastis/src/app/pastis/pastis-routing.module.ts b/ui/ui-frontend/projects/pastis/src/app/pastis/pastis-routing.module.ts index 98255b9e4c0..991fb4eb9dd 100644 --- a/ui/ui-frontend/projects/pastis/src/app/pastis/pastis-routing.module.ts +++ b/ui/ui-frontend/projects/pastis/src/app/pastis/pastis-routing.module.ts @@ -34,64 +34,63 @@ * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ -import {CommonModule} from '@angular/common'; -import {NgModule} from '@angular/core'; -import {Route, RouterModule} from '@angular/router'; -import {ActiveTenantGuard, TenantSelectionGuard, VitamUITenantSelectComponent} from 'ui-frontend-common'; -import {environment} from '../../environments/environment'; -import {MainComponent} from '../main/main.component'; -import {CreateProfileComponent} from '../profile/create-profile/create-profile.component'; -import {ListProfileComponent} from '../profile/list-profile/list-profile.component'; -import {SedaVisualizerComponent} from '../seda-visualizer/seda-visualizer.component'; -import {PastisUnderConstructionComponent} from '../shared/pastis-under-construction/pastis-under-construction.component'; +import { CommonModule } from '@angular/common'; +import { NgModule } from '@angular/core'; +import { Route, RouterModule } from '@angular/router'; +import { ActiveTenantGuard, TenantSelectionGuard, VitamUITenantSelectComponent } from 'ui-frontend-common'; +import { environment } from '../../environments/environment'; +import { MainComponent } from '../main/main.component'; +import { CreateProfileComponent } from '../profile/create-profile/create-profile.component'; +import { ListProfileComponent } from '../profile/list-profile/list-profile.component'; +import { SedaVisualizerComponent } from '../seda-visualizer/seda-visualizer.component'; +import { PastisUnderConstructionComponent } from '../shared/pastis-under-construction/pastis-under-construction.component'; const standalone: boolean = environment.standalone; -const routes: Route[] = standalone ? -[ - { - path: '', - component: ListProfileComponent, - }, - {path: 'sedaview', component: SedaVisualizerComponent}, - {path: '', component: ListProfileComponent, data: {appId: 'PASTIS_APP'}}, - {path: 'edit/:id', component: MainComponent, data: {appId: 'PASTIS_APP'}}, - {path: 'new', component: MainComponent, data: {appId: 'PASTIS_APP'}}, - {path: '**', component: PastisUnderConstructionComponent, data: {appId: 'PASTIS_APP'}} -] : -[ - { - path: '', - redirectTo: 'tenant', - pathMatch: 'full', - }, - { - path: 'tenant', - component: VitamUITenantSelectComponent, - canActivate: [TenantSelectionGuard] - }, - { - path: 'tenant/:tenantIdentifier', - component: ListProfileComponent, - canActivate: [ActiveTenantGuard] - }, - { - path: 'tenant/:tenantIdentifier/sedaview', - component: SedaVisualizerComponent, - canActivate: [ActiveTenantGuard] - }, - { - path: 'tenant/:tenantIdentifier/createTest', - component: CreateProfileComponent, - canActivate: [ActiveTenantGuard] - }, - { - path: 'tenant/:tenantIdentifier/edit/:id', - component: MainComponent, - canActivate: [ActiveTenantGuard], - }, - {path: 'tenant/:tenantIdentifier/new', component: MainComponent, canActivate: [ActiveTenantGuard]}, -]; - +const routes: Route[] = standalone + ? [ + { + path: '', + component: ListProfileComponent, + }, + { path: 'sedaview', component: SedaVisualizerComponent }, + { path: '', component: ListProfileComponent, data: { appId: 'PASTIS_APP' } }, + { path: 'edit/:id', component: MainComponent, data: { appId: 'PASTIS_APP' } }, + { path: 'new', component: MainComponent, data: { appId: 'PASTIS_APP' } }, + { path: '**', component: PastisUnderConstructionComponent, data: { appId: 'PASTIS_APP' } }, + ] + : [ + { + path: '', + redirectTo: 'tenant', + pathMatch: 'full', + }, + { + path: 'tenant', + component: VitamUITenantSelectComponent, + canActivate: [TenantSelectionGuard], + }, + { + path: 'tenant/:tenantIdentifier', + component: ListProfileComponent, + canActivate: [ActiveTenantGuard], + }, + { + path: 'tenant/:tenantIdentifier/sedaview', + component: SedaVisualizerComponent, + canActivate: [ActiveTenantGuard], + }, + { + path: 'tenant/:tenantIdentifier/createTest', + component: CreateProfileComponent, + canActivate: [ActiveTenantGuard], + }, + { + path: 'tenant/:tenantIdentifier/edit/:id', + component: MainComponent, + canActivate: [ActiveTenantGuard], + }, + { path: 'tenant/:tenantIdentifier/new', component: MainComponent, canActivate: [ActiveTenantGuard] }, + ]; @NgModule({ declarations: [], diff --git a/ui/ui-frontend/projects/pastis/src/app/pastis/pastis.module.ts b/ui/ui-frontend/projects/pastis/src/app/pastis/pastis.module.ts index 0ed8517a0ea..6c51f34f13a 100644 --- a/ui/ui-frontend/projects/pastis/src/app/pastis/pastis.module.ts +++ b/ui/ui-frontend/projects/pastis/src/app/pastis/pastis.module.ts @@ -99,19 +99,9 @@ import { PastisRoutingModule } from './pastis-routing.module'; MatIconModule, MatTabsModule, ], - providers: [ - DatePipe, - TranslateService - ], - declarations: [ - MainComponent, - UserActionRemoveMetadataComponent, - UserActionAddMetadataComponent, - SedaVisualizerComponent - - ], - exports: [ - ], - schemas: [CUSTOM_ELEMENTS_SCHEMA] + providers: [DatePipe, TranslateService], + declarations: [MainComponent, UserActionRemoveMetadataComponent, UserActionAddMetadataComponent, SedaVisualizerComponent], + exports: [], + schemas: [CUSTOM_ELEMENTS_SCHEMA], }) export class PastisModule {} diff --git a/ui/ui-frontend/projects/pastis/src/app/profile/create-notice-choice/create-notice-choice.component.html b/ui/ui-frontend/projects/pastis/src/app/profile/create-notice-choice/create-notice-choice.component.html index 67341f98f7a..9292d05cf4b 100644 --- a/ui/ui-frontend/projects/pastis/src/app/profile/create-notice-choice/create-notice-choice.component.html +++ b/ui/ui-frontend/projects/pastis/src/app/profile/create-notice-choice/create-notice-choice.component.html @@ -1,21 +1,24 @@

      - {{data.subTitleDialog}} - {{data.titleDialog}} + {{ data.subTitleDialog }} + {{ data.titleDialog }}

      - - - + +
      - - + +
      - - - diff --git a/ui/ui-frontend/projects/pastis/src/app/profile/create-notice-choice/create-notice-choice.component.scss b/ui/ui-frontend/projects/pastis/src/app/profile/create-notice-choice/create-notice-choice.component.scss index b5efb57d93f..cdadc484740 100644 --- a/ui/ui-frontend/projects/pastis/src/app/profile/create-notice-choice/create-notice-choice.component.scss +++ b/ui/ui-frontend/projects/pastis/src/app/profile/create-notice-choice/create-notice-choice.component.scss @@ -40,24 +40,24 @@ color: var(--vitamui-grey-900); } -.conteneur{ +.conteneur { display: block; margin: 35px 23px; } -.gauche{ +.gauche { margin: 10px 0px -20px 30px; float: left; - width:34% + width: 34%; } -.flex{ +.flex { flex-grow: 1; } .pastis-dialog-confirm-buttons { position: relative; - margin : 0 0 10px 5%; + margin: 0 0 10px 5%; } .pastis-btn-oui-dialog-confirm { @@ -65,7 +65,7 @@ font-size: 0.9em; font-family: Mulish, sans-serif !important; border-radius: 100px; - padding:0 30px; + padding: 0 30px; min-width: 92px; height: 50px; letter-spacing: 0.5px; @@ -74,7 +74,7 @@ } .pastis-btn-non-dialog-confirm { - padding: 0 30px; + padding: 0 30px; border: none; min-width: 92px; height: 50px; @@ -87,7 +87,4 @@ font-size: 0.9em; letter-spacing: 0.5px; text-transform: uppercase; - } - - diff --git a/ui/ui-frontend/projects/pastis/src/app/profile/create-notice-choice/create-notice-choice.component.ts b/ui/ui-frontend/projects/pastis/src/app/profile/create-notice-choice/create-notice-choice.component.ts index 4c9473ff321..cb0d34b5a6d 100644 --- a/ui/ui-frontend/projects/pastis/src/app/profile/create-notice-choice/create-notice-choice.component.ts +++ b/ui/ui-frontend/projects/pastis/src/app/profile/create-notice-choice/create-notice-choice.component.ts @@ -5,7 +5,6 @@ import { environment } from '../../../environments/environment'; import { ProfileType } from '../../models/profile-type.enum'; import { PastisDialogData } from '../../shared/pastis-dialog/classes/pastis-dialog-data'; - const POPUP_CREATION_CHOICE_PATH = 'PROFILE.POP_UP_CREATION.NOTICE_CHOICE'; function constantToTranslate() { @@ -17,38 +16,37 @@ function constantToTranslate() { @Component({ selector: 'create-notice-choice', templateUrl: './create-notice-choice.component.html', - styleUrls: ['./create-notice-choice.component.scss'] + styleUrls: ['./create-notice-choice.component.scss'], }) - export class CreateNoticeChoiceComponent implements OnInit { - firstChoice: string; secondChoice: string; title: string; noticePaChoice = true; isStandalone: boolean = environment.standalone; - constructor(private dialogRef: MatDialogRef, private translateService: TranslateService, - @Inject(MAT_DIALOG_DATA) public data: PastisDialogData) { - } + constructor( + private dialogRef: MatDialogRef, + private translateService: TranslateService, + @Inject(MAT_DIALOG_DATA) public data: PastisDialogData, + ) {} ngOnInit() { if (!this.isStandalone) { constantToTranslate.call(this); this.translatedOnChange(); } else if (this.isStandalone) { - this.firstChoice = ProfileType.PA - this.secondChoice = ProfileType.PUA - this.title = 'Choisir le type de notice à créer :' + this.firstChoice = ProfileType.PA; + this.secondChoice = ProfileType.PUA; + this.title = 'Choisir le type de notice à créer :'; } } translatedOnChange(): void { - this.translateService.onLangChange - .subscribe((event: LangChangeEvent) => { - constantToTranslate.call(this); - console.log(event.lang); - }); + this.translateService.onLangChange.subscribe((event: LangChangeEvent) => { + constantToTranslate.call(this); + console.log(event.lang); + }); } translated(nameOfFieldToTranslate: string): string { @@ -64,7 +62,7 @@ export class CreateNoticeChoiceComponent implements OnInit { } changeChoiceCreateProfile($event: string) { - console.log($event) + console.log($event); this.noticePaChoice = $event === this.firstChoice; } @@ -75,5 +73,4 @@ export class CreateNoticeChoiceComponent implements OnInit { this.dialogRef.close({ success: true, action: ProfileType.PUA }); } } - } diff --git a/ui/ui-frontend/projects/pastis/src/app/profile/create-profile/create-profile.component.html b/ui/ui-frontend/projects/pastis/src/app/profile/create-profile/create-profile.component.html index 54231740a29..db9057da49a 100644 --- a/ui/ui-frontend/projects/pastis/src/app/profile/create-profile/create-profile.component.html +++ b/ui/ui-frontend/projects/pastis/src/app/profile/create-profile/create-profile.component.html @@ -1,34 +1,42 @@

      -

      {{data.subTitleDialog}}

      -

      {{data.titleDialog}}

      +

      + {{ data.subTitleDialog }} +

      +

      {{ data.titleDialog }}

      -
      - -
      +
      +
      - +
      -
      - - + +
      - - - diff --git a/ui/ui-frontend/projects/pastis/src/app/profile/create-profile/create-profile.component.scss b/ui/ui-frontend/projects/pastis/src/app/profile/create-profile/create-profile.component.scss index 33ede172059..ad81d3f274b 100644 --- a/ui/ui-frontend/projects/pastis/src/app/profile/create-profile/create-profile.component.scss +++ b/ui/ui-frontend/projects/pastis/src/app/profile/create-profile/create-profile.component.scss @@ -46,25 +46,25 @@ color: var(--vitamui-grey-900); } -.conteneur{ +.conteneur { display: flex; padding: 0px 0px 40px 0px; margin: -15px 15px 20px -15px; } -.gauche{ +.gauche { margin: 10px 0px -20px 30px; float: left; - width:34% + width: 34%; } -.droite{ +.droite { float: right; - width:15%; + width: 15%; margin-top: 4%; } -.flex{ +.flex { flex-grow: 1; } @@ -80,7 +80,7 @@ font-weight: normal; font-size: 12px; /* Secondary/Secondary-900 */ - color: #050C15; + color: #050c15; } .pastis-dialog-confirm-buttons { @@ -121,7 +121,4 @@ align-items: center; letter-spacing: 0.5px; text-transform: uppercase; - } - - diff --git a/ui/ui-frontend/projects/pastis/src/app/profile/create-profile/create-profile.component.ts b/ui/ui-frontend/projects/pastis/src/app/profile/create-profile/create-profile.component.ts index ab8d20d2d7e..bc63f7f5b1e 100644 --- a/ui/ui-frontend/projects/pastis/src/app/profile/create-profile/create-profile.component.ts +++ b/ui/ui-frontend/projects/pastis/src/app/profile/create-profile/create-profile.component.ts @@ -53,7 +53,7 @@ function constantToTranslate() { @Component({ selector: 'pastis-create-profile', templateUrl: './create-profile.component.html', - styleUrls: ['./create-profile.component.scss'] + styleUrls: ['./create-profile.component.scss'], }) export class CreateProfileComponent implements OnInit { firstChoice: string; @@ -62,9 +62,11 @@ export class CreateProfileComponent implements OnInit { profilPaChoice = true; isStandalone: boolean = environment.standalone; - constructor(private dialogRef: MatDialogRef, private translateService: TranslateService, - @Inject(MAT_DIALOG_DATA) public data: PastisDialogData) { - } + constructor( + private dialogRef: MatDialogRef, + private translateService: TranslateService, + @Inject(MAT_DIALOG_DATA) public data: PastisDialogData, + ) {} ngOnInit() { if (!this.isStandalone) { @@ -73,16 +75,15 @@ export class CreateProfileComponent implements OnInit { } else if (this.isStandalone) { this.firstChoice = ProfileType.PA; this.secondChoice = ProfileType.PUA; - this.title = 'Sélectionner un profil d\'archivage :'; + this.title = "Sélectionner un profil d'archivage :"; } } translatedOnChange(): void { - this.translateService.onLangChange - .subscribe((event: LangChangeEvent) => { - constantToTranslate.call(this); - console.log(event.lang); - }); + this.translateService.onLangChange.subscribe((event: LangChangeEvent) => { + constantToTranslate.call(this); + console.log(event.lang); + }); } translated(nameOfFieldToTranslate: string): string { @@ -113,5 +114,4 @@ export class CreateProfileComponent implements OnInit { this.dialogRef.close({ success: true, action: ProfileType.PUA }); } } - } diff --git a/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/edit-profile.component.html b/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/edit-profile.component.html index f51ea2ea63c..99847c8fba1 100644 --- a/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/edit-profile.component.html +++ b/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/edit-profile.component.html @@ -5,80 +5,82 @@

      - {{this.profileService.profileName}} + {{ this.profileService.profileName }}

      -
      -

      {{'PROFILE.EDIT_PROFILE.PROFILE_ID' | translate}} : - {{this.profileService.profileId}}

      +
      +

      {{ 'PROFILE.EDIT_PROFILE.PROFILE_ID' | translate }} : {{ this.profileService.profileId }}

      - - + +
      - +
      - +
      - +
      - +
      - +
      - +
      - +
      -
      diff --git a/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/edit-profile.component.scss b/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/edit-profile.component.scss index 12c97992155..e0393ca682e 100644 --- a/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/edit-profile.component.scss +++ b/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/edit-profile.component.scss @@ -1,22 +1,22 @@ -@import "../../../assets/css/colors"; +@import '../../../assets/css/colors'; -.pastis-edit-profile-header{ +.pastis-edit-profile-header { position: fixed; width: 480px; top: 70px; height: 180px; display: block; - background-color: #FFFFFF; + background-color: #ffffff; border-bottom: solid var(--vitamui-grey-200); } -.mat-table{ - background-color: map-get($colors , 'ligthly-purple'); +.mat-table { + background-color: map-get($colors, 'ligthly-purple'); position: fixed; top: 220px; height: 100%; width: 480px; } -.pastis-edit-profile-header-name{ +.pastis-edit-profile-header-name { position: relative; left: 40px; top: 43px; @@ -26,120 +26,117 @@ font-size: 24px; line-height: 24px; right: 186px; - color: #FFFFFF; + color: #ffffff; } -.pastis-edit-profile-header-id{ - position: relative; - left: 40px; - top: 25px; - font-family: Mulish; - font-style: normal; - font-weight: normal; - font-size: 13px; - line-height: 20px; - color: #FFFFFF; +.pastis-edit-profile-header-id { + position: relative; + left: 40px; + top: 25px; + font-family: Mulish; + font-style: normal; + font-weight: normal; + font-size: 13px; + line-height: 20px; + color: #ffffff; } // The tabs containers -::ng-deep .mat-tab-header{ - left: 40px ; - right: 40px; - bottom: 37px ; - height: 37px; - max-width: fit-content; - border:none; +::ng-deep .mat-tab-header { + left: 40px; + right: 40px; + bottom: 37px; + height: 37px; + max-width: fit-content; + border: none; } // The tab -::ng-deep.mat-tab-label{ - @extend .pastis-font-label-historique !optional; - margin-right: 3px !important; - background: rgba(255, 255, 255, 0.3); - height: 37px !important; - padding: 0 !important; - min-width: fit-content !important; - opacity: unset !important; +::ng-deep.mat-tab-label { + @extend .pastis-font-label-historique !optional; + margin-right: 3px !important; + background: rgba(255, 255, 255, 0.3); + height: 37px !important; + padding: 0 !important; + min-width: fit-content !important; + opacity: unset !important; } //The tab hover ::ng-deep.mat-tab-label:hover { - background: #FFFFFF!important; + background: #ffffff !important; } // Tab hover and tab text hover -::ng-deep.mat-tab-label:hover .mat-tab-label-content{ - text-shadow: 0.5px 0 #5E5D5D; - background: rgba(255, 255, 255, 0.3) !important; - color: #5E5D5D !important; +::ng-deep.mat-tab-label:hover .mat-tab-label-content { + text-shadow: 0.5px 0 #5e5d5d; + background: rgba(255, 255, 255, 0.3) !important; + color: #5e5d5d !important; } - // The active tab (Black and bold) -::ng-deep .mat-tab-label-active{ - text-shadow: 0.5px 0 #5E5D5D; - background: #FFFFFF !important; - border-bottom: solid var(--vitamui-primary) 3px; +::ng-deep .mat-tab-label-active { + text-shadow: 0.5px 0 #5e5d5d; + background: #ffffff !important; + border-bottom: solid var(--vitamui-primary) 3px; } // The tab content -::ng-deep .mat-tab-label-content{ - margin: 8px; - display: flex; - align-items: center; - color: var(--vitamui-grey-400); +::ng-deep .mat-tab-label-content { + margin: 8px; + display: flex; + align-items: center; + color: var(--vitamui-grey-400); } - // The content of the active tab -::ng-deep .mat-tab-label-active .mat-tab-label-content{ - color: var(--vitamui-primary) !important; - padding-top: 3px !important; +::ng-deep .mat-tab-label-active .mat-tab-label-content { + color: var(--vitamui-primary) !important; + padding-top: 3px !important; } - // The automatic tab pagination chevron ::ng-deep .mat-tab-header-pagination-controls-enabled .mat-tab-header-pagination { - display: none !important; + display: none !important; } -::ng-deep .mat-tab-group.mat-primary .mat-ink-bar, .mat-tab-nav-bar.mat-primary .mat-ink-bar .pastis-ink-bar{ - height: 0; - - } +::ng-deep .mat-tab-group.mat-primary .mat-ink-bar, +.mat-tab-nav-bar.mat-primary .mat-ink-bar .pastis-ink-bar { + height: 0; +} .mat-tab-group { - @media screen and (min-height: 950px){ + @media screen and (min-height: 950px) { max-height: 850px; } - @media screen and (min-height: 700px) and (max-height: 950px){ + @media screen and (min-height: 700px) and (max-height: 950px) { max-height: 500px !important; } - @media screen and (min-height: 550px) and (max-height: 700px){ + @media screen and (min-height: 550px) and (max-height: 700px) { max-height: 450px; } - @media screen and (max-height: 550px){ + @media screen and (max-height: 550px) { max-height: 350px; } } .mat-tab-body .mat-tab-body-active { - overflow-x: auto !important; - overflow-y: auto !important; + overflow-x: auto !important; + overflow-y: auto !important; } .mat-tab-body-content { - overflow-x: auto !important; - overflow-y: auto !important; + overflow-x: auto !important; + overflow-y: auto !important; } -.pastis-ico-close-sidenav{ - position: absolute; - left: 90%; - top: 31px; - color: #757575; - cursor: pointer; - font-size: 24px; +.pastis-ico-close-sidenav { + position: absolute; + left: 90%; + top: 31px; + color: #757575; + cursor: pointer; + font-size: 24px; } .vitamui-icon-close { @@ -149,4 +146,3 @@ color: var(--vitamui-grey-900); font-size: 20px; } - diff --git a/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/edit-profile.component.ts b/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/edit-profile.component.ts index 5eb4b3d6bc4..e61d2a21bcc 100644 --- a/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/edit-profile.component.ts +++ b/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/edit-profile.component.ts @@ -66,9 +66,7 @@ export interface UploadedProfileResponse { templateUrl: './edit-profile.component.html', styleUrls: ['./edit-profile.component.scss'], }) - export class EditProfileComponent implements OnDestroy { - nodeToSend: FileNode; sedaParentNode: SedaData; selectedIndex: number; @@ -79,10 +77,9 @@ export class EditProfileComponent implements OnDestroy { entete = 'Entête'; regles = 'Règles'; - unitesArchives = 'Unités d\'archives'; + unitesArchives = "Unités d'archives"; objets = 'Objets'; - unitesArchivesPuaMode = 'Unité d\'archive'; - + unitesArchivesPuaMode = "Unité d'archive"; profileTabChildrenToInclude: string[] = []; profileTabChildrenToExclude: string[] = []; @@ -110,10 +107,15 @@ export class EditProfileComponent implements OnDestroy { private _fileServiceCurrentTreeSubscription: Subscription; - constructor(private sedaService: SedaService, private fileService: FileService, - private sideNavService: ToggleSidenavService, public profileService: ProfileService, - private loaderService: NgxUiLoaderService, private fileTreeService: FileTreeService, - private translateService: TranslateService) { + constructor( + private sedaService: SedaService, + private fileService: FileService, + private sideNavService: ToggleSidenavService, + public profileService: ProfileService, + private loaderService: NgxUiLoaderService, + private fileTreeService: FileTreeService, + private translateService: TranslateService, + ) { this.selectedIndex = 0; } @@ -129,9 +131,9 @@ export class EditProfileComponent implements OnDestroy { this.tabLabels.push(this.entete, this.regles, this.unitesArchives, this.objets, this.unitesArchivesPuaMode); const collectionSeda: string[] = []; - collectionSeda.push('Entête', 'Règles', 'Unités d\'archives', 'Objets'); + collectionSeda.push('Entête', 'Règles', "Unités d'archives", 'Objets'); this.fileTreeService.nestedTreeControl = new NestedTreeControl(this.getChildren); - this.collectionNames = collectionSeda.map(name => name.charAt(0).toUpperCase() + name.slice(1).toLowerCase()); + this.collectionNames = collectionSeda.map((name) => name.charAt(0).toUpperCase() + name.slice(1).toLowerCase()); this.rootNames.push('ArchiveTransfer', 'ManagementMetadata', 'DescriptiveMetadata', 'DataObjectPackage'); @@ -139,7 +141,14 @@ export class EditProfileComponent implements OnDestroy { this.profileTabChildrenToInclude.push(); this.profileTabChildrenToExclude.push(); this.headerTabChildrenToInclude.push(); - this.headerTabChildrenToExclude.push('DataObjectPackage', 'DataObjectGroup', 'DescriptiveMetadata', 'ManagementMetadata', 'id', 'BinaryDataObject'); + this.headerTabChildrenToExclude.push( + 'DataObjectPackage', + 'DataObjectGroup', + 'DescriptiveMetadata', + 'ManagementMetadata', + 'id', + 'BinaryDataObject', + ); this.rulesTabChildrenToInclude.push(); this.rulesTabChildrenToExclude.push(); this.treeTabChildrenToInclude.push(); @@ -151,7 +160,8 @@ export class EditProfileComponent implements OnDestroy { [this.profileTabChildrenToInclude, this.profileTabChildrenToExclude], [this.rulesTabChildrenToInclude, this.rulesTabChildrenToExclude], [this.treeTabChildrenToInclude, this.treeTabChildrenToExclude], - [this.objectTabChildrenToInclude, this.objectTabChildrenToExclude]); + [this.objectTabChildrenToInclude, this.objectTabChildrenToExclude], + ); this.initActiveTabAndProfileMode(); this.setTabsAndMetadataRules(this.activeTabIndex); @@ -162,7 +172,7 @@ export class EditProfileComponent implements OnDestroy { } ngAfterViewInit() { - this._fileServiceCurrentTreeSubscription = this.fileService.currentTree.subscribe(response => { + this._fileServiceCurrentTreeSubscription = this.fileService.currentTree.subscribe((response) => { this.initAll(); if (response) { this.nodeToSend = response[0]; @@ -189,9 +199,8 @@ export class EditProfileComponent implements OnDestroy { return this.translateService.instant(EDIT_PROFILE_TRANSLATE_PATH + nameOfFieldToTranslate); } - initActiveTabAndProfileMode() { - this.profileService.profileMode === ProfileType.PA ? this.activeTabIndex = 0 : this.activeTabIndex = 2; + this.profileService.profileMode === ProfileType.PA ? (this.activeTabIndex = 0) : (this.activeTabIndex = 2); } loadProfile(event: MatTabChangeEvent) { @@ -202,7 +211,8 @@ export class EditProfileComponent implements OnDestroy { setTabsAndMetadataRules(tabIndex: number) { this.collectionName = this.profileService.profileMode === ProfileType.PA ? this.collectionNames[tabIndex] : this.collectionNames[2]; this.rootTabMetadataName = this.profileService.profileMode === ProfileType.PA ? this.rootNames[tabIndex] : this.rootNames[2]; - this.elementRules = this.profileService.profileMode === ProfileType.PA ? this.tabShowElementRules[tabIndex] : this.tabShowElementRules[2]; + this.elementRules = + this.profileService.profileMode === ProfileType.PA ? this.tabShowElementRules[tabIndex] : this.tabShowElementRules[2]; } loadProfileData(tabindex: number) { @@ -242,7 +252,7 @@ export class EditProfileComponent implements OnDestroy { } canShowOnPuaMode(tabIndex: number) { - return this.profileService.profileMode === ProfileType.PUA ? (tabIndex === 3) : true; + return this.profileService.profileMode === ProfileType.PUA ? tabIndex === 3 : true; } ngOnDestroy() { @@ -250,5 +260,4 @@ export class EditProfileComponent implements OnDestroy { this._fileServiceCurrentTreeSubscription.unsubscribe(); } } - } diff --git a/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/file-tree-metadata/attributes/attributes.component.html b/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/file-tree-metadata/attributes/attributes.component.html index fc958b867a7..ade36bea243 100644 --- a/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/file-tree-metadata/attributes/attributes.component.html +++ b/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/file-tree-metadata/attributes/attributes.component.html @@ -1,37 +1,28 @@
      - - - - @@ -39,24 +30,22 @@ - - - - - + +
      - - +   - - {{'PROFILE.EDIT_PROFILE.FILE_TREE_METADATA.ATTRIBUTS.NOM_ATTRIBUT' | translate}} + {{ 'PROFILE.EDIT_PROFILE.FILE_TREE_METADATA.ATTRIBUTS.NOM_ATTRIBUT' | translate }} - {{'PROFILE.EDIT_PROFILE.FILE_TREE_METADATA.ATTRIBUTS.VALEUR_FIXE' | translate}} + {{ 'PROFILE.EDIT_PROFILE.FILE_TREE_METADATA.ATTRIBUTS.VALEUR_FIXE' | translate }} - {{'PROFILE.EDIT_PROFILE.FILE_TREE_METADATA.ATTRIBUTS.COMMENTAIRE' | translate}} + {{ 'PROFILE.EDIT_PROFILE.FILE_TREE_METADATA.ATTRIBUTS.COMMENTAIRE' | translate }}
      diff --git a/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/file-tree-metadata/attributes/attributes.component.scss b/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/file-tree-metadata/attributes/attributes.component.scss index e94170c6e04..8ccfdf7b610 100644 --- a/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/file-tree-metadata/attributes/attributes.component.scss +++ b/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/file-tree-metadata/attributes/attributes.component.scss @@ -46,20 +46,18 @@ td { } ::ng-deep .mat-checkbox { - .mat-checkbox-frame { border-radius: 3px; border: 1px solid var(--vitamui-grey-400); background: white; } - &.mat-checkbox-checked .mat-checkbox-frame { + &.mat-checkbox-checked .mat-checkbox-frame { border-radius: 3px; border: 1px solid var(--vitamui-primary); background: var(--vitamui-primary); } - &.mat-checkbox-checked .mat-checkbox-background, .mat-checkbox-background { background: transparent; @@ -71,11 +69,9 @@ td { stroke-width: 5px; } - - - span{ - font-size:14px; - color:var(--vitamui-grey-900); + span { + font-size: 14px; + color: var(--vitamui-grey-900); } .mat-checkbox:checked { @@ -92,12 +88,11 @@ td { position: absolute; } } - } ::ng-deep .mat-checkbox-checked.mat-accent.mat-checkbox-disabled .mat-checkbox-background, .mat-checkbox-indeterminate.mat-accent .mat-checkbox-background { - border: none! important; + border: none !important; border-color: var(--vitamui-grey-700); background-color: var(--vitamui-grey-300); @@ -105,14 +100,14 @@ td { stroke: var(--vitamui-grey-700) !important; } - &.mat-checkbox-checked .mat-checkbox-frame { + &.mat-checkbox-checked .mat-checkbox-frame { border-radius: 3px; border: 1px solid var(--vitamui-grey-700) !important; background: var(--vitamui-grey-700); } } -::ng-deep .mat-checkbox.mat-checkbox-disabled .mat-checkbox-frame{ +::ng-deep .mat-checkbox.mat-checkbox-disabled .mat-checkbox-frame { border: 1px solid var(--vitamui-primary); border-color: var(--vitamui-grey-700); background-color: var(--vitamui-grey-300); diff --git a/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/file-tree-metadata/attributes/attributes.component.ts b/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/file-tree-metadata/attributes/attributes.component.ts index 1a580be9505..d8f4dd55519 100644 --- a/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/file-tree-metadata/attributes/attributes.component.ts +++ b/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/file-tree-metadata/attributes/attributes.component.ts @@ -35,34 +35,27 @@ same conditions as regards security. The fact that you are presently reading this means that you have had knowledge of the CeCILL-C license and that you accept its terms. */ -import {Component, Inject, OnInit } from '@angular/core'; -import {MatCheckboxChange} from '@angular/material/checkbox'; -import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog'; -import {MatTableDataSource} from '@angular/material/table'; -import {FileService} from 'projects/pastis/src/app/core/services/file.service'; -import {PopupService} from 'projects/pastis/src/app/core/services/popup.service'; -import {SedaService} from 'projects/pastis/src/app/core/services/seda.service'; -import {PastisDialogData} from 'projects/pastis/src/app/shared/pastis-dialog/classes/pastis-dialog-data'; -import {PastisPopupMetadataLanguageService} from 'projects/pastis/src/app/shared/pastis-popup-metadata-language/pastis-popup-metadata-language.service'; -import {Subscription} from 'rxjs'; -import {AttributeData} from '../../../../models/edit-attribute-models'; -import { - CardinalityConstants, - DataTypeConstants, - FileNode, - TypeConstants, - ValueOrDataConstants -} from '../../../../models/file-node'; -import {SedaData} from '../../../../models/seda-data'; -import {FileTreeMetadataService} from '../file-tree-metadata.service'; +import { Component, Inject, OnInit } from '@angular/core'; +import { MatCheckboxChange } from '@angular/material/checkbox'; +import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; +import { MatTableDataSource } from '@angular/material/table'; +import { FileService } from 'projects/pastis/src/app/core/services/file.service'; +import { PopupService } from 'projects/pastis/src/app/core/services/popup.service'; +import { SedaService } from 'projects/pastis/src/app/core/services/seda.service'; +import { PastisDialogData } from 'projects/pastis/src/app/shared/pastis-dialog/classes/pastis-dialog-data'; +import { PastisPopupMetadataLanguageService } from 'projects/pastis/src/app/shared/pastis-popup-metadata-language/pastis-popup-metadata-language.service'; +import { Subscription } from 'rxjs'; +import { AttributeData } from '../../../../models/edit-attribute-models'; +import { CardinalityConstants, DataTypeConstants, FileNode, TypeConstants, ValueOrDataConstants } from '../../../../models/file-node'; +import { SedaData } from '../../../../models/seda-data'; +import { FileTreeMetadataService } from '../file-tree-metadata.service'; @Component({ selector: 'pastis-edit-attributes', templateUrl: './attributes.component.html', - styleUrls: ['./attributes.component.scss'] + styleUrls: ['./attributes.component.scss'], }) export class AttributesPopupComponent implements OnInit { - displayedColumns: string[] = ['selected', 'nomDuChamp', 'valeurFixe', 'commentaire']; attributeCardinalities: string[]; @@ -82,7 +75,6 @@ export class AttributesPopupComponent implements OnInit { sedaLanguage: boolean; sedaLanguageSub: Subscription; - constructor( public dialogRef: MatDialogRef, @Inject(MAT_DIALOG_DATA) public dialogReceivedData: PastisDialogData, @@ -90,21 +82,20 @@ export class AttributesPopupComponent implements OnInit { private fileService: FileService, private fileTreeMetadataService: FileTreeMetadataService, private popUpService: PopupService, - private sedaLanguageService: PastisPopupMetadataLanguageService - ) { } + private sedaLanguageService: PastisPopupMetadataLanguageService, + ) {} ngOnInit() { - this.sedaLanguageSub = this.sedaLanguageService.sedaLanguage.subscribe( (value: boolean) => { this.sedaLanguage = value; }, (error) => { console.log(error); - } + }, ); - this.fileService.currentTree.subscribe( fileTree => { + this.fileService.currentTree.subscribe((fileTree) => { if (fileTree) { this.parentFileNode = fileTree[0]; } @@ -122,7 +113,7 @@ export class AttributesPopupComponent implements OnInit { for (const index in this.matDataSource.data) { const fileNode = this.dialogReceivedData.fileNode; const att = this.matDataSource.data[index]; - const attSedaData = fileNode.sedaData.Children.find((child: { Name: string; }) => child.Name === att.nomDuChamp); + const attSedaData = fileNode.sedaData.Children.find((child: { Name: string }) => child.Name === att.nomDuChamp); if (attSedaData.Cardinality === CardinalityConstants.Obligatoire) { this.matDataSource.data[index].selected = true; } else { @@ -140,7 +131,7 @@ export class AttributesPopupComponent implements OnInit { // console.log('ParentFileNode : ', this.parentFileNode); for (const node of this.parentFileNode.children) { if (node.name === elementName) { - node.documentation = newComment; + node.documentation = newComment; } } } @@ -153,7 +144,7 @@ export class AttributesPopupComponent implements OnInit { } for (const node of this.parentFileNode.children) { if (node.name === elementName) { - node.value = newValue; + node.value = newValue; } } } @@ -163,14 +154,16 @@ export class AttributesPopupComponent implements OnInit { * If all checkboxs are checked, then the "select all" checkbox is checked */ isChecked(): boolean { - return this.matDataSource.data.filter(a => !a.selected).length == 0; + return this.matDataSource.data.filter((a) => !a.selected).length == 0; } isSedaObligatory(attribute: AttributeData): boolean { if (attribute) { const popUpData = this.popUpService.getPopUpDataOnOpen() as PastisDialogData; if (popUpData) { - const popSendSedaNodeFilted = popUpData.fileNode.sedaData.Children.find((child: { Name: string; }) => child.Name === attribute.nomDuChamp); + const popSendSedaNodeFilted = popUpData.fileNode.sedaData.Children.find( + (child: { Name: string }) => child.Name === attribute.nomDuChamp, + ); return popSendSedaNodeFilted.Cardinality.startsWith('1'); } } @@ -183,23 +176,21 @@ export class AttributesPopupComponent implements OnInit { */ toggleAllAttributes(toggleAllCheckChange: MatCheckboxChange): void { const istoggleAllChecked = toggleAllCheckChange.checked; - this.matDataSource.data.forEach(a => { - this.isSedaObligatory(a) ? a.selected = true : a.selected = istoggleAllChecked; + this.matDataSource.data.forEach((a) => { + this.isSedaObligatory(a) ? (a.selected = true) : (a.selected = istoggleAllChecked); a.selectedCardinality = '1'; - } - ); + }); } - /** + /** * Function that checks/unchecks the attribute * @param change */ toggleAttribute(change: MatCheckboxChange, elementName: string): void { - const element = this.matDataSource.data.find(a => a.nomDuChamp === elementName); + const element = this.matDataSource.data.find((a) => a.nomDuChamp === elementName); element.selected = change.checked; } - /** * Returns the modified FileNode from the popup * @@ -214,13 +205,18 @@ export class AttributesPopupComponent implements OnInit { // Map all selected AttributeData to FileNode and add them as children of the fileNode this.matDataSource.data - .filter(attributeData => attributeData.selected) - .forEach(attributeData => { + .filter((attributeData) => attributeData.selected) + .forEach((attributeData) => { const attributeFileNode: FileNode = {} as FileNode; attributeFileNode.id = window.crypto.getRandomValues(new Uint32Array(10))[0]; attributeFileNode.cardinality = attributeData.selectedCardinality; attributeFileNode.children = []; - attributeFileNode.dataType = DataTypeConstants[(fileNode.sedaData.Children.find(child => child.Name === attributeData.nomDuChamp).Type.toString()) as keyof typeof DataTypeConstants]; + attributeFileNode.dataType = + DataTypeConstants[ + fileNode.sedaData.Children.find( + (child) => child.Name === attributeData.nomDuChamp, + ).Type.toString() as keyof typeof DataTypeConstants + ]; attributeFileNode.documentation = attributeData.commentaire ? attributeData.commentaire : null; attributeFileNode.level = fileNode.level + 1; attributeFileNode.name = attributeData.nomDuChamp; @@ -229,7 +225,7 @@ export class AttributesPopupComponent implements OnInit { attributeFileNode.value = attributeData.valeurFixe ? attributeData.valeurFixe : null; attributeFileNode.valueOrData = ValueOrDataConstants.value; // Add the attribute to the filenode - }); + }); return fileNode; } @@ -246,15 +242,14 @@ export class AttributesPopupComponent implements OnInit { const attributeDataList: AttributeData[] = []; // Loop on all the attributes available for the node in the seda definition // Maps all the attributes node to AttributesData object - this.sedaService.getAttributes(sedaNode, sedaNode.Collection).forEach(sedaAttribute => { - + this.sedaService.getAttributes(sedaNode, sedaNode.Collection).forEach((sedaAttribute) => { const attributeData: AttributeData = {} as AttributeData; attributeData.nomDuChamp = sedaAttribute.Name; attributeData.type = sedaAttribute.Element; // Check if the attribute is already added to the current node - const fileAttribute = fileNode.children.find(child => child.name === attributeData.nomDuChamp) as FileNode; + const fileAttribute = fileNode.children.find((child) => child.name === attributeData.nomDuChamp) as FileNode; // let mattAttFound = this.matDataSource.data.find(att=> att.nomDuChamp === fileAttribute.name); if (fileAttribute) { // If the attribute is present in the FileNode @@ -267,16 +262,16 @@ export class AttributesPopupComponent implements OnInit { attributeData.selectedCardinality = fileAttribute.cardinality; attributeData.enumeration = sedaAttribute.Enumeration; attributeData.valeurFixe = fileAttribute.value; - } else { - // If the attribute is not present, we fill in defaults values - attributeData.valeurFixe = null; - attributeData.selected = false; - attributeData.commentaire = null; - attributeData.id = window.crypto.getRandomValues(new Uint32Array(10))[0]; - attributeData.cardinalities = this.fileTreeMetadataService.allowedCardinality.get(sedaAttribute.Cardinality); - attributeData.selectedCardinality = null; - attributeData.enumeration = sedaAttribute.Enumeration; - } + } else { + // If the attribute is not present, we fill in defaults values + attributeData.valeurFixe = null; + attributeData.selected = false; + attributeData.commentaire = null; + attributeData.id = window.crypto.getRandomValues(new Uint32Array(10))[0]; + attributeData.cardinalities = this.fileTreeMetadataService.allowedCardinality.get(sedaAttribute.Cardinality); + attributeData.selectedCardinality = null; + attributeData.enumeration = sedaAttribute.Enumeration; + } attributeDataList.push(attributeData); }); // Create and return the datasource with the attribute's data @@ -285,9 +280,9 @@ export class AttributesPopupComponent implements OnInit { } getAttributeInputType(element: AttributeData) { - if (element.enumeration.length > 0) { - return 'enumeration'; - } + if (element.enumeration.length > 0) { + return 'enumeration'; + } } getSedaDefinition(elementName: string) { @@ -302,7 +297,6 @@ export class AttributesPopupComponent implements OnInit { } onResolveName(elementName: string): string { - if (this.dialogReceivedData.fileNode.sedaData) { for (const node of this.dialogReceivedData.fileNode.sedaData.Children) { if (node.Name === elementName) { @@ -324,5 +318,4 @@ export class AttributesPopupComponent implements OnInit { this.sedaLanguageSub.unsubscribe(); } } - } diff --git a/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/file-tree-metadata/center-matmenu.directive.ts b/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/file-tree-metadata/center-matmenu.directive.ts index 7f0d3189b67..a7a58cf3a8d 100644 --- a/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/file-tree-metadata/center-matmenu.directive.ts +++ b/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/file-tree-metadata/center-matmenu.directive.ts @@ -1,9 +1,9 @@ -import {FlexibleConnectedPositionStrategy, OverlayConfig, OverlayRef} from '@angular/cdk/overlay'; -import {Directive, ElementRef, HostListener, Input, Renderer2} from '@angular/core'; -import {MatMenuPanel, MatMenuTrigger} from '@angular/material/menu'; +import { FlexibleConnectedPositionStrategy, OverlayConfig, OverlayRef } from '@angular/cdk/overlay'; +import { Directive, ElementRef, HostListener, Input, Renderer2 } from '@angular/core'; +import { MatMenuPanel, MatMenuTrigger } from '@angular/material/menu'; @Directive({ - selector: '[center-mat-menu]' + selector: '[center-mat-menu]', }) export class CenterMatmenuDirective { overlayRef: OverlayRef; @@ -19,10 +19,10 @@ export class CenterMatmenuDirective { @Input('center-mat-menu') private menuTrigger: MatMenuTrigger; - constructor(private _menuButton: ElementRef, private _renderer: Renderer2) { - } - - + constructor( + private _menuButton: ElementRef, + private _renderer: Renderer2, + ) {} @HostListener('click', ['$event']) // @ts-ignore @@ -62,15 +62,14 @@ export class CenterMatmenuDirective { } private _overrideMatMenu() { - console.log(this.overlayConf) + console.log(this.overlayConf); let strat = this.overlayConf.positionStrategy as FlexibleConnectedPositionStrategy; this.menuTrigger['_setPosition'](strat); strat.positionChanges.subscribe(() => { this._setButtonVars(); this._setOverlayPosition(this.dropDown, this.overlayPositionBox); }); - this.overlayConf.hasBackdrop = this.menu.hasBackdrop == null ? - !this.menuTrigger.triggersSubmenu() : this.menu.hasBackdrop; + this.overlayConf.hasBackdrop = this.menu.hasBackdrop == null ? !this.menuTrigger.triggersSubmenu() : this.menu.hasBackdrop; this.overlayRef.attach(this.menuTrigger['_getPortal']()); if (this.menu.lazyContent) { @@ -83,7 +82,6 @@ export class CenterMatmenuDirective { setTimeout(() => { this._renderer.removeChild(this.button, this.arrowDiv); }, 75); - }); this.menuTrigger['_initMenu'](); } @@ -92,12 +90,12 @@ export class CenterMatmenuDirective { this.arrowDiv = this._renderer.createElement('div'); this._renderer.addClass(this.arrowDiv, 'dialog-arrow'); this._renderer.appendChild(this.button, this.arrowDiv); - this._renderer.setStyle(this.arrowDiv, 'left', (this.buttonWidth / 2) - 10 + 'px'); + this._renderer.setStyle(this.arrowDiv, 'left', this.buttonWidth / 2 - 10 + 'px'); this._renderer.setStyle(this._renderer.parentNode(dropDown), 'transform-origin', 'center top 0px'); } private _setOverlayPosition(dropDown: HTMLElement, overlayPositionBox: HTMLElement) { - const dropDownleft = ((this.buttonWidth / 2 + this.buttonLeft) - dropDown.offsetWidth / 2); + const dropDownleft = this.buttonWidth / 2 + this.buttonLeft - dropDown.offsetWidth / 2; this._renderer.setStyle(overlayPositionBox, 'top', this.buttonBottom + 1 + 'px'); this._renderer.setStyle(overlayPositionBox, 'left', dropDownleft + 'px'); diff --git a/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/file-tree-metadata/file-tree-metadata.component.html b/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/file-tree-metadata/file-tree-metadata.component.html index c47f7c9421f..e5bf66e07f9 100644 --- a/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/file-tree-metadata/file-tree-metadata.component.html +++ b/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/file-tree-metadata/file-tree-metadata.component.html @@ -1,7 +1,6 @@ - +
      class="material-icons field-tooltip" matTooltip="usage(s) autorisé(s) dans le cas de l’ajout d’un objet binaire à un groupe d’objets techniques existant" matTooltipClass="vitamui-tooltip" - >infoinfo
      - +
      @@ -295,9 +281,12 @@

      Héritage

      Création d'un contrat d'entrée

      Position de rattachement - info + info

      Création d'un contrat d'entrée

      Contrôle des rattachements - info + info

      - + - + - +
      @@ -368,11 +366,11 @@

      Création d'un contrat d'entrée

      Contrôle des rattachementsinfo + class="material-icons field-tooltip" + matTooltip="Sélection des positions de l'arbre" + matTooltipClass="vitamui-tooltip" + >info

      @@ -396,6 +394,5 @@

      - diff --git a/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-create/ingest-contract-create.component.spec.ts b/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-create/ingest-contract-create.component.spec.ts index 2d45edcc7b8..e059f28ada1 100644 --- a/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-create/ingest-contract-create.component.spec.ts +++ b/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-create/ingest-contract-create.component.spec.ts @@ -55,54 +55,52 @@ describe('IngestContractCreateComponent', () => { let component: IngestContractCreateComponent; let fixture: ComponentFixture; - beforeEach( - waitForAsync(() => { - const ingestContractCreateValidatorsSpy = jasmine.createSpyObj('IngestContractCreateValidators', { - uniqueName: () => of(null), - uniqueIdentifier: () => of(null), - identifierToIgnore: '', - }); + beforeEach(waitForAsync(() => { + const ingestContractCreateValidatorsSpy = jasmine.createSpyObj('IngestContractCreateValidators', { + uniqueName: () => of(null), + uniqueIdentifier: () => of(null), + identifierToIgnore: '', + }); - const accessContractServiceMock = { - getAll: () => of([]), - }; + const accessContractServiceMock = { + getAll: () => of([]), + }; - const parameters: Map = new Map(); - parameters.set(ExternalParameters.PARAM_ACCESS_CONTRACT, '1'); - const externalParametersServiceMock = { - getUserExternalParameters: () => of(parameters), - }; + const parameters: Map = new Map(); + parameters.set(ExternalParameters.PARAM_ACCESS_CONTRACT, '1'); + const externalParametersServiceMock = { + getUserExternalParameters: () => of(parameters), + }; - const fileFormatServiceMock = { - getAllForTenant: () => of([]), - }; - const managementContractApiServiceMock = { - getAllByParams: (_params: any) => of(null), - }; - const archiveProfileApiServiceMock = { - getAllByParams: (_params: any) => of(null), - }; + const fileFormatServiceMock = { + getAllForTenant: () => of([]), + }; + const managementContractApiServiceMock = { + getAllByParams: (_params: any) => of(null), + }; + const archiveProfileApiServiceMock = { + getAllByParams: (_params: any) => of(null), + }; - TestBed.configureTestingModule({ - imports: [VitamUICommonTestModule, MatSnackBarModule], - declarations: [IngestContractCreateComponent], - providers: [ - FormBuilder, - { provide: MatDialogRef, useValue: {} }, - { provide: MAT_DIALOG_DATA, useValue: {} }, - { provide: IngestContractService, useValue: {} }, - { provide: IngestContractCreateValidators, useValue: ingestContractCreateValidatorsSpy }, - { provide: ConfirmDialogService, useValue: { listenToEscapeKeyPress: () => EMPTY } }, - { provide: FileFormatService, useValue: fileFormatServiceMock }, - { provide: ManagementContractApiService, useValue: managementContractApiServiceMock }, - { provide: ArchiveProfileApiService, useValue: archiveProfileApiServiceMock }, - { provide: ExternalParametersService, useValue: externalParametersServiceMock }, - { provide: AccessContractService, useValue: accessContractServiceMock }, - ], - schemas: [NO_ERRORS_SCHEMA], - }).compileComponents(); - }) - ); + TestBed.configureTestingModule({ + imports: [VitamUICommonTestModule, MatSnackBarModule], + declarations: [IngestContractCreateComponent], + providers: [ + FormBuilder, + { provide: MatDialogRef, useValue: {} }, + { provide: MAT_DIALOG_DATA, useValue: {} }, + { provide: IngestContractService, useValue: {} }, + { provide: IngestContractCreateValidators, useValue: ingestContractCreateValidatorsSpy }, + { provide: ConfirmDialogService, useValue: { listenToEscapeKeyPress: () => EMPTY } }, + { provide: FileFormatService, useValue: fileFormatServiceMock }, + { provide: ManagementContractApiService, useValue: managementContractApiServiceMock }, + { provide: ArchiveProfileApiService, useValue: archiveProfileApiServiceMock }, + { provide: ExternalParametersService, useValue: externalParametersServiceMock }, + { provide: AccessContractService, useValue: accessContractServiceMock }, + ], + schemas: [NO_ERRORS_SCHEMA], + }).compileComponents(); + })); beforeEach(() => { fixture = TestBed.createComponent(IngestContractCreateComponent); diff --git a/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-create/ingest-contract-create.component.ts b/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-create/ingest-contract-create.component.ts index f4ca59622dd..3bb47622928 100644 --- a/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-create/ingest-contract-create.component.ts +++ b/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-create/ingest-contract-create.component.ts @@ -85,7 +85,7 @@ export class IngestContractCreateComponent implements OnInit, OnDestroy { private managementContractService: ManagementContractApiService, private archiveProfileService: ArchiveProfileApiService, private externalParameterService: ExternalParametersService, - private snackBar: MatSnackBar + private snackBar: MatSnackBar, ) {} statusControl = new FormControl(false); @@ -150,7 +150,7 @@ export class IngestContractCreateComponent implements OnInit, OnDestroy { { panelClass: 'vitamui-snack-bar', duration: 10000, - } + }, ); } }); @@ -224,7 +224,7 @@ export class IngestContractCreateComponent implements OnInit, OnDestroy { (error) => { this.dialogRef.close(false); console.error(error); - } + }, ); } diff --git a/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-create/ingest-contract-create.validators.ts b/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-create/ingest-contract-create.validators.ts index dd4e7376ee8..8c975c64405 100644 --- a/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-create/ingest-contract-create.validators.ts +++ b/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-create/ingest-contract-create.validators.ts @@ -74,7 +74,7 @@ export class IngestContractCreateValidators { return timer(this.debounceTime).pipe( switchMap(() => (control.value !== valueToIgnore ? this.ingestContractService.existsProperties(properties) : of(false))), take(1), - map((exists: boolean) => (exists ? existField : null)) + map((exists: boolean) => (exists ? existField : null)), ); } }; @@ -90,7 +90,7 @@ export class IngestContractCreateValidators { return timer(this.debounceTime).pipe( switchMap(() => (control.value !== valueToIgnore ? this.ingestContractService.existsProperties(properties) : of(false))), take(1), - map((exists: boolean) => (exists ? existField : null)) + map((exists: boolean) => (exists ? existField : null)), ); }; } diff --git a/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-list/ingest-contract-list.component.spec.ts b/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-list/ingest-contract-list.component.spec.ts index ac40e567d8e..196a7b5c497 100644 --- a/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-list/ingest-contract-list.component.spec.ts +++ b/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-list/ingest-contract-list.component.spec.ts @@ -51,22 +51,20 @@ describe('IngestContractListComponent', () => { updated: new Subject(), }; - beforeEach( - waitForAsync(() => { - const ingestContractServiceMock = { - search: () => of(null), - }; + beforeEach(waitForAsync(() => { + const ingestContractServiceMock = { + search: () => of(null), + }; - TestBed.configureTestingModule({ - declarations: [IngestContractListComponent], - providers: [ - { provide: IngestContractService, useValue: ingestContractServiceMock }, - { provide: IngestContractService, useValue: ingestContractServiceSpy }, - ], - schemas: [NO_ERRORS_SCHEMA], - }).compileComponents(); - }) - ); + TestBed.configureTestingModule({ + declarations: [IngestContractListComponent], + providers: [ + { provide: IngestContractService, useValue: ingestContractServiceMock }, + { provide: IngestContractService, useValue: ingestContractServiceSpy }, + ], + schemas: [NO_ERRORS_SCHEMA], + }).compileComponents(); + })); beforeEach(() => { fixture = TestBed.createComponent(IngestContractListComponent); diff --git a/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-list/ingest-contract-list.component.ts b/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-list/ingest-contract-list.component.ts index 735eb723240..395735a73dc 100644 --- a/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-list/ingest-contract-list.component.ts +++ b/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-list/ingest-contract-list.component.ts @@ -85,7 +85,7 @@ export class IngestContractListComponent extends InfiniteScrollTable {}, - () => (this.pending = false) + () => (this.pending = false), ); this.searchCriteriaSub = merge(this.searchChange, this.filterChange, this.orderChange) diff --git a/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-preview/ingest-contract-attachment-tab/ingest-contract-attachment-tab.component.spec.ts b/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-preview/ingest-contract-attachment-tab/ingest-contract-attachment-tab.component.spec.ts index e2800bc753d..9712bbdbe5f 100644 --- a/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-preview/ingest-contract-attachment-tab/ingest-contract-attachment-tab.component.spec.ts +++ b/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-preview/ingest-contract-attachment-tab/ingest-contract-attachment-tab.component.spec.ts @@ -34,21 +34,20 @@ * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ -import {NO_ERRORS_SCHEMA} from '@angular/core'; -import {ComponentFixture,TestBed,waitForAsync} from '@angular/core/testing'; -import {MatDialog} from '@angular/material/dialog'; -import {MatSnackBarModule} from '@angular/material/snack-bar'; -import {SearchUnitApiService} from 'projects/vitamui-library/src/public-api'; -import {of} from 'rxjs'; -import {ExternalParameters,ExternalParametersService} from 'ui-frontend-common'; -import {IngestContractAttachmentTabComponent} from './ingest-contract-attachment-tab.component'; +import { NO_ERRORS_SCHEMA } from '@angular/core'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; +import { MatDialog } from '@angular/material/dialog'; +import { MatSnackBarModule } from '@angular/material/snack-bar'; +import { SearchUnitApiService } from 'projects/vitamui-library/src/public-api'; +import { of } from 'rxjs'; +import { ExternalParameters, ExternalParametersService } from 'ui-frontend-common'; +import { IngestContractAttachmentTabComponent } from './ingest-contract-attachment-tab.component'; - -describe('IngestContractAttachmentTabComponent',() => { +describe('IngestContractAttachmentTabComponent', () => { let component: IngestContractAttachmentTabComponent; let fixture: ComponentFixture; - const ingestContractValue={ + const ingestContractValue = { tenant: 0, version: 1, description: 'desc', @@ -71,42 +70,40 @@ describe('IngestContractAttachmentTabComponent',() => { formatType: [''], archiveProfiles: [''], managementContractId: 'MC-000001', - computeInheritedRulesAtIngest: true + computeInheritedRulesAtIngest: true, }; - beforeEach( - waitForAsync(() => { - const parameters: Map=new Map(); - parameters.set(ExternalParameters.PARAM_ACCESS_CONTRACT,'1'); - const externalParametersServiceMock={ - getUserExternalParameters: () => of(parameters), - }; + beforeEach(waitForAsync(() => { + const parameters: Map = new Map(); + parameters.set(ExternalParameters.PARAM_ACCESS_CONTRACT, '1'); + const externalParametersServiceMock = { + getUserExternalParameters: () => of(parameters), + }; - const unitValueMock={ - getByDsl: () => of({}), - }; + const unitValueMock = { + getByDsl: () => of({}), + }; - TestBed.configureTestingModule({ - declarations: [IngestContractAttachmentTabComponent], - imports: [MatSnackBarModule], - providers: [ - {provide: MatDialog,useValue: {}}, - {provide: SearchUnitApiService,useValue: unitValueMock}, - {provide: ExternalParametersService,useValue: externalParametersServiceMock}, - ], - schemas: [NO_ERRORS_SCHEMA], - }).compileComponents(); - }) - ); + TestBed.configureTestingModule({ + declarations: [IngestContractAttachmentTabComponent], + imports: [MatSnackBarModule], + providers: [ + { provide: MatDialog, useValue: {} }, + { provide: SearchUnitApiService, useValue: unitValueMock }, + { provide: ExternalParametersService, useValue: externalParametersServiceMock }, + ], + schemas: [NO_ERRORS_SCHEMA], + }).compileComponents(); + })); beforeEach(() => { - fixture=TestBed.createComponent(IngestContractAttachmentTabComponent); - component=fixture.componentInstance; - component.ingestContract=ingestContractValue; + fixture = TestBed.createComponent(IngestContractAttachmentTabComponent); + component = fixture.componentInstance; + component.ingestContract = ingestContractValue; fixture.detectChanges(); }); - it('should create',() => { + it('should create', () => { expect(component).toBeTruthy(); }); }); diff --git a/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-preview/ingest-contract-attachment-tab/ingest-contract-attachment-tab.component.ts b/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-preview/ingest-contract-attachment-tab/ingest-contract-attachment-tab.component.ts index 5ec46255e9a..536d03079ad 100644 --- a/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-preview/ingest-contract-attachment-tab/ingest-contract-attachment-tab.component.ts +++ b/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-preview/ingest-contract-attachment-tab/ingest-contract-attachment-tab.component.ts @@ -83,7 +83,7 @@ export class IngestContractAttachmentTabComponent implements OnInit { private unitService: SearchUnitApiService, private externalParameterService: ExternalParametersService, private dialog: MatDialog, - private snackBar: MatSnackBar + private snackBar: MatSnackBar, ) {} ngOnInit() { @@ -99,7 +99,7 @@ export class IngestContractAttachmentTabComponent implements OnInit { { panelClass: 'vitamui-snack-bar', duration: 10000, - } + }, ); } }); diff --git a/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-preview/ingest-contract-attachment-tab/ingest-contract-nodes-update/ingest-contract-node-update.component.spec.ts b/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-preview/ingest-contract-attachment-tab/ingest-contract-nodes-update/ingest-contract-node-update.component.spec.ts index f433553d283..2de183eb810 100644 --- a/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-preview/ingest-contract-attachment-tab/ingest-contract-nodes-update/ingest-contract-node-update.component.spec.ts +++ b/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-preview/ingest-contract-attachment-tab/ingest-contract-nodes-update/ingest-contract-node-update.component.spec.ts @@ -41,7 +41,7 @@ import { ReactiveFormsModule } from '@angular/forms'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; import { MatSnackBarModule } from '@angular/material/snack-bar'; import { FilingPlanModule } from 'projects/vitamui-library/src/lib/components/filing-plan/filing-plan.module'; -import {BASE_URL, ENVIRONMENT, InjectorModule, LoggerModule, VitamUISnackBarService} from 'ui-frontend-common'; +import { BASE_URL, ENVIRONMENT, InjectorModule, LoggerModule, VitamUISnackBarService } from 'ui-frontend-common'; import { VitamUICommonTestModule } from 'ui-frontend-common/testing'; import { environment } from './../../../../../environments/environment'; @@ -52,35 +52,33 @@ xdescribe('IngestContractNodeUpdateComponent', () => { let component: IngestContractNodeUpdateComponent; let fixture: ComponentFixture; - beforeEach( - waitForAsync(() => { - const matDialogRefSpy = jasmine.createSpyObj('MatDialogRef', ['close']); + beforeEach(waitForAsync(() => { + const matDialogRefSpy = jasmine.createSpyObj('MatDialogRef', ['close']); const snackBarSpy = jasmine.createSpyObj('VitamUISnackBarService', ['open']); - TestBed.configureTestingModule({ - imports: [ - ReactiveFormsModule, - HttpClientTestingModule, - VitamUICommonTestModule, - FilingPlanModule, - MatSnackBarModule, - InjectorModule, - LoggerModule.forRoot(), - ], - declarations: [IngestContractNodeUpdateComponent], - providers: [ - { provide: MatDialogRef, useValue: matDialogRefSpy }, - { - provide: MAT_DIALOG_DATA, - useValue: { data: { ingestContract: 'IC-000001', accessContractId: 'AC-000001', tenantIdentifier: 1 } }, - }, - { provide: BASE_URL, useValue: '/fake-api' }, - { provide: VitamUISnackBarService, useValue: snackBarSpy }, - { provide: ENVIRONMENT, useValue: environment }, - ], - schemas: [CUSTOM_ELEMENTS_SCHEMA], - }).compileComponents(); - }) - ); + TestBed.configureTestingModule({ + imports: [ + ReactiveFormsModule, + HttpClientTestingModule, + VitamUICommonTestModule, + FilingPlanModule, + MatSnackBarModule, + InjectorModule, + LoggerModule.forRoot(), + ], + declarations: [IngestContractNodeUpdateComponent], + providers: [ + { provide: MatDialogRef, useValue: matDialogRefSpy }, + { + provide: MAT_DIALOG_DATA, + useValue: { data: { ingestContract: 'IC-000001', accessContractId: 'AC-000001', tenantIdentifier: 1 } }, + }, + { provide: BASE_URL, useValue: '/fake-api' }, + { provide: VitamUISnackBarService, useValue: snackBarSpy }, + { provide: ENVIRONMENT, useValue: environment }, + ], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }).compileComponents(); + })); beforeEach(() => { fixture = TestBed.createComponent(IngestContractNodeUpdateComponent); diff --git a/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-preview/ingest-contract-attachment-tab/ingest-contract-nodes-update/ingest-contract-node-update.component.ts b/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-preview/ingest-contract-attachment-tab/ingest-contract-nodes-update/ingest-contract-node-update.component.ts index 7e24fa89b04..cc3aedaf001 100644 --- a/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-preview/ingest-contract-attachment-tab/ingest-contract-nodes-update/ingest-contract-node-update.component.ts +++ b/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-preview/ingest-contract-attachment-tab/ingest-contract-nodes-update/ingest-contract-node-update.component.ts @@ -67,7 +67,7 @@ export class IngestContractNodeUpdateComponent implements OnInit { public dialogRef: MatDialogRef, @Inject(MAT_DIALOG_DATA) public data: { ingestContract: IngestContract; accessContractId: string; tenantIdentifier: number }, private formBuilder: FormBuilder, - private ingestContractService: IngestContractService + private ingestContractService: IngestContractService, ) { this.accessContractId = this.data.accessContractId; this.ingestContract = this.data.ingestContract; @@ -93,10 +93,10 @@ export class IngestContractNodeUpdateComponent implements OnInit { }); this.linkParentIdControl.setValue( - this.ingestContract.linkParentId ? { included: [this.ingestContract.linkParentId], excluded: [] } : { included: [], excluded: [] } + this.ingestContract.linkParentId ? { included: [this.ingestContract.linkParentId], excluded: [] } : { included: [], excluded: [] }, ); this.checkParentIdControl.setValue( - this.ingestContract.checkParentId ? { included: this.ingestContract.checkParentId, excluded: [] } : { included: [], excluded: [] } + this.ingestContract.checkParentId ? { included: this.ingestContract.checkParentId, excluded: [] } : { included: [], excluded: [] }, ); } @@ -120,7 +120,7 @@ export class IngestContractNodeUpdateComponent implements OnInit { (error: any) => { this.dialogRef.close(false); console.error(error); - } + }, ); } diff --git a/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-preview/ingest-contract-format-tab/ingest-contract-format-tab.component.spec.ts b/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-preview/ingest-contract-format-tab/ingest-contract-format-tab.component.spec.ts index 723bd49d47e..5ff208b0359 100644 --- a/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-preview/ingest-contract-format-tab/ingest-contract-format-tab.component.spec.ts +++ b/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-preview/ingest-contract-format-tab/ingest-contract-format-tab.component.spec.ts @@ -34,21 +34,20 @@ * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ -import {CUSTOM_ELEMENTS_SCHEMA} from '@angular/core'; -import {ComponentFixture,TestBed,waitForAsync} from '@angular/core/testing'; -import {ReactiveFormsModule} from '@angular/forms'; -import {of} from 'rxjs'; -import {VitamUICommonTestModule} from 'ui-frontend-common/testing'; -import {FileFormatService} from '../../../file-format/file-format.service'; -import {IngestContractService} from '../../ingest-contract.service'; -import {IngestContractFormatTabComponent} from './ingest-contract-format-tab.component'; +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; +import { ReactiveFormsModule } from '@angular/forms'; +import { of } from 'rxjs'; +import { VitamUICommonTestModule } from 'ui-frontend-common/testing'; +import { FileFormatService } from '../../../file-format/file-format.service'; +import { IngestContractService } from '../../ingest-contract.service'; +import { IngestContractFormatTabComponent } from './ingest-contract-format-tab.component'; - -describe('IngestContractFormatTabComponent',() => { +describe('IngestContractFormatTabComponent', () => { let component: IngestContractFormatTabComponent; let fixture: ComponentFixture; - const ingestContractValue={ + const ingestContractValue = { tenant: 0, version: 1, description: 'desc', @@ -71,34 +70,32 @@ describe('IngestContractFormatTabComponent',() => { formatType: [''], archiveProfiles: [''], managementContractId: 'MC-000001', - computeInheritedRulesAtIngest: true + computeInheritedRulesAtIngest: true, }; - beforeEach( - waitForAsync(() => { - const fileFormatServiceMock={ - getAllForTenant: () => of([]), - }; - TestBed.configureTestingModule({ - imports: [ReactiveFormsModule,VitamUICommonTestModule], - declarations: [IngestContractFormatTabComponent], - providers: [ - {provide: IngestContractService,useValue: {}}, - {provide: FileFormatService,useValue: fileFormatServiceMock}, - ], - schemas: [CUSTOM_ELEMENTS_SCHEMA], - }).compileComponents(); - }) - ); + beforeEach(waitForAsync(() => { + const fileFormatServiceMock = { + getAllForTenant: () => of([]), + }; + TestBed.configureTestingModule({ + imports: [ReactiveFormsModule, VitamUICommonTestModule], + declarations: [IngestContractFormatTabComponent], + providers: [ + { provide: IngestContractService, useValue: {} }, + { provide: FileFormatService, useValue: fileFormatServiceMock }, + ], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }).compileComponents(); + })); beforeEach(() => { - fixture=TestBed.createComponent(IngestContractFormatTabComponent); - component=fixture.componentInstance; - component.ingestContract=ingestContractValue; + fixture = TestBed.createComponent(IngestContractFormatTabComponent); + component = fixture.componentInstance; + component.ingestContract = ingestContractValue; fixture.detectChanges(); }); - it('should create',() => { + it('should create', () => { expect(component).toBeTruthy(); }); }); diff --git a/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-preview/ingest-contract-format-tab/ingest-contract-format-tab.component.ts b/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-preview/ingest-contract-format-tab/ingest-contract-format-tab.component.ts index 3b0c1d30b47..54648eb1d24 100644 --- a/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-preview/ingest-contract-format-tab/ingest-contract-format-tab.component.ts +++ b/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-preview/ingest-contract-format-tab/ingest-contract-format-tab.component.ts @@ -90,7 +90,7 @@ export class IngestContractFormatTabComponent implements OnInit { constructor( private formBuilder: FormBuilder, private ingestContractService: IngestContractService, - private fileFormatService: FileFormatService + private fileFormatService: FileFormatService, ) { this.form = this.formBuilder.group({ everyFormatType: [true, Validators.required], @@ -114,8 +114,8 @@ export class IngestContractFormatTabComponent implements OnInit { filter((formData) => !isEmpty(formData)), map((formData) => extend({ id: this.previousValue().id, identifier: this.previousValue().identifier }, formData)), switchMap((formData: { id: string; [key: string]: any }) => - this.ingestContractService.patch(formData).pipe(catchError(() => of(null))) - ) + this.ingestContractService.patch(formData).pipe(catchError(() => of(null))), + ), ); } @@ -130,7 +130,7 @@ export class IngestContractFormatTabComponent implements OnInit { }, () => { this.submited = false; - } + }, ); } diff --git a/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-preview/ingest-contract-heritage-tab/ingest-contract-heritage-tab.component.ts b/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-preview/ingest-contract-heritage-tab/ingest-contract-heritage-tab.component.ts index 57e14685630..6f8b53f1255 100644 --- a/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-preview/ingest-contract-heritage-tab/ingest-contract-heritage-tab.component.ts +++ b/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-preview/ingest-contract-heritage-tab/ingest-contract-heritage-tab.component.ts @@ -73,7 +73,10 @@ export class IngestContractHeritageTabComponent implements OnInit { return this._ingestContract; } - constructor(private formBuilder: FormBuilder, private ingestContractService: IngestContractService) {} + constructor( + private formBuilder: FormBuilder, + private ingestContractService: IngestContractService, + ) {} ngOnInit() { const rule = this.ingestContract !== undefined ? this.ingestContract.computeInheritedRulesAtIngest : false; @@ -99,7 +102,7 @@ export class IngestContractHeritageTabComponent implements OnInit { }, () => { this.submited = false; - } + }, ); } @@ -108,8 +111,8 @@ export class IngestContractHeritageTabComponent implements OnInit { filter((formData) => !isEmpty(formData)), map((formData) => extend({ id: this.previousValue().id, identifier: this.previousValue().identifier }, formData)), switchMap((formData: { id: string; [key: string]: any }) => - this.ingestContractService.patch(formData).pipe(catchError(() => of(null))) - ) + this.ingestContractService.patch(formData).pipe(catchError(() => of(null))), + ), ); } diff --git a/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-preview/ingest-contract-information-tab/ingest-contract-information-tab.component.ts b/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-preview/ingest-contract-information-tab/ingest-contract-information-tab.component.ts index 607907f05eb..73544c66bdf 100644 --- a/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-preview/ingest-contract-information-tab/ingest-contract-information-tab.component.ts +++ b/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-preview/ingest-contract-information-tab/ingest-contract-information-tab.component.ts @@ -104,7 +104,7 @@ export class IngestContractInformationTabComponent implements OnInit { private ingestContractService: IngestContractService, private managementContractService: ManagementContractApiService, private archiveProfileService: ArchiveProfileApiService, - private ingestContractCreateValidators: IngestContractCreateValidators + private ingestContractCreateValidators: IngestContractCreateValidators, ) { this.form = this.formBuilder.group({ identifier: [null, Validators.required], @@ -175,7 +175,7 @@ export class IngestContractInformationTabComponent implements OnInit { } } return this.ingestContractService.patch(formData).pipe(catchError(() => of(null))); - }) + }), ); } @@ -193,7 +193,7 @@ export class IngestContractInformationTabComponent implements OnInit { }, () => { this.submited = false; - } + }, ); } diff --git a/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-preview/ingest-contract-object-tab/ingest-contract-object-tab.component.ts b/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-preview/ingest-contract-object-tab/ingest-contract-object-tab.component.ts index 29295080682..3808f0d5853 100644 --- a/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-preview/ingest-contract-object-tab/ingest-contract-object-tab.component.ts +++ b/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-preview/ingest-contract-object-tab/ingest-contract-object-tab.component.ts @@ -93,7 +93,10 @@ export class IngestContractObjectTabComponent implements OnInit { } } - constructor(private formBuilder: FormBuilder, private ingestContractService: IngestContractService) { + constructor( + private formBuilder: FormBuilder, + private ingestContractService: IngestContractService, + ) { this.form = this.formBuilder.group({ masterMandatory: [true], everyDataObjectVersion: [true, Validators.required], @@ -112,8 +115,8 @@ export class IngestContractObjectTabComponent implements OnInit { filter((formData) => !isEmpty(formData)), map((formData) => extend({ id: this.previousValue().id, identifier: this.previousValue().identifier }, formData)), switchMap((formData: { id: string; [key: string]: any }) => - this.ingestContractService.patch(formData).pipe(catchError(() => of(null))) - ) + this.ingestContractService.patch(formData).pipe(catchError(() => of(null))), + ), ); } @@ -128,7 +131,7 @@ export class IngestContractObjectTabComponent implements OnInit { }, () => { this.submited = false; - } + }, ); } diff --git a/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-preview/ingest-contract-preview.component.html b/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-preview/ingest-contract-preview.component.html index eca923dcb34..fac8351c084 100644 --- a/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-preview/ingest-contract-preview.component.html +++ b/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-preview/ingest-contract-preview.component.html @@ -38,12 +38,22 @@
      {{ ingestContract?.name }}
      - + - + diff --git a/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-preview/ingest-contract-preview.component.spec.ts b/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-preview/ingest-contract-preview.component.spec.ts index 138f130a68d..deda7511e96 100644 --- a/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-preview/ingest-contract-preview.component.spec.ts +++ b/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-preview/ingest-contract-preview.component.spec.ts @@ -45,18 +45,16 @@ describe('IngestContractPreviewComponent', () => { let component: IngestContractPreviewComponent; let fixture: ComponentFixture; - beforeEach( - waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [IngestContractPreviewComponent], - providers: [ - { provide: MatDialog, useValue: {} }, - { provide: IngestContractService, useValue: {} }, - ], - schemas: [CUSTOM_ELEMENTS_SCHEMA], - }).compileComponents(); - }) - ); + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [IngestContractPreviewComponent], + providers: [ + { provide: MatDialog, useValue: {} }, + { provide: IngestContractService, useValue: {} }, + ], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }).compileComponents(); + })); beforeEach(() => { fixture = TestBed.createComponent(IngestContractPreviewComponent); diff --git a/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-preview/ingest-contract-preview.component.ts b/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-preview/ingest-contract-preview.component.ts index 075da4c720c..c716941bd9a 100644 --- a/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-preview/ingest-contract-preview.component.ts +++ b/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract-preview/ingest-contract-preview.component.ts @@ -82,7 +82,10 @@ export class IngestContractPreviewComponent implements OnChanges, AfterViewInit } } - constructor(private matDialog: MatDialog, private ingestContractService: IngestContractService) {} + constructor( + private matDialog: MatDialog, + private ingestContractService: IngestContractService, + ) {} ngOnChanges(changes: SimpleChanges): void { if (changes.hasOwnProperty('ingestContract')) { diff --git a/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract.component.html b/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract.component.html index 20c873e4a46..7487938d927 100644 --- a/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract.component.html +++ b/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract.component.html @@ -13,11 +13,10 @@
      - +

      - Paramétrer mes Contrats d’entrée + Paramétrer mes Contrats d’entrée

      @@ -30,8 +29,7 @@

      - @@ -41,8 +39,7 @@

      - +

      diff --git a/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract.component.ts b/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract.component.ts index 10f9cb4a834..a3860a5637a 100644 --- a/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract.component.ts +++ b/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract.component.ts @@ -65,7 +65,7 @@ export class IngestContractComponent extends SidenavPage impleme private router: Router, globalEventService: GlobalEventService, private applicationService: ApplicationService, - private securityService: SecurityService + private securityService: SecurityService, ) { super(route, globalEventService); globalEventService.tenantEvent.subscribe(() => { @@ -120,7 +120,7 @@ export class IngestContractComponent extends SidenavPage impleme mergeMap((params) => { this.tenantIdentifier = +params.tenantIdentifier; return this.securityService.hasRole(this.appName, this.tenantIdentifier, 'ROLE_UPDATE_INGEST_CONTRACTS'); - }) + }), ); this.updateSlaveMode(); diff --git a/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract.service.ts b/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract.service.ts index b214ff792b1..e88b5cc5ec3 100644 --- a/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract.service.ts +++ b/ui/ui-frontend/projects/referential/src/app/ingest-contract/ingest-contract.service.ts @@ -48,7 +48,11 @@ import { IngestContractApiService } from '../core/api/ingest-contract-api.servic export class IngestContractService extends SearchService { updated = new Subject(); - constructor(private ingestContractApi: IngestContractApiService, private snackBarService: VitamUISnackBarService, http: HttpClient) { + constructor( + private ingestContractApi: IngestContractApiService, + private snackBarService: VitamUISnackBarService, + http: HttpClient, + ) { super(http, ingestContractApi, 'ALL'); } @@ -98,8 +102,8 @@ export class IngestContractService extends SearchService { }, (error) => { this.snackBarService.open({ message: error.error.message, translate: false }); - } - ) + }, + ), ); } @@ -114,8 +118,8 @@ export class IngestContractService extends SearchService { }, (error) => { this.snackBarService.open({ message: error.error.message, translate: false }); - } - ) + }, + ), ); } } diff --git a/ui/ui-frontend/projects/referential/src/app/logbook-management-operation/logbook-management-operation-list/logbook-management-operation-list.component.html b/ui/ui-frontend/projects/referential/src/app/logbook-management-operation/logbook-management-operation-list/logbook-management-operation-list.component.html index 04986b8b4d7..4e964c177b9 100644 --- a/ui/ui-frontend/projects/referential/src/app/logbook-management-operation/logbook-management-operation-list/logbook-management-operation-list.component.html +++ b/ui/ui-frontend/projects/referential/src/app/logbook-management-operation/logbook-management-operation-list/logbook-management-operation-list.component.html @@ -162,10 +162,10 @@ operationStatus(operation) === 'OK' ? 'text-green' : operationStatus(operation) === 'KO' - ? 'text-red' - : operationStatus(operation) === 'WARNING' - ? 'text-orange' - : 'text-red-fatal' + ? 'text-red' + : operationStatus(operation) === 'WARNING' + ? 'text-orange' + : 'text-red-fatal' " >{{ 'STATUS_VALUE.' + operation?.stepStatus | translate }} diff --git a/ui/ui-frontend/projects/referential/src/app/logbook-management-operation/logbook-management-operation-list/logbook-management-operation-list.component.scss b/ui/ui-frontend/projects/referential/src/app/logbook-management-operation/logbook-management-operation-list/logbook-management-operation-list.component.scss index 45564e661ec..caba8ddd903 100644 --- a/ui/ui-frontend/projects/referential/src/app/logbook-management-operation/logbook-management-operation-list/logbook-management-operation-list.component.scss +++ b/ui/ui-frontend/projects/referential/src/app/logbook-management-operation/logbook-management-operation-list/logbook-management-operation-list.component.scss @@ -74,7 +74,9 @@ width: 100%; height: 60px; background: #ffffff; - box-shadow: 0px 2px 8px rgba(33, 33, 33, 0.2), 0px 4px 16px rgba(33, 33, 33, 0.05); + box-shadow: + 0px 2px 8px rgba(33, 33, 33, 0.2), + 0px 4px 16px rgba(33, 33, 33, 0.05); border-radius: 5px; } diff --git a/ui/ui-frontend/projects/referential/src/app/logbook-management-operation/logbook-management-operation-list/logbook-management-operation-list.component.ts b/ui/ui-frontend/projects/referential/src/app/logbook-management-operation/logbook-management-operation-list/logbook-management-operation-list.component.ts index fb695ef8e5a..d72203c8d96 100644 --- a/ui/ui-frontend/projects/referential/src/app/logbook-management-operation/logbook-management-operation-list/logbook-management-operation-list.component.ts +++ b/ui/ui-frontend/projects/referential/src/app/logbook-management-operation/logbook-management-operation-list/logbook-management-operation-list.component.ts @@ -86,7 +86,10 @@ export class LogbookManagementOperationListComponent implements OnInit { { key: 'EXTERNAL_LOGBOOK', value: 'Journalisation d’événements externes' }, ]; - constructor(public logbookManagementOperationService: LogbookManagementOperationService, private translate: TranslateService) {} + constructor( + public logbookManagementOperationService: LogbookManagementOperationService, + private translate: TranslateService, + ) {} searchOperationsList(searchCriteria: any) { this.filterMap.categories = []; @@ -300,12 +303,12 @@ export class LogbookManagementOperationListComponent implements OnInit { const resultsToShow: any[] = this.filter ? this.resultsFiltred : this.operationsList.results; if (!this.getParamShow('Status')) { resultsToShow.sort((a, b) => - this.translate.instant('STATUS_VALUE.' + a.stepStatus) > this.translate.instant('STATUS_VALUE.' + b.stepStatus) ? 1 : -1 + this.translate.instant('STATUS_VALUE.' + a.stepStatus) > this.translate.instant('STATUS_VALUE.' + b.stepStatus) ? 1 : -1, ); this.changeParamShow('Status', true); } else { resultsToShow.sort((a, b) => - this.translate.instant('STATUS_VALUE.' + a.stepStatus) < this.translate.instant('STATUS_VALUE.' + b.stepStatus) ? 1 : -1 + this.translate.instant('STATUS_VALUE.' + a.stepStatus) < this.translate.instant('STATUS_VALUE.' + b.stepStatus) ? 1 : -1, ); this.changeParamShow('Status', false); } diff --git a/ui/ui-frontend/projects/referential/src/app/logbook-management-operation/logbook-management-operation-preview/logbook-management-operation-information-tab/logbook-management-operation-information-tab.component.spec.ts b/ui/ui-frontend/projects/referential/src/app/logbook-management-operation/logbook-management-operation-preview/logbook-management-operation-information-tab/logbook-management-operation-information-tab.component.spec.ts index 29f8eef012f..2d121ec5335 100644 --- a/ui/ui-frontend/projects/referential/src/app/logbook-management-operation/logbook-management-operation-preview/logbook-management-operation-information-tab/logbook-management-operation-information-tab.component.spec.ts +++ b/ui/ui-frontend/projects/referential/src/app/logbook-management-operation/logbook-management-operation-preview/logbook-management-operation-information-tab/logbook-management-operation-information-tab.component.spec.ts @@ -47,26 +47,24 @@ describe('LogbookManagementOperationInformationTabComponent', () => { let logbookInformationComponent: TestLogbookInformationComponent; let fixture: ComponentFixture; - beforeEach( - waitForAsync(() => { - expectedOperation = { - globalState: 'PAUSE', - nextStep: 'nextStep', - operationId: 'aecaaereragfogjqbaai6malzquerteaaaq', - previousStep: 'previousStep', - processDate: new Date(), - processType: 'TRACEABILITY', - stepByStep: true, - stepStatus: 'KO', - }; - TestBed.configureTestingModule({ - declarations: [LogbookManagementOperationInformationTabComponent, TestLogbookInformationComponent], - imports: [TranslateModule.forRoot()], - providers: [{ provide: LogbookService, useValue: {} }], - schemas: [NO_ERRORS_SCHEMA], - }).compileComponents(); - }) - ); + beforeEach(waitForAsync(() => { + expectedOperation = { + globalState: 'PAUSE', + nextStep: 'nextStep', + operationId: 'aecaaereragfogjqbaai6malzquerteaaaq', + previousStep: 'previousStep', + processDate: new Date(), + processType: 'TRACEABILITY', + stepByStep: true, + stepStatus: 'KO', + }; + TestBed.configureTestingModule({ + declarations: [LogbookManagementOperationInformationTabComponent, TestLogbookInformationComponent], + imports: [TranslateModule.forRoot()], + providers: [{ provide: LogbookService, useValue: {} }], + schemas: [NO_ERRORS_SCHEMA], + }).compileComponents(); + })); beforeEach(() => { fixture = TestBed.createComponent(TestLogbookInformationComponent); diff --git a/ui/ui-frontend/projects/referential/src/app/logbook-management-operation/logbook-management-operation-preview/logbook-management-operation-preview.component.ts b/ui/ui-frontend/projects/referential/src/app/logbook-management-operation/logbook-management-operation-preview/logbook-management-operation-preview.component.ts index 065c5e244fd..e19e8a1663b 100644 --- a/ui/ui-frontend/projects/referential/src/app/logbook-management-operation/logbook-management-operation-preview/logbook-management-operation-preview.component.ts +++ b/ui/ui-frontend/projects/referential/src/app/logbook-management-operation/logbook-management-operation-preview/logbook-management-operation-preview.component.ts @@ -45,7 +45,7 @@ import { LogbookManagementOperationService } from '../logbook-management-operati @Component({ selector: 'app-logbook-management-operation-preview', templateUrl: './logbook-management-operation-preview.component.html', - styleUrls: [ './logbook-management-operation-preview.component.scss' ], + styleUrls: ['./logbook-management-operation-preview.component.scss'], }) export class LogbookManagementOperationPreviewComponent implements OnInit, OnDestroy { @Input() operation: OperationDetails; @@ -60,9 +60,8 @@ export class LogbookManagementOperationPreviewComponent implements OnInit, OnDes constructor( private matDialog: MatDialog, - public logbookManagementOperationService: LogbookManagementOperationService - ) { - } + public logbookManagementOperationService: LogbookManagementOperationService, + ) {} ngOnDestroy(): void { this.operationUpdatedSub?.unsubscribe(); @@ -70,10 +69,9 @@ export class LogbookManagementOperationPreviewComponent implements OnInit, OnDes ngOnInit(): void { if (this.logbookManagementOperationService.operationUpdated) { - this.operationUpdatedSub = this.logbookManagementOperationService.operationUpdated - .subscribe((updatedOperation: OperationDetails) => { - this.operation = updatedOperation; - }); + this.operationUpdatedSub = this.logbookManagementOperationService.operationUpdated.subscribe((updatedOperation: OperationDetails) => { + this.operation = updatedOperation; + }); } } diff --git a/ui/ui-frontend/projects/referential/src/app/logbook-management-operation/logbook-management-operation.component.scss b/ui/ui-frontend/projects/referential/src/app/logbook-management-operation/logbook-management-operation.component.scss index 5858c4304fd..287a9077aa5 100644 --- a/ui/ui-frontend/projects/referential/src/app/logbook-management-operation/logbook-management-operation.component.scss +++ b/ui/ui-frontend/projects/referential/src/app/logbook-management-operation/logbook-management-operation.component.scss @@ -70,7 +70,9 @@ background: #ffffff; - box-shadow: 0px 2px 8px rgba(33, 33, 33, 0.2), 0px 4px 16px rgba(33, 33, 33, 0.05); + box-shadow: + 0px 2px 8px rgba(33, 33, 33, 0.2), + 0px 4px 16px rgba(33, 33, 33, 0.05); border-radius: 5px; flex: none; @@ -119,7 +121,9 @@ background: #ffffff; - box-shadow: 0px 2px 8px rgba(33, 33, 33, 0.2), 0px 4px 16px rgba(33, 33, 33, 0.05); + box-shadow: + 0px 2px 8px rgba(33, 33, 33, 0.2), + 0px 4px 16px rgba(33, 33, 33, 0.05); border-radius: 5px; } diff --git a/ui/ui-frontend/projects/referential/src/app/logbook-management-operation/logbook-management-operation.component.ts b/ui/ui-frontend/projects/referential/src/app/logbook-management-operation/logbook-management-operation.component.ts index 199858fd13a..85b036c2ce2 100644 --- a/ui/ui-frontend/projects/referential/src/app/logbook-management-operation/logbook-management-operation.component.ts +++ b/ui/ui-frontend/projects/referential/src/app/logbook-management-operation/logbook-management-operation.component.ts @@ -60,7 +60,11 @@ export class LogbookManagementOperationComponent implements OnInit { @ViewChild(LogbookManagementOperationListComponent, { static: true }) logbookManagementOperationListComponent: LogbookManagementOperationListComponent; - constructor(private formBuilder: FormBuilder, private route: ActivatedRoute, private authService: AuthService) { + constructor( + private formBuilder: FormBuilder, + private route: ActivatedRoute, + private authService: AuthService, + ) { this.dateRangeFilterForm = this.formBuilder.group({ startDateMin: null, startDateMax: null, diff --git a/ui/ui-frontend/projects/referential/src/app/logbook-management-operation/logbook-management-operation.service.ts b/ui/ui-frontend/projects/referential/src/app/logbook-management-operation/logbook-management-operation.service.ts index 2b6ee7f6fe9..754d36b0c2b 100644 --- a/ui/ui-frontend/projects/referential/src/app/logbook-management-operation/logbook-management-operation.service.ts +++ b/ui/ui-frontend/projects/referential/src/app/logbook-management-operation/logbook-management-operation.service.ts @@ -52,7 +52,7 @@ export class LogbookManagementOperationService extends SearchService { constructor( private logbookManagementOperationApiService: LogbookManagementOperationApiService, private snackBarService: VitamUISnackBarService, - http: HttpClient + http: HttpClient, ) { super(http, logbookManagementOperationApiService, 'ALL'); } @@ -81,7 +81,7 @@ export class LogbookManagementOperationService extends SearchService { catchError(() => { return of({ $hits: null, $results: [] }); }), - map((response) => this.buildOperationsResults(response)) + map((response) => this.buildOperationsResults(response)), ); } @@ -92,7 +92,7 @@ export class LogbookManagementOperationService extends SearchService { catchError(() => { return of({ $hits: null, $results: [] }); }), - map((response) => this.buildOperationsResults(response)) + map((response) => this.buildOperationsResults(response)), ) .pipe( tap((response) => { @@ -102,8 +102,8 @@ export class LogbookManagementOperationService extends SearchService { }), tap( () => this.snackBarService.open({ message: 'LOGBOOK_MANAGEMENT_OPERATION_ACTIONS.MESSAGE' }), - (error) => this.snackBarService.open({ message: error.error.message, translate: false }) - ) + (error) => this.snackBarService.open({ message: error.error.message, translate: false }), + ), ); } @@ -114,7 +114,7 @@ export class LogbookManagementOperationService extends SearchService { catchError(() => { return of({ $hits: null, $results: [] }); }), - map((response) => this.buildOperationsResults(response)) + map((response) => this.buildOperationsResults(response)), ) .pipe( tap((response) => { @@ -124,8 +124,8 @@ export class LogbookManagementOperationService extends SearchService { }), tap( () => this.snackBarService.open({ message: 'LOGBOOK_MANAGEMENT_OPERATION_ACTIONS.MESSAGE' }), - (error) => this.snackBarService.open({ message: error.error.message, translate: false }) - ) + (error) => this.snackBarService.open({ message: error.error.message, translate: false }), + ), ); } } diff --git a/ui/ui-frontend/projects/referential/src/app/logbook-operation/event-filter.interface.ts b/ui/ui-frontend/projects/referential/src/app/logbook-operation/event-filter.interface.ts index bbb95ddca15..011861a2041 100644 --- a/ui/ui-frontend/projects/referential/src/app/logbook-operation/event-filter.interface.ts +++ b/ui/ui-frontend/projects/referential/src/app/logbook-operation/event-filter.interface.ts @@ -37,5 +37,5 @@ export interface EventFilter { type?: Array; status?: 'RUNNING' | 'ERROR' | 'DONE'; - dateRange?: { startDate: Date, endDate: Date }; + dateRange?: { startDate: Date; endDate: Date }; } diff --git a/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-download.service.ts b/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-download.service.ts index c3d4ecf46c7..3b985a3573f 100644 --- a/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-download.service.ts +++ b/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-download.service.ts @@ -34,16 +34,10 @@ * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ -import {HttpClient} from '@angular/common/http'; -import {Injectable} from '@angular/core'; -import {Subject} from 'rxjs'; -import { - Event, - LogbookApiService, - LogbookOperationReportState, - SearchService, - VitamUISnackBarService -} from 'ui-frontend-common'; +import { HttpClient } from '@angular/common/http'; +import { Injectable } from '@angular/core'; +import { Subject } from 'rxjs'; +import { Event, LogbookApiService, LogbookOperationReportState, SearchService, VitamUISnackBarService } from 'ui-frontend-common'; const DOWNLOAD_TYPE_TRANSFER_SIP = 'transfersip'; const DOWNLOAD_TYPE_DIP = 'dip'; @@ -55,7 +49,6 @@ const DOWNLOAD_TYPE_OBJECT = 'object'; providedIn: 'root', }) export class LogbookDownloadService extends SearchService { - logbookOperationsReloaded = new Subject(); private evTypeAllowed = [ @@ -74,7 +67,11 @@ export class LogbookDownloadService extends SearchService { ]; private evTypeProcAllowed = ['AUDIT', 'EXPORT_DIP', 'ARCHIVE_TRANSFER', 'TRANSFER_REPLY', 'INGEST', 'MASS_UPDATE']; - constructor(private logbookApiService: LogbookApiService, private snackBarService: VitamUISnackBarService, http: HttpClient) { + constructor( + private logbookApiService: LogbookApiService, + private snackBarService: VitamUISnackBarService, + http: HttpClient, + ) { super(http, logbookApiService); } diff --git a/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-operation-constants.ts b/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-operation-constants.ts index 989d64e7856..78d229f492f 100644 --- a/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-operation-constants.ts +++ b/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-operation-constants.ts @@ -46,7 +46,7 @@ export const LOGBOOK_OPERATION_CATEGORIES: Option[] = [ { key: 'UPDATE', label: 'Mise à jour', info: '' }, { key: 'PRESERVATION', label: 'Préservation', info: '' }, { key: 'RECLASSIFICATION', label: 'Réorganisation', info: '' }, - { key: 'STORAGE_BACKUP', label: 'Sauvegarde d\'écriture', info: '' }, + { key: 'STORAGE_BACKUP', label: "Sauvegarde d'écriture", info: '' }, { key: 'TRACEABILITY', label: 'Sécurisation', info: '' }, { key: 'CHECK', label: 'Vérification', info: '' }, { key: 'EXTERNAL_LOGBOOK', label: 'Journalisation externe', info: '' }, diff --git a/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-operation-detail/logbook-operation-detail.component.html b/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-operation-detail/logbook-operation-detail.component.html index 00f3f90b32b..a32c4cc7489 100644 --- a/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-operation-detail/logbook-operation-detail.component.html +++ b/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-operation-detail/logbook-operation-detail.component.html @@ -14,20 +14,20 @@
      {{ event?.id | truncate: 30 }}
      - -
      -
      @@ -40,8 +40,7 @@
      {{ event?.id | truncate: 30 }}
      - +
      {{ event?.agIdExt }}
      diff --git a/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-operation-detail/logbook-operation-detail.component.scss b/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-operation-detail/logbook-operation-detail.component.scss index 1dc77d3af0d..c705a80aae5 100644 --- a/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-operation-detail/logbook-operation-detail.component.scss +++ b/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-operation-detail/logbook-operation-detail.component.scss @@ -1,51 +1,51 @@ .title { - max-width: 504px; + max-width: 504px; - h2 { - word-break: break-all; - } + h2 { + word-break: break-all; + } - .vitamui-icon.no-margin { - margin-right: 0; - } + .vitamui-icon.no-margin { + margin-right: 0; + } - .status-badge-mini { - margin-right: 10px; + .status-badge-mini { + margin-right: 10px; - &:after { - margin-left: -11px; - margin-top: -11px; - width: 9px; - height: 9px; - } + &:after { + margin-left: -11px; + margin-top: -11px; + width: 9px; + height: 9px; } + } } .panel-row { - display: flex; + display: flex; } .word-break { - word-break: break-all; + word-break: break-all; } .vitamui-sidepanel-loading-overlay { - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - background: rgba(255, 255, 255, 0.5); - z-index: 1; - display: flex; - align-items: center; - justify-content: center; + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + background: rgba(255, 255, 255, 0.5); + z-index: 1; + display: flex; + align-items: center; + justify-content: center; } .vitamui-sidepanel-header { - height: 287px; + height: 287px; } .vitamui-sidepanel-body { - top: 250px; -} \ No newline at end of file + top: 250px; +} diff --git a/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-operation-detail/logbook-operation-detail.component.ts b/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-operation-detail/logbook-operation-detail.component.ts index f41e274f7f5..402f1780c20 100644 --- a/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-operation-detail/logbook-operation-detail.component.ts +++ b/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-operation-detail/logbook-operation-detail.component.ts @@ -91,15 +91,15 @@ export class LogbookOperationDetailComponent implements OnInit, OnChanges, OnDes private route: ActivatedRoute, private logbookDownloadService: LogbookDownloadService, private externalParameterService: ExternalParametersService, - private snackBar: MatSnackBar + private snackBar: MatSnackBar, ) {} ngOnInit() { this.externalParameterService.getUserExternalParameters().subscribe((parameters) => this.setAccessContractId(parameters)); this.subscriptions.add( this.logbookDownloadService.logbookOperationsReloaded.subscribe((logbookOperations) => - this.setLogbookOperationIfIfHasBeenReloaded(logbookOperations) - ) + this.setLogbookOperationIfIfHasBeenReloaded(logbookOperations), + ), ); this.refreshLogbookOperation(); } diff --git a/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-operation-detail/logbook-operation-popup.component.ts b/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-operation-detail/logbook-operation-popup.component.ts index f9bdb24cc34..72fca48d573 100644 --- a/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-operation-detail/logbook-operation-popup.component.ts +++ b/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-operation-detail/logbook-operation-popup.component.ts @@ -46,15 +46,13 @@ import { ActivatedRoute } from '@angular/router'; [tenantIdentifier]="tenantIdentifier" [isPopup]="true" > - ` + `, }) export class LogbookOperationPopupComponent implements OnInit { - eventId: string; tenantIdentifier: number; - constructor(private route: ActivatedRoute) { - } + constructor(private route: ActivatedRoute) {} ngOnInit() { this.eventId = this.route.snapshot.paramMap.get('id'); @@ -64,5 +62,4 @@ export class LogbookOperationPopupComponent implements OnInit { closePopup() { window.close(); } - } diff --git a/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-operation-list/event-type-badge-class.pipe.ts b/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-operation-list/event-type-badge-class.pipe.ts index 3ee25f52848..c50e761332c 100644 --- a/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-operation-list/event-type-badge-class.pipe.ts +++ b/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-operation-list/event-type-badge-class.pipe.ts @@ -42,14 +42,13 @@ const classMap: { [key: string]: string } = { OK: 'status-badge-green', WARNING: 'status-badge-orange', KO: 'status-badge-red', - FATAL: 'status-badge-red' + FATAL: 'status-badge-red', }; @Pipe({ - name: 'eventTypeBadgeClass' + name: 'eventTypeBadgeClass', }) export class EventTypeBadgeClassPipe implements PipeTransform { - transform(event: Event): string { if (!event || !event.events || event.events.length <= 0) { return 'status-badge-grey'; @@ -63,5 +62,4 @@ export class EventTypeBadgeClassPipe implements PipeTransform { return classMap[lastEvent.outcome] || 'status-badge-grey'; } - } diff --git a/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-operation-list/event-type-color-class.pipe.ts b/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-operation-list/event-type-color-class.pipe.ts index b39d6d1ee12..1bcdcdb2c0e 100644 --- a/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-operation-list/event-type-color-class.pipe.ts +++ b/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-operation-list/event-type-color-class.pipe.ts @@ -41,14 +41,13 @@ const colorClassMap: { [key: string]: string } = { OK: 'success', WARNING: 'warning', KO: 'error', - FATAL: 'error' + FATAL: 'error', }; @Pipe({ - name: 'eventTypeColorClass' + name: 'eventTypeColorClass', }) export class EventTypeColorClassPipe implements PipeTransform { - transform(event: Event): string { if (!event.events || event.events.length <= 0) { return ''; @@ -62,5 +61,4 @@ export class EventTypeColorClassPipe implements PipeTransform { return colorClassMap[lastEvent.outcome] || ''; } - } diff --git a/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-operation-list/last-event.pipe.ts b/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-operation-list/last-event.pipe.ts index 5c6a52ee3a2..493bea2043f 100644 --- a/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-operation-list/last-event.pipe.ts +++ b/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-operation-list/last-event.pipe.ts @@ -39,12 +39,10 @@ import { Event } from 'ui-frontend-common'; import { Pipe, PipeTransform } from '@angular/core'; @Pipe({ - name: 'lastEvent' + name: 'lastEvent', }) export class LastEventPipe implements PipeTransform { - transform(event: Event): Event { - return (event && event.events && event.events.length > 0) ? event.events[event.events.length - 1] : null; + return event && event.events && event.events.length > 0 ? event.events[event.events.length - 1] : null; } - } diff --git a/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-operation-list/logbook-operation-list.component.ts b/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-operation-list/logbook-operation-list.component.ts index a49f90de90c..3419592754e 100644 --- a/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-operation-list/logbook-operation-list.component.ts +++ b/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-operation-list/logbook-operation-list.component.ts @@ -118,7 +118,10 @@ export class LogbookOperationListComponent extends InfiniteScrollTable im }; operationCategoriesFilterOptions: Array<{ value: string; label: string }> = []; - constructor(public logbookSearchService: LogbookSearchService, private logbookDownloadService: LogbookDownloadService) { + constructor( + public logbookSearchService: LogbookSearchService, + private logbookDownloadService: LogbookDownloadService, + ) { super(logbookSearchService); } @@ -126,7 +129,7 @@ export class LogbookOperationListComponent extends InfiniteScrollTable im this.pending = true; this.updatedData.subscribe(() => this.onDataSourceReloaded()); const searchCriteriaChange = merge(this.searchChange, this.filterChange, this.orderChange, this.searchFiltersChange).pipe( - debounceTime(FILTER_DEBOUNCE_TIME_MS) + debounceTime(FILTER_DEBOUNCE_TIME_MS), ); searchCriteriaChange.subscribe(() => { @@ -135,7 +138,7 @@ export class LogbookOperationListComponent extends InfiniteScrollTable im this.refreshOperationCategoriesOptions(); this.refreshList(); this.logbookOperationsSubscription = this.logbookDownloadService.logbookOperationsReloaded.subscribe((logbookOperationsReloaded) => - this.updateLogbookOperations(logbookOperationsReloaded) + this.updateLogbookOperations(logbookOperationsReloaded), ); } diff --git a/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-operation-routing.module.ts b/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-operation-routing.module.ts index f5274571f06..a17f9e09651 100644 --- a/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-operation-routing.module.ts +++ b/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-operation-routing.module.ts @@ -44,30 +44,24 @@ const routes: Route[] = [ { path: '', redirectTo: 'tenant', - pathMatch: 'full' + pathMatch: 'full', }, { path: 'tenant', component: VitamUITenantSelectComponent, pathMatch: 'full', - canActivate: [TenantSelectionGuard] + canActivate: [TenantSelectionGuard], }, { path: 'tenant/:tenantIdentifier', component: LogbookOperationComponent, - canActivate: [ActiveTenantGuard] - } + canActivate: [ActiveTenantGuard], + }, ]; - @NgModule({ declarations: [], - imports: [ - CommonModule, - RouterModule.forChild(routes) - ], - exports: [ - RouterModule - ] + imports: [CommonModule, RouterModule.forChild(routes)], + exports: [RouterModule], }) -export class LogbookOperationRoutingModule { } +export class LogbookOperationRoutingModule {} diff --git a/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-operation.component.spec.ts b/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-operation.component.spec.ts index 00c73c7a7a1..a719d8bddce 100644 --- a/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-operation.component.spec.ts +++ b/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-operation.component.spec.ts @@ -51,25 +51,23 @@ describe('LogbookOperationComponent', () => { let component: LogbookOperationComponent; let fixture: ComponentFixture; - beforeEach( - waitForAsync(() => { - const matDialogSpy = jasmine.createSpyObj('MatDialog', ['open']); - matDialogSpy.open.and.returnValue({ afterClosed: () => of(true) }); - TestBed.configureTestingModule({ - imports: [MatMenuModule, ReactiveFormsModule, InjectorModule, LoggerModule.forRoot(), SearchBarModule], - declarations: [LogbookOperationComponent, SearchBarComponent], - providers: [ - { provide: MatDialog, useValue: matDialogSpy }, - { provide: ActivatedRoute, useValue: { paramMap: EMPTY, data: EMPTY, queryParams: of({ guid: 'operationId' }) } }, - { provide: LogbookSearchService, useValue: { search: () => EMPTY } }, - { provide: Router, useValue: { navigate: () => {} } }, - GlobalEventService, - { provide: ENVIRONMENT, useValue: environment } - ], - schemas: [NO_ERRORS_SCHEMA] - }).compileComponents(); - }) - ); + beforeEach(waitForAsync(() => { + const matDialogSpy = jasmine.createSpyObj('MatDialog', ['open']); + matDialogSpy.open.and.returnValue({ afterClosed: () => of(true) }); + TestBed.configureTestingModule({ + imports: [MatMenuModule, ReactiveFormsModule, InjectorModule, LoggerModule.forRoot(), SearchBarModule], + declarations: [LogbookOperationComponent, SearchBarComponent], + providers: [ + { provide: MatDialog, useValue: matDialogSpy }, + { provide: ActivatedRoute, useValue: { paramMap: EMPTY, data: EMPTY, queryParams: of({ guid: 'operationId' }) } }, + { provide: LogbookSearchService, useValue: { search: () => EMPTY } }, + { provide: Router, useValue: { navigate: () => {} } }, + GlobalEventService, + { provide: ENVIRONMENT, useValue: environment }, + ], + schemas: [NO_ERRORS_SCHEMA], + }).compileComponents(); + })); beforeEach(() => { fixture = TestBed.createComponent(LogbookOperationComponent); diff --git a/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-operation.component.ts b/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-operation.component.ts index 125233f829d..86169abebfb 100644 --- a/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-operation.component.ts +++ b/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-operation.component.ts @@ -34,18 +34,18 @@ * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ -import {Component, OnInit, ViewChild} from '@angular/core'; -import {FormBuilder, FormGroup} from '@angular/forms'; -import {MatDialog} from '@angular/material/dialog'; -import {ActivatedRoute, Router} from '@angular/router'; -import {GlobalEventService, SearchBarComponent, SidenavPage} from 'ui-frontend-common'; -import {EventFilter} from './event-filter.interface'; -import {LogbookOperationListComponent} from './logbook-operation-list/logbook-operation-list.component'; +import { Component, OnInit, ViewChild } from '@angular/core'; +import { FormBuilder, FormGroup } from '@angular/forms'; +import { MatDialog } from '@angular/material/dialog'; +import { ActivatedRoute, Router } from '@angular/router'; +import { GlobalEventService, SearchBarComponent, SidenavPage } from 'ui-frontend-common'; +import { EventFilter } from './event-filter.interface'; +import { LogbookOperationListComponent } from './logbook-operation-list/logbook-operation-list.component'; @Component({ selector: 'app-logbook-operation', templateUrl: './logbook-operation.component.html', - styleUrls: ['./logbook-operation.component.scss'] + styleUrls: ['./logbook-operation.component.scss'], }) export class LogbookOperationComponent extends SidenavPage implements OnInit { search = ''; @@ -54,8 +54,8 @@ export class LogbookOperationComponent extends SidenavPage implements OnIni filters: Readonly = {}; workflowGuidToSearch: string; - @ViewChild(SearchBarComponent, {static: true}) searchBar: SearchBarComponent; - @ViewChild(LogbookOperationListComponent, {static: true}) list: LogbookOperationListComponent; + @ViewChild(SearchBarComponent, { static: true }) searchBar: SearchBarComponent; + @ViewChild(LogbookOperationListComponent, { static: true }) list: LogbookOperationListComponent; constructor( private route: ActivatedRoute, @@ -70,14 +70,14 @@ export class LogbookOperationComponent extends SidenavPage implements OnIni this.dateRangeFilterForm = this.formBuilder.group({ startDate: null, - endDate: null + endDate: null, }); this.dateRangeFilterForm.valueChanges.subscribe((value) => { this.filters = { type: this.filters.type, status: this.filters.status, - dateRange: value + dateRange: value, }; }); } @@ -103,7 +103,7 @@ export class LogbookOperationComponent extends SidenavPage implements OnIni } changeTenant(tenantIdentifier: number) { - this.router.navigate(['..', tenantIdentifier], {relativeTo: this.route}); + this.router.navigate(['..', tenantIdentifier], { relativeTo: this.route }); } onSearchSubmit(search: string) { @@ -112,9 +112,9 @@ export class LogbookOperationComponent extends SidenavPage implements OnIni clearDate(date: 'startDate' | 'endDate') { if (date === 'startDate') { - this.dateRangeFilterForm.get(date).reset(null, {emitEvent: false}); + this.dateRangeFilterForm.get(date).reset(null, { emitEvent: false }); } else if (date === 'endDate') { - this.dateRangeFilterForm.get(date).reset(null, {emitEvent: false}); + this.dateRangeFilterForm.get(date).reset(null, { emitEvent: false }); } else { console.error('clearDate() error: unknown date ' + date); } @@ -134,5 +134,4 @@ export class LogbookOperationComponent extends SidenavPage implements OnIni this.searchBar.reset(); this.list.resetFilters(); } - } diff --git a/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-search.service.spec.ts b/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-search.service.spec.ts index 1227d8cc16b..0cdb0a8e197 100644 --- a/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-search.service.spec.ts +++ b/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-search.service.spec.ts @@ -43,13 +43,15 @@ import { TestBed } from '@angular/core/testing'; import { LogbookSearchService } from './logbook-search.service'; describe('LogbookSearchService', () => { - beforeEach(() => TestBed.configureTestingModule({ - imports: [HttpClientTestingModule], - providers: [ - { provide: LogbookService, useValue: {} }, - { provide: LogbookApiService, useValue: {} }, - ] - })); + beforeEach(() => + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule], + providers: [ + { provide: LogbookService, useValue: {} }, + { provide: LogbookApiService, useValue: {} }, + ], + }), + ); it('should be created', () => { const service: LogbookSearchService = TestBed.inject(LogbookSearchService); diff --git a/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-search.service.ts b/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-search.service.ts index e5db0fde297..d0ef6f96879 100644 --- a/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-search.service.ts +++ b/ui/ui-frontend/projects/referential/src/app/logbook-operation/logbook-search.service.ts @@ -35,18 +35,15 @@ * knowledge of the CeCILL-C license and that you accept its terms. */ import * as moment from 'moment'; -import { - Event, LogbookApiService, PageRequest, SearchService, VitamSelectOperator, VitamSelectQuery -} from 'ui-frontend-common'; +import { Event, LogbookApiService, PageRequest, SearchService, VitamSelectOperator, VitamSelectQuery } from 'ui-frontend-common'; import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class LogbookSearchService extends SearchService { - constructor(http: HttpClient, logbookApi: LogbookApiService) { super(http, logbookApi); } @@ -57,14 +54,14 @@ export class LogbookSearchService extends SearchService { $filter: { $limit: pageRequest.size, $offset: Math.max(0, pageRequest.page - 1) * pageRequest.size, - $orderby: { evDateTime: -1 } - } + $orderby: { evDateTime: -1 }, + }, }; if (!criteria) { return { $query: {} as VitamSelectOperator, - ...baseParameters + ...baseParameters, }; } @@ -73,17 +70,15 @@ export class LogbookSearchService extends SearchService { if (queryOperators.length === 0) { return { $query: {} as VitamSelectOperator, - ...baseParameters + ...baseParameters, }; } return { $query: { - $and: [ - ...this.buildQueryOperators(criteria), - ] + $and: [...this.buildQueryOperators(criteria)], }, - ...baseParameters + ...baseParameters, }; } @@ -112,5 +107,4 @@ export class LogbookSearchService extends SearchService { return operators; } - } diff --git a/ui/ui-frontend/projects/referential/src/app/management-contract/management-contract-create/management-contract-create.component.ts b/ui/ui-frontend/projects/referential/src/app/management-contract/management-contract-create/management-contract-create.component.ts index f3c2a7c8f72..f5dca9d222a 100644 --- a/ui/ui-frontend/projects/referential/src/app/management-contract/management-contract-create/management-contract-create.component.ts +++ b/ui/ui-frontend/projects/referential/src/app/management-contract/management-contract-create/management-contract-create.component.ts @@ -60,7 +60,7 @@ export class ManagementContractCreateComponent implements OnInit, OnDestroy { private confirmDialogService: ConfirmDialogService, private managementContractService: ManagementContractService, private managementContractCreateValidators: ManagementContractCreateValidators, - private logger: Logger + private logger: Logger, ) {} statusControl = new FormControl(false); @@ -126,7 +126,7 @@ export class ManagementContractCreateComponent implements OnInit, OnDestroy { (error: any) => { this.dialogRef.close({ success: false, action: 'none' }); this.logger.error(error); - } + }, ); } diff --git a/ui/ui-frontend/projects/referential/src/app/management-contract/management-contract-list/management-contract-list.component.html b/ui/ui-frontend/projects/referential/src/app/management-contract/management-contract-list/management-contract-list.component.html index 6f069d2e2ad..f9e73b09690 100644 --- a/ui/ui-frontend/projects/referential/src/app/management-contract/management-contract-list/management-contract-list.component.html +++ b/ui/ui-frontend/projects/referential/src/app/management-contract/management-contract-list/management-contract-list.component.html @@ -94,15 +94,15 @@
      {{ managementContract?.identifier }}
      {{ managementContract?.name }}
      -
      {{ managementContract?.creationDate | dateTime : 'dd/MM/yyyy' }}
      +
      {{ managementContract?.creationDate | dateTime: 'dd/MM/yyyy' }}
      - {{ managementContract?.creationDate | dateTime : 'HH:mm:ss' }} + {{ managementContract?.creationDate | dateTime: 'HH:mm:ss' }}
      -
      {{ managementContract?.lastUpdate | dateTime : 'dd/MM/yyyy' }}
      +
      {{ managementContract?.lastUpdate | dateTime: 'dd/MM/yyyy' }}
      - {{ managementContract?.lastUpdate | dateTime : 'HH:mm:ss' }} + {{ managementContract?.lastUpdate | dateTime: 'HH:mm:ss' }}
      diff --git a/ui/ui-frontend/projects/referential/src/app/management-contract/management-contract-list/management-contract-list.component.ts b/ui/ui-frontend/projects/referential/src/app/management-contract/management-contract-list/management-contract-list.component.ts index 725a5f60436..ee24fd031b1 100644 --- a/ui/ui-frontend/projects/referential/src/app/management-contract/management-contract-list/management-contract-list.component.ts +++ b/ui/ui-frontend/projects/referential/src/app/management-contract/management-contract-list/management-contract-list.component.ts @@ -74,7 +74,7 @@ export class ManagementContractListComponent extends InfiniteScrollTable {}, - () => (this.pending = false) + () => (this.pending = false), ); this.searchCriteriaSub = merge(this.searchChange, this.filterChange, this.orderChange) @@ -103,7 +103,7 @@ export class ManagementContractListComponent extends InfiniteScrollTable { const index = this.dataSource.findIndex( - (mngContract: ManagementContract) => mngContract.identifier === managementContract.identifier + (mngContract: ManagementContract) => mngContract.identifier === managementContract.identifier, ); if (index > -1) { this.dataSource[index] = { diff --git a/ui/ui-frontend/projects/referential/src/app/management-contract/management-contract-preview/management-contract-information-tab/management-contract-information-tab.component.html b/ui/ui-frontend/projects/referential/src/app/management-contract/management-contract-preview/management-contract-information-tab/management-contract-information-tab.component.html index b5b0cfd5b90..1546700de33 100644 --- a/ui/ui-frontend/projects/referential/src/app/management-contract/management-contract-preview/management-contract-information-tab/management-contract-information-tab.component.html +++ b/ui/ui-frontend/projects/referential/src/app/management-contract/management-contract-preview/management-contract-information-tab/management-contract-information-tab.component.html @@ -49,8 +49,8 @@
      - {{ inputManagementContract?.creationDate | dateTime : 'dd/MM/yyyy' }} - {{ inputManagementContract?.creationDate | dateTime : 'HH:mm:ss' }} + {{ inputManagementContract?.creationDate | dateTime: 'dd/MM/yyyy' }} + {{ inputManagementContract?.creationDate | dateTime: 'HH:mm:ss' }}
      @@ -59,8 +59,8 @@
      - {{ inputManagementContract?.lastUpdate | dateTime : 'dd/MM/yyyy' }} - {{ inputManagementContract?.lastUpdate | dateTime : 'HH:mm:ss' }} + {{ inputManagementContract?.lastUpdate | dateTime: 'dd/MM/yyyy' }} + {{ inputManagementContract?.lastUpdate | dateTime: 'HH:mm:ss' }}
      diff --git a/ui/ui-frontend/projects/referential/src/app/management-contract/management-contract-preview/management-contract-information-tab/management-contract-information-tab.component.ts b/ui/ui-frontend/projects/referential/src/app/management-contract/management-contract-preview/management-contract-information-tab/management-contract-information-tab.component.ts index 7ee9cd6dfb4..24f9d64793f 100644 --- a/ui/ui-frontend/projects/referential/src/app/management-contract/management-contract-preview/management-contract-information-tab/management-contract-information-tab.component.ts +++ b/ui/ui-frontend/projects/referential/src/app/management-contract/management-contract-preview/management-contract-information-tab/management-contract-information-tab.component.ts @@ -79,7 +79,10 @@ export class ManagementContractInformationTabComponent implements OnInit, OnDest return this._inputManagementContract; }; - constructor(private formBuilder: FormBuilder, private managementContractService: ManagementContractService) { + constructor( + private formBuilder: FormBuilder, + private managementContractService: ManagementContractService, + ) { this.form = this.formBuilder.group({ identifier: [{ value: null, disabled: true }, Validators.required], name: [null, Validators.required], @@ -113,7 +116,7 @@ export class ManagementContractInformationTabComponent implements OnInit, OnDest } } return this.managementContractService.patch(formData).pipe(catchError(() => of(null))); - }) + }), ); } @@ -131,7 +134,7 @@ export class ManagementContractInformationTabComponent implements OnInit, OnDest () => { this.submited = false; this.showSpinner = false; - } + }, ); } diff --git a/ui/ui-frontend/projects/referential/src/app/management-contract/management-contract-preview/management-contract-preview.component.html b/ui/ui-frontend/projects/referential/src/app/management-contract/management-contract-preview/management-contract-preview.component.html index 1c116eb49f1..46fa4e8af8e 100644 --- a/ui/ui-frontend/projects/referential/src/app/management-contract/management-contract-preview/management-contract-preview.component.html +++ b/ui/ui-frontend/projects/referential/src/app/management-contract/management-contract-preview/management-contract-preview.component.html @@ -1,5 +1,5 @@ extend({ id: this._inputManagementContract.id, identifier: this._inputManagementContract.identifier }, formData)), switchMap((formData: { id: string; [key: string]: any }) => { return this.managementContractService.patch(formData).pipe(catchError(() => of(null))); - }) + }), ); } @@ -125,7 +128,7 @@ export class ManagementContractStorageTabComponent implements OnInit, OnDestroy () => { this.submited = false; this.showSpinner = false; - } + }, ); } diff --git a/ui/ui-frontend/projects/referential/src/app/management-contract/management-contract.component.ts b/ui/ui-frontend/projects/referential/src/app/management-contract/management-contract.component.ts index c5277c510ec..d9441c8cefb 100644 --- a/ui/ui-frontend/projects/referential/src/app/management-contract/management-contract.component.ts +++ b/ui/ui-frontend/projects/referential/src/app/management-contract/management-contract.component.ts @@ -51,7 +51,7 @@ export class ManagementContractComponent extends SidenavPage public dialog: MatDialog, private route: ActivatedRoute, globalEventService: GlobalEventService, - private applicationService: ApplicationService + private applicationService: ApplicationService, ) { super(route, globalEventService); globalEventService.tenantEvent.subscribe(() => { @@ -98,7 +98,7 @@ export class ManagementContractComponent extends SidenavPage this.subscriptions.add( this.applicationService.isApplicationExternalIdentifierEnabled('MANAGEMENT_CONTRACT').subscribe((value) => { this.isSlaveMode = value; - }) + }), ); } diff --git a/ui/ui-frontend/projects/referential/src/app/management-contract/management-contract.service.ts b/ui/ui-frontend/projects/referential/src/app/management-contract/management-contract.service.ts index fcf8f9a0ef7..0f9389816f0 100644 --- a/ui/ui-frontend/projects/referential/src/app/management-contract/management-contract.service.ts +++ b/ui/ui-frontend/projects/referential/src/app/management-contract/management-contract.service.ts @@ -44,7 +44,7 @@ export class ManagementContractService extends SearchService private managementContractApi: ManagementContractsApiService, private snackBarService: VitamUISnackBarService, private translateService: TranslateService, - http: HttpClient + http: HttpClient, ) { super(http, managementContractApi, 'ALL'); } @@ -93,8 +93,8 @@ export class ManagementContractService extends SearchService }, (error) => { this.snackBarService.open({ message: error.error.message }); - } - ) + }, + ), ); } @@ -108,8 +108,8 @@ export class ManagementContractService extends SearchService }, (error) => { this.snackBarService.open({ message: error.error.message }); - } - ) + }, + ), ); } } diff --git a/ui/ui-frontend/projects/referential/src/app/management-contract/validators/management-contract-create.validators.ts b/ui/ui-frontend/projects/referential/src/app/management-contract/validators/management-contract-create.validators.ts index e5a4293e55a..73854a51bd2 100644 --- a/ui/ui-frontend/projects/referential/src/app/management-contract/validators/management-contract-create.validators.ts +++ b/ui/ui-frontend/projects/referential/src/app/management-contract/validators/management-contract-create.validators.ts @@ -58,7 +58,7 @@ export class ManagementContractCreateValidators { return timer(this.debounceTime).pipe( switchMap(() => (control.value !== valueToIgnore ? this.managementContractService.existsProperties(properties) : of(false))), take(1), - map((exists: boolean) => (exists ? existField : null)) + map((exists: boolean) => (exists ? existField : null)), ); }; } diff --git a/ui/ui-frontend/projects/referential/src/app/models/accession-register-export-csv.interface.ts b/ui/ui-frontend/projects/referential/src/app/models/accession-register-export-csv.interface.ts index 1ce9a6bc1a7..995424979ab 100644 --- a/ui/ui-frontend/projects/referential/src/app/models/accession-register-export-csv.interface.ts +++ b/ui/ui-frontend/projects/referential/src/app/models/accession-register-export-csv.interface.ts @@ -26,26 +26,24 @@ * * accept its terms. * */ -import {Direction} from 'ui-frontend-common'; +import { Direction } from 'ui-frontend-common'; export interface AccessionRegisterSearchDto { - - orderBy?: string + orderBy?: string; direction?: Direction; - searchText?: string - filters?: Map> - endDateInterval?: EndDateInterval + searchText?: string; + filters?: Map>; + endDateInterval?: EndDateInterval; opi?: string; originatingAgency?: string; - originatingAgencies?: Array - archivalAgreements?: Array - archivalProfiles?: Array - acquisitionInformations?: Array + originatingAgencies?: Array; + archivalAgreements?: Array; + archivalProfiles?: Array; + acquisitionInformations?: Array; elimination?: string; transferReply?: string; - } export interface EndDateInterval { diff --git a/ui/ui-frontend/projects/referential/src/app/ontology/ontology-create/ontology-create.component.scss b/ui/ui-frontend/projects/referential/src/app/ontology/ontology-create/ontology-create.component.scss index e00ac086af8..84f3f02320b 100644 --- a/ui/ui-frontend/projects/referential/src/app/ontology/ontology-create/ontology-create.component.scss +++ b/ui/ui-frontend/projects/referential/src/app/ontology/ontology-create/ontology-create.component.scss @@ -1,16 +1,16 @@ @import '~ui-frontend-common/sass/variables/colors'; .actions { - margin-top: 20px; - display: flex; + margin-top: 20px; + display: flex; } .actions > button:not(:last-child) { - margin-right: 20px; + margin-right: 20px; } .form-group { - padding-bottom: 30px; + padding-bottom: 30px; } .field-tooltip { @@ -30,33 +30,33 @@ } label { - color: var(--vitamui-grey-900); - font-size: 15px; - line-height: normal; - margin-bottom: 10px; - display: block; + color: var(--vitamui-grey-900); + font-size: 15px; + line-height: normal; + margin-bottom: 10px; + display: block; - .required-marker { - color: var(--vitamui-primary); - } + .required-marker { + color: var(--vitamui-primary); + } - small { - color: #a5a5a5; - font-size: inherit; - } + small { + color: #a5a5a5; + font-size: inherit; + } } .underline { - text-decoration: underline; - cursor: pointer; + text-decoration: underline; + cursor: pointer; } .input-file { - display: none; + display: none; } .inline-label { - padding-top: 5px; + padding-top: 5px; } // STEP 1 @@ -70,111 +70,110 @@ label { // STEP 2 .label-password-revocation-delay { - width: 255px; - margin-right: 40px; + width: 255px; + margin-right: 40px; } .field-password-revocation-delay { - width: 180px; + width: 180px; } .field-domains { - max-width: 460px; + max-width: 460px; } button.primary { - margin-right: 20px; + margin-right: 20px; } button.back { - margin-top: 60px; + margin-top: 60px; } button > small { - display: block; - font-size: 12px; - font-weight: 400; + display: block; + font-size: 12px; + font-weight: 400; } .hint { - color: #a5a5a5; - font-size: 15px; + color: #a5a5a5; + font-size: 15px; } .drag-and-drop-area { - margin-left: 10%; - width: 300px; - height: 120px; - border: 2px dashed var(--vitamui-secondary); - border-radius: 6px; - box-shadow: 0px 0px 80px rgba(163, 163, 163, 0.3); - background: $white; - margin-bottom: 60px; + margin-left: 10%; + width: 300px; + height: 120px; + border: 2px dashed var(--vitamui-secondary); + border-radius: 6px; + box-shadow: 0px 0px 80px rgba(163, 163, 163, 0.3); + background: $white; + margin-bottom: 60px; - p { - padding-top: 20px; - } + p { + padding-top: 20px; + } } .on-over { - border: 2px solid var(--vitamui-secondary); + border: 2px solid var(--vitamui-secondary); - p { - color: $white; - } + p { + color: $white; + } - .drop-area { - background: var(--vitamui-grey-900); - opacity: 0.9; - color: $white; - } + .drop-area { + background: var(--vitamui-grey-900); + opacity: 0.9; + color: $white; + } } .image-container { - position: absolute; - width: 300px; - height: 120px; - vertical-align: middle; + position: absolute; + width: 300px; + height: 120px; + vertical-align: middle; } .logo-image { - max-height: 100%; - max-width: 100%; - width: auto; - height: auto; - position: absolute; - top: 0; - bottom: 0; - left: 0; - right: 0; - margin: auto; + max-height: 100%; + max-width: 100%; + width: auto; + height: auto; + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 0; + margin: auto; } .drop-area { - position: absolute; - width: 296px; - height: 116px; + position: absolute; + width: 296px; + height: 116px; } .upload-text { - padding-top: 5%; - font-size: 15px; - line-height: 18px; - color: #a5a5a5; - - .upload { - color: var(--vitamui-secondary); - } + padding-top: 5%; + font-size: 15px; + line-height: 18px; + color: #a5a5a5; + .upload { + color: var(--vitamui-secondary); + } } .logo-drop { - font-size: 14px; - line-height: 20px; - color: var(--vitamui-grey-900); - text-align: center; - - small { - color: #a5a5a5; - } + font-size: 14px; + line-height: 20px; + color: var(--vitamui-grey-900); + text-align: center; + + small { + color: #a5a5a5; + } } diff --git a/ui/ui-frontend/projects/referential/src/app/ontology/ontology-create/ontology-create.component.ts b/ui/ui-frontend/projects/referential/src/app/ontology/ontology-create/ontology-create.component.ts index 49f5e7e9884..27cf82f5b2b 100644 --- a/ui/ui-frontend/projects/referential/src/app/ontology/ontology-create/ontology-create.component.ts +++ b/ui/ui-frontend/projects/referential/src/app/ontology/ontology-create/ontology-create.component.ts @@ -90,7 +90,7 @@ export class OntologyCreateComponent implements OnInit, OnDestroy { private formBuilder: FormBuilder, private confirmDialogService: ConfirmDialogService, private ontologyService: OntologyService, - private ontologyCreateValidator: OntologyCreateValidators + private ontologyCreateValidator: OntologyCreateValidators, ) {} ngOnInit() { @@ -132,7 +132,7 @@ export class OntologyCreateComponent implements OnInit, OnDestroy { (error: any) => { this.dialogRef.close({ success: false, action: 'none' }); console.error(error); - } + }, ); } diff --git a/ui/ui-frontend/projects/referential/src/app/ontology/ontology-create/ontology-create.module.ts b/ui/ui-frontend/projects/referential/src/app/ontology/ontology-create/ontology-create.module.ts index eb8fba7496a..112b288b83d 100644 --- a/ui/ui-frontend/projects/referential/src/app/ontology/ontology-create/ontology-create.module.ts +++ b/ui/ui-frontend/projects/referential/src/app/ontology/ontology-create/ontology-create.module.ts @@ -34,20 +34,20 @@ * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ -import {CommonModule} from '@angular/common'; -import {NgModule} from '@angular/core'; -import {ReactiveFormsModule} from '@angular/forms'; -import {MatButtonToggleModule} from '@angular/material/button-toggle'; -import {MatFormFieldModule} from '@angular/material/form-field'; -import {MatInputModule} from '@angular/material/input'; -import {MatProgressBarModule} from '@angular/material/progress-bar'; -import {MatSelectModule} from '@angular/material/select'; -import {MatSnackBarModule} from '@angular/material/snack-bar'; -import {MatTooltipModule} from '@angular/material/tooltip'; -import {VitamUICommonModule} from 'ui-frontend-common'; +import { CommonModule } from '@angular/common'; +import { NgModule } from '@angular/core'; +import { ReactiveFormsModule } from '@angular/forms'; +import { MatButtonToggleModule } from '@angular/material/button-toggle'; +import { MatFormFieldModule } from '@angular/material/form-field'; +import { MatInputModule } from '@angular/material/input'; +import { MatProgressBarModule } from '@angular/material/progress-bar'; +import { MatSelectModule } from '@angular/material/select'; +import { MatSnackBarModule } from '@angular/material/snack-bar'; +import { MatTooltipModule } from '@angular/material/tooltip'; +import { VitamUICommonModule } from 'ui-frontend-common'; -import {SharedModule} from '../../../../../identity/src/app/shared/shared.module'; -import {OntologyCreateComponent} from './ontology-create.component'; +import { SharedModule } from '../../../../../identity/src/app/shared/shared.module'; +import { OntologyCreateComponent } from './ontology-create.component'; @NgModule({ imports: [ @@ -61,12 +61,9 @@ import {OntologyCreateComponent} from './ontology-create.component'; MatSnackBarModule, MatTooltipModule, ReactiveFormsModule, - VitamUICommonModule + VitamUICommonModule, ], - declarations: [ - OntologyCreateComponent - ], - entryComponents: [OntologyCreateComponent] + declarations: [OntologyCreateComponent], + entryComponents: [OntologyCreateComponent], }) -export class OntologyCreateModule { -} +export class OntologyCreateModule {} diff --git a/ui/ui-frontend/projects/referential/src/app/ontology/ontology-create/ontology-create.validators.ts b/ui/ui-frontend/projects/referential/src/app/ontology/ontology-create/ontology-create.validators.ts index 917fbb49495..b3a732831b3 100644 --- a/ui/ui-frontend/projects/referential/src/app/ontology/ontology-create/ontology-create.validators.ts +++ b/ui/ui-frontend/projects/referential/src/app/ontology/ontology-create/ontology-create.validators.ts @@ -34,38 +34,35 @@ * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ -import {Injectable} from '@angular/core'; -import {AbstractControl, AsyncValidatorFn, ValidationErrors, ValidatorFn} from '@angular/forms'; -import {Observable, timer} from 'rxjs'; -import {map, switchMap, take} from 'rxjs/operators'; +import { Injectable } from '@angular/core'; +import { AbstractControl, AsyncValidatorFn, ValidationErrors, ValidatorFn } from '@angular/forms'; +import { Observable, timer } from 'rxjs'; +import { map, switchMap, take } from 'rxjs/operators'; -import {OntologyService} from '../ontology.service'; +import { OntologyService } from '../ontology.service'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class OntologyCreateValidators { - private debounceTime = 400; - constructor(private ontologyService: OntologyService) { - } + constructor(private ontologyService: OntologyService) {} uniqueID = (): AsyncValidatorFn => { return (control: AbstractControl): Observable => { - return timer(this.debounceTime) - .pipe( - switchMap(() => this.ontologyService.exists(control.value)), - take(1), - map((exists: boolean) => exists ? {idExists: true} : null) - ); + return timer(this.debounceTime).pipe( + switchMap(() => this.ontologyService.exists(control.value)), + take(1), + map((exists: boolean) => (exists ? { idExists: true } : null)), + ); }; - } + }; patternID = (): ValidatorFn => { return (control: AbstractControl): ValidationErrors | null => { const regexp = /^[_#\s]|\s/; - return regexp.test(control.value) ? {idPattern: true} : null; + return regexp.test(control.value) ? { idPattern: true } : null; }; - } + }; } diff --git a/ui/ui-frontend/projects/referential/src/app/ontology/ontology-list/ontology-list.component.spec.ts b/ui/ui-frontend/projects/referential/src/app/ontology/ontology-list/ontology-list.component.spec.ts index fc6e0be3bdc..98c427dabd4 100644 --- a/ui/ui-frontend/projects/referential/src/app/ontology/ontology-list/ontology-list.component.spec.ts +++ b/ui/ui-frontend/projects/referential/src/app/ontology/ontology-list/ontology-list.component.spec.ts @@ -36,13 +36,13 @@ */ import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; -import {NO_ERRORS_SCHEMA} from '@angular/core'; -import {MatDialog} from '@angular/material/dialog'; -import {Ontology} from 'projects/vitamui-library/src/public-api'; -import {of} from 'rxjs'; -import {AuthService, BASE_URL} from 'ui-frontend-common'; -import {OntologyService} from '../ontology.service'; -import {OntologyListComponent} from './ontology-list.component'; +import { NO_ERRORS_SCHEMA } from '@angular/core'; +import { MatDialog } from '@angular/material/dialog'; +import { Ontology } from 'projects/vitamui-library/src/public-api'; +import { of } from 'rxjs'; +import { AuthService, BASE_URL } from 'ui-frontend-common'; +import { OntologyService } from '../ontology.service'; +import { OntologyListComponent } from './ontology-list.component'; describe('OntologyListComponent', () => { let component: OntologyListComponent; @@ -51,19 +51,19 @@ describe('OntologyListComponent', () => { const ontologyServiceMock = { // tslint:disable-next-line:variable-name delete: (_item: Ontology) => of(null), - search: () => of(null) + search: () => of(null), }; beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ declarations: [OntologyListComponent], providers: [ - {provide: BASE_URL, useValue: ''}, - {provide: MatDialog, useValue: {}}, - {provide: OntologyService, useValue: ontologyServiceMock}, - {provide: AuthService, useValue: {user: {proofTenantIdentifier: '1'}}} + { provide: BASE_URL, useValue: '' }, + { provide: MatDialog, useValue: {} }, + { provide: OntologyService, useValue: ontologyServiceMock }, + { provide: AuthService, useValue: { user: { proofTenantIdentifier: '1' } } }, ], - schemas: [NO_ERRORS_SCHEMA] + schemas: [NO_ERRORS_SCHEMA], }).compileComponents(); })); diff --git a/ui/ui-frontend/projects/referential/src/app/ontology/ontology-list/ontology-list.component.ts b/ui/ui-frontend/projects/referential/src/app/ontology/ontology-list/ontology-list.component.ts index 50920961941..f1c9d00f173 100644 --- a/ui/ui-frontend/projects/referential/src/app/ontology/ontology-list/ontology-list.component.ts +++ b/ui/ui-frontend/projects/referential/src/app/ontology/ontology-list/ontology-list.component.ts @@ -34,22 +34,22 @@ * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ -import {Component, EventEmitter, Input, OnDestroy, OnInit, Output} from '@angular/core'; -import {MatDialog} from '@angular/material/dialog'; -import {ConfirmActionComponent} from 'projects/vitamui-library/src/public-api'; -import {merge, Subject} from 'rxjs'; -import {debounceTime, filter} from 'rxjs/operators'; -import {DEFAULT_PAGE_SIZE, Direction, InfiniteScrollTable, PageRequest} from 'ui-frontend-common'; +import { Component, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core'; +import { MatDialog } from '@angular/material/dialog'; +import { ConfirmActionComponent } from 'projects/vitamui-library/src/public-api'; +import { merge, Subject } from 'rxjs'; +import { debounceTime, filter } from 'rxjs/operators'; +import { DEFAULT_PAGE_SIZE, Direction, InfiniteScrollTable, PageRequest } from 'ui-frontend-common'; -import {Ontology} from '../../../../../vitamui-library/src/lib/models/ontology'; -import {OntologyService} from '../ontology.service'; +import { Ontology } from '../../../../../vitamui-library/src/lib/models/ontology'; +import { OntologyService } from '../ontology.service'; const FILTER_DEBOUNCE_TIME_MS = 400; @Component({ selector: 'app-ontology-list', templateUrl: './ontology-list.component.html', - styleUrls: ['./ontology-list.component.scss'] + styleUrls: ['./ontology-list.component.scss'], }) export class OntologyListComponent extends InfiniteScrollTable implements OnDestroy, OnInit { // tslint:disable-next-line:no-input-rename @@ -72,23 +72,22 @@ export class OntologyListComponent extends InfiniteScrollTable impleme constructor( public ontologyService: OntologyService, - private matDialog: MatDialog + private matDialog: MatDialog, ) { super(ontologyService); } ngOnInit() { this.pending = true; - this.ontologyService.search(new PageRequest(0, DEFAULT_PAGE_SIZE, this.orderBy, Direction.ASCENDANT)) - .subscribe((data: Ontology[]) => { - this.dataSource = data; - }, - () => { - }, - () => this.pending = false); + this.ontologyService.search(new PageRequest(0, DEFAULT_PAGE_SIZE, this.orderBy, Direction.ASCENDANT)).subscribe( + (data: Ontology[]) => { + this.dataSource = data; + }, + () => {}, + () => (this.pending = false), + ); - const searchCriteriaChange = merge(this.searchChange, this.orderChange) - .pipe(debounceTime(FILTER_DEBOUNCE_TIME_MS)); + const searchCriteriaChange = merge(this.searchChange, this.orderChange).pipe(debounceTime(FILTER_DEBOUNCE_TIME_MS)); searchCriteriaChange.subscribe(() => { const query: any = this.buildOntologyCriteriaFromSearch(); @@ -119,22 +118,18 @@ export class OntologyListComponent extends InfiniteScrollTable impleme } deleteOntologyDialog(ontology: Ontology) { - const dialog = this.matDialog.open(ConfirmActionComponent, {panelClass: 'vitamui-confirm-dialog'}); + const dialog = this.matDialog.open(ConfirmActionComponent, { panelClass: 'vitamui-confirm-dialog' }); dialog.componentInstance.objectType = 'ontologie'; dialog.componentInstance.objectName = ontology.identifier; - dialog.afterClosed().pipe( - filter((result) => !!result) - ).subscribe(() => { - this.ontologyService.delete(ontology).subscribe( - () => { + dialog + .afterClosed() + .pipe(filter((result) => !!result)) + .subscribe(() => { + this.ontologyService.delete(ontology).subscribe(() => { this.searchOntologyOrdered(); - } - ); - }); - - + }); + }); } - } diff --git a/ui/ui-frontend/projects/referential/src/app/ontology/ontology-preview/ontology-information-tab/ontology-information-tab.component.html b/ui/ui-frontend/projects/referential/src/app/ontology/ontology-preview/ontology-information-tab/ontology-information-tab.component.html index 63efd7d3219..ee86a553b4c 100644 --- a/ui/ui-frontend/projects/referential/src/app/ontology/ontology-preview/ontology-information-tab/ontology-information-tab.component.html +++ b/ui/ui-frontend/projects/referential/src/app/ontology/ontology-preview/ontology-information-tab/ontology-information-tab.component.html @@ -1,56 +1,63 @@
      - -
      -
      - - -
      +
      +
      + +
      +
      -
      -
      - - - {{type.label}} - -
      - keyboard_arrow_up - keyboard_arrow_down -
      -
      -
      - -
      - - - {{collection.label}} - -
      - keyboard_arrow_up - keyboard_arrow_down -
      -
      +
      +
      + + + {{ type.label }} + +
      + keyboard_arrow_up + keyboard_arrow_down
      +
      -
      -
      - - - {{'COMMON.REQUIRED' | translate}} - - - +
      + + + {{ collection.label }} + +
      + keyboard_arrow_up + keyboard_arrow_down
      +
      +
      -
      -
      - Date de création : {{inputOntology?.creationDate | dateTime: 'dd/MM/yyyy'}} -
      +
      +
      + + + {{ 'COMMON.REQUIRED' | translate }} + + +
      +
      + +
      +
      Date de création : {{ inputOntology?.creationDate | dateTime: 'dd/MM/yyyy' }}
      +
      diff --git a/ui/ui-frontend/projects/referential/src/app/ontology/ontology-preview/ontology-information-tab/ontology-information-tab.component.spec.ts b/ui/ui-frontend/projects/referential/src/app/ontology/ontology-preview/ontology-information-tab/ontology-information-tab.component.spec.ts index 1509e310a5e..76aac80533c 100644 --- a/ui/ui-frontend/projects/referential/src/app/ontology/ontology-preview/ontology-information-tab/ontology-information-tab.component.spec.ts +++ b/ui/ui-frontend/projects/referential/src/app/ontology/ontology-preview/ontology-information-tab/ontology-information-tab.component.spec.ts @@ -1,25 +1,24 @@ -import {NO_ERRORS_SCHEMA} from '@angular/core'; -import {ComponentFixture,TestBed,waitForAsync} from '@angular/core/testing'; -import {FormBuilder,ReactiveFormsModule} from '@angular/forms'; -import {MatSelectModule} from '@angular/material/select'; -import {NoopAnimationsModule} from '@angular/platform-browser/animations'; -import {Ontology} from 'projects/vitamui-library/src/public-api'; -import {of} from 'rxjs'; -import {VitamUICommonTestModule} from 'ui-frontend-common/testing'; -import {OntologyService} from '../../ontology.service'; -import {OntologyInformationTabComponent} from './ontology-information-tab.component'; +import { NO_ERRORS_SCHEMA } from '@angular/core'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; +import { FormBuilder, ReactiveFormsModule } from '@angular/forms'; +import { MatSelectModule } from '@angular/material/select'; +import { NoopAnimationsModule } from '@angular/platform-browser/animations'; +import { Ontology } from 'projects/vitamui-library/src/public-api'; +import { of } from 'rxjs'; +import { VitamUICommonTestModule } from 'ui-frontend-common/testing'; +import { OntologyService } from '../../ontology.service'; +import { OntologyInformationTabComponent } from './ontology-information-tab.component'; - -describe('OntologyInformationTabComponent',() => { +describe('OntologyInformationTabComponent', () => { let component: OntologyInformationTabComponent; let fixture: ComponentFixture; - const ontologyServiceMock={ + const ontologyServiceMock = { // tslint:disable-next-line:variable-name - patch: (_data: any) => of(null) + patch: (_data: any) => of(null), }; - const ontologyValue: Ontology={ + const ontologyValue: Ontology = { id: 'id', tenant: 0, version: 1, @@ -32,35 +31,26 @@ describe('OntologyInformationTabComponent',() => { identifier: 'SP-000001', type: 'EXTERNAL', collections: [''], - description: 'Mon Ontologie' + description: 'Mon Ontologie', }; beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [ - ReactiveFormsModule, - VitamUICommonTestModule, - NoopAnimationsModule, - MatSelectModule - ], + imports: [ReactiveFormsModule, VitamUICommonTestModule, NoopAnimationsModule, MatSelectModule], declarations: [OntologyInformationTabComponent], - providers: [ - FormBuilder, - {provide: OntologyService,useValue: ontologyServiceMock} - ], - schemas: [NO_ERRORS_SCHEMA] - }) - .compileComponents(); + providers: [FormBuilder, { provide: OntologyService, useValue: ontologyServiceMock }], + schemas: [NO_ERRORS_SCHEMA], + }).compileComponents(); })); beforeEach(() => { - fixture=TestBed.createComponent(OntologyInformationTabComponent); - component=fixture.componentInstance; - component.inputOntology=ontologyValue; + fixture = TestBed.createComponent(OntologyInformationTabComponent); + component = fixture.componentInstance; + component.inputOntology = ontologyValue; fixture.detectChanges(); }); - it('should create',() => { + it('should create', () => { expect(component).toBeTruthy(); }); }); diff --git a/ui/ui-frontend/projects/referential/src/app/ontology/ontology-preview/ontology-information-tab/ontology-information-tab.component.ts b/ui/ui-frontend/projects/referential/src/app/ontology/ontology-preview/ontology-information-tab/ontology-information-tab.component.ts index 0a26a3f586f..4d5d226e803 100644 --- a/ui/ui-frontend/projects/referential/src/app/ontology/ontology-preview/ontology-information-tab/ontology-information-tab.component.ts +++ b/ui/ui-frontend/projects/referential/src/app/ontology/ontology-preview/ontology-information-tab/ontology-information-tab.component.ts @@ -1,51 +1,51 @@ -import {Component,EventEmitter,Input,OnInit,Output} from '@angular/core'; -import {FormBuilder,FormGroup,Validators} from '@angular/forms'; -import {Ontology} from 'projects/vitamui-library/src/public-api'; -import {Observable,of} from 'rxjs'; -import {catchError,filter,map,switchMap} from 'rxjs/operators'; -import {diff,Option} from 'ui-frontend-common'; -import {extend,isEmpty} from 'underscore'; -import {OntologyService} from '../../ontology.service'; +import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import { Ontology } from 'projects/vitamui-library/src/public-api'; +import { Observable, of } from 'rxjs'; +import { catchError, filter, map, switchMap } from 'rxjs/operators'; +import { diff, Option } from 'ui-frontend-common'; +import { extend, isEmpty } from 'underscore'; +import { OntologyService } from '../../ontology.service'; @Component({ selector: 'app-ontology-information-tab', templateUrl: './ontology-information-tab.component.html', - styleUrls: ['./ontology-information-tab.component.scss'] + styleUrls: ['./ontology-information-tab.component.scss'], }) export class OntologyInformationTabComponent implements OnInit { - @Output() updated: EventEmitter=new EventEmitter(); + @Output() updated: EventEmitter = new EventEmitter(); form: FormGroup; - isInternal=true; + isInternal = true; - submited=false; + submited = false; // FIXME: Get list from common var ? - types: Option[]=[ - {key: 'DATE',label: 'Date',info: ''}, - {key: 'TEXT',label: 'Texte',info: ''}, - {key: 'KEYWORD',label: 'Mot clé',info: ''}, - {key: 'BOOLEAN',label: 'Boolean',info: ''}, - {key: 'LONG',label: 'Long',info: ''}, - {key: 'DOUBLE',label: 'Double',info: ''}, - {key: 'ENUM',label: 'Énumérer',info: ''}, - {key: 'GEO_POINT',label: 'Point Géographique',info: ''} + types: Option[] = [ + { key: 'DATE', label: 'Date', info: '' }, + { key: 'TEXT', label: 'Texte', info: '' }, + { key: 'KEYWORD', label: 'Mot clé', info: '' }, + { key: 'BOOLEAN', label: 'Boolean', info: '' }, + { key: 'LONG', label: 'Long', info: '' }, + { key: 'DOUBLE', label: 'Double', info: '' }, + { key: 'ENUM', label: 'Énumérer', info: '' }, + { key: 'GEO_POINT', label: 'Point Géographique', info: '' }, ]; // FIXME: Get list from common var ? - collections: Option[]=[ - {key: 'Unit',label: 'Unité Archivistique',info: ''}, - {key: 'ObjectGroup',label: 'Groupe d\'objet',info: ''} + collections: Option[] = [ + { key: 'Unit', label: 'Unité Archivistique', info: '' }, + { key: 'ObjectGroup', label: "Groupe d'objet", info: '' }, ]; @Input() set inputOntology(ontology: Ontology) { - this._inputOntology=ontology; + this._inputOntology = ontology; - this.isInternal=ontology.origin==='INTERNAL'; + this.isInternal = ontology.origin === 'INTERNAL'; - if(!ontology.description) { - this._inputOntology.description=''; + if (!ontology.description) { + this._inputOntology.description = ''; } this.resetForm(this.inputOntology); @@ -61,35 +61,35 @@ export class OntologyInformationTabComponent implements OnInit { @Input() set readOnly(readOnly: boolean) { - if(readOnly&&this.form.enabled) { - this.form.disable({emitEvent: false}); - } else if(this.form.disabled) { - this.form.enable({emitEvent: false}); - this.form.get('identifier').disable({emitEvent: false}); + if (readOnly && this.form.enabled) { + this.form.disable({ emitEvent: false }); + } else if (this.form.disabled) { + this.form.enable({ emitEvent: false }); + this.form.get('identifier').disable({ emitEvent: false }); } } - previousValue=(): Ontology => { + previousValue = (): Ontology => { return this._inputOntology; - } + }; constructor( private formBuilder: FormBuilder, - private ontologyService: OntologyService + private ontologyService: OntologyService, ) { - this.form=this.formBuilder.group({ - identifier: [null,Validators.required], - shortName: [null,Validators.required], - type: [null,Validators.required], - collections: [null,Validators.required], - description: [null,Validators.required] + this.form = this.formBuilder.group({ + identifier: [null, Validators.required], + shortName: [null, Validators.required], + type: [null, Validators.required], + collections: [null, Validators.required], + description: [null, Validators.required], }); - this.form.disable({emitEvent: false}); + this.form.disable({ emitEvent: false }); } ngOnInit(): void { - if(this._inputOntology.origin==='EXTERNAL') { - this.form.enable({emitEvent: false}); + if (this._inputOntology.origin === 'EXTERNAL') { + this.form.enable({ emitEvent: false }); } } @@ -103,33 +103,35 @@ export class OntologyInformationTabComponent implements OnInit { } unchanged(): boolean { - const unchanged=JSON.stringify(diff(this.form.getRawValue(),this.previousValue()))==='{}'; + const unchanged = JSON.stringify(diff(this.form.getRawValue(), this.previousValue())) === '{}'; this.updated.emit(!unchanged); return unchanged; } prepareSubmit(): Observable { - return of(diff(this.form.getRawValue(),this.previousValue())).pipe( + return of(diff(this.form.getRawValue(), this.previousValue())).pipe( filter((formData) => !isEmpty(formData)), - map((formData) => extend({id: this.previousValue().id,identifier: this.previousValue().identifier},formData)), - switchMap((formData: {id: string,[key: string]: any}) => this.ontologyService.patch(formData).pipe(catchError(() => of(null))))); + map((formData) => extend({ id: this.previousValue().id, identifier: this.previousValue().identifier }, formData)), + switchMap((formData: { id: string; [key: string]: any }) => this.ontologyService.patch(formData).pipe(catchError(() => of(null)))), + ); } onSubmit() { - this.submited=true; - this.prepareSubmit().subscribe(() => { - this.ontologyService.get(this._inputOntology.identifier).subscribe( - response => { - this.submited=false; - this.inputOntology=response; - } - ); - },() => { - this.submited=false; - }); + this.submited = true; + this.prepareSubmit().subscribe( + () => { + this.ontologyService.get(this._inputOntology.identifier).subscribe((response) => { + this.submited = false; + this.inputOntology = response; + }); + }, + () => { + this.submited = false; + }, + ); } resetForm(ontology: Ontology) { - this.form.reset(ontology,{emitEvent: false}); + this.form.reset(ontology, { emitEvent: false }); } } diff --git a/ui/ui-frontend/projects/referential/src/app/ontology/ontology-preview/ontology-preview.component.html b/ui/ui-frontend/projects/referential/src/app/ontology/ontology-preview/ontology-preview.component.html index 189ea1ff217..1f60bfbca95 100644 --- a/ui/ui-frontend/projects/referential/src/app/ontology/ontology-preview/ontology-preview.component.html +++ b/ui/ui-frontend/projects/referential/src/app/ontology/ontology-preview/ontology-preview.component.html @@ -1,31 +1,38 @@
      -
      -
      - -
      - -
      -
      -
      {{ inputOntology?.shortName }}
      -

      {{ inputOntology?.identifier }}

      -
      -
      +
      +
      +
      -
      - - - - - - - - - - +
      +
      +
      {{ inputOntology?.shortName }}
      +

      {{ inputOntology?.identifier }}

      +
      +
      +
      + + + + + + + + + + +
      diff --git a/ui/ui-frontend/projects/referential/src/app/ontology/ontology-preview/ontology-preview.component.spec.ts b/ui/ui-frontend/projects/referential/src/app/ontology/ontology-preview/ontology-preview.component.spec.ts index 169a85bf0c8..19ebc3a8e78 100644 --- a/ui/ui-frontend/projects/referential/src/app/ontology/ontology-preview/ontology-preview.component.spec.ts +++ b/ui/ui-frontend/projects/referential/src/app/ontology/ontology-preview/ontology-preview.component.spec.ts @@ -34,12 +34,12 @@ * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ -import {CUSTOM_ELEMENTS_SCHEMA} from '@angular/core'; +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; -import {MatDialog} from '@angular/material/dialog'; +import { MatDialog } from '@angular/material/dialog'; -import {OntologyService} from '../ontology.service'; -import {OntologyPreviewComponent} from './ontology-preview.component'; +import { OntologyService } from '../ontology.service'; +import { OntologyPreviewComponent } from './ontology-preview.component'; // TODO : fix test xdescribe('OntologyPreviewComponent', () => { @@ -50,12 +50,11 @@ xdescribe('OntologyPreviewComponent', () => { TestBed.configureTestingModule({ declarations: [OntologyPreviewComponent], providers: [ - {provide: MatDialog, useValue: {}}, - {provide: OntologyService, useValue: {}} + { provide: MatDialog, useValue: {} }, + { provide: OntologyService, useValue: {} }, ], - schemas: [CUSTOM_ELEMENTS_SCHEMA] - }) - .compileComponents(); + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }).compileComponents(); })); beforeEach(() => { diff --git a/ui/ui-frontend/projects/referential/src/app/ontology/ontology-preview/ontology-preview.component.ts b/ui/ui-frontend/projects/referential/src/app/ontology/ontology-preview/ontology-preview.component.ts index e5b97ba6f6f..f324fc7017f 100644 --- a/ui/ui-frontend/projects/referential/src/app/ontology/ontology-preview/ontology-preview.component.ts +++ b/ui/ui-frontend/projects/referential/src/app/ontology/ontology-preview/ontology-preview.component.ts @@ -34,21 +34,20 @@ * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ -import {Component, EventEmitter, HostListener, Input, Output, ViewChild, AfterViewInit} from '@angular/core'; -import {MatDialog} from '@angular/material/dialog'; -import {MatTab, MatTabGroup, MatTabHeader} from '@angular/material/tabs'; -import {ConfirmActionComponent, Ontology} from 'projects/vitamui-library/src/public-api'; -import {Observable} from 'rxjs'; -import {OntologyService} from '../ontology.service'; -import {OntologyInformationTabComponent} from './ontology-information-tab/ontology-information-tab.component'; +import { Component, EventEmitter, HostListener, Input, Output, ViewChild, AfterViewInit } from '@angular/core'; +import { MatDialog } from '@angular/material/dialog'; +import { MatTab, MatTabGroup, MatTabHeader } from '@angular/material/tabs'; +import { ConfirmActionComponent, Ontology } from 'projects/vitamui-library/src/public-api'; +import { Observable } from 'rxjs'; +import { OntologyService } from '../ontology.service'; +import { OntologyInformationTabComponent } from './ontology-information-tab/ontology-information-tab.component'; @Component({ selector: 'app-ontology-preview', templateUrl: './ontology-preview.component.html', - styleUrls: ['./ontology-preview.component.scss'] + styleUrls: ['./ontology-preview.component.scss'], }) export class OntologyPreviewComponent implements AfterViewInit { - @Output() previewClose: EventEmitter = new EventEmitter(); @@ -58,15 +57,13 @@ export class OntologyPreviewComponent implements AfterViewInit { inputOntology: Ontology; // tab indexes: info = 0; history = 2; tabUpdated: boolean[] = [false, false]; - @ViewChild('tabs', {static: false}) tabs: MatTabGroup; + @ViewChild('tabs', { static: false }) tabs: MatTabGroup; tabLinks: Array = []; - @ViewChild('infoTab', {static: false}) infoTab: OntologyInformationTabComponent; + @ViewChild('infoTab', { static: false }) infoTab: OntologyInformationTabComponent; filterEvents(event: any): boolean { - return event.outDetail && ( - event.outDetail.includes('STP_UPDATE_ONTOLOGY') || - event.outDetail.includes('STP_IMPORT_ONTOLOGY')); + return event.outDetail && (event.outDetail.includes('STP_UPDATE_ONTOLOGY') || event.outDetail.includes('STP_IMPORT_ONTOLOGY')); } @HostListener('window:beforeunload', ['$event']) @@ -78,8 +75,10 @@ export class OntologyPreviewComponent implements AfterViewInit { } } - constructor(private matDialog: MatDialog, private ontologyService: OntologyService) { - } + constructor( + private matDialog: MatDialog, + private ontologyService: OntologyService, + ) {} ngAfterViewInit() { this.tabs._handleClick = this.interceptTabChange.bind(this); @@ -95,11 +94,9 @@ export class OntologyPreviewComponent implements AfterViewInit { const submitOntologyUpdate: Observable = this.tabLinks[this.tabs.selectedIndex].prepareSubmit(); submitOntologyUpdate.subscribe(() => { - this.ontologyService.get(this.inputOntology.identifier).subscribe( - response => { - this.inputOntology = response; - } - ); + this.ontologyService.get(this.inputOntology.identifier).subscribe((response) => { + this.inputOntology = response; + }); }); } else { this.tabLinks[this.tabs.selectedIndex].resetForm(this.inputOntology); @@ -116,7 +113,7 @@ export class OntologyPreviewComponent implements AfterViewInit { } async confirmAction(): Promise { - const dialog = this.matDialog.open(ConfirmActionComponent, {panelClass: 'vitamui-confirm-dialog'}); + const dialog = this.matDialog.open(ConfirmActionComponent, { panelClass: 'vitamui-confirm-dialog' }); dialog.componentInstance.dialogType = 'changeTab'; return await dialog.afterClosed().toPromise(); } @@ -124,5 +121,4 @@ export class OntologyPreviewComponent implements AfterViewInit { emitClose() { this.previewClose.emit(); } - } diff --git a/ui/ui-frontend/projects/referential/src/app/ontology/ontology-preview/ontology-preview.module.ts b/ui/ui-frontend/projects/referential/src/app/ontology/ontology-preview/ontology-preview.module.ts index 381a7a1298a..d3d2143e22c 100644 --- a/ui/ui-frontend/projects/referential/src/app/ontology/ontology-preview/ontology-preview.module.ts +++ b/ui/ui-frontend/projects/referential/src/app/ontology/ontology-preview/ontology-preview.module.ts @@ -34,23 +34,23 @@ * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ -import {CommonModule} from '@angular/common'; -import {NgModule} from '@angular/core'; -import {FormsModule, ReactiveFormsModule} from '@angular/forms'; -import {MatOptionModule} from '@angular/material/core'; -import {MatDialogModule} from '@angular/material/dialog'; -import {MatMenuModule} from '@angular/material/menu'; -import {MatProgressSpinnerModule} from '@angular/material/progress-spinner'; -import {MatSelectModule} from '@angular/material/select'; -import {MatSidenavModule} from '@angular/material/sidenav'; -import {MatSnackBarModule} from '@angular/material/snack-bar'; -import {MatTabsModule} from '@angular/material/tabs'; -import {RouterModule} from '@angular/router'; -import {VitamUILibraryModule} from 'projects/vitamui-library/src/public-api'; -import {VitamUICommonModule} from 'ui-frontend-common'; +import { CommonModule } from '@angular/common'; +import { NgModule } from '@angular/core'; +import { FormsModule, ReactiveFormsModule } from '@angular/forms'; +import { MatOptionModule } from '@angular/material/core'; +import { MatDialogModule } from '@angular/material/dialog'; +import { MatMenuModule } from '@angular/material/menu'; +import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; +import { MatSelectModule } from '@angular/material/select'; +import { MatSidenavModule } from '@angular/material/sidenav'; +import { MatSnackBarModule } from '@angular/material/snack-bar'; +import { MatTabsModule } from '@angular/material/tabs'; +import { RouterModule } from '@angular/router'; +import { VitamUILibraryModule } from 'projects/vitamui-library/src/public-api'; +import { VitamUICommonModule } from 'ui-frontend-common'; -import {OntologyInformationTabComponent} from './ontology-information-tab/ontology-information-tab.component'; -import {OntologyPreviewComponent} from './ontology-preview.component'; +import { OntologyInformationTabComponent } from './ontology-information-tab/ontology-information-tab.component'; +import { OntologyPreviewComponent } from './ontology-preview.component'; @NgModule({ imports: [ @@ -67,16 +67,9 @@ import {OntologyPreviewComponent} from './ontology-preview.component'; MatProgressSpinnerModule, MatSelectModule, MatOptionModule, - MatTabsModule + MatTabsModule, ], - declarations: [ - OntologyPreviewComponent, - OntologyInformationTabComponent - ], - exports: [ - OntologyPreviewComponent - ] - + declarations: [OntologyPreviewComponent, OntologyInformationTabComponent], + exports: [OntologyPreviewComponent], }) -export class OntologyPreviewModule { -} +export class OntologyPreviewModule {} diff --git a/ui/ui-frontend/projects/referential/src/app/ontology/ontology-routing.module.ts b/ui/ui-frontend/projects/referential/src/app/ontology/ontology-routing.module.ts index 87f0320e51e..f4ef50a6568 100644 --- a/ui/ui-frontend/projects/referential/src/app/ontology/ontology-routing.module.ts +++ b/ui/ui-frontend/projects/referential/src/app/ontology/ontology-routing.module.ts @@ -34,27 +34,22 @@ * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ -import {CommonModule} from '@angular/common'; -import {NgModule} from '@angular/core'; -import {Route, RouterModule} from '@angular/router'; -import {AppGuard, AuthGuard} from 'ui-frontend-common'; -import {OntologyComponent} from './ontology.component'; +import { CommonModule } from '@angular/common'; +import { NgModule } from '@angular/core'; +import { Route, RouterModule } from '@angular/router'; +import { AppGuard, AuthGuard } from 'ui-frontend-common'; +import { OntologyComponent } from './ontology.component'; const routes: Route[] = [ { path: '', component: OntologyComponent, canActivate: [AuthGuard, AppGuard], - data: {appId: 'ONTOLOGY_APP'} - } + data: { appId: 'ONTOLOGY_APP' }, + }, ]; - @NgModule({ - imports: [ - CommonModule, - RouterModule.forChild(routes), - ] + imports: [CommonModule, RouterModule.forChild(routes)], }) -export class OntologyRoutingModule { -} +export class OntologyRoutingModule {} diff --git a/ui/ui-frontend/projects/referential/src/app/ontology/ontology.component.html b/ui/ui-frontend/projects/referential/src/app/ontology/ontology.component.html index 740ee0e6d47..127d97766dc 100644 --- a/ui/ui-frontend/projects/referential/src/app/ontology/ontology.component.html +++ b/ui/ui-frontend/projects/referential/src/app/ontology/ontology.component.html @@ -1,36 +1,36 @@ - -
      -

      - Paramétrer les Vocabulaires -

      +

      Paramétrer les Vocabulaires

      -
      -
      -
      @@ -39,5 +39,4 @@

      - diff --git a/ui/ui-frontend/projects/referential/src/app/ontology/ontology.component.spec.ts b/ui/ui-frontend/projects/referential/src/app/ontology/ontology.component.spec.ts index ccbe0fea4aa..60437323581 100644 --- a/ui/ui-frontend/projects/referential/src/app/ontology/ontology.component.spec.ts +++ b/ui/ui-frontend/projects/referential/src/app/ontology/ontology.component.spec.ts @@ -34,28 +34,27 @@ * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ -import {Component, Input, NO_ERRORS_SCHEMA} from '@angular/core'; +import { Component, Input, NO_ERRORS_SCHEMA } from '@angular/core'; import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; -import {MatDialogModule} from '@angular/material/dialog'; -import {MatSidenavModule} from '@angular/material/sidenav'; -import {NoopAnimationsModule} from '@angular/platform-browser/animations'; -import {RouterTestingModule} from '@angular/router/testing'; -import {InjectorModule, LoggerModule} from 'ui-frontend-common'; -import {VitamUICommonTestModule} from 'ui-frontend-common/testing'; +import { MatDialogModule } from '@angular/material/dialog'; +import { MatSidenavModule } from '@angular/material/sidenav'; +import { NoopAnimationsModule } from '@angular/platform-browser/animations'; +import { RouterTestingModule } from '@angular/router/testing'; +import { InjectorModule, LoggerModule } from 'ui-frontend-common'; +import { VitamUICommonTestModule } from 'ui-frontend-common/testing'; -import {OntologyComponent} from './ontology.component'; +import { OntologyComponent } from './ontology.component'; -@Component({selector: 'app-ontology-preview', template: ''}) +@Component({ selector: 'app-ontology-preview', template: '' }) // tslint:disable-next-line:component-class-suffix class OntologyPreviewStub { @Input() accessContract: any; } -@Component({selector: 'app-ontology-list', template: ''}) +@Component({ selector: 'app-ontology-list', template: '' }) // tslint:disable-next-line:component-class-suffix -class OntologyListStub { -} +class OntologyListStub {} describe('OntologyComponent', () => { let component: OntologyComponent; @@ -63,11 +62,7 @@ describe('OntologyComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - declarations: [ - OntologyComponent, - OntologyListStub, - OntologyPreviewStub - ], + declarations: [OntologyComponent, OntologyListStub, OntologyPreviewStub], imports: [ VitamUICommonTestModule, RouterTestingModule, @@ -75,11 +70,10 @@ describe('OntologyComponent', () => { LoggerModule.forRoot(), NoopAnimationsModule, MatSidenavModule, - MatDialogModule + MatDialogModule, ], - schemas: [NO_ERRORS_SCHEMA] - }) - .compileComponents(); + schemas: [NO_ERRORS_SCHEMA], + }).compileComponents(); })); beforeEach(() => { diff --git a/ui/ui-frontend/projects/referential/src/app/ontology/ontology.component.ts b/ui/ui-frontend/projects/referential/src/app/ontology/ontology.component.ts index c72f779f3c2..7dc97fcdea1 100644 --- a/ui/ui-frontend/projects/referential/src/app/ontology/ontology.component.ts +++ b/ui/ui-frontend/projects/referential/src/app/ontology/ontology.component.ts @@ -34,34 +34,37 @@ * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ -import {Component, OnInit, ViewChild} from '@angular/core'; -import {MatDialog} from '@angular/material/dialog'; -import {ActivatedRoute} from '@angular/router'; +import { Component, OnInit, ViewChild } from '@angular/core'; +import { MatDialog } from '@angular/material/dialog'; +import { ActivatedRoute } from '@angular/router'; -import {Ontology} from 'projects/vitamui-library/src/lib/models/ontology'; -import {GlobalEventService, SidenavPage} from 'ui-frontend-common'; -import {Referential} from '../shared/vitamui-import-dialog/referential.enum'; -import {VitamUIImportDialogComponent} from '../shared/vitamui-import-dialog/vitamui-import-dialog.component'; -import {OntologyCreateComponent} from './ontology-create/ontology-create.component'; -import {OntologyListComponent} from './ontology-list/ontology-list.component'; +import { Ontology } from 'projects/vitamui-library/src/lib/models/ontology'; +import { GlobalEventService, SidenavPage } from 'ui-frontend-common'; +import { Referential } from '../shared/vitamui-import-dialog/referential.enum'; +import { VitamUIImportDialogComponent } from '../shared/vitamui-import-dialog/vitamui-import-dialog.component'; +import { OntologyCreateComponent } from './ontology-create/ontology-create.component'; +import { OntologyListComponent } from './ontology-list/ontology-list.component'; @Component({ selector: 'app-ontology', templateUrl: './ontology.component.html', - styleUrls: ['./ontology.component.scss'] + styleUrls: ['./ontology.component.scss'], }) export class OntologyComponent extends SidenavPage implements OnInit { - search = ''; - @ViewChild(OntologyListComponent, {static: true}) ontologyListComponent: OntologyListComponent; + @ViewChild(OntologyListComponent, { static: true }) ontologyListComponent: OntologyListComponent; - constructor(public dialog: MatDialog, route: ActivatedRoute, globalEventService: GlobalEventService) { + constructor( + public dialog: MatDialog, + route: ActivatedRoute, + globalEventService: GlobalEventService, + ) { super(route, globalEventService); } openCreateOntologyDialog() { - const dialogRef = this.dialog.open(OntologyCreateComponent, {panelClass: 'vitamui-modal', disableClose: true}); + const dialogRef = this.dialog.open(OntologyCreateComponent, { panelClass: 'vitamui-modal', disableClose: true }); dialogRef.afterClosed().subscribe((result) => { if (result.success) { this.refreshList(); @@ -83,20 +86,18 @@ export class OntologyComponent extends SidenavPage implements OnInit { this.search = search || ''; } - ngOnInit() { - } + ngOnInit() {} showOntology(item: Ontology) { this.openPanel(item); } openOntologyImportDialog() { - const dialogRef = this.dialog.open( - VitamUIImportDialogComponent, { - panelClass: 'vitamui-modal', - data: Referential.ONTOLOGY, - disableClose: true - }); + const dialogRef = this.dialog.open(VitamUIImportDialogComponent, { + panelClass: 'vitamui-modal', + data: Referential.ONTOLOGY, + disableClose: true, + }); dialogRef.afterClosed().subscribe((result) => { console.log('result : ', result); diff --git a/ui/ui-frontend/projects/referential/src/app/ontology/ontology.module.ts b/ui/ui-frontend/projects/referential/src/app/ontology/ontology.module.ts index e6492820727..b7713fd60bf 100644 --- a/ui/ui-frontend/projects/referential/src/app/ontology/ontology.module.ts +++ b/ui/ui-frontend/projects/referential/src/app/ontology/ontology.module.ts @@ -34,23 +34,23 @@ * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ -import {CommonModule} from '@angular/common'; -import {NgModule} from '@angular/core'; -import {MatDialogModule} from '@angular/material/dialog'; -import {MatMenuModule} from '@angular/material/menu'; -import {MatProgressSpinnerModule} from '@angular/material/progress-spinner'; -import {MatSidenavModule} from '@angular/material/sidenav'; -import {MatSnackBarModule} from '@angular/material/snack-bar'; -import {RouterModule} from '@angular/router'; -import {VitamUILibraryModule} from 'projects/vitamui-library/src/public-api'; -import {TableFilterModule, VitamUICommonModule} from 'ui-frontend-common'; +import { CommonModule } from '@angular/common'; +import { NgModule } from '@angular/core'; +import { MatDialogModule } from '@angular/material/dialog'; +import { MatMenuModule } from '@angular/material/menu'; +import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; +import { MatSidenavModule } from '@angular/material/sidenav'; +import { MatSnackBarModule } from '@angular/material/snack-bar'; +import { RouterModule } from '@angular/router'; +import { VitamUILibraryModule } from 'projects/vitamui-library/src/public-api'; +import { TableFilterModule, VitamUICommonModule } from 'ui-frontend-common'; -import {SharedModule} from '../shared/shared.module'; -import {OntologyCreateModule} from './ontology-create/ontology-create.module'; -import {OntologyListComponent} from './ontology-list/ontology-list.component'; -import {OntologyPreviewModule} from './ontology-preview/ontology-preview.module'; -import {OntologyRoutingModule} from './ontology-routing.module'; -import {OntologyComponent} from './ontology.component'; +import { SharedModule } from '../shared/shared.module'; +import { OntologyCreateModule } from './ontology-create/ontology-create.module'; +import { OntologyListComponent } from './ontology-list/ontology-list.component'; +import { OntologyPreviewModule } from './ontology-preview/ontology-preview.module'; +import { OntologyRoutingModule } from './ontology-routing.module'; +import { OntologyComponent } from './ontology.component'; @NgModule({ imports: [ @@ -67,13 +67,8 @@ import {OntologyComponent} from './ontology.component'; MatSidenavModule, MatProgressSpinnerModule, SharedModule, - TableFilterModule + TableFilterModule, ], - declarations: [ - OntologyComponent, - OntologyListComponent - ] - + declarations: [OntologyComponent, OntologyListComponent], }) -export class OntologyModule { -} +export class OntologyModule {} diff --git a/ui/ui-frontend/projects/referential/src/app/ontology/ontology.service.ts b/ui/ui-frontend/projects/referential/src/app/ontology/ontology.service.ts index cd2eff8448a..d433c6d0d6f 100644 --- a/ui/ui-frontend/projects/referential/src/app/ontology/ontology.service.ts +++ b/ui/ui-frontend/projects/referential/src/app/ontology/ontology.service.ts @@ -44,16 +44,16 @@ import { Ontology } from 'projects/vitamui-library/src/public-api'; import { OntologyApiService } from '../core/api/ontology-api.service'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class OntologyService extends SearchService { - updated = new Subject(); constructor( private ontologyApiService: OntologyApiService, private snackBarService: VitamUISnackBarService, - http: HttpClient) { + http: HttpClient, + ) { super(http, ontologyApiService, 'ALL'); } @@ -61,7 +61,7 @@ export class OntologyService extends SearchService { return this.ontologyApiService.getOne(encodeURI(id)); } - existsProperties(properties: { name?: string, identifier?: string }): Observable { + existsProperties(properties: { name?: string; identifier?: string }): Observable { const existOntology: any = {}; if (properties.name) { existOntology.name = properties.name; @@ -75,51 +75,51 @@ export class OntologyService extends SearchService { } create(ontology: Ontology) { - return this.ontologyApiService.create(ontology, this.headers) - .pipe( - tap( - (_: Ontology) => { - this.snackBarService.open({ - message: 'SNACKBAR.ONTOLOGY_CREATED', - icon: 'vitamui-icon-ontologie' - }); - }, - (error: any) => { - this.snackBarService.open({ message: error.error.message, translate: false }); - } - ) - ); + return this.ontologyApiService.create(ontology, this.headers).pipe( + tap( + (_: Ontology) => { + this.snackBarService.open({ + message: 'SNACKBAR.ONTOLOGY_CREATED', + icon: 'vitamui-icon-ontologie', + }); + }, + (error: any) => { + this.snackBarService.open({ message: error.error.message, translate: false }); + }, + ), + ); } - patch(data: { id: string, [key: string]: any }): Observable { - return this.ontologyApiService.patch(data) - .pipe( - tap((response) => this.updated.next(response)), - tap( - () => { - this.snackBarService.open({ - message: 'SNACKBAR.ONTOLOGY_UPDATED', - icon: 'vitamui-icon-ontologie' - }); - }, - (error) => { - this.snackBarService.open({ message: error.error.message, translate: false }); - } - ) - ); + patch(data: { id: string; [key: string]: any }): Observable { + return this.ontologyApiService.patch(data).pipe( + tap((response) => this.updated.next(response)), + tap( + () => { + this.snackBarService.open({ + message: 'SNACKBAR.ONTOLOGY_UPDATED', + icon: 'vitamui-icon-ontologie', + }); + }, + (error) => { + this.snackBarService.open({ message: error.error.message, translate: false }); + }, + ), + ); } delete(ontology: Ontology): Observable { return this.ontologyApiService.delete(ontology.id).pipe( - tap(() => { + tap( + () => { this.snackBarService.open({ message: 'SNACKBAR.ONTOLOGY_DELETED', - icon: 'vitamui-icon-ontologie' + icon: 'vitamui-icon-ontologie', }); }, (error) => { this.snackBarService.open({ message: error.error.message, translate: false }); - }) + }, + ), ); } @@ -130,15 +130,16 @@ export class OntologyService extends SearchService { document.body.appendChild(a); a.style.display = 'none'; - const blob = new Blob([ response ], { type: 'octet/stream' }); + const blob = new Blob([response], { type: 'octet/stream' }); const url = window.URL.createObjectURL(blob); a.href = url; a.download = 'agencies.csv'; a.click(); window.URL.revokeObjectURL(url); - }, (error) => { + }, + (error) => { this.snackBarService.open({ message: error.error.message, translate: false }); - } + }, ); } diff --git a/ui/ui-frontend/projects/referential/src/app/probative-value/probative-value-create/probative-value-create.component.scss b/ui/ui-frontend/projects/referential/src/app/probative-value/probative-value-create/probative-value-create.component.scss index 19b95290597..0935ca706b6 100644 --- a/ui/ui-frontend/projects/referential/src/app/probative-value/probative-value-create/probative-value-create.component.scss +++ b/ui/ui-frontend/projects/referential/src/app/probative-value/probative-value-create/probative-value-create.component.scss @@ -10,7 +10,7 @@ } .form-group { - padding-bottom: 30px; + padding-bottom: 30px; } label { diff --git a/ui/ui-frontend/projects/referential/src/app/probative-value/probative-value-create/probative-value-create.component.spec.ts b/ui/ui-frontend/projects/referential/src/app/probative-value/probative-value-create/probative-value-create.component.spec.ts index de082f1c62a..da580e23031 100644 --- a/ui/ui-frontend/projects/referential/src/app/probative-value/probative-value-create/probative-value-create.component.spec.ts +++ b/ui/ui-frontend/projects/referential/src/app/probative-value/probative-value-create/probative-value-create.component.spec.ts @@ -34,19 +34,19 @@ * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ -import {CUSTOM_ELEMENTS_SCHEMA} from '@angular/core'; +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; -import {FormBuilder, ReactiveFormsModule} from '@angular/forms'; -import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog'; -import {MatProgressBarModule} from '@angular/material/progress-bar'; -import {MatSelectModule} from '@angular/material/select'; -import {NoopAnimationsModule} from '@angular/platform-browser/animations'; -import {EMPTY, of} from 'rxjs'; -import {ConfirmDialogService, ExternalParametersService} from 'ui-frontend-common'; -import {VitamUICommonTestModule} from 'ui-frontend-common/testing'; +import { FormBuilder, ReactiveFormsModule } from '@angular/forms'; +import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; +import { MatProgressBarModule } from '@angular/material/progress-bar'; +import { MatSelectModule } from '@angular/material/select'; +import { NoopAnimationsModule } from '@angular/platform-browser/animations'; +import { EMPTY, of } from 'rxjs'; +import { ConfirmDialogService, ExternalParametersService } from 'ui-frontend-common'; +import { VitamUICommonTestModule } from 'ui-frontend-common/testing'; -import {ProbativeValueService} from '../probative-value.service'; -import {ProbativeValueCreateComponent} from './probative-value-create.component'; +import { ProbativeValueService } from '../probative-value.service'; +import { ProbativeValueCreateComponent } from './probative-value-create.component'; import { MatSnackBarModule } from '@angular/material/snack-bar'; describe('ProbativeValueCreateComponent', () => { @@ -56,7 +56,7 @@ describe('ProbativeValueCreateComponent', () => { beforeEach(waitForAsync(() => { const parameters: Map = new Map(); const externalParametersServiceMock = { - getUserExternalParameters: () => of(parameters) + getUserExternalParameters: () => of(parameters), }; TestBed.configureTestingModule({ @@ -66,20 +66,19 @@ describe('ProbativeValueCreateComponent', () => { NoopAnimationsModule, MatProgressBarModule, MatSnackBarModule, - VitamUICommonTestModule + VitamUICommonTestModule, ], declarations: [ProbativeValueCreateComponent], providers: [ FormBuilder, - {provide: MatDialogRef, useValue: {}}, - {provide: MAT_DIALOG_DATA, useValue: {}}, - {provide: ConfirmDialogService, useValue: {listenToEscapeKeyPress: () => EMPTY}}, - {provide: ProbativeValueService, useValue: {}}, - {provide: ExternalParametersService, useValue: externalParametersServiceMock} + { provide: MatDialogRef, useValue: {} }, + { provide: MAT_DIALOG_DATA, useValue: {} }, + { provide: ConfirmDialogService, useValue: { listenToEscapeKeyPress: () => EMPTY } }, + { provide: ProbativeValueService, useValue: {} }, + { provide: ExternalParametersService, useValue: externalParametersServiceMock }, ], - schemas: [CUSTOM_ELEMENTS_SCHEMA] - }) - .compileComponents(); + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }).compileComponents(); })); beforeEach(() => { diff --git a/ui/ui-frontend/projects/referential/src/app/probative-value/probative-value-create/probative-value-create.component.ts b/ui/ui-frontend/projects/referential/src/app/probative-value/probative-value-create/probative-value-create.component.ts index 1f12bff47ba..ed30aefc9ff 100644 --- a/ui/ui-frontend/projects/referential/src/app/probative-value/probative-value-create/probative-value-create.component.ts +++ b/ui/ui-frontend/projects/referential/src/app/probative-value/probative-value-create/probative-value-create.component.ts @@ -87,7 +87,7 @@ export class ProbativeValueCreateComponent implements OnInit { private confirmDialogService: ConfirmDialogService, private probativeValueService: ProbativeValueService, private externalParameterService: ExternalParametersService, - private snackBar: MatSnackBar + private snackBar: MatSnackBar, ) {} ngOnInit() { @@ -102,7 +102,7 @@ export class ProbativeValueCreateComponent implements OnInit { { panelClass: 'vitamui-snack-bar', duration: 10000, - } + }, ); } }); @@ -145,7 +145,7 @@ export class ProbativeValueCreateComponent implements OnInit { }, () => { this.dialogRef.close({ success: false, action: 'none' }); - } + }, ); } diff --git a/ui/ui-frontend/projects/referential/src/app/probative-value/probative-value-create/probative-value-create.module.ts b/ui/ui-frontend/projects/referential/src/app/probative-value/probative-value-create/probative-value-create.module.ts index eb298440a71..b0725bc0b8c 100644 --- a/ui/ui-frontend/projects/referential/src/app/probative-value/probative-value-create/probative-value-create.module.ts +++ b/ui/ui-frontend/projects/referential/src/app/probative-value/probative-value-create/probative-value-create.module.ts @@ -34,20 +34,20 @@ * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ -import {CommonModule} from '@angular/common'; -import {NgModule} from '@angular/core'; -import {ReactiveFormsModule} from '@angular/forms'; -import {MatButtonToggleModule} from '@angular/material/button-toggle'; -import {MatFormFieldModule} from '@angular/material/form-field'; -import {MatInputModule} from '@angular/material/input'; -import {MatProgressBarModule} from '@angular/material/progress-bar'; -import {MatSelectModule} from '@angular/material/select'; -import {MatSnackBarModule} from '@angular/material/snack-bar'; -import {VitamUILibraryModule} from 'projects/vitamui-library/src/public-api'; -import {VitamUICommonModule} from 'ui-frontend-common'; +import { CommonModule } from '@angular/common'; +import { NgModule } from '@angular/core'; +import { ReactiveFormsModule } from '@angular/forms'; +import { MatButtonToggleModule } from '@angular/material/button-toggle'; +import { MatFormFieldModule } from '@angular/material/form-field'; +import { MatInputModule } from '@angular/material/input'; +import { MatProgressBarModule } from '@angular/material/progress-bar'; +import { MatSelectModule } from '@angular/material/select'; +import { MatSnackBarModule } from '@angular/material/snack-bar'; +import { VitamUILibraryModule } from 'projects/vitamui-library/src/public-api'; +import { VitamUICommonModule } from 'ui-frontend-common'; -import {SharedModule} from '../../shared/shared.module'; -import {ProbativeValueCreateComponent} from './probative-value-create.component'; +import { SharedModule } from '../../shared/shared.module'; +import { ProbativeValueCreateComponent } from './probative-value-create.component'; @NgModule({ declarations: [ProbativeValueCreateComponent], @@ -62,9 +62,8 @@ import {ProbativeValueCreateComponent} from './probative-value-create.component' MatSnackBarModule, ReactiveFormsModule, VitamUICommonModule, - VitamUILibraryModule + VitamUILibraryModule, ], - entryComponents: [ProbativeValueCreateComponent] + entryComponents: [ProbativeValueCreateComponent], }) -export class ProbativeValueCreateModule { -} +export class ProbativeValueCreateModule {} diff --git a/ui/ui-frontend/projects/referential/src/app/probative-value/probative-value-list/probative-value-list.component.html b/ui/ui-frontend/projects/referential/src/app/probative-value/probative-value-list/probative-value-list.component.html index d520dc1a40d..d980a3eb8c0 100644 --- a/ui/ui-frontend/projects/referential/src/app/probative-value/probative-value-list/probative-value-list.component.html +++ b/ui/ui-frontend/projects/referential/src/app/probative-value/probative-value-list/probative-value-list.component.html @@ -1,53 +1,79 @@ -
      - - - - + + + + - - - + + + - - - - - - - - - + + + + + + + + +
      -
      - Identifiant - -
      -
      -
      - Date de création - -
      -
      +
      + Identifiant + +
      +
      +
      + Date de création + +
      +
      StatutMessage
      StatutMessage
      - - {{ probativeValue?.id }}{{ probativeValue?.dateTime | dateTime: 'dd/MM/yyyy' }} - - {{ probativeValueStatus(probativeValue) }}{{ probativeValueMessage(probativeValue) }}
      + + {{ probativeValue?.id }} + {{ probativeValue?.dateTime | dateTime: 'dd/MM/yyyy' }} + + {{ probativeValueStatus(probativeValue) }} + {{ probativeValueMessage(probativeValue) }}