From 29e468e6aaa69d2687b604b380272c5ae610b6ae Mon Sep 17 00:00:00 2001 From: Chi Nguyen <6671583+cnguyen-de@users.noreply.github.com> Date: Wed, 22 Jul 2020 10:44:33 +0200 Subject: [PATCH] TSK-981: Provide frontend formatter for common IDEs (#1187) * TSK-981: tested adding prettier * TSK-981: Refined prettier and eslint configs * TSK-981: Update eslint rules * TSK-981: Updated VS Code settings and ignore folders * TSK-981: Added editor config * TSK-981: added html to prettierignore * TSK-981: tested adding prettier * TSK-981: Refined prettier and eslint configs * TSK-981: Update eslint rules * TSK-981: Updated VS Code settings and ignore folders * TSK-981: Added editor config * TSK-981: added html to prettierignore * TSK-981: reformatted code using prettier/new eslint configs --- web/.editorconfig | 14 + web/.eslintrc.js | 51 +-- web/.prettierignore | 12 + web/.prettierrc.js | 8 + web/.vscode/settings.json | 15 + web/angular.json | 25 +- web/jasmine-seed-reporter.js | 8 +- web/karma.conf.js | 18 +- web/package-lock.json | 67 ++++ web/package.json | 7 +- .../administration-routing.module.ts | 3 +- .../administration/administration.module.ts | 12 +- .../access-items-management.component.scss | 33 +- .../access-items-management.component.spec.ts | 4 +- .../access-items-management.component.ts | 97 +++--- .../classification-details.component.scss | 4 +- .../classification-details.component.spec.ts | 22 +- .../classification-details.component.ts | 138 ++++---- .../classification-list.component.scss | 10 +- .../classification-list.component.spec.ts | 39 ++- .../classification-list.component.ts | 52 +-- .../classification-overview.component.spec.ts | 23 +- .../classification-overview.component.ts | 45 ++- ...ification-types-selector.component.spec.ts | 4 +- .../import-export.component.spec.ts | 13 +- .../import-export/import-export.component.ts | 11 +- .../components/tree/tree.component.scss | 4 +- .../components/tree/tree.component.spec.ts | 14 +- .../components/tree/tree.component.ts | 76 +++-- .../type-icon/icon-type.component.spec.ts | 4 +- .../type-icon/icon-type.component.ts | 26 +- .../workbasket-access-items.component.scss | 33 +- .../workbasket-access-items.component.spec.ts | 77 +++-- .../workbasket-access-items.component.ts | 73 +++-- .../workbasket-details.component.spec.ts | 91 ++++-- .../workbasket-details.component.ts | 58 ++-- ...basket-distribution-targets.component.scss | 14 +- ...ket-distribution-targets.component.spec.ts | 104 ++++-- ...rkbasket-distribution-targets.component.ts | 151 +++++---- .../workbasket-dual-list.component.scss | 129 ++++---- .../workbasket-dual-list.component.ts | 4 +- .../workbasket-information.component.scss | 2 +- .../workbasket-information.component.spec.ts | 73 ++++- .../workbasket-information.component.ts | 91 +++--- .../workbasket-list-toolbar.component.scss | 16 +- .../workbasket-list-toolbar.component.spec.ts | 47 +-- .../workbasket-list-toolbar.component.ts | 28 +- .../workbasket-list.component.scss | 37 +-- .../workbasket-list.component.spec.ts | 61 ++-- .../workbasket-list.component.ts | 75 +++-- .../workbasket-overview.component.spec.ts | 31 +- .../workbasket-overview.component.ts | 43 ++- .../app/administration/models/tree-node.ts | 2 +- .../classification-definition.service.ts | 4 +- .../services/classification-tree.service.ts | 18 +- .../services/saving-workbaskets.service.ts | 4 +- .../services/workbasket-definition.service.ts | 8 +- web/src/app/app-routing.module.ts | 28 +- web/src/app/app.component.spec.ts | 38 +-- web/src/app/app.component.ts | 16 +- web/src/app/app.module.ts | 12 +- web/src/app/app.test.configuration.ts | 26 +- web/src/app/app.test.module.ts | 10 +- web/src/app/history/history-routing.module.ts | 5 +- web/src/app/history/history.module.ts | 10 +- .../services/task-query/task-query.service.ts | 59 ++-- .../task-query/task-query.component.scss | 28 +- .../task-query/task-query.component.spec.ts | 3 +- .../task-query/task-query.component.ts | 55 ++-- .../classification-report.component.spec.ts | 3 +- .../classification-report.component.ts | 3 +- .../components/monitor/monitor.component.ts | 6 +- .../report-table/report-table.component.scss | 12 +- .../report-table/report-table.component.ts | 17 +- .../task-report/task-report.component.spec.ts | 3 +- .../task-report/task-report.component.ts | 7 +- .../timestamp-report.component.ts | 3 +- ...rkbasket-report-due-date.component.spec.ts | 3 +- .../workbasket-report-due-date.component.ts | 3 +- ...sket-report-planned-date.component.spec.ts | 3 +- ...orkbasket-report-planned-date.component.ts | 5 +- ...et-report-query-switcher.component.spec.ts | 3 +- .../workbasket-report.component.spec.ts | 3 +- .../workbasket-report.component.ts | 3 +- web/src/app/monitor/models/chart-colors.ts | 24 +- web/src/app/monitor/monitor.module.ts | 5 +- .../services/rest-connector.service.ts | 26 +- .../date-picker/date-picker.component.spec.ts | 14 +- .../dropdown/dropdown.component.spec.ts | 3 +- .../components/dropdown/dropdown.component.ts | 3 +- .../field-error-display.component.spec.ts | 3 +- .../field-error-display.component.ts | 3 +- .../components/filter/filter.component.scss | 16 +- .../filter/filter.component.spec.ts | 4 +- .../components/filter/filter.component.ts | 27 +- .../master-and-detail.component.scss | 3 +- .../master-and-detail.component.spec.ts | 22 +- .../master-and-detail.component.ts | 14 +- .../components/nav-bar/nav-bar.component.scss | 182 +++++------ .../nav-bar/nav-bar.component.spec.ts | 22 +- .../components/nav-bar/nav-bar.component.ts | 31 +- .../no-access/no-access.component.scss | 18 +- .../no-access/no-access.component.spec.ts | 4 +- .../no-access/no-access.component.ts | 2 +- .../number-picker.component.scss | 46 +-- .../number-picker.component.spec.ts | 11 +- .../number-picker/number-picker.component.ts | 3 +- .../pagination/pagination.component.scss | 63 ++-- .../pagination/pagination.component.spec.ts | 12 +- .../popup/dialog-pop-up.component.spec.ts | 7 +- .../popup/dialog-pop-up.component.ts | 10 +- .../progress-bar/progress-bar.component.scss | 20 +- .../progress-bar.component.spec.ts | 3 +- .../progress-bar/progress-bar.component.ts | 3 +- .../components/sort/sort.component.spec.ts | 4 +- .../shared/components/sort/sort.component.ts | 8 +- .../components/spinner/spinner.component.scss | 122 ++++--- .../spinner/spinner.component.spec.ts | 3 +- .../components/spinner/spinner.component.ts | 4 +- .../components/toast/toast.component.ts | 3 +- .../type-ahead/type-ahead.component.scss | 139 ++++---- .../type-ahead/type-ahead.component.ts | 18 +- .../type-ahead/type-ahead.mock.component.ts | 18 +- .../user-information.component.scss | 106 +++--- .../user-information.component.spec.ts | 7 +- .../user-information.component.ts | 4 +- .../app/shared/guards/business-admin.guard.ts | 2 +- web/src/app/shared/guards/domain.guard.ts | 5 +- web/src/app/shared/guards/history.guard.ts | 5 +- web/src/app/shared/guards/monitor.guard.ts | 2 +- web/src/app/shared/guards/user.guard.ts | 2 +- web/src/app/shared/models/access-id.ts | 6 +- .../models/access-item-workbasket-resource.ts | 5 +- .../shared/models/access-item-workbasket.ts | 2 +- .../models/classification-paging-list.ts | 2 +- web/src/app/shared/models/customisation.ts | 19 +- .../shared/models/links-workbasket-summary.ts | 8 +- web/src/app/shared/models/links.ts | 4 +- web/src/app/shared/models/notifications.ts | 301 ++++++------------ web/src/app/shared/models/page.ts | 2 +- web/src/app/shared/models/pair.ts | 5 +- web/src/app/shared/models/user-info.ts | 6 +- web/src/app/shared/models/version.ts | 4 +- .../app/shared/models/workbasket-summary.ts | 32 +- .../app/shared/pipes/map-to-iterable.pipe.ts | 2 +- web/src/app/shared/pipes/map-values.pipe.ts | 2 +- .../app/shared/pipes/number-to-array.pipe.ts | 1 - web/src/app/shared/pipes/order-by.pipe.ts | 4 +- .../shared/pipes/remove-empty-type.pipe.ts | 2 +- .../shared/pipes/select-workbaskets.pipe.ts | 10 +- .../app/shared/pipes/spread-number.pipe.ts | 13 +- .../services/access-ids/access-ids.service.ts | 27 +- .../classification-categories.service.spec.ts | 13 +- .../classification-categories.service.ts | 8 +- .../classifications.service.ts | 28 +- .../services/domain/domain.service.mock.ts | 12 +- .../services/domain/domain.service.spec.ts | 12 +- .../shared/services/domain/domain.service.ts | 11 +- .../forms-validator.service.ts | 40 +-- .../http-client-interceptor.service.spec.ts | 9 +- .../http-client-interceptor.service.ts | 39 ++- .../notifications/notification.service.ts | 24 +- .../notifications.service.spec.ts | 36 ++- .../orientation/orientation.service.ts | 11 +- .../services/selected-route/selected-route.ts | 13 +- .../services/startup/startup.service.spec.ts | 20 +- .../services/startup/startup.service.ts | 34 +- .../taskana-engine.mock.service.ts | 5 +- .../taskana-engine/taskana-engine.service.ts | 22 +- .../shared/services/upload/upload.service.ts | 2 +- .../services/workbasket/workbasket.service.ts | 67 ++-- web/src/app/shared/shared.module.ts | 8 +- .../classification.actions.ts | 18 +- .../classification.state.ts | 131 +++++--- .../engine-configuration.selectors.ts | 10 +- .../engine-configuration.state.ts | 19 +- .../workbasket-store/workbasket.actions.ts | 44 +-- .../workbasket-store/workbasket.selectors.ts | 4 +- .../workbasket-store/workbasket.state.ts | 258 +++++++++------ web/src/app/shared/util/query-parameters.ts | 2 +- .../task-list-toolbar.component.spec.ts | 43 ++- .../task-list-toolbar.component.ts | 22 +- .../task-list/task-list.component.scss | 31 +- .../task-list/task-list.component.spec.ts | 30 +- .../task-list/task-list.component.ts | 22 +- .../task-master/task-master.component.spec.ts | 41 ++- .../task-master/task-master.component.ts | 58 ++-- .../components/task/task.component.scss | 3 +- .../components/task/task.component.spec.ts | 18 +- .../components/task/task.component.ts | 57 ++-- .../attribute.component.spec.ts | 3 +- .../attribute.component.ts | 3 +- .../custom-fields.component.spec.ts | 3 +- .../custom-fields.component.ts | 3 +- ...general-fields-extension.component.spec.ts | 3 +- .../general-fields-extension.component.ts | 3 +- .../general-fields.component.spec.ts | 28 +- .../general-fields.component.ts | 37 ++- .../taskdetails/taskdetails.component.scss | 41 +-- .../taskdetails/taskdetails.component.spec.ts | 24 +- .../taskdetails/taskdetails.component.ts | 103 +++--- .../app/workplace/models/object-reference.ts | 7 +- web/src/app/workplace/models/task-resource.ts | 4 +- web/src/app/workplace/models/task.ts | 7 +- .../app/workplace/services/task.service.ts | 59 ++-- web/src/app/workplace/workplace.module.ts | 7 +- web/src/assets/icons-fonts/README.md | 3 +- .../data-sources/environment-information.json | 2 +- .../data-sources/taskana-customization.json | 126 ++++---- web/src/polyfills.ts | 4 +- web/src/test.ts | 5 +- web/src/theme/_buttons.scss | 8 +- web/src/theme/_checkboxes.scss | 66 ++-- web/src/theme/_date-picker.scss | 5 +- web/src/theme/_forms.scss | 26 +- web/src/theme/_material_styles.scss | 74 +++-- web/src/theme/_progress-bar.scss | 51 +-- web/src/theme/_site.scss | 36 ++- web/src/theme/_table.scss | 71 ++--- web/src/theme/_tabs.scss | 56 ++-- web/src/theme/_tree.scss | 155 ++++----- web/src/theme/_type-ahead.scss | 20 +- web/src/theme/_variables.scss | 12 +- web/src/theme/animations/expand.animation.ts | 85 +++-- .../theme/animations/validation.animation.ts | 23 +- .../bootstrap-3-backward-compatibility.scss | 8 +- web/src/theme/mixin/_colors.scss | 24 +- web/src/tsconfig.app.json | 5 +- web/src/tsconfig.spec.json | 15 +- web/tsconfig.json | 9 +- 230 files changed, 3479 insertions(+), 2983 deletions(-) create mode 100644 web/.editorconfig create mode 100644 web/.prettierignore create mode 100644 web/.prettierrc.js create mode 100644 web/.vscode/settings.json diff --git a/web/.editorconfig b/web/.editorconfig new file mode 100644 index 000000000..5c50917f4 --- /dev/null +++ b/web/.editorconfig @@ -0,0 +1,14 @@ +# Editor configuration, see http://editorconfig.org +root = true + +[*] +charset = utf-8 +indent_style = space +indent_size = 2 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +[*.md] +max_line_length = off +trim_trailing_whitespace = false diff --git a/web/.eslintrc.js b/web/.eslintrc.js index a2d7c290b..421c259db 100644 --- a/web/.eslintrc.js +++ b/web/.eslintrc.js @@ -1,42 +1,17 @@ module.exports = { - "extends": [ - "airbnb-typescript/base" - ], - "env": { - "browser": true, - "node": true + extends: ['prettier/@typescript-eslint', 'plugin:prettier/recommended'], + env: { + browser: true, + node: true }, - "parser": "@typescript-eslint/parser", - "parserOptions": { - "project": "tsconfig.json", + parser: '@typescript-eslint/parser', + parserOptions: { + ecmaVersion: 2018, + sourceType: 'module', + project: './tsconfig.json', + errorOnUnknownASTType: true, + errorOnTypeScriptSyntacticAndSemanticIssues: true }, - "plugins": [ - "@typescript-eslint", - "@typescript-eslint/tslint" - ], - "rules": { - "arrow-parens": ["error", "as-needed"], - "@typescript-eslint/indent": ['error', 2], - "max-len": ["error", { "code": 140, "ignorePattern": "import *" }], // smaller than 140? - "object-curly-newline": ["error", { "ImportDeclaration": "never" }], - "quote-props": ["error", "as-needed"], - "lines-between-class-members": ["error", "always", { "exceptAfterSingleLine": true }], - "comma-dangle": ["error", "only-multiline"], - "no-underscore-dangle": ["error", { "allow": ["_links", "__karma__"] }], - "no-param-reassign": ["error", { "props": false }], - "no-plusplus" : ["error", { "allowForLoopAfterthoughts": true }], - "@typescript-eslint/no-use-before-define": ["error", { "functions": false, "classes": false }], - "@typescript-eslint/no-unused-expressions": ["error", { "allowTernary": true }], - - // all following rules SHOULD be removed - "class-methods-use-this": "off", - "import/extensions": "off", - "import/no-unresolved": "off", - "import/prefer-default-export": "off", - "max-classes-per-file": "off", - "@typescript-eslint/no-unused-vars": "off", - - // all following rules MUST be removed (mostly autofix) - "linebreak-style": ["off", "unix"], // own PR - } + plugins: ['@typescript-eslint', '@typescript-eslint/tslint'], + rules: {} }; diff --git a/web/.prettierignore b/web/.prettierignore new file mode 100644 index 000000000..519dc96d0 --- /dev/null +++ b/web/.prettierignore @@ -0,0 +1,12 @@ +*.lint.ts +**/node_modules/** +.github/** +.idea/** +.cache/** +.vscode/** +dist*/** +build/** +coverage/** +**/dist/** +out-tsc/** +**/*.html diff --git a/web/.prettierrc.js b/web/.prettierrc.js new file mode 100644 index 000000000..0b024376b --- /dev/null +++ b/web/.prettierrc.js @@ -0,0 +1,8 @@ +module.exports = { + tabWidth: 2, + semi: true, + singleQuote: true, + bracketSpacing: true, + printWidth: 120, + trailingComma: 'none' +}; diff --git a/web/.vscode/settings.json b/web/.vscode/settings.json new file mode 100644 index 000000000..7880738e9 --- /dev/null +++ b/web/.vscode/settings.json @@ -0,0 +1,15 @@ +{ + "eslint.validate": [ "javascript", "typescript", "html"], + + "eslint.options": { + "extensions": [".js", ".ts", "html"] + }, + + "editor.codeActionsOnSave": { + "source.fixAll.eslint": true, + }, + "[html]": { + "editor.formatOnSave": true, + "editor.defaultFormatter": "vscode.html-language-features" + } +} \ No newline at end of file diff --git a/web/angular.json b/web/angular.json index 9de149919..49f110b2e 100644 --- a/web/angular.json +++ b/web/angular.json @@ -16,14 +16,8 @@ "main": "src/main.ts", "tsConfig": "src/tsconfig.app.json", "polyfills": "src/polyfills.ts", - "assets": [ - "src/assets", - "src/environments/data-sources" - ], - "styles": [ - "./node_modules/@angular/material/prebuilt-themes/indigo-pink.css", - "src/theme/_main.scss" - ], + "assets": ["src/assets", "src/environments/data-sources"], + "styles": ["./node_modules/@angular/material/prebuilt-themes/indigo-pink.css", "src/theme/_main.scss"], "scripts": [ "node_modules/jquery/dist/jquery.min.js", "node_modules/popper.js/dist/umd/popper.min.js", @@ -80,23 +74,14 @@ "node_modules/popper.js/dist/umd/popper.min.js", "node_modules/bootstrap/dist/js/bootstrap.min.js" ], - "styles": [ - "./node_modules/@angular/material/prebuilt-themes/indigo-pink.css", - "src/theme/_main.scss" - ], - "assets": [ - "src/assets", - "src/environments/data-sources" - ] + "styles": ["./node_modules/@angular/material/prebuilt-themes/indigo-pink.css", "src/theme/_main.scss"], + "assets": ["src/assets", "src/environments/data-sources"] } }, "lint": { "builder": "@angular-devkit/build-angular:tslint", "options": { - "tsConfig": [ - "src/tsconfig.app.json", - "src/tsconfig.spec.json" - ], + "tsConfig": ["src/tsconfig.app.json", "src/tsconfig.spec.json"], "exclude": [] } } diff --git a/web/jasmine-seed-reporter.js b/web/jasmine-seed-reporter.js index 18caabaee..bd18f328d 100644 --- a/web/jasmine-seed-reporter.js +++ b/web/jasmine-seed-reporter.js @@ -1,13 +1,13 @@ -var SeedReporter = function(baseReporterDecorator) { +var SeedReporter = function (baseReporterDecorator) { baseReporterDecorator(this); - this.onBrowserComplete = function(browser, result) { + this.onBrowserComplete = function (browser, result) { if (result.order && result.order.random && result.order.seed) { - this.write("%s: Randomized with seed %s\n", browser, result.order.seed); + this.write('%s: Randomized with seed %s\n', browser, result.order.seed); } }; }; module.exports = { - "reporter:jasmine-seed": ["type", SeedReporter] + 'reporter:jasmine-seed': ['type', SeedReporter] }; diff --git a/web/karma.conf.js b/web/karma.conf.js index 8bb185124..428d71afe 100644 --- a/web/karma.conf.js +++ b/web/karma.conf.js @@ -21,23 +21,21 @@ module.exports = function (config) { }, clearContext: false // leave Jasmine Spec Runner output visible in browser }, - files: [ - - ], - preprocessors: { - - }, + files: [], + preprocessors: {}, mime: { 'text/x-typescript': ['ts', 'tsx'] }, coverageIstanbulReporter: { - dir: require('path').join(__dirname, 'coverage'), reports: ['html', 'lcovonly'], + dir: require('path').join(__dirname, 'coverage'), + reports: ['html', 'lcovonly'], fixWebpackSourcePaths: true }, - reporters: config.angularCli && config.angularCli.codeCoverage - ? ['progress', 'coverage-istanbul', 'jasmine-seed'] - : ['progress', 'kjhtml', 'jasmine-seed'], + reporters: + config.angularCli && config.angularCli.codeCoverage + ? ['progress', 'coverage-istanbul', 'jasmine-seed'] + : ['progress', 'kjhtml', 'jasmine-seed'], port: 9876, colors: true, logLevel: config.LOG_INFO, diff --git a/web/package-lock.json b/web/package-lock.json index b6d648517..807c53b9c 100644 --- a/web/package-lock.json +++ b/web/package-lock.json @@ -665,6 +665,7 @@ "dev": true, "optional": true, "requires": { + "bindings": "^1.5.0", "nan": "^2.12.1" } }, @@ -3166,6 +3167,16 @@ "integrity": "sha512-1Yj8h9Q+QDF5FzhMs/c9+6UntbD5MkRfRwac8DoEm9ZfUBZ7tZ55YcGVAzEe4bXsdQHEk+s9S5wsOKVdZrw0tQ==", "dev": true }, + "bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "dev": true, + "optional": true, + "requires": { + "file-uri-to-path": "1.0.0" + } + }, "blob": { "version": "0.0.5", "resolved": "https://registry.npmjs.org/blob/-/blob-0.0.5.tgz", @@ -5397,6 +5408,23 @@ "eslint-config-airbnb-base": "^14.0.0" } }, + "eslint-config-prettier": { + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-6.11.0.tgz", + "integrity": "sha512-oB8cpLWSAjOVFEJhhyMZh6NOEOtBVziaqdDQ86+qhDHFbZXoRTM7pNSvFRfW/W/L/LrQ38C99J5CGuRBBzBsdA==", + "dev": true, + "requires": { + "get-stdin": "^6.0.0" + }, + "dependencies": { + "get-stdin": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-6.0.0.tgz", + "integrity": "sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g==", + "dev": true + } + } + }, "eslint-import-resolver-node": { "version": "0.3.4", "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.4.tgz", @@ -5654,6 +5682,15 @@ } } }, + "eslint-plugin-prettier": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.4.tgz", + "integrity": "sha512-jZDa8z76klRqo+TdGDTFJSavwbnWK2ZpqGKNZ+VvweMW516pDUMmQ2koXvxEE4JhzNvTv+radye/bWGBmA6jmg==", + "dev": true, + "requires": { + "prettier-linter-helpers": "^1.0.0" + } + }, "eslint-scope": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.3.tgz", @@ -6044,6 +6081,12 @@ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" }, + "fast-diff": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.2.0.tgz", + "integrity": "sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==", + "dev": true + }, "fast-glob": { "version": "3.2.4", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.4.tgz", @@ -6132,6 +6175,13 @@ "resolved": "https://registry.npmjs.org/file-saver/-/file-saver-1.3.3.tgz", "integrity": "sha1-zdTETTqiZOrC9o7BZbx5HDSvEjI=" }, + "file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", + "dev": true, + "optional": true + }, "fileset": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/fileset/-/fileset-2.0.3.tgz", @@ -10116,6 +10166,21 @@ "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=", "dev": true }, + "prettier": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.5.tgz", + "integrity": "sha512-7PtVymN48hGcO4fGjybyBSIWDsLU4H4XlvOHfq91pz9kkGlonzwTfYkaIEwiRg/dAJF9YlbsduBAgtYLi+8cFg==", + "dev": true + }, + "prettier-linter-helpers": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", + "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==", + "dev": true, + "requires": { + "fast-diff": "^1.1.2" + } + }, "process": { "version": "0.11.10", "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", @@ -13278,6 +13343,7 @@ "dev": true, "optional": true, "requires": { + "bindings": "^1.5.0", "nan": "^2.12.1" } }, @@ -13855,6 +13921,7 @@ "dev": true, "optional": true, "requires": { + "bindings": "^1.5.0", "nan": "^2.12.1" } }, diff --git a/web/package.json b/web/package.json index 63b9c0fed..885d9d641 100644 --- a/web/package.json +++ b/web/package.json @@ -11,7 +11,9 @@ "test": "ng test --karma-config karma.conf.js --watch=false --browsers Firefox", "test:watch": "ng test --karma-config karma.conf.js --browsers Chrome", "lint": "eslint --ext .ts src", - "lint:fix": "eslint --ext .ts src --fix" + "lint:fix": "eslint --ext .ts src --fix", + "format": "prettier --write \"**/*.{js,ts,css,scss,md,json,yml}\"", + "format:html": "prettier --write \"**/*.{html,}\"" }, "private": true, "dependencies": { @@ -62,6 +64,8 @@ "eslint-config-airbnb-typescript": "6.3.1", "eslint-plugin-import": "2.22.0", "@hapi/hoek": "9.0.4", + "eslint-config-prettier": "^6.11.0", + "eslint-plugin-prettier": "^3.1.4", "jasmine-core": "3.5.0", "jasmine-spec-reporter": "4.2.1", "karma": "5.1.0", @@ -73,6 +77,7 @@ "karma-jasmine-html-reporter": "1.4.0", "moment": "2.22.1", "ng2-mock-component": "0.1.1", + "prettier": "^2.0.5", "protractor": "7.0.0", "ts-mockito": "2.3.0", "ts-node": "4.1.0", diff --git a/web/src/app/administration/administration-routing.module.ts b/web/src/app/administration/administration-routing.module.ts index 00da58cbb..47644ef12 100644 --- a/web/src/app/administration/administration-routing.module.ts +++ b/web/src/app/administration/administration-routing.module.ts @@ -75,5 +75,4 @@ const routes: Routes = [ imports: [RouterModule.forChild(routes)], exports: [RouterModule] }) -export class AdministrationRoutingModule { -} +export class AdministrationRoutingModule {} diff --git a/web/src/app/administration/administration.module.ts b/web/src/app/administration/administration.module.ts index 5d48ebfc1..1826f2d02 100644 --- a/web/src/app/administration/administration.module.ts +++ b/web/src/app/administration/administration.module.ts @@ -44,7 +44,7 @@ const MODULES = [ SharedModule, AdministrationRoutingModule, TypeaheadModule, - InfiniteScrollModule, + InfiniteScrollModule ]; const DECLARATIONS = [ @@ -66,17 +66,13 @@ const DECLARATIONS = [ @NgModule({ declarations: DECLARATIONS, - imports: [ - MODULES, - MatRadioModule - ], + imports: [MODULES, MatRadioModule], providers: [ ClassificationDefinitionService, WorkbasketDefinitionService, SavingWorkbasketService, ClassificationCategoriesService, - ImportExportService, + ImportExportService ] }) -export class AdministrationModule { -} +export class AdministrationModule {} diff --git a/web/src/app/administration/components/access-items-management/access-items-management.component.scss b/web/src/app/administration/components/access-items-management/access-items-management.component.scss index b53c62a6e..4f071fa18 100644 --- a/web/src/app/administration/components/access-items-management/access-items-management.component.scss +++ b/web/src/app/administration/components/access-items-management/access-items-management.component.scss @@ -1,36 +1,37 @@ @import '../../../../theme/colors'; .margin { - margin-top: 10px; - margin-bottom: 20px; + margin-top: 10px; + margin-bottom: 20px; } .required-header:after { - - content:" *"; - color: $invalid; + content: ' *'; + color: $invalid; } td { - &.has-changes { - border-bottom: 1px solid $brown; - } + &.has-changes { + border-bottom: 1px solid $brown; + } } .table > thead > tr > th { - max-width: 150px; - border-bottom: none; + max-width: 150px; + border-bottom: none; } .table > thead > tr:last-child > th { - max-width: 150px; - border-bottom: 2px solid $grey; + max-width: 150px; + border-bottom: 2px solid $grey; } -.wrap{ - max-width: 150px; - word-wrap:break-word; +.wrap { + max-width: 150px; + word-wrap: break-word; +} +.min-width { + min-width: 135px; } -.min-width{ min-width: 135px;} .modal-title { font-weight: bold; diff --git a/web/src/app/administration/components/access-items-management/access-items-management.component.spec.ts b/web/src/app/administration/components/access-items-management/access-items-management.component.spec.ts index 277f62a6d..870201ad2 100644 --- a/web/src/app/administration/components/access-items-management/access-items-management.component.spec.ts +++ b/web/src/app/administration/components/access-items-management/access-items-management.component.spec.ts @@ -22,8 +22,8 @@ describe('AccessItemsManagementComponent', () => { }); }; - beforeEach(done => { - configureTests(configure).then(testBed => { + beforeEach((done) => { + configureTests(configure).then((testBed) => { fixture = testBed.createComponent(AccessItemsManagementComponent); component = fixture.componentInstance; accessIdsService = testBed.get(AccessIdsService); diff --git a/web/src/app/administration/components/access-items-management/access-items-management.component.ts b/web/src/app/administration/components/access-items-management/access-items-management.component.ts index e6275acb0..7ea3ac40b 100644 --- a/web/src/app/administration/components/access-items-management/access-items-management.component.ts +++ b/web/src/app/administration/components/access-items-management/access-items-management.component.ts @@ -16,9 +16,7 @@ import { AccessIdsService } from '../../../shared/services/access-ids/access-ids import { AccessIdDefinition } from '../../../shared/models/access-id'; import { NotificationService } from '../../../shared/services/notifications/notification.service'; import { NOTIFICATION_TYPES } from '../../../shared/models/notifications'; -import { AccessItemsCustomisation, - CustomField, - getCustomFields } from '../../../shared/models/customisation'; +import { AccessItemsCustomisation, CustomField, getCustomFields } from '../../../shared/models/customisation'; import { customFieldCount } from '../../../shared/models/workbasket-access-items'; @Component({ @@ -34,22 +32,28 @@ export class AccessItemsManagementComponent implements OnInit { toggleValidationAccessIdMap = new Map(); accessId: AccessIdDefinition; groups: AccessIdDefinition[]; - sortingFields = new Map([['access-id', 'Access id'], ['workbasket-key', 'Workbasket Key']]); + sortingFields = new Map([ + ['access-id', 'Access id'], + ['workbasket-key', 'Workbasket Key'] + ]); sortModel: Sorting = new Sorting('access-id', Direction.DESC); isGroup: boolean = false; - @Select(EngineConfigurationSelectors.accessItemsCustomisation) accessItemsCustomization$: Observable; + @Select(EngineConfigurationSelectors.accessItemsCustomisation) accessItemsCustomization$: Observable< + AccessItemsCustomisation + >; customFields$: Observable; - constructor(private formBuilder: FormBuilder, + constructor( + private formBuilder: FormBuilder, private accessIdsService: AccessIdsService, private formsValidatorService: FormsValidatorService, private requestInProgressService: RequestInProgressService, - private notificationService: NotificationService) { - } + private notificationService: NotificationService + ) {} get accessItemsGroups(): FormArray { - return this.accessItemsForm ? this.accessItemsForm.get('accessItemsGroups') as FormArray : null; + return this.accessItemsForm ? (this.accessItemsForm.get('accessItemsGroups') as FormArray) : null; } ngOnInit() { @@ -57,10 +61,10 @@ export class AccessItemsManagementComponent implements OnInit { } setAccessItemsGroups(accessItems: Array) { - const AccessItemsFormGroups = accessItems.map(accessItem => this.formBuilder.group(accessItem)); - AccessItemsFormGroups.forEach(accessItemGroup => { + const AccessItemsFormGroups = accessItems.map((accessItem) => this.formBuilder.group(accessItem)); + AccessItemsFormGroups.forEach((accessItemGroup) => { accessItemGroup.controls.accessId.setValidators(Validators.required); - Object.keys(accessItemGroup.controls).forEach(key => { + Object.keys(accessItemGroup.controls).forEach((key) => { accessItemGroup.controls[key].disable(); }); }); @@ -86,16 +90,20 @@ export class AccessItemsManagementComponent implements OnInit { if (this.accessIdPrevious !== selected.accessId) { this.accessIdPrevious = selected.accessId; - this.accessIdsService.getGroupsByAccessId(selected.accessId) - .pipe(take(1)).subscribe((groups: AccessIdDefinition[]) => { - this.accessId = selected; - this.groups = groups; - this.searchForAccessItemsWorkbaskets(); - }, - error => { - this.requestInProgressService.setRequestInProgress(false); - this.notificationService.triggerError(NOTIFICATION_TYPES.FETCH_ERR, error); - }); + this.accessIdsService + .getGroupsByAccessId(selected.accessId) + .pipe(take(1)) + .subscribe( + (groups: AccessIdDefinition[]) => { + this.accessId = selected; + this.groups = groups; + this.searchForAccessItemsWorkbaskets(); + }, + (error) => { + this.requestInProgressService.setRequestInProgress(false); + this.notificationService.triggerError(NOTIFICATION_TYPES.FETCH_ERR, error); + } + ); } } @@ -110,41 +118,48 @@ export class AccessItemsManagementComponent implements OnInit { searchForAccessItemsWorkbaskets() { this.requestInProgressService.setRequestInProgress(true); - this.accessIdsService.getAccessItems( - [this.accessId, ...this.groups], - this.accessItemsForm ? this.accessItemsForm.value.accessIdFilter : undefined, - this.accessItemsForm ? this.accessItemsForm.value.workbasketKeyFilter : undefined, - this.sortModel - ).pipe(take(1)).subscribe((accessItemsResource: AccessItemWorkbasketResource) => { - this.setAccessItemsGroups(accessItemsResource ? accessItemsResource.accessItems : []); - this.requestInProgressService.setRequestInProgress(false); - }, error => { - this.requestInProgressService.setRequestInProgress(false); - this.notificationService.triggerError(NOTIFICATION_TYPES.FETCH_ERR_2, error); - }); + this.accessIdsService + .getAccessItems( + [this.accessId, ...this.groups], + this.accessItemsForm ? this.accessItemsForm.value.accessIdFilter : undefined, + this.accessItemsForm ? this.accessItemsForm.value.workbasketKeyFilter : undefined, + this.sortModel + ) + .pipe(take(1)) + .subscribe( + (accessItemsResource: AccessItemWorkbasketResource) => { + this.setAccessItemsGroups(accessItemsResource ? accessItemsResource.accessItems : []); + this.requestInProgressService.setRequestInProgress(false); + }, + (error) => { + this.requestInProgressService.setRequestInProgress(false); + this.notificationService.triggerError(NOTIFICATION_TYPES.FETCH_ERR_2, error); + } + ); } revokeAccess() { this.notificationService.showDialog( - `You are going to delete all access related: ${ - this.accessIdSelected - }. Can you confirm this action?`, + `You are going to delete all access related: ${this.accessIdSelected}. Can you confirm this action?`, this.onRemoveConfirmed.bind(this) ); } private onRemoveConfirmed() { this.requestInProgressService.setRequestInProgress(true); - this.accessIdsService.removeAccessItemsPermissions(this.accessIdSelected) - .pipe(take(1)).subscribe( + this.accessIdsService + .removeAccessItemsPermissions(this.accessIdSelected) + .pipe(take(1)) + .subscribe( () => { this.requestInProgressService.setRequestInProgress(false); this.notificationService.showToast( - NOTIFICATION_TYPES.SUCCESS_ALERT, new Map([['accessId', this.accessIdSelected]]) + NOTIFICATION_TYPES.SUCCESS_ALERT, + new Map([['accessId', this.accessIdSelected]]) ); this.searchForAccessItemsWorkbaskets(); }, - error => { + (error) => { this.requestInProgressService.setRequestInProgress(false); this.notificationService.triggerError(NOTIFICATION_TYPES.DELETE_ERR, error); } diff --git a/web/src/app/administration/components/classification-details/classification-details.component.scss b/web/src/app/administration/components/classification-details/classification-details.component.scss index 1d6f1f554..b38d91e91 100644 --- a/web/src/app/administration/components/classification-details/classification-details.component.scss +++ b/web/src/app/administration/components/classification-details/classification-details.component.scss @@ -1,5 +1,5 @@ .custom-field-row { - display:flex; + display: flex; flex-wrap: wrap; flex-direction: column; height: 40vh; @@ -9,7 +9,7 @@ .custom-field-wrapper { height: 70px; - padding: 0 15px + padding: 0 15px; } .dropdown-menu > li { cursor: pointer; diff --git a/web/src/app/administration/components/classification-details/classification-details.component.spec.ts b/web/src/app/administration/components/classification-details/classification-details.component.spec.ts index e0bb6fec4..48b562873 100644 --- a/web/src/app/administration/components/classification-details/classification-details.component.spec.ts +++ b/web/src/app/administration/components/classification-details/classification-details.component.spec.ts @@ -22,8 +22,7 @@ import { NotificationService } from '../../../shared/services/notifications/noti selector: 'taskana-dummy-detail', template: 'dummydetail' }) -class DummyDetailComponent { -} +class DummyDetailComponent {} describe('ClassificationDetailsComponent', () => { let component: ClassificationDetailsComponent; @@ -38,17 +37,22 @@ describe('ClassificationDetailsComponent', () => { testBed.configureTestingModule({ imports: [FormsModule, HttpClientModule, AngularSvgIconModule, NgxsModule.forRoot()], declarations: [ClassificationDetailsComponent, DummyDetailComponent], - providers: [MasterAndDetailService, RequestInProgressService, ClassificationsService, - HttpClient, NotificationService, + providers: [ + MasterAndDetailService, + RequestInProgressService, + ClassificationsService, + HttpClient, + NotificationService, ImportExportService, { provide: Location, useValue: locationSpy }, - { provide: Store, useValue: storeSpy }] + { provide: Store, useValue: storeSpy } + ] }); }; - beforeEach(done => { - configureTests(configure).then(testBed => { - storeSpy.select.and.callFake(selector => { + beforeEach((done) => { + configureTests(configure).then((testBed) => { + storeSpy.select.and.callFake((selector) => { switch (selector) { case EngineConfigurationSelectors.classificationsCustomisation: return of({ information: {} }); @@ -99,7 +103,7 @@ describe('ClassificationDetailsComponent', () => { expect(component).toBeTruthy(); }); - it('should enable editing of key on create and on copy', async done => { + it('should enable editing of key on create and on copy', async (done) => { component.isCreatingNewClassification = true; await fixture.detectChanges(); expect(fixture.debugElement.nativeElement.querySelector('#classification-key').disabled).toEqual(false); diff --git a/web/src/app/administration/components/classification-details/classification-details.component.ts b/web/src/app/administration/components/classification-details/classification-details.component.ts index 21d7df517..d6c8c5ea7 100644 --- a/web/src/app/administration/components/classification-details/classification-details.component.ts +++ b/web/src/app/administration/components/classification-details/classification-details.component.ts @@ -17,19 +17,19 @@ import { ClassificationSelectors } from 'app/shared/store/classification-store/c import { Location } from '@angular/common'; import { NOTIFICATION_TYPES } from '../../../shared/models/notifications'; import { NotificationService } from '../../../shared/services/notifications/notification.service'; -import { ClassificationCategoryImages, - CustomField, - getCustomFields } from '../../../shared/models/customisation'; +import { ClassificationCategoryImages, CustomField, getCustomFields } from '../../../shared/models/customisation'; import { Classification } from '../../../shared/models/classification'; import { customFieldCount } from '../../../shared/models/classification-summary'; import { CategoriesResponse } from '../../../shared/services/classification-categories/classification-categories.service'; -import { SaveCreatedClassification, +import { + SaveCreatedClassification, RemoveSelectedClassification, RestoreSelectedClassification, SaveModifiedClassification, SelectClassification, - CopyClassification } from '../../../shared/store/classification-store/classification.actions'; + CopyClassification +} from '../../../shared/store/classification-store/classification.actions'; @Component({ selector: 'taskana-administration-classification-details', @@ -63,29 +63,32 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy { private notificationsService: NotificationService, private importExportService: ImportExportService, private store: Store - ) { - } + ) {} ngOnInit() { this.customFields$ = this.store.select(EngineConfigurationSelectors.classificationsCustomisation).pipe( - map(customisation => customisation.information), + map((customisation) => customisation.information), getCustomFields(customFieldCount) ); - this.selectedClassification$.pipe(takeUntil(this.destroy$)) - .subscribe(classification => { - this.classification = { ...classification }; - this.isCreatingNewClassification = typeof this.classification.classificationId === 'undefined'; - }); - - this.importExportService.getImportingFinished().pipe(takeUntil(this.destroy$)).subscribe(() => { - this.store.dispatch(new SelectClassification(this.classification.classificationId)); + this.selectedClassification$.pipe(takeUntil(this.destroy$)).subscribe((classification) => { + this.classification = { ...classification }; + this.isCreatingNewClassification = typeof this.classification.classificationId === 'undefined'; }); + + this.importExportService + .getImportingFinished() + .pipe(takeUntil(this.destroy$)) + .subscribe(() => { + this.store.dispatch(new SelectClassification(this.classification.classificationId)); + }); } removeClassification() { - this.notificationsService.showDialog(`You are going to delete classification: ${this.classification.key}. Can you confirm this action?`, - this.removeClassificationConfirmation.bind(this)); + this.notificationsService.showDialog( + `You are going to delete classification: ${this.classification.key}. Can you confirm this action?`, + this.removeClassificationConfirmation.bind(this) + ); } isFieldValid(field: string): boolean { @@ -94,20 +97,23 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy { onSubmit() { this.formsValidatorService.formSubmitAttempt = true; - this.formsValidatorService.validateFormInformation(this.classificationForm, this.toogleValidationMap).then(value => { - if (value) { - this.onSave(); - } - }); + this.formsValidatorService + .validateFormInformation(this.classificationForm, this.toogleValidationMap) + .then((value) => { + if (value) { + this.onSave(); + } + }); } onRestore() { this.formsValidatorService.formSubmitAttempt = false; - this.store.dispatch( - new RestoreSelectedClassification(this.classification.classificationId) - ).pipe(take(1)).subscribe(() => { - this.notificationsService.showToast(NOTIFICATION_TYPES.INFO_ALERT); - }); + this.store + .dispatch(new RestoreSelectedClassification(this.classification.classificationId)) + .pipe(take(1)) + .subscribe(() => { + this.notificationsService.showToast(NOTIFICATION_TYPES.INFO_ALERT); + }); } onCopy() { @@ -123,11 +129,13 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy { } getCategoryIcon(category: string): Observable { - return this.categoryIcons$.pipe(map( - iconMap => (iconMap[category] - ? new Pair(iconMap[category], category) - : new Pair(iconMap.missing, 'Category does not match with the configuration')) - )); + return this.categoryIcons$.pipe( + map((iconMap) => + iconMap[category] + ? new Pair(iconMap[category], category) + : new Pair(iconMap.missing, 'Category does not match with the configuration') + ) + ); } spinnerRunning(value) { @@ -147,7 +155,10 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy { } getAvailableCategories(type: string): Observable { - return this.classificationTypes$.pipe(take(1), map(classTypes => classTypes[type])); + return this.classificationTypes$.pipe( + take(1), + map((classTypes) => classTypes[type]) + ); } ngOnDestroy(): void { @@ -158,26 +169,36 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy { private async onSave() { this.requestInProgressService.setRequestInProgress(true); if (typeof this.classification.classificationId === 'undefined') { - this.store.dispatch( - new SaveCreatedClassification(this.classification) - ).pipe(take(1)).subscribe(store => { - this.notificationsService.showToast( - NOTIFICATION_TYPES.SUCCESS_ALERT_2, - new Map([['classificationKey', store.classification.selectedClassification.key]]) + this.store + .dispatch(new SaveCreatedClassification(this.classification)) + .pipe(take(1)) + .subscribe( + (store) => { + this.notificationsService.showToast( + NOTIFICATION_TYPES.SUCCESS_ALERT_2, + new Map([['classificationKey', store.classification.selectedClassification.key]]) + ); + this.location.go( + this.location + .path() + .replace( + /(classifications).*/g, + `classifications/(detail:${store.classification.selectedClassification.classificationId})` + ) + ); + this.afterRequest(); + }, + (error) => { + this.notificationsService.triggerError(NOTIFICATION_TYPES.CREATE_ERR, error); + this.afterRequest(); + } ); - this.location.go(this.location.path().replace( - /(classifications).*/g, - `classifications/(detail:${store.classification.selectedClassification.classificationId})` - )); - this.afterRequest(); - }, error => { - this.notificationsService.triggerError(NOTIFICATION_TYPES.CREATE_ERR, error); - this.afterRequest(); - }); } else { try { - this.store.dispatch(new SaveModifiedClassification(this.classification)) - .pipe(take(1)).subscribe(() => { + this.store + .dispatch(new SaveModifiedClassification(this.classification)) + .pipe(take(1)) + .subscribe(() => { this.afterRequest(); this.notificationsService.showToast( NOTIFICATION_TYPES.SUCCESS_ALERT_3, @@ -202,11 +223,16 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy { } this.requestInProgressService.setRequestInProgress(true); - this.store.dispatch(new RemoveSelectedClassification()).pipe(take(1)).subscribe(() => { - this.notificationsService.showToast(NOTIFICATION_TYPES.SUCCESS_ALERT_4, - new Map([['classificationKey', this.classification.key]])); - this.afterRequest(); - }); + this.store + .dispatch(new RemoveSelectedClassification()) + .pipe(take(1)) + .subscribe(() => { + this.notificationsService.showToast( + NOTIFICATION_TYPES.SUCCESS_ALERT_4, + new Map([['classificationKey', this.classification.key]]) + ); + this.afterRequest(); + }); this.location.go(this.location.path().replace(/(classifications).*/g, 'classifications')); } } diff --git a/web/src/app/administration/components/classification-list/classification-list.component.scss b/web/src/app/administration/components/classification-list/classification-list.component.scss index 6ef54bcc2..d5850021b 100644 --- a/web/src/app/administration/components/classification-list/classification-list.component.scss +++ b/web/src/app/administration/components/classification-list/classification-list.component.scss @@ -7,12 +7,12 @@ border: none; } -.tab-align{ +.tab-align { margin-bottom: 0px; border-bottom: 1px dotted #ddd; padding: 8px 12px 8px 4px; - &>div{ - margin: 6px 0px; + & > div { + margin: 6px 0px; } } @@ -25,10 +25,10 @@ input.filter-input { } .category-filter { - margin: 7px 2px; + margin: 7px 2px; } -.dropdown-menu-classification{ +.dropdown-menu-classification { margin-left: 15px; min-width: 0px; } diff --git a/web/src/app/administration/components/classification-list/classification-list.component.spec.ts b/web/src/app/administration/components/classification-list/classification-list.component.spec.ts index d9e64b505..a4ef6d67d 100644 --- a/web/src/app/administration/components/classification-list/classification-list.component.spec.ts +++ b/web/src/app/administration/components/classification-list/classification-list.component.spec.ts @@ -28,12 +28,9 @@ import { NotificationService } from '../../../shared/services/notifications/noti selector: 'taskana-dummy-detail', template: 'dummydetail' }) -class DummyDetailComponent { -} +class DummyDetailComponent {} -const routes: Routes = [ - { path: ':id', component: DummyDetailComponent } -]; +const routes: Routes = [{ path: ':id', component: DummyDetailComponent }]; describe('ClassificationListComponent', () => { let component: ClassificationListComponent; @@ -43,19 +40,35 @@ describe('ClassificationListComponent', () => { const configure = (testBed: TestBed) => { testBed.configureTestingModule({ - declarations: [ClassificationListComponent, ImportExportComponent, ClassificationTypesSelectorComponent, - DummyDetailComponent], - imports: [HttpClientModule, RouterTestingModule.withRoutes(routes), FormsModule, AngularSvgIconModule, NgxsModule.forRoot([]), MatRadioModule], + declarations: [ + ClassificationListComponent, + ImportExportComponent, + ClassificationTypesSelectorComponent, + DummyDetailComponent + ], + imports: [ + HttpClientModule, + RouterTestingModule.withRoutes(routes), + FormsModule, + AngularSvgIconModule, + NgxsModule.forRoot([]), + MatRadioModule + ], providers: [ - HttpClient, WorkbasketDefinitionService, NotificationService, - ClassificationsService, DomainService, ClassificationDefinitionService, - RequestInProgressService, ImportExportService + HttpClient, + WorkbasketDefinitionService, + NotificationService, + ClassificationsService, + DomainService, + ClassificationDefinitionService, + RequestInProgressService, + ImportExportService ] }); }; - beforeEach(done => { - configureTests(configure).then(testBed => { + beforeEach((done) => { + configureTests(configure).then((testBed) => { fixture = testBed.createComponent(ClassificationListComponent); component = fixture.componentInstance; diff --git a/web/src/app/administration/components/classification-list/classification-list.component.ts b/web/src/app/administration/components/classification-list/classification-list.component.ts index 6ab0bc745..8595be053 100644 --- a/web/src/app/administration/components/classification-list/classification-list.component.ts +++ b/web/src/app/administration/components/classification-list/classification-list.component.ts @@ -12,8 +12,10 @@ import { ClassificationSelectors } from 'app/shared/store/classification-store/c import { Location } from '@angular/common'; import { ClassificationCategoryImages } from '../../../shared/models/customisation'; -import { GetClassifications, - CreateClassification } from '../../../shared/store/classification-store/classification.actions'; +import { + GetClassifications, + CreateClassification +} from '../../../shared/store/classification-store/classification.actions'; import { DomainService } from '../../../shared/services/domain/domain.service'; import { ClassificationSummary } from '../../../shared/models/classification-summary'; @@ -44,40 +46,38 @@ export class ClassificationListComponent implements OnInit, OnDestroy { private ngxsActions$: Actions, private domainService: DomainService ) { - this.ngxsActions$.pipe(ofActionDispatched(GetClassifications), - takeUntil(this.destroy$)) - .subscribe(() => { - this.requestInProgress = true; - }); - this.ngxsActions$.pipe(ofActionCompleted(GetClassifications), - takeUntil(this.destroy$)) - .subscribe(() => { - this.requestInProgress = false; - }); + this.ngxsActions$.pipe(ofActionDispatched(GetClassifications), takeUntil(this.destroy$)).subscribe(() => { + this.requestInProgress = true; + }); + this.ngxsActions$.pipe(ofActionCompleted(GetClassifications), takeUntil(this.destroy$)).subscribe(() => { + this.requestInProgress = false; + }); } ngOnInit() { - this.classifications$.pipe(takeUntil(this.destroy$)).subscribe(classifications => { + this.classifications$.pipe(takeUntil(this.destroy$)).subscribe((classifications) => { this.classifications = classifications; }); - this.classificationTypeSelected$ - .pipe(takeUntil(this.destroy$)) - .subscribe(() => { - this.store.dispatch(new GetClassifications()); - this.selectedCategory = ''; - }); + this.classificationTypeSelected$.pipe(takeUntil(this.destroy$)).subscribe(() => { + this.store.dispatch(new GetClassifications()); + this.selectedCategory = ''; + }); - this.importExportService.getImportingFinished() + this.importExportService + .getImportingFinished() .pipe(takeUntil(this.destroy$)) .subscribe(() => { this.store.dispatch(new GetClassifications()); }); // needed, so that the list updates, when domain gets changed (could be placed anywhere and should be removed, when domain is in store) - this.domainService.getSelectedDomain().pipe(takeUntil(this.destroy$)).subscribe(domain => { - this.store.dispatch(GetClassifications); - }); + this.domainService + .getSelectedDomain() + .pipe(takeUntil(this.destroy$)) + .subscribe((domain) => { + this.store.dispatch(GetClassifications); + }); } addClassification() { @@ -91,10 +91,10 @@ export class ClassificationListComponent implements OnInit, OnDestroy { getCategoryIcon(category: string): Observable { return this.categoryIcons$.pipe( - map( - iconMap => (iconMap[category] + map((iconMap) => + iconMap[category] ? new Pair(iconMap[category], category) - : new Pair(iconMap.missing, 'Category does not match with the configuration')) + : new Pair(iconMap.missing, 'Category does not match with the configuration') ) ); } diff --git a/web/src/app/administration/components/classification-overview/classification-overview.component.spec.ts b/web/src/app/administration/components/classification-overview/classification-overview.component.spec.ts index bffff7e54..a552db2e5 100644 --- a/web/src/app/administration/components/classification-overview/classification-overview.component.spec.ts +++ b/web/src/app/administration/components/classification-overview/classification-overview.component.spec.ts @@ -10,8 +10,7 @@ import { ClassificationOverviewComponent } from './classification-overview.compo selector: 'taskana-dummy-detail', template: 'dummydetail' }) -export class DummyDetailComponent { -} +export class DummyDetailComponent {} describe('ClassificationOverviewComponent', () => { let component: ClassificationOverviewComponent; @@ -20,21 +19,13 @@ describe('ClassificationOverviewComponent', () => { let debugElement; const locationSpy: jasmine.SpyObj = jasmine.createSpyObj('Location', ['go']); - beforeEach((() => { - const routes: Routes = [ - { path: ':id', component: DummyDetailComponent } - ]; + beforeEach(() => { + const routes: Routes = [{ path: ':id', component: DummyDetailComponent }]; TestBed.configureTestingModule({ - declarations: [ - ClassificationOverviewComponent, - DummyDetailComponent], - imports: [ - RouterTestingModule.withRoutes(routes), - NgxsModule.forRoot()], - providers: [ - { provide: Location, useValue: locationSpy }, - ], + declarations: [ClassificationOverviewComponent, DummyDetailComponent], + imports: [RouterTestingModule.withRoutes(routes), NgxsModule.forRoot()], + providers: [{ provide: Location, useValue: locationSpy }], schemas: [NO_ERRORS_SCHEMA] }); @@ -44,7 +35,7 @@ describe('ClassificationOverviewComponent', () => { router = TestBed.get(Router); fixture.detectChanges(); - })); + }); it('should create', () => { expect(component).toBeTruthy(); diff --git a/web/src/app/administration/components/classification-overview/classification-overview.component.ts b/web/src/app/administration/components/classification-overview/classification-overview.component.ts index 02f8a73ae..91c5c9762 100644 --- a/web/src/app/administration/components/classification-overview/classification-overview.component.ts +++ b/web/src/app/administration/components/classification-overview/classification-overview.component.ts @@ -4,7 +4,11 @@ import { Observable, Subject } from 'rxjs'; import { Select, Store } from '@ngxs/store'; import { takeUntil } from 'rxjs/operators'; import { ClassificationSelectors } from '../../../shared/store/classification-store/classification.selectors'; -import { GetClassifications, SelectClassification, CreateClassification } from '../../../shared/store/classification-store/classification.actions'; +import { + GetClassifications, + SelectClassification, + CreateClassification +} from '../../../shared/store/classification-store/classification.actions'; import { Classification } from '../../../shared/models/classification'; @Component({ @@ -18,35 +22,28 @@ export class ClassificationOverviewComponent implements OnInit, OnDestroy { private destroy$ = new Subject(); routerParams: any; - constructor( - private route: ActivatedRoute, - private store: Store - ) { - } + constructor(private route: ActivatedRoute, private store: Store) {} ngOnInit() { if (this.route.firstChild) { - this.route.firstChild.params - .pipe(takeUntil(this.destroy$)) - .subscribe(params => { - this.routerParams = params; + this.route.firstChild.params.pipe(takeUntil(this.destroy$)).subscribe((params) => { + this.routerParams = params; - if (this.routerParams.id) { - this.showDetail = true; - this.store.dispatch(new SelectClassification(this.routerParams.id)) - .subscribe(() => this.store.dispatch(new GetClassifications())); - } - if (this.routerParams.id && this.routerParams.id.indexOf('new-classification') !== -1) { - this.store.dispatch(new CreateClassification()); - } - }); + if (this.routerParams.id) { + this.showDetail = true; + this.store + .dispatch(new SelectClassification(this.routerParams.id)) + .subscribe(() => this.store.dispatch(new GetClassifications())); + } + if (this.routerParams.id && this.routerParams.id.indexOf('new-classification') !== -1) { + this.store.dispatch(new CreateClassification()); + } + }); } - this.selectedClassification$ - .pipe(takeUntil(this.destroy$)) - .subscribe(selectedClassification => { - this.showDetail = !!selectedClassification; - }); + this.selectedClassification$.pipe(takeUntil(this.destroy$)).subscribe((selectedClassification) => { + this.showDetail = !!selectedClassification; + }); } ngOnDestroy() { diff --git a/web/src/app/administration/components/classification-types-selector/classification-types-selector.component.spec.ts b/web/src/app/administration/components/classification-types-selector/classification-types-selector.component.spec.ts index 7bec25f97..4cff37609 100644 --- a/web/src/app/administration/components/classification-types-selector/classification-types-selector.component.spec.ts +++ b/web/src/app/administration/components/classification-types-selector/classification-types-selector.component.spec.ts @@ -14,9 +14,7 @@ describe('ClassificationTypesSelectorComponent', () => { TestBed.configureTestingModule({ imports: [NgxsModule.forRoot(), MatRadioModule], declarations: [ClassificationTypesSelectorComponent], - providers: [ - { provide: Location, useValue: locationSpy }, - ] + providers: [{ provide: Location, useValue: locationSpy }] }).compileComponents(); })); diff --git a/web/src/app/administration/components/import-export/import-export.component.spec.ts b/web/src/app/administration/components/import-export/import-export.component.spec.ts index d7d4e2a09..7ec277a20 100644 --- a/web/src/app/administration/components/import-export/import-export.component.spec.ts +++ b/web/src/app/administration/components/import-export/import-export.component.spec.ts @@ -15,16 +15,21 @@ describe('ImportExportComponent', () => { let fixture: ComponentFixture; let debugElement; - beforeEach(done => { + beforeEach((done) => { const configure = (testBed: TestBed) => { testBed.configureTestingModule({ declarations: [ImportExportComponent], imports: [HttpClientModule, AngularSvgIconModule], - providers: [WorkbasketService, ClassificationDefinitionService, WorkbasketDefinitionService, NotificationService, - ImportExportService] + providers: [ + WorkbasketService, + ClassificationDefinitionService, + WorkbasketDefinitionService, + NotificationService, + ImportExportService + ] }); }; - configureTests(configure).then(testBed => { + configureTests(configure).then((testBed) => { fixture = TestBed.createComponent(ImportExportComponent); component = fixture.componentInstance; debugElement = fixture.debugElement.nativeElement; diff --git a/web/src/app/administration/components/import-export/import-export.component.ts b/web/src/app/administration/components/import-export/import-export.component.ts index 2376d97db..3daf05fbc 100644 --- a/web/src/app/administration/components/import-export/import-export.component.ts +++ b/web/src/app/administration/components/import-export/import-export.component.ts @@ -32,15 +32,12 @@ export class ImportExportComponent implements OnInit { public uploadservice: UploadService, private errorsService: NotificationService, private importExportService: ImportExportService - ) { - } + ) {} ngOnInit() { - this.domainService.getDomains().subscribe( - data => { - this.domains = data; - } - ); + this.domainService.getDomains().subscribe((data) => { + this.domains = data; + }); } export(domain = '') { diff --git a/web/src/app/administration/components/tree/tree.component.scss b/web/src/app/administration/components/tree/tree.component.scss index 713544699..b37cc00e8 100644 --- a/web/src/app/administration/components/tree/tree.component.scss +++ b/web/src/app/administration/components/tree/tree.component.scss @@ -1,5 +1,5 @@ -.text-top{ - vertical-align: text-top; +.text-top { + vertical-align: text-top; } svg-icon.blue.fa-fw { diff --git a/web/src/app/administration/components/tree/tree.component.spec.ts b/web/src/app/administration/components/tree/tree.component.spec.ts index 0a66fe7a6..f7158f743 100644 --- a/web/src/app/administration/components/tree/tree.component.spec.ts +++ b/web/src/app/administration/components/tree/tree.component.spec.ts @@ -37,16 +37,18 @@ describe('TaskanaTreeComponent', () => { testBed.configureTestingModule({ imports: [AngularSvgIconModule, HttpClientModule, NgxsModule.forRoot()], declarations: [TreeVendorComponent], - providers: [ClassificationsService, + providers: [ + ClassificationsService, { provide: Location, useValue: locationSpy }, - { provide: Store, useValue: storeSpy }] + { provide: Store, useValue: storeSpy } + ] }); }; - beforeEach(done => { - configureTests(configure).then(testBed => { + beforeEach((done) => { + configureTests(configure).then((testBed) => { locationSpy.path.and.callFake(() => ''); - storeSpy.select.and.callFake(selector => { + storeSpy.select.and.callFake((selector) => { switch (selector) { case ClassificationSelectors.selectedClassificationId: return of('id4'); @@ -96,7 +98,7 @@ describe('TaskanaTreeComponent', () => { name: 'classification4', description: 'description', priority: 1, - serviceLevel: 'level', + serviceLevel: 'level' }; // using parameter 'any' since getClassification is a private method diff --git a/web/src/app/administration/components/tree/tree.component.ts b/web/src/app/administration/components/tree/tree.component.ts index 5b3945e84..a19fdd367 100644 --- a/web/src/app/administration/components/tree/tree.component.ts +++ b/web/src/app/administration/components/tree/tree.component.ts @@ -1,4 +1,5 @@ -import { AfterViewChecked, +import { + AfterViewChecked, Component, ElementRef, EventEmitter, @@ -7,7 +8,8 @@ import { AfterViewChecked, OnDestroy, OnInit, Output, - ViewChild } from '@angular/core'; + ViewChild +} from '@angular/core'; import { TreeNodeModel } from 'app/administration/models/tree-node'; import { ITreeOptions, KEYS, TREE_ACTIONS, TreeComponent } from 'angular-tree-component'; @@ -24,15 +26,17 @@ import { Classification } from '../../../shared/models/classification'; import { ClassificationsService } from '../../../shared/services/classifications/classifications.service'; import { ClassificationCategoryImages } from '../../../shared/models/customisation'; import { ClassificationSelectors } from '../../../shared/store/classification-store/classification.selectors'; -import { DeselectClassification, +import { + DeselectClassification, SelectClassification, - UpdateClassification } from '../../../shared/store/classification-store/classification.actions'; + UpdateClassification +} from '../../../shared/store/classification-store/classification.actions'; import { ClassificationTreeService } from '../../services/classification-tree.service'; @Component({ selector: 'taskana-administration-tree', templateUrl: './tree.component.html', - styleUrls: ['./tree.component.scss'], + styleUrls: ['./tree.component.scss'] }) export class TaskanaTreeComponent implements OnInit, AfterViewChecked, OnDestroy { treeNodes: TreeNodeModel[]; @@ -75,8 +79,7 @@ export class TaskanaTreeComponent implements OnInit, AfterViewChecked, OnDestroy private store: Store, private notificationsService: NotificationService, private classificationTreeService: ClassificationTreeService - ) { - } + ) {} @HostListener('document:click', ['$event']) onDocumentClick(event) { @@ -87,11 +90,12 @@ export class TaskanaTreeComponent implements OnInit, AfterViewChecked, OnDestroy ngOnInit() { const computedTreeNodes$: Observable = this.classifications$.pipe( - filter(classifications => typeof (classifications) !== 'undefined'), - map(classifications => this.classificationTreeService.transformToTreeNode(classifications)) + filter((classifications) => typeof classifications !== 'undefined'), + map((classifications) => this.classificationTreeService.transformToTreeNode(classifications)) ); - combineLatest([this.selectedClassificationId$, computedTreeNodes$]).pipe(takeUntil(this.destroy$)) + combineLatest([this.selectedClassificationId$, computedTreeNodes$]) + .pipe(takeUntil(this.destroy$)) .subscribe(([selectedClassificationId, treeNodes]) => { this.treeNodes = treeNodes; this.selectNodeId = typeof selectedClassificationId !== 'undefined' ? selectedClassificationId : undefined; @@ -122,8 +126,7 @@ export class TaskanaTreeComponent implements OnInit, AfterViewChecked, OnDestroy } } - if (this.filterTextOld !== this.filterText - || this.filterIconOld !== this.filterIcon) { + if (this.filterTextOld !== this.filterText || this.filterIconOld !== this.filterIcon) { this.filterIconOld = this.filterIcon; this.filterTextOld = this.filterText; this.filterNodes(this.filterText ? this.filterText : '', this.filterIcon); @@ -166,11 +169,13 @@ export class TaskanaTreeComponent implements OnInit, AfterViewChecked, OnDestroy } getCategoryIcon(category: string): Observable { - return this.categoryIcons$.pipe(map( - iconMap => (iconMap[category] - ? new Pair(iconMap[category], category) - : new Pair(iconMap.missing, 'Category does not match with the configuration')) - )); + return this.categoryIcons$.pipe( + map((iconMap) => + iconMap[category] + ? new Pair(iconMap[category], category) + : new Pair(iconMap.missing, 'Category does not match with the configuration') + ) + ); } switchTaskanaSpinner(active: boolean) { @@ -203,18 +208,20 @@ export class TaskanaTreeComponent implements OnInit, AfterViewChecked, OnDestroy } private filterNodes(text, iconText) { - this.tree.treeModel.filterNodes(node => TaskanaTreeComponent.checkNameAndKey(node, text) - && TaskanaTreeComponent.checkIcon(node, iconText)); + this.tree.treeModel.filterNodes( + (node) => TaskanaTreeComponent.checkNameAndKey(node, text) && TaskanaTreeComponent.checkIcon(node, iconText) + ); } private static checkNameAndKey(node: any, text: string): boolean { - return (node.data.name.toUpperCase().includes(text.toUpperCase()) - || node.data.key.toUpperCase().includes(text.toUpperCase())); + return ( + node.data.name.toUpperCase().includes(text.toUpperCase()) || + node.data.key.toUpperCase().includes(text.toUpperCase()) + ); } private static checkIcon(node: any, iconText: string): boolean { - return (node.data.category.toUpperCase() === iconText.toUpperCase() - || iconText === ''); + return node.data.category.toUpperCase() === iconText.toUpperCase() || iconText === ''; } private manageTreeState() { @@ -225,10 +232,10 @@ export class TaskanaTreeComponent implements OnInit, AfterViewChecked, OnDestroy } private checkValidElements(event): boolean { - return (this.elementRef.nativeElement.contains(event.target) - || this.elementRef.nativeElement === event.target) - && (event.target.localName === 'tree-viewport' - || event.target.localName === 'taskana-tree'); + return ( + (this.elementRef.nativeElement.contains(event.target) || this.elementRef.nativeElement === event.target) && + (event.target.localName === 'tree-viewport' || event.target.localName === 'taskana-tree') + ); } private getClassification(classificationId: string): Promise { @@ -236,14 +243,13 @@ export class TaskanaTreeComponent implements OnInit, AfterViewChecked, OnDestroy } private updateClassification(classification: Classification) { - this.store.dispatch(new UpdateClassification(classification)) - .subscribe(() => { - this.notificationsService.showToast( - NOTIFICATION_TYPES.SUCCESS_ALERT_5, - new Map([['classificationKey', classification.key]]) - ); - this.switchTaskanaSpinner(false); - }); + this.store.dispatch(new UpdateClassification(classification)).subscribe(() => { + this.notificationsService.showToast( + NOTIFICATION_TYPES.SUCCESS_ALERT_5, + new Map([['classificationKey', classification.key]]) + ); + this.switchTaskanaSpinner(false); + }); } private collapseParentNodeIfItIsTheLastChild(node: any) { diff --git a/web/src/app/administration/components/type-icon/icon-type.component.spec.ts b/web/src/app/administration/components/type-icon/icon-type.component.spec.ts index 633bda409..b380b27dc 100644 --- a/web/src/app/administration/components/type-icon/icon-type.component.spec.ts +++ b/web/src/app/administration/components/type-icon/icon-type.component.spec.ts @@ -9,13 +9,13 @@ describe('IconTypeComponent', () => { let fixture: ComponentFixture; let debugElement; - beforeEach(done => { + beforeEach((done) => { const configure = (testBed: TestBed) => { testBed.configureTestingModule({ imports: [AngularSvgIconModule, HttpClientModule] }); }; - configureTests(configure).then(testBed => { + configureTests(configure).then((testBed) => { fixture = TestBed.createComponent(IconTypeComponent); component = fixture.componentInstance; debugElement = fixture.debugElement.nativeElement; diff --git a/web/src/app/administration/components/type-icon/icon-type.component.ts b/web/src/app/administration/components/type-icon/icon-type.component.ts index b2ab632ec..3df8d99e7 100644 --- a/web/src/app/administration/components/type-icon/icon-type.component.ts +++ b/web/src/app/administration/components/type-icon/icon-type.component.ts @@ -20,20 +20,28 @@ export class IconTypeComponent implements OnInit { text: string; public static get allTypes(): Map { - return new Map([['PERSONAL', 'Personal'], ['GROUP', 'Group'], ['CLEARANCE', 'Clearance'], ['TOPIC', 'Topic']]); + return new Map([ + ['PERSONAL', 'Personal'], + ['GROUP', 'Group'], + ['CLEARANCE', 'Clearance'], + ['TOPIC', 'Topic'] + ]); } - ngOnInit() { - - } + ngOnInit() {} getIconPath(type: string) { switch (type) { - case 'PERSONAL': return 'user.svg'; - case 'GROUP': return 'users.svg'; - case 'TOPIC': return 'topic.svg'; - case 'CLEARANCE': return 'clearance.svg'; - default: return 'asterisk.svg'; + case 'PERSONAL': + return 'user.svg'; + case 'GROUP': + return 'users.svg'; + case 'TOPIC': + return 'topic.svg'; + case 'CLEARANCE': + return 'clearance.svg'; + default: + return 'asterisk.svg'; } } } diff --git a/web/src/app/administration/components/workbasket-access-items/workbasket-access-items.component.scss b/web/src/app/administration/components/workbasket-access-items/workbasket-access-items.component.scss index 4bd2fee42..61cc887f8 100644 --- a/web/src/app/administration/components/workbasket-access-items/workbasket-access-items.component.scss +++ b/web/src/app/administration/components/workbasket-access-items/workbasket-access-items.component.scss @@ -1,34 +1,33 @@ @import '../../../../theme/colors'; -td > input[type="checkbox"] { - margin-top: 0px; +td > input[type='checkbox'] { + margin-top: 0px; } .panel-body { - overflow-x: auto; + overflow-x: auto; } -.text-width{ - width: 100%; - min-width: 180px; +.text-width { + width: 100%; + min-width: 180px; } .required-header { - width: 200px; + width: 200px; } .required-header:after { - - content:" *"; - color: red; + content: ' *'; + color: red; } td { - vertical-align: bottom !important; - &.has-changes { - border-bottom: 1px solid #f0ad4e;; - } + vertical-align: bottom !important; + &.has-changes { + border-bottom: 1px solid #f0ad4e; + } } .table > thead > tr > th { - max-width: 150px; - border-bottom: none; + max-width: 150px; + border-bottom: none; } taskana-shared-type-ahead { - top: 0; + top: 0; } diff --git a/web/src/app/administration/components/workbasket-access-items/workbasket-access-items.component.spec.ts b/web/src/app/administration/components/workbasket-access-items/workbasket-access-items.component.spec.ts index 997e25ad5..db3795cd2 100644 --- a/web/src/app/administration/components/workbasket-access-items/workbasket-access-items.component.spec.ts +++ b/web/src/app/administration/components/workbasket-access-items/workbasket-access-items.component.spec.ts @@ -34,18 +34,27 @@ describe('WorkbasketAccessItemsComponent', () => { testBed.configureTestingModule({ declarations: [WorkbasketAccessItemsComponent], imports: [ - FormsModule, AngularSvgIconModule, - HttpClientModule, ReactiveFormsModule, - NgxsModule.forRoot([WorkbasketState, EngineConfigurationState])], - providers: [WorkbasketService, NotificationService, SavingWorkbasketService, RequestInProgressService, - AccessIdsService, FormsValidatorService, ClassificationCategoriesService, - { provide: Location, useValue: locationSpy }, + FormsModule, + AngularSvgIconModule, + HttpClientModule, + ReactiveFormsModule, + NgxsModule.forRoot([WorkbasketState, EngineConfigurationState]) + ], + providers: [ + WorkbasketService, + NotificationService, + SavingWorkbasketService, + RequestInProgressService, + AccessIdsService, + FormsValidatorService, + ClassificationCategoriesService, + { provide: Location, useValue: locationSpy } ] }); }; - beforeEach(done => { - configureTests(configure).then(testBed => { + beforeEach((done) => { + configureTests(configure).then((testBed) => { const store: Store = testBed.get(Store); store.reset([WorkbasketState, EngineConfigurationState]); @@ -59,31 +68,33 @@ describe('WorkbasketAccessItemsComponent', () => { workbasketService = testBed.get(WorkbasketService); notificationsService = testBed.get(NotificationService); const workbasketAccessItemsRepresentation: WorkbasketAccessItemsRepresentation = { - accessItems: [{ - accessId: 'accessID1', - workbasketId: 'id1', - workbasketKey: '1', - accessItemId: '', - accessName: '', - permRead: false, - permOpen: false, - permAppend: false, - permTransfer: false, - permDistribute: false, - permCustom1: false, - permCustom2: false, - permCustom3: false, - permCustom4: false, - permCustom5: false, - permCustom6: false, - permCustom7: false, - permCustom8: false, - permCustom9: false, - permCustom10: false, - permCustom11: false, - permCustom12: false, - _links: {}, - }], + accessItems: [ + { + accessId: 'accessID1', + workbasketId: 'id1', + workbasketKey: '1', + accessItemId: '', + accessName: '', + permRead: false, + permOpen: false, + permAppend: false, + permTransfer: false, + permDistribute: false, + permCustom1: false, + permCustom2: false, + permCustom3: false, + permCustom4: false, + permCustom5: false, + permCustom6: false, + permCustom7: false, + permCustom8: false, + permCustom9: false, + permCustom10: false, + permCustom11: false, + permCustom12: false, + _links: {} + } + ], _links: { self: { href: 'someurl' } } }; debugElement = fixture.debugElement.nativeElement; diff --git a/web/src/app/administration/components/workbasket-access-items/workbasket-access-items.component.ts b/web/src/app/administration/components/workbasket-access-items/workbasket-access-items.component.ts index 3eb1be51f..e1cec9fb3 100644 --- a/web/src/app/administration/components/workbasket-access-items/workbasket-access-items.component.ts +++ b/web/src/app/administration/components/workbasket-access-items/workbasket-access-items.component.ts @@ -1,4 +1,5 @@ -import { Component, +import { + Component, ElementRef, Input, OnChanges, @@ -6,7 +7,8 @@ import { Component, OnInit, QueryList, SimpleChanges, - ViewChildren } from '@angular/core'; + ViewChildren +} from '@angular/core'; import { Observable, Subject } from 'rxjs'; import { Select, Store } from '@ngxs/store'; import { FormArray, FormBuilder, Validators } from '@angular/forms'; @@ -27,8 +29,10 @@ import { takeUntil } from 'rxjs/operators'; import { NOTIFICATION_TYPES } from '../../../shared/models/notifications'; import { NotificationService } from '../../../shared/services/notifications/notification.service'; import { AccessItemsCustomisation, CustomField, getCustomFields } from '../../../shared/models/customisation'; -import { GetWorkbasketAccessItems, - UpdateWorkbasketAccessItems } from '../../../shared/store/workbasket-store/workbasket.actions'; +import { + GetWorkbasketAccessItems, + UpdateWorkbasketAccessItems +} from '../../../shared/store/workbasket-store/workbasket.actions'; import { WorkbasketSelectors } from '../../../shared/store/workbasket-store/workbasket.selectors'; @Component({ @@ -81,8 +85,7 @@ export class WorkbasketAccessItemsComponent implements OnInit, OnChanges, OnDest private formsValidatorService: FormsValidatorService, private notificationsService: NotificationService, private store: Store - ) { - } + ) {} get accessItemsGroups(): FormArray { return this.AccessItemsForm.get('accessItemsGroups') as FormArray; @@ -90,7 +93,7 @@ export class WorkbasketAccessItemsComponent implements OnInit, OnChanges, OnDest ngOnInit() { this.customFields$ = this.accessItemsCustomization$.pipe(getCustomFields(customFieldCount)); - this.accessItemsRepresentation$.subscribe(accessItemsRepresentation => { + this.accessItemsRepresentation$.subscribe((accessItemsRepresentation) => { if (typeof accessItemsRepresentation !== 'undefined') { this.accessItemsRepresentation = accessItemsRepresentation; this.setAccessItemsGroups(accessItemsRepresentation.accessItems); @@ -101,7 +104,7 @@ export class WorkbasketAccessItemsComponent implements OnInit, OnChanges, OnDest } ngAfterViewInit() { - this.inputs.changes.subscribe(next => { + this.inputs.changes.subscribe((next) => { if (typeof next.last !== 'undefined') { if (this.added) next.last.nativeElement.focus(); } @@ -131,7 +134,8 @@ export class WorkbasketAccessItemsComponent implements OnInit, OnChanges, OnDest this.requestInProgress = false; }); - this.savingWorkbaskets.triggeredAccessItemsSaving() + this.savingWorkbaskets + .triggeredAccessItemsSaving() .pipe(takeUntil(this.destroy$)) .subscribe((savingInformation: SavingInformation) => { if (this.action === ACTION.COPY) { @@ -144,8 +148,8 @@ export class WorkbasketAccessItemsComponent implements OnInit, OnChanges, OnDest } setAccessItemsGroups(accessItems: Array) { - const AccessItemsFormGroups = accessItems.map(accessItem => this.formBuilder.group(accessItem)); - AccessItemsFormGroups.forEach(accessItemGroup => { + const AccessItemsFormGroups = accessItems.map((accessItem) => this.formBuilder.group(accessItem)); + AccessItemsFormGroups.forEach((accessItemGroup) => { accessItemGroup.controls.accessId.setValidators(Validators.required); }); const AccessItemsFormArray = this.formBuilder.array(AccessItemsFormGroups); @@ -176,7 +180,7 @@ export class WorkbasketAccessItemsComponent implements OnInit, OnChanges, OnDest permCustom10: false, permCustom11: false, permCustom12: false, - _links: {}, + _links: {} }; } @@ -210,18 +214,25 @@ export class WorkbasketAccessItemsComponent implements OnInit, OnChanges, OnDest onSubmit() { this.formsValidatorService.formSubmitAttempt = true; - this.formsValidatorService.validateFormAccess(this.accessItemsGroups, this.toggleValidationAccessIdMap).then(value => { - if (value) { - this.onSave(); - } - }); + this.formsValidatorService + .validateFormAccess(this.accessItemsGroups, this.toggleValidationAccessIdMap) + .then((value) => { + if (value) { + this.onSave(); + } + }); } checkAll(row: number, value: any) { const checkAll = value.target.checked; const workbasketAccessItemsObj: WorkbasketAccessItems = this.createWorkbasketAccessItems(); - Object.keys(workbasketAccessItemsObj).forEach(property => { - if (property !== 'accessId' && property !== '_links' && property !== 'workbasketId' && property !== 'accessItemId') { + Object.keys(workbasketAccessItemsObj).forEach((property) => { + if ( + property !== 'accessId' && + property !== '_links' && + property !== 'workbasketId' && + property !== 'accessItemId' + ) { this.accessItemsGroups.controls[row].get(property).setValue(checkAll); } }); @@ -234,12 +245,16 @@ export class WorkbasketAccessItemsComponent implements OnInit, OnChanges, OnDest private onSave() { this.requestInProgressService.setRequestInProgress(true); - this.store.dispatch(new UpdateWorkbasketAccessItems( - this.accessItemsRepresentation._links.self.href, - this.AccessItemsForm.value.accessItemsGroups - )).subscribe(() => { - this.requestInProgressService.setRequestInProgress(false); - }); + this.store + .dispatch( + new UpdateWorkbasketAccessItems( + this.accessItemsRepresentation._links.self.href, + this.AccessItemsForm.value.accessItemsGroups + ) + ) + .subscribe(() => { + this.requestInProgressService.setRequestInProgress(false); + }); } private setBadge() { @@ -249,13 +264,13 @@ export class WorkbasketAccessItemsComponent implements OnInit, OnChanges, OnDest } private cloneAccessItems(inputaccessItem): Array { - return this.AccessItemsForm.value.accessItemsGroups.map( - (accessItems: WorkbasketAccessItems) => ({ ...accessItems }) - ); + return this.AccessItemsForm.value.accessItemsGroups.map((accessItems: WorkbasketAccessItems) => ({ + ...accessItems + })); } private setWorkbasketIdForCopy(workbasketId: string) { - this.accessItemsGroups.value.forEach(element => { + this.accessItemsGroups.value.forEach((element) => { delete element.accessItemId; element.workbasketId = workbasketId; }); diff --git a/web/src/app/administration/components/workbasket-details/workbasket-details.component.spec.ts b/web/src/app/administration/components/workbasket-details/workbasket-details.component.spec.ts index 7d2c216b7..8453633a2 100644 --- a/web/src/app/administration/components/workbasket-details/workbasket-details.component.spec.ts +++ b/web/src/app/administration/components/workbasket-details/workbasket-details.component.spec.ts @@ -33,12 +33,29 @@ import { NotificationService } from '../../../shared/services/notifications/noti selector: 'taskana-dummy-detail', template: 'dummydetail' }) -export class DummyDetailComponent { -} +export class DummyDetailComponent {} -function createWorkbasket(workbasketId?, created?, key?, domain?, type?, modified?, name?, description?, - owner?, custom1?, custom2?, custom3?, custom4?, orgLevel1?, orgLevel2?, orgLevel3?, orgLevel4?, - _links?: Links, markedForDeletion?: boolean) { +function createWorkbasket( + workbasketId?, + created?, + key?, + domain?, + type?, + modified?, + name?, + description?, + owner?, + custom1?, + custom2?, + custom3?, + custom4?, + orgLevel1?, + orgLevel2?, + orgLevel3?, + orgLevel4?, + _links?: Links, + markedForDeletion?: boolean +) { const workbasket: Workbasket = { workbasketId, created, @@ -70,29 +87,63 @@ describe('WorkbasketDetailsComponent', () => { let masterAndDetailService; let workbasketService; let router; - const workbasket = createWorkbasket('1', '', '', '', ICONTYPES.TOPIC, '', '', '', '', '', '', '', '', '', '', '', '', - {}); + const workbasket = createWorkbasket( + '1', + '', + '', + '', + ICONTYPES.TOPIC, + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + {} + ); const workbasketSummaryRepresentation: WorkbasketSummaryRepresentation = { workbaskets: [], _links: {}, page: {} }; const workbasketAccessItemsRepresentation: WorkbasketAccessItemsRepresentation = { accessItems: [], _links: {} }; - const routes: Routes = [ - { path: '*', component: DummyDetailComponent } - ]; + const routes: Routes = [{ path: '*', component: DummyDetailComponent }]; - beforeEach(done => { + beforeEach((done) => { const configure = (testBed: TestBed) => { testBed.configureTestingModule({ - imports: [RouterTestingModule.withRoutes(routes), FormsModule, AngularSvgIconModule, HttpClientModule, ReactiveFormsModule, - InfiniteScrollModule, NgxsModule.forRoot()], - declarations: [WorkbasketDetailsComponent, WorkbasketInformationComponent, + imports: [ + RouterTestingModule.withRoutes(routes), + FormsModule, + AngularSvgIconModule, + HttpClientModule, + ReactiveFormsModule, + InfiniteScrollModule, + NgxsModule.forRoot() + ], + declarations: [ + WorkbasketDetailsComponent, + WorkbasketInformationComponent, WorkbasketAccessItemsComponent, - WorkbasketDistributionTargetsComponent, WorkbasketDualListComponent, DummyDetailComponent], - providers: [WorkbasketService, MasterAndDetailService, RequestInProgressService, - NotificationService, SavingWorkbasketService, ImportExportService] + WorkbasketDistributionTargetsComponent, + WorkbasketDualListComponent, + DummyDetailComponent + ], + providers: [ + WorkbasketService, + MasterAndDetailService, + RequestInProgressService, + NotificationService, + SavingWorkbasketService, + ImportExportService + ] }); }; - configureTests(configure).then(testBed => { + configureTests(configure).then((testBed) => { fixture = TestBed.createComponent(WorkbasketDetailsComponent); component = fixture.componentInstance; debugElement = fixture.debugElement.nativeElement; @@ -106,7 +157,9 @@ describe('WorkbasketDetailsComponent', () => { spyOn(workbasketService, 'getWorkBasket').and.callFake(() => of(workbasket)); spyOn(workbasketService, 'getWorkBasketAccessItems').and.callFake(() => of(workbasketAccessItemsRepresentation)); - spyOn(workbasketService, 'getWorkBasketsDistributionTargets').and.callFake(() => of(workbasketSummaryRepresentation)); + spyOn(workbasketService, 'getWorkBasketsDistributionTargets').and.callFake(() => + of(workbasketSummaryRepresentation) + ); done(); }); }); diff --git a/web/src/app/administration/components/workbasket-details/workbasket-details.component.ts b/web/src/app/administration/components/workbasket-details/workbasket-details.component.ts index 181fd89cd..c2d202d70 100644 --- a/web/src/app/administration/components/workbasket-details/workbasket-details.component.ts +++ b/web/src/app/administration/components/workbasket-details/workbasket-details.component.ts @@ -40,34 +40,34 @@ export class WorkbasketDetailsComponent implements OnInit, OnDestroy { destroy$ = new Subject(); - constructor(private service: WorkbasketService, + constructor( + private service: WorkbasketService, private route: ActivatedRoute, private router: Router, private domainService: DomainService, private importExportService: ImportExportService, - private store: Store) { - } + private store: Store + ) {} ngOnInit() { - this.selectedWorkbasketAndAction$ - .pipe(takeUntil(this.destroy$)) - .subscribe(selectedWorkbasketAndAction => { - this.action = selectedWorkbasketAndAction.action; - if (this.action === ACTION.CREATE) { - this.tabSelected = 'information'; - this.selectedId = undefined; - this.initWorkbasket(); - } else if (this.action === ACTION.COPY) { - // delete this.workbasket.key; - this.workbasketCopy = this.workbasket; - this.getWorkbasketInformation(); - } else if (typeof selectedWorkbasketAndAction.selectedWorkbasket !== 'undefined') { - this.workbasket = { ...selectedWorkbasketAndAction.selectedWorkbasket }; - this.getWorkbasketInformation(this.workbasket); - } - }); + this.selectedWorkbasketAndAction$.pipe(takeUntil(this.destroy$)).subscribe((selectedWorkbasketAndAction) => { + this.action = selectedWorkbasketAndAction.action; + if (this.action === ACTION.CREATE) { + this.tabSelected = 'information'; + this.selectedId = undefined; + this.initWorkbasket(); + } else if (this.action === ACTION.COPY) { + // delete this.workbasket.key; + this.workbasketCopy = this.workbasket; + this.getWorkbasketInformation(); + } else if (typeof selectedWorkbasketAndAction.selectedWorkbasket !== 'undefined') { + this.workbasket = { ...selectedWorkbasketAndAction.selectedWorkbasket }; + this.getWorkbasketInformation(this.workbasket); + } + }); - this.importExportService.getImportingFinished() + this.importExportService + .getImportingFinished() .pipe(takeUntil(this.destroy$)) .subscribe(() => { if (this.workbasket) { @@ -105,15 +105,18 @@ export class WorkbasketDetailsComponent implements OnInit, OnDestroy { workbasketIdSelected = selectedWorkbasket.workbasketId; } this.requestInProgress = true; - if (!workbasketIdSelected && this.action === ACTION.CREATE) { // CREATE + if (!workbasketIdSelected && this.action === ACTION.CREATE) { + // CREATE this.workbasket = {}; - this.domainService.getSelectedDomain() + this.domainService + .getSelectedDomain() .pipe(takeUntil(this.destroy$)) - .subscribe(domain => { + .subscribe((domain) => { this.workbasket.domain = domain; }); this.requestInProgress = false; - } else if (!workbasketIdSelected && this.action === ACTION.COPY) { // COPY + } else if (!workbasketIdSelected && this.action === ACTION.COPY) { + // COPY this.workbasket = { ...this.workbasketCopy }; delete this.workbasket.workbasketId; this.requestInProgress = false; @@ -126,9 +129,10 @@ export class WorkbasketDetailsComponent implements OnInit, OnDestroy { } private checkDomainAndRedirect() { - this.domainService.getSelectedDomain() + this.domainService + .getSelectedDomain() .pipe(takeUntil(this.destroy$)) - .subscribe(domain => { + .subscribe((domain) => { if (domain !== '' && this.workbasket && this.workbasket.domain !== domain) { this.backClicked(); } diff --git a/web/src/app/administration/components/workbasket-distribution-targets/workbasket-distribution-targets.component.scss b/web/src/app/administration/components/workbasket-distribution-targets/workbasket-distribution-targets.component.scss index 56ab9bb4b..ac213ad3b 100644 --- a/web/src/app/administration/components/workbasket-distribution-targets/workbasket-distribution-targets.component.scss +++ b/web/src/app/administration/components/workbasket-distribution-targets/workbasket-distribution-targets.component.scss @@ -1,15 +1,13 @@ - .button-margin-top { - margin-top: 100px + margin-top: 100px; } -.list-arrows > button{ - margin: 10px 0px; +.list-arrows > button { + margin: 10px 0px; } - .col-md-5-6 { - @media (min-width: 992px){ - width: 45.82%; - } + @media (min-width: 992px) { + width: 45.82%; + } } diff --git a/web/src/app/administration/components/workbasket-distribution-targets/workbasket-distribution-targets.component.spec.ts b/web/src/app/administration/components/workbasket-distribution-targets/workbasket-distribution-targets.component.spec.ts index bdf9d0aed..dcdaa723d 100644 --- a/web/src/app/administration/components/workbasket-distribution-targets/workbasket-distribution-targets.component.spec.ts +++ b/web/src/app/administration/components/workbasket-distribution-targets/workbasket-distribution-targets.component.spec.ts @@ -21,18 +21,55 @@ import { InfiniteScrollModule } from 'ngx-infinite-scroll'; import { NgxsModule, Store } from '@ngxs/store'; import { WorkbasketDistributionTargetsComponent, Side } from './workbasket-distribution-targets.component'; import { WorkbasketDualListComponent } from '../workbasket-dual-list/workbasket-dual-list.component'; -import { NotificationService } from '../../../shared/services/notifications/notification.service'; import { ClassificationSelectors } from '../../../shared/store/classification-store/classification.selectors'; +import { NotificationService } from '../../../shared/services/notifications/notification.service'; +import { ClassificationSelectors } from '../../../shared/store/classification-store/classification.selectors'; import { WorkbasketSelectors } from '../../../shared/store/workbasket-store/workbasket.selectors'; describe('WorkbasketDistributionTargetsComponent', () => { let component: WorkbasketDistributionTargetsComponent; let fixture: ComponentFixture; let workbasketService; - const workbasket = createWorkbasket('1', '', '', '', ICONTYPES.TOPIC, '', '', '', '', '', '', '', '', '', '', '', '', - {}); - function createWorkbasket(workbasketId?, created?, key?, domain?, type?, modified?, name?, description?, - owner?, custom1?, custom2?, custom3?, custom4?, orgLevel1?, orgLevel2?, orgLevel3?, orgLevel4?, - _links?: Links, markedForDeletion?: boolean): Workbasket { + const workbasket = createWorkbasket( + '1', + '', + '', + '', + ICONTYPES.TOPIC, + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + {} + ); + function createWorkbasket( + workbasketId?, + created?, + key?, + domain?, + type?, + modified?, + name?, + description?, + owner?, + custom1?, + custom2?, + custom3?, + custom4?, + orgLevel1?, + orgLevel2?, + orgLevel3?, + orgLevel4?, + _links?: Links, + markedForDeletion?: boolean + ): Workbasket { return { workbasketId, created, @@ -56,7 +93,19 @@ describe('WorkbasketDistributionTargetsComponent', () => { }; } - function createWorkbasketSummary(workbasketId, key, name, domain, type, description, owner, custom1, custom2, custom3, custom4) { + function createWorkbasketSummary( + workbasketId, + key, + name, + domain, + type, + description, + owner, + custom1, + custom2, + custom3, + custom4 + ) { const workbasketSummary: WorkbasketSummary = { workbasketId, key, @@ -74,10 +123,8 @@ describe('WorkbasketDistributionTargetsComponent', () => { } const workbasketSummaryResource: WorkbasketSummaryRepresentation = { workbaskets: [ - createWorkbasketSummary('1', 'key1', 'NAME1', '', 'PERSONAL', - 'description 1', 'owner1', '', '', '', ''), - createWorkbasketSummary('2', 'key2', 'NAME2', '', 'PERSONAL', - 'description 2', 'owner2', '', '', '', ''), + createWorkbasketSummary('1', 'key1', 'NAME1', '', 'PERSONAL', 'description 1', 'owner1', '', '', '', ''), + createWorkbasketSummary('2', 'key2', 'NAME2', '', 'PERSONAL', 'description 2', 'owner2', '', '', '', '') ], _links: new LinksWorkbasketSummary({ href: 'url' }), page: {} @@ -90,17 +137,22 @@ describe('WorkbasketDistributionTargetsComponent', () => { const storeSpy: jasmine.SpyObj = jasmine.createSpyObj('Store', ['select', 'dispatch']); - beforeEach(done => { + beforeEach((done) => { const configure = (testBed: TestBed) => { testBed.configureTestingModule({ imports: [AngularSvgIconModule, HttpClientModule, InfiniteScrollModule, NgxsModule.forRoot()], declarations: [WorkbasketDistributionTargetsComponent, WorkbasketDualListComponent], - providers: [WorkbasketService, NotificationService, SavingWorkbasketService, RequestInProgressService, - { provide: Store, useValue: storeSpy }] + providers: [ + WorkbasketService, + NotificationService, + SavingWorkbasketService, + RequestInProgressService, + { provide: Store, useValue: storeSpy } + ] }); }; - configureTests(configure).then(testBed => { - storeSpy.select.and.callFake(selector => { + configureTests(configure).then((testBed) => { + storeSpy.select.and.callFake((selector) => { switch (selector) { case WorkbasketSelectors.workbasketDistributionTargets: return of(['distributionTargets', '_links']); @@ -113,7 +165,9 @@ describe('WorkbasketDistributionTargetsComponent', () => { component.workbasket = workbasket; workbasketService = TestBed.get(WorkbasketService); spyOn(workbasketService, 'getWorkBasketsSummary').and.callFake(() => of(workbasketSummaryResource)); - spyOn(workbasketService, 'getWorkBasketsDistributionTargets').and.callFake(() => of(workbasketDistributionTargets)); + spyOn(workbasketService, 'getWorkBasketsDistributionTargets').and.callFake(() => + of(workbasketDistributionTargets) + ); component.ngOnChanges({ active: new SimpleChange(undefined, 'distributionTargets', true) }); @@ -139,21 +193,19 @@ describe('WorkbasketDistributionTargetsComponent', () => { let repeteadElemens = false; expect(component.distributionTargetsLeft.length).toBe(2); expect(component.distributionTargetsRight.length).toBe(2); - component.distributionTargetsLeft.forEach(leftElement => { - component.distributionTargetsRight.forEach(rightElement => { - if (leftElement.workbasketId === rightElement.workbasketId) { repeteadElemens = true; } + component.distributionTargetsLeft.forEach((leftElement) => { + component.distributionTargetsRight.forEach((rightElement) => { + if (leftElement.workbasketId === rightElement.workbasketId) { + repeteadElemens = true; + } }); }); expect(repeteadElemens).toBeTruthy(); }); it('should reset distribution target and distribution target selected on reset', () => { - component.distributionTargetsLeft.push( - createWorkbasketSummary('id4', '', '', '', '', '', '', '', '', '', '') - ); - component.distributionTargetsRight.push( - createWorkbasketSummary('id5', '', '', '', '', '', '', '', '', '', '') - ); + component.distributionTargetsLeft.push(createWorkbasketSummary('id4', '', '', '', '', '', '', '', '', '', '')); + component.distributionTargetsRight.push(createWorkbasketSummary('id5', '', '', '', '', '', '', '', '', '', '')); expect(component.distributionTargetsLeft.length).toBe(3); expect(component.distributionTargetsRight.length).toBe(3); diff --git a/web/src/app/administration/components/workbasket-distribution-targets/workbasket-distribution-targets.component.ts b/web/src/app/administration/components/workbasket-distribution-targets/workbasket-distribution-targets.component.ts index a893fb431..3aa5acf48 100644 --- a/web/src/app/administration/components/workbasket-distribution-targets/workbasket-distribution-targets.component.ts +++ b/web/src/app/administration/components/workbasket-distribution-targets/workbasket-distribution-targets.component.ts @@ -1,10 +1,4 @@ -import { Component, - ElementRef, - Input, - OnChanges, - OnDestroy, OnInit, - SimpleChanges, - ViewChild } from '@angular/core'; +import { Component, ElementRef, Input, OnChanges, OnDestroy, OnInit, SimpleChanges, ViewChild } from '@angular/core'; import { Observable, Subject } from 'rxjs'; import { Workbasket } from 'app/shared/models/workbasket'; @@ -24,8 +18,11 @@ import { Select, Store } from '@ngxs/store'; import { take, takeUntil } from 'rxjs/operators'; import { NOTIFICATION_TYPES } from '../../../shared/models/notifications'; import { NotificationService } from '../../../shared/services/notifications/notification.service'; -import { GetWorkbasketDistributionTargets, - GetWorkbasketsSummary, UpdateWorkbasketDistributionTargets } from '../../../shared/store/workbasket-store/workbasket.actions'; +import { + GetWorkbasketDistributionTargets, + GetWorkbasketsSummary, + UpdateWorkbasketDistributionTargets +} from '../../../shared/store/workbasket-store/workbasket.actions'; import { WorkbasketSelectors } from '../../../shared/store/workbasket-store/workbasket.selectors'; import { WorkbasketStateModel } from '../../../shared/store/workbasket-store/workbasket.state'; @@ -82,10 +79,10 @@ export class WorkbasketDistributionTargetsComponent implements OnInit, OnChanges private orientationService: OrientationService, private notificationsService: NotificationService, private store: Store - ) { } + ) {} ngOnInit() { - this.workbasketDistributionTargets$.subscribe(workbasketDistributionTargets => { + this.workbasketDistributionTargets$.subscribe((workbasketDistributionTargets) => { if (typeof workbasketDistributionTargets !== 'undefined') { this.distributionTargetsSelectedResource = { ...workbasketDistributionTargets }; this.distributionTargetsSelected = this.distributionTargetsSelectedResource.distributionTargets; @@ -120,7 +117,8 @@ export class WorkbasketDistributionTargetsComponent implements OnInit, OnChanges } this.store.dispatch(new GetWorkbasketDistributionTargets(this.workbasket._links.distributionTargets.href)); - this.savingWorkbaskets.triggeredDistributionTargetsSaving() + this.savingWorkbaskets + .triggeredDistributionTargetsSaving() .pipe(takeUntil(this.destroy$)) .subscribe((savingInformation: SavingInformation) => { if (this.action === ACTION.COPY) { @@ -129,7 +127,8 @@ export class WorkbasketDistributionTargetsComponent implements OnInit, OnChanges } }); - this.orientationService.getOrientation() + this.orientationService + .getOrientation() .pipe(takeUntil(this.destroy$)) .subscribe(() => { this.calculateNumberItemsList(); @@ -144,52 +143,73 @@ export class WorkbasketDistributionTargetsComponent implements OnInit, OnChanges } // TODO: Implement this into NGXS - this.workbasketService.getWorkBasketsSummary(true) + this.workbasketService + .getWorkBasketsSummary(true) .pipe(takeUntil(this.destroy$)) - .subscribe( - (distributionTargetsAvailable: WorkbasketSummaryRepresentation) => { - if (TaskanaQueryParameters.page === 1) { - this.distributionTargetsLeft = []; - this.page = distributionTargetsAvailable.page; - } - if (side === this.side.LEFT) { - this.distributionTargetsLeft.push(...distributionTargetsAvailable.workbaskets); - } else if (side === this.side.RIGHT) { - this.distributionTargetsRight = Object.assign([], distributionTargetsAvailable.workbaskets); - } else { - this.distributionTargetsLeft.push(...distributionTargetsAvailable.workbaskets); - this.distributionTargetsRight = Object.assign([], distributionTargetsAvailable.workbaskets); - this.distributionTargetsClone = Object.assign([], distributionTargetsAvailable.workbaskets); - } - this.onRequest(true); + .subscribe((distributionTargetsAvailable: WorkbasketSummaryRepresentation) => { + if (TaskanaQueryParameters.page === 1) { + this.distributionTargetsLeft = []; + this.page = distributionTargetsAvailable.page; } - ); + if (side === this.side.LEFT) { + this.distributionTargetsLeft.push(...distributionTargetsAvailable.workbaskets); + } else if (side === this.side.RIGHT) { + this.distributionTargetsRight = Object.assign([], distributionTargetsAvailable.workbaskets); + } else { + this.distributionTargetsLeft.push(...distributionTargetsAvailable.workbaskets); + this.distributionTargetsRight = Object.assign([], distributionTargetsAvailable.workbaskets); + this.distributionTargetsClone = Object.assign([], distributionTargetsAvailable.workbaskets); + } + this.onRequest(true); + }); } performFilter(dualListFilter: any) { this.fillDistributionTargets(dualListFilter.side, undefined); this.onRequest(false, dualListFilter.side); - this.store.dispatch(new GetWorkbasketsSummary(true, '', '', '', - dualListFilter.filterBy.filterParams.name, dualListFilter.filterBy.filterParams.description, '', - dualListFilter.filterBy.filterParams.owner, dualListFilter.filterBy.filterParams.type, '', - dualListFilter.filterBy.filterParams.key, '', true)).subscribe((state: WorkbasketStateModel) => { - this.fillDistributionTargets(dualListFilter.side, state.paginatedWorkbasketsSummary.workbaskets); - this.onRequest(true, dualListFilter.side); - }); + this.store + .dispatch( + new GetWorkbasketsSummary( + true, + '', + '', + '', + dualListFilter.filterBy.filterParams.name, + dualListFilter.filterBy.filterParams.description, + '', + dualListFilter.filterBy.filterParams.owner, + dualListFilter.filterBy.filterParams.type, + '', + dualListFilter.filterBy.filterParams.key, + '', + true + ) + ) + .subscribe((state: WorkbasketStateModel) => { + this.fillDistributionTargets(dualListFilter.side, state.paginatedWorkbasketsSummary.workbaskets); + this.onRequest(true, dualListFilter.side); + }); } onSave() { this.requestInProgressService.setRequestInProgress(true); - this.store.dispatch(new UpdateWorkbasketDistributionTargets( - this.distributionTargetsSelectedResource._links.self.href, - this.getSeletedIds() - )).subscribe(() => { - this.requestInProgressService.setRequestInProgress(false); - return true; - }, error => { - this.requestInProgressService.setRequestInProgress(false); - return false; - }); + this.store + .dispatch( + new UpdateWorkbasketDistributionTargets( + this.distributionTargetsSelectedResource._links.self.href, + this.getSeletedIds() + ) + ) + .subscribe( + () => { + this.requestInProgressService.setRequestInProgress(false); + return true; + }, + (error) => { + this.requestInProgressService.setRequestInProgress(false); + return false; + } + ); /* TODO: OLD IMPLEMENTATION, KEPT HERE FOR REFERENCE this.workbasketService.updateWorkBasketsDistributionTargets( this.distributionTargetsSelectedResource._links.self.href, this.getSeletedIds() @@ -220,7 +240,10 @@ export class WorkbasketDistributionTargetsComponent implements OnInit, OnChanges const itemsSelected = this.getSelectedItems(this.distributionTargetsLeft); this.distributionTargetsSelected = [...this.distributionTargetsSelected, ...itemsSelected]; this.distributionTargetsRight = this.distributionTargetsRight.concat(itemsSelected); - if (((itemsLeft - itemsSelected.length) <= TaskanaQueryParameters.pageSize) && ((itemsLeft + itemsRight) < this.page.totalElements)) { + if ( + itemsLeft - itemsSelected.length <= TaskanaQueryParameters.pageSize && + itemsLeft + itemsRight < this.page.totalElements + ) { this.getNextPage(side); } this.unselectItems(this.distributionTargetsSelected); @@ -244,9 +267,13 @@ export class WorkbasketDistributionTargetsComponent implements OnInit, OnChanges if (this.panelBody) { const cardHeight = 72; const unusedHeight = 100; - this.cards = this.orientationService.calculateNumberItemsList( - this.panelBody.nativeElement.offsetHeight, cardHeight, unusedHeight, true - ) + 1; // TODO: warum +1 + this.cards = + this.orientationService.calculateNumberItemsList( + this.panelBody.nativeElement.offsetHeight, + cardHeight, + unusedHeight, + true + ) + 1; // TODO: warum +1 } } @@ -267,7 +294,7 @@ export class WorkbasketDistributionTargetsComponent implements OnInit, OnChanges } getSelectedItems(originList: any): Array { - return originList.filter((item: any) => (item.selected === true)); + return originList.filter((item: any) => item.selected === true); } unselectItems(originList: any): Array { @@ -282,7 +309,7 @@ export class WorkbasketDistributionTargetsComponent implements OnInit, OnChanges removeSelectedItems(originList: any, selectedItemList) { for (let index = originList.length - 1; index >= 0; index--) { - if (selectedItemList.some(itemToRemove => (originList[index].workbasketId === itemToRemove.workbasketId))) { + if (selectedItemList.some((itemToRemove) => originList[index].workbasketId === itemToRemove.workbasketId)) { originList.splice(index, 1); } } @@ -293,9 +320,11 @@ export class WorkbasketDistributionTargetsComponent implements OnInit, OnChanges this.loadingItems = false; const inProgress = !finished; switch (side) { - case Side.LEFT: this.requestInProgressLeft = inProgress; + case Side.LEFT: + this.requestInProgressLeft = inProgress; break; - case Side.RIGHT: this.requestInProgressRight = inProgress; + case Side.RIGHT: + this.requestInProgressRight = inProgress; break; default: this.requestInProgressLeft = inProgress; @@ -305,15 +334,19 @@ export class WorkbasketDistributionTargetsComponent implements OnInit, OnChanges getSeletedIds(): Array { const distributionTargetsSelelected: Array = []; - this.distributionTargetsSelected.forEach(item => { + this.distributionTargetsSelected.forEach((item) => { distributionTargetsSelelected.push(item.workbasketId); }); return distributionTargetsSelelected; } private uncheckSelectAll(side: number) { - if (side === Side.LEFT && this.selectAllLeft) { this.selectAllLeft = false; } - if (side === Side.RIGHT && this.selectAllRight) { this.selectAllRight = false; } + if (side === Side.LEFT && this.selectAllLeft) { + this.selectAllLeft = false; + } + if (side === Side.RIGHT && this.selectAllRight) { + this.selectAllRight = false; + } } ngOnDestroy() { diff --git a/web/src/app/administration/components/workbasket-dual-list/workbasket-dual-list.component.scss b/web/src/app/administration/components/workbasket-dual-list/workbasket-dual-list.component.scss index fee9fac98..cb7dcecba 100644 --- a/web/src/app/administration/components/workbasket-dual-list/workbasket-dual-list.component.scss +++ b/web/src/app/administration/components/workbasket-dual-list/workbasket-dual-list.component.scss @@ -1,49 +1,48 @@ $selected-item: #e3f3f5; .dual-list { - min-height: 250px; - padding: 0px; - background-color: #f5f5f5; - border: 1px solid #e3e3e3; - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .05); - box-shadow: inset 0 1px 1px rgba(0, 0, 0, .05); - & .row { - padding: 0px 0px 0px 3px; - } - & .row:first { - border-top: 1px solid #ddd; - } + min-height: 250px; + padding: 0px; + background-color: #f5f5f5; + border: 1px solid #e3e3e3; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); + & .row { + padding: 0px 0px 0px 3px; + } + & .row:first { + border-top: 1px solid #ddd; + } - & div.pull-right { - margin-right: 17px; - } + & div.pull-right { + margin-right: 17px; + } - & >.list-group { - margin-bottom: 0px; - margin-top: 0px; + & > .list-group { + margin-bottom: 0px; + margin-top: 0px; + } + & > .list-group > li { + border-left: none; + border-right: none; + } - } - & > .list-group > li { - border-left: none; - border-right: none; - } + overflow-x: hidden; + overflow-y: hidden; - overflow-x: hidden; - overflow-y: hidden; - - @media screen and (max-width: 991px){ - height: calc((100vh - 241px) / 2); - min-height: 120px; - margin-bottom: 0; - } - max-height: calc(100vh - 194px); - margin-bottom: 2px; + @media screen and (max-width: 991px) { + height: calc((100vh - 241px) / 2); + min-height: 120px; + margin-bottom: 0; + } + max-height: calc(100vh - 194px); + margin-bottom: 2px; } .infinite-scroll { overflow-y: scroll; height: calc(100vh - 233px); - @media screen and (max-width: 991px){ + @media screen and (max-width: 991px) { height: calc((100vh - 315px) / 2); min-height: 83px; } @@ -54,60 +53,60 @@ $selected-item: #e3f3f5; } .list-group { - margin-top: 8px; + margin-top: 8px; } - -ul>li { - &:first-child.list-group-item.selected { +ul > li { + &:first-child.list-group-item.selected { border-color: #ddd; - } - &.list-group-item.selected { - background-color: $selected-item; - } + } + &.list-group-item.selected { + background-color: $selected-item; + } } .list-left li { - cursor: pointer; + cursor: pointer; } -button.no-style{ - background: none; - border:none; +button.no-style { + background: none; + border: none; } .row.list-group { - margin-left: 2px; + margin-left: 2px; } .list-group > li { - border-left: none; - border-right: none; + border-left: none; + border-right: none; } -a > label{ - height: 2em; - width: 100%; +a > label { + height: 2em; + width: 100%; } -dd, dt { - text-overflow: ellipsis; - white-space: nowrap; - overflow: hidden; +dd, +dt { + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; } dt > i { - font-weight: normal; - text-overflow: ellipsis; - white-space: nowrap; - overflow: hidden; + font-weight: normal; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; } li > div.row > dl { - margin-bottom: 0px; + margin-bottom: 0px; } -li.list-group-item:hover, { - color: #555; - text-decoration: none; - background-color: #f5f5f5; +li.list-group-item:hover { + color: #555; + text-decoration: none; + background-color: #f5f5f5; } diff --git a/web/src/app/administration/components/workbasket-dual-list/workbasket-dual-list.component.ts b/web/src/app/administration/components/workbasket-dual-list/workbasket-dual-list.component.ts index b4fc31a79..3f92912c3 100644 --- a/web/src/app/administration/components/workbasket-dual-list/workbasket-dual-list.component.ts +++ b/web/src/app/administration/components/workbasket-dual-list/workbasket-dual-list.component.ts @@ -13,9 +13,9 @@ import { Side } from '../workbasket-distribution-targets/workbasket-distribution export class WorkbasketDualListComponent implements OnInit { @Input() distributionTargets: WorkbasketSummary[]; @Input() distributionTargetsSelected: WorkbasketSummary[]; - @Output() performDualListFilter = new EventEmitter<{ filterBy: Filter, side: Side }>(); + @Output() performDualListFilter = new EventEmitter<{ filterBy: Filter; side: Side }>(); @Input() requestInProgress = false; - @Input() loadingItems ? = false; + @Input() loadingItems? = false; @Input() side: Side; @Input() header: string; @Output() scrolling = new EventEmitter(); diff --git a/web/src/app/administration/components/workbasket-information/workbasket-information.component.scss b/web/src/app/administration/components/workbasket-information/workbasket-information.component.scss index b6f1bc259..d9a9b302c 100644 --- a/web/src/app/administration/components/workbasket-information/workbasket-information.component.scss +++ b/web/src/app/administration/components/workbasket-information/workbasket-information.component.scss @@ -1,3 +1,3 @@ .dropdown-menu { - min-width: auto; + min-width: auto; } diff --git a/web/src/app/administration/components/workbasket-information/workbasket-information.component.spec.ts b/web/src/app/administration/components/workbasket-information/workbasket-information.component.spec.ts index f4ff5f278..c9e06196e 100644 --- a/web/src/app/administration/components/workbasket-information/workbasket-information.component.spec.ts +++ b/web/src/app/administration/components/workbasket-information/workbasket-information.component.spec.ts @@ -23,8 +23,7 @@ import { NotificationService } from '../../../shared/services/notifications/noti selector: 'taskana-dummy-detail', template: 'dummydetail' }) -export class DummyDetailComponent { -} +export class DummyDetailComponent {} const routes: Routes = [ { path: ':id', component: DummyDetailComponent, outlet: 'detail' }, @@ -44,17 +43,44 @@ describe('WorkbasketInformationComponent', () => { const configure = (testBed: TestBed) => { testBed.configureTestingModule({ declarations: [WorkbasketInformationComponent, DummyDetailComponent], - imports: [FormsModule, AngularSvgIconModule, HttpClientModule, RouterTestingModule.withRoutes(routes), - NgxsModule.forRoot()], - providers: [WorkbasketService, NotificationService, SavingWorkbasketService, - RequestInProgressService, FormsValidatorService] - + imports: [ + FormsModule, + AngularSvgIconModule, + HttpClientModule, + RouterTestingModule.withRoutes(routes), + NgxsModule.forRoot() + ], + providers: [ + WorkbasketService, + NotificationService, + SavingWorkbasketService, + RequestInProgressService, + FormsValidatorService + ] }); }; - function createWorkbasket(workbasketId?, created?, key?, domain?, type?, modified?, name?, description?, - owner?, custom1?, custom2?, custom3?, custom4?, orgLevel1?, orgLevel2?, orgLevel3?, orgLevel4?, - _links?: Links, markedForDeletion?: boolean) { + function createWorkbasket( + workbasketId?, + created?, + key?, + domain?, + type?, + modified?, + name?, + description?, + owner?, + custom1?, + custom2?, + custom3?, + custom4?, + orgLevel1?, + orgLevel2?, + orgLevel3?, + orgLevel4?, + _links?: Links, + markedForDeletion?: boolean + ) { if (!type) { // eslint-disable-next-line no-param-reassign type = 'PERSONAL'; @@ -83,8 +109,8 @@ describe('WorkbasketInformationComponent', () => { return workbasket; } - beforeEach(done => { - configureTests(configure).then(testBed => { + beforeEach((done) => { + configureTests(configure).then((testBed) => { fixture = testBed.createComponent(WorkbasketInformationComponent); component = fixture.componentInstance; debugElement = fixture.debugElement.nativeElement; @@ -119,11 +145,26 @@ describe('WorkbasketInformationComponent', () => { it('should create a copy of workbasket when workbasket is selected', () => { expect(component.workbasketClone).toBeUndefined(); - component.workbasket = createWorkbasket('id', 'created', 'keyModified', 'domain', ICONTYPES.TOPIC, 'modified', 'name', 'description', - 'owner', 'custom1', 'custom2', 'custom3', 'custom4', 'orgLevel1', 'orgLevel2', 'orgLevel3', 'orgLevel4'); - component.ngOnChanges( - undefined + component.workbasket = createWorkbasket( + 'id', + 'created', + 'keyModified', + 'domain', + ICONTYPES.TOPIC, + 'modified', + 'name', + 'description', + 'owner', + 'custom1', + 'custom2', + 'custom3', + 'custom4', + 'orgLevel1', + 'orgLevel2', + 'orgLevel3', + 'orgLevel4' ); + component.ngOnChanges(undefined); fixture.detectChanges(); expect(component.workbasket.workbasketId).toEqual(component.workbasketClone.workbasketId); }); diff --git a/web/src/app/administration/components/workbasket-information/workbasket-information.component.ts b/web/src/app/administration/components/workbasket-information/workbasket-information.component.ts index 3a9554aa3..175b0de57 100644 --- a/web/src/app/administration/components/workbasket-information/workbasket-information.component.ts +++ b/web/src/app/administration/components/workbasket-information/workbasket-information.component.ts @@ -1,10 +1,4 @@ -import { Component, - Input, - OnChanges, - OnDestroy, - OnInit, - SimpleChanges, - ViewChild } from '@angular/core'; +import { Component, Input, OnChanges, OnDestroy, OnInit, SimpleChanges, ViewChild } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; import { Observable, Subject, Subscription } from 'rxjs'; import { NgForm } from '@angular/forms'; @@ -23,20 +17,21 @@ import { map, takeUntil } from 'rxjs/operators'; import { EngineConfigurationSelectors } from 'app/shared/store/engine-configuration-store/engine-configuration.selectors'; import { NOTIFICATION_TYPES } from '../../../shared/models/notifications'; import { NotificationService } from '../../../shared/services/notifications/notification.service'; -import { CustomField, - getCustomFields, - WorkbasketsCustomisation } from '../../../shared/models/customisation'; -import { CopyWorkbasket, MarkWorkbasketForDeletion, - RemoveDistributionTarget, SaveNewWorkbasket, - UpdateWorkbasket } from '../../../shared/store/workbasket-store/workbasket.actions'; +import { CustomField, getCustomFields, WorkbasketsCustomisation } from '../../../shared/models/customisation'; +import { + CopyWorkbasket, + MarkWorkbasketForDeletion, + RemoveDistributionTarget, + SaveNewWorkbasket, + UpdateWorkbasket +} from '../../../shared/store/workbasket-store/workbasket.actions'; @Component({ selector: 'taskana-administration-workbasket-information', templateUrl: './workbasket-information.component.html', styleUrls: ['./workbasket-information.component.scss'] }) -export class WorkbasketInformationComponent -implements OnInit, OnChanges, OnDestroy { +export class WorkbasketInformationComponent implements OnInit, OnChanges, OnDestroy { @Input() workbasket: Workbasket; @@ -68,8 +63,7 @@ implements OnInit, OnChanges, OnDestroy { private formsValidatorService: FormsValidatorService, private notificationService: NotificationService, private store: Store - ) { - } + ) {} ngOnInit() { this.allTypes = new Map([ @@ -79,16 +73,14 @@ implements OnInit, OnChanges, OnDestroy { ['TOPIC', 'Topic'] ]); this.customFields$ = this.workbasketsCustomisation$.pipe( - map(customisation => customisation.information), + map((customisation) => customisation.information), getCustomFields(customFieldCount) ); - this.workbasketsCustomisation$ - .pipe(takeUntil(this.destroy$)) - .subscribe(workbasketsCustomization => { - if (workbasketsCustomization.information.owner) { - this.lookupField = workbasketsCustomization.information.owner.lookupField; - } - }); + this.workbasketsCustomisation$.pipe(takeUntil(this.destroy$)).subscribe((workbasketsCustomization) => { + if (workbasketsCustomization.information.owner) { + this.lookupField = workbasketsCustomization.information.owner.lookupField; + } + }); } ngOnChanges(changes: SimpleChanges) { @@ -106,13 +98,11 @@ implements OnInit, OnChanges, OnDestroy { onSubmit() { this.formsValidatorService.formSubmitAttempt = true; - this.formsValidatorService - .validateFormInformation(this.workbasketForm, this.toogleValidationMap) - .then(value => { - if (value) { - this.onSave(); - } - }); + this.formsValidatorService.validateFormInformation(this.workbasketForm, this.toogleValidationMap).then((value) => { + if (value) { + this.onSave(); + } + }); } isFieldValid(field: string): boolean { @@ -146,11 +136,10 @@ implements OnInit, OnChanges, OnDestroy { this.postNewWorkbasket(); return; } - this.store.dispatch(new UpdateWorkbasket(this.workbasket._links.self.href, this.workbasket)) - .subscribe(state => { - this.requestInProgressService.setRequestInProgress(false); - this.workbasketClone = { ...this.workbasket }; - }); + this.store.dispatch(new UpdateWorkbasket(this.workbasket._links.self.href, this.workbasket)).subscribe((state) => { + this.requestInProgressService.setRequestInProgress(false); + this.workbasketClone = { ...this.workbasket }; + }); } private beforeRequest() { @@ -164,25 +153,17 @@ implements OnInit, OnChanges, OnDestroy { private postNewWorkbasket() { this.addDateToWorkbasket(); - this.store.dispatch(new SaveNewWorkbasket(this.workbasket)).subscribe( - () => { - this.afterRequest(); - if (this.action === ACTION.COPY) { - this.savingWorkbasket.triggerDistributionTargetSaving( - new SavingInformation( - this.workbasket._links.distributionTargets.href, - this.workbasket.workbasketId - ) - ); - this.savingWorkbasket.triggerAccessItemsSaving( - new SavingInformation( - this.workbasket._links.accessItems.href, - this.workbasket.workbasketId - ) - ); - } + this.store.dispatch(new SaveNewWorkbasket(this.workbasket)).subscribe(() => { + this.afterRequest(); + if (this.action === ACTION.COPY) { + this.savingWorkbasket.triggerDistributionTargetSaving( + new SavingInformation(this.workbasket._links.distributionTargets.href, this.workbasket.workbasketId) + ); + this.savingWorkbasket.triggerAccessItemsSaving( + new SavingInformation(this.workbasket._links.accessItems.href, this.workbasket.workbasketId) + ); } - ); + }); } private addDateToWorkbasket() { diff --git a/web/src/app/administration/components/workbasket-list-toolbar/workbasket-list-toolbar.component.scss b/web/src/app/administration/components/workbasket-list-toolbar/workbasket-list-toolbar.component.scss index 405a24add..a7f6d1c64 100644 --- a/web/src/app/administration/components/workbasket-list-toolbar/workbasket-list-toolbar.component.scss +++ b/web/src/app/administration/components/workbasket-list-toolbar/workbasket-list-toolbar.component.scss @@ -1,13 +1,13 @@ .list-group-item { - padding: 5px 0px 2px 1px; - border: none; + padding: 5px 0px 2px 1px; + border: none; } -.tab-align{ - padding: 8px 12px 8px 4px; - margin-bottom: 0px; +.tab-align { + padding: 8px 12px 8px 4px; + margin-bottom: 0px; - &>div{ + & > div { margin: 6px 0px; - } -} \ No newline at end of file + } +} diff --git a/web/src/app/administration/components/workbasket-list-toolbar/workbasket-list-toolbar.component.spec.ts b/web/src/app/administration/components/workbasket-list-toolbar/workbasket-list-toolbar.component.spec.ts index 4efd469c2..39ca88989 100644 --- a/web/src/app/administration/components/workbasket-list-toolbar/workbasket-list-toolbar.component.spec.ts +++ b/web/src/app/administration/components/workbasket-list-toolbar/workbasket-list-toolbar.component.spec.ts @@ -27,9 +27,7 @@ import { ICONTYPES } from '../../../shared/models/icon-types'; selector: 'taskana-dummy-detail', template: 'dummydetail' }) -export class DummyDetailComponent { - -} +export class DummyDetailComponent {} describe('WorkbasketListToolbarComponent', () => { let component: WorkbasketListToolbarComponent; @@ -38,15 +36,20 @@ describe('WorkbasketListToolbarComponent', () => { let workbasketService; let router; - const routes: Routes = [ - { path: ':id', component: DummyDetailComponent, outlet: 'detail' } - ]; + const routes: Routes = [{ path: ':id', component: DummyDetailComponent, outlet: 'detail' }]; - beforeEach(done => { + beforeEach((done) => { const configure = (testBed: TestBed) => { testBed.configureTestingModule({ - imports: [FormsModule, ReactiveFormsModule, AngularSvgIconModule, - HttpClientModule, RouterTestingModule.withRoutes(routes), SharedModule, AppModule], + imports: [ + FormsModule, + ReactiveFormsModule, + AngularSvgIconModule, + HttpClientModule, + RouterTestingModule.withRoutes(routes), + SharedModule, + AppModule + ], declarations: [WorkbasketListToolbarComponent, DummyDetailComponent, ImportExportComponent], providers: [ WorkbasketService, @@ -56,7 +59,7 @@ describe('WorkbasketListToolbarComponent', () => { ] }); }; - configureTests(configure).then(testBed => { + configureTests(configure).then((testBed) => { fixture = TestBed.createComponent(WorkbasketListToolbarComponent); workbasketService = TestBed.get(WorkbasketService); router = TestBed.get(Router); @@ -65,12 +68,16 @@ describe('WorkbasketListToolbarComponent', () => { debugElement = fixture.debugElement.nativeElement; component = fixture.componentInstance; - component.workbaskets = [{ workbasketId: '1', - key: 'key1', - name: 'NAME1', - description: 'description 1', - owner: 'owner 1', - type: ICONTYPES.PERSONAL }]; + component.workbaskets = [ + { + workbasketId: '1', + key: 'key1', + name: 'NAME1', + description: 'description 1', + owner: 'owner 1', + type: ICONTYPES.PERSONAL + } + ]; component.workbaskets[0].markedForDeletion = false; fixture.detectChanges(); @@ -90,7 +97,9 @@ describe('WorkbasketListToolbarComponent', () => { let sort: Sorting; const compareSort = new Sorting(); - component.performSorting.subscribe(value => { sort = value; }); + component.performSorting.subscribe((value) => { + sort = value; + }); component.sorting(compareSort); expect(sort).toBe(compareSort); }); @@ -99,7 +108,9 @@ describe('WorkbasketListToolbarComponent', () => { let filter: Filter; const compareFilter = new Filter(); - component.performFilter.subscribe(value => { filter = value; }); + component.performFilter.subscribe((value) => { + filter = value; + }); component.filtering(compareFilter); expect(filter).toBe(compareFilter); }); diff --git a/web/src/app/administration/components/workbasket-list-toolbar/workbasket-list-toolbar.component.ts b/web/src/app/administration/components/workbasket-list-toolbar/workbasket-list-toolbar.component.ts index 2c5a80269..b53a81ef9 100644 --- a/web/src/app/administration/components/workbasket-list-toolbar/workbasket-list-toolbar.component.ts +++ b/web/src/app/administration/components/workbasket-list-toolbar/workbasket-list-toolbar.component.ts @@ -29,9 +29,20 @@ export class WorkbasketListToolbarComponent implements OnInit { @Output() performFilter = new EventEmitter(); selectionToImport = TaskanaType.WORKBASKETS; - sortingFields = new Map([['name', 'Name'], ['key', 'Key'], ['description', 'Description'], ['owner', 'Owner'], ['type', 'Type']]); - filteringTypes = new Map([['ALL', 'All'], ['PERSONAL', 'Personal'], ['GROUP', 'Group'], - ['CLEARANCE', 'Clearance'], ['TOPIC', 'Topic']]); + sortingFields = new Map([ + ['name', 'Name'], + ['key', 'Key'], + ['description', 'Description'], + ['owner', 'Owner'], + ['type', 'Type'] + ]); + filteringTypes = new Map([ + ['ALL', 'All'], + ['PERSONAL', 'Personal'], + ['GROUP', 'Group'], + ['CLEARANCE', 'Clearance'], + ['TOPIC', 'Topic'] + ]); filterParams = { name: '', key: '', type: '', description: '', owner: '' }; toolbarState = false; @@ -49,15 +60,12 @@ export class WorkbasketListToolbarComponent implements OnInit { private router: Router, private store: Store, private location: Location - ) { - } + ) {} ngOnInit() { - this.workbasketActiveAction$ - .pipe(takeUntil(this.destroy$)) - .subscribe(action => { - this.action = action; - }); + this.workbasketActiveAction$.pipe(takeUntil(this.destroy$)).subscribe((action) => { + this.action = action; + }); } sorting(sort: Sorting) { diff --git a/web/src/app/administration/components/workbasket-list/workbasket-list.component.scss b/web/src/app/administration/components/workbasket-list/workbasket-list.component.scss index 2a2932913..dc33278ac 100644 --- a/web/src/app/administration/components/workbasket-list/workbasket-list.component.scss +++ b/web/src/app/administration/components/workbasket-list/workbasket-list.component.scss @@ -1,37 +1,38 @@ .row.list-group { - margin-left: 2px; + margin-left: 2px; } .list-group > li { - border-left: none; - border-right: none; + border-left: none; + border-right: none; } -a > label{ - height: 2em; - width: 100%; +a > label { + height: 2em; + width: 100%; } -dd, dt { - text-overflow: ellipsis; - white-space: nowrap; - overflow: hidden; +dd, +dt { + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; } dt > i { - font-weight: normal; - text-overflow: ellipsis; - white-space: nowrap; - overflow: hidden; + font-weight: normal; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; } li > div.row > dl { - margin-bottom: 0px; + margin-bottom: 0px; } li > div.row > dl:first-child { - margin-left: 15px; + margin-left: 15px; } .no-space { - border-top: none; - padding: 0px + border-top: none; + padding: 0px; } diff --git a/web/src/app/administration/components/workbasket-list/workbasket-list.component.spec.ts b/web/src/app/administration/components/workbasket-list/workbasket-list.component.spec.ts index 8964b2892..a91aeaa93 100644 --- a/web/src/app/administration/components/workbasket-list/workbasket-list.component.spec.ts +++ b/web/src/app/administration/components/workbasket-list/workbasket-list.component.spec.ts @@ -28,8 +28,7 @@ import { WorkbasketListComponent } from './workbasket-list.component'; selector: 'taskana-dummy-detail', template: 'dummydetail' }) -class DummyDetailComponent { -} +class DummyDetailComponent {} @Component({ selector: 'taskana-pagination', @@ -45,7 +44,19 @@ class PaginationComponent { @Output() changePage = new EventEmitter(); } -function createWorkbasketSummary(workbasketId, key, name, domain, type, description, owner, custom1, custom2, custom3, custom4) { +function createWorkbasketSummary( + workbasketId, + key, + name, + domain, + type, + description, + owner, + custom1, + custom2, + custom3, + custom4 +) { const workbasketSummary: WorkbasketSummary = { workbasketId, key, @@ -63,10 +74,8 @@ function createWorkbasketSummary(workbasketId, key, name, domain, type, descript } const workbasketSummaryResource: WorkbasketSummaryRepresentation = { workbaskets: [ - createWorkbasketSummary('1', 'key1', 'NAME1', '', 'PERSONAL', - 'description 1', 'owner1', '', '', '', ''), - createWorkbasketSummary('2', 'key2', 'NAME2', '', 'PERSONAL', - 'description 2', 'owner2', '', '', '', ''), + createWorkbasketSummary('1', 'key1', 'NAME1', '', 'PERSONAL', 'description 1', 'owner1', '', '', '', ''), + createWorkbasketSummary('2', 'key2', 'NAME2', '', 'PERSONAL', 'description 2', 'owner2', '', '', '', '') ], _links: new LinksWorkbasketSummary({ href: 'url' }), page: {} @@ -84,21 +93,16 @@ describe('WorkbasketListComponent', () => { { path: 'workbaskets', component: DummyDetailComponent } ]; - beforeEach(done => { + beforeEach((done) => { const configure = (testBed: TestBed) => { testBed.configureTestingModule({ declarations: [ WorkbasketListComponent, DummyDetailComponent, WorkbasketListToolbarComponent, - ImportExportComponent, - ], - imports: [ - AngularSvgIconModule, - HttpClientModule, - RouterTestingModule.withRoutes(routes), - NgxsModule.forRoot() + ImportExportComponent ], + imports: [AngularSvgIconModule, HttpClientModule, RouterTestingModule.withRoutes(routes), NgxsModule.forRoot()], providers: [ WorkbasketService, WorkbasketDefinitionService, @@ -108,7 +112,7 @@ describe('WorkbasketListComponent', () => { ] }); }; - configureTests(configure).then(testBed => { + configureTests(configure).then((testBed) => { fixture = TestBed.createComponent(WorkbasketListComponent); component = fixture.componentInstance; Object.defineProperty(component, 'workbasketsSummaryRepresentation$', { writable: true }); @@ -121,7 +125,9 @@ describe('WorkbasketListComponent', () => { debugElement = fixture.debugElement.nativeElement; workbasketService = TestBed.get(WorkbasketService); const orientationService = TestBed.get(OrientationService); - workbasketSummarySpy = spyOn(workbasketService, 'getWorkBasketsSummary').and.returnValue(of(workbasketSummaryResource)); + workbasketSummarySpy = spyOn(workbasketService, 'getWorkBasketsSummary').and.returnValue( + of(workbasketSummaryResource) + ); spyOn(workbasketService, 'getSelectedWorkBasket').and.returnValue(of('2')); spyOn(orientationService, 'getOrientation').and.returnValue(of(undefined)); @@ -139,15 +145,18 @@ describe('WorkbasketListComponent', () => { expect(component).toBeTruthy(); }); - it('should have wb-action-toolbar, wb-search-bar, wb-list-container, wb-pagination,' - + ' collapsedMenufilterWb and taskana-filter created in the html', () => { - expect(debugElement.querySelector('#wb-action-toolbar')).toBeDefined(); - expect(debugElement.querySelector('#wb-search-bar')).toBeDefined(); - expect(debugElement.querySelector('#wb-pagination')).toBeDefined(); - expect(debugElement.querySelector('#wb-list-container')).toBeDefined(); - expect(debugElement.querySelector('#collapsedMenufilterWb')).toBeDefined(); - expect(debugElement.querySelector('taskana-filter')).toBeDefined(); - }); + it( + 'should have wb-action-toolbar, wb-search-bar, wb-list-container, wb-pagination,' + + ' collapsedMenufilterWb and taskana-filter created in the html', + () => { + expect(debugElement.querySelector('#wb-action-toolbar')).toBeDefined(); + expect(debugElement.querySelector('#wb-search-bar')).toBeDefined(); + expect(debugElement.querySelector('#wb-pagination')).toBeDefined(); + expect(debugElement.querySelector('#wb-list-container')).toBeDefined(); + expect(debugElement.querySelector('#collapsedMenufilterWb')).toBeDefined(); + expect(debugElement.querySelector('taskana-filter')).toBeDefined(); + } + ); it('should have rendered sort by: name, id, description, owner and type', () => { expect(debugElement.querySelector('#sort-by-name')).toBeDefined(); diff --git a/web/src/app/administration/components/workbasket-list/workbasket-list.component.ts b/web/src/app/administration/components/workbasket-list/workbasket-list.component.ts index 3b9bf6ba1..a5644cffb 100644 --- a/web/src/app/administration/components/workbasket-list/workbasket-list.component.ts +++ b/web/src/app/administration/components/workbasket-list/workbasket-list.component.ts @@ -13,8 +13,11 @@ import { TaskanaQueryParameters } from 'app/shared/util/query-parameters'; import { ImportExportService } from 'app/administration/services/import-export.service'; import { Actions, ofActionCompleted, ofActionDispatched, Select, Store } from '@ngxs/store'; import { takeUntil } from 'rxjs/operators'; -import { DeselectWorkbasket, GetWorkbasketsSummary, - SelectWorkbasket } from '../../../shared/store/workbasket-store/workbasket.actions'; +import { + DeselectWorkbasket, + GetWorkbasketsSummary, + SelectWorkbasket +} from '../../../shared/store/workbasket-store/workbasket.actions'; import { WorkbasketSelectors } from '../../../shared/store/workbasket-store/workbasket.selectors'; import { Workbasket } from '../../../shared/models/workbasket'; @@ -53,47 +56,45 @@ export class WorkbasketListComponent implements OnInit, OnDestroy { private workbasketService: WorkbasketService, private orientationService: OrientationService, private importExportService: ImportExportService, - private ngxsActions$: Actions, + private ngxsActions$: Actions ) { - this.ngxsActions$.pipe(ofActionDispatched(GetWorkbasketsSummary), - takeUntil(this.destroy$)) - .subscribe(() => { - this.requestInProgress = true; - }); - this.ngxsActions$.pipe(ofActionCompleted(GetWorkbasketsSummary), - takeUntil(this.destroy$)) - .subscribe(() => { - this.requestInProgress = false; - }); + this.ngxsActions$.pipe(ofActionDispatched(GetWorkbasketsSummary), takeUntil(this.destroy$)).subscribe(() => { + this.requestInProgress = true; + }); + this.ngxsActions$.pipe(ofActionCompleted(GetWorkbasketsSummary), takeUntil(this.destroy$)).subscribe(() => { + this.requestInProgress = false; + }); } ngOnInit() { this.requestInProgress = true; - this.selectedWorkbasket$.pipe(takeUntil(this.destroy$)) - .subscribe(selectedWorkbasket => { - if (typeof selectedWorkbasket !== 'undefined') { - this.selectedId = selectedWorkbasket.workbasketId; - } else { - this.selectedId = undefined; - } - }); + this.selectedWorkbasket$.pipe(takeUntil(this.destroy$)).subscribe((selectedWorkbasket) => { + if (typeof selectedWorkbasket !== 'undefined') { + this.selectedId = selectedWorkbasket.workbasketId; + } else { + this.selectedId = undefined; + } + }); TaskanaQueryParameters.page = this.pageSelected; TaskanaQueryParameters.pageSize = this.pageSize; - this.workbasketService.workbasketSavedTriggered() + this.workbasketService + .workbasketSavedTriggered() .pipe(takeUntil(this.destroy$)) - .subscribe(value => { + .subscribe((value) => { this.performRequest(); }); - this.orientationService.getOrientation() + this.orientationService + .getOrientation() .pipe(takeUntil(this.destroy$)) .subscribe((orientation: Orientation) => { this.refreshWorkbasketList(); }); - this.importExportService.getImportingFinished() + this.importExportService + .getImportingFinished() .pipe(takeUntil(this.destroy$)) .subscribe((value: Boolean) => { this.refreshWorkbasketList(); @@ -125,15 +126,31 @@ export class WorkbasketListComponent implements OnInit, OnDestroy { refreshWorkbasketList() { this.cards = this.orientationService.calculateNumberItemsList( - window.innerHeight, 72, 170 + this.toolbarElement.nativeElement.offsetHeight, false + window.innerHeight, + 72, + 170 + this.toolbarElement.nativeElement.offsetHeight, + false ); this.performRequest(); } private performRequest(): void { - this.store.dispatch(new GetWorkbasketsSummary(true, this.sort.sortBy, this.sort.sortDirection, '', - this.filterBy.filterParams.name, this.filterBy.filterParams.description, '', this.filterBy.filterParams.owner, - this.filterBy.filterParams.type, '', this.filterBy.filterParams.key, '')); + this.store.dispatch( + new GetWorkbasketsSummary( + true, + this.sort.sortBy, + this.sort.sortDirection, + '', + this.filterBy.filterParams.name, + this.filterBy.filterParams.description, + '', + this.filterBy.filterParams.owner, + this.filterBy.filterParams.type, + '', + this.filterBy.filterParams.key, + '' + ) + ); TaskanaQueryParameters.pageSize = this.cards; } diff --git a/web/src/app/administration/components/workbasket-overview/workbasket-overview.component.spec.ts b/web/src/app/administration/components/workbasket-overview/workbasket-overview.component.spec.ts index 5445fb560..f414e881b 100644 --- a/web/src/app/administration/components/workbasket-overview/workbasket-overview.component.spec.ts +++ b/web/src/app/administration/components/workbasket-overview/workbasket-overview.component.spec.ts @@ -12,39 +12,26 @@ import { WorkbasketOverviewComponent } from './workbasket-overview.component'; selector: 'taskana-dummy-detail', template: 'dummydetail' }) -export class DummyDetailComponent { -} +export class DummyDetailComponent {} @Component({ selector: 'taskana-workbasket-list', template: 'dummylist' }) -export class DummyListComponent { -} +export class DummyListComponent {} describe('WorkbasketOverviewComponent', () => { let debugElement: any; let component: WorkbasketOverviewComponent; let fixture: ComponentFixture; const locationSpy: jasmine.SpyObj = jasmine.createSpyObj('Location', ['go']); - const routes: Routes = [ - { path: ':id', component: DummyDetailComponent } - ]; + const routes: Routes = [{ path: ':id', component: DummyDetailComponent }]; beforeEach(async(() => { - TestBed.configureTestingModule( - { imports: [ - RouterTestingModule.withRoutes(routes), - NgxsModule.forRoot() - ], - declarations: [ - WorkbasketOverviewComponent, - DummyDetailComponent, - DummyListComponent], - providers: [ - { provide: Location, useValue: locationSpy }, - ], - schemas: [NO_ERRORS_SCHEMA] } - ) - .compileComponents(); + TestBed.configureTestingModule({ + imports: [RouterTestingModule.withRoutes(routes), NgxsModule.forRoot()], + declarations: [WorkbasketOverviewComponent, DummyDetailComponent, DummyListComponent], + providers: [{ provide: Location, useValue: locationSpy }], + schemas: [NO_ERRORS_SCHEMA] + }).compileComponents(); })); afterEach(() => { diff --git a/web/src/app/administration/components/workbasket-overview/workbasket-overview.component.ts b/web/src/app/administration/components/workbasket-overview/workbasket-overview.component.ts index 7a97fae44..826af883d 100644 --- a/web/src/app/administration/components/workbasket-overview/workbasket-overview.component.ts +++ b/web/src/app/administration/components/workbasket-overview/workbasket-overview.component.ts @@ -5,9 +5,11 @@ import { ActivatedRoute } from '@angular/router'; import { takeUntil } from 'rxjs/operators'; import { WorkbasketSelectors } from '../../../shared/store/workbasket-store/workbasket.selectors'; -import { CreateWorkbasket, +import { + CreateWorkbasket, SelectWorkbasket, - SetActiveAction } from '../../../shared/store/workbasket-store/workbasket.actions'; + SetActiveAction +} from '../../../shared/store/workbasket-store/workbasket.actions'; @Component({ selector: 'app-workbasket-overview', @@ -20,34 +22,25 @@ export class WorkbasketOverviewComponent implements OnInit { destroy$ = new Subject(); routerParams: any; - constructor( - private route: ActivatedRoute, - private store: Store - ) { - - } + constructor(private route: ActivatedRoute, private store: Store) {} ngOnInit() { if (this.route.firstChild) { - this.route.firstChild.params - .pipe(takeUntil(this.destroy$)) - .subscribe(params => { - this.routerParams = params; - if (this.routerParams.id) { - this.showDetail = true; - if (this.routerParams.id === 'new-workbasket') { - this.store.dispatch(new CreateWorkbasket()); - } else { - this.store.dispatch(new SelectWorkbasket(this.routerParams.id)); - } + this.route.firstChild.params.pipe(takeUntil(this.destroy$)).subscribe((params) => { + this.routerParams = params; + if (this.routerParams.id) { + this.showDetail = true; + if (this.routerParams.id === 'new-workbasket') { + this.store.dispatch(new CreateWorkbasket()); + } else { + this.store.dispatch(new SelectWorkbasket(this.routerParams.id)); } - }); - } - this.selectedWorkbasketAndAction$ - .pipe(takeUntil(this.destroy$)) - .subscribe(state => { - this.showDetail = !!state.selectedWorkbasket || state.action === 1; + } }); + } + this.selectedWorkbasketAndAction$.pipe(takeUntil(this.destroy$)).subscribe((state) => { + this.showDetail = !!state.selectedWorkbasket || state.action === 1; + }); } ngOnDestroy() { diff --git a/web/src/app/administration/models/tree-node.ts b/web/src/app/administration/models/tree-node.ts index bd0ba05bc..1444fa18b 100644 --- a/web/src/app/administration/models/tree-node.ts +++ b/web/src/app/administration/models/tree-node.ts @@ -1,5 +1,5 @@ import { Classification } from 'app/shared/models/classification'; export interface TreeNodeModel extends Classification { - children: TreeNodeModel[] + children: TreeNodeModel[]; } diff --git a/web/src/app/administration/services/classification-definition.service.ts b/web/src/app/administration/services/classification-definition.service.ts index 413329405..e0ce3f6d4 100644 --- a/web/src/app/administration/services/classification-definition.service.ts +++ b/web/src/app/administration/services/classification-definition.service.ts @@ -8,11 +8,11 @@ import { Classification } from '../../shared/models/classification'; @Injectable() export class ClassificationDefinitionService { url = `${environment.taskanaRestUrl}/v1/classification-definitions`; - constructor(private httpClient: HttpClient) { } + constructor(private httpClient: HttpClient) {} // GET async exportClassifications(domain: string) { - const domainRequest = (domain ? '' : `?domain=${domain}`); + const domainRequest = domain ? '' : `?domain=${domain}`; const classificationDefinitions = await this.httpClient.get(this.url + domainRequest).toPromise(); BlobGenerator.saveFile(classificationDefinitions, `Classifications_${TaskanaDate.getDate()}.json`); } diff --git a/web/src/app/administration/services/classification-tree.service.ts b/web/src/app/administration/services/classification-tree.service.ts index 7a84b8709..62a96ff3f 100644 --- a/web/src/app/administration/services/classification-tree.service.ts +++ b/web/src/app/administration/services/classification-tree.service.ts @@ -7,25 +7,27 @@ import { Classification } from '../../shared/models/classification'; }) export class ClassificationTreeService { transformToTreeNode(classifications: Classification[]): TreeNodeModel[] { - const classificationsAsTree: TreeNodeModel[] = classifications.map(c => ({ - ...c, - children: [] - })).sort((a: TreeNodeModel, b: TreeNodeModel) => a.key.localeCompare(b.key)); + const classificationsAsTree: TreeNodeModel[] = classifications + .map((c) => ({ + ...c, + children: [] + })) + .sort((a: TreeNodeModel, b: TreeNodeModel) => a.key.localeCompare(b.key)); const roots: TreeNodeModel[] = []; const children: TreeNodeModel[] = []; - classificationsAsTree.forEach(item => { + classificationsAsTree.forEach((item) => { const parent = item.parentId; - const target = !parent ? roots : (children[parent] || (children[parent] = [])); + const target = !parent ? roots : children[parent] || (children[parent] = []); target.push(item); }); - roots.forEach(parent => this.findChildren(parent, children)); + roots.forEach((parent) => this.findChildren(parent, children)); return roots; } private findChildren(parent: TreeNodeModel, children: TreeNodeModel[]) { if (children[parent.classificationId]) { parent.children = children[parent.classificationId]; - parent.children.forEach(child => this.findChildren(child, children)); + parent.children.forEach((child) => this.findChildren(child, children)); } } } diff --git a/web/src/app/administration/services/saving-workbaskets.service.ts b/web/src/app/administration/services/saving-workbaskets.service.ts index 0e01bb370..989919182 100644 --- a/web/src/app/administration/services/saving-workbaskets.service.ts +++ b/web/src/app/administration/services/saving-workbaskets.service.ts @@ -2,9 +2,7 @@ import { Injectable } from '@angular/core'; import { Subject, Observable } from 'rxjs'; export class SavingInformation { - constructor(public url: string, - public workbasketId: string) { - } + constructor(public url: string, public workbasketId: string) {} } @Injectable() diff --git a/web/src/app/administration/services/workbasket-definition.service.ts b/web/src/app/administration/services/workbasket-definition.service.ts index 4eb20d79c..ac25eb547 100644 --- a/web/src/app/administration/services/workbasket-definition.service.ts +++ b/web/src/app/administration/services/workbasket-definition.service.ts @@ -9,12 +9,14 @@ import { BlobGenerator } from 'app/shared/util/blob-generator'; export class WorkbasketDefinitionService { url: string = `${environment.taskanaRestUrl}/v1/workbasket-definitions`; - constructor(private httpClient: HttpClient) { } + constructor(private httpClient: HttpClient) {} // GET async exportWorkbaskets(domain: string) { - const domainRequest = (domain === '' ? domain : `?domain=${domain}`); - const workbasketDefinitions = await this.httpClient.get(this.url + domainRequest).toPromise(); + const domainRequest = domain === '' ? domain : `?domain=${domain}`; + const workbasketDefinitions = await this.httpClient + .get(this.url + domainRequest) + .toPromise(); BlobGenerator.saveFile(workbasketDefinitions, `Workbaskets_${TaskanaDate.getDate()}.json`); } } diff --git a/web/src/app/app-routing.module.ts b/web/src/app/app-routing.module.ts index 2aafd5200..d5119891b 100644 --- a/web/src/app/app-routing.module.ts +++ b/web/src/app/app-routing.module.ts @@ -14,22 +14,22 @@ const appRoutes: Routes = [ { canActivate: [BusinessAdminGuard], path: 'administration', - loadChildren: () => import('./administration/administration.module').then(m => m.AdministrationModule), + loadChildren: () => import('./administration/administration.module').then((m) => m.AdministrationModule) }, { canActivate: [MonitorGuard], path: 'monitor', - loadChildren: () => import('./monitor/monitor.module').then(m => m.MonitorModule), + loadChildren: () => import('./monitor/monitor.module').then((m) => m.MonitorModule) }, { canActivate: [UserGuard], path: 'workplace', - loadChildren: () => import('./workplace/workplace.module').then(m => m.WorkplaceModule) + loadChildren: () => import('./workplace/workplace.module').then((m) => m.WorkplaceModule) }, { canActivate: [HistoryGuard], path: 'history', - loadChildren: () => import('./history/history.module').then(m => m.HistoryModule) + loadChildren: () => import('./history/history.module').then((m) => m.HistoryModule) }, { path: 'no-role', @@ -37,13 +37,13 @@ const appRoutes: Routes = [ }, { path: 'administration', - redirectTo: 'administration/workbaskets', + redirectTo: 'administration/workbaskets' }, { path: '**', redirectTo: 'workplace' - }, - ], + } + ] }, { path: 'no-role', @@ -52,16 +52,10 @@ const appRoutes: Routes = [ { path: '**', redirectTo: 'taskana/workplace' - }, + } ]; @NgModule({ - imports: [ - RouterModule.forRoot( - appRoutes, { useHash: true } - ) - ], - exports: [ - RouterModule - ] + imports: [RouterModule.forRoot(appRoutes, { useHash: true })], + exports: [RouterModule] }) -export class AppRoutingModule { } +export class AppRoutingModule {} diff --git a/web/src/app/app.component.spec.ts b/web/src/app/app.component.spec.ts index 0f5c8ddf8..d8b5dacb7 100644 --- a/web/src/app/app.component.spec.ts +++ b/web/src/app/app.component.spec.ts @@ -13,21 +13,12 @@ describe('AppComponent', () => { let fixture; let debugElement; - const routes: Routes = [ - { path: 'classifications', component: AppComponent } - ]; + const routes: Routes = [{ path: 'classifications', component: AppComponent }]; beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ - AppComponent, NavBarComponent - ], - imports: [ - AngularSvgIconModule, - RouterTestingModule.withRoutes(routes), - HttpClientModule, - SharedModule - ] + declarations: [AppComponent, NavBarComponent], + imports: [AngularSvgIconModule, RouterTestingModule.withRoutes(routes), HttpClientModule, SharedModule] }).compileComponents(); fixture = TestBed.createComponent(AppComponent); @@ -39,19 +30,22 @@ describe('AppComponent', () => { document.body.removeChild(debugElement); })); - it('should create the app', (() => { + it('should create the app', () => { expect(app).toBeTruthy(); - })); + }); - it('should render title in a tag', (() => { + it('should render title in a tag', () => { fixture.detectChanges(); expect(debugElement.querySelector('ul p a').textContent).toContain('Taskana administration'); - })); + }); - it('should call Router.navigateByUrl("classifications") and workbasketRoute should be false', (inject([Router], (router: Router) => { - expect(app.workbasketsRoute).toBe(true); - fixture.detectChanges(); - router.navigateByUrl('/classifications'); - expect(app.workbasketsRoute).toBe(false); - }))); + it('should call Router.navigateByUrl("classifications") and workbasketRoute should be false', inject( + [Router], + (router: Router) => { + expect(app.workbasketsRoute).toBe(true); + fixture.detectChanges(); + router.navigateByUrl('/classifications'); + expect(app.workbasketsRoute).toBe(false); + } + )); }); diff --git a/web/src/app/app.component.ts b/web/src/app/app.component.ts index ca344690b..19c9f8432 100644 --- a/web/src/app/app.component.ts +++ b/web/src/app/app.component.ts @@ -38,9 +38,7 @@ export class AppComponent implements OnInit, OnDestroy { private formsValidatorService: FormsValidatorService, private errorService: NotificationService, public uploadService: UploadService - ) { - - } + ) {} @HostListener('window:resize', ['$event']) onResize() { @@ -48,16 +46,18 @@ export class AppComponent implements OnInit, OnDestroy { } ngOnInit() { - this.routerSubscription = this.router.events.subscribe(event => { + this.routerSubscription = this.router.events.subscribe((event) => { if (event instanceof NavigationStart) { this.selectedRouteService.selectRoute(event); this.formsValidatorService.formSubmitAttempt = false; } }); - this.requestInProgressSubscription = this.requestInProgressService.getRequestInProgress().subscribe((value: boolean) => { - this.requestInProgress = value; - }); + this.requestInProgressSubscription = this.requestInProgressService + .getRequestInProgress() + .subscribe((value: boolean) => { + this.requestInProgress = value; + }); this.selectedRouteSubscription = this.selectedRouteService.getSelectedRoute().subscribe((value: string) => { if (value.indexOf('classifications') !== -1) { @@ -65,7 +65,7 @@ export class AppComponent implements OnInit, OnDestroy { } this.selectedRoute = value; }); - this.uploadingFileSubscription = this.uploadService.getCurrentProgressValue().subscribe(value => { + this.uploadingFileSubscription = this.uploadService.getCurrentProgressValue().subscribe((value) => { this.currentProgressValue = value; }); } diff --git a/web/src/app/app.module.ts b/web/src/app/app.module.ts index 856432be8..44b10764c 100644 --- a/web/src/app/app.module.ts +++ b/web/src/app/app.module.ts @@ -66,12 +66,7 @@ const MODULES = [ NgxsReduxDevtoolsPluginModule.forRoot({ disabled: environment.production, maxAge: 25 }) ]; -const DECLARATIONS = [ - AppComponent, - NavBarComponent, - UserInformationComponent, - NoAccessComponent, -]; +const DECLARATIONS = [AppComponent, NavBarComponent, UserInformationComponent, NoAccessComponent]; export function startupServiceFactory(startupService: StartupService): () => Promise { return (): Promise => startupService.load(); @@ -102,9 +97,8 @@ export function startupServiceFactory(startupService: StartupService): () => Pro FormsValidatorService, UploadService, NotificationService, - ClassificationCategoriesService, + ClassificationCategoriesService ], bootstrap: [AppComponent] }) -export class AppModule { -} +export class AppModule {} diff --git a/web/src/app/app.test.configuration.ts b/web/src/app/app.test.configuration.ts index d00908d53..197a5942a 100644 --- a/web/src/app/app.test.configuration.ts +++ b/web/src/app/app.test.configuration.ts @@ -21,18 +21,28 @@ export const configureTests = (configure: (testBed: TestBed) => void) => { const testBed = getTestBed(); if (testBed.platform == null) { - testBed.initTestEnvironment( - BrowserDynamicTestingModule, - platformBrowserDynamicTesting() - ); + testBed.initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting()); } configure(testBed); testBed.configureTestingModule({ - imports: [BrowserAnimationsModule, SharedModule, FormsModule, ReactiveFormsModule, HttpClientModule, AngularSvgIconModule], - providers: [{ provide: TaskanaEngineService, useClass: TaskanaEngineServiceMock }, - { provide: DomainService, useClass: DomainServiceMock }, NotificationService, - RequestInProgressService, OrientationService, SelectedRouteService, FormsValidatorService] + imports: [ + BrowserAnimationsModule, + SharedModule, + FormsModule, + ReactiveFormsModule, + HttpClientModule, + AngularSvgIconModule + ], + providers: [ + { provide: TaskanaEngineService, useClass: TaskanaEngineServiceMock }, + { provide: DomainService, useClass: DomainServiceMock }, + NotificationService, + RequestInProgressService, + OrientationService, + SelectedRouteService, + FormsValidatorService + ] }); return testBed.compileComponents().then(() => testBed); diff --git a/web/src/app/app.test.module.ts b/web/src/app/app.test.module.ts index 77f179976..25545ddff 100644 --- a/web/src/app/app.test.module.ts +++ b/web/src/app/app.test.module.ts @@ -1,17 +1,13 @@ import { NgModule } from '@angular/core'; import { TaskanaTypeAheadMockComponent } from 'app/shared/components/type-ahead/type-ahead.mock.component'; -const MODULES = [ -]; +const MODULES = []; -const DECLARATIONS = [ - TaskanaTypeAheadMockComponent -]; +const DECLARATIONS = [TaskanaTypeAheadMockComponent]; @NgModule({ declarations: DECLARATIONS, imports: MODULES, providers: [] }) -export class AppTestModule { -} +export class AppTestModule {} diff --git a/web/src/app/history/history-routing.module.ts b/web/src/app/history/history-routing.module.ts index 1660d8080..8a8b03129 100644 --- a/web/src/app/history/history-routing.module.ts +++ b/web/src/app/history/history-routing.module.ts @@ -10,10 +10,11 @@ const routes: Routes = [ { path: '**', redirectTo: '' - }]; + } +]; @NgModule({ imports: [RouterModule.forChild(routes)], exports: [RouterModule] }) -export class HistoryRoutingModule { } +export class HistoryRoutingModule {} diff --git a/web/src/app/history/history.module.ts b/web/src/app/history/history.module.ts index aee86448e..4ce608837 100644 --- a/web/src/app/history/history.module.ts +++ b/web/src/app/history/history.module.ts @@ -7,13 +7,7 @@ import { HistoryRoutingModule } from './history-routing.module'; import { TaskQueryComponent } from './task-query/task-query.component'; @NgModule({ - imports: [ - CommonModule, - HistoryRoutingModule, - SharedModule, - FormsModule, - ReactiveFormsModule - ], + imports: [CommonModule, HistoryRoutingModule, SharedModule, FormsModule, ReactiveFormsModule], declarations: [TaskQueryComponent] }) -export class HistoryModule { } +export class HistoryModule {} diff --git a/web/src/app/history/services/task-query/task-query.service.ts b/web/src/app/history/services/task-query/task-query.service.ts index 53ed3f0db..7d90fed60 100644 --- a/web/src/app/history/services/task-query/task-query.service.ts +++ b/web/src/app/history/services/task-query/task-query.service.ts @@ -14,7 +14,7 @@ import { environment } from 'environments/environment'; export class TaskQueryService { private url = environment.taskanaRestUrl; - constructor(private httpClient: HttpClient) { } + constructor(private httpClient: HttpClient) {} queryTask( orderBy: string = 'created', @@ -22,31 +22,33 @@ export class TaskQueryService { searchForValues: TaskHistoryEventData, allPages: boolean = false ): Observable { - return this.httpClient.get(`${this.url}/v1/task-history-event${this.getQueryParameters( - orderBy, - sortDirection, - searchForValues.taskId, - searchForValues.parentBusinessProcessId, - searchForValues.businessProcessId, - searchForValues.eventType, - searchForValues.userId, - searchForValues.domain, - searchForValues.workbasketKey, - searchForValues.porCompany, - searchForValues.porSystem, - searchForValues.porInstance, - searchForValues.porType, - searchForValues.porValue, - searchForValues.taskClassificationKey, - searchForValues.taskClassificationCategory, - searchForValues.attachmentClassificationKey, - searchForValues.custom1, - searchForValues.custom2, - searchForValues.custom3, - searchForValues.custom4, - searchForValues.created, - allPages - )}`); + return this.httpClient.get( + `${this.url}/v1/task-history-event${this.getQueryParameters( + orderBy, + sortDirection, + searchForValues.taskId, + searchForValues.parentBusinessProcessId, + searchForValues.businessProcessId, + searchForValues.eventType, + searchForValues.userId, + searchForValues.domain, + searchForValues.workbasketKey, + searchForValues.porCompany, + searchForValues.porSystem, + searchForValues.porInstance, + searchForValues.porType, + searchForValues.porValue, + searchForValues.taskClassificationKey, + searchForValues.taskClassificationCategory, + searchForValues.attachmentClassificationKey, + searchForValues.custom1, + searchForValues.custom2, + searchForValues.custom3, + searchForValues.custom4, + searchForValues.created, + allPages + )}` + ); } private getQueryParameters( @@ -98,7 +100,10 @@ export class TaskQueryService { parameters.CUSTOM_4_LIKE = custom4; parameters.CREATED = created; - if (allPages) { delete TaskanaQueryParameters.page; delete TaskanaQueryParameters.pageSize; } + if (allPages) { + delete TaskanaQueryParameters.page; + delete TaskanaQueryParameters.pageSize; + } return TaskanaQueryParameters.getQueryParameters(parameters); } diff --git a/web/src/app/history/task-query/task-query.component.scss b/web/src/app/history/task-query/task-query.component.scss index 141b014bf..3686f75a3 100644 --- a/web/src/app/history/task-query/task-query.component.scss +++ b/web/src/app/history/task-query/task-query.component.scss @@ -1,41 +1,41 @@ @import '../../../theme/colors'; .table { - max-height: calc(100vh - 152px); - padding-right: 15px; + max-height: calc(100vh - 152px); + padding-right: 15px; } .table-header { - background-color: $light-grey; - cursor: pointer; + background-color: $light-grey; + cursor: pointer; } .table-footer { - display: block; + display: block; } .table-cell { - height: 35px; - max-height: 35px; - min-height: 35px; + height: 35px; + max-height: 35px; + min-height: 35px; } .divDate { - padding-right: 20px; + padding-right: 20px; } -.btn-xs{ - padding: 0px; +.btn-xs { + padding: 0px; } .table .btn { - border: none; + border: none; } .icon-space { - margin-right: 20px; + margin-right: 20px; } .divTablePagination { - margin: 0 auto; + margin: 0 auto; } diff --git a/web/src/app/history/task-query/task-query.component.spec.ts b/web/src/app/history/task-query/task-query.component.spec.ts index c02426a31..396443593 100644 --- a/web/src/app/history/task-query/task-query.component.spec.ts +++ b/web/src/app/history/task-query/task-query.component.spec.ts @@ -9,8 +9,7 @@ describe('TaskQueryComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [TaskQueryComponent] - }) - .compileComponents(); + }).compileComponents(); })); beforeEach(() => { diff --git a/web/src/app/history/task-query/task-query.component.ts b/web/src/app/history/task-query/task-query.component.ts index f69f1a9d5..9708f6836 100644 --- a/web/src/app/history/task-query/task-query.component.ts +++ b/web/src/app/history/task-query/task-query.component.ts @@ -31,8 +31,7 @@ export class TaskQueryComponent implements OnInit { private orientationService: OrientationService, private requestInProgressService: RequestInProgressService, private errorsService: NotificationService - ) { - } + ) {} ngOnInit() { this.orientationSubscription = this.orientationService.getOrientation().subscribe((orientation: Orientation) => { @@ -99,12 +98,18 @@ export class TaskQueryComponent implements OnInit { } isDate(fieldName: string): boolean { - return (fieldName === 'created'); + return fieldName === 'created'; } filterFieldsToAllowQuerying(fieldName: string): boolean { - if (!fieldName || fieldName === 'oldData' || fieldName === 'newData' || fieldName === 'comment' - || fieldName === 'oldValue' || fieldName === 'newValue') { + if ( + !fieldName || + fieldName === 'oldData' || + fieldName === 'newData' || + fieldName === 'comment' || + fieldName === 'oldValue' || + fieldName === 'newValue' + ) { return false; } @@ -119,9 +124,17 @@ export class TaskQueryComponent implements OnInit { } filterExpandGroup(fieldName: string): boolean { - if (fieldName === 'custom1' || fieldName === 'custom2' || fieldName === 'custom3' || fieldName === 'custom4' - || fieldName === 'oldData' || fieldName === 'newData' || fieldName === 'comment' - || fieldName === 'oldValue' || fieldName === 'newValue') { + if ( + fieldName === 'custom1' || + fieldName === 'custom2' || + fieldName === 'custom3' || + fieldName === 'custom4' || + fieldName === 'oldData' || + fieldName === 'newData' || + fieldName === 'comment' || + fieldName === 'oldValue' || + fieldName === 'newValue' + ) { return true; } return false; @@ -179,21 +192,23 @@ export class TaskQueryComponent implements OnInit { private performRequest() { this.requestInProgressService.setRequestInProgress(true); this.calculateQueryPages(); - this.taskQuerySubscription = this.taskQueryService.queryTask( - this.orderBy.sortBy.replace(/([A-Z])|([0-9])/g, g => `-${g[0].toLowerCase()}`), - this.orderBy.sortDirection, - new TaskHistoryEventData(this.taskQueryForm.value), - false - ).subscribe(taskQueryResource => { - this.requestInProgressService.setRequestInProgress(false); - this.taskQueryResource = taskQueryResource.taskHistoryEvents ? taskQueryResource : null; - this.taskQuery = taskQueryResource.taskHistoryEvents ? taskQueryResource.taskHistoryEvents : null; - }); + this.taskQuerySubscription = this.taskQueryService + .queryTask( + this.orderBy.sortBy.replace(/([A-Z])|([0-9])/g, (g) => `-${g[0].toLowerCase()}`), + this.orderBy.sortDirection, + new TaskHistoryEventData(this.taskQueryForm.value), + false + ) + .subscribe((taskQueryResource) => { + this.requestInProgressService.setRequestInProgress(false); + this.taskQueryResource = taskQueryResource.taskHistoryEvents ? taskQueryResource : null; + this.taskQuery = taskQueryResource.taskHistoryEvents ? taskQueryResource.taskHistoryEvents : null; + }); } private initTaskQueryForm() { const me = this; - Object.keys(new TaskHistoryEventData()).forEach(key => { + Object.keys(new TaskHistoryEventData()).forEach((key) => { me.taskQueryForm.addControl(key, new FormControl()); }); } @@ -202,7 +217,7 @@ export class TaskQueryComponent implements OnInit { const rowHeight = 34; const unusedHeight = 300; const totalHeight = window.innerHeight; - const cards = Math.round((totalHeight - (unusedHeight)) / rowHeight); + const cards = Math.round((totalHeight - unusedHeight) / rowHeight); TaskanaQueryParameters.page = TaskanaQueryParameters.page ? TaskanaQueryParameters.page : 1; TaskanaQueryParameters.pageSize = cards > 0 ? cards : 1; } diff --git a/web/src/app/monitor/components/classification-report/classification-report.component.spec.ts b/web/src/app/monitor/components/classification-report/classification-report.component.spec.ts index 8c940d137..b03b2c6e3 100644 --- a/web/src/app/monitor/components/classification-report/classification-report.component.spec.ts +++ b/web/src/app/monitor/components/classification-report/classification-report.component.spec.ts @@ -9,8 +9,7 @@ describe('ClassificationReportComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [ClassificationReportComponent] - }) - .compileComponents(); + }).compileComponents(); })); beforeEach(() => { diff --git a/web/src/app/monitor/components/classification-report/classification-report.component.ts b/web/src/app/monitor/components/classification-report/classification-report.component.ts index 9f15c0fc7..39448b9ff 100644 --- a/web/src/app/monitor/components/classification-report/classification-report.component.ts +++ b/web/src/app/monitor/components/classification-report/classification-report.component.ts @@ -26,8 +26,7 @@ export class ClassificationReportComponent implements OnInit { constructor( private restConnectorService: RestConnectorService, private requestInProgressService: RequestInProgressService - ) { - } + ) {} async ngOnInit() { this.requestInProgressService.setRequestInProgress(true); diff --git a/web/src/app/monitor/components/monitor/monitor.component.ts b/web/src/app/monitor/components/monitor/monitor.component.ts index 0ba2c17a0..a1d015b3a 100644 --- a/web/src/app/monitor/components/monitor/monitor.component.ts +++ b/web/src/app/monitor/components/monitor/monitor.component.ts @@ -8,11 +8,9 @@ import { Component, OnDestroy, OnInit } from '@angular/core'; export class MonitorComponent implements OnInit, OnDestroy { tabSelected = 'tasks'; - ngOnInit(): void { - } + ngOnInit(): void {} - ngOnDestroy(): void { - } + ngOnDestroy(): void {} selectTab(tab) { this.tabSelected = tab; diff --git a/web/src/app/monitor/components/report-table/report-table.component.scss b/web/src/app/monitor/components/report-table/report-table.component.scss index 14252e1bd..da94ed927 100644 --- a/web/src/app/monitor/components/report-table/report-table.component.scss +++ b/web/src/app/monitor/components/report-table/report-table.component.scss @@ -1,20 +1,20 @@ .report { - margin-top: 20px; + margin-top: 20px; } .table-cell--clickable { - cursor: pointer; + cursor: pointer; } .table-row--highlight, .table-row--hover:hover { - background-color: #f9f9f9; + background-color: #f9f9f9; } .table-row--highlight > .table-cell { - border-bottom: 2px solid #ddd; + border-bottom: 2px solid #ddd; } .table-row--white { - background-color: white !important; -} \ No newline at end of file + background-color: white !important; +} diff --git a/web/src/app/monitor/components/report-table/report-table.component.ts b/web/src/app/monitor/components/report-table/report-table.component.ts index 9a175a22c..346ddf602 100644 --- a/web/src/app/monitor/components/report-table/report-table.component.ts +++ b/web/src/app/monitor/components/report-table/report-table.component.ts @@ -12,24 +12,25 @@ export class ReportTableComponent implements OnInit { @Input() reportData: ReportData; - ngOnInit(): void { - } + ngOnInit(): void {} toggleFold(indexNumber: number, sumRow: boolean = false) { let rows = sumRow ? this.reportData.sumRow : this.reportData.rows; let index = indexNumber; - const toggleRow = rows[index += 1]; + const toggleRow = rows[(index += 1)]; if (toggleRow.depth < this.reportData.meta.rowDesc.length - 1) { - const firstChildRow = rows[index += 1]; + const firstChildRow = rows[(index += 1)]; firstChildRow.display = !firstChildRow.display; - const endIndex = rows.findIndex(row => row.depth <= toggleRow.depth); + const endIndex = rows.findIndex((row) => row.depth <= toggleRow.depth); rows = endIndex >= 0 ? rows.slice(0, endIndex) : rows; - rows.forEach(row => { row.display = firstChildRow.display && row.depth === firstChildRow.depth; }); + rows.forEach((row) => { + row.display = firstChildRow.display && row.depth === firstChildRow.depth; + }); this.currentExpHeaders = Math.max( - ...this.reportData.rows.filter(r => r.display).map(r => r.depth), - ...this.reportData.sumRow.filter(r => r.display).map(r => r.depth) + ...this.reportData.rows.filter((r) => r.display).map((r) => r.depth), + ...this.reportData.sumRow.filter((r) => r.display).map((r) => r.depth) ); } } diff --git a/web/src/app/monitor/components/task-report/task-report.component.spec.ts b/web/src/app/monitor/components/task-report/task-report.component.spec.ts index 55c56f274..3758af34e 100644 --- a/web/src/app/monitor/components/task-report/task-report.component.spec.ts +++ b/web/src/app/monitor/components/task-report/task-report.component.spec.ts @@ -9,8 +9,7 @@ describe('TaskReportComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [TaskReportComponent] - }) - .compileComponents(); + }).compileComponents(); })); beforeEach(() => { diff --git a/web/src/app/monitor/components/task-report/task-report.component.ts b/web/src/app/monitor/components/task-report/task-report.component.ts index 3c2b4b3e2..8e7653d86 100644 --- a/web/src/app/monitor/components/task-report/task-report.component.ts +++ b/web/src/app/monitor/components/task-report/task-report.component.ts @@ -6,7 +6,7 @@ import { RequestInProgressService } from '../../../shared/services/request-in-pr @Component({ selector: 'taskana-monitor-task-report', templateUrl: './task-report.component.html', - styleUrls: ['./task-report.component.scss'], + styleUrls: ['./task-report.component.scss'] }) export class TaskReportComponent implements OnInit { pieChartLabels: string[]; @@ -17,14 +17,13 @@ export class TaskReportComponent implements OnInit { constructor( private restConnectorService: RestConnectorService, private requestInProgressService: RequestInProgressService - ) { - } + ) {} async ngOnInit() { this.requestInProgressService.setRequestInProgress(true); this.reportData = await this.restConnectorService.getTaskStatusReport().toPromise(); this.pieChartLabels = this.reportData.meta.header; - this.reportData.sumRow[0].cells.forEach(c => { + this.reportData.sumRow[0].cells.forEach((c) => { this.pieChartData.push(c); }); this.requestInProgressService.setRequestInProgress(false); diff --git a/web/src/app/monitor/components/timestamp-report/timestamp-report.component.ts b/web/src/app/monitor/components/timestamp-report/timestamp-report.component.ts index 495075a49..08f4f357d 100644 --- a/web/src/app/monitor/components/timestamp-report/timestamp-report.component.ts +++ b/web/src/app/monitor/components/timestamp-report/timestamp-report.component.ts @@ -10,8 +10,7 @@ import { RestConnectorService } from '../../services/rest-connector.service'; export class TimestampReportComponent implements OnInit { reportData: ReportData; - constructor(private restConnectorService: RestConnectorService) { - } + constructor(private restConnectorService: RestConnectorService) {} ngOnInit() { this.restConnectorService.getDailyEntryExitReport().subscribe((data: ReportData) => { diff --git a/web/src/app/monitor/components/workbasket-report-due-date/workbasket-report-due-date.component.spec.ts b/web/src/app/monitor/components/workbasket-report-due-date/workbasket-report-due-date.component.spec.ts index 514b24c43..c33c2c92b 100644 --- a/web/src/app/monitor/components/workbasket-report-due-date/workbasket-report-due-date.component.spec.ts +++ b/web/src/app/monitor/components/workbasket-report-due-date/workbasket-report-due-date.component.spec.ts @@ -9,8 +9,7 @@ describe('WorkbasketReportDueDateComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [WorkbasketReportDueDateComponent] - }) - .compileComponents(); + }).compileComponents(); })); beforeEach(() => { diff --git a/web/src/app/monitor/components/workbasket-report-due-date/workbasket-report-due-date.component.ts b/web/src/app/monitor/components/workbasket-report-due-date/workbasket-report-due-date.component.ts index a41f73455..dd3e8f937 100644 --- a/web/src/app/monitor/components/workbasket-report-due-date/workbasket-report-due-date.component.ts +++ b/web/src/app/monitor/components/workbasket-report-due-date/workbasket-report-due-date.component.ts @@ -30,8 +30,7 @@ export class WorkbasketReportDueDateComponent implements OnInit { constructor( private restConnectorService: RestConnectorService, private requestInProgressService: RequestInProgressService - ) { - } + ) {} async ngOnInit() { this.requestInProgressService.setRequestInProgress(true); diff --git a/web/src/app/monitor/components/workbasket-report-planned-date/workbasket-report-planned-date.component.spec.ts b/web/src/app/monitor/components/workbasket-report-planned-date/workbasket-report-planned-date.component.spec.ts index 6067bd0f9..8af4ebe78 100644 --- a/web/src/app/monitor/components/workbasket-report-planned-date/workbasket-report-planned-date.component.spec.ts +++ b/web/src/app/monitor/components/workbasket-report-planned-date/workbasket-report-planned-date.component.spec.ts @@ -9,8 +9,7 @@ describe('WorkbasketReportPlannedDateComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [WorkbasketReportPlannedDateComponent] - }) - .compileComponents(); + }).compileComponents(); })); beforeEach(() => { diff --git a/web/src/app/monitor/components/workbasket-report-planned-date/workbasket-report-planned-date.component.ts b/web/src/app/monitor/components/workbasket-report-planned-date/workbasket-report-planned-date.component.ts index 667423b88..1ac932b70 100644 --- a/web/src/app/monitor/components/workbasket-report-planned-date/workbasket-report-planned-date.component.ts +++ b/web/src/app/monitor/components/workbasket-report-planned-date/workbasket-report-planned-date.component.ts @@ -23,7 +23,7 @@ export class WorkbasketReportPlannedDateComponent implements OnInit { lineChartData: Array; lineChartOptions: any = { responsive: true, - scales: { xAxes: [{}], yAxes: [{}] }, + scales: { xAxes: [{}], yAxes: [{}] } }; lineChartColors = ChartColorsDefinition.getColors(); @@ -31,8 +31,7 @@ export class WorkbasketReportPlannedDateComponent implements OnInit { constructor( private restConnectorService: RestConnectorService, private requestInProgressService: RequestInProgressService - ) { - } + ) {} async ngOnInit() { this.requestInProgressService.setRequestInProgress(true); diff --git a/web/src/app/monitor/components/workbasket-report-query-switcher/workbasket-report-query-switcher.component.spec.ts b/web/src/app/monitor/components/workbasket-report-query-switcher/workbasket-report-query-switcher.component.spec.ts index 2d3d5605e..3233dc4e5 100644 --- a/web/src/app/monitor/components/workbasket-report-query-switcher/workbasket-report-query-switcher.component.spec.ts +++ b/web/src/app/monitor/components/workbasket-report-query-switcher/workbasket-report-query-switcher.component.spec.ts @@ -9,8 +9,7 @@ describe('WorkbasketReportQuerySwitcherComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [WorkbasketReportQuerySwitcherComponent] - }) - .compileComponents(); + }).compileComponents(); })); beforeEach(() => { diff --git a/web/src/app/monitor/components/workbasket-report/workbasket-report.component.spec.ts b/web/src/app/monitor/components/workbasket-report/workbasket-report.component.spec.ts index e9f1cae3a..fba318ca9 100644 --- a/web/src/app/monitor/components/workbasket-report/workbasket-report.component.spec.ts +++ b/web/src/app/monitor/components/workbasket-report/workbasket-report.component.spec.ts @@ -9,8 +9,7 @@ describe('WorkbasketReportComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [WorkbasketReportComponent] - }) - .compileComponents(); + }).compileComponents(); })); beforeEach(() => { diff --git a/web/src/app/monitor/components/workbasket-report/workbasket-report.component.ts b/web/src/app/monitor/components/workbasket-report/workbasket-report.component.ts index 4c9d33676..14f511ae9 100644 --- a/web/src/app/monitor/components/workbasket-report/workbasket-report.component.ts +++ b/web/src/app/monitor/components/workbasket-report/workbasket-report.component.ts @@ -12,8 +12,7 @@ export class WorkbasketReportComponent implements OnInit { showMonitorQueryPlannedDate: Boolean; showMonitorQueryDueDate: Boolean; - ngOnInit() { - } + ngOnInit() {} getMetaInformation(metaInformation: MetaInfoData) { this.metaInformation = metaInformation; diff --git a/web/src/app/monitor/models/chart-colors.ts b/web/src/app/monitor/models/chart-colors.ts index ec6f0bfc6..a2a9c4a29 100644 --- a/web/src/app/monitor/models/chart-colors.ts +++ b/web/src/app/monitor/models/chart-colors.ts @@ -1,7 +1,8 @@ export class ChartColorsDefinition { public static getColors(): Array { return [ - { // red + { + // red backgroundColor: 'rgba(215, 40, 40, 0.2)', borderColor: 'rgba(215, 40, 40, 1)', pointBackgroundColor: 'rgba(215, 40, 40, 1)', @@ -9,7 +10,8 @@ export class ChartColorsDefinition { pointHoverBackgroundColor: '#fff', pointHoverBorderColor: 'rgba(215, 40, 40, 0.8)' }, - { // yellow + { + // yellow backgroundColor: 'rgba(208, 205, 44, 0.2)', borderColor: 'rgba(208, 205, 44, 1)', pointBackgroundColor: 'rgba(208, 205, 44, 1)', @@ -17,7 +19,8 @@ export class ChartColorsDefinition { pointHoverBackgroundColor: '#fff', pointHoverBorderColor: 'rgba(208, 205, 44, 0.8)' }, - { // green + { + // green backgroundColor: 'rgba(45, 205, 44, 0.2)', borderColor: 'rgba(45, 205, 44, 1)', pointBackgroundColor: 'rgba(45, 205, 44, 1)', @@ -25,7 +28,8 @@ export class ChartColorsDefinition { pointHoverBackgroundColor: '#fff', pointHoverBorderColor: 'rgba(45, 205, 44, 0.8)' }, - { // blue + { + // blue backgroundColor: 'rgba(45, 45, 201, 0.2)', borderColor: 'rgba(45, 45, 201, 1)', pointBackgroundColor: 'rgba(45, 45, 201, 1)', @@ -33,7 +37,8 @@ export class ChartColorsDefinition { pointHoverBackgroundColor: '#fff', pointHoverBorderColor: 'rgba(45, 45, 201, 0.8)' }, - { // cyan + { + // cyan backgroundColor: 'rgba(45, 190, 201, 0.2)', borderColor: 'rgba(45, 190, 201, 1)', pointBackgroundColor: 'rgba(45, 190, 201, 1)', @@ -41,7 +46,8 @@ export class ChartColorsDefinition { pointHoverBackgroundColor: '#fff', pointHoverBorderColor: 'rgba(45, 190, 201, 0.8)' }, - { // black-grey + { + // black-grey backgroundColor: 'rgba(37, 35, 38, 0.2)', borderColor: 'rgba(37, 35, 38, 1)', pointBackgroundColor: 'rgba(37, 35, 38, 1)', @@ -49,7 +55,8 @@ export class ChartColorsDefinition { pointHoverBackgroundColor: '#fff', pointHoverBorderColor: 'rgba(37, 35, 38, 0.8)' }, - { // orange + { + // orange backgroundColor: 'rgba(221, 125, 0, 0.2)', borderColor: 'rgba(221, 125, 0, 1)', pointBackgroundColor: 'rgba(221, 125, 0, 1)', @@ -57,7 +64,8 @@ export class ChartColorsDefinition { pointHoverBackgroundColor: '#fff', pointHoverBorderColor: 'rgba(221, 125, 0, 0.8)' }, - { // lile + { + // lile backgroundColor: 'rgba(180, 137, 255, 0.2)', borderColor: 'rgba(180, 137, 255, 1)', pointBackgroundColor: 'rgba(180, 137, 255, 1)', diff --git a/web/src/app/monitor/monitor.module.ts b/web/src/app/monitor/monitor.module.ts index f4e831561..f5d3d8479 100644 --- a/web/src/app/monitor/monitor.module.ts +++ b/web/src/app/monitor/monitor.module.ts @@ -43,7 +43,7 @@ const DECLARATIONS = [ WorkbasketReportDueDateComponent, WorkbasketReportQuerySwitcherComponent, TaskReportComponent, - ClassificationReportComponent, + ClassificationReportComponent ]; @NgModule({ @@ -51,5 +51,4 @@ const DECLARATIONS = [ imports: MODULES, providers: [RestConnectorService, MapToIterable] }) -export class MonitorModule { -} +export class MonitorModule {} diff --git a/web/src/app/monitor/services/rest-connector.service.ts b/web/src/app/monitor/services/rest-connector.service.ts index 494d52cc3..e1169e162 100644 --- a/web/src/app/monitor/services/rest-connector.service.ts +++ b/web/src/app/monitor/services/rest-connector.service.ts @@ -9,36 +9,36 @@ const monitorUrl = '/v1/monitor/'; @Injectable() export class RestConnectorService { - constructor(private httpClient: HttpClient) { - } + constructor(private httpClient: HttpClient) {} getTaskStatusReport(): Observable { - return this.httpClient.get(`${environment.taskanaRestUrl + monitorUrl - }tasks-status-report?states=READY,CLAIMED,COMPLETED`); + return this.httpClient.get( + `${environment.taskanaRestUrl + monitorUrl}tasks-status-report?states=READY,CLAIMED,COMPLETED` + ); } getWorkbasketStatisticsQueryingByDueDate(): Observable { - return this.httpClient.get(`${environment.taskanaRestUrl - + monitorUrl}tasks-workbasket-report?states=READY,CLAIMED,COMPLETED`); + return this.httpClient.get( + `${environment.taskanaRestUrl + monitorUrl}tasks-workbasket-report?states=READY,CLAIMED,COMPLETED` + ); } getWorkbasketStatisticsQueryingByPlannedDate(): Observable { - return this.httpClient.get(`${environment.taskanaRestUrl - }/v1/monitor/tasks-workbasket-planned-date-report?daysInPast=7&states=READY,CLAIMED,COMPLETED`); + return this.httpClient.get( + `${environment.taskanaRestUrl}/v1/monitor/tasks-workbasket-planned-date-report?daysInPast=7&states=READY,CLAIMED,COMPLETED` + ); } getClassificationTasksReport(): Observable { - return this.httpClient.get(`${environment.taskanaRestUrl - + monitorUrl}tasks-classification-report`); + return this.httpClient.get(`${environment.taskanaRestUrl + monitorUrl}tasks-classification-report`); } getDailyEntryExitReport(): Observable { - return this.httpClient.get(`${environment.taskanaRestUrl - + monitorUrl}timestamp-report`); + return this.httpClient.get(`${environment.taskanaRestUrl + monitorUrl}timestamp-report`); } getChartData(source: ReportData): Array { - return source.rows.map(row => { + return source.rows.map((row) => { const rowData = new ChartData(); [rowData.label] = row.desc; rowData.data = row.cells; diff --git a/web/src/app/shared/components/date-picker/date-picker.component.spec.ts b/web/src/app/shared/components/date-picker/date-picker.component.spec.ts index 3d7511d03..3d7980143 100644 --- a/web/src/app/shared/components/date-picker/date-picker.component.spec.ts +++ b/web/src/app/shared/components/date-picker/date-picker.component.spec.ts @@ -1,6 +1,12 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { BsDatepickerModule, BsDatepickerConfig, ComponentLoaderFactory, PositioningService, BsLocaleService } from 'ngx-bootstrap'; +import { + BsDatepickerModule, + BsDatepickerConfig, + ComponentLoaderFactory, + PositioningService, + BsLocaleService +} from 'ngx-bootstrap'; import { DatePickerComponent } from './date-picker.component'; describe('DatePickerComponent', () => { @@ -11,10 +17,8 @@ describe('DatePickerComponent', () => { TestBed.configureTestingModule({ imports: [BsDatepickerModule], declarations: [DatePickerComponent], - providers: [BsDatepickerConfig, ComponentLoaderFactory, PositioningService, - BsLocaleService] - }) - .compileComponents(); + providers: [BsDatepickerConfig, ComponentLoaderFactory, PositioningService, BsLocaleService] + }).compileComponents(); })); beforeEach(() => { diff --git a/web/src/app/shared/components/dropdown/dropdown.component.spec.ts b/web/src/app/shared/components/dropdown/dropdown.component.spec.ts index 8a6262686..79ad3ef62 100644 --- a/web/src/app/shared/components/dropdown/dropdown.component.spec.ts +++ b/web/src/app/shared/components/dropdown/dropdown.component.spec.ts @@ -9,8 +9,7 @@ describe('DropdownComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [DropdownComponent] - }) - .compileComponents(); + }).compileComponents(); })); beforeEach(() => { diff --git a/web/src/app/shared/components/dropdown/dropdown.component.ts b/web/src/app/shared/components/dropdown/dropdown.component.ts index 1f368f900..cd502d054 100644 --- a/web/src/app/shared/components/dropdown/dropdown.component.ts +++ b/web/src/app/shared/components/dropdown/dropdown.component.ts @@ -10,8 +10,7 @@ export class DropdownComponent implements OnInit { @Input() list: any[]; @Output() performClassification = new EventEmitter(); - ngOnInit(): void { - } + ngOnInit(): void {} selectItem(item: any) { this.itemSelected = item; diff --git a/web/src/app/shared/components/field-error-display/field-error-display.component.spec.ts b/web/src/app/shared/components/field-error-display/field-error-display.component.spec.ts index 3de8e5c2c..f9be40fe3 100644 --- a/web/src/app/shared/components/field-error-display/field-error-display.component.spec.ts +++ b/web/src/app/shared/components/field-error-display/field-error-display.component.spec.ts @@ -9,8 +9,7 @@ describe('FieldErrorDisplayComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [FieldErrorDisplayComponent] - }) - .compileComponents(); + }).compileComponents(); })); beforeEach(() => { diff --git a/web/src/app/shared/components/field-error-display/field-error-display.component.ts b/web/src/app/shared/components/field-error-display/field-error-display.component.ts index 3e01f443b..7ed24ac92 100644 --- a/web/src/app/shared/components/field-error-display/field-error-display.component.ts +++ b/web/src/app/shared/components/field-error-display/field-error-display.component.ts @@ -17,6 +17,5 @@ export class FieldErrorDisplayComponent implements OnInit { @Input() validationTrigger: boolean; - ngOnInit() { - } + ngOnInit() {} } diff --git a/web/src/app/shared/components/filter/filter.component.scss b/web/src/app/shared/components/filter/filter.component.scss index 5f2f4692f..74bd3ddaa 100644 --- a/web/src/app/shared/components/filter/filter.component.scss +++ b/web/src/app/shared/components/filter/filter.component.scss @@ -1,19 +1,19 @@ .dropdown-menu-users { - &>li{ - margin-bottom: 5px; - } - margin-left: 15px; + & > li { + margin-bottom: 5px; + } + margin-left: 15px; } .list-group-search { - padding: 0px 15px; - border-top: 1px solid #ddd; + padding: 0px 15px; + border-top: 1px solid #ddd; } .list-group-search { - border-top: none; + border-top: none; } row.padding { - padding: 1px 0px; + padding: 1px 0px; } .filter-list { diff --git a/web/src/app/shared/components/filter/filter.component.spec.ts b/web/src/app/shared/components/filter/filter.component.spec.ts index 7892b6cb9..aef3d7f9e 100644 --- a/web/src/app/shared/components/filter/filter.component.spec.ts +++ b/web/src/app/shared/components/filter/filter.component.spec.ts @@ -13,14 +13,14 @@ describe('FilterComponent', () => { let fixture: ComponentFixture; let debugElement: any; - beforeEach(done => { + beforeEach((done) => { const configure = (testBed: TestBed) => { testBed.configureTestingModule({ providers: [MatSnackBar, Overlay], imports: [AngularSvgIconModule, FormsModule, HttpClientModule] }); }; - configureTests(configure).then(testBed => { + configureTests(configure).then((testBed) => { fixture = TestBed.createComponent(FilterComponent); component = fixture.componentInstance; component.filterParams = { diff --git a/web/src/app/shared/components/filter/filter.component.ts b/web/src/app/shared/components/filter/filter.component.ts index d3b13b316..9daf9b9e7 100644 --- a/web/src/app/shared/components/filter/filter.component.ts +++ b/web/src/app/shared/components/filter/filter.component.ts @@ -9,11 +9,20 @@ import { TaskanaType } from 'app/shared/models/taskana-type'; styleUrls: ['./filter.component.scss'] }) export class FilterComponent implements OnInit { - @Input() allTypes: Map = new Map([['ALL', 'All'], ['PERSONAL', 'Personal'], ['GROUP', 'Group'], - ['CLEARANCE', 'Clearance'], ['TOPIC', 'Topic']]); + @Input() allTypes: Map = new Map([ + ['ALL', 'All'], + ['PERSONAL', 'Personal'], + ['GROUP', 'Group'], + ['CLEARANCE', 'Clearance'], + ['TOPIC', 'Topic'] + ]); - @Input() allStates: Map = new Map([['ALL', 'All'], ['READY', 'Ready'], ['CLAIMED', 'Claimed'], - ['COMPLETED', 'Completed']]); + @Input() allStates: Map = new Map([ + ['ALL', 'All'], + ['READY', 'Ready'], + ['CLAIMED', 'Claimed'], + ['COMPLETED', 'Completed'] + ]); @Input() filterParams = { name: '', key: '', type: '', description: '', owner: '' }; @@ -35,15 +44,17 @@ export class FilterComponent implements OnInit { } selectType(type: ICONTYPES) { - this.filter.filterParams.type = (type === ICONTYPES.ALL) ? '' : type; + this.filter.filterParams.type = type === ICONTYPES.ALL ? '' : type; } selectState(state: ICONTYPES) { - this.filter.filterParams.state = (state === 'ALL') ? '' : state; + this.filter.filterParams.state = state === 'ALL' ? '' : state; } clear() { - Object.keys(this.filterParams).forEach(key => { this.filterParams[key] = ''; }); + Object.keys(this.filterParams).forEach((key) => { + this.filterParams[key] = ''; + }); this.initializeFilterModel(); } @@ -68,6 +79,6 @@ export class FilterComponent implements OnInit { * @returns {string[]} */ getUnusedKeys(): string[] { - return Object.keys(this.filterParamKeys).filter(key => ['name', 'key', 'type'].indexOf(key) < 0); + return Object.keys(this.filterParamKeys).filter((key) => ['name', 'key', 'type'].indexOf(key) < 0); } } diff --git a/web/src/app/shared/components/master-and-detail/master-and-detail.component.scss b/web/src/app/shared/components/master-and-detail/master-and-detail.component.scss index d274d7961..5e361a980 100644 --- a/web/src/app/shared/components/master-and-detail/master-and-detail.component.scss +++ b/web/src/app/shared/components/master-and-detail/master-and-detail.component.scss @@ -1,4 +1,3 @@ - .center-block.no-detail { - text-align: center; + text-align: center; } diff --git a/web/src/app/shared/components/master-and-detail/master-and-detail.component.spec.ts b/web/src/app/shared/components/master-and-detail/master-and-detail.component.spec.ts index 2b1b71537..cc47f3612 100644 --- a/web/src/app/shared/components/master-and-detail/master-and-detail.component.spec.ts +++ b/web/src/app/shared/components/master-and-detail/master-and-detail.component.spec.ts @@ -12,17 +12,13 @@ import { MasterAndDetailComponent } from './master-and-detail.component'; selector: 'taskana-dummy-master', template: 'dummymaster' }) -export class DummyMasterComponent { - -} +export class DummyMasterComponent {} @Component({ selector: 'taskana-dummy-detail', template: 'dummydetail' }) -export class DummyDetailComponent { - -} +export class DummyDetailComponent {} describe('MasterAndDetailComponent ', () => { let component; @@ -51,18 +47,10 @@ describe('MasterAndDetailComponent ', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ - MasterAndDetailComponent, - DummyMasterComponent, - DummyDetailComponent], - imports: [ - RouterTestingModule.withRoutes(routes), - AngularSvgIconModule, - HttpClientModule - ], + declarations: [MasterAndDetailComponent, DummyMasterComponent, DummyDetailComponent], + imports: [RouterTestingModule.withRoutes(routes), AngularSvgIconModule, HttpClientModule], providers: [MasterAndDetailService] - }) - .compileComponents(); + }).compileComponents(); fixture = TestBed.createComponent(MasterAndDetailComponent); component = fixture.debugElement.componentInstance; diff --git a/web/src/app/shared/components/master-and-detail/master-and-detail.component.ts b/web/src/app/shared/components/master-and-detail/master-and-detail.component.ts index 9e8db6e38..b387c5eae 100644 --- a/web/src/app/shared/components/master-and-detail/master-and-detail.component.ts +++ b/web/src/app/shared/components/master-and-detail/master-and-detail.component.ts @@ -5,8 +5,7 @@ import { MasterAndDetailService } from 'app/shared/services/master-and-detail/ma @Component({ selector: 'taskana-shared-master-and-detail', templateUrl: './master-and-detail.component.html', - styleUrls: ['./master-and-detail.component.scss'], - + styleUrls: ['./master-and-detail.component.scss'] }) export class MasterAndDetailComponent implements OnInit { private classifications = 'classifications'; @@ -16,13 +15,16 @@ export class MasterAndDetailComponent implements OnInit { showDetail = false; currentRoute = ''; - constructor(private route: ActivatedRoute, private router: Router, private masterAndDetailService: MasterAndDetailService) { - } + constructor( + private route: ActivatedRoute, + private router: Router, + private masterAndDetailService: MasterAndDetailService + ) {} ngOnInit(): void { this.showDetail = this.showDetails(); this.masterAndDetailService.setShowDetail(this.showDetail); - this.router.events.subscribe(event => { + this.router.events.subscribe((event) => { if (event instanceof NavigationStart) { this.showDetail = this.showDetails(event); this.masterAndDetailService.setShowDetail(this.showDetail); @@ -43,7 +45,7 @@ export class MasterAndDetailComponent implements OnInit { private checkUrl(url: string): boolean { this.checkRoute(url); - return this.detailRoutes.some(routeDetail => url.indexOf(routeDetail) !== -1); + return this.detailRoutes.some((routeDetail) => url.indexOf(routeDetail) !== -1); } private checkRoute(url: string) { diff --git a/web/src/app/shared/components/nav-bar/nav-bar.component.scss b/web/src/app/shared/components/nav-bar/nav-bar.component.scss index d6d533e78..de2a0d5df 100644 --- a/web/src/app/shared/components/nav-bar/nav-bar.component.scss +++ b/web/src/app/shared/components/nav-bar/nav-bar.component.scss @@ -1,144 +1,144 @@ @import '../../../../theme/variables'; -.navbar.main:before { - @include degraded-bar(right, 100%, 3px) +.navbar.main:before { + @include degraded-bar(right, 100%, 3px); } .navbar-inverse { - border:none; - background-color: $dark-green; - box-shadow: 0px 1px 5px -1px black; + border: none; + background-color: $dark-green; + box-shadow: 0px 1px 5px -1px black; } -.navbar-toggle{ - margin: 3px 0px; +.navbar-toggle { + margin: 3px 0px; + font-size: 20px; + &.logout { font-size: 20px; - &.logout{ - font-size: 20px; - } - + } } -button.navbar-toggle:hover > span{ - color:$aquamarine; +button.navbar-toggle:hover > span { + color: $aquamarine; } ul.nav > p { - white-space: nowrap; - text-overflow: ellipsis; - padding-right: 0px; + white-space: nowrap; + text-overflow: ellipsis; + padding-right: 0px; } -.navbar-inverse .navbar-toggle, .navbar-toggle:hover, .navbar-inverse .navbar-toggle:focus { - border: none; - background-color: transparent; +.navbar-inverse .navbar-toggle, +.navbar-toggle:hover, +.navbar-inverse .navbar-toggle:focus { + border: none; + background-color: transparent; } svg-icon.logo { - float: left; - width: 150px; - height: 50px; - padding: 5px; - position: initial; + float: left; + width: 150px; + height: 50px; + padding: 5px; + position: initial; } -h2.navbar-brand{ - vertical-align: middle; - text-decoration: none; - color: white; - padding: 15px 0px 0px 0px; - font-size: 20px; +h2.navbar-brand { + vertical-align: middle; + text-decoration: none; + color: white; + padding: 15px 0px 0px 0px; + font-size: 20px; } .domain-form { - margin: 13px; - color: white; - font-size: 18px; - > div{ - cursor: pointer; - > button { - color: white; - background-color: $dark-green; - border: none; - font-size: 16px; - border-bottom: 1px solid $dark-green; - margin-left:5px; - } + margin: 13px; + color: white; + font-size: 18px; + > div { + cursor: pointer; + > button { + color: white; + background-color: $dark-green; + border: none; + font-size: 16px; + border-bottom: 1px solid $dark-green; + margin-left: 5px; } + } } -.nav-content{ - margin-top: 5px; +.nav-content { + margin-top: 5px; } .nav-version { - color: $grey; - position: absolute; - bottom: 5px; - font-size: 12px; + color: $grey; + position: absolute; + bottom: 5px; + font-size: 12px; } /* * All side bar links styling. */ .nav-sidebar > li > a { - padding-right: 20px; - padding-left: 20px; + padding-right: 20px; + padding-left: 20px; } - .menu > span:hover, -.submenu > span:hover - { - color: white; - cursor: pointer; +.submenu > span:hover { + color: white; + cursor: pointer; } .sidenav { - position:fixed; - z-index:999; - box-shadow: none; - height: 100%; - background-color: $dark-green; - box-shadow: 3px 0px 10px -1px $dark-green; + position: fixed; + z-index: 999; + box-shadow: none; + height: 100%; + background-color: $dark-green; + box-shadow: 3px 0px 10px -1px $dark-green; } .navbar { - height: 52px; - margin-bottom: 0px; - + height: 52px; + margin-bottom: 0px; } -.menu,.submenu > span { - margin-top: 15px; - font-size: 20px; - width: 100%; - font-family: inherit; - font-weight: 500; - line-height: 1.1; +.menu, +.submenu > span { + margin-top: 15px; + font-size: 20px; + width: 100%; + font-family: inherit; + font-weight: 500; + line-height: 1.1; } -.menu,.submenu > span { - padding-left: 12px; - color: $grey; - outline: none; - +.menu, +.submenu > span { + padding-left: 12px; + color: $grey; + outline: none; } -.menu.selected,.submenu.selected { - background-color: transparent; - &> span{ - padding-left: 10px; - border-left: $pallete-green 5px solid; - color: white; - } +.menu.selected, +.submenu.selected { + background-color: transparent; + & > span { + padding-left: 10px; + border-left: $pallete-green 5px solid; + color: white; + } } -.menu > .submenu{ - margin-left: 30px; +.menu > .submenu { + margin-left: 30px; } a { - color: $grey; - &:hover{ - color:white; - } - text-decoration: none + color: $grey; + &:hover { + color: white; + } + text-decoration: none; } diff --git a/web/src/app/shared/components/nav-bar/nav-bar.component.spec.ts b/web/src/app/shared/components/nav-bar/nav-bar.component.spec.ts index 988c9aaa7..19a3f4c9e 100644 --- a/web/src/app/shared/components/nav-bar/nav-bar.component.spec.ts +++ b/web/src/app/shared/components/nav-bar/nav-bar.component.spec.ts @@ -24,20 +24,13 @@ describe('NavBarComponent', () => { let debugElement; let navBar; - const routes: Routes = [ - { path: 'classifications', component: NavBarComponent } - ]; + const routes: Routes = [{ path: 'classifications', component: NavBarComponent }]; - beforeEach(done => { + beforeEach((done) => { const configure = (testBed: TestBed) => { testBed.configureTestingModule({ declarations: [NavBarComponent, UserInformationComponent], - imports: [ - AngularSvgIconModule, - HttpClientModule, - RouterTestingModule.withRoutes(routes), - SharedModule - ], + imports: [AngularSvgIconModule, HttpClientModule, RouterTestingModule.withRoutes(routes), SharedModule], providers: [ SelectedRouteService, BusinessAdminGuard, @@ -45,10 +38,11 @@ describe('NavBarComponent', () => { WindowRefService, RequestInProgressService, MatSnackBar, - Overlay] + Overlay + ] }); }; - configureTests(configure).then(testBed => { + configureTests(configure).then((testBed) => { fixture = TestBed.createComponent(NavBarComponent); component = fixture.componentInstance; debugElement = fixture.debugElement.nativeElement; @@ -67,7 +61,7 @@ describe('NavBarComponent', () => { expect(component).toBeTruthy(); }); - it('should have as title \'\'', (() => { + it("should have as title ''", () => { expect(navBar.title).toEqual(''); - })); + }); }); diff --git a/web/src/app/shared/components/nav-bar/nav-bar.component.ts b/web/src/app/shared/components/nav-bar/nav-bar.component.ts index 5fc473c3f..02b7bfc7f 100644 --- a/web/src/app/shared/components/nav-bar/nav-bar.component.ts +++ b/web/src/app/shared/components/nav-bar/nav-bar.component.ts @@ -13,7 +13,7 @@ import { TaskanaEngineService } from '../../services/taskana-engine/taskana-engi selector: 'taskana-shared-nav-bar', templateUrl: './nav-bar.component.html', styleUrls: ['./nav-bar.component.scss'], - animations: [expandRight], + animations: [expandRight] }) export class NavBarComponent implements OnInit, OnDestroy { selectedRoute = ''; @@ -50,22 +50,22 @@ export class NavBarComponent implements OnInit, OnDestroy { private domainService: DomainService, private taskanaEngineService: TaskanaEngineService, private window: WindowRefService - ) { } + ) {} ngOnInit() { this.selectedRouteSubscription = this.selectedRouteService.getSelectedRoute().subscribe((value: string) => { this.selectedRoute = value; this.setTitle(value); }); - this.getDomainsSubscription = this.domainService.getDomains().subscribe(domains => { + this.getDomainsSubscription = this.domainService.getDomains().subscribe((domains) => { this.domains = domains; }); - this.domainService.getSelectedDomain().subscribe(domain => { + this.domainService.getSelectedDomain().subscribe((domain) => { this.selectedDomain = domain; }); - this.taskanaEngineService.getVersion().subscribe(restVersion => { + this.taskanaEngineService.getVersion().subscribe((restVersion) => { this.version = restVersion.version; }); @@ -73,7 +73,7 @@ export class NavBarComponent implements OnInit, OnDestroy { this.monitorAccess = this.taskanaEngineService.hasRole(MonitorGuard.roles); this.workplaceAccess = this.taskanaEngineService.hasRole(UserGuard.roles); - this.taskanaEngineService.isHistoryProviderEnabled().subscribe(value => { + this.taskanaEngineService.isHistoryProviderEnabled().subscribe((value) => { this.historyAccess = value; }); } @@ -87,15 +87,16 @@ export class NavBarComponent implements OnInit, OnDestroy { } logout() { - this.taskanaEngineService.logout().subscribe(() => { - }); + this.taskanaEngineService.logout().subscribe(() => {}); this.window.nativeWindow.location.href = environment.taskanaLogoutUrl; } showDomainSelector(): boolean { - return this.selectedRoute.indexOf('administration') !== -1 - || this.selectedRoute.indexOf('workbaskets') !== -1 - || this.selectedRoute.indexOf('classifications') !== -1; + return ( + this.selectedRoute.indexOf('administration') !== -1 || + this.selectedRoute.indexOf('workbaskets') !== -1 || + this.selectedRoute.indexOf('classifications') !== -1 + ); } private setTitle(value: string = 'workbaskets') { @@ -115,7 +116,11 @@ export class NavBarComponent implements OnInit, OnDestroy { } ngOnDestroy(): void { - if (this.selectedRouteSubscription) { this.selectedRouteSubscription.unsubscribe(); } - if (this.getDomainsSubscription) { this.getDomainsSubscription.unsubscribe(); } + if (this.selectedRouteSubscription) { + this.selectedRouteSubscription.unsubscribe(); + } + if (this.getDomainsSubscription) { + this.getDomainsSubscription.unsubscribe(); + } } } diff --git a/web/src/app/shared/components/no-access/no-access.component.scss b/web/src/app/shared/components/no-access/no-access.component.scss index dd162823e..0974adf93 100644 --- a/web/src/app/shared/components/no-access/no-access.component.scss +++ b/web/src/app/shared/components/no-access/no-access.component.scss @@ -1,14 +1,12 @@ - .container-no-access .no-access-icon { - display: block; - width: 150px; - height: 150px; - fill: grey; - margin: 20px auto; + display: block; + width: 150px; + height: 150px; + fill: grey; + margin: 20px auto; } -.container-no-access{ - top:20vh; - height: 100vh; +.container-no-access { + top: 20vh; + height: 100vh; } - diff --git a/web/src/app/shared/components/no-access/no-access.component.spec.ts b/web/src/app/shared/components/no-access/no-access.component.spec.ts index 2d226226b..799555ade 100644 --- a/web/src/app/shared/components/no-access/no-access.component.spec.ts +++ b/web/src/app/shared/components/no-access/no-access.component.spec.ts @@ -11,14 +11,14 @@ describe('NoAccessComponent', () => { let fixture: ComponentFixture; let debugElement; - beforeEach(done => { + beforeEach((done) => { const configure = (testBed: TestBed) => { testBed.configureTestingModule({ imports: [RouterTestingModule, AngularSvgIconModule, HttpClientModule], declarations: [NoAccessComponent] }); }; - configureTests(configure).then(testBed => { + configureTests(configure).then((testBed) => { fixture = TestBed.createComponent(NoAccessComponent); component = fixture.componentInstance; debugElement = fixture.debugElement.nativeElement; diff --git a/web/src/app/shared/components/no-access/no-access.component.ts b/web/src/app/shared/components/no-access/no-access.component.ts index ed813716c..3a5b15586 100644 --- a/web/src/app/shared/components/no-access/no-access.component.ts +++ b/web/src/app/shared/components/no-access/no-access.component.ts @@ -12,7 +12,7 @@ import { TaskanaEngineService } from '../../services/taskana-engine/taskana-engi }) export class NoAccessComponent implements OnInit { showNoAccess = false; - constructor(private taskanaEngineService: TaskanaEngineService, public router: Router) { } + constructor(private taskanaEngineService: TaskanaEngineService, public router: Router) {} ngOnInit() { if (this.taskanaEngineService.hasRole(BusinessAdminGuard.roles)) { diff --git a/web/src/app/shared/components/number-picker/number-picker.component.scss b/web/src/app/shared/components/number-picker/number-picker.component.scss index f644b3ef0..e9da03c5c 100644 --- a/web/src/app/shared/components/number-picker/number-picker.component.scss +++ b/web/src/app/shared/components/number-picker/number-picker.component.scss @@ -1,32 +1,32 @@ -button{ - font-size: 1px; - padding: 0px; +button { + font-size: 1px; + padding: 0px; } -.input-group{ - max-width: 100px; +.input-group { + max-width: 100px; } -input{ - text-align: right; +input { + text-align: right; } .input-group-btn-vertical { - position: relative; - white-space: nowrap; - vertical-align: middle; - display: table-cell; + position: relative; + white-space: nowrap; + vertical-align: middle; + display: table-cell; } .input-group-btn-vertical > .btn { - display: block; - float: none; - width: 100%; - max-width: 100%; - padding: 1px; - margin-left: -1px; - position: relative; - border-radius: 0; + display: block; + float: none; + width: 100%; + max-width: 100%; + padding: 1px; + margin-left: -1px; + position: relative; + border-radius: 0; } - .input-group-btn-vertical > .btn:first-child { +.input-group-btn-vertical > .btn:first-child { border-top-right-radius: 4px; } .input-group-btn-vertical > .btn:last-child { @@ -35,12 +35,12 @@ input{ } // small "hack" to remove the arrows in the input fields of type numbers -input[type=number]::-webkit-inner-spin-button, -input[type=number]::-webkit-outer-spin-button { +input[type='number']::-webkit-inner-spin-button, +input[type='number']::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; } input[type='number'] { - -moz-appearance:textfield; + -moz-appearance: textfield; } diff --git a/web/src/app/shared/components/number-picker/number-picker.component.spec.ts b/web/src/app/shared/components/number-picker/number-picker.component.spec.ts index 520de7962..fd8402c20 100644 --- a/web/src/app/shared/components/number-picker/number-picker.component.spec.ts +++ b/web/src/app/shared/components/number-picker/number-picker.component.spec.ts @@ -9,14 +9,9 @@ describe('NumberPickerComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ - NumberPickerComponent], - imports: [ - FormsModule, - ReactiveFormsModule - ] - }) - .compileComponents(); + declarations: [NumberPickerComponent], + imports: [FormsModule, ReactiveFormsModule] + }).compileComponents(); fixture = TestBed.createComponent(NumberPickerComponent); component = fixture.componentInstance; diff --git a/web/src/app/shared/components/number-picker/number-picker.component.ts b/web/src/app/shared/components/number-picker/number-picker.component.ts index f244c7d52..67533bb73 100644 --- a/web/src/app/shared/components/number-picker/number-picker.component.ts +++ b/web/src/app/shared/components/number-picker/number-picker.component.ts @@ -24,8 +24,7 @@ export class NumberPickerComponent implements OnInit, ControlValueAccessor { private onTouchedCallback: () => {}; private onChangeCallback: (_: any) => {}; - ngOnInit() { - } + ngOnInit() {} // get accessor get value(): any { diff --git a/web/src/app/shared/components/pagination/pagination.component.scss b/web/src/app/shared/components/pagination/pagination.component.scss index 0387ee4e0..c8700a058 100644 --- a/web/src/app/shared/components/pagination/pagination.component.scss +++ b/web/src/app/shared/components/pagination/pagination.component.scss @@ -1,48 +1,47 @@ $blue: #66afe9; -.pagination{ - margin: 15px 0 0 0; +.pagination { + margin: 15px 0 0 0; } -a.pagination{ - width: 35px; - height: 35px; - margin: 0 10px; - padding: 0; +a.pagination { + width: 35px; + height: 35px; + margin: 0 10px; + padding: 0; + background-color: aliceblue; + > input { + margin: 1px; + width: 30px; + height: 30px; + text-align: center; background-color: aliceblue; - > input{ - margin: 1px; - width: 30px; - height: 30px; - text-align: center; - background-color: aliceblue; - border: none; - outline: none; - &:focus{ - border-color: $blue; - outline: 0; - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6); - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6); - } - } + border: none; + outline: none; + &:focus { + border-color: $blue; + outline: 0; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6); + } + } } -ul.pagination{ - cursor: pointer; - overflow: hidden; +ul.pagination { + cursor: pointer; + overflow: hidden; } -.footer{ - margin: 0px 5px 0 0; - color: $blue; +.footer { + margin: 0px 5px 0 0; + color: $blue; } - // small "hack" to remove the arrows in the input fields of type numbers -input[type=number]::-webkit-inner-spin-button, -input[type=number]::-webkit-outer-spin-button { +input[type='number']::-webkit-inner-spin-button, +input[type='number']::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; } input[type='number'] { - -moz-appearance:textfield; + -moz-appearance: textfield; } diff --git a/web/src/app/shared/components/pagination/pagination.component.spec.ts b/web/src/app/shared/components/pagination/pagination.component.spec.ts index 8cf1160a6..1a11fa358 100644 --- a/web/src/app/shared/components/pagination/pagination.component.spec.ts +++ b/web/src/app/shared/components/pagination/pagination.component.spec.ts @@ -12,13 +12,13 @@ describe('PaginationComponent', () => { let fixture: ComponentFixture; let debugElement; - beforeEach(done => { + beforeEach((done) => { const configure = (testBed: TestBed) => { testBed.configureTestingModule({ imports: [FormsModule, SharedModule] }); }; - configureTests(configure).then(testBed => { + configureTests(configure).then((testBed) => { fixture = TestBed.createComponent(PaginationComponent); component = fixture.componentInstance; component.page = new Page(6, 3, 3, 1); @@ -47,7 +47,7 @@ describe('PaginationComponent', () => { component.page = new Page(6, 3, 3, 1); component.previousPageSelected = 2; fixture.detectChanges(); - component.changePage.subscribe(value => { + component.changePage.subscribe((value) => { expect(value).toBe(1); }); component.changeToPage(1); @@ -57,7 +57,7 @@ describe('PaginationComponent', () => { component.page = new Page(6, 3, 3, 1); component.previousPageSelected = 2; fixture.detectChanges(); - component.changePage.subscribe(value => { + component.changePage.subscribe((value) => { expect(false).toBe(true); }); component.changeToPage(2); @@ -67,7 +67,7 @@ describe('PaginationComponent', () => { component.page = new Page(6, 3, 3, 1); component.previousPageSelected = 2; fixture.detectChanges(); - component.changePage.subscribe(value => { + component.changePage.subscribe((value) => { expect(value).toBe(3); }); component.changeToPage(100); @@ -77,7 +77,7 @@ describe('PaginationComponent', () => { component.page = new Page(6, 3, 3, 1); component.previousPageSelected = 2; fixture.detectChanges(); - component.changePage.subscribe(value => { + component.changePage.subscribe((value) => { expect(value).toBe(1); }); component.changeToPage(0); diff --git a/web/src/app/shared/components/popup/dialog-pop-up.component.spec.ts b/web/src/app/shared/components/popup/dialog-pop-up.component.spec.ts index fd80dca4c..ebfefbbf2 100644 --- a/web/src/app/shared/components/popup/dialog-pop-up.component.spec.ts +++ b/web/src/app/shared/components/popup/dialog-pop-up.component.spec.ts @@ -1,8 +1,11 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { MAT_DIALOG_DATA, +import { + MAT_DIALOG_DATA, MAT_DIALOG_SCROLL_STRATEGY, MatDialog, - MatDialogClose, MatDialogModule } from '@angular/material/dialog'; + MatDialogClose, + MatDialogModule +} from '@angular/material/dialog'; import { DialogPopUpComponent } from './dialog-pop-up.component'; diff --git a/web/src/app/shared/components/popup/dialog-pop-up.component.ts b/web/src/app/shared/components/popup/dialog-pop-up.component.ts index 0e2cf99b4..6a5682018 100644 --- a/web/src/app/shared/components/popup/dialog-pop-up.component.ts +++ b/web/src/app/shared/components/popup/dialog-pop-up.component.ts @@ -7,15 +7,13 @@ import { notifications } from '../../models/notifications'; templateUrl: './dialog-pop-up.component.html', styleUrls: ['./dialog-pop-up.component.scss'] }) - export class DialogPopUpComponent implements OnInit { title: string; message: string; isDialog: false; callback: Function; - constructor(@Inject(MAT_DIALOG_DATA) private data: any) { - } + constructor(@Inject(MAT_DIALOG_DATA) private data: any) {} ngOnInit() { if (this.data) { @@ -32,8 +30,10 @@ export class DialogPopUpComponent implements OnInit { initError() { this.title = notifications.get(this.data.key).name || ''; - this.message = notifications.get(this.data.key).text - || (this.data && this.data.passedError && this.data.passedError.error) ? this.data.passedError.error.message : ''; + this.message = + notifications.get(this.data.key).text || (this.data && this.data.passedError && this.data.passedError.error) + ? this.data.passedError.error.message + : ''; if (this.data.additions) { this.data.additions.forEach((value: string, replacementKey: string) => { this.message = this.message.replace(`{${replacementKey}}`, value); diff --git a/web/src/app/shared/components/progress-bar/progress-bar.component.scss b/web/src/app/shared/components/progress-bar/progress-bar.component.scss index 549ce268b..4fd67d066 100644 --- a/web/src/app/shared/components/progress-bar/progress-bar.component.scss +++ b/web/src/app/shared/components/progress-bar/progress-bar.component.scss @@ -1,11 +1,11 @@ -.upload-file-container{ - z-index: 3000; - width: 170px; - position: absolute; - left: 50%; - top: 33%; - margin-left: -85px; - > .item{ - margin-left: 10px; - } +.upload-file-container { + z-index: 3000; + width: 170px; + position: absolute; + left: 50%; + top: 33%; + margin-left: -85px; + > .item { + margin-left: 10px; + } } diff --git a/web/src/app/shared/components/progress-bar/progress-bar.component.spec.ts b/web/src/app/shared/components/progress-bar/progress-bar.component.spec.ts index 0aaae9558..8aa26f01e 100644 --- a/web/src/app/shared/components/progress-bar/progress-bar.component.spec.ts +++ b/web/src/app/shared/components/progress-bar/progress-bar.component.spec.ts @@ -9,8 +9,7 @@ describe('ProgressBarComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [ProgressBarComponent] - }) - .compileComponents(); + }).compileComponents(); })); beforeEach(() => { diff --git a/web/src/app/shared/components/progress-bar/progress-bar.component.ts b/web/src/app/shared/components/progress-bar/progress-bar.component.ts index 2a23bd61f..fe58cbe58 100644 --- a/web/src/app/shared/components/progress-bar/progress-bar.component.ts +++ b/web/src/app/shared/components/progress-bar/progress-bar.component.ts @@ -16,8 +16,7 @@ export class ProgressBarComponent implements OnInit, OnChanges { inProgress = false; - ngOnInit() { - } + ngOnInit() {} ngOnChanges(changes: SimpleChanges) { if (!this.inProgress && changes.currentValue.currentValue > this.min) { diff --git a/web/src/app/shared/components/sort/sort.component.spec.ts b/web/src/app/shared/components/sort/sort.component.spec.ts index 290bac669..47b420a4b 100644 --- a/web/src/app/shared/components/sort/sort.component.spec.ts +++ b/web/src/app/shared/components/sort/sort.component.spec.ts @@ -9,13 +9,13 @@ describe('SortComponent', () => { let fixture: ComponentFixture; let debugElement; - beforeEach(done => { + beforeEach((done) => { const configure = (testBed: TestBed) => { testBed.configureTestingModule({ declarations: [] }); }; - configureTests(configure).then(testBed => { + configureTests(configure).then((testBed) => { fixture = TestBed.createComponent(SortComponent); component = fixture.componentInstance; debugElement = fixture.debugElement.nativeElement; diff --git a/web/src/app/shared/components/sort/sort.component.ts b/web/src/app/shared/components/sort/sort.component.ts index 3f2ab0ac1..81ab8e1bb 100644 --- a/web/src/app/shared/components/sort/sort.component.ts +++ b/web/src/app/shared/components/sort/sort.component.ts @@ -1,8 +1,4 @@ -import { Component, - EventEmitter, - Input, - OnInit, - Output } from '@angular/core'; +import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; import { Direction, Sorting } from 'app/shared/models/sorting'; @Component({ @@ -24,7 +20,7 @@ export class SortComponent implements OnInit { } changeOrder(sortDirection: string) { - this.sort.sortDirection = (sortDirection === Direction.ASC) ? Direction.ASC : Direction.DESC; + this.sort.sortDirection = sortDirection === Direction.ASC ? Direction.ASC : Direction.DESC; this.search(); } diff --git a/web/src/app/shared/components/spinner/spinner.component.scss b/web/src/app/shared/components/spinner/spinner.component.scss index 489ce83d2..7ef130bed 100644 --- a/web/src/app/shared/components/spinner/spinner.component.scss +++ b/web/src/app/shared/components/spinner/spinner.component.scss @@ -21,128 +21,156 @@ background-color: #36bcee; border-radius: 100%; -webkit-animation: sk-circleBounceDelay 1.2s infinite ease-in-out both; - animation: sk-circleBounceDelay 1.2s infinite ease-in-out both; + animation: sk-circleBounceDelay 1.2s infinite ease-in-out both; } .sk-circle .sk-circle2 { -webkit-transform: rotate(30deg); - -ms-transform: rotate(30deg); - transform: rotate(30deg); } + -ms-transform: rotate(30deg); + transform: rotate(30deg); +} .sk-circle .sk-circle3 { -webkit-transform: rotate(60deg); - -ms-transform: rotate(60deg); - transform: rotate(60deg); } + -ms-transform: rotate(60deg); + transform: rotate(60deg); +} .sk-circle .sk-circle4 { -webkit-transform: rotate(90deg); - -ms-transform: rotate(90deg); - transform: rotate(90deg); } + -ms-transform: rotate(90deg); + transform: rotate(90deg); +} .sk-circle .sk-circle5 { -webkit-transform: rotate(120deg); - -ms-transform: rotate(120deg); - transform: rotate(120deg); } + -ms-transform: rotate(120deg); + transform: rotate(120deg); +} .sk-circle .sk-circle6 { -webkit-transform: rotate(150deg); - -ms-transform: rotate(150deg); - transform: rotate(150deg); } + -ms-transform: rotate(150deg); + transform: rotate(150deg); +} .sk-circle .sk-circle7 { -webkit-transform: rotate(180deg); - -ms-transform: rotate(180deg); - transform: rotate(180deg); } + -ms-transform: rotate(180deg); + transform: rotate(180deg); +} .sk-circle .sk-circle8 { -webkit-transform: rotate(210deg); - -ms-transform: rotate(210deg); - transform: rotate(210deg); } + -ms-transform: rotate(210deg); + transform: rotate(210deg); +} .sk-circle .sk-circle9 { -webkit-transform: rotate(240deg); - -ms-transform: rotate(240deg); - transform: rotate(240deg); } + -ms-transform: rotate(240deg); + transform: rotate(240deg); +} .sk-circle .sk-circle10 { -webkit-transform: rotate(270deg); - -ms-transform: rotate(270deg); - transform: rotate(270deg); } + -ms-transform: rotate(270deg); + transform: rotate(270deg); +} .sk-circle .sk-circle11 { -webkit-transform: rotate(300deg); - -ms-transform: rotate(300deg); - transform: rotate(300deg); } + -ms-transform: rotate(300deg); + transform: rotate(300deg); +} .sk-circle .sk-circle12 { -webkit-transform: rotate(330deg); - -ms-transform: rotate(330deg); - transform: rotate(330deg); } + -ms-transform: rotate(330deg); + transform: rotate(330deg); +} .sk-circle .sk-circle2:before { background-color: #35b9ea; -webkit-animation-delay: -1.1s; - animation-delay: -1.1s; } + animation-delay: -1.1s; +} .sk-circle .sk-circle3:before { background-color: #33b0df; -webkit-animation-delay: -1s; - animation-delay: -1s; } + animation-delay: -1s; +} .sk-circle .sk-circle4:before { background-color: #36bbed; -webkit-animation-delay: -0.9s; - animation-delay: -0.9s; } + animation-delay: -0.9s; +} .sk-circle .sk-circle5:before { background-color: #46b9cc; -webkit-animation-delay: -0.8s; - animation-delay: -0.8s; } + animation-delay: -0.8s; +} .sk-circle .sk-circle6:before { background-color: #4fbbbd; -webkit-animation-delay: -0.7s; - animation-delay: -0.7s; } + animation-delay: -0.7s; +} .sk-circle .sk-circle7:before { background-color: #51b9b5; -webkit-animation-delay: -0.6s; - animation-delay: -0.6s; } + animation-delay: -0.6s; +} .sk-circle .sk-circle8:before { background-color: #5fbca1; -webkit-animation-delay: -0.5s; - animation-delay: -0.5s; } + animation-delay: -0.5s; +} .sk-circle .sk-circle9:before { background-color: #5db99e; -webkit-animation-delay: -0.4s; - animation-delay: -0.4s; } + animation-delay: -0.4s; +} .sk-circle .sk-circle10:before { background-color: #5ebba0; -webkit-animation-delay: -0.3s; - animation-delay: -0.3s; } + animation-delay: -0.3s; +} .sk-circle .sk-circle11:before { background-color: #5db99e; -webkit-animation-delay: -0.2s; - animation-delay: -0.2s; } + animation-delay: -0.2s; +} .sk-circle .sk-circle12:before { background-color: #5fbba0; -webkit-animation-delay: -0.1s; - animation-delay: -0.1s; } + animation-delay: -0.1s; +} @-webkit-keyframes sk-circleBounceDelay { - 0%, 80%, 100% { + 0%, + 80%, + 100% { -webkit-transform: scale(0); - transform: scale(0); - } 40% { + transform: scale(0); + } + 40% { -webkit-transform: scale(1); - transform: scale(1); + transform: scale(1); } } @keyframes sk-circleBounceDelay { - 0%, 80%, 100% { + 0%, + 80%, + 100% { -webkit-transform: scale(0); - transform: scale(0); - } 40% { + transform: scale(0); + } + 40% { -webkit-transform: scale(1); - transform: scale(1); + transform: scale(1); } } .floating { - position: absolute; - left: 45%; - top: auto; - z-index: 10; + position: absolute; + left: 45%; + top: auto; + z-index: 10; } .spinner-centered { margin-top: calc(50vh - 150px); } -.no-display{ +.no-display { display: none; } diff --git a/web/src/app/shared/components/spinner/spinner.component.spec.ts b/web/src/app/shared/components/spinner/spinner.component.spec.ts index 4c3949dfa..df4c46cf2 100644 --- a/web/src/app/shared/components/spinner/spinner.component.spec.ts +++ b/web/src/app/shared/components/spinner/spinner.component.spec.ts @@ -13,8 +13,7 @@ describe('SpinnerComponent', () => { TestBed.configureTestingModule({ declarations: [SpinnerComponent], providers: [MatSnackBar, Overlay, MatDialog, { provide: MAT_DIALOG_SCROLL_STRATEGY }] - }) - .compileComponents(); + }).compileComponents(); })); beforeEach(() => { diff --git a/web/src/app/shared/components/spinner/spinner.component.ts b/web/src/app/shared/components/spinner/spinner.component.ts index 027ff14ef..cfedaa34e 100644 --- a/web/src/app/shared/components/spinner/spinner.component.ts +++ b/web/src/app/shared/components/spinner/spinner.component.ts @@ -29,9 +29,7 @@ export class SpinnerComponent implements OnDestroy { @ViewChild('spinnerModal', { static: true }) private modal; - constructor(private errorsService: NotificationService) { - - } + constructor(private errorsService: NotificationService) {} set isDelayedRunning(value: boolean) { this.showSpinner = value; diff --git a/web/src/app/shared/components/toast/toast.component.ts b/web/src/app/shared/components/toast/toast.component.ts index 0dc51d878..9b32e910e 100644 --- a/web/src/app/shared/components/toast/toast.component.ts +++ b/web/src/app/shared/components/toast/toast.component.ts @@ -11,8 +11,7 @@ export class ToastComponent implements OnInit { message: string; type: string = 'info'; - constructor(@Inject(MAT_SNACK_BAR_DATA) private data: any) { - } + constructor(@Inject(MAT_SNACK_BAR_DATA) private data: any) {} ngOnInit(): void { if (this.data) { diff --git a/web/src/app/shared/components/type-ahead/type-ahead.component.scss b/web/src/app/shared/components/type-ahead/type-ahead.component.scss index 52407eec7..afc437782 100644 --- a/web/src/app/shared/components/type-ahead/type-ahead.component.scss +++ b/web/src/app/shared/components/type-ahead/type-ahead.component.scss @@ -1,103 +1,104 @@ @import '../../../../theme/colors'; .wrapper-text { - min-width: 150px; - height: 47px; - & label { - margin-bottom: 0px; - //font-style: italic; - //color: grey; - overflow: hidden; - } - &> div{ - - &> div { - margin-top: 2px; - max-width: 175px; - } + min-width: 150px; + height: 47px; + & label { + margin-bottom: 0px; + //font-style: italic; + //color: grey; + overflow: hidden; + } + & > div { + & > div { + margin-top: 2px; + max-width: 175px; } - > div{ - border-bottom: 1px solid $pallete-blue !important; - border-radius: 4px !important; - height: 32px; - text-overflow: ellipsis; - overflow: hidden; - white-space: nowrap; - margin-right: 35px; - padding-left: 12px; - } - + } + > div { + border-bottom: 1px solid $pallete-blue !important; + border-radius: 4px !important; + height: 32px; + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; + margin-right: 35px; + padding-left: 12px; + } } .custom-form-control { - margin-top: -5px; - max-height: 57px; - & .input-group{ - width: 100%; - } + margin-top: -5px; + max-height: 57px; + & .input-group { + width: 100%; + } } .input-text { - margin-top: 4px; - margin-bottom: 16px; - background: white; - box-shadow: none; - border-radius: 4px !important; - //border-color: lightgray; - border-bottom: 1px solid $pallete-blue !important; - min-width: 150px; - height: 32px; - padding: 13px 0 13px 12px; + margin-top: 4px; + margin-bottom: 16px; + background: white; + box-shadow: none; + border-radius: 4px !important; + //border-color: lightgray; + border-bottom: 1px solid $pallete-blue !important; + min-width: 150px; + height: 32px; + padding: 13px 0 13px 12px; } -.field-label-wrapper{ - position: relative; - height: 28px; - box-sizing: content-box; - overflow: hidden; - pointer-events: none; - label{ - margin-bottom: 1px; - } +.field-label-wrapper { + position: relative; + height: 28px; + box-sizing: content-box; + overflow: hidden; + pointer-events: none; + label { + margin-bottom: 1px; + } } .form-control:focus { - //border-color: unset; - box-shadow: none; + //border-color: unset; + box-shadow: none; } .loading { - position: absolute; - top: 0px; - right: 0; + position: absolute; + top: 0px; + right: 0; } .btn.rounded { - position: absolute; - top: 0px; - right: 0px; - padding-top: 0; + position: absolute; + top: 0px; + right: 0px; + padding-top: 0; } .search-button { - z-index: 999; - margin-top: 8px; + z-index: 999; + margin-top: 8px; } -::placeholder { /* Chrome, Firefox, Opera, Safari 10.1+ */ - color: $invalid; - opacity: 1; /* Firefox */ +::placeholder { + /* Chrome, Firefox, Opera, Safari 10.1+ */ + color: $invalid; + opacity: 1; /* Firefox */ } -:-ms-input-placeholder { /* Internet Explorer 10-11 */ - color: $invalid; +:-ms-input-placeholder { + /* Internet Explorer 10-11 */ + color: $invalid; } -::-ms-input-placeholder { /* Microsoft Edge */ - color: $invalid; +::-ms-input-placeholder { + /* Microsoft Edge */ + color: $invalid; } .disable { - cursor: not-allowed; + cursor: not-allowed; } .invalid { - color: $invalid; + color: $invalid; } diff --git a/web/src/app/shared/components/type-ahead/type-ahead.component.ts b/web/src/app/shared/components/type-ahead/type-ahead.component.ts index edf17169f..e78dc108d 100644 --- a/web/src/app/shared/components/type-ahead/type-ahead.component.ts +++ b/web/src/app/shared/components/type-ahead/type-ahead.component.ts @@ -1,10 +1,13 @@ -import { Component, +import { + Component, Input, ViewChild, forwardRef, Output, EventEmitter, - ElementRef, AfterViewInit } from '@angular/core'; + ElementRef, + AfterViewInit +} from '@angular/core'; import { Observable } from 'rxjs'; import { TypeaheadMatch } from 'ngx-bootstrap/typeahead'; @@ -102,8 +105,7 @@ export class TypeAheadComponent implements AfterViewInit, ControlValueAccessor { this.onTouchedCallback = fn; } - constructor(private accessIdsService: AccessIdsService) { - } + constructor(private accessIdsService: AccessIdsService) {} ngAfterViewInit() { this.inputField.emit(this.inputTypeAhead); @@ -113,9 +115,9 @@ export class TypeAheadComponent implements AfterViewInit, ControlValueAccessor { this.dataSource = new Observable((observer: any) => { observer.next(this.value); }).pipe(mergeMap((token: string) => this.getUsersAsObservable(token))); - this.accessIdsService.searchForAccessId(this.value).subscribe(items => { + this.accessIdsService.searchForAccessId(this.value).subscribe((items) => { if (items.length > 0) { - this.dataSource.selected = items.find(item => item.accessId.toLowerCase() === this.value.toLowerCase()); + this.dataSource.selected = items.find((item) => item.accessId.toLowerCase() === this.value.toLowerCase()); } }); } @@ -134,7 +136,9 @@ export class TypeAheadComponent implements AfterViewInit, ControlValueAccessor { } setTyping(value) { - if (this.disable) { return; } + if (this.disable) { + return; + } if (value) { setTimeout(() => { this.inputTypeAhead.nativeElement.focus(); diff --git a/web/src/app/shared/components/type-ahead/type-ahead.mock.component.ts b/web/src/app/shared/components/type-ahead/type-ahead.mock.component.ts index aae4aee95..ad5386a8b 100644 --- a/web/src/app/shared/components/type-ahead/type-ahead.mock.component.ts +++ b/web/src/app/shared/components/type-ahead/type-ahead.mock.component.ts @@ -8,7 +8,7 @@ import { NG_VALUE_ACCESSOR, ControlValueAccessor } from '@angular/forms'; { provide: NG_VALUE_ACCESSOR, multi: true, - useExisting: forwardRef(() => TaskanaTypeAheadMockComponent), + useExisting: forwardRef(() => TaskanaTypeAheadMockComponent) } ] }) @@ -19,19 +19,11 @@ export class TaskanaTypeAheadMockComponent implements ControlValueAccessor { @Input() validationValue; - writeValue(obj: any): void { + writeValue(obj: any): void {} - } + registerOnChange(fn: any): void {} - registerOnChange(fn: any): void { + registerOnTouched(fn: any): void {} - } - - registerOnTouched(fn: any): void { - - } - - setDisabledState?(isDisabled: boolean): void { - - } + setDisabledState?(isDisabled: boolean): void {} } diff --git a/web/src/app/shared/components/user-information/user-information.component.scss b/web/src/app/shared/components/user-information/user-information.component.scss index 8045d684c..ef831ad54 100644 --- a/web/src/app/shared/components/user-information/user-information.component.scss +++ b/web/src/app/shared/components/user-information/user-information.component.scss @@ -1,70 +1,70 @@ @import '../../../../theme/variables'; .big { - width: 64px; - height: 64px; + width: 64px; + height: 64px; } .user-info { - margin-top:85px; - > span { - margin: 0 15px 0 15px; - font-size: 20px; - font-family: inherit; - font-weight: 500; - line-height: 1.1; - } - + margin-top: 85px; + > span { + margin: 0 15px 0 15px; + font-size: 20px; + font-family: inherit; + font-weight: 500; + line-height: 1.1; + } } -.icon, { - width: 100%; - position: relative; - & > .icon-wrap { - border-radius: 50%; - border: solid 2px #22a39f; - width: 72px; - height: 72px; - overflow: hidden; - background-color: #175263; - position: absolute; - -webkit-box-shadow: 0px 3px 3px #416b6a; - -moz-box-shadow: 0px 3px 3px #416b6a; - box-shadow: 0px 3px 3px #416b6a; - - &> svg-icon { - border-radius: 50%; - overflow: hidden; - background-color: white; - position: absolute; - margin:2px - } - } -} - -.icon:before { content: ''; +.icon { + width: 100%; + position: relative; + & > .icon-wrap { + border-radius: 50%; + border: solid 2px #22a39f; + width: 72px; + height: 72px; + overflow: hidden; + background-color: #175263; position: absolute; - @include degraded-bar(right, 100%, 4px); - width: 100%; - height: 2px; - transform: translateY(33px); -webkit-box-shadow: 0px 3px 3px #416b6a; -moz-box-shadow: 0px 3px 3px #416b6a; box-shadow: 0px 3px 3px #416b6a; + + & > svg-icon { + border-radius: 50%; + overflow: hidden; + background-color: white; + position: absolute; + margin: 2px; + } + } } -button.transparent, { +.icon:before { + content: ''; + position: absolute; + @include degraded-bar(right, 100%, 4px); + width: 100%; + height: 2px; + transform: translateY(33px); + -webkit-box-shadow: 0px 3px 3px #416b6a; + -moz-box-shadow: 0px 3px 3px #416b6a; + box-shadow: 0px 3px 3px #416b6a; +} + +button.transparent { + border: none; + background-color: transparent; + &:hover { border: none; background-color: transparent; - &:hover{ - border: none; - background-color: transparent; - color:#22a39f - } - &:focus{ - border: none; - background-color: transparent; - outline: none; - color:white - } + color: #22a39f; + } + &:focus { + border: none; + background-color: transparent; + outline: none; + color: white; + } } diff --git a/web/src/app/shared/components/user-information/user-information.component.spec.ts b/web/src/app/shared/components/user-information/user-information.component.spec.ts index b12d2fac5..a8329c460 100644 --- a/web/src/app/shared/components/user-information/user-information.component.spec.ts +++ b/web/src/app/shared/components/user-information/user-information.component.spec.ts @@ -12,16 +12,15 @@ describe('UserInformationComponent', () => { let fixture: ComponentFixture; let debugElement; - beforeEach(done => { + beforeEach((done) => { const configure = (testBed: TestBed) => { testBed.configureTestingModule({ - imports: [AngularSvgIconModule, - HttpClientModule], + imports: [AngularSvgIconModule, HttpClientModule], declarations: [UserInformationComponent], providers: [MatSnackBar, Overlay] }); }; - configureTests(configure).then(testBed => { + configureTests(configure).then((testBed) => { fixture = TestBed.createComponent(UserInformationComponent); component = fixture.componentInstance; debugElement = fixture.debugElement.nativeElement; diff --git a/web/src/app/shared/components/user-information/user-information.component.ts b/web/src/app/shared/components/user-information/user-information.component.ts index e14fd198d..41f7524eb 100644 --- a/web/src/app/shared/components/user-information/user-information.component.ts +++ b/web/src/app/shared/components/user-information/user-information.component.ts @@ -7,13 +7,13 @@ import { expandDown } from '../../../../theme/animations/expand.animation'; selector: 'taskana-shared-user-information', templateUrl: './user-information.component.html', styleUrls: ['./user-information.component.scss'], - animations: [expandDown], + animations: [expandDown] }) export class UserInformationComponent implements OnInit { userInformation: UserInfo; roles = ''; showRoles = false; - constructor(private taskanaEngineService: TaskanaEngineService) { } + constructor(private taskanaEngineService: TaskanaEngineService) {} ngOnInit() { this.userInformation = this.taskanaEngineService.currentUserInfo; diff --git a/web/src/app/shared/guards/business-admin.guard.ts b/web/src/app/shared/guards/business-admin.guard.ts index f8ec7bfcd..9e42cda78 100644 --- a/web/src/app/shared/guards/business-admin.guard.ts +++ b/web/src/app/shared/guards/business-admin.guard.ts @@ -6,7 +6,7 @@ import { TaskanaEngineService } from 'app/shared/services/taskana-engine/taskana export class BusinessAdminGuard implements CanActivate { static roles = ['ADMIN', 'BUSINESS_ADMIN']; - constructor(private taskanaEngineService: TaskanaEngineService, public router: Router) { } + constructor(private taskanaEngineService: TaskanaEngineService, public router: Router) {} canActivate() { if (this.taskanaEngineService.hasRole(BusinessAdminGuard.roles)) { diff --git a/web/src/app/shared/guards/domain.guard.ts b/web/src/app/shared/guards/domain.guard.ts index c21bd0ca6..177aebf21 100644 --- a/web/src/app/shared/guards/domain.guard.ts +++ b/web/src/app/shared/guards/domain.guard.ts @@ -8,12 +8,11 @@ import { NOTIFICATION_TYPES } from '../models/notifications'; @Injectable() export class DomainGuard implements CanActivate { - constructor(private domainService: DomainService, private errorsService: NotificationService) { - } + constructor(private domainService: DomainService, private errorsService: NotificationService) {} canActivate() { return this.domainService.getDomains().pipe( - map(domain => true), + map((domain) => true), catchError(() => { this.errorsService.triggerError(NOTIFICATION_TYPES.FETCH_ERR_5); return of(false); diff --git a/web/src/app/shared/guards/history.guard.ts b/web/src/app/shared/guards/history.guard.ts index 2b3399686..a99ba82dd 100644 --- a/web/src/app/shared/guards/history.guard.ts +++ b/web/src/app/shared/guards/history.guard.ts @@ -14,15 +14,14 @@ export class HistoryGuard implements CanActivate { private taskanaEngineService: TaskanaEngineService, public router: Router, private errorsService: NotificationService - ) { - } + ) {} canActivate( next: ActivatedRouteSnapshot, state: RouterStateSnapshot ): Observable | Promise | boolean { return this.taskanaEngineService.isHistoryProviderEnabled().pipe( - map(value => { + map((value) => { if (value) { return value; } diff --git a/web/src/app/shared/guards/monitor.guard.ts b/web/src/app/shared/guards/monitor.guard.ts index 721a320ee..0633401d9 100644 --- a/web/src/app/shared/guards/monitor.guard.ts +++ b/web/src/app/shared/guards/monitor.guard.ts @@ -5,7 +5,7 @@ import { TaskanaEngineService } from 'app/shared/services/taskana-engine/taskana @Injectable() export class MonitorGuard implements CanActivate { static roles = ['ADMIN', 'MONITOR']; - constructor(private taskanaEngineService: TaskanaEngineService, public router: Router) { } + constructor(private taskanaEngineService: TaskanaEngineService, public router: Router) {} canActivate() { if (this.taskanaEngineService.hasRole(MonitorGuard.roles)) { diff --git a/web/src/app/shared/guards/user.guard.ts b/web/src/app/shared/guards/user.guard.ts index 5b1a37e83..b55ce28d5 100644 --- a/web/src/app/shared/guards/user.guard.ts +++ b/web/src/app/shared/guards/user.guard.ts @@ -5,7 +5,7 @@ import { TaskanaEngineService } from 'app/shared/services/taskana-engine/taskana @Injectable() export class UserGuard implements CanActivate { static roles = ['ADMIN', 'USER']; - constructor(private taskanaEngineService: TaskanaEngineService, private router: Router) { } + constructor(private taskanaEngineService: TaskanaEngineService, private router: Router) {} canActivate() { if (this.taskanaEngineService.hasRole(UserGuard.roles)) { return true; diff --git a/web/src/app/shared/models/access-id.ts b/web/src/app/shared/models/access-id.ts index 9f9df3694..75c026fd0 100644 --- a/web/src/app/shared/models/access-id.ts +++ b/web/src/app/shared/models/access-id.ts @@ -1,7 +1,3 @@ export class AccessIdDefinition { - constructor( - public accessId?: string, - public name?: string - ) { - } + constructor(public accessId?: string, public name?: string) {} } diff --git a/web/src/app/shared/models/access-item-workbasket-resource.ts b/web/src/app/shared/models/access-item-workbasket-resource.ts index 7a18381db..b7c6a452f 100644 --- a/web/src/app/shared/models/access-item-workbasket-resource.ts +++ b/web/src/app/shared/models/access-item-workbasket-resource.ts @@ -2,8 +2,5 @@ import { Links } from './links'; import { AccessItemWorkbasket } from './access-item-workbasket'; export class AccessItemWorkbasketResource { - constructor( - public accessItems: Array = [], - public _links?: Links - ) { } + constructor(public accessItems: Array = [], public _links?: Links) {} } diff --git a/web/src/app/shared/models/access-item-workbasket.ts b/web/src/app/shared/models/access-item-workbasket.ts index 670b6b2cb..23b151411 100644 --- a/web/src/app/shared/models/access-item-workbasket.ts +++ b/web/src/app/shared/models/access-item-workbasket.ts @@ -23,5 +23,5 @@ export class AccessItemWorkbasket { public permCustom11: boolean = false, public permCustom12: boolean = false, public _links?: Links - ) { } + ) {} } diff --git a/web/src/app/shared/models/classification-paging-list.ts b/web/src/app/shared/models/classification-paging-list.ts index 569d0990b..f72a85305 100644 --- a/web/src/app/shared/models/classification-paging-list.ts +++ b/web/src/app/shared/models/classification-paging-list.ts @@ -5,5 +5,5 @@ import { ClassificationSummary } from './classification-summary'; export interface ClassificationPagingList { classifications: ClassificationSummary[]; _links?: Links; - page?: Page + page?: Page; } diff --git a/web/src/app/shared/models/customisation.ts b/web/src/app/shared/models/customisation.ts index e9ddac74e..421c8a79a 100644 --- a/web/src/app/shared/models/customisation.ts +++ b/web/src/app/shared/models/customisation.ts @@ -14,7 +14,7 @@ export interface CustomisationContent { export interface TasksCustomisation { information?: { owner: LookupField; - } + }; } export interface ClassificationsCustomisation { @@ -47,10 +47,15 @@ export interface LookupField { } export function getCustomFields(amount: number): OperatorFunction { - return map(customisation => [...Array(amount).keys()] - .map(x => x + 1) - .map(x => customisation[`custom${x}`] || { - field: `Custom ${x}`, - visible: true - })); + return map((customisation) => + [...Array(amount).keys()] + .map((x) => x + 1) + .map( + (x) => + customisation[`custom${x}`] || { + field: `Custom ${x}`, + visible: true + } + ) + ); } diff --git a/web/src/app/shared/models/links-workbasket-summary.ts b/web/src/app/shared/models/links-workbasket-summary.ts index 65fbb7f21..044bf3212 100644 --- a/web/src/app/shared/models/links-workbasket-summary.ts +++ b/web/src/app/shared/models/links-workbasket-summary.ts @@ -1,10 +1,4 @@ // Remnant from old design, needs to be removed, type reference should instead => models/Links.ts export class LinksWorkbasketSummary { - constructor( - self?, - distributionTargets?, - accessItems?, - public allWorkbaskets?: { 'href': string } - ) { - } + constructor(self?, distributionTargets?, accessItems?, public allWorkbaskets?: { href: string }) {} } diff --git a/web/src/app/shared/models/links.ts b/web/src/app/shared/models/links.ts index 41c054524..7f1501380 100644 --- a/web/src/app/shared/models/links.ts +++ b/web/src/app/shared/models/links.ts @@ -1,5 +1,5 @@ export interface Links { [description: string]: { - href: string - } + href: string; + }; } diff --git a/web/src/app/shared/models/notifications.ts b/web/src/app/shared/models/notifications.ts index 33e073067..08dfdb22d 100644 --- a/web/src/app/shared/models/notifications.ts +++ b/web/src/app/shared/models/notifications.ts @@ -1,7 +1,6 @@ import { Pair } from './pair'; export enum NOTIFICATION_TYPES { - // ERRORS FETCH_ERR, FETCH_ERR_2, @@ -62,257 +61,161 @@ export enum NOTIFICATION_TYPES { export const notifications = new Map([ // access-items-management.component.ts - [NOTIFICATION_TYPES.FETCH_ERR, new Pair( - 'There was an error while retrieving your access ids with groups.', - '' - )], + [NOTIFICATION_TYPES.FETCH_ERR, new Pair('There was an error while retrieving your access ids with groups.', '')], // access-items-management.component.ts - [NOTIFICATION_TYPES.FETCH_ERR_2, new Pair( - 'There was an error while retrieving your access items ', - '' - )], + [NOTIFICATION_TYPES.FETCH_ERR_2, new Pair('There was an error while retrieving your access items ', '')], // access-items-management.component.ts - [NOTIFICATION_TYPES.DELETE_ERR, new Pair( - 'You can\'t delete a group', - '', - )], + [NOTIFICATION_TYPES.DELETE_ERR, new Pair("You can't delete a group", '')], // classification-details.component - [NOTIFICATION_TYPES.CREATE_ERR, new Pair( - 'There was an error while creating this classification', - '', - )], + [NOTIFICATION_TYPES.CREATE_ERR, new Pair('There was an error while creating this classification', '')], // classification-details.component - [NOTIFICATION_TYPES.REMOVE_ERR, new Pair( - 'There was an error while removing your classification', - '' - )], + [NOTIFICATION_TYPES.REMOVE_ERR, new Pair('There was an error while removing your classification', '')], // classification-details.component - [NOTIFICATION_TYPES.SAVE_ERR, new Pair( - 'There was an error while saving your classification', - '' - )], + [NOTIFICATION_TYPES.SAVE_ERR, new Pair('There was an error while saving your classification', '')], // classification-details.component - [NOTIFICATION_TYPES.SELECT_ERR, new Pair( - 'There is no classification selected', - 'Please check if you are creating a classification' - )], + [ + NOTIFICATION_TYPES.SELECT_ERR, + new Pair('There is no classification selected', 'Please check if you are creating a classification') + ], // import-export.component - [NOTIFICATION_TYPES.FILE_ERR, new Pair( - 'Wrong format', - 'This file format is not allowed! Please use a .json file.' - )], + [NOTIFICATION_TYPES.FILE_ERR, new Pair('Wrong format', 'This file format is not allowed! Please use a .json file.')], // import-export.component - [NOTIFICATION_TYPES.IMPORT_ERR_1, new Pair( - 'Import was not successful', - 'Import was not successful, you have no access to apply this operation.' - )], + [ + NOTIFICATION_TYPES.IMPORT_ERR_1, + new Pair('Import was not successful', 'Import was not successful, you have no access to apply this operation.') + ], // import-export.component - [NOTIFICATION_TYPES.IMPORT_ERR_2, new Pair( - 'Import was not successful', - 'Import was not successful, operation was not found.' - )], + [ + NOTIFICATION_TYPES.IMPORT_ERR_2, + new Pair('Import was not successful', 'Import was not successful, operation was not found.') + ], // import-export.component - [NOTIFICATION_TYPES.IMPORT_ERR_3, new Pair( - 'Import was not successful', - 'Import was not successful, operation has some conflicts.' - )], + [ + NOTIFICATION_TYPES.IMPORT_ERR_3, + new Pair('Import was not successful', 'Import was not successful, operation has some conflicts.') + ], // import-export.component - [NOTIFICATION_TYPES.IMPORT_ERR_4, new Pair( - 'Import was not successful', - 'Import was not successful, maximum file size exceeded.' - )], + [ + NOTIFICATION_TYPES.IMPORT_ERR_4, + new Pair('Import was not successful', 'Import was not successful, maximum file size exceeded.') + ], // import-export.component - [NOTIFICATION_TYPES.UPLOAD_ERR, new Pair( - 'Upload failed', - `The upload didn't proceed sucessfully. + [ + NOTIFICATION_TYPES.UPLOAD_ERR, + new Pair( + 'Upload failed', + `The upload didn't proceed sucessfully. \n The uploaded file probably exceeded the maximum file size of 10 MB.` - )], + ) + ], // taskdetails.component - [NOTIFICATION_TYPES.FETCH_ERR_3, new Pair( - '', - 'An error occurred while fetching the task' - )], + [NOTIFICATION_TYPES.FETCH_ERR_3, new Pair('', 'An error occurred while fetching the task')], // workbasket-details.component - [NOTIFICATION_TYPES.FETCH_ERR_4, new Pair( - '', - 'An error occurred while fetching the workbasket' - )], + [NOTIFICATION_TYPES.FETCH_ERR_4, new Pair('', 'An error occurred while fetching the workbasket')], // access-items.component - [NOTIFICATION_TYPES.SAVE_ERR_2, new Pair( - 'There was an error while saving your workbasket\'s access items', - '' - )], + [NOTIFICATION_TYPES.SAVE_ERR_2, new Pair("There was an error while saving your workbasket's access items", '')], // workbaskets-distribution-targets.component - [NOTIFICATION_TYPES.SAVE_ERR_3, new Pair( - 'There was an error while saving your workbasket\'s distribution targets', - '', - )], + [ + NOTIFICATION_TYPES.SAVE_ERR_3, + new Pair("There was an error while saving your workbasket's distribution targets", '') + ], // workbasket-information.component - [NOTIFICATION_TYPES.REMOVE_ERR_2, new Pair( - 'There was an error removing distribution target for {workbasketId}.', - '', - )], + [ + NOTIFICATION_TYPES.REMOVE_ERR_2, + new Pair('There was an error removing distribution target for {workbasketId}.', '') + ], // workbasket-information.component - [NOTIFICATION_TYPES.SAVE_ERR_4, new Pair( - 'There was an error while saving your workbasket', - '' - )], + [NOTIFICATION_TYPES.SAVE_ERR_4, new Pair('There was an error while saving your workbasket', '')], // workbasket-information.component - [NOTIFICATION_TYPES.CREATE_ERR_2, new Pair( - 'There was an error while creating this workbasket', - '' - )], + [NOTIFICATION_TYPES.CREATE_ERR_2, new Pair('There was an error while creating this workbasket', '')], // workbasket-information.component - [NOTIFICATION_TYPES.MARK_ERR, new Pair( - 'Workbasket was marked for deletion.', - 'The Workbasket {workbasketId} still contains completed tasks and could not be deleted.' - + ' Instead is was marked for deletion and will be deleted automatically ' - + 'as soon as the completed tasks are cleared from the database.' - )], + [ + NOTIFICATION_TYPES.MARK_ERR, + new Pair( + 'Workbasket was marked for deletion.', + 'The Workbasket {workbasketId} still contains completed tasks and could not be deleted.' + + ' Instead is was marked for deletion and will be deleted automatically ' + + 'as soon as the completed tasks are cleared from the database.' + ) + ], // domain.guard - [NOTIFICATION_TYPES.FETCH_ERR_5, new Pair( - 'There was an error, please contact your administrator', - 'There was an error getting Domains' - )], + [ + NOTIFICATION_TYPES.FETCH_ERR_5, + new Pair('There was an error, please contact your administrator', 'There was an error getting Domains') + ], // history.guard - [NOTIFICATION_TYPES.FETCH_ERR_6, new Pair( - 'There was an error, please contact your administrator', - 'There was an error getting history provider' - )], + [ + NOTIFICATION_TYPES.FETCH_ERR_6, + new Pair('There was an error, please contact your administrator', 'There was an error getting history provider') + ], // http-client-interceptor.service - [NOTIFICATION_TYPES.ACCESS_ERR, new Pair( - 'You have no access to this resource', - '' - )], + [NOTIFICATION_TYPES.ACCESS_ERR, new Pair('You have no access to this resource', '')], // http-client-interceptor.service - [NOTIFICATION_TYPES.GENERAL_ERR, new Pair( - 'There was an error, please contact your administrator', - '' - )], + [NOTIFICATION_TYPES.GENERAL_ERR, new Pair('There was an error, please contact your administrator', '')], // spinner.component - [NOTIFICATION_TYPES.TIMEOUT_ERR, new Pair( - 'There was an error with your request, please make sure you have internet connection', - 'Request time exceeded' - )], + [ + NOTIFICATION_TYPES.TIMEOUT_ERR, + new Pair( + 'There was an error with your request, please make sure you have internet connection', + 'Request time exceeded' + ) + ], // taskdetails.component - [NOTIFICATION_TYPES.FETCH_ERR_7, new Pair( - 'An error occurred while fetching the task', - '' - )], + [NOTIFICATION_TYPES.FETCH_ERR_7, new Pair('An error occurred while fetching the task', '')], // taskdetails.component - [NOTIFICATION_TYPES.DELETE_ERR_2, new Pair( - 'An error occurred while deleting the task', - '' - )], + [NOTIFICATION_TYPES.DELETE_ERR_2, new Pair('An error occurred while deleting the task', '')], // ALERTS // access-items-management.component - [NOTIFICATION_TYPES.SUCCESS_ALERT, new Pair( - '', - '{accessId} was removed successfully' - )], + [NOTIFICATION_TYPES.SUCCESS_ALERT, new Pair('', '{accessId} was removed successfully')], // classification-details.component - [NOTIFICATION_TYPES.SUCCESS_ALERT_2, new Pair( - '', - 'Classification {classificationKey} was created successfully' - )], + [NOTIFICATION_TYPES.SUCCESS_ALERT_2, new Pair('', 'Classification {classificationKey} was created successfully')], // classification-details.component - [NOTIFICATION_TYPES.SUCCESS_ALERT_3, new Pair( - '', - 'Classification {classificationKey} was saved successfully' - )], + [NOTIFICATION_TYPES.SUCCESS_ALERT_3, new Pair('', 'Classification {classificationKey} was saved successfully')], // classification-details.component // access-items.component // workbasket.distribution-targets.component // workbasket-information.component // taskdetails.component - [NOTIFICATION_TYPES.INFO_ALERT, new Pair( - '', - 'Information restored' - )], + [NOTIFICATION_TYPES.INFO_ALERT, new Pair('', 'Information restored')], // classification-details.component - [NOTIFICATION_TYPES.SUCCESS_ALERT_4, new Pair( - '', - 'Classification {classificationKey} was removed successfully' - )], + [NOTIFICATION_TYPES.SUCCESS_ALERT_4, new Pair('', 'Classification {classificationKey} was removed successfully')], // classification-list.component - [NOTIFICATION_TYPES.SUCCESS_ALERT_5, new Pair( - '', - 'Classification {classificationKey} was moved successfully' - )], + [NOTIFICATION_TYPES.SUCCESS_ALERT_5, new Pair('', 'Classification {classificationKey} was moved successfully')], // import-export.component - [NOTIFICATION_TYPES.SUCCESS_ALERT_6, new Pair( - '', - 'Import was successful' - )], + [NOTIFICATION_TYPES.SUCCESS_ALERT_6, new Pair('', 'Import was successful')], // access-items.component - [NOTIFICATION_TYPES.SUCCESS_ALERT_7, new Pair( - '', - 'Workbasket {workbasketKey} Access items were saved successfully' - )], + [NOTIFICATION_TYPES.SUCCESS_ALERT_7, new Pair('', 'Workbasket {workbasketKey} Access items were saved successfully')], // workbasket.distribution-targets.component - [NOTIFICATION_TYPES.SUCCESS_ALERT_8, new Pair( - '', - 'Workbasket {workbasketName} Distribution targets were saved successfully' - )], + [ + NOTIFICATION_TYPES.SUCCESS_ALERT_8, + new Pair('', 'Workbasket {workbasketName} Distribution targets were saved successfully') + ], // workbasket-information.component - [NOTIFICATION_TYPES.SUCCESS_ALERT_9, new Pair( - '', - 'DistributionTargets for workbasketID {workbasketId} was removed successfully' - )], + [ + NOTIFICATION_TYPES.SUCCESS_ALERT_9, + new Pair('', 'DistributionTargets for workbasketID {workbasketId} was removed successfully') + ], // workbasket-information.component - [NOTIFICATION_TYPES.SUCCESS_ALERT_10, new Pair( - '', - 'Workbasket {workbasketKey} was saved successfully' - )], + [NOTIFICATION_TYPES.SUCCESS_ALERT_10, new Pair('', 'Workbasket {workbasketKey} was saved successfully')], // workbasket-information.component - [NOTIFICATION_TYPES.SUCCESS_ALERT_11, new Pair( - '', - 'Workbasket {workbasketKey} was created successfully' - )], + [NOTIFICATION_TYPES.SUCCESS_ALERT_11, new Pair('', 'Workbasket {workbasketKey} was created successfully')], // workbasket-information.component - [NOTIFICATION_TYPES.SUCCESS_ALERT_12, new Pair( - '', - 'The Workbasket {workbasketId} has been deleted.' - )], + [NOTIFICATION_TYPES.SUCCESS_ALERT_12, new Pair('', 'The Workbasket {workbasketId} has been deleted.')], // forms-validator.service - [NOTIFICATION_TYPES.WARNING_ALERT, new Pair( - '', - 'There are some empty fields which are required.' - )], + [NOTIFICATION_TYPES.WARNING_ALERT, new Pair('', 'There are some empty fields which are required.')], // forms-validator.service x2 - [NOTIFICATION_TYPES.WARNING_ALERT_2, new Pair( - '', - 'The {owner} introduced is not valid.' - )], + [NOTIFICATION_TYPES.WARNING_ALERT_2, new Pair('', 'The {owner} introduced is not valid.')], // taskdetails.component - [NOTIFICATION_TYPES.DANGER_ALERT, new Pair( - '', - 'There was an error while updating.' - )], + [NOTIFICATION_TYPES.DANGER_ALERT, new Pair('', 'There was an error while updating.')], // taskdetails.component - [NOTIFICATION_TYPES.SUCCESS_ALERT_13, new Pair( - '', - 'Task {taskId} was created successfully.' - )], + [NOTIFICATION_TYPES.SUCCESS_ALERT_13, new Pair('', 'Task {taskId} was created successfully.')], // taskdetails.component - [NOTIFICATION_TYPES.SUCCESS_ALERT_14, new Pair( - '', - 'Updating was successful.' - )], + [NOTIFICATION_TYPES.SUCCESS_ALERT_14, new Pair('', 'Updating was successful.')], // taskdetails.component - [NOTIFICATION_TYPES.DANGER_ALERT_2, new Pair( - '', - 'There was an error while creating a new task.' - )], + [NOTIFICATION_TYPES.DANGER_ALERT_2, new Pair('', 'There was an error while creating a new task.')], // task-master.component - [NOTIFICATION_TYPES.INFO_ALERT_2, new Pair( - '', - 'The selected Workbasket is empty!' - )], - [NOTIFICATION_TYPES.WARNING_CANT_COPY, new Pair( - '', - 'Can\'t copy a not created classification' - )] + [NOTIFICATION_TYPES.INFO_ALERT_2, new Pair('', 'The selected Workbasket is empty!')], + [NOTIFICATION_TYPES.WARNING_CANT_COPY, new Pair('', "Can't copy a not created classification")] ]); diff --git a/web/src/app/shared/models/page.ts b/web/src/app/shared/models/page.ts index 84add4c40..57d340baf 100644 --- a/web/src/app/shared/models/page.ts +++ b/web/src/app/shared/models/page.ts @@ -4,5 +4,5 @@ export class Page { public totalElements?: number, public totalPages?: number, public number?: number - ) { } + ) {} } diff --git a/web/src/app/shared/models/pair.ts b/web/src/app/shared/models/pair.ts index 5abe0a743..22b30d4d7 100644 --- a/web/src/app/shared/models/pair.ts +++ b/web/src/app/shared/models/pair.ts @@ -1,6 +1,3 @@ export class Pair { - constructor( - public name?: string, - public text?: string, - ) { } + constructor(public name?: string, public text?: string) {} } diff --git a/web/src/app/shared/models/user-info.ts b/web/src/app/shared/models/user-info.ts index 49c73bd26..42375bcb6 100644 --- a/web/src/app/shared/models/user-info.ts +++ b/web/src/app/shared/models/user-info.ts @@ -1,7 +1,3 @@ export class UserInfo { - constructor( - public userId: string = '', - public groupIds: Array = [], - public roles: Array = [] - ) { } + constructor(public userId: string = '', public groupIds: Array = [], public roles: Array = []) {} } diff --git a/web/src/app/shared/models/version.ts b/web/src/app/shared/models/version.ts index a3d3580b4..f19b8700f 100644 --- a/web/src/app/shared/models/version.ts +++ b/web/src/app/shared/models/version.ts @@ -1,5 +1,3 @@ export class Version { - constructor( - public version: string = '' - ) { } + constructor(public version: string = '') {} } diff --git a/web/src/app/shared/models/workbasket-summary.ts b/web/src/app/shared/models/workbasket-summary.ts index 09392b568..3fc77902f 100644 --- a/web/src/app/shared/models/workbasket-summary.ts +++ b/web/src/app/shared/models/workbasket-summary.ts @@ -1,20 +1,20 @@ import { ICONTYPES } from './icon-types'; export interface WorkbasketSummary { - workbasketId?: string, - key?: string, - name?: string, - domain?: string, - type?: ICONTYPES, - description?: string, - owner?: string, - custom1?: string, - custom2?: string, - custom3?: string, - custom4?: string, - orgLevel1?: string, - orgLevel2?: string, - orgLevel3?: string, - orgLevel4?: string, - markedForDeletion?: boolean, + workbasketId?: string; + key?: string; + name?: string; + domain?: string; + type?: ICONTYPES; + description?: string; + owner?: string; + custom1?: string; + custom2?: string; + custom3?: string; + custom4?: string; + orgLevel1?: string; + orgLevel2?: string; + orgLevel3?: string; + orgLevel4?: string; + markedForDeletion?: boolean; } diff --git a/web/src/app/shared/pipes/map-to-iterable.pipe.ts b/web/src/app/shared/pipes/map-to-iterable.pipe.ts index 395ce32c4..94ecaf23a 100644 --- a/web/src/app/shared/pipes/map-to-iterable.pipe.ts +++ b/web/src/app/shared/pipes/map-to-iterable.pipe.ts @@ -6,7 +6,7 @@ import { Pipe, PipeTransform } from '@angular/core'; export class MapToIterable implements PipeTransform { transform(dict: Object) { const result = []; - Object.keys(dict).forEach(key => { + Object.keys(dict).forEach((key) => { result.push({ key, val: dict[key] }); }); return result; diff --git a/web/src/app/shared/pipes/map-values.pipe.ts b/web/src/app/shared/pipes/map-values.pipe.ts index 681d36a70..9bc661d91 100644 --- a/web/src/app/shared/pipes/map-values.pipe.ts +++ b/web/src/app/shared/pipes/map-values.pipe.ts @@ -2,7 +2,7 @@ import { Pipe, PipeTransform } from '@angular/core'; @Pipe({ name: 'mapValues' }) export class MapValuesPipe implements PipeTransform { - transform(value: Map, args?: any[]): { key: T, value: V }[] { + transform(value: Map, args?: any[]): { key: T; value: V }[] { const returnArray = []; if (!value) { diff --git a/web/src/app/shared/pipes/number-to-array.pipe.ts b/web/src/app/shared/pipes/number-to-array.pipe.ts index bcdbd1c58..2ca14be3c 100644 --- a/web/src/app/shared/pipes/number-to-array.pipe.ts +++ b/web/src/app/shared/pipes/number-to-array.pipe.ts @@ -1,7 +1,6 @@ import { Pipe, PipeTransform } from '@angular/core'; @Pipe({ name: 'numberToArray' }) - export class NumberToArray implements PipeTransform { transform(index: number): Array { return Array.from(Array(index), (x, i) => i); diff --git a/web/src/app/shared/pipes/order-by.pipe.ts b/web/src/app/shared/pipes/order-by.pipe.ts index 0cd5855e2..a954f2bf1 100644 --- a/web/src/app/shared/pipes/order-by.pipe.ts +++ b/web/src/app/shared/pipes/order-by.pipe.ts @@ -1,7 +1,6 @@ import { Pipe, PipeTransform } from '@angular/core'; @Pipe({ name: 'orderBy' }) - export class OrderBy implements PipeTransform { transform(records: Array, sortKeys?: string[]): any { return records.sort((a, b) => { @@ -14,7 +13,8 @@ export class OrderBy implements PipeTransform { } if (a[sortKey] < b[sortKey]) { return -1 * direction; - } if (a[sortKey] > b[sortKey]) { + } + if (a[sortKey] > b[sortKey]) { return direction; } } diff --git a/web/src/app/shared/pipes/remove-empty-type.pipe.ts b/web/src/app/shared/pipes/remove-empty-type.pipe.ts index 7d67fdf48..00833aecf 100644 --- a/web/src/app/shared/pipes/remove-empty-type.pipe.ts +++ b/web/src/app/shared/pipes/remove-empty-type.pipe.ts @@ -4,7 +4,7 @@ import { Pipe, PipeTransform } from '@angular/core'; export class RemoveNoneTypePipe implements PipeTransform { transform(value: any): Object[] { const returnArray = []; - value.forEach(entry => { + value.forEach((entry) => { if (entry.key !== '') { returnArray.push({ key: entry.key, diff --git a/web/src/app/shared/pipes/select-workbaskets.pipe.ts b/web/src/app/shared/pipes/select-workbaskets.pipe.ts index 49d9f972d..b9b0d3ad5 100644 --- a/web/src/app/shared/pipes/select-workbaskets.pipe.ts +++ b/web/src/app/shared/pipes/select-workbaskets.pipe.ts @@ -10,8 +10,14 @@ export class SelectWorkBasketPipe implements PipeTransform { } for (let index = originArray.length - 1; index >= 0; index--) { - if ((arg1 && !selectionArray.some(elementToRemove => originArray[index].workbasketId === elementToRemove.workbasketId)) - || (!arg1 && selectionArray.some(elementToRemove => originArray[index].workbasketId === elementToRemove.workbasketId))) { + if ( + (arg1 && + !selectionArray.some( + (elementToRemove) => originArray[index].workbasketId === elementToRemove.workbasketId + )) || + (!arg1 && + selectionArray.some((elementToRemove) => originArray[index].workbasketId === elementToRemove.workbasketId)) + ) { originArray.splice(index, 1); } } diff --git a/web/src/app/shared/pipes/spread-number.pipe.ts b/web/src/app/shared/pipes/spread-number.pipe.ts index 89a7cbbd5..7c784b041 100644 --- a/web/src/app/shared/pipes/spread-number.pipe.ts +++ b/web/src/app/shared/pipes/spread-number.pipe.ts @@ -11,18 +11,21 @@ export class SpreadNumberPipe implements PipeTransform { return returnArray; } - let minArrayValue = (currentIndex - maxArrayElements / 2); - let maxArrayValue = (currentIndex + maxArrayElements / 2); + let minArrayValue = currentIndex - maxArrayElements / 2; + let maxArrayValue = currentIndex + maxArrayElements / 2; let leftDifference = 0; let rightDifference = 0; - if (minArrayValue < 0) { leftDifference = Math.abs(minArrayValue); minArrayValue = 0; } + if (minArrayValue < 0) { + leftDifference = Math.abs(minArrayValue); + minArrayValue = 0; + } if (maxArrayValue > maxPageNumber) { rightDifference = maxArrayValue - maxPageNumber; maxArrayValue = maxPageNumber; } - const minIndex = (minArrayValue - rightDifference) <= 0 ? 0 : minArrayValue - rightDifference; - const maxIndex = (maxArrayValue + leftDifference) > maxPageNumber ? maxPageNumber : maxArrayValue + leftDifference; + const minIndex = minArrayValue - rightDifference <= 0 ? 0 : minArrayValue - rightDifference; + const maxIndex = maxArrayValue + leftDifference > maxPageNumber ? maxPageNumber : maxArrayValue + leftDifference; for (let i = minIndex; i < maxIndex; i += 1) { returnArray.push(i); diff --git a/web/src/app/shared/services/access-ids/access-ids.service.ts b/web/src/app/shared/services/access-ids/access-ids.service.ts index a6136cd4c..78a1fd4d8 100644 --- a/web/src/app/shared/services/access-ids/access-ids.service.ts +++ b/web/src/app/shared/services/access-ids/access-ids.service.ts @@ -13,9 +13,7 @@ import { QueryParameters } from 'app/shared/models/query-parameters'; }) export class AccessIdsService { private url = `${environment.taskanaRestUrl}/v1/access-ids`; - constructor( - private httpClient: HttpClient - ) { } + constructor(private httpClient: HttpClient) {} searchForAccessId(accessId: string): Observable { if (!accessId || accessId.length < 3) { @@ -37,19 +35,19 @@ export class AccessIdsService { workbasketKeyLike?: string, sortModel: Sorting = new Sorting('workbasket-key') ): Observable { - return this.httpClient.get(encodeURI( - `${environment.taskanaRestUrl}/v1/workbasket-access-items/${TaskanaQueryParameters.getQueryParameters( - AccessIdsService.accessIdsParameters(sortModel, - accessIds, - accessIdLike, - workbasketKeyLike) - )}` - )); + return this.httpClient.get( + encodeURI( + `${environment.taskanaRestUrl}/v1/workbasket-access-items/${TaskanaQueryParameters.getQueryParameters( + AccessIdsService.accessIdsParameters(sortModel, accessIds, accessIdLike, workbasketKeyLike) + )}` + ) + ); } removeAccessItemsPermissions(accessId: string) { - return this.httpClient - .delete(`${environment.taskanaRestUrl}/v1/workbasket-access-items/?access-id=${accessId}`); + return this.httpClient.delete( + `${environment.taskanaRestUrl}/v1/workbasket-access-items/?access-id=${accessId}` + ); } private static accessIdsParameters( @@ -57,7 +55,8 @@ export class AccessIdsService { accessIds: AccessIdDefinition[], accessIdLike?: string, workbasketKeyLike?: string - ): QueryParameters { // TODO extend this query for support of multiple sortbys + ): QueryParameters { + // TODO extend this query for support of multiple sortbys const parameters = new QueryParameters(); parameters.SORTBY = sortModel.sortBy; parameters.SORTDIRECTION = sortModel.sortDirection; diff --git a/web/src/app/shared/services/classification-categories/classification-categories.service.spec.ts b/web/src/app/shared/services/classification-categories/classification-categories.service.spec.ts index b0d6b78b5..6a8b3c8fe 100644 --- a/web/src/app/shared/services/classification-categories/classification-categories.service.spec.ts +++ b/web/src/app/shared/services/classification-categories/classification-categories.service.spec.ts @@ -18,9 +18,9 @@ describe('ClassificationCategoriesService', () => { }); it('should insert missing icon into customisation', async(() => { - const expectedCustomisationContent: CustomisationContent = { classifications: - { categories: - { missing: missingIcon } } }; + const expectedCustomisationContent: CustomisationContent = { + classifications: { categories: { missing: missingIcon } } + }; const expectedCustomisation: Customisation = { EN: expectedCustomisationContent, DE: expectedCustomisationContent }; @@ -30,9 +30,10 @@ describe('ClassificationCategoriesService', () => { { EN: {}, DE: {} } ]; - initialCustomisations.forEach(initialCustomisation => { - categoryService.getCustomisation() - .subscribe(customisation => { expect(customisation).toEqual(expectedCustomisation); }); + initialCustomisations.forEach((initialCustomisation) => { + categoryService.getCustomisation().subscribe((customisation) => { + expect(customisation).toEqual(expectedCustomisation); + }); httpMock.expectOne('environments/data-sources/taskana-customization.json').flush(initialCustomisation); diff --git a/web/src/app/shared/services/classification-categories/classification-categories.service.ts b/web/src/app/shared/services/classification-categories/classification-categories.service.ts index 9e2e49184..52e92eeaa 100644 --- a/web/src/app/shared/services/classification-categories/classification-categories.service.ts +++ b/web/src/app/shared/services/classification-categories/classification-categories.service.ts @@ -11,7 +11,9 @@ const customisationUrl = 'environments/data-sources/taskana-customization.json'; export const missingIcon = 'assets/icons/categories/missing-icon.svg'; -export interface CategoriesResponse { [key: string]: string[] } +export interface CategoriesResponse { + [key: string]: string[]; +} @Injectable() export class ClassificationCategoriesService { @@ -24,8 +26,8 @@ export class ClassificationCategoriesService { getCustomisation(): Observable { return this.httpClient.get(customisationUrl).pipe( - map(customisation => { - Object.keys(customisation).forEach(lang => { + map((customisation) => { + Object.keys(customisation).forEach((lang) => { set(customisation[lang], 'classifications.categories.missing', missingIcon); }); return customisation; diff --git a/web/src/app/shared/services/classifications/classifications.service.ts b/web/src/app/shared/services/classifications/classifications.service.ts index f76e7bdd6..840ed972a 100644 --- a/web/src/app/shared/services/classifications/classifications.service.ts +++ b/web/src/app/shared/services/classifications/classifications.service.ts @@ -18,11 +18,7 @@ export class ClassificationsService { private classificationResourcePromise: Promise; private lastDomain: string; - constructor( - private httpClient: HttpClient, - private domainService: DomainService, - ) { - } + constructor(private httpClient: HttpClient, private domainService: DomainService) {} private static classificationParameters(domain: string, type?: string): QueryParameters { const parameters = new QueryParameters(); @@ -39,11 +35,13 @@ export class ClassificationsService { // GET getClassifications(classificationType?: string): Observable { return this.domainService.getSelectedDomain().pipe( - mergeMap(domain => this.httpClient.get( - `${this.url}${TaskanaQueryParameters.getQueryParameters( - ClassificationsService.classificationParameters(domain, classificationType) - )}` - )), + mergeMap((domain) => + this.httpClient.get( + `${this.url}${TaskanaQueryParameters.getQueryParameters( + ClassificationsService.classificationParameters(domain, classificationType) + )}` + ) + ), tap(() => this.domainService.domainChangedComplete()) ); } @@ -52,9 +50,13 @@ export class ClassificationsService { getClassificationsByDomain(domain: string, forceRefresh = false): Promise { if (this.lastDomain !== domain || !this.classificationResourcePromise || forceRefresh) { this.lastDomain = domain; - this.classificationResourcePromise = this.httpClient.get( - `${this.url}${TaskanaQueryParameters.getQueryParameters(ClassificationsService.classificationParameters(domain))}` - ).toPromise(); + this.classificationResourcePromise = this.httpClient + .get( + `${this.url}${TaskanaQueryParameters.getQueryParameters( + ClassificationsService.classificationParameters(domain) + )}` + ) + .toPromise(); } return this.classificationResourcePromise; } diff --git a/web/src/app/shared/services/domain/domain.service.mock.ts b/web/src/app/shared/services/domain/domain.service.mock.ts index d3b4c99c5..256e170bf 100644 --- a/web/src/app/shared/services/domain/domain.service.mock.ts +++ b/web/src/app/shared/services/domain/domain.service.mock.ts @@ -20,17 +20,13 @@ export class DomainServiceMock { this.domainSelected.next(value); } - domainChangedComplete() { - } + domainChangedComplete() {} - getSelectedDomainValue() { - } + getSelectedDomainValue() {} - addMasterDomain() { - } + addMasterDomain() {} - removeMasterDomain() { - } + removeMasterDomain() {} switchDomain(value: string) { this.selectDomain(value); diff --git a/web/src/app/shared/services/domain/domain.service.spec.ts b/web/src/app/shared/services/domain/domain.service.spec.ts index 865b18dfe..285bdff18 100644 --- a/web/src/app/shared/services/domain/domain.service.spec.ts +++ b/web/src/app/shared/services/domain/domain.service.spec.ts @@ -12,20 +12,14 @@ import { SelectedRouteService } from '../selected-route/selected-route'; selector: 'taskana-dummy-detail', template: 'dummydetail' }) -class DummyDetailComponent { -} +class DummyDetailComponent {} -const routes: Routes = [ - { path: '', component: DummyDetailComponent } -]; +const routes: Routes = [{ path: '', component: DummyDetailComponent }]; describe('DomainService', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ - HttpClientModule, - RouterTestingModule.withRoutes(routes) - ], + imports: [HttpClientModule, RouterTestingModule.withRoutes(routes)], providers: [HttpClient, DomainService, RequestInProgressService, SelectedRouteService], declarations: [DummyDetailComponent] }); diff --git a/web/src/app/shared/services/domain/domain.service.ts b/web/src/app/shared/services/domain/domain.service.ts index fbc6e0e24..a34e07167 100644 --- a/web/src/app/shared/services/domain/domain.service.ts +++ b/web/src/app/shared/services/domain/domain.service.ts @@ -41,7 +41,7 @@ export class DomainService { getDomains(forceRefresh = false): Observable { if (!this.dataObs$.observers.length || forceRefresh) { this.httpClient.get(this.url).subscribe( - domains => { + (domains) => { this.domainRestValue = domains; this.domainValue = domains; this.dataObs$.next(this.hasMasterDomain ? this.addEmptyDomain(domains) : domains); @@ -49,7 +49,7 @@ export class DomainService { this.selectDomain(this.domainValue[0]); } }, - error => { + (error) => { this.dataObs$.error(error); this.dataObs$ = new ReplaySubject(1); } @@ -79,13 +79,13 @@ export class DomainService { } addMasterDomain() { - if (this.domainValue.some(domain => domain !== '')) { + if (this.domainValue.some((domain) => domain !== '')) { this.dataObs$.next(this.addEmptyDomain(this.domainRestValue)); } } removeMasterDomain() { - if (this.domainValue.some(domain => domain === '')) { + if (this.domainValue.some((domain) => domain === '')) { this.domainValue = this.domainRestValue; this.dataObs$.next(this.domainValue); } @@ -105,7 +105,8 @@ export class DomainService { private getNavigationUrl(): string { if (this.router.url.indexOf('workbaskets') !== -1) { return 'taskana/administration/workbaskets'; - } if (this.router.url.indexOf('classifications') !== -1) { + } + if (this.router.url.indexOf('classifications') !== -1) { return 'taskana/administration/classifications'; } return ''; diff --git a/web/src/app/shared/services/forms-validator/forms-validator.service.ts b/web/src/app/shared/services/forms-validator/forms-validator.service.ts index b217c2f0b..d6914309c 100644 --- a/web/src/app/shared/services/forms-validator/forms-validator.service.ts +++ b/web/src/app/shared/services/forms-validator/forms-validator.service.ts @@ -9,19 +9,15 @@ export class FormsValidatorService { public formSubmitAttempt = false; private workbasketOwner = 'workbasket.owner'; - constructor( - private notificationsService: NotificationService, - private accessIdsService: AccessIdsService - ) { - } + constructor(private notificationsService: NotificationService, private accessIdsService: AccessIdsService) {} public async validateFormInformation(form: NgForm, toogleValidationMap: Map): Promise { let validSync = true; if (!form) { return false; } - const forFieldsPromise = new Promise(resolve => { - Object.keys(form.form.controls).forEach(control => { + const forFieldsPromise = new Promise((resolve) => { + Object.keys(form.form.controls).forEach((control) => { if (control.indexOf('owner') === -1 && form.form.controls[control].invalid) { const validationState = toogleValidationMap.get(control); toogleValidationMap.set(this.workbasketOwner, !validationState); @@ -31,13 +27,13 @@ export class FormsValidatorService { resolve(validSync); }); - const ownerPromise = new Promise(resolve => { + const ownerPromise = new Promise((resolve) => { const ownerString = 'owner'; if (form.form.controls[this.workbasketOwner]) { - this.accessIdsService.searchForAccessId(form.form.controls[this.workbasketOwner].value).subscribe(items => { + this.accessIdsService.searchForAccessId(form.form.controls[this.workbasketOwner].value).subscribe((items) => { const validationState = toogleValidationMap.get(this.workbasketOwner); toogleValidationMap.set(this.workbasketOwner, !validationState); - const valid = items.find(item => item.accessId === form.form.controls[this.workbasketOwner].value); + const valid = items.find((item) => item.accessId === form.form.controls[this.workbasketOwner].value); resolve(new ResponseOwner({ valid, field: ownerString })); }); } else { @@ -66,19 +62,21 @@ export class FormsValidatorService { const ownerPromise: Array> = new Array>(); for (let i = 0; i < form.length; i++) { - ownerPromise.push(new Promise(resolve => { - const validationState = toogleValidationAccessIdMap.get(i); - toogleValidationAccessIdMap.set(i, !validationState); - this.accessIdsService.searchForAccessId(form.controls[i].value.accessId).subscribe(items => { - resolve(new ResponseOwner({ valid: items.length > 0, field: 'access id' })); - }); - })); + ownerPromise.push( + new Promise((resolve) => { + const validationState = toogleValidationAccessIdMap.get(i); + toogleValidationAccessIdMap.set(i, !validationState); + this.accessIdsService.searchForAccessId(form.controls[i].value.accessId).subscribe((items) => { + resolve(new ResponseOwner({ valid: items.length > 0, field: 'access id' })); + }); + }) + ); } let result = true; const values = await Promise.all(ownerPromise); let responseOwner; - values.forEach(owner => { + values.forEach((owner) => { responseOwner = new ResponseOwner(owner); result = result && responseOwner.valid; }); @@ -98,8 +96,10 @@ export class FormsValidatorService { if (!this.formSubmitAttempt) { return true; } - return (this.formSubmitAttempt && ngForm.form.controls[field].valid) - || (ngForm.form.controls[field].touched && ngForm.form.controls[field].valid); + return ( + (this.formSubmitAttempt && ngForm.form.controls[field].valid) || + (ngForm.form.controls[field].touched && ngForm.form.controls[field].valid) + ); } } diff --git a/web/src/app/shared/services/http-client-interceptor/http-client-interceptor.service.spec.ts b/web/src/app/shared/services/http-client-interceptor/http-client-interceptor.service.spec.ts index 7f9b7a8b9..15f325fc3 100644 --- a/web/src/app/shared/services/http-client-interceptor/http-client-interceptor.service.spec.ts +++ b/web/src/app/shared/services/http-client-interceptor/http-client-interceptor.service.spec.ts @@ -12,7 +12,14 @@ describe('HttpExtensionService', () => { beforeEach(() => { TestBed.configureTestingModule({ imports: [HttpClientModule], - providers: [HttpClientInterceptor, RequestInProgressService, MatSnackBar, Overlay, MatDialog, { provide: MAT_DIALOG_SCROLL_STRATEGY }] + providers: [ + HttpClientInterceptor, + RequestInProgressService, + MatSnackBar, + Overlay, + MatDialog, + { provide: MAT_DIALOG_SCROLL_STRATEGY } + ] }); }); diff --git a/web/src/app/shared/services/http-client-interceptor/http-client-interceptor.service.ts b/web/src/app/shared/services/http-client-interceptor/http-client-interceptor.service.ts index da39bbdfd..3a98c5cbc 100644 --- a/web/src/app/shared/services/http-client-interceptor/http-client-interceptor.service.ts +++ b/web/src/app/shared/services/http-client-interceptor/http-client-interceptor.service.ts @@ -9,28 +9,33 @@ import { NOTIFICATION_TYPES } from '../../models/notifications'; @Injectable() export class HttpClientInterceptor implements HttpInterceptor { - constructor( - private requestInProgressService: RequestInProgressService, - private errorsService: NotificationService - ) { - - } + constructor(private requestInProgressService: RequestInProgressService, private errorsService: NotificationService) {} intercept(request: HttpRequest, next: HttpHandler): Observable> { let req = request.clone({ headers: request.headers.set('Content-Type', 'application/hal+json') }); if (!environment.production) { req = req.clone({ headers: req.headers.set('Authorization', 'Basic YWRtaW46YWRtaW4=') }); } - return next.handle(req).pipe(tap(() => { - }, error => { - this.requestInProgressService.setRequestInProgress(false); - if (error instanceof HttpErrorResponse && (error.status === 401 || error.status === 403)) { - this.errorsService.triggerError(NOTIFICATION_TYPES.ACCESS_ERR, error); - } else if (error instanceof HttpErrorResponse && (error.status === 404) && error.url.indexOf('environment-information.json')) { - // ignore this error - } else if (!(error.status === 409 && error.error.exception.endsWith('WorkbasketAccessItemAlreadyExistException'))) { - this.errorsService.triggerError(NOTIFICATION_TYPES.GENERAL_ERR, error); - } - })); + return next.handle(req).pipe( + tap( + () => {}, + (error) => { + this.requestInProgressService.setRequestInProgress(false); + if (error instanceof HttpErrorResponse && (error.status === 401 || error.status === 403)) { + this.errorsService.triggerError(NOTIFICATION_TYPES.ACCESS_ERR, error); + } else if ( + error instanceof HttpErrorResponse && + error.status === 404 && + error.url.indexOf('environment-information.json') + ) { + // ignore this error + } else if ( + !(error.status === 409 && error.error.exception.endsWith('WorkbasketAccessItemAlreadyExistException')) + ) { + this.errorsService.triggerError(NOTIFICATION_TYPES.GENERAL_ERR, error); + } + } + ) + ); } } diff --git a/web/src/app/shared/services/notifications/notification.service.ts b/web/src/app/shared/services/notifications/notification.service.ts index 63297e5ef..054aa21e0 100644 --- a/web/src/app/shared/services/notifications/notification.service.ts +++ b/web/src/app/shared/services/notifications/notification.service.ts @@ -12,8 +12,7 @@ import { DialogPopUpComponent } from '../../components/popup/dialog-pop-up.compo providedIn: 'root' }) export class NotificationService { - constructor(private matSnack: MatSnackBar, private popup: MatDialog) { - } + constructor(private matSnack: MatSnackBar, private popup: MatDialog) {} triggerError(key: NOTIFICATION_TYPES, passedError?: HttpErrorResponse, additions?: Map): void { this.popup.open(DialogPopUpComponent, { @@ -21,7 +20,7 @@ export class NotificationService { backdropClass: 'backdrop', position: { top: '3em' }, autoFocus: true, - maxWidth: '50em', + maxWidth: '50em' }); } @@ -31,9 +30,9 @@ export class NotificationService { backdropClass: 'backdrop', position: { top: '3em' }, autoFocus: true, - maxWidth: '50em', + maxWidth: '50em' }); - ref.beforeClosed().subscribe(call => { + ref.beforeClosed().subscribe((call) => { if (typeof call === 'function') { call(); } @@ -45,15 +44,20 @@ export class NotificationService { let colorClass: string[]; const type = NOTIFICATION_TYPES[key].split('_')[0].toLowerCase(); switch (type) { - case 'danger': colorClass = ['red', 'background-white']; + case 'danger': + colorClass = ['red', 'background-white']; break; - case 'success': colorClass = ['white', 'background-bluegreen']; + case 'success': + colorClass = ['white', 'background-bluegreen']; break; - case 'info': colorClass = ['white', 'background-darkgreen']; + case 'info': + colorClass = ['white', 'background-darkgreen']; break; - case 'warning': colorClass = ['brown', 'background-white']; + case 'warning': + colorClass = ['brown', 'background-white']; break; - default: colorClass = ['white', 'background-darkgreen']; + default: + colorClass = ['white', 'background-darkgreen']; } return this.matSnack.openFromComponent(ToastComponent, { duration: 5000, diff --git a/web/src/app/shared/services/notifications/notifications.service.spec.ts b/web/src/app/shared/services/notifications/notifications.service.spec.ts index e29b21656..f3d96dbe5 100644 --- a/web/src/app/shared/services/notifications/notifications.service.spec.ts +++ b/web/src/app/shared/services/notifications/notifications.service.spec.ts @@ -16,9 +16,16 @@ describe('NotificationService', () => { beforeEach(() => { TestBed.configureTestingModule({ declarations: [ToastComponent], - providers: [NotificationService, Overlay, { provide: MAT_DIALOG_SCROLL_STRATEGY }, { provide: MAT_SNACK_BAR_DATA }], - imports: [MatSnackBarModule, MatDialogModule, NoopAnimationsModule], - }).overrideModule(BrowserDynamicTestingModule, { set: { entryComponents: [ToastComponent] } }).compileComponents(); + providers: [ + NotificationService, + Overlay, + { provide: MAT_DIALOG_SCROLL_STRATEGY }, + { provide: MAT_SNACK_BAR_DATA } + ], + imports: [MatSnackBarModule, MatDialogModule, NoopAnimationsModule] + }) + .overrideModule(BrowserDynamicTestingModule, { set: { entryComponents: [ToastComponent] } }) + .compileComponents(); }); beforeEach(() => { @@ -31,14 +38,17 @@ describe('NotificationService', () => { expect(service).toBeTruthy(); })); - it('should apply the correct panelClasses for the different alerts', inject([NotificationService], (service:NotificationService) => { - let ref = service.showToast(NOTIFICATION_TYPES.INFO_ALERT); - expect(ref.containerInstance.snackBarConfig.panelClass).toEqual(['white', 'background-darkgreen']); - ref = service.showToast(NOTIFICATION_TYPES.DANGER_ALERT); - expect(ref.containerInstance.snackBarConfig.panelClass).toEqual(['red', 'background-white']); - ref = service.showToast(NOTIFICATION_TYPES.WARNING_ALERT); - expect(ref.containerInstance.snackBarConfig.panelClass).toEqual(['brown', 'background-white']); - ref = service.showToast(NOTIFICATION_TYPES.SUCCESS_ALERT); - expect(ref.containerInstance.snackBarConfig.panelClass).toEqual(['white', 'background-bluegreen']); - })); + it('should apply the correct panelClasses for the different alerts', inject( + [NotificationService], + (service: NotificationService) => { + let ref = service.showToast(NOTIFICATION_TYPES.INFO_ALERT); + expect(ref.containerInstance.snackBarConfig.panelClass).toEqual(['white', 'background-darkgreen']); + ref = service.showToast(NOTIFICATION_TYPES.DANGER_ALERT); + expect(ref.containerInstance.snackBarConfig.panelClass).toEqual(['red', 'background-white']); + ref = service.showToast(NOTIFICATION_TYPES.WARNING_ALERT); + expect(ref.containerInstance.snackBarConfig.panelClass).toEqual(['brown', 'background-white']); + ref = service.showToast(NOTIFICATION_TYPES.SUCCESS_ALERT); + expect(ref.containerInstance.snackBarConfig.panelClass).toEqual(['white', 'background-bluegreen']); + } + )); }); diff --git a/web/src/app/shared/services/orientation/orientation.service.ts b/web/src/app/shared/services/orientation/orientation.service.ts index 8b758d1f0..625ca4b0d 100644 --- a/web/src/app/shared/services/orientation/orientation.service.ts +++ b/web/src/app/shared/services/orientation/orientation.service.ts @@ -31,9 +31,16 @@ export class OrientationService { } } - calculateNumberItemsList(heightContainer: number, cardHeight: number, unusedHeight: number, doubleList = false): number { + calculateNumberItemsList( + heightContainer: number, + cardHeight: number, + unusedHeight: number, + doubleList = false + ): number { let cards = Math.round((heightContainer - unusedHeight) / cardHeight); - if (doubleList && window.innerWidth < 992) { cards = Math.floor(cards / 2); } + if (doubleList && window.innerWidth < 992) { + cards = Math.floor(cards / 2); + } TaskanaQueryParameters.pageSize = cards > 0 ? cards : 1; return cards; } diff --git a/web/src/app/shared/services/selected-route/selected-route.ts b/web/src/app/shared/services/selected-route/selected-route.ts index 8343b8676..7a3409a3c 100644 --- a/web/src/app/shared/services/selected-route/selected-route.ts +++ b/web/src/app/shared/services/selected-route/selected-route.ts @@ -6,9 +6,16 @@ import { Router, ActivatedRoute, NavigationStart } from '@angular/router'; export class SelectedRouteService { public selectedRouteTriggered = new Subject(); - private detailRoutes: Array = ['workbaskets', 'classifications', 'monitor', 'workplace', 'access-items-management', 'history']; + private detailRoutes: Array = [ + 'workbaskets', + 'classifications', + 'monitor', + 'workplace', + 'access-items-management', + 'history' + ]; - constructor(private router: Router) { } + constructor(private router: Router) {} selectRoute(value) { this.selectedRouteTriggered.next(this.getRoute(value)); @@ -26,6 +33,6 @@ export class SelectedRouteService { } private checkUrl(url: string): string { - return this.detailRoutes.find(routeDetail => url.indexOf(routeDetail) !== -1) || ''; + return this.detailRoutes.find((routeDetail) => url.indexOf(routeDetail) !== -1) || ''; } } diff --git a/web/src/app/shared/services/startup/startup.service.spec.ts b/web/src/app/shared/services/startup/startup.service.spec.ts index 3c4c379b5..a6a4f357c 100644 --- a/web/src/app/shared/services/startup/startup.service.spec.ts +++ b/web/src/app/shared/services/startup/startup.service.spec.ts @@ -21,16 +21,8 @@ describe('StartupService', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ - HttpClientModule, - HttpClientTestingModule - ], - providers: [ - StartupService, - HttpClient, - TaskanaEngineService, - WindowRefService - ] + imports: [HttpClientModule, HttpClientTestingModule], + providers: [StartupService, HttpClient, TaskanaEngineService, WindowRefService] }); }); @@ -45,10 +37,10 @@ describe('StartupService', () => { expect(service).toBeTruthy(); })); - it('should initialize rest and logout url from external file', done => { + it('should initialize rest and logout url from external file', (done) => { environment.taskanaRestUrl = ''; environment.taskanaLogoutUrl = ''; - service.getEnvironmentFilePromise().then(res => { + service.getEnvironmentFilePromise().then((res) => { expect(environment.taskanaRestUrl).toBe(someRestUrl); expect(environment.taskanaLogoutUrl).toBe(someLogoutUrl); done(); @@ -59,10 +51,10 @@ describe('StartupService', () => { httpMock.verify(); }); - it('should initialize rest and logout url from external file and override previous config', done => { + it('should initialize rest and logout url from external file and override previous config', (done) => { environment.taskanaRestUrl = 'oldRestUrl'; environment.taskanaLogoutUrl = 'oldLogoutUrl'; - service.getEnvironmentFilePromise().then(res => { + service.getEnvironmentFilePromise().then((res) => { expect(environment.taskanaRestUrl).toBe(someRestUrl); expect(environment.taskanaLogoutUrl).toBe(someLogoutUrl); done(); diff --git a/web/src/app/shared/services/startup/startup.service.ts b/web/src/app/shared/services/startup/startup.service.ts index 994c68a43..d5444268f 100644 --- a/web/src/app/shared/services/startup/startup.service.ts +++ b/web/src/app/shared/services/startup/startup.service.ts @@ -14,8 +14,7 @@ export class StartupService { private taskanaEngineService: TaskanaEngineService, private injector: Injector, private window: WindowRefService - ) { - } + ) {} public get router(): Router { return this.injector.get(Router); @@ -27,23 +26,28 @@ export class StartupService { // TODO: refactor this getEnvironmentFilePromise() { - return this.httpClient.get('environments/data-sources/environment-information.json').pipe(map(jsonFile => { - if (jsonFile && jsonFile.taskanaRestUrl) { - environment.taskanaRestUrl = jsonFile.taskanaRestUrl; - } + return this.httpClient + .get('environments/data-sources/environment-information.json') + .pipe( + map((jsonFile) => { + if (jsonFile && jsonFile.taskanaRestUrl) { + environment.taskanaRestUrl = jsonFile.taskanaRestUrl; + } - if (jsonFile && jsonFile.taskanaLogoutUrl) { - environment.taskanaLogoutUrl = jsonFile.taskanaLogoutUrl; - } - })).toPromise() + if (jsonFile && jsonFile.taskanaLogoutUrl) { + environment.taskanaLogoutUrl = jsonFile.taskanaLogoutUrl; + } + }) + ) + .toPromise() .catch(() => of(true)); } private loadEnvironment() { - return this.getEnvironmentFilePromise().then( - () => this.taskanaEngineService.getUserInformation() - ).catch(error => { - // this.window.nativeWindow.location.href = environment.taskanaRestUrl + '/login'; - }); + return this.getEnvironmentFilePromise() + .then(() => this.taskanaEngineService.getUserInformation()) + .catch((error) => { + // this.window.nativeWindow.location.href = environment.taskanaRestUrl + '/login'; + }); } } diff --git a/web/src/app/shared/services/taskana-engine/taskana-engine.mock.service.ts b/web/src/app/shared/services/taskana-engine/taskana-engine.mock.service.ts index f05532dc1..4fe14fe50 100644 --- a/web/src/app/shared/services/taskana-engine/taskana-engine.mock.service.ts +++ b/web/src/app/shared/services/taskana-engine/taskana-engine.mock.service.ts @@ -7,8 +7,7 @@ import { Version } from '../../models/version'; export class TaskanaEngineServiceMock { currentUserInfo: UserInfo; - constructor( - ) { + constructor() { this.getUserInformation(); } @@ -38,6 +37,6 @@ export class TaskanaEngineServiceMock { } private findRole(roles2Find: Array) { - return this.currentUserInfo.roles.find(role => roles2Find.some(roleLookingFor => role === roleLookingFor)); + return this.currentUserInfo.roles.find((role) => roles2Find.some((roleLookingFor) => role === roleLookingFor)); } } diff --git a/web/src/app/shared/services/taskana-engine/taskana-engine.service.ts b/web/src/app/shared/services/taskana-engine/taskana-engine.service.ts index ce7091fe0..f692a364e 100644 --- a/web/src/app/shared/services/taskana-engine/taskana-engine.service.ts +++ b/web/src/app/shared/services/taskana-engine/taskana-engine.service.ts @@ -10,17 +10,18 @@ import { map } from 'rxjs/operators'; export class TaskanaEngineService { currentUserInfo: UserInfo; - constructor( - private httpClient: HttpClient - ) { } + constructor(private httpClient: HttpClient) {} // GET getUserInformation(): Promise { - return this.httpClient.get(`${environment.taskanaRestUrl}/v1/current-user-info`).pipe(map( - data => { - this.currentUserInfo = data; - } - )).toPromise(); + return this.httpClient + .get(`${environment.taskanaRestUrl}/v1/current-user-info`) + .pipe( + map((data) => { + this.currentUserInfo = data; + }) + ) + .toPromise(); } hasRole(roles2Find: Array): boolean { @@ -38,8 +39,7 @@ export class TaskanaEngineService { } logout(): Observable { - return this.httpClient - .post(`${environment.taskanaLogoutUrl}`, ''); + return this.httpClient.post(`${environment.taskanaLogoutUrl}`, ''); } isHistoryProviderEnabled(): Observable { @@ -47,6 +47,6 @@ export class TaskanaEngineService { } private findRole(roles2Find: Array) { - return this.currentUserInfo.roles.find(role => roles2Find.some(roleLookingFor => role === roleLookingFor)); + return this.currentUserInfo.roles.find((role) => roles2Find.some((roleLookingFor) => role === roleLookingFor)); } } diff --git a/web/src/app/shared/services/upload/upload.service.ts b/web/src/app/shared/services/upload/upload.service.ts index d2818a1e9..5a300904e 100644 --- a/web/src/app/shared/services/upload/upload.service.ts +++ b/web/src/app/shared/services/upload/upload.service.ts @@ -2,7 +2,7 @@ import { Injectable } from '@angular/core'; import { Subject } from 'rxjs'; @Injectable({ - providedIn: 'root', + providedIn: 'root' }) export class UploadService { private currentProgressValue = new Subject(); diff --git a/web/src/app/shared/services/workbasket/workbasket.service.ts b/web/src/app/shared/services/workbasket/workbasket.service.ts index 2d4a15b61..333a9ca02 100644 --- a/web/src/app/shared/services/workbasket/workbasket.service.ts +++ b/web/src/app/shared/services/workbasket/workbasket.service.ts @@ -21,14 +21,12 @@ export class WorkbasketService { public workBasketSaved = new Subject(); private workbasketSummaryRef: Observable = new Observable(); - constructor( - private httpClient: HttpClient, - private domainService: DomainService - ) { } + constructor(private httpClient: HttpClient, private domainService: DomainService) {} // #region "REST calls" // GET - getWorkBasketsSummary(forceRequest: boolean = false, + getWorkBasketsSummary( + forceRequest: boolean = false, sortBy: string = TaskanaQueryParameters.parameters.KEY, order: string = Direction.ASC, name?: string, @@ -40,23 +38,39 @@ export class WorkbasketService { key?: string, keyLike?: string, requiredPermission?: string, - allPages: boolean = false) { + allPages: boolean = false + ) { if (this.workbasketSummaryRef && !forceRequest) { return this.workbasketSummaryRef; } - return this.domainService.getSelectedDomain() - .pipe(mergeMap(domain => { + return this.domainService.getSelectedDomain().pipe( + mergeMap((domain) => { this.workbasketSummaryRef = this.httpClient.get( - `${environment.taskanaRestUrl}/v1/workbaskets/${TaskanaQueryParameters - .getQueryParameters(this.workbasketParameters(sortBy, order, name, nameLike, descLike, owner, ownerLike, - type, key, keyLike, requiredPermission, allPages, domain))}` + `${environment.taskanaRestUrl}/v1/workbaskets/${TaskanaQueryParameters.getQueryParameters( + this.workbasketParameters( + sortBy, + order, + name, + nameLike, + descLike, + owner, + ownerLike, + type, + key, + keyLike, + requiredPermission, + allPages, + domain + ) + )}` ); return this.workbasketSummaryRef; }), tap(() => { this.domainService.domainChangedComplete(); - })); + }) + ); } // GET @@ -66,27 +80,24 @@ export class WorkbasketService { // GET getAllWorkBaskets(): Observable { - return this.httpClient.get(`${environment.taskanaRestUrl}/v1/workbaskets?required-permission=OPEN`); + return this.httpClient.get( + `${environment.taskanaRestUrl}/v1/workbaskets?required-permission=OPEN` + ); } // POST createWorkbasket(workbasket: Workbasket): Observable { - return this.httpClient - .post(`${environment.taskanaRestUrl}/v1/workbaskets`, workbasket); + return this.httpClient.post(`${environment.taskanaRestUrl}/v1/workbaskets`, workbasket); } // PUT updateWorkbasket(url: string, workbasket: Workbasket): Observable { - return this.httpClient - .put(url, workbasket).pipe( - catchError(this.handleError) - ); + return this.httpClient.put(url, workbasket).pipe(catchError(this.handleError)); } // delete markWorkbasketForDeletion(url: string): Observable { - return this.httpClient - .delete(url, { observe: 'response' }); + return this.httpClient.delete(url, { observe: 'response' }); } // GET @@ -95,14 +106,16 @@ export class WorkbasketService { } // POST - createWorkBasketAccessItem(url: string, workbasketAccessItem: WorkbasketAccessItems): Observable { + createWorkBasketAccessItem( + url: string, + workbasketAccessItem: WorkbasketAccessItems + ): Observable { return this.httpClient.post(url, workbasketAccessItem); } // PUT updateWorkBasketAccessItem(url: string, workbasketAccessItem: Array): Observable { - return this.httpClient.put(url, - workbasketAccessItem); + return this.httpClient.put(url, workbasketAccessItem); } // GET @@ -111,8 +124,10 @@ export class WorkbasketService { } // PUT - updateWorkBasketsDistributionTargets(url: string, distributionTargetsIds: Array): - Observable { + updateWorkBasketsDistributionTargets( + url: string, + distributionTargetsIds: Array + ): Observable { return this.httpClient.put(url, distributionTargetsIds); } diff --git a/web/src/app/shared/shared.module.ts b/web/src/app/shared/shared.module.ts index bc1f1532a..cfcd64d81 100644 --- a/web/src/app/shared/shared.module.ts +++ b/web/src/app/shared/shared.module.ts @@ -95,10 +95,7 @@ const DECLARATIONS = [ @NgModule({ declarations: DECLARATIONS, - imports: [ - MODULES, - MatRadioModule - ], + imports: [MODULES, MatRadioModule], exports: DECLARATIONS, providers: [ { @@ -112,5 +109,4 @@ const DECLARATIONS = [ ], entryComponents: [ToastComponent, DialogPopUpComponent] }) -export class SharedModule { -} +export class SharedModule {} diff --git a/web/src/app/shared/store/classification-store/classification.actions.ts b/web/src/app/shared/store/classification-store/classification.actions.ts index 92ba6a75d..230b11e42 100644 --- a/web/src/app/shared/store/classification-store/classification.actions.ts +++ b/web/src/app/shared/store/classification-store/classification.actions.ts @@ -2,14 +2,12 @@ import { Classification } from '../../models/classification'; export class SetSelectedClassificationType { static readonly type = '[Classification-Selected Type] Set selected classification type'; - constructor(public selectedType: string) { - } + constructor(public selectedType: string) {} } export class SelectClassification { static readonly type = '[Classification] Select a classification'; - constructor(public classificationId: string) { - } + constructor(public classificationId: string) {} } export class DeselectClassification { @@ -26,20 +24,17 @@ export class CopyClassification { export class SaveCreatedClassification { static readonly type = '[Classification] Save a classification that has been newly created or copied'; - constructor(public classification: Classification) { - } + constructor(public classification: Classification) {} } export class SaveModifiedClassification { static readonly type = '[Classification] Save an existing classification that has been modified'; - constructor(public classification: Classification) { - } + constructor(public classification: Classification) {} } export class RestoreSelectedClassification { static readonly type = '[Classification] Fetch and restore a classification'; - constructor(public classificationId: string) { - } + constructor(public classificationId: string) {} } export class RemoveSelectedClassification { @@ -52,6 +47,5 @@ export class GetClassifications { export class UpdateClassification { static readonly type = '[Tree] Update a classification and refetch all classifications'; - constructor(public classification: Classification) { - } + constructor(public classification: Classification) {} } diff --git a/web/src/app/shared/store/classification-store/classification.state.ts b/web/src/app/shared/store/classification-store/classification.state.ts index d06242c45..d4f87db74 100644 --- a/web/src/app/shared/store/classification-store/classification.state.ts +++ b/web/src/app/shared/store/classification-store/classification.state.ts @@ -2,17 +2,23 @@ import { Action, NgxsAfterBootstrap, State, StateContext } from '@ngxs/store'; import { Observable, of } from 'rxjs'; import { take, tap } from 'rxjs/operators'; import { TaskanaDate } from 'app/shared/util/taskana.date'; -import { CategoriesResponse, - ClassificationCategoriesService } from '../../services/classification-categories/classification-categories.service'; -import { SaveCreatedClassification, +import { + CategoriesResponse, + ClassificationCategoriesService +} from '../../services/classification-categories/classification-categories.service'; +import { + SaveCreatedClassification, DeselectClassification, - GetClassifications, CopyClassification, CreateClassification, + GetClassifications, + CopyClassification, + CreateClassification, RemoveSelectedClassification, RestoreSelectedClassification, SaveModifiedClassification, SelectClassification, SetSelectedClassificationType, - UpdateClassification } from './classification.actions'; + UpdateClassification +} from './classification.actions'; import { ClassificationsService } from '../../services/classifications/classifications.service'; import { DomainService } from '../../services/domain/domain.service'; import { Classification } from '../../models/classification'; @@ -28,25 +34,27 @@ export class ClassificationState implements NgxsAfterBootstrap { private categoryService: ClassificationCategoriesService, private classificationsService: ClassificationsService, private domainService: DomainService - ) { - } + ) {} @Action(InitializeStore) initializeStore(ctx: StateContext): Observable { return this.categoryService.getClassificationCategoriesByType().pipe( take(1), - tap(classificationTypes => { + tap((classificationTypes) => { ctx.patchState({ classificationTypes, classifications: undefined, - selectedClassificationType: Object.keys(classificationTypes)[0], + selectedClassificationType: Object.keys(classificationTypes)[0] }); - }), + }) ); } @Action(SetSelectedClassificationType) - setSelectedClassificationType(ctx: StateContext, action: SetSelectedClassificationType): Observable { + setSelectedClassificationType( + ctx: StateContext, + action: SetSelectedClassificationType + ): Observable { if (ctx.getState().classificationTypes[action.selectedType]) { ctx.patchState({ selectedClassificationType: action.selectedType, @@ -57,14 +65,19 @@ export class ClassificationState implements NgxsAfterBootstrap { } @Action(SelectClassification) - selectClassification(ctx: StateContext, action: SelectClassification): Observable { + selectClassification( + ctx: StateContext, + action: SelectClassification + ): Observable { if (typeof action.classificationId !== 'undefined') { return this.classificationsService.getClassification(action.classificationId).pipe( take(1), - tap(selectedClassification => ctx.patchState({ - selectedClassification, - selectedClassificationType: selectedClassification.type - })) + tap((selectedClassification) => + ctx.patchState({ + selectedClassification, + selectedClassificationType: selectedClassification.type + }) + ) ); } return of(null); @@ -83,20 +96,28 @@ export class ClassificationState implements NgxsAfterBootstrap { const { selectedClassificationType } = ctx.getState(); return this.classificationsService.getClassifications(selectedClassificationType).pipe( take(1), - tap(list => ctx.patchState({ - classifications: list.classifications - })), + tap((list) => + ctx.patchState({ + classifications: list.classifications + }) + ) ); } @Action(SaveCreatedClassification) // this action is called when a copied or a new classification is saved - createClassification(ctx: StateContext, action: SaveCreatedClassification): Observable { + createClassification( + ctx: StateContext, + action: SaveCreatedClassification + ): Observable { return this.classificationsService.postClassification(action.classification).pipe( - take(1), tap(classification => ctx.patchState({ - classifications: [...ctx.getState().classifications, classification], - selectedClassification: classification - })) + take(1), + tap((classification) => + ctx.patchState({ + classifications: [...ctx.getState().classifications, classification], + selectedClassification: classification + }) + ) ); } @@ -104,23 +125,28 @@ export class ClassificationState implements NgxsAfterBootstrap { saveClassification(ctx: StateContext, action: SaveModifiedClassification): Observable { return this.classificationsService.putClassification(action.classification).pipe( take(1), - tap(savedClassification => ctx.patchState({ - classifications: updateClassificationList(ctx.getState().classifications, savedClassification), - selectedClassification: savedClassification - })) + tap((savedClassification) => + ctx.patchState({ + classifications: updateClassificationList(ctx.getState().classifications, savedClassification), + selectedClassification: savedClassification + }) + ) ); } @Action(RestoreSelectedClassification) - restoreSelectedClassification(ctx: StateContext, action: RestoreSelectedClassification): Observable { + restoreSelectedClassification( + ctx: StateContext, + action: RestoreSelectedClassification + ): Observable { const state = ctx.getState(); // check whether the classification already exists // returns true in case the classification was edited or copied - if (state.classifications.some(classification => classification.classificationId === action.classificationId)) { + if (state.classifications.some((classification) => classification.classificationId === action.classificationId)) { return this.classificationsService.getClassification(action.classificationId).pipe( take(1), - tap(selectedClassification => { + tap((selectedClassification) => { ctx.patchState({ selectedClassification }); }) ); @@ -144,7 +170,7 @@ export class ClassificationState implements NgxsAfterBootstrap { category: state.classificationTypes[state.selectedClassificationType][0], created: date, modified: date, - domain: this.domainService.getSelectedDomainValue(), + domain: this.domainService.getSelectedDomainValue() }; if (state.selectedClassification) { initialClassification.parentId = state.selectedClassification.classificationId; @@ -175,29 +201,32 @@ export class ClassificationState implements NgxsAfterBootstrap { return this.classificationsService.deleteClassification(sel.classificationId).pipe( take(1), tap(() => { - const classifications = ctx.getState().classifications.filter(el => el.classificationId !== sel.classificationId); + const classifications = ctx + .getState() + .classifications.filter((el) => el.classificationId !== sel.classificationId); ctx.patchState({ selectedClassification: undefined, classifications }); }) ); } @Action(UpdateClassification) - updateClassification(ctx: StateContext, action: SaveModifiedClassification): Observable { + updateClassification( + ctx: StateContext, + action: SaveModifiedClassification + ): Observable { return this.classificationsService.putClassification(action.classification).pipe( take(1), - tap( - classification => { - const state = ctx.getState(); - let { selectedClassification } = state; - if (selectedClassification && selectedClassification.classificationId === classification.classificationId) { - selectedClassification = classification; - } - ctx.patchState({ - classifications: updateClassificationList(state.classifications, classification), - selectedClassification - }); + tap((classification) => { + const state = ctx.getState(); + let { selectedClassification } = state; + if (selectedClassification && selectedClassification.classificationId === classification.classificationId) { + selectedClassification = classification; } - ) + ctx.patchState({ + classifications: updateClassificationList(state.classifications, classification), + selectedClassification + }); + }) ); } @@ -209,7 +238,7 @@ export class ClassificationState implements NgxsAfterBootstrap { } function updateClassificationList(classifications: ClassificationSummary[], classification: Classification) { - return classifications.map(c => { + return classifications.map((c) => { if (c.classificationId === classification.classificationId) { return classification; } @@ -218,9 +247,9 @@ function updateClassificationList(classifications: ClassificationSummary[], clas } export interface ClassificationStateModel { - classifications: ClassificationSummary[], - selectedClassification: Classification, + classifications: ClassificationSummary[]; + selectedClassification: Classification; selectedClassificationType: string; - classificationTypes: CategoriesResponse, - badgeMessage: string + classificationTypes: CategoriesResponse; + badgeMessage: string; } diff --git a/web/src/app/shared/store/engine-configuration-store/engine-configuration.selectors.ts b/web/src/app/shared/store/engine-configuration-store/engine-configuration.selectors.ts index 426039f7d..b3ef8130f 100644 --- a/web/src/app/shared/store/engine-configuration-store/engine-configuration.selectors.ts +++ b/web/src/app/shared/store/engine-configuration-store/engine-configuration.selectors.ts @@ -1,4 +1,10 @@ -import { WorkbasketsCustomisation, ClassificationsCustomisation, AccessItemsCustomisation, TasksCustomisation, ClassificationCategoryImages } from 'app/shared/models/customisation'; +import { + WorkbasketsCustomisation, + ClassificationsCustomisation, + AccessItemsCustomisation, + TasksCustomisation, + ClassificationCategoryImages +} from 'app/shared/models/customisation'; import { Selector } from '@ngxs/store'; import { EngineConfigurationStateModel, EngineConfigurationState } from './engine-configuration.state'; @@ -26,7 +32,7 @@ export class EngineConfigurationSelectors { @Selector([EngineConfigurationState]) static selectCategoryIcons(state: EngineConfigurationStateModel): ClassificationCategoryImages { return { - ...state.customisation[state.language].classifications.categories, + ...state.customisation[state.language].classifications.categories }; } } diff --git a/web/src/app/shared/store/engine-configuration-store/engine-configuration.state.ts b/web/src/app/shared/store/engine-configuration-store/engine-configuration.state.ts index a2f5f552e..1d58adad9 100644 --- a/web/src/app/shared/store/engine-configuration-store/engine-configuration.state.ts +++ b/web/src/app/shared/store/engine-configuration-store/engine-configuration.state.ts @@ -10,17 +10,18 @@ class InitializeStore { @State({ name: 'engineConfiguration' }) export class EngineConfigurationState implements NgxsOnInit { - constructor(private categoryService: ClassificationCategoriesService) { - } + constructor(private categoryService: ClassificationCategoriesService) {} @Action(InitializeStore) initializeStore(ctx: StateContext): Observable { return this.categoryService.getCustomisation().pipe( - tap(customisation => ctx.setState({ - ...ctx.getState(), - customisation, - language: 'EN' - })), + tap((customisation) => + ctx.setState({ + ...ctx.getState(), + customisation, + language: 'EN' + }) + ) ); } @@ -30,6 +31,6 @@ export class EngineConfigurationState implements NgxsOnInit { } export interface EngineConfigurationStateModel { - customisation: Customisation, - language: string + customisation: Customisation; + language: string; } diff --git a/web/src/app/shared/store/workbasket-store/workbasket.actions.ts b/web/src/app/shared/store/workbasket-store/workbasket.actions.ts index f19441363..ee188770c 100644 --- a/web/src/app/shared/store/workbasket-store/workbasket.actions.ts +++ b/web/src/app/shared/store/workbasket-store/workbasket.actions.ts @@ -6,9 +6,10 @@ import { WorkbasketAccessItems } from '../../models/workbasket-access-items'; // Workbasket List export class GetWorkbasketsSummary { - static readonly type = '[Workbasket List] Get all workbaskets\' summary'; + static readonly type = "[Workbasket List] Get all workbaskets' summary"; - constructor(public forceRequest: boolean = false, + constructor( + public forceRequest: boolean = false, public sortBy: string = TaskanaQueryParameters.parameters.KEY, public order: string = Direction.ASC, public name?: string, @@ -20,14 +21,13 @@ export class GetWorkbasketsSummary { public key?: string, public keyLike?: string, public requiredPermission?: string, - public allPages: boolean = false) { - } + public allPages: boolean = false + ) {} } export class SelectWorkbasket { static readonly type = '[Workbasket] Select a workbasket'; - constructor(public workbasketId: string) { - } + constructor(public workbasketId: string) {} } export class DeselectWorkbasket { @@ -40,63 +40,53 @@ export class CreateWorkbasket { export class SetActiveAction { static readonly type = '[Workbasket] Specify current action'; - constructor(public action: ACTION) { - } + constructor(public action: ACTION) {} } // Workbasket Information export class SaveNewWorkbasket { static readonly type = '[Workbasket] Save new workbasket'; - constructor(public workbasket: Workbasket) { - } + constructor(public workbasket: Workbasket) {} } export class CopyWorkbasket { static readonly type = '[Workbasket] Copy selected workbasket'; - constructor(public workbasket: Workbasket) { - } + constructor(public workbasket: Workbasket) {} } export class UpdateWorkbasket { static readonly type = '[Workbasket] Update a workbasket'; - constructor(public url: string, public workbasket: Workbasket) { - } + constructor(public url: string, public workbasket: Workbasket) {} } export class RemoveDistributionTarget { static readonly type = '[Workbasket] Remove distribution targets of selected workbasket'; - constructor(public url: string) { - } + constructor(public url: string) {} } export class MarkWorkbasketForDeletion { static readonly type = '[Workbasket] Mark selected workbasket for deletion'; - constructor(public url: string) { - } + constructor(public url: string) {} } // Workbasket Access Items export class GetWorkbasketAccessItems { static readonly type = '[Workbasket] Get all workbasket access items'; - constructor(public url: string) { - } + constructor(public url: string) {} } export class UpdateWorkbasketAccessItems { - static readonly type = '[Workbasket] Update selected workbasket\'s access items'; - constructor(public url: string, public workbasketAccessItems: WorkbasketAccessItems[]) { - } + static readonly type = "[Workbasket] Update selected workbasket's access items"; + constructor(public url: string, public workbasketAccessItems: WorkbasketAccessItems[]) {} } // Workbasket Distribution Targets export class GetWorkbasketDistributionTargets { static readonly type = '[Workbasket] Get all workbasket distribution targets'; - constructor(public url: string) { - } + constructor(public url: string) {} } export class UpdateWorkbasketDistributionTargets { static readonly type = '[Workbasket] Update workbasket distribution targets'; - constructor(public url: string, public distributionTargetsIds: string[]) { - } + constructor(public url: string, public distributionTargetsIds: string[]) {} } diff --git a/web/src/app/shared/store/workbasket-store/workbasket.selectors.ts b/web/src/app/shared/store/workbasket-store/workbasket.selectors.ts index 8c9e20daa..1db32ceea 100644 --- a/web/src/app/shared/store/workbasket-store/workbasket.selectors.ts +++ b/web/src/app/shared/store/workbasket-store/workbasket.selectors.ts @@ -51,6 +51,6 @@ export class WorkbasketSelectors { } export interface WorkbasketAndAction { - selectedWorkbasket: Workbasket, - action: ACTION + selectedWorkbasket: Workbasket; + action: ACTION; } diff --git a/web/src/app/shared/store/workbasket-store/workbasket.state.ts b/web/src/app/shared/store/workbasket-store/workbasket.state.ts index b8855069f..453466344 100644 --- a/web/src/app/shared/store/workbasket-store/workbasket.state.ts +++ b/web/src/app/shared/store/workbasket-store/workbasket.state.ts @@ -4,7 +4,8 @@ import { Observable, of } from 'rxjs'; import { Location } from '@angular/common'; import { WorkbasketService } from '../../services/workbasket/workbasket.service'; import { Workbasket } from '../../models/workbasket'; -import { CopyWorkbasket, +import { + CopyWorkbasket, CreateWorkbasket, DeselectWorkbasket, GetWorkbasketAccessItems, @@ -15,8 +16,10 @@ import { CopyWorkbasket, SaveNewWorkbasket, SelectWorkbasket, SetActiveAction, - UpdateWorkbasket, UpdateWorkbasketAccessItems, - UpdateWorkbasketDistributionTargets } from './workbasket.actions'; + UpdateWorkbasket, + UpdateWorkbasketAccessItems, + UpdateWorkbasketDistributionTargets +} from './workbasket.actions'; import { WorkbasketSummaryRepresentation } from '../../models/workbasket-summary-representation'; import { ACTION } from '../../models/action'; import { DomainService } from '../../services/domain/domain.service'; @@ -37,20 +40,32 @@ export class WorkbasketState implements NgxsAfterBootstrap { private domainService: DomainService, private location: Location, private notificationService: NotificationService - ) { - } + ) {} @Action(GetWorkbasketsSummary) getWorkbasketsSummary(ctx: StateContext, action: GetWorkbasketsSummary): Observable { - return this.workbasketService.getWorkBasketsSummary(action.forceRequest, - action.sortBy, action.order, action.name, action.nameLike, action.descLike, action.owner, action.ownerLike, - action.type, action.key, action.keyLike, action.requiredPermission, action.allPages).pipe( - take(1), tap(paginatedWorkbasketsSummary => { - ctx.patchState( - { paginatedWorkbasketsSummary } - ); - }) - ); + return this.workbasketService + .getWorkBasketsSummary( + action.forceRequest, + action.sortBy, + action.order, + action.name, + action.nameLike, + action.descLike, + action.owner, + action.ownerLike, + action.type, + action.key, + action.keyLike, + action.requiredPermission, + action.allPages + ) + .pipe( + take(1), + tap((paginatedWorkbasketsSummary) => { + ctx.patchState({ paginatedWorkbasketsSummary }); + }) + ); } @Action(SelectWorkbasket) @@ -58,14 +73,15 @@ export class WorkbasketState implements NgxsAfterBootstrap { this.location.go(this.location.path().replace(/(workbaskets).*/g, `workbaskets/(detail:${action.workbasketId})`)); const id = action.workbasketId; if (typeof id !== 'undefined') { - return this.workbasketService.getWorkBasket(id).pipe(take(1), tap( - selectedWorkbasket => { + return this.workbasketService.getWorkBasket(id).pipe( + take(1), + tap((selectedWorkbasket) => { ctx.patchState({ selectedWorkbasket, action: ACTION.READ }); - } - )); + }) + ); } return of(null); } @@ -98,19 +114,23 @@ export class WorkbasketState implements NgxsAfterBootstrap { @Action(SaveNewWorkbasket) saveNewWorkbasket(ctx: StateContext, action: SaveNewWorkbasket): Observable { - return this.workbasketService.createWorkbasket(action.workbasket).pipe(take(1), tap( - workbasketUpdated => { - this.notificationService.showToast( - NOTIFICATION_TYPES.SUCCESS_ALERT_11, - new Map([['workbasketKey', workbasketUpdated.key]]) - ); + return this.workbasketService.createWorkbasket(action.workbasket).pipe( + take(1), + tap( + (workbasketUpdated) => { + this.notificationService.showToast( + NOTIFICATION_TYPES.SUCCESS_ALERT_11, + new Map([['workbasketKey', workbasketUpdated.key]]) + ); - this.selectWorkbasket(ctx, workbasketUpdated.workbasketId); - this.location.go(this.location.path().replace(/(workbaskets).*/g, 'workbaskets')); - }, error => { - this.notificationService.triggerError(NOTIFICATION_TYPES.CREATE_ERR_2, error); - } - )); + this.selectWorkbasket(ctx, workbasketUpdated.workbasketId); + this.location.go(this.location.path().replace(/(workbaskets).*/g, 'workbaskets')); + }, + (error) => { + this.notificationService.triggerError(NOTIFICATION_TYPES.CREATE_ERR_2, error); + } + ) + ); } @Action(CopyWorkbasket) @@ -124,97 +144,125 @@ export class WorkbasketState implements NgxsAfterBootstrap { @Action(UpdateWorkbasket) updateWorkbasket(ctx: StateContext, action: UpdateWorkbasket): Observable { - return this.workbasketService.updateWorkbasket(action.url, action.workbasket).pipe(take(1), tap( - updatedWorkbasket => { - this.notificationService.showToast( - NOTIFICATION_TYPES.SUCCESS_ALERT_10, - new Map([['workbasketKey', updatedWorkbasket.key]]) - ); + return this.workbasketService.updateWorkbasket(action.url, action.workbasket).pipe( + take(1), + tap( + (updatedWorkbasket) => { + this.notificationService.showToast( + NOTIFICATION_TYPES.SUCCESS_ALERT_10, + new Map([['workbasketKey', updatedWorkbasket.key]]) + ); - const paginatedWorkbasketSummary = { ...ctx.getState().paginatedWorkbasketsSummary }; - paginatedWorkbasketSummary.workbaskets = updateWorkbasketSummaryRepresentation( - paginatedWorkbasketSummary.workbaskets, action.workbasket - ); + const paginatedWorkbasketSummary = { ...ctx.getState().paginatedWorkbasketsSummary }; + paginatedWorkbasketSummary.workbaskets = updateWorkbasketSummaryRepresentation( + paginatedWorkbasketSummary.workbaskets, + action.workbasket + ); - ctx.patchState({ - selectedWorkbasket: updatedWorkbasket, - paginatedWorkbasketsSummary: paginatedWorkbasketSummary - }); - }, error => { - this.notificationService.triggerError(NOTIFICATION_TYPES.SAVE_ERR_4, error); - } - )); + ctx.patchState({ + selectedWorkbasket: updatedWorkbasket, + paginatedWorkbasketsSummary: paginatedWorkbasketSummary + }); + }, + (error) => { + this.notificationService.triggerError(NOTIFICATION_TYPES.SAVE_ERR_4, error); + } + ) + ); } @Action(RemoveDistributionTarget) removeDistributionTarget(ctx: StateContext, action: RemoveDistributionTarget): Observable { - return this.workbasketService.removeDistributionTarget(action.url).pipe(take(1), tap( - () => { - this.notificationService.showToast( - NOTIFICATION_TYPES.SUCCESS_ALERT_9, - new Map([['workbasketId', ctx.getState().selectedWorkbasket.workbasketId]]) - ); - }, error => { - this.notificationService.triggerError(NOTIFICATION_TYPES.REMOVE_ERR_2, - error, - new Map([['workbasketId', ctx.getState().selectedWorkbasket.workbasketId]])); - } - )); + return this.workbasketService.removeDistributionTarget(action.url).pipe( + take(1), + tap( + () => { + this.notificationService.showToast( + NOTIFICATION_TYPES.SUCCESS_ALERT_9, + new Map([['workbasketId', ctx.getState().selectedWorkbasket.workbasketId]]) + ); + }, + (error) => { + this.notificationService.triggerError( + NOTIFICATION_TYPES.REMOVE_ERR_2, + error, + new Map([['workbasketId', ctx.getState().selectedWorkbasket.workbasketId]]) + ); + } + ) + ); } @Action(MarkWorkbasketForDeletion) deleteWorkbasket(ctx: StateContext, action: MarkWorkbasketForDeletion): Observable { - return this.workbasketService.markWorkbasketForDeletion(action.url).pipe(take(1), tap( - response => { + return this.workbasketService.markWorkbasketForDeletion(action.url).pipe( + take(1), + tap((response) => { if (response.status === 202) { - this.notificationService.triggerError(NOTIFICATION_TYPES.MARK_ERR, + this.notificationService.triggerError( + NOTIFICATION_TYPES.MARK_ERR, undefined, - new Map([['workbasketId', ctx.getState().selectedWorkbasket.workbasketId]])); + new Map([['workbasketId', ctx.getState().selectedWorkbasket.workbasketId]]) + ); } else { this.notificationService.showToast( NOTIFICATION_TYPES.SUCCESS_ALERT_12, new Map([['workbasketId', ctx.getState().selectedWorkbasket.workbasketId]]) ); } - } - )); + }) + ); } @Action(GetWorkbasketAccessItems) getWorkbasketAccessItems(ctx: StateContext, action: GetWorkbasketAccessItems): Observable { - return this.workbasketService.getWorkBasketAccessItems(action.url).pipe(take(1), tap( - workbasketAccessItemsRepresentation => { + return this.workbasketService.getWorkBasketAccessItems(action.url).pipe( + take(1), + tap((workbasketAccessItemsRepresentation) => { ctx.patchState({ workbasketAccessItems: workbasketAccessItemsRepresentation }); - } - )); + }) + ); } @Action(UpdateWorkbasketAccessItems) - updateWorkbasketAccessItems(ctx: StateContext, - action: UpdateWorkbasketAccessItems): Observable { - return this.workbasketService.updateWorkBasketAccessItem(action.url, action.workbasketAccessItems) - .pipe(take(1), tap(workbasketAccessItems => { - ctx.patchState({ - workbasketAccessItems - }); - this.notificationService.showToast(NOTIFICATION_TYPES.SUCCESS_ALERT_7, - new Map([['workbasketKey', ctx.getState().selectedWorkbasket.key]])); - }, error => { - this.notificationService.triggerError(NOTIFICATION_TYPES.SAVE_ERR_2, error); - })); + updateWorkbasketAccessItems( + ctx: StateContext, + action: UpdateWorkbasketAccessItems + ): Observable { + return this.workbasketService.updateWorkBasketAccessItem(action.url, action.workbasketAccessItems).pipe( + take(1), + tap( + (workbasketAccessItems) => { + ctx.patchState({ + workbasketAccessItems + }); + this.notificationService.showToast( + NOTIFICATION_TYPES.SUCCESS_ALERT_7, + new Map([['workbasketKey', ctx.getState().selectedWorkbasket.key]]) + ); + }, + (error) => { + this.notificationService.triggerError(NOTIFICATION_TYPES.SAVE_ERR_2, error); + } + ) + ); } @Action(GetWorkbasketDistributionTargets) - getWorkbasketDistributionTargets(ctx: StateContext, action: GetWorkbasketDistributionTargets): Observable { - return this.workbasketService.getWorkBasketsDistributionTargets(action.url).pipe(take(1), tap( - workbasketDistributionTargets => { + getWorkbasketDistributionTargets( + ctx: StateContext, + action: GetWorkbasketDistributionTargets + ): Observable { + return this.workbasketService.getWorkBasketsDistributionTargets(action.url).pipe( + take(1), + tap((workbasketDistributionTargets) => { ctx.patchState({ workbasketDistributionTargets }); - } - )); + }) + ); } @Action(UpdateWorkbasketDistributionTargets) @@ -222,16 +270,20 @@ export class WorkbasketState implements NgxsAfterBootstrap { ctx: StateContext, action: UpdateWorkbasketDistributionTargets ): Observable { - return this.workbasketService.updateWorkBasketsDistributionTargets(action.url, action.distributionTargetsIds).pipe(take(1), tap( - updatedWorkbasketsDistributionTargets => { - this.notificationService.showToast( - NOTIFICATION_TYPES.SUCCESS_ALERT_8, - new Map([['workbasketName', ctx.getState().selectedWorkbasket.name]]) - ); - }, error => { - this.notificationService.triggerError(NOTIFICATION_TYPES.SAVE_ERR_3, error); - } - )); + return this.workbasketService.updateWorkBasketsDistributionTargets(action.url, action.distributionTargetsIds).pipe( + take(1), + tap( + (updatedWorkbasketsDistributionTargets) => { + this.notificationService.showToast( + NOTIFICATION_TYPES.SUCCESS_ALERT_8, + new Map([['workbasketName', ctx.getState().selectedWorkbasket.name]]) + ); + }, + (error) => { + this.notificationService.triggerError(NOTIFICATION_TYPES.SAVE_ERR_3, error); + } + ) + ); } ngxsAfterBootstrap(ctx?: StateContext): void { @@ -243,7 +295,7 @@ function updateWorkbasketSummaryRepresentation( workbasketsSummary: WorkbasketSummary[], selectedWorkbasket: Workbasket ) { - return workbasketsSummary.map(w => { + return workbasketsSummary.map((w) => { if (w.workbasketId === selectedWorkbasket.workbasketId) { const workbasketSummary: WorkbasketSummary = selectedWorkbasket; return workbasketSummary; @@ -253,9 +305,9 @@ function updateWorkbasketSummaryRepresentation( } export interface WorkbasketStateModel { - paginatedWorkbasketsSummary: WorkbasketSummaryRepresentation, - selectedWorkbasket: Workbasket, - action: ACTION, - workbasketAccessItems: WorkbasketAccessItemsRepresentation, - workbasketDistributionTargets: WorkbasketDistributionTargets + paginatedWorkbasketsSummary: WorkbasketSummaryRepresentation; + selectedWorkbasket: Workbasket; + action: ACTION; + workbasketAccessItems: WorkbasketAccessItemsRepresentation; + workbasketDistributionTargets: WorkbasketDistributionTargets; } diff --git a/web/src/app/shared/util/query-parameters.ts b/web/src/app/shared/util/query-parameters.ts index 4f3245dd8..570db9955 100644 --- a/web/src/app/shared/util/query-parameters.ts +++ b/web/src/app/shared/util/query-parameters.ts @@ -60,7 +60,7 @@ export class TaskanaQueryParameters { public static getQueryParameters(queryParametersModel: QueryParameters): string { let query = '?'; - Object.keys(queryParametersModel).forEach(key => { + Object.keys(queryParametersModel).forEach((key) => { const value = queryParametersModel[key]; query += value ? `${TaskanaQueryParameters.parameters[key]}=${value}&` : ''; }); diff --git a/web/src/app/workplace/components/task-list-toolbar/task-list-toolbar.component.spec.ts b/web/src/app/workplace/components/task-list-toolbar/task-list-toolbar.component.spec.ts index ca7daf9b8..36d060ce6 100644 --- a/web/src/app/workplace/components/task-list-toolbar/task-list-toolbar.component.spec.ts +++ b/web/src/app/workplace/components/task-list-toolbar/task-list-toolbar.component.spec.ts @@ -23,28 +23,45 @@ import { TaskListToolbarComponent } from './task-list-toolbar.component'; selector: 'taskana-dummy-detail', template: 'dummydetail' }) -export class DummyDetailComponent { -} +export class DummyDetailComponent {} // TODO: test pending to test. Failing random xdescribe('TasklistToolbarComponent', () => { let component: TaskListToolbarComponent; let fixture: ComponentFixture; - const routes: Routes = [ - { path: '*', component: DummyDetailComponent } - ]; + const routes: Routes = [{ path: '*', component: DummyDetailComponent }]; beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [TaskListToolbarComponent, SortComponent, FilterComponent, MapValuesPipe, - IconTypeComponent, SvgIconComponent, DummyDetailComponent], - imports: [FormsModule, TypeaheadModule, HttpClientModule, RouterTestingModule.withRoutes(routes), - BrowserAnimationsModule], - providers: [TaskService, HttpClient, WorkbasketService, DomainService, RequestInProgressService, - SelectedRouteService, WorkplaceService, ComponentLoaderFactory, PositioningService] - }) - .compileComponents(); + declarations: [ + TaskListToolbarComponent, + SortComponent, + FilterComponent, + MapValuesPipe, + IconTypeComponent, + SvgIconComponent, + DummyDetailComponent + ], + imports: [ + FormsModule, + TypeaheadModule, + HttpClientModule, + RouterTestingModule.withRoutes(routes), + BrowserAnimationsModule + ], + providers: [ + TaskService, + HttpClient, + WorkbasketService, + DomainService, + RequestInProgressService, + SelectedRouteService, + WorkplaceService, + ComponentLoaderFactory, + PositioningService + ] + }).compileComponents(); })); beforeEach(() => { diff --git a/web/src/app/workplace/components/task-list-toolbar/task-list-toolbar.component.ts b/web/src/app/workplace/components/task-list-toolbar/task-list-toolbar.component.ts index d9cdc50f8..aa2af5d6c 100644 --- a/web/src/app/workplace/components/task-list-toolbar/task-list-toolbar.component.ts +++ b/web/src/app/workplace/components/task-list-toolbar/task-list-toolbar.component.ts @@ -27,7 +27,12 @@ export class TaskListToolbarComponent implements OnInit { @Output() performFilter = new EventEmitter(); @Output() selectSearchType = new EventEmitter(); - sortingFields = new Map([['name', 'Name'], ['priority', 'Priority'], ['due', 'Due'], ['planned', 'Planned']]); + sortingFields = new Map([ + ['name', 'Name'], + ['priority', 'Priority'], + ['due', 'Due'], + ['planned', 'Planned'] + ]); filterParams = { name: '', key: '', owner: '', priority: '', state: '' }; tasks: Task[] = []; @@ -46,21 +51,22 @@ export class TaskListToolbarComponent implements OnInit { resultType = ''; resultValue = ''; - constructor(private taskService: TaskService, + constructor( + private taskService: TaskService, private workbasketService: WorkbasketService, private workplaceService: WorkplaceService, private router: Router, - private route: ActivatedRoute) { - } + private route: ActivatedRoute + ) {} ngOnInit() { - this.workbasketService.getAllWorkBaskets().subscribe(workbaskets => { + this.workbasketService.getAllWorkBaskets().subscribe((workbaskets) => { this.workbaskets = workbaskets.workbaskets; - this.workbaskets.forEach(workbasket => { + this.workbaskets.forEach((workbasket) => { this.workbasketNames.push(workbasket.name); }); }); - this.taskService.getSelectedTask().subscribe(t => { + this.taskService.getSelectedTask().subscribe((t) => { if (!this.resultName) { this.resultName = t.workbasketSummaryResource.name; this.resultId = t.workbasketSummaryResource.workbasketId; @@ -90,7 +96,7 @@ export class TaskListToolbarComponent implements OnInit { } else { this.workplaceService.selectObjectReference(); if (this.workbaskets) { - this.workbaskets.forEach(workbasket => { + this.workbaskets.forEach((workbasket) => { if (workbasket.name === this.resultName) { this.resultId = workbasket.workbasketId; this.currentBasket = workbasket; diff --git a/web/src/app/workplace/components/task-list/task-list.component.scss b/web/src/app/workplace/components/task-list/task-list.component.scss index d2e5f21fa..5fdd8ab1c 100644 --- a/web/src/app/workplace/components/task-list/task-list.component.scss +++ b/web/src/app/workplace/components/task-list/task-list.component.scss @@ -1,17 +1,16 @@ .clickable { - cursor: pointer; - } - - .list-group > li { - border-left: none; - border-right: none; - } - - li > div.row > dl { - margin-bottom: 0px; - } - - .list-group-item>div>dl>span.badge{ - margin-left: 8px; - } - \ No newline at end of file + cursor: pointer; +} + +.list-group > li { + border-left: none; + border-right: none; +} + +li > div.row > dl { + margin-bottom: 0px; +} + +.list-group-item > div > dl > span.badge { + margin-left: 8px; +} diff --git a/web/src/app/workplace/components/task-list/task-list.component.spec.ts b/web/src/app/workplace/components/task-list/task-list.component.spec.ts index cc99168f3..ea7a8f188 100644 --- a/web/src/app/workplace/components/task-list/task-list.component.spec.ts +++ b/web/src/app/workplace/components/task-list/task-list.component.spec.ts @@ -13,42 +13,26 @@ import { DateTimeZonePipe } from '../../../shared/pipes/date-time-zone.pipe'; selector: 'taskana-dummy-detail', template: 'dummydetail' }) -export class DummyDetailComponent { -} +export class DummyDetailComponent {} @Component({ selector: 'svg-icon', template: '

Mock Icon Component

' }) -export class MockSvgIconComponent { -} +export class MockSvgIconComponent {} describe('TaskListComponent', () => { let component: TaskListComponent; let fixture: ComponentFixture; - const routes: Routes = [ - { path: '*', component: DummyDetailComponent } - ]; + const routes: Routes = [{ path: '*', component: DummyDetailComponent }]; beforeEach(async(() => { TestBed.configureTestingModule({ - imports: [ - FormsModule, - RouterTestingModule.withRoutes(routes), - HttpClientModule], - declarations: [ - TaskListComponent, - DummyDetailComponent, - MockSvgIconComponent, - DateTimeZonePipe - ], - providers: [ - WorkplaceService, - ChangeDetectorRef - ] - }) - .compileComponents(); + imports: [FormsModule, RouterTestingModule.withRoutes(routes), HttpClientModule], + declarations: [TaskListComponent, DummyDetailComponent, MockSvgIconComponent, DateTimeZonePipe], + providers: [WorkplaceService, ChangeDetectorRef] + }).compileComponents(); })); beforeEach(() => { diff --git a/web/src/app/workplace/components/task-list/task-list.component.ts b/web/src/app/workplace/components/task-list/task-list.component.ts index 04c319a6d..5807f3c1e 100644 --- a/web/src/app/workplace/components/task-list/task-list.component.ts +++ b/web/src/app/workplace/components/task-list/task-list.component.ts @@ -1,4 +1,14 @@ -import { Component, OnInit, Input, ChangeDetectionStrategy, Output, EventEmitter, SimpleChanges, OnChanges, ChangeDetectorRef } from '@angular/core'; +import { + Component, + OnInit, + Input, + ChangeDetectionStrategy, + Output, + EventEmitter, + SimpleChanges, + OnChanges, + ChangeDetectorRef +} from '@angular/core'; import { Task } from 'app/workplace/models/task'; import { TaskanaDate } from 'app/shared/util/taskana.date'; import { WorkplaceService } from 'app/workplace/services/workplace.service'; @@ -7,7 +17,7 @@ import { Router, ActivatedRoute } from '@angular/router'; @Component({ selector: 'taskana-task-list', templateUrl: './task-list.component.html', - styleUrls: ['./task-list.component.scss'], + styleUrls: ['./task-list.component.scss'] }) export class TaskListComponent implements OnInit { @Input() @@ -19,13 +29,9 @@ export class TaskListComponent implements OnInit { @Output() selectedIdChange = new EventEmitter(); - constructor(private router: Router, - private route: ActivatedRoute, - private workplaceService: WorkplaceService) { - } + constructor(private router: Router, private route: ActivatedRoute, private workplaceService: WorkplaceService) {} - ngOnInit() { - } + ngOnInit() {} selectTask(taskId: string) { this.workplaceService.selectObjectReference(); diff --git a/web/src/app/workplace/components/task-master/task-master.component.spec.ts b/web/src/app/workplace/components/task-master/task-master.component.spec.ts index 25dbde3b8..2bfc7c6d2 100644 --- a/web/src/app/workplace/components/task-master/task-master.component.spec.ts +++ b/web/src/app/workplace/components/task-master/task-master.component.spec.ts @@ -27,8 +27,7 @@ import { NotificationService } from '../../../shared/services/notifications/noti selector: 'taskana-dummy-detail', template: 'dummydetail' }) -export class DummyDetailComponent { -} +export class DummyDetailComponent {} // TODO: test pending to test. Failing random xdescribe('TaskMasterComponent', () => { @@ -37,16 +36,34 @@ xdescribe('TaskMasterComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - imports: [FormsModule, TypeaheadModule, - HttpClientModule, BrowserAnimationsModule], - declarations: [TaskMasterComponent, TaskListToolbarComponent, SvgIconComponent, - PaginationComponent, SortComponent, FilterComponent, - SpreadNumberPipe, MapValuesPipe, IconTypeComponent, DummyDetailComponent], - providers: [TaskService, HttpClient, WorkplaceService, NotificationService, OrientationService, - WorkbasketService, DomainService, RequestInProgressService, SelectedRouteService, - ComponentLoaderFactory, PositioningService, SvgIconRegistryService] - }) - .compileComponents(); + imports: [FormsModule, TypeaheadModule, HttpClientModule, BrowserAnimationsModule], + declarations: [ + TaskMasterComponent, + TaskListToolbarComponent, + SvgIconComponent, + PaginationComponent, + SortComponent, + FilterComponent, + SpreadNumberPipe, + MapValuesPipe, + IconTypeComponent, + DummyDetailComponent + ], + providers: [ + TaskService, + HttpClient, + WorkplaceService, + NotificationService, + OrientationService, + WorkbasketService, + DomainService, + RequestInProgressService, + SelectedRouteService, + ComponentLoaderFactory, + PositioningService, + SvgIconRegistryService + ] + }).compileComponents(); })); beforeEach(() => { diff --git a/web/src/app/workplace/components/task-master/task-master.component.ts b/web/src/app/workplace/components/task-master/task-master.component.ts index 6ec052e6c..24670963b 100644 --- a/web/src/app/workplace/components/task-master/task-master.component.ts +++ b/web/src/app/workplace/components/task-master/task-master.component.ts @@ -59,39 +59,39 @@ export class TaskMasterComponent implements OnInit, OnDestroy { private notificationsService: NotificationService, private orientationService: OrientationService ) { - this.taskChangeSubscription = this.taskService.taskChangedStream.subscribe(task => { + this.taskChangeSubscription = this.taskService.taskChangedStream.subscribe((task) => { this.getTasks(); this.selectedId = task ? task.taskId : ''; }); - this.workbasketChangeSubscription = this.workplaceService.workbasketSelectedStream.subscribe(workbasket => { + this.workbasketChangeSubscription = this.workplaceService.workbasketSelectedStream.subscribe((workbasket) => { this.currentBasket = workbasket; if (this.selectedSearchType === Search.byWorkbasket) { this.getTasks(); } }); - this.objectReferenceSubscription = this.workplaceService.objectReferenceSelectedStream.subscribe(objectReference => { - this.objectReference = objectReference; - delete this.currentBasket; - if (objectReference) { - this.getTasks(); - } - }); - } - - ngOnInit() { - this.taskService.getSelectedTask().subscribe( - task => { - if (!this.currentBasket) { - this.selectedId = task.taskId; - this.currentBasket = task.workbasketSummaryResource; - } - if (!task) { - this.selectedId = ''; + this.objectReferenceSubscription = this.workplaceService.objectReferenceSelectedStream.subscribe( + (objectReference) => { + this.objectReference = objectReference; + delete this.currentBasket; + if (objectReference) { + this.getTasks(); } } ); + } + + ngOnInit() { + this.taskService.getSelectedTask().subscribe((task) => { + if (!this.currentBasket) { + this.selectedId = task.taskId; + this.currentBasket = task.workbasketSummaryResource; + } + if (!task) { + this.selectedId = ''; + } + }); this.orientationSubscription = this.orientationService.getOrientation().subscribe((orientation: Orientation) => { this.refreshWorkbasketList(); }); @@ -141,11 +141,19 @@ export class TaskMasterComponent implements OnInit, OnDestroy { this.tasks = []; } else { this.calculateHeightCard(); - this.taskService.findTasksWithWorkbasket(this.currentBasket ? this.currentBasket.workbasketId : '', - this.sort.sortBy, this.sort.sortDirection, this.filterBy.filterParams.name, this.filterBy.filterParams.owner, - this.filterBy.filterParams.priority, this.filterBy.filterParams.state, this.objectReference ? this.objectReference.type : '', - this.objectReference ? this.objectReference.value : '') - .subscribe(taskResource => { + this.taskService + .findTasksWithWorkbasket( + this.currentBasket ? this.currentBasket.workbasketId : '', + this.sort.sortBy, + this.sort.sortDirection, + this.filterBy.filterParams.name, + this.filterBy.filterParams.owner, + this.filterBy.filterParams.priority, + this.filterBy.filterParams.state, + this.objectReference ? this.objectReference.type : '', + this.objectReference ? this.objectReference.value : '' + ) + .subscribe((taskResource) => { this.requestInProgress = false; if (taskResource.tasks && taskResource.tasks.length > 1) { this.tasks = taskResource.tasks; diff --git a/web/src/app/workplace/components/task/task.component.scss b/web/src/app/workplace/components/task/task.component.scss index 24883b1e4..0129c65b4 100644 --- a/web/src/app/workplace/components/task/task.component.scss +++ b/web/src/app/workplace/components/task/task.component.scss @@ -1,4 +1,3 @@ - iframe { - height: calc(100vh - 290px); + height: calc(100vh - 290px); } diff --git a/web/src/app/workplace/components/task/task.component.spec.ts b/web/src/app/workplace/components/task/task.component.spec.ts index 9ad823c7b..ee2f98864 100644 --- a/web/src/app/workplace/components/task/task.component.spec.ts +++ b/web/src/app/workplace/components/task/task.component.spec.ts @@ -18,12 +18,9 @@ import { TaskComponent } from './task.component'; selector: 'taskana-dummy-detail', template: 'dummydetail' }) -class DummyDetailComponent { -} +class DummyDetailComponent {} -const routes: Routes = [ - { path: 'workplace/tasks', component: DummyDetailComponent } -]; +const routes: Routes = [{ path: 'workplace/tasks', component: DummyDetailComponent }]; // TODO: test pending to test. Failing random xdescribe('TaskComponent', () => { @@ -34,8 +31,15 @@ xdescribe('TaskComponent', () => { TestBed.configureTestingModule({ imports: [FormsModule, HttpClientModule, RouterTestingModule.withRoutes(routes)], declarations: [TaskComponent, SpinnerComponent, DummyDetailComponent], - providers: [TaskService, HttpClient, WorkbasketService, DomainService, RequestInProgressService, - SelectedRouteService, ClassificationsService] + providers: [ + TaskService, + HttpClient, + WorkbasketService, + DomainService, + RequestInProgressService, + SelectedRouteService, + ClassificationsService + ] }).compileComponents(); })); diff --git a/web/src/app/workplace/components/task/task.component.ts b/web/src/app/workplace/components/task/task.component.ts index 6ddcb1313..489eb7a86 100644 --- a/web/src/app/workplace/components/task/task.component.ts +++ b/web/src/app/workplace/components/task/task.component.ts @@ -24,16 +24,17 @@ export class TaskComponent implements OnInit, OnDestroy { task: Task = null; workbaskets: Workbasket[]; - constructor(private taskService: TaskService, + constructor( + private taskService: TaskService, private workbasketService: WorkbasketService, private classificationService: ClassificationsService, private route: ActivatedRoute, private router: Router, - private sanitizer: DomSanitizer) { - } + private sanitizer: DomSanitizer + ) {} ngOnInit() { - this.routeSubscription = this.route.params.subscribe(params => { + this.routeSubscription = this.route.params.subscribe((params) => { const { id } = params; this.getTask(id); }); @@ -42,9 +43,9 @@ export class TaskComponent implements OnInit, OnDestroy { async getTask(id: string) { this.requestInProgress = true; this.task = await this.taskService.getTask(id).toPromise(); - const classification = await this.classificationService.getClassification( - this.task.classificationSummary.classificationId - ).toPromise(); + const classification = await this.classificationService + .getClassification(this.task.classificationSummary.classificationId) + .toPromise(); this.address = this.extractUrl(classification.applicationEntryPoint) || `${this.address}/?q=${this.task.name}`; this.link = this.sanitizer.bypassSecurityTrustResourceUrl(this.address); this.getWorkbaskets(); @@ -53,11 +54,13 @@ export class TaskComponent implements OnInit, OnDestroy { getWorkbaskets() { this.requestInProgress = true; - this.workbasketService.getAllWorkBaskets().subscribe(workbaskets => { + this.workbasketService.getAllWorkBaskets().subscribe((workbaskets) => { this.requestInProgress = false; this.workbaskets = workbaskets.workbaskets; - const index = this.workbaskets.findIndex(workbasket => workbasket.name === this.task.workbasketSummaryResource.name); + const index = this.workbaskets.findIndex( + (workbasket) => workbasket.name === this.task.workbasketSummaryResource.name + ); if (index !== -1) { this.workbaskets.splice(index, 1); } @@ -66,40 +69,40 @@ export class TaskComponent implements OnInit, OnDestroy { transferTask(workbasket: Workbasket) { this.requestInProgress = true; - this.taskService.transferTask(this.task.taskId, workbasket.workbasketId).subscribe( - task => { - this.requestInProgress = false; - this.task = task; - } - ); + this.taskService.transferTask(this.task.taskId, workbasket.workbasketId).subscribe((task) => { + this.requestInProgress = false; + this.task = task; + }); this.navigateBack(); } completeTask() { this.requestInProgress = true; - this.taskService.completeTask(this.task.taskId).subscribe( - task => { - this.requestInProgress = false; - this.task = task; - this.taskService.publishUpdatedTask(task); - this.navigateBack(); - } - ); + this.taskService.completeTask(this.task.taskId).subscribe((task) => { + this.requestInProgress = false; + this.task = task; + this.taskService.publishUpdatedTask(task); + this.navigateBack(); + }); } navigateBack() { - this.router.navigate([{ outlets: { detail: `taskdetail/${this.task.taskId}` } }], { relativeTo: this.route.parent }); + this.router.navigate([{ outlets: { detail: `taskdetail/${this.task.taskId}` } }], { + relativeTo: this.route.parent + }); } private extractUrl(url: string): string { const me = this; const extractedExpressions = url.match(this.regex); - if (!extractedExpressions) { return url; } + if (!extractedExpressions) { + return url; + } let extractedUrl = url; - extractedExpressions.forEach(expression => { + extractedExpressions.forEach((expression) => { const parameter = expression.substring(2, expression.length - 1); let objectValue: any = me; - parameter.split('.').forEach(property => { + parameter.split('.').forEach((property) => { objectValue = this.getReflectiveProperty(objectValue, property); }); extractedUrl = extractedUrl.replace(expression, objectValue); diff --git a/web/src/app/workplace/components/taskdetails-attribute/attribute.component.spec.ts b/web/src/app/workplace/components/taskdetails-attribute/attribute.component.spec.ts index 9be4ad55d..106aeccd8 100644 --- a/web/src/app/workplace/components/taskdetails-attribute/attribute.component.spec.ts +++ b/web/src/app/workplace/components/taskdetails-attribute/attribute.component.spec.ts @@ -12,8 +12,7 @@ xdescribe('AttributeComponent', () => { TestBed.configureTestingModule({ imports: [FormsModule], declarations: [TaskdetailsAttributeComponent] - }) - .compileComponents(); + }).compileComponents(); })); beforeEach(() => { diff --git a/web/src/app/workplace/components/taskdetails-attribute/attribute.component.ts b/web/src/app/workplace/components/taskdetails-attribute/attribute.component.ts index 7baf3bef9..82f6d0964 100644 --- a/web/src/app/workplace/components/taskdetails-attribute/attribute.component.ts +++ b/web/src/app/workplace/components/taskdetails-attribute/attribute.component.ts @@ -11,8 +11,7 @@ export class TaskdetailsAttributeComponent implements OnInit { @Input() attributes: CustomAttribute[] = []; @Output() attributesChange: EventEmitter = new EventEmitter(); - ngOnInit() { - } + ngOnInit() {} addAttribute(): void { this.attributes.push({ key: '', value: '' }); diff --git a/web/src/app/workplace/components/taskdetails-custom-fields/custom-fields.component.spec.ts b/web/src/app/workplace/components/taskdetails-custom-fields/custom-fields.component.spec.ts index b7c22320e..e6c1523c2 100644 --- a/web/src/app/workplace/components/taskdetails-custom-fields/custom-fields.component.spec.ts +++ b/web/src/app/workplace/components/taskdetails-custom-fields/custom-fields.component.spec.ts @@ -12,8 +12,7 @@ xdescribe('CustomComponent', () => { TestBed.configureTestingModule({ imports: [FormsModule], declarations: [TaskdetailsCustomFieldsComponent] - }) - .compileComponents(); + }).compileComponents(); })); beforeEach(() => { diff --git a/web/src/app/workplace/components/taskdetails-custom-fields/custom-fields.component.ts b/web/src/app/workplace/components/taskdetails-custom-fields/custom-fields.component.ts index 1bad239db..785268cc5 100644 --- a/web/src/app/workplace/components/taskdetails-custom-fields/custom-fields.component.ts +++ b/web/src/app/workplace/components/taskdetails-custom-fields/custom-fields.component.ts @@ -9,6 +9,5 @@ export class TaskdetailsCustomFieldsComponent implements OnInit { @Input() task: Task; @Output() taskChange: EventEmitter = new EventEmitter(); - ngOnInit() { - } + ngOnInit() {} } diff --git a/web/src/app/workplace/components/taskdetails-general-fields-extension/general-fields-extension.component.spec.ts b/web/src/app/workplace/components/taskdetails-general-fields-extension/general-fields-extension.component.spec.ts index 34a1b323e..7e1ff3f2f 100644 --- a/web/src/app/workplace/components/taskdetails-general-fields-extension/general-fields-extension.component.spec.ts +++ b/web/src/app/workplace/components/taskdetails-general-fields-extension/general-fields-extension.component.spec.ts @@ -9,8 +9,7 @@ xdescribe('GeneralFieldsExtensionComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [GeneralFieldsExtensionComponent] - }) - .compileComponents(); + }).compileComponents(); })); beforeEach(() => { diff --git a/web/src/app/workplace/components/taskdetails-general-fields-extension/general-fields-extension.component.ts b/web/src/app/workplace/components/taskdetails-general-fields-extension/general-fields-extension.component.ts index 73cc86dc2..198d32a34 100644 --- a/web/src/app/workplace/components/taskdetails-general-fields-extension/general-fields-extension.component.ts +++ b/web/src/app/workplace/components/taskdetails-general-fields-extension/general-fields-extension.component.ts @@ -10,6 +10,5 @@ export class GeneralFieldsExtensionComponent implements OnInit { @Input() task: Task; @Output() taskChange: EventEmitter = new EventEmitter(); - ngOnInit() { - } + ngOnInit() {} } diff --git a/web/src/app/workplace/components/taskdetails-general/general-fields.component.spec.ts b/web/src/app/workplace/components/taskdetails-general/general-fields.component.spec.ts index 8a774706b..181945dee 100644 --- a/web/src/app/workplace/components/taskdetails-general/general-fields.component.spec.ts +++ b/web/src/app/workplace/components/taskdetails-general/general-fields.component.spec.ts @@ -18,8 +18,7 @@ import { TaskdetailsGeneralFieldsComponent } from './general-fields.component'; selector: 'taskana-dummy-detail', template: 'dummydetail' }) -export class DummyDetailComponent { -} +export class DummyDetailComponent {} // TODO: test pending to test. Failing random xdescribe('GeneralComponent', () => { @@ -27,20 +26,24 @@ xdescribe('GeneralComponent', () => { let fixture: ComponentFixture; let classificationsService; - const routes: Routes = [ - { path: '*', component: DummyDetailComponent } - ]; + const routes: Routes = [{ path: '*', component: DummyDetailComponent }]; - beforeEach(done => { + beforeEach((done) => { const configure = (testBed: TestBed) => { testBed.configureTestingModule({ imports: [FormsModule, HttpClientModule, RouterTestingModule.withRoutes(routes)], declarations: [TaskdetailsGeneralFieldsComponent, DummyDetailComponent], - providers: [HttpClient, ClassificationCategoriesService, - DomainService, RequestInProgressService, SelectedRouteService, ClassificationsService] + providers: [ + HttpClient, + ClassificationCategoriesService, + DomainService, + RequestInProgressService, + SelectedRouteService, + ClassificationsService + ] }); }; - configureTests(configure).then(testBed => { + configureTests(configure).then((testBed) => { classificationsService = testBed.get(ClassificationsService); const resource: ClassificationPagingList = { classifications: [ @@ -53,7 +56,8 @@ xdescribe('GeneralComponent', () => { name: 'classification1', parentId: 'parentId', parentKey: 'parentKey' - }, { + }, + { classificationId: 'id2', key: 'key2', category: 'category', @@ -62,7 +66,7 @@ xdescribe('GeneralComponent', () => { name: 'classification1', parentId: 'parentId', parentKey: 'parentKey' - }, + } ] }; spyOn(classificationsService, 'getClassificationsByDomain').and.returnValue(resource); @@ -80,7 +84,7 @@ xdescribe('GeneralComponent', () => { expect(component).toBeTruthy(); }); - it('should call to getClassificationsByDomain', done => { + it('should call to getClassificationsByDomain', (done) => { component.ngOnInit(); expect(classificationsService.getClassificationsByDomain).toHaveBeenCalled(); done(); diff --git a/web/src/app/workplace/components/taskdetails-general/general-fields.component.ts b/web/src/app/workplace/components/taskdetails-general/general-fields.component.ts index 958875686..1c0460bea 100644 --- a/web/src/app/workplace/components/taskdetails-general/general-fields.component.ts +++ b/web/src/app/workplace/components/taskdetails-general/general-fields.component.ts @@ -1,4 +1,14 @@ -import { Component, EventEmitter, Input, OnInit, Output, ViewChild, SimpleChanges, OnChanges, HostListener } from '@angular/core'; +import { + Component, + EventEmitter, + Input, + OnInit, + Output, + ViewChild, + SimpleChanges, + OnChanges, + HostListener +} from '@angular/core'; import { Task } from 'app/workplace/models/task'; import { FormsValidatorService } from 'app/shared/services/forms-validator/forms-validator.service'; import { NgForm } from '@angular/forms'; @@ -39,15 +49,17 @@ export class TaskdetailsGeneralFieldsComponent implements OnInit, OnChanges { private classificationService: ClassificationsService, private formsValidatorService: FormsValidatorService, private domainService: DomainService - ) { - } + ) {} ngOnInit() { this.getClassificationByDomain(); } ngOnChanges(changes: SimpleChanges): void { - if (changes.saveToggleTriggered && changes.saveToggleTriggered.currentValue !== changes.saveToggleTriggered.previousValue) { + if ( + changes.saveToggleTriggered && + changes.saveToggleTriggered.currentValue !== changes.saveToggleTriggered.previousValue + ) { this.validate(); } } @@ -64,13 +76,11 @@ export class TaskdetailsGeneralFieldsComponent implements OnInit, OnChanges { private validate() { this.formsValidatorService.formSubmitAttempt = true; - this.formsValidatorService - .validateFormInformation(this.taskForm, this.toogleValidationMap) - .then(value => { - if (value) { - this.formValid.emit(true); - } - }); + this.formsValidatorService.validateFormInformation(this.taskForm, this.toogleValidationMap).then((value) => { + if (value) { + this.formValid.emit(true); + } + }); } changedClassification(itemSelected: Classification) { @@ -79,8 +89,9 @@ export class TaskdetailsGeneralFieldsComponent implements OnInit, OnChanges { private async getClassificationByDomain() { this.requestInProgress = true; - this.classifications = (await this.classificationService.getClassificationsByDomain(this.domainService.getSelectedDomainValue())) - .classifications; + this.classifications = ( + await this.classificationService.getClassificationsByDomain(this.domainService.getSelectedDomainValue()) + ).classifications; this.requestInProgress = false; } } diff --git a/web/src/app/workplace/components/taskdetails/taskdetails.component.scss b/web/src/app/workplace/components/taskdetails/taskdetails.component.scss index 4ecf3d2d6..8a042c5d4 100644 --- a/web/src/app/workplace/components/taskdetails/taskdetails.component.scss +++ b/web/src/app/workplace/components/taskdetails/taskdetails.component.scss @@ -1,29 +1,30 @@ @import '../../../../theme/colors'; ::ng-deep .btn-block { - background-color: whitesmoke; - font-size: 16px; - font-weight: 700; + background-color: whitesmoke; + font-size: 16px; + font-weight: 700; } -::ng-deep .panel-group .panel-heading + .panel-collapse > .panel-body, .panel-group .panel-heading + .panel-collapse > .list-group { - border: none; +::ng-deep .panel-group .panel-heading + .panel-collapse > .panel-body, +.panel-group .panel-heading + .panel-collapse > .list-group { + border: none; } ::ng-deep .collapse { - -webkit-transition: max-height 0.5s ease; - -moz-transition: max-height 0.5s ease; - -o-transition: max-height 0.5s ease; - -ms-transition: max-height 0.5s ease; - transition: max-height 0.5s ease; - - display: block!important; - overflow: hidden!important; - visibility: visible!important; - max-height: 0; - - &.in { - max-height: 2000px; - overflow: visible!important; - } + -webkit-transition: max-height 0.5s ease; + -moz-transition: max-height 0.5s ease; + -o-transition: max-height 0.5s ease; + -ms-transition: max-height 0.5s ease; + transition: max-height 0.5s ease; + + display: block !important; + overflow: hidden !important; + visibility: visible !important; + max-height: 0; + + &.in { + max-height: 2000px; + overflow: visible !important; } +} diff --git a/web/src/app/workplace/components/taskdetails/taskdetails.component.spec.ts b/web/src/app/workplace/components/taskdetails/taskdetails.component.spec.ts index aed5ed7c1..60b905824 100644 --- a/web/src/app/workplace/components/taskdetails/taskdetails.component.spec.ts +++ b/web/src/app/workplace/components/taskdetails/taskdetails.component.spec.ts @@ -19,12 +19,9 @@ import { NotificationService } from '../../../shared/services/notifications/noti selector: 'taskana-dummy-detail', template: 'dummydetail' }) -class DummyDetailComponent { -} +class DummyDetailComponent {} -const routes: Routes = [ - { path: 'workplace/taskdetail/:id', component: DummyDetailComponent } -]; +const routes: Routes = [{ path: 'workplace/taskdetail/:id', component: DummyDetailComponent }]; // TODO: test pending to test. Failing random xdescribe('TaskdetailsComponent', () => { @@ -33,14 +30,17 @@ xdescribe('TaskdetailsComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [TaskdetailsComponent, SpinnerComponent, - TaskdetailsGeneralFieldsComponent, TaskdetailsCustomFieldsComponent, - TaskdetailsAttributeComponent, DummyDetailComponent], + declarations: [ + TaskdetailsComponent, + SpinnerComponent, + TaskdetailsGeneralFieldsComponent, + TaskdetailsCustomFieldsComponent, + TaskdetailsAttributeComponent, + DummyDetailComponent + ], imports: [FormsModule, RouterTestingModule.withRoutes(routes), HttpClientModule], - providers: - [TaskService, HttpClient, WorkplaceService, RequestInProgressService, NotificationService] - }) - .compileComponents(); + providers: [TaskService, HttpClient, WorkplaceService, RequestInProgressService, NotificationService] + }).compileComponents(); })); beforeEach(() => { diff --git a/web/src/app/workplace/components/taskdetails/taskdetails.component.ts b/web/src/app/workplace/components/taskdetails/taskdetails.component.ts index 1fc277506..90006c38f 100644 --- a/web/src/app/workplace/components/taskdetails/taskdetails.component.ts +++ b/web/src/app/workplace/components/taskdetails/taskdetails.component.ts @@ -32,21 +32,22 @@ export class TaskdetailsComponent implements OnInit, OnDestroy { private masterAndDetailSubscription: Subscription; private deleteTaskSubscription: Subscription; - constructor(private route: ActivatedRoute, + constructor( + private route: ActivatedRoute, private taskService: TaskService, private workplaceService: WorkplaceService, private router: Router, private requestInProgressService: RequestInProgressService, private notificationService: NotificationService, - private masterAndDetailService: MasterAndDetailService) { - } + private masterAndDetailService: MasterAndDetailService + ) {} ngOnInit() { this.currentWorkbasket = this.workplaceService.currentWorkbasket; - this.workbasketSubscription = this.workplaceService.getSelectedWorkbasket().subscribe(workbasket => { + this.workbasketSubscription = this.workplaceService.getSelectedWorkbasket().subscribe((workbasket) => { this.currentWorkbasket = workbasket; }); - this.routeSubscription = this.route.params.subscribe(params => { + this.routeSubscription = this.route.params.subscribe((params) => { this.currentId = params.id; // redirect if user enters through a deep-link if (!this.currentWorkbasket && this.currentId === 'new-task') { @@ -54,7 +55,7 @@ export class TaskdetailsComponent implements OnInit, OnDestroy { } this.getTask(); }); - this.masterAndDetailSubscription = this.masterAndDetailService.getShowDetail().subscribe(showDetail => { + this.masterAndDetailSubscription = this.masterAndDetailService.getShowDetail().subscribe((showDetail) => { this.showDetail = showDetail; }); } @@ -73,14 +74,17 @@ export class TaskdetailsComponent implements OnInit, OnDestroy { this.requestInProgress = false; this.task = new Task('', new ObjectReference(), this.currentWorkbasket); } else { - this.taskService.getTask(this.currentId).subscribe(task => { - this.requestInProgress = false; - this.task = task; - this.cloneTask(); - this.taskService.selectTask(task); - }, error => { - this.notificationService.triggerError(NOTIFICATION_TYPES.FETCH_ERR_7, error); - }); + this.taskService.getTask(this.currentId).subscribe( + (task) => { + this.requestInProgress = false; + this.task = task; + this.cloneTask(); + this.taskService.selectTask(task); + }, + (error) => { + this.notificationService.triggerError(NOTIFICATION_TYPES.FETCH_ERR_7, error); + } + ); } } @@ -104,13 +108,16 @@ export class TaskdetailsComponent implements OnInit, OnDestroy { } deleteTaskConfirmation(): void { - this.deleteTaskSubscription = this.taskService.deleteTask(this.task).subscribe(() => { - this.taskService.publishUpdatedTask(); - this.task = null; - this.router.navigate(['taskana/workplace/tasks']); - }, error => { - this.notificationService.triggerError(NOTIFICATION_TYPES.DELETE_ERR_2, error); - }); + this.deleteTaskSubscription = this.taskService.deleteTask(this.task).subscribe( + () => { + this.taskService.publishUpdatedTask(); + this.task = null; + this.router.navigate(['taskana/workplace/tasks']); + }, + (error) => { + this.notificationService.triggerError(NOTIFICATION_TYPES.DELETE_ERR_2, error); + } + ); } selectTab(tab: string): void { @@ -144,35 +151,41 @@ export class TaskdetailsComponent implements OnInit, OnDestroy { private updateTask() { this.requestInProgressService.setRequestInProgress(true); - this.taskService.updateTask(this.task).subscribe(task => { - this.requestInProgressService.setRequestInProgress(false); - this.task = task; - this.cloneTask(); - this.taskService.publishUpdatedTask(task); - this.notificationService.showToast(NOTIFICATION_TYPES.SUCCESS_ALERT_14); - }, () => { - this.requestInProgressService.setRequestInProgress(false); - this.notificationService.showToast(NOTIFICATION_TYPES.DANGER_ALERT); - }); + this.taskService.updateTask(this.task).subscribe( + (task) => { + this.requestInProgressService.setRequestInProgress(false); + this.task = task; + this.cloneTask(); + this.taskService.publishUpdatedTask(task); + this.notificationService.showToast(NOTIFICATION_TYPES.SUCCESS_ALERT_14); + }, + () => { + this.requestInProgressService.setRequestInProgress(false); + this.notificationService.showToast(NOTIFICATION_TYPES.DANGER_ALERT); + } + ); } private createTask() { this.requestInProgressService.setRequestInProgress(true); this.addDateToTask(); - this.taskService.createTask(this.task).subscribe(task => { - this.requestInProgressService.setRequestInProgress(false); - this.notificationService.showToast( - NOTIFICATION_TYPES.SUCCESS_ALERT_13, - new Map([['taskId', task.name]]) - ); - this.task = task; - this.taskService.selectTask(this.task); - this.taskService.publishUpdatedTask(task); - this.router.navigate([`../${task.taskId}`], { relativeTo: this.route }); - }, () => { - this.requestInProgressService.setRequestInProgress(false); - this.notificationService.showToast(NOTIFICATION_TYPES.DANGER_ALERT_2); - }); + this.taskService.createTask(this.task).subscribe( + (task) => { + this.requestInProgressService.setRequestInProgress(false); + this.notificationService.showToast( + NOTIFICATION_TYPES.SUCCESS_ALERT_13, + new Map([['taskId', task.name]]) + ); + this.task = task; + this.taskService.selectTask(this.task); + this.taskService.publishUpdatedTask(task); + this.router.navigate([`../${task.taskId}`], { relativeTo: this.route }); + }, + () => { + this.requestInProgressService.setRequestInProgress(false); + this.notificationService.showToast(NOTIFICATION_TYPES.DANGER_ALERT_2); + } + ); } private addDateToTask() { diff --git a/web/src/app/workplace/models/object-reference.ts b/web/src/app/workplace/models/object-reference.ts index 803f880c6..bc13a0b7c 100644 --- a/web/src/app/workplace/models/object-reference.ts +++ b/web/src/app/workplace/models/object-reference.ts @@ -1,9 +1,10 @@ export class ObjectReference { - constructor(public id?: string, + constructor( + public id?: string, public company?: string, public system?: string, public systemInstance?: string, public type?: string, - public value?: string) { - } + public value?: string + ) {} } diff --git a/web/src/app/workplace/models/task-resource.ts b/web/src/app/workplace/models/task-resource.ts index e9e213627..364706451 100644 --- a/web/src/app/workplace/models/task-resource.ts +++ b/web/src/app/workplace/models/task-resource.ts @@ -3,7 +3,5 @@ import { Links } from '../../shared/models/links'; import { Task } from './task'; export class TaskResource { - constructor(public tasks: Array, - public _links?: Links, - public page: Page = new Page()) {} + constructor(public tasks: Array, public _links?: Links, public page: Page = new Page()) {} } diff --git a/web/src/app/workplace/models/task.ts b/web/src/app/workplace/models/task.ts index 7e72f0f38..afb6973d3 100644 --- a/web/src/app/workplace/models/task.ts +++ b/web/src/app/workplace/models/task.ts @@ -3,7 +3,8 @@ import { ObjectReference } from './object-reference'; import { ClassificationSummary } from '../../shared/models/classification-summary'; export class Task { - constructor(public taskId: string, + constructor( + public taskId: string, public primaryObjRef: ObjectReference = new ObjectReference(), public workbasketSummaryResource?: Workbasket, public classificationSummary?: ClassificationSummary, @@ -41,8 +42,8 @@ export class Task { public custom13?: string, public custom14?: string, public custom15?: string, - public custom16?: string) { - } + public custom16?: string + ) {} } export class CustomAttribute { diff --git a/web/src/app/workplace/services/task.service.ts b/web/src/app/workplace/services/task.service.ts index ee8397e95..499c92c38 100644 --- a/web/src/app/workplace/services/task.service.ts +++ b/web/src/app/workplace/services/task.service.ts @@ -19,8 +19,7 @@ export class TaskService { taskSelectedSource = new Subject(); taskSelectedStream = this.taskSelectedSource.asObservable(); - constructor(private httpClient: HttpClient) { - } + constructor(private httpClient: HttpClient) {} publishUpdatedTask(task: Task = new Task('empty')) { this.taskChangedSource.next(task); @@ -34,7 +33,8 @@ export class TaskService { return this.taskSelectedStream; } - findTasksWithWorkbasket(basketId: string, + findTasksWithWorkbasket( + basketId: string, sortBy: string, sortDirection: string, nameLike: string, @@ -43,19 +43,22 @@ export class TaskService { state: string, objRefTypeLike: string, objRefValueLike: string, - allPages: boolean = false): Observable { - const url = `${this.url}${TaskanaQueryParameters.getQueryParameters(this.accessIdsParameters( - basketId, - sortBy, - sortDirection, - nameLike, - ownerLike, - priority, - state, - objRefTypeLike, - objRefValueLike, - allPages - ))}`; + allPages: boolean = false + ): Observable { + const url = `${this.url}${TaskanaQueryParameters.getQueryParameters( + this.accessIdsParameters( + basketId, + sortBy, + sortDirection, + nameLike, + ownerLike, + priority, + state, + objRefTypeLike, + objRefValueLike, + allPages + ) + )}`; return this.httpClient.get(url); } @@ -89,12 +92,24 @@ export class TaskService { } private convertTasksDatesToGMT(task: Task): Task { - if (task.created) { task.created = new Date(task.created).toISOString(); } - if (task.claimed) { task.claimed = new Date(task.claimed).toISOString(); } - if (task.completed) { task.completed = new Date(task.completed).toISOString(); } - if (task.modified) { task.modified = new Date(task.modified).toISOString(); } - if (task.planned) { task.planned = new Date(task.planned).toISOString(); } - if (task.due) { task.due = new Date(task.due).toISOString(); } + if (task.created) { + task.created = new Date(task.created).toISOString(); + } + if (task.claimed) { + task.claimed = new Date(task.claimed).toISOString(); + } + if (task.completed) { + task.completed = new Date(task.completed).toISOString(); + } + if (task.modified) { + task.modified = new Date(task.modified).toISOString(); + } + if (task.planned) { + task.planned = new Date(task.planned).toISOString(); + } + if (task.due) { + task.due = new Date(task.due).toISOString(); + } return task; } diff --git a/web/src/app/workplace/workplace.module.ts b/web/src/app/workplace/workplace.module.ts index 09ead68ce..b8bf4f4a5 100644 --- a/web/src/app/workplace/workplace.module.ts +++ b/web/src/app/workplace/workplace.module.ts @@ -46,7 +46,7 @@ const DECLARATIONS = [ TaskdetailsAttributeComponent, TaskComponent, GeneralFieldsExtensionComponent, - TaskListComponent, + TaskListComponent ]; @NgModule({ @@ -60,8 +60,7 @@ const DECLARATIONS = [ provide: HTTP_INTERCEPTORS, useClass: TokenInterceptor, multi: true - }, + } ] }) -export class WorkplaceModule { -} +export class WorkplaceModule {} diff --git a/web/src/assets/icons-fonts/README.md b/web/src/assets/icons-fonts/README.md index ce4141eca..39c1c0146 100644 --- a/web/src/assets/icons-fonts/README.md +++ b/web/src/assets/icons-fonts/README.md @@ -1,8 +1,7 @@ The recommended way to use the Material Icons font is by linking to the web font hosted on Google Fonts: ```html - + ``` Read more in our full usage guide: diff --git a/web/src/environments/data-sources/environment-information.json b/web/src/environments/data-sources/environment-information.json index d4eb22e89..ef6ee5af9 100644 --- a/web/src/environments/data-sources/environment-information.json +++ b/web/src/environments/data-sources/environment-information.json @@ -1,4 +1,4 @@ { - "taskanaRestUrl": "", + "taskanaRestUrl": "", "taskanaLogoutUrl": "" } diff --git a/web/src/environments/data-sources/taskana-customization.json b/web/src/environments/data-sources/taskana-customization.json index 2235f1f5b..297ac777c 100644 --- a/web/src/environments/data-sources/taskana-customization.json +++ b/web/src/environments/data-sources/taskana-customization.json @@ -1,69 +1,69 @@ { - "EN": { - "workbaskets": { - "information": { - "owner": { - "lookupField": true - }, - "custom1": { - "field": "Customized field 1 title", - "visible": true - }, - "custom3": { - "field": "", - "visible": false - } - }, - "access-items": { - "accessId": { - "lookupField": true - }, - "custom3": { - "field": "", - "visible": false - }, - "custom9": { - "field": "Some custom field", - "visible": true - }, - "custom10": { - "field": "", - "visible": false - }, - "custom11": { - "field": "", - "visible": false - }, - "custom12": { - "field": "", - "visible": false - } - } + "EN": { + "workbaskets": { + "information": { + "owner": { + "lookupField": true }, - "classifications": { - "information": { - "custom1": { - "field": "Classification custom 1", - "visible": true - }, - "custom3": { - "field": "", - "visible": false - } - }, - "categories": { - "EXTERNAL": "assets/icons/categories/external.svg", - "MANUAL": "assets/icons/categories/manual.svg", - "AUTOMATIC": "assets/icons/categories/automatic.svg", - "PROCESS": "assets/icons/categories/process.svg" - } + "custom1": { + "field": "Customized field 1 title", + "visible": true }, - "tasks": { - "information": { - "owner": { - "lookupField": true - } - } + "custom3": { + "field": "", + "visible": false } + }, + "access-items": { + "accessId": { + "lookupField": true + }, + "custom3": { + "field": "", + "visible": false + }, + "custom9": { + "field": "Some custom field", + "visible": true + }, + "custom10": { + "field": "", + "visible": false + }, + "custom11": { + "field": "", + "visible": false + }, + "custom12": { + "field": "", + "visible": false + } + } + }, + "classifications": { + "information": { + "custom1": { + "field": "Classification custom 1", + "visible": true + }, + "custom3": { + "field": "", + "visible": false + } + }, + "categories": { + "EXTERNAL": "assets/icons/categories/external.svg", + "MANUAL": "assets/icons/categories/manual.svg", + "AUTOMATIC": "assets/icons/categories/automatic.svg", + "PROCESS": "assets/icons/categories/process.svg" + } + }, + "tasks": { + "information": { + "owner": { + "lookupField": true + } + } } + } } diff --git a/web/src/polyfills.ts b/web/src/polyfills.ts index b6e530fb8..54aaf523a 100644 --- a/web/src/polyfills.ts +++ b/web/src/polyfills.ts @@ -15,8 +15,8 @@ */ /** ************************************************************************************************* -* BROWSER POLYFILLS -*/ + * BROWSER POLYFILLS + */ /** IE10 and IE11 requires the following for NgClass support on SVG elements */ // import 'classlist.js'; // Run `npm install --save classlist.js`. diff --git a/web/src/test.ts b/web/src/test.ts index 1053fb3fe..fd0119574 100644 --- a/web/src/test.ts +++ b/web/src/test.ts @@ -18,10 +18,7 @@ declare let require: any; __karma__.loaded = function noop() {}; // First, initialize the Angular testing environment. -getTestBed().initTestEnvironment( - BrowserDynamicTestingModule, - platformBrowserDynamicTesting() -); +getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting()); // Then we find all the tests. const contextAdministration = require.context('./app/administration', true, /\.spec\.ts$/); const contextWorkplace = require.context('./app/workplace', true, /\.spec\.ts$/); diff --git a/web/src/theme/_buttons.scss b/web/src/theme/_buttons.scss index fa861e251..8a1ad727e 100644 --- a/web/src/theme/_buttons.scss +++ b/web/src/theme/_buttons.scss @@ -1,11 +1,11 @@ .btn-group > .dropdown > .btn:first-child:not(:last-child):not(.dropdown-toggle) { - border-bottom-right-radius: 0; - border-top-right-radius: 0; + border-bottom-right-radius: 0; + border-top-right-radius: 0; } .btn-group ul + .btn { - margin-left: -1px; + margin-left: -1px; } .btn-group > div.btn-group > .btn:first-child:not(:last-child):not(.dropdown-toggle) { - border-radius: 0; + border-radius: 0; } diff --git a/web/src/theme/_checkboxes.scss b/web/src/theme/_checkboxes.scss index 3b216648b..fdb3e83d2 100644 --- a/web/src/theme/_checkboxes.scss +++ b/web/src/theme/_checkboxes.scss @@ -1,44 +1,46 @@ -input[type=checkbox] { - display: none; +input[type='checkbox'] { + display: none; } -input[type=checkbox] + label { - background-color: #fafafa; - border: 1px solid $blue; - box-shadow: 0 1px 2px rgba(0,0,0,0.05), inset 0px -15px 10px -12px rgba(0,0,0,0.05); - padding: 9px; - border-radius: 3px; - display: inline-block; - position: relative; - cursor: pointer; - margin-bottom: 0px; +input[type='checkbox'] + label { + background-color: #fafafa; + border: 1px solid $blue; + box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), inset 0px -15px 10px -12px rgba(0, 0, 0, 0.05); + padding: 9px; + border-radius: 3px; + display: inline-block; + position: relative; + cursor: pointer; + margin-bottom: 0px; } -input[type=checkbox][disabled]:checked + label { - background-color: $light-grey; - cursor: not-allowed +input[type='checkbox'][disabled]:checked + label { + background-color: $light-grey; + cursor: not-allowed; } -input[type=checkbox][disabled]:not(:checked) + label { - background-color: $light-grey; - cursor: not-allowed; +input[type='checkbox'][disabled]:not(:checked) + label { + background-color: $light-grey; + cursor: not-allowed; } -input[type=checkbox] + label:active, input[type=checkbox]:checked + label:active { - box-shadow: 0 1px 2px rgba(0,0,0,0.05), inset 0px 1px 3px rgba(0,0,0,0.1); +input[type='checkbox'] + label:active, +input[type='checkbox']:checked + label:active { + box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), inset 0px 1px 3px rgba(0, 0, 0, 0.1); } -input[type=checkbox]:checked + label { - background-color: white; - border: 1px solid $grey; - box-shadow: 0 1px 2px rgba(0,0,0,0.05), inset 0px -15px 10px -12px rgba(0,0,0,0.05), inset 15px 10px -12px rgba(255,255,255,0.1); - color: $blue; +input[type='checkbox']:checked + label { + background-color: white; + border: 1px solid $grey; + box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), inset 0px -15px 10px -12px rgba(0, 0, 0, 0.05), + inset 15px 10px -12px rgba(255, 255, 255, 0.1); + color: $blue; } -input[type=checkbox]:checked + label:after { - content: '\2714'; - font-size: 14px; - position: absolute; - top: 0px; - left: 3px; - color: $blue; +input[type='checkbox']:checked + label:after { + content: '\2714'; + font-size: 14px; + position: absolute; + top: 0px; + left: 3px; + color: $blue; } diff --git a/web/src/theme/_date-picker.scss b/web/src/theme/_date-picker.scss index 53e572bd7..a468b838e 100644 --- a/web/src/theme/_date-picker.scss +++ b/web/src/theme/_date-picker.scss @@ -2,7 +2,10 @@ background-color: #246972; } -.theme-green .bs-datepicker-body table td span.selected, .theme-green .bs-datepicker-body table td.selected span, .theme-green .bs-datepicker-body table td span[class*="select-"]:after, .theme-green .bs-datepicker-body table td[class*="select-"] span:after { +.theme-green .bs-datepicker-body table td span.selected, +.theme-green .bs-datepicker-body table td.selected span, +.theme-green .bs-datepicker-body table td span[class*='select-']:after, +.theme-green .bs-datepicker-body table td[class*='select-'] span:after { background-color: #246972; } diff --git a/web/src/theme/_forms.scss b/web/src/theme/_forms.scss index a01a08ddc..cb5069a8b 100644 --- a/web/src/theme/_forms.scss +++ b/web/src/theme/_forms.scss @@ -1,14 +1,14 @@ -.ng-invalid.ng-touched:not(form) { - border-color: $invalid; - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); - } - - .required-text { - padding-left: 3px; - color: $invalid; - } - - textarea { - resize: none; +.ng-invalid.ng-touched:not(form) { + border-color: $invalid; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); +} + +.required-text { + padding-left: 3px; + color: $invalid; +} + +textarea { + resize: none; } diff --git a/web/src/theme/_material_styles.scss b/web/src/theme/_material_styles.scss index 38a096fa7..88287ab96 100644 --- a/web/src/theme/_material_styles.scss +++ b/web/src/theme/_material_styles.scss @@ -3,18 +3,17 @@ font-style: normal; font-weight: 400; src: url(../assets/icons-fonts/MaterialIcons-Regular.eot); /* For IE6-8 */ - src: local('Material Icons'), - local('MaterialIcons-Regular'), - url(../assets/icons-fonts/MaterialIcons-Regular.woff2) format('woff2'), - url(../assets/icons-fonts/MaterialIcons-Regular.woff) format('woff'), - url(../assets/icons-fonts/MaterialIcons-Regular.ttf) format('truetype'); + src: local('Material Icons'), local('MaterialIcons-Regular'), + url(../assets/icons-fonts/MaterialIcons-Regular.woff2) format('woff2'), + url(../assets/icons-fonts/MaterialIcons-Regular.woff) format('woff'), + url(../assets/icons-fonts/MaterialIcons-Regular.ttf) format('truetype'); } .material-icons { font-family: 'Material Icons'; font-weight: normal; font-style: normal; - font-size: 24px; /* Preferred icon size */ + font-size: 24px; /* Preferred icon size */ display: inline-block; line-height: 1; text-transform: none; @@ -36,24 +35,57 @@ } /* Rules for sizing the icon. */ -.material-icons.md-14 { font-size: 15px; } -.material-icons.md-18 { font-size: 18px; } -.material-icons.md-20 { font-size: 20px; } -.material-icons.md-24 { font-size: 24px; } -.material-icons.md-36 { font-size: 36px; } -.material-icons.md-48 { font-size: 48px; } +.material-icons.md-14 { + font-size: 15px; +} +.material-icons.md-18 { + font-size: 18px; +} +.material-icons.md-20 { + font-size: 20px; +} +.material-icons.md-24 { + font-size: 24px; +} +.material-icons.md-36 { + font-size: 36px; +} +.material-icons.md-48 { + font-size: 48px; +} /* Rules for using icons as black on a light background. */ -.material-icons.md-dark { color: rgba(0, 0, 0, 0.54); } -.material-icons.md-dark.md-inactive { color: rgba(0, 0, 0, 0.26); } +.material-icons.md-dark { + color: rgba(0, 0, 0, 0.54); +} +.material-icons.md-dark.md-inactive { + color: rgba(0, 0, 0, 0.26); +} /* Rules for using icons as white on a dark background. */ -.material-icons.md-light { color: rgba(255, 255, 255, 1); } -.material-icons.md-light.md-inactive { color: rgba(255, 255, 255, 0.3); } +.material-icons.md-light { + color: rgba(255, 255, 255, 1); +} +.material-icons.md-light.md-inactive { + color: rgba(255, 255, 255, 0.3); +} /** styling of mat-radio overwrites the default colors of the radio TODO needs to be removed when migrating to material*/ -.mat-radio-button.mat-accent .mat-radio-inner-circle{background-color: $blue;} -.mat-radio-button.mat-accent.mat-radio-checked .mat-radio-outer-circle {border-color: $blue;} -.mat-radio-button.mat-accent .mat-radio-inner-circle, .mat-radio-button.mat-accent .mat-radio-ripple .mat-ripple-element:not(.mat-radio-persistent-ripple), .mat-radio-button.mat-accent.mat-radio-checked .mat-radio-persistent-ripple, .mat-radio-button.mat-accent:active .mat-radio-persistent-ripple {background-color: $blue;} -.mat-radio-outer-circle {border-color: $blue;} -.mat-radio-label-content {color: $blue;} +.mat-radio-button.mat-accent .mat-radio-inner-circle { + background-color: $blue; +} +.mat-radio-button.mat-accent.mat-radio-checked .mat-radio-outer-circle { + border-color: $blue; +} +.mat-radio-button.mat-accent .mat-radio-inner-circle, +.mat-radio-button.mat-accent .mat-radio-ripple .mat-ripple-element:not(.mat-radio-persistent-ripple), +.mat-radio-button.mat-accent.mat-radio-checked .mat-radio-persistent-ripple, +.mat-radio-button.mat-accent:active .mat-radio-persistent-ripple { + background-color: $blue; +} +.mat-radio-outer-circle { + border-color: $blue; +} +.mat-radio-label-content { + color: $blue; +} diff --git a/web/src/theme/_progress-bar.scss b/web/src/theme/_progress-bar.scss index 6c7d6ae32..a5b133d9c 100644 --- a/web/src/theme/_progress-bar.scss +++ b/web/src/theme/_progress-bar.scss @@ -1,27 +1,27 @@ @import 'colors'; .item { - margin-bottom: 20px; - position: relative; - width: 113px; - height: 113px; - border-radius: 50%; - border: 1px solid #fff; - background-color: #FFF; - float: left; - margin-right: 20px; + margin-bottom: 20px; + position: relative; + width: 113px; + height: 113px; + border-radius: 50%; + border: 1px solid #fff; + background-color: #fff; + float: left; + margin-right: 20px; } .radial-inner-bg { - border-radius: 50%; - width: 100px; - height: 100px; - top: 5px; - left: 5px; - background: #FFF; - position: absolute; - >h1 { - margin: 30px 0 0 5px; - } + border-radius: 50%; + width: 100px; + height: 100px; + top: 5px; + left: 5px; + background: #fff; + position: absolute; + > h1 { + margin: 30px 0 0 5px; + } } $step: 1; // step of % for created classes @@ -31,12 +31,13 @@ $half: round($loops / 2); @for $i from 0 through $loops { .progress-#{$i*$step} { @if $i < 50 { - $nextdeg: 90deg + ( $increment * $i ); - background-image: linear-gradient(90deg, #fff 50%, transparent 50%, transparent), linear-gradient($nextdeg, $pallete-green 51%, #fff 50%, #fff); - } - @else { - $nextdeg: -90deg + ( $increment * ( $i - $half ) ); - background-image: linear-gradient($nextdeg, $pallete-green 51%, transparent 50%, transparent), linear-gradient(270deg, $pallete-green 50%, #fff 50%, #fff); + $nextdeg: 90deg + ($increment * $i); + background-image: linear-gradient(90deg, #fff 50%, transparent 50%, transparent), + linear-gradient($nextdeg, $pallete-green 51%, #fff 50%, #fff); + } @else { + $nextdeg: -90deg + ($increment * ($i - $half)); + background-image: linear-gradient($nextdeg, $pallete-green 51%, transparent 50%, transparent), + linear-gradient(270deg, $pallete-green 50%, #fff 50%, #fff); } } } diff --git a/web/src/theme/_site.scss b/web/src/theme/_site.scss index 598fd453d..cf10ffc4a 100644 --- a/web/src/theme/_site.scss +++ b/web/src/theme/_site.scss @@ -1,4 +1,3 @@ - .placeholder img { display: inline-block; border-radius: 50%; @@ -157,7 +156,6 @@ svg-icon { background-color: #e1e1e1; } - /* *Remove bootstrap cols padding for master and detail component */ @@ -197,11 +195,10 @@ svg-icon { } .form-group.required .control-label:after { - content: " *"; + content: ' *'; color: red; } - .user-select { margin-left: 2px; } @@ -241,7 +238,6 @@ body { margin-bottom: 5px; } - .toolbar { padding: 13px 15px; } @@ -313,8 +309,14 @@ span.flip { } } -taskana-administration-workbasket-information, taskana-administration-workbasket-access-items, taskana-administration-workbasket-distribution-targets, taskana-administration-workbasket-details, taskana-monitor-task-report, -taskana-monitor-workbasket-report, taskana-monitor-classification-report, taskana-monitor-timestamp-report { +taskana-administration-workbasket-information, +taskana-administration-workbasket-access-items, +taskana-administration-workbasket-distribution-targets, +taskana-administration-workbasket-details, +taskana-monitor-task-report, +taskana-monitor-workbasket-report, +taskana-monitor-classification-report, +taskana-monitor-timestamp-report { & .panel { border: none; box-shadow: none; @@ -328,7 +330,11 @@ taskana-monitor-workbasket-report, taskana-monitor-classification-report, taskan } } -taskana-task-details, taskana-administration-classification-details, taskana-administration-access-items-management, taskana-task, taskana-task-query { +taskana-task-details, +taskana-administration-classification-details, +taskana-administration-access-items-management, +taskana-task, +taskana-task-query { & .panel { border: none; box-shadow: none; @@ -351,8 +357,10 @@ taskana-task-query { } } - -taskana-monitor-task-report, taskana-monitor-workbasket-report, taskana-monitor-classification-report, taskana-administration-access-items-management { +taskana-monitor-task-report, +taskana-monitor-workbasket-report, +taskana-monitor-classification-report, +taskana-administration-access-items-management { & .panel { & > .panel-heading { border-left: 1px solid #ddd; @@ -386,7 +394,8 @@ li.list-group-item:hover { border-bottom: 1px solid #ccc; } -.center-block > span.empty-icon, .empty-icon { +.center-block > span.empty-icon, +.empty-icon { display: block; width: 150px; height: 150px; @@ -422,7 +431,8 @@ li.list-group-item:hover { border-radius: 50%; background-color: transparent; - &:focus, &:active:focus { + &:focus, + &:active:focus { outline: none; } } @@ -442,7 +452,7 @@ li.list-group-item:hover { bottom: 0; top: 0; z-index: 990; - background-color: rgba(180,180,180,0.7); + background-color: rgba(180, 180, 180, 0.7); opacity: 0.8; } diff --git a/web/src/theme/_table.scss b/web/src/theme/_table.scss index 485ceda62..5d84fb407 100644 --- a/web/src/theme/_table.scss +++ b/web/src/theme/_table.scss @@ -1,83 +1,82 @@ .table { - width: 100%; - display: table; + width: 100%; + display: table; } .table-striped .table-body .table-row:nth-of-type(odd), .table-body-striped .table-body:nth-of-type(odd) { - background-color: #f9f9f9; + background-color: #f9f9f9; } .table-caption { - display: table-caption; + display: table-caption; } -.table-header, .table-footer { - display: table-header-group; +.table-header, +.table-footer { + display: table-header-group; } .table-header > .table-row:last-child > .table-cell { - border-bottom: 2px solid #ddd; + border-bottom: 2px solid #ddd; } .table-footer > .table-row:first-child > .table-cell { - border-top: 1px solid #ddd; + border-top: 1px solid #ddd; } .table-footer > .table-row:last-of-type > .table-cell, .table-header > .table-row > .table-cell { - border-bottom: none; + border-bottom: none; } .table-body { - display: table-row-group; + display: table-row-group; } .table-row { - display: table-row; + display: table-row; } .table-cell { - display: table-cell; - padding: 5px; - white-space: nowrap; - min-width: 50px; - vertical-align: middle; - text-align: center; - border-bottom: 1px solid #ddd; - cursor: default; + display: table-cell; + padding: 5px; + white-space: nowrap; + min-width: 50px; + vertical-align: middle; + text-align: center; + border-bottom: 1px solid #ddd; + cursor: default; } .table-cell--justify { - text-align: justify; + text-align: justify; } .table-cell--bold { - font-weight: bold; + font-weight: bold; } .table-cell--separator { - border-left: 2px solid #ddd; - border-right: 2px solid #ddd; - background-color: $light-grey; + border-left: 2px solid #ddd; + border-right: 2px solid #ddd; + background-color: $light-grey; - &.zoom-in { - cursor: zoom-in; - } + &.zoom-in { + cursor: zoom-in; + } + &.zoom-out { + cursor: zoom-out; + } - &.zoom-out { - cursor: zoom-out; - } - - min-width: 0; + min-width: 0; } .table-cell--border-right { - border-right: 2px solid #ddd; + border-right: 2px solid #ddd; } - .table-cell--border-left { - border-left: 2px solid #ddd; -} \ No newline at end of file + border-left: 2px solid #ddd; +} diff --git a/web/src/theme/_tabs.scss b/web/src/theme/_tabs.scss index b6f94a2d4..f98797d35 100644 --- a/web/src/theme/_tabs.scss +++ b/web/src/theme/_tabs.scss @@ -1,33 +1,33 @@ .nav.nav-tabs { - & > li { - & > a { - min-height: 52px; - padding-top: 15px; - border-radius: 0; - margin-right: 0; - &.has-changes{ - border-bottom: solid #f0ad4e; - } - cursor: pointer; - } - - &:first-child > a{ - border-left: none; - } - } - & > li.active > a { - border-top: 3px solid #479ea9; - padding-top: 13px; - background-color: #f5f5f5; - } - & > p{ - margin: 0; - } - & > li.disabled { - cursor: not-allowed; + & > li { + & > a { + min-height: 52px; + padding-top: 15px; + border-radius: 0; + margin-right: 0; + &.has-changes { + border-bottom: solid #f0ad4e; + } + cursor: pointer; } - & > li.disabled > a { - pointer-events: none; + &:first-child > a { + border-left: none; } + } + & > li.active > a { + border-top: 3px solid #479ea9; + padding-top: 13px; + background-color: #f5f5f5; + } + & > p { + margin: 0; + } + & > li.disabled { + cursor: not-allowed; + } + + & > li.disabled > a { + pointer-events: none; + } } diff --git a/web/src/theme/_tree.scss b/web/src/theme/_tree.scss index 574be6530..016258f1d 100644 --- a/web/src/theme/_tree.scss +++ b/web/src/theme/_tree.scss @@ -1,105 +1,108 @@ tree-viewport { - height: calc(100vh - 165px); - & > div { - display: inline-block; - } + height: calc(100vh - 165px); + & > div { + display: inline-block; + } } tree-node-expander { - - & .toggle-children { - &:before { - @extend .material-icons; - content: 'add'; - } - top: 2px; - @extend .blue; - background: white; - background-image: none; - color: $blue-green; - padding-left:3px; + & .toggle-children { + &:before { + @extend .material-icons; + content: 'add'; } + top: 2px; + @extend .blue; + background: white; + background-image: none; + color: $blue-green; + padding-left: 3px; + } } .toggle-children-wrapper { - padding: 0px; - font-size: 16px; + padding: 0px; + font-size: 16px; } tree-node-expander .toggle-children-wrapper-expanded { - & .toggle-children { - &:before { - @extend .material-icons; - content: 'remove'; - } - transform: none; + & .toggle-children { + &:before { + @extend .material-icons; + content: 'remove'; } + transform: none; + } } .node-content-wrapper { - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; - font-size: 16px; - margin: 0px 14px; + font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; + font-size: 16px; + margin: 0px 14px; } .node-wrapper { - padding: 4px 0px; + padding: 4px 0px; } .node-drop-slot { - height: 0px; + height: 0px; } -.node-content-wrapper, .tree-children { - position: relative; - } - -.node-content-wrapper::before, .tree-children::after { - content: ""; - position: absolute; +.node-content-wrapper, +.tree-children { + position: relative; } -.node-content-wrapper-active, .node-content-wrapper.node-content-wrapper-active:hover, .node-content-wrapper-active.node-content-wrapper-focused { - background-color: $blue; - & >tree-node-content{ - color:white; - & >span >svg-icon{ - @extend .white; - } +.node-content-wrapper::before, +.tree-children::after { + content: ''; + position: absolute; +} + +.node-content-wrapper-active, +.node-content-wrapper.node-content-wrapper-active:hover, +.node-content-wrapper-active.node-content-wrapper-focused { + background-color: $blue; + & > tree-node-content { + color: white; + & > span > svg-icon { + @extend .white; } + } } - + /* START Children branch lines*/ - .node-content-wrapper::before { - border-bottom: 1px dotted $blue-green; - border-left: 1px dotted $blue-green; - height: 28px; - top: -17px; - width: 20px; - left: -28px; - } - - .tree-node-level-1 > tree-node-wrapper > .node-wrapper > .node-content-wrapper::before { - display: none; - } - - .tree-node-leaf > .node-wrapper > .node-content-wrapper::before { - width: 25px; - } - - .tree-children::after { - border-left: 1px dotted $blue-green; - - height: 100%; - top: -15px; - left: -15px; - } - - tree-node:last-child > .tree-node > .tree-children::after { - border-left: none; - } - - .toggle-children { - z-index: 1; - } +.node-content-wrapper::before { + border-bottom: 1px dotted $blue-green; + border-left: 1px dotted $blue-green; + height: 28px; + top: -17px; + width: 20px; + left: -28px; +} + +.tree-node-level-1 > tree-node-wrapper > .node-wrapper > .node-content-wrapper::before { + display: none; +} + +.tree-node-leaf > .node-wrapper > .node-content-wrapper::before { + width: 25px; +} + +.tree-children::after { + border-left: 1px dotted $blue-green; + + height: 100%; + top: -15px; + left: -15px; +} + +tree-node:last-child > .tree-node > .tree-children::after { + border-left: none; +} + +.toggle-children { + z-index: 1; +} /* END children branch lines */ diff --git a/web/src/theme/_type-ahead.scss b/web/src/theme/_type-ahead.scss index 129ec9db5..9b69b922b 100644 --- a/web/src/theme/_type-ahead.scss +++ b/web/src/theme/_type-ahead.scss @@ -1,13 +1,11 @@ - -typeahead-container >ul.dropdown-menu{ - max-width: 600px; - & >li.active { - &>a { - background-color: $blue; - } - &>a:hover { - background-color: $blue; - } +typeahead-container > ul.dropdown-menu { + max-width: 600px; + & > li.active { + & > a { + background-color: $blue; } + & > a:hover { + background-color: $blue; + } + } } - diff --git a/web/src/theme/_variables.scss b/web/src/theme/_variables.scss index ca132a052..e7d62bcb8 100644 --- a/web/src/theme/_variables.scss +++ b/web/src/theme/_variables.scss @@ -1,10 +1,10 @@ @import 'colors'; @import 'mixin/colors'; -@mixin degraded-bar ($direction, $width, $height) { - display: block; - width: $width; - height: $height; - background-image: linear-gradient(to $direction, $pallete-blue 30%, $pallete-green 50%); - content: ' '; +@mixin degraded-bar($direction, $width, $height) { + display: block; + width: $width; + height: $height; + background-image: linear-gradient(to $direction, $pallete-blue 30%, $pallete-green 50%); + content: ' '; } diff --git a/web/src/theme/animations/expand.animation.ts b/web/src/theme/animations/expand.animation.ts index ba36fd103..62f79a193 100644 --- a/web/src/theme/animations/expand.animation.ts +++ b/web/src/theme/animations/expand.animation.ts @@ -3,47 +3,70 @@ import { trigger, style, transition, animate, keyframes, state } from '@angular/ export const expandDown = trigger('toggleDown', [ state('true', style({ opacity: '1', display: 'initial' })), state('false', style({ opacity: '0', display: 'none' })), - transition('false => true', animate('300ms ease-in', keyframes([ - style({ opacity: 0, height: '0px' }), - style({ opacity: 0.5, height: '50px' }), - style({ opacity: 1, height: '*' })]))), - transition('true => false', animate('300ms ease-out', keyframes([ - style({ opacity: 1, height: '*' }), - style({ opacity: 0.5, height: '50px' }), - style({ opacity: 0, height: '0px' })]))) + transition( + 'false => true', + animate( + '300ms ease-in', + keyframes([ + style({ opacity: 0, height: '0px' }), + style({ opacity: 0.5, height: '50px' }), + style({ opacity: 1, height: '*' }) + ]) + ) + ), + transition( + 'true => false', + animate( + '300ms ease-out', + keyframes([ + style({ opacity: 1, height: '*' }), + style({ opacity: 0.5, height: '50px' }), + style({ opacity: 0, height: '0px' }) + ]) + ) + ) ]); export const expandRight = trigger('toggleRight', [ - transition('void => *', animate('300ms ease-in', keyframes([ - style({ opacity: 0, width: '0px' }), - style({ opacity: 1, width: '150px' }), - style({ opacity: 1, width: '*' })]))), - transition('* => void', animate('300ms ease-out', keyframes([ - style({ opacity: 1, width: '*' }), - style({ opacity: 0, width: '150px' }), - style({ opacity: 0, width: '0px' })]))) + transition( + 'void => *', + animate( + '300ms ease-in', + keyframes([ + style({ opacity: 0, width: '0px' }), + style({ opacity: 1, width: '150px' }), + style({ opacity: 1, width: '*' }) + ]) + ) + ), + transition( + '* => void', + animate( + '300ms ease-out', + keyframes([ + style({ opacity: 1, width: '*' }), + style({ opacity: 0, width: '150px' }), + style({ opacity: 0, width: '0px' }) + ]) + ) + ) ]); export const expandTop = trigger('toggleTop', [ state('in', style({ transform: 'translateY(0)', overflow: 'hidden' })), - transition('void => *', [ - style({ transform: 'translateY(100%)', overflow: 'hidden' }), - animate(100) - ]), - transition('* => void', [ - animate(100, style({ transform: 'translateY(100%)', overflow: 'hidden' })) - ]) + transition('void => *', [style({ transform: 'translateY(100%)', overflow: 'hidden' }), animate(100)]), + transition('* => void', [animate(100, style({ transform: 'translateY(100%)', overflow: 'hidden' }))]) ]); export const opacity = trigger('toggleOpacity', [ state('*', style({ opacity: '1' })), state('void', style({ opacity: '0' })), - transition('void => *', animate('300ms ease-in', keyframes([ - style({ opacity: 0 }), - style({ opacity: 0.5 }), - style({ opacity: 1 })]))), - transition('* => void', animate('300ms ease-out', keyframes([ - style({ opacity: 1 }), - style({ opacity: 0.5 }), - style({ opacity: 0 })]))) + transition( + 'void => *', + animate('300ms ease-in', keyframes([style({ opacity: 0 }), style({ opacity: 0.5 }), style({ opacity: 1 })])) + ), + transition( + '* => void', + animate('300ms ease-out', keyframes([style({ opacity: 1 }), style({ opacity: 0.5 }), style({ opacity: 0 })])) + ) ]); diff --git a/web/src/theme/animations/validation.animation.ts b/web/src/theme/animations/validation.animation.ts index 0e9920773..fbeafef68 100644 --- a/web/src/theme/animations/validation.animation.ts +++ b/web/src/theme/animations/validation.animation.ts @@ -1,12 +1,19 @@ import { trigger, style, transition, animate, keyframes } from '@angular/animations'; export const highlight = trigger('validation', [ - transition('true => false, false => true, * => true', animate('1500ms', keyframes([ - style({ opacity: '1' }), - style({ opacity: '0.3' }), - style({ opacity: '1' }), - style({ opacity: '0.3' }), - style({ opacity: '1' }), - style({ opacity: '0.3' }), - style({ opacity: '1' })]))) + transition( + 'true => false, false => true, * => true', + animate( + '1500ms', + keyframes([ + style({ opacity: '1' }), + style({ opacity: '0.3' }), + style({ opacity: '1' }), + style({ opacity: '0.3' }), + style({ opacity: '1' }), + style({ opacity: '0.3' }), + style({ opacity: '1' }) + ]) + ) + ) ]); diff --git a/web/src/theme/bootstrap-3-backward-compatibility.scss b/web/src/theme/bootstrap-3-backward-compatibility.scss index f7155610f..873709e29 100644 --- a/web/src/theme/bootstrap-3-backward-compatibility.scss +++ b/web/src/theme/bootstrap-3-backward-compatibility.scss @@ -1,9 +1,11 @@ -.dropdown-menu.show, .modal-backdrop.show, .fade.show { +.dropdown-menu.show, +.modal-backdrop.show, +.fade.show { display: block; opacity: 1; visibility: visible; } .modal.fade .modal-dialog { - transform: translate(0,0); -} \ No newline at end of file + transform: translate(0, 0); +} diff --git a/web/src/theme/mixin/_colors.scss b/web/src/theme/mixin/_colors.scss index bf18095cc..8fd9cd77b 100644 --- a/web/src/theme/mixin/_colors.scss +++ b/web/src/theme/mixin/_colors.scss @@ -1,17 +1,15 @@ @mixin colors { - &-red { - background-color: $invalid; - } - &-green { - background-color: $pallete-green; - } - &-orange { - background-color: $brown; - } + &-red { + background-color: $invalid; + } + &-green { + background-color: $pallete-green; + } + &-orange { + background-color: $brown; + } } -.badge{ - @include colors; +.badge { + @include colors; } - - diff --git a/web/src/tsconfig.app.json b/web/src/tsconfig.app.json index cf49d7fda..e4e36095a 100644 --- a/web/src/tsconfig.app.json +++ b/web/src/tsconfig.app.json @@ -5,8 +5,5 @@ "baseUrl": "", "types": [] }, - "exclude": [ - "test.ts", - "**/*.spec.ts" - ] + "exclude": ["test.ts", "**/*.spec.ts"] } diff --git a/web/src/tsconfig.spec.json b/web/src/tsconfig.spec.json index 9c56a51c4..c8cc403b0 100644 --- a/web/src/tsconfig.spec.json +++ b/web/src/tsconfig.spec.json @@ -3,17 +3,8 @@ "compilerOptions": { "outDir": "../out-tsc/spec", "baseUrl": "", - "types": [ - "jasmine", - "node" - ] + "types": ["jasmine", "node"] }, - "files": [ - "test.ts", - "polyfills.ts" - ], - "include": [ - "**/*.spec.ts", - "**/*.d.ts" - ] + "files": ["test.ts", "polyfills.ts"], + "include": ["**/*.spec.ts", "**/*.d.ts"] } diff --git a/web/tsconfig.json b/web/tsconfig.json index 1a693cae2..b89056144 100644 --- a/web/tsconfig.json +++ b/web/tsconfig.json @@ -11,12 +11,7 @@ "emitDecoratorMetadata": true, "experimentalDecorators": true, "target": "es5", - "typeRoots": [ - "node_modules/@types" - ], - "lib": [ - "es2018", - "dom" - ] + "typeRoots": ["node_modules/@types"], + "lib": ["es2018", "dom"] } }