Commit 3272c2d7 authored by Christopher Keim's avatar Christopher Keim
Browse files

[TOB-245] feat: Add statement editor



 * Add pipe for extracting form arrays
 * Add value observable to abstract form component
 * Add standard projector functions to store util
 * Add rxjs operator to catch specific HttpErrorResponses
 * Add injection token for global URL object
 * Add action and effect for opening files in new tab
 * Add directive for toggling global css class on body
 * Reorganize statement config data in store
 * Add back end model and API calls for statement editor
 * Extend statement store for statement editor
 * Add components for statement editor form
 * Integrate store in statement editor form

[TOB-314] feat: Add attachment functionality to statement editor

 * Add tagging functionality to already existing attachment components
 * Reorganize attachment store module
 * Add attachment component to statement editor

[TOB-292] test: Increase test coverage to 80%

 * Add test cases for attachment effects
 * Add test cases for contact effects
 * Add test cases for process effects

[TOB-291] chore: Update dependencies

 * Update several dependencies in package.json
 * Add webpack plugin to generate license file
Signed-off-by: Christopher Keim's avatarChristopher Keim <keim@develop-group.de>
parent 98facd60
......@@ -9,6 +9,8 @@ licenses.txt
/out-tsc
/coverage
/.scannerwork
/lint.styles.report.json
/lint.ts.report.json
# Only exists if Bazel was run
/bazel-out
......@@ -21,7 +23,6 @@ chrome-profiler-events*.json
speed-measure-plugin*.json
# IDEs and editors
/.idea
.project
.classpath
.c9/
......@@ -29,6 +30,18 @@ speed-measure-plugin*.json
.settings/
*.sublime-workspace
# IDE - Jetbrains
# See: https://www.gitignore.io/api/jetbrains to share code style, etc.
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
.idea/modules.xml
.idea/*.iml
.idea/modules
# IDE - VSCode
.vscode/*
!.vscode/settings.json
......@@ -40,7 +53,6 @@ speed-measure-plugin*.json
# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
yarn-error.log
......
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<ScssCodeStyleSettings>
<option name="HEX_COLOR_LOWER_CASE" value="true" />
<option name="HEX_COLOR_LONG_FORMAT" value="true" />
</ScssCodeStyleSettings>
<TypeScriptCodeStyleSettings version="1">
<option name="FORCE_SEMICOLON_STYLE" value="true" />
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
<option name="FORCE_QUOTE_STYlE" value="true" />
<option name="SPACE_WITHIN_TYPE_ASSERTION" value="true" />
<option name="IMPORT_SORT_MODULE_NAME" value="true" />
<option name="BLACKLIST_IMPORTS" value="rxjs/Rx,primeng,primeng/public_api" />
</TypeScriptCodeStyleSettings>
<codeStyleSettings language="CSS">
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="LESS">
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="SASS">
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="SCSS">
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="Stylus">
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="TypeScript">
<option name="RIGHT_MARGIN" value="140" />
<option name="IF_BRACE_FORCE" value="3" />
<option name="DOWHILE_BRACE_FORCE" value="3" />
<option name="WHILE_BRACE_FORCE" value="3" />
<option name="FOR_BRACE_FORCE" value="3" />
</codeStyleSettings>
</code_scheme>
</component>
\ No newline at end of file
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>
\ No newline at end of file
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="Stylelint" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="TsLint" enabled="true" level="WARNING" enabled_by_default="true" />
</profile>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CommitMessageInspectionProfile">
<profile version="1.0">
<inspection_tool class="BodyLimit" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="SubjectBodySeparation" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="SubjectLimit" enabled="true" level="WARNING" enabled_by_default="true" />
</profile>
</component>
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
......@@ -14,5 +14,6 @@
<style>
.sb-show-main > *:nth-child(4) {
height: 100%;
overflow: auto;
}
</style>
......@@ -3,21 +3,7 @@
"stylelint-config-sass-guidelines"
],
"rules": {
"indentation": [
2,
{
"ignore": [
"inside-parens"
]
}
],
"shorthand-property-no-redundant-values": null,
"string-quotes": "double",
"value-keyword-case": null,
"color-hex-length": "long",
"property-no-vendor-prefix": null,
"function-parentheses-space-inside": null,
"block-opening-brace-space-before": "always",
"at-rule-name-space-after": "always",
"block-closing-brace-newline-after": [
"always",
{
......@@ -27,16 +13,29 @@
]
}
],
"block-opening-brace-space-before": "always",
"color-hex-length": "long",
"function-parentheses-newline-inside": null,
"at-rule-name-space-after": "always",
"rule-empty-line-before": "always",
"function-parentheses-space-inside": null,
"indentation": [
2,
{
"ignore": [
"inside-parens"
]
}
],
"max-nesting-depth": 3,
"no-duplicate-selectors": true,
"order/properties-alphabetical-order": null,
"scss/selector-no-redundant-nesting-selector": null,
"property-no-vendor-prefix": null,
"rule-empty-line-before": "always",
"scss/at-else-closing-brace-newline-after": "always-last-in-chain",
"scss/at-else-closing-brace-space-after": "always-intermediate",
"scss/at-else-empty-line-before": "never",
"scss/at-if-closing-brace-newline-after": "always-last-in-chain",
"scss/at-if-closing-brace-space-after": "always-intermediate",
"scss/selector-no-redundant-nesting-selector": null,
"selector-type-no-unknown": [
true,
{
......@@ -46,6 +45,9 @@
"mat-checkbox"
]
}
]
],
"shorthand-property-no-redundant-values": null,
"string-quotes": "double",
"value-keyword-case": null
}
}
......@@ -47,101 +47,113 @@ The project maintains the following source code repositories:
## Third-party Content
@angular/animations (9.1.0)
@angular-devkit/build-angular (0.901.11)
* License: MIT
* Source: https://github.com/angular/angular
* Homepage: https://github.com/angular/angular-cli
@angular/cdk (9.2.0)
@angular/animations (9.1.12)
* License: MIT
* Source: https://github.com/angular/components
* Homepage: https://github.com/angular/angular#readme
@angular/common (9.1.0)
@angular/cdk (9.2.4)
* License: MIT
* Source: https://github.com/angular/angular
* Homepage: https://github.com/angular/components#readme
@angular/compiler (9.1.0)
@angular/common (9.1.12)
* License: MIT
* Source: https://github.com/angular/angular
* Homepage: https://github.com/angular/angular#readme
@angular/core (9.1.0)
@angular/core (9.1.12)
* License: MIT
* Source: https://github.com/angular/angular
* Homepage: https://github.com/angular/angular#readme
@angular/forms (9.1.0)
@angular/forms (9.1.12)
* License: MIT
* Source: https://github.com/angular/angular
* Homepage: https://github.com/angular/angular#readme
@angular/material (9.2.0)
@angular/material (9.2.4)
* License: MIT
* Source: https://github.com/angular/components
* Homepage: https://github.com/angular/components#readme
@angular/platform-browser-dynamic (9.1.0)
@angular/platform-browser (9.1.12)
* License: MIT
* Source: https://github.com/angular/angular
@angular/platform-browser (9.1.0)
* Homepage: https://github.com/angular/angular#readme
@angular/platform-browser-dynamic (9.1.12)
* License: MIT
* Source: https://github.com/angular/angular
* Homepage: https://github.com/angular/angular#readme
@angular/router (9.1.0)
@angular/router (9.1.12)
* License: MIT
* Source: https://github.com/angular/angular
* Homepage: https://github.com/angular/angular/tree/master/packages/router
@ngrx/effects (9.0.0)
@ngrx/effects (9.2.0)
* License: MIT
* Source: https://github.com/ngrx/platform
* Homepage: https://github.com/ngrx/platform#readme
@ngrx/store (9.0.0)
@ngrx/store (9.2.0)
* License: MIT
* Source: https://github.com/ngrx/platform
* Homepage: https://github.com/ngrx/platform#readme
@ngx-translate/core (12.1.2)
* License: MIT
* Source: https://github.com/ngx-translate/core
* Homepage: https://github.com/ngx-translate/core
@ngx-translate/http-loader (4.0.0)
@ngx-translate/http-loader (5.0.0)
* License: MIT
* Source: https://github.com/ngx-translate/http-loader
* Homepage: https://github.com/ngx-translate/http-loader
bpmn-js (6.5.1)
* License: bpmn.io License (https://bpmn.io/license)
* Source: https://github.com/bpmn-io/bpmn-js
* Homepage: https://github.com/bpmn-io/bpmn-js#readme
core-js (3.6.4)
* License: MIT
* Homepage: https://github.com/zloirock/core-js#readme
css-loader (3.5.1)
* License: MIT
* Homepage: https://github.com/webpack-contrib/css-loader
leaflet (1.6.0)
* License: BSD-2-Clause
* Source: https://github.com/Leaflet/Leaflet
* Homepage: https://leafletjs.com/
material-design-icons (3.0.1)
* License: Apache-2.0
* Source: https://github.com/google/material-design-icons
* Homepage: https://github.com/google/material-design-icons
moment (2.24.0)
moment (2.27.0)
* License: MIT
* Source: https://github.com/moment/moment
* Homepage: https://momentjs.com
primeng (9.0.6)
primeng (9.1.3)
* License: MIT
* Source: https://github.com/primefaces/primeng
* Homepage: https://github.com/primefaces/primeng#readme
proj4 (2.6.1)
regenerator-runtime (0.13.5)
* License: MIT
* Source: https://github.com/proj4js/proj4js
* Repository: https://github.com/facebook/regenerator/tree/master/packages/regenerator-runtime
rxjs (6.5.4)
rxjs (6.5.5)
* License: Apache-2.0
* Source: https://github.com/reactivex/rxjs
* Homepage: https://github.com/ReactiveX/RxJS
source-sans-pro (3.6.0)
* License: OFL-1.1
* Source: https://github.com/adobe-fonts/source-sans-pro.git#release
* Homepage: https://adobe-fonts.github.io/source-sans-pro
tslib (1.11.1)
* License: Apache-2.0
* Source: https://github.com/Microsoft/tslib
tslib (1.13.0)
* License: 0BSD
* Homepage: https://www.typescriptlang.org/
webpack (4.42.0)
* License: MIT
* Homepage: https://github.com/webpack/webpack
zone.js (0.10.3)
* License: MIT
* Source: https://github.com/angular/angular
* Homepage: https://github.com/angular/angular#readme
## Cryptography
......
......@@ -15,8 +15,11 @@
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"builder": "@angular-builders/custom-webpack:browser",
"options": {
"customWebpackConfig": {
"path": "./webpack.config.js"
},
"outputPath": "dist/statement-public-affairs",
"index": "src/index.html",
"main": "src/main.ts",
......
This diff is collapsed.
{
"name": "openkonsequenz-statement-public-affairs",
"version": "0.5.0",
"version": "0.6.0",
"description": "Statement Public Affairs",
"license": "Eclipse Public License - v 2.0",
"repository": {
"type": "git",
"url": "https://git.eclipse.org/r/plugins/gitiles/openk-usermodules/org.eclipse.openk-usermodules.statementPublicAffairs.frontend"
},
"routes": {
"spaFrontend": "/statementpaFE",
"spaBackend": "/statementpaBE",
......@@ -37,69 +41,71 @@
},
"private": true,
"dependencies": {
"@angular/animations": "~9.1.0",
"@angular/cdk": "9.2.0",
"@angular/common": "~9.1.0",
"@angular/compiler": "~9.1.0",
"@angular/core": "~9.1.0",
"@angular/forms": "~9.1.0",
"@angular/material": "^9.2.0",
"@angular/platform-browser": "~9.1.0",
"@angular/platform-browser-dynamic": "~9.1.0",
"@angular/router": "~9.1.0",
"@ngrx/effects": "^9.0.0",
"@ngrx/store": "^9.0.0",
"@angular/animations": "~9.1.12",
"@angular/cdk": "~9.2.4",
"@angular/common": "~9.1.12",
"@angular/compiler": "~9.1.12",
"@angular/core": "~9.1.12",
"@angular/forms": "~9.1.12",
"@angular/material": "^9.2.4",
"@angular/platform-browser": "~9.1.12",
"@angular/platform-browser-dynamic": "~9.1.12",
"@angular/router": "~9.1.12",
"@ngrx/effects": "^9.2.0",
"@ngrx/store": "^9.2.0",
"@ngx-translate/core": "^12.1.2",
"@ngx-translate/http-loader": "^4.0.0",
"@ngx-translate/http-loader": "^5.0.0",
"bpmn-js": "^6.5.1",
"leaflet": "^1.6.0",
"material-design-icons": "^3.0.1",
"moment": "2.24.0",
"primeng": "^9.0.6",
"proj4": "^2.6.1",
"moment": "^2.27.0",
"primeng": "^9.1.3",
"rxjs": "~6.5.4",
"source-sans-pro": "^3.6.0",
"tslib": "^1.10.0",
"zone.js": "~0.10.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.901.0",
"@angular/cli": "~9.1.0",
"@angular/compiler-cli": "~9.1.0",
"@angular/language-service": "~9.1.0",
"@angular-builders/custom-webpack": "^9.2.0",
"@angular-devkit/build-angular": "~0.901.11",
"@angular/cli": "~9.1.11",
"@angular/compiler-cli": "~9.1.12",
"@angular/language-service": "~9.1.12",
"@babel/core": "^7.9.0",
"@ngrx/store-devtools": "^9.0.0",
"@storybook/addon-actions": "^5.3.18",
"@storybook/addon-knobs": "^5.3.18",
"@storybook/addon-links": "^5.3.18",
"@storybook/addon-notes": "^5.3.18",
"@storybook/addons": "^5.3.18",
"@storybook/angular": "^5.3.18",
"@ngrx/store-devtools": "^9.2.0",
"@storybook/addon-actions": "^5.3.19",
"@storybook/addon-knobs": "^5.3.19",
"@storybook/addon-links": "^5.3.19",
"@storybook/addon-notes": "^5.3.19",
"@storybook/addons": "^5.3.19",
"@storybook/angular": "^5.3.19",
"@types/jasmine": "~3.5.0",
"@types/jasminewd2": "~2.0.3",
"@types/klaw": "^3.0.1",
"@types/leaflet": "^1.5.17",
"@types/node": "^12.11.1",
"@types/proj4": "^2.5.0",
"autoprefixer": "^8.1.0",
"babel-loader": "^8.1.0",
"codelyzer": "^5.1.2",
"husky": "^4.2.3",
"husky": "^4.2.5",
"jasmine-core": "~3.5.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.4.1",
"karma": "~5.1.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~2.1.0",
"karma-jasmine": "~3.0.1",
"karma-jasmine-html-reporter": "^1.4.2",
"karma-coverage-istanbul-reporter": "~3.0.3",
"karma-jasmine": "~3.3.1",
"karma-jasmine-html-reporter": "^1.5.4",
"license-checker": "^25.0.1",
"protractor": "~5.4.3",
"puppeteer": "^3.1.0",
"license-webpack-plugin": "^2.3.0",
"protractor": "~7.0.0",
"puppeteer": "^3.3.0",
"sonar-scanner": "^3.1.0",
"stylelint": "^13.3.0",
"stylelint": "^13.6.1",
"stylelint-config-sass-guidelines": "^7.0.0",
"ts-node": "~8.3.0",
"tslint": "~6.1.0",
"typescript": "~3.8.3",
"webpack-bundle-analyzer": "^3.7.0"
"webpack-bundle-analyzer": "^3.8.0"
}
}
......@@ -11,20 +11,18 @@
* SPDX-License-Identifier: EPL-2.0
********************************************************************************/
export interface IStatementInfoFormValue {
export enum EAPIStaticAttachmentTagIds {
title: string;
EMAIL_TEXT = "email-text",
receiptDate: string;
EMAIL = "email",
dueDate: string;
OUTBOX = "outbox",
typeId: number;
CONSIDERATION = "consideration",
city: string;
STATEMENT = "statement",
district: string;
attachments?: File[];
COVER_LETTER = "cover-letter"
}
......@@ -44,5 +44,5 @@ export interface IAPIAttachmentModel {
/**
* List of IDs for tagging.
*/
tagIds: number[];
tagIds: string[];
}
......@@ -13,7 +13,7 @@
import {HttpClient} from "@angular/common/http";
import {Inject, Injectable} from "@angular/core";
import {urlJoin} from "../../../util/http";
import {objectToHttpParams, urlJoin} from "../../../util/http";
import {SPA_BACKEND_ROUTE} from "../../external-routes";
import {IAPIAttachmentModel} from "./IAPIAttachmentModel";
......@@ -38,11 +38,12 @@ export class AttachmentsApiService {
/**
* Uploads a new file to the back end linked to a specific statement.
*/
public postAttachment(statementId: number, taskId: string, file: File) {
public postAttachment(statementId: number, taskId: string, file: File, ...tagId: string[]) {
const params = tagId.length > 0 ? objectToHttpParams({tagId}) : undefined;
const endPoint = `/process/statements/${statementId}/task/${taskId}/attachments`;
const formData = new FormData();
formData.append("attachment", file, file.name);
return this.httpClient.post<IAPIAttachmentModel>(urlJoin(this.baseUrl, endPoint), formData);
return this.httpClient.post<IAPIAttachmentModel>(urlJoin(this.baseUrl, endPoint), formData, {params});
}
/**
......
......@@ -12,4 +12,5 @@
********************************************************************************/
export * from "./attachments-api.service";
export * from "./EAPIStaticAttachmentTagIds";
export * from "./IAPIAttachmentModel";
......@@ -39,7 +39,7 @@ export class CoreApiService {
}
/**
* Fetches the unser information
* Fetches the user information
*/
public getUserInfo() {
const endPoint = `userinfo`;
......
......@@ -16,5 +16,6 @@ export * from "./contacts";
export * from "./core";
export * from "./process";
export * from "./settings";
export * from "./statements";
export * from "./shared";
export * from "./statements";
export * from "./text";