From d182637f41213d6c8e5e9db577735dfef54422e8 Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Wed, 1 May 2019 14:37:22 +0200 Subject: [PATCH 01/31] improved the README.md, especially regarding the JHipster workflow --- README.md | 248 +++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 182 insertions(+), 66 deletions(-) diff --git a/README.md b/README.md index caccdc73..616276c9 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,38 @@ # hsadminNg Development + + + +**Table of Contents** _generated with [DocToc](https://github.com/thlorenz/doctoc)_ + +- [Setting up the Development Environment](#setting-up-the-development-environment) +- [Frequent Tasks](#frequent-tasks) + - [Building the Application with Test Execution](#building-the-application-with-test-execution) + - [Starting the Application](#starting-the-application) + - [Running JUnit tests with branch coverage](#running-junit-tests-with-branch-coverage) +- [HOWTO Commits](#howto-commits) + - [Creating HOWTO Commits](#creating-howto-commits) +- [Special Build Tasks](#special-build-tasks) + - [Spotless Formatting](#spotless-formatting) + - [Mutation Testing PiTest](#mutation-testing-pitest) + - [Git Workflow for JHipster Generator](#git-workflow-for-jhipster-generator) + - [Generating the Table of Contents for Markdown](#generating-the-table-of-contents-for-markdown) + + + ## Setting up the Development Environment You'll often need to execute `./gradlew`, therefore we suggest to define this alias: alias gw='./gradlew' +TODO: Instructions for setting up the dev environment from scratch. + ## Frequent Tasks ### Building the Application with Test Execution -gw build + gw build ### Starting the Application @@ -31,45 +53,82 @@ see: https://confluence.jetbrains.com/display/IDEADEV/IDEA+Coverage+Runner Either apply it to specific test configurations or, better, delete the previous test configurations and amend the JUnit template. -## Git Workflow for JHipster Generator +## HOWTO Commits -The jhipster-generated git branch tracks the history of the JDL model file -and the generated source code. The project has to be resetted to a clean state -(without any generated entities) before changes to the JDL file can be imported. +There are git tags on some commits which show how to add certain features. -| WARNING: This is just a guideline. You should understand what you are doing! | -| ---------------------------------------------------------------------------- | +Find all of such tags with: + git tag | grep HOWTO - git checkout jhipster-generated - git pull - git tag REAL-HEAD - git reset --hard jdl-base - git clean -f -d - git cherry-pick -n spotless - git reset --soft REAL-HEAD - git checkout REAL-HEAD src/main/jdl/customer.jdl # AND OTHERS! - git tag -d REAL-HEAD +### Creating HOWTO Commits - # MANUAL STEP: Apply changes to the jdl file! +If you want to add such a commit, make sure that it contains no clutter +(no changes which are not necessary for whatever the commit is about to explain), +and is complete with all unit tests, code coverage, pitest and other checks. +Otherwise the next developer would run into the same problems again. - # (Re-) Importing - jhipster import-jdl src/main/jdl/customer.jdl - jhipster import-jdl src/main/jdl/accessrights.jdl - # AND OTHERS, if applicable! +One way to keep the commit clean, is to develop it on a local branch. +If any other changes (e.g. bugfixes, API extensions etc.) are necessary, +apply these only to the master or cherry-pick just these to the master, +then rebase your local branch. Do not forget to run all checks locally: + gw clean check pitest # might need over an hour + +(Check the PiTest section for speeding up mutation testing.) + +To create and push a new tag use: + + git tag HOWTO-... master + git push origin HOWTO-... + +After you've moved an existing the tag to another commit, you can use: + + git push --force origin HOWTO-... + +## Special Build Tasks + +Besides common build tasks like `build`, `test` or `bootRun` this projects has some not so common tasks which are explained in this section. + +### Spotless Formatting + +To make sure that no IDE auto-formatter destroys the git history of any file and +especially to avoid merge conflicts from JHipster generated files after these had been changed, +we are using a standard formatter enforced by _spotless_, which is based on the standard Eclipse formatter. + +The rules can be checked and applied with these commands: + + gw spotlessCheck gw spotlessApply - git add . - git commit -m"..." - # MANUAL STEP: - # - if you've renamed any identifiers, use refactoring to rename in master as well BEFORE MERGING! +The spotlessCheck task is included as an early step in our Jenkins build pipeline. +Therefore wrong formatting is automatically detected. - # Merge changeset into master branch - git checkout master - git merge jhipster-generated +Our configuration can be found under the directory `cfg/spotless`. +Currently we only have specific rules for _\*.java_-files and their import-order. -### Amending the spotless commit +#### Our Changes to the Standard Eclipse Formatter + +We amended the Standard Eclipse Formatter in these respects: + +- Lines of code are never joined, thus the developer has control about linebreaks, + which is important for readability in some implementations like toString(). +- Lines in comments are never joined either, because that often destroys readable stucture. +- Parts of files can be excluded from getting formatted, by using `@formatter:off` and `@formatter:on` in a comment. + See for example in class `SecurityConfiguration`. + +#### Pre-Commit Hook + +If you like, you could add this code to the _pre-commit or \_pre_push_ hook\_ in your `.git/hooks` directory: + + if ! ./gradlew spotlessCheck; then + exit 1 + fi + +#### The Tagged Spotless Commit + +The commit which introduces the spotless configuration is tagged. +Through this tag it can easily be cherry-picked in the JHipster workflow. If you need to amend the commit tagged 'spotless', e.g. to change the spotless configuration, it can be done with these steps: @@ -87,43 +146,6 @@ it can be done with these steps: git reset --hard REAL-HEAD git tag -d REAL-HEAD -## HOWTO do This and That - -There are git tags on some commits which show how to add certian features. - -Find all of such tags with: - - git tag | grep HOWTO - -### creating HOWTO commits - -If you want to add such a commit, make sure that it contains no clutter -(no changes which are not necessary for whatever the commit is about to explain), -and is complete with all unit tests, code coverage, pitest and other checks. -Otherwise the next developer would run into the same problems again. - -One way to keep the commit clean, is to develop it on a local branch. -If any other changes (e.g. bugfixes, API extensions etc.) are necessary, -apply these only to the master or cherry-pick just these to the master, -then rebase your local branch. Do not forget to run all checks locally: - - gw clean check pitest # might need over an hour - -(Check the pitest section for speeding up pitest.) - -To create and push a new tag use: - - git tag HOWTO-... master - git push origin HOWTO-... - -After you've moved an existing the tag to another commit, you can use: - - git push origin HOWTO-... --force - -## Special Build Tasks - -Besides common build tasks like `build`, `test` or `bootRun` this projects has some not so common tasks which are explained in this section. - ### Mutation Testing PiTest ./gradlew pitest @@ -168,3 +190,97 @@ If you want to spend more CPU threads on your local system, you can change that gw pitest -Doverride.pitest.threads=7 I suggest to leave one CPU thread for other tasks or your might lag extremely. + +### Git Workflow for JHipster Generator + +The following workflow steps make sure that + +- JHipster re-imports work properly, +- the git history of changes to the JDL-files, the generated code and the master is comprehensible, +- and merging newly generated code to the master branch is smooth. + +It uses a git branch `jhipster-generated` to track the history of the JDL model file and the generated source code. +Applying commits which contain non-generated changes to that branch breaks the normal git history for generated files. +Therefore, this documentation is also not available in that branch. +Thus: + +**MANUAL STEP before starting:** Copy this workflow documentation, because this file will be gone once you switched the branch. + +| WARNING: The following steps are just a guideline. You should understand what you are doing! | +| -------------------------------------------------------------------------------------------- | + + +#### 1. Preparing the `jhipster-generated` git Branch + +This step assumes that the latest `*.jdl` files are on the `HEAD` of the `jhipster-generated` git branch. +On a re-import of a JDL-file, JHipster does not remove any generated classes which belong to entities deleted from the JDL-file. +Therefore, the project has to be reset to a clean state before changes to the JDL file can be re-imported. +We have not yet finally tested a simplified workflow for just adding new entities or properties. + +A git tag `jdl-base` is assumed to sit on the base commit after the application was generated, but before any entities were imported. + + git checkout jhipster-generated + git pull + git tag REAL-HEAD + git reset --hard jdl-base + git clean -f -d + git cherry-pick -n spotless + git reset --soft REAL-HEAD + git checkout REAL-HEAD src/main/jdl/customer.jdl # AND OTHERS! + git tag -d REAL-HEAD + +#### 2. Amending and Re-Importing the JDL + +**MANUAL STEP:** First apply all necessary changes to the JDL files. +Then re-import like this: + + # (Re-) Importing + jhipster import-jdl src/main/jdl/customer.jdl + jhipster import-jdl src/main/jdl/accessrights.jdl + jhipster import-jdl src/main/jdl/... # once there are more + +For smoothly being able to merge, we need the same formatting in the generated code as on the master: + + gw spotlessApply + +#### 3. Committing our Changes + + git add . + git commit -m"..." + +#### 4. Merging our Changes to the `master` Branch + + git checkout master + git pull + +**MANUAL STEP:** If you've renamed any identifiers, use the refactoring feature of your IDE to rename in master as well. +To avoid oodles of merge-conflicts, you need to do that **BEFORE MERGING!** +Commit any of such changes, if any. + +Now we can finally merge our changes to master. + + git merge jhipster-generated + +It's a good idea doing this step in an IDE because it makes conflict resolving much easier. +Typical merge conflicts stem from: + +- Random numbers in test data of `*IntTest.java` files. +- Timestamps in Liquibase-xml-Files. + +Now, I suggest to run all tests locally: + + gw clean test + +Once everything works again, we can push our new version: + + git push + +### Generating the Table of Contents for Markdown + +This README file contains a table of contents generated by _doctoc_. +It's quite simple to use: + +npm install -g doctoc +doctoc --maxlevel 3 README.md + +Further information can be found [https://github.com/thlorenz/doctoc/blob/master/README.md](on the _doctoc_ github page). From 89437ca0674fd017c55f29023cb7dfb2687db478 Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Wed, 3 Apr 2019 11:53:36 +0200 Subject: [PATCH 02/31] filter Customer table + class TableFilter --- src/main/resources/logback-spring.xml | 4 + .../entities/customer/customer.component.html | 26 ++++-- .../entities/customer/customer.component.ts | 8 ++ .../webapp/app/shared/util/tablefilter.ts | 40 +++++++++ .../spec/app/shared/util/tablefilter.spec.ts | 86 +++++++++++++++++++ 5 files changed, 158 insertions(+), 6 deletions(-) create mode 100644 src/main/webapp/app/shared/util/tablefilter.ts create mode 100644 src/test/javascript/spec/app/shared/util/tablefilter.spec.ts diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml index 2d182c88..e82256df 100644 --- a/src/main/resources/logback-spring.xml +++ b/src/main/resources/logback-spring.xml @@ -45,6 +45,10 @@ + diff --git a/src/main/webapp/app/entities/customer/customer.component.html b/src/main/webapp/app/entities/customer/customer.component.html index c655cc04..5d77faba 100644 --- a/src/main/webapp/app/entities/customer/customer.component.html +++ b/src/main/webapp/app/entities/customer/customer.component.html @@ -14,12 +14,26 @@ - - - - - - + + + + + + + + + + + + + + diff --git a/src/main/webapp/app/entities/customer/customer.component.ts b/src/main/webapp/app/entities/customer/customer.component.ts index 3f95501d..c3e4a5e0 100644 --- a/src/main/webapp/app/entities/customer/customer.component.ts +++ b/src/main/webapp/app/entities/customer/customer.component.ts @@ -8,6 +8,7 @@ import { AccountService } from 'app/core'; import { ITEMS_PER_PAGE } from 'app/shared'; import { CustomerService } from './customer.service'; +import { TableFilter } from 'app/shared/util/tablefilter'; @Component({ selector: 'jhi-customer', @@ -23,6 +24,7 @@ export class CustomerComponent implements OnInit, OnDestroy { predicate: any; reverse: any; totalItems: number; + filter: TableFilter<{ reference?: string; prefix?: string; name?: string; kind?: string }>; constructor( protected customerService: CustomerService, @@ -39,11 +41,15 @@ export class CustomerComponent implements OnInit, OnDestroy { }; this.predicate = 'id'; this.reverse = true; + this.filter = new TableFilter({ reference: 'equals', prefix: 'contains', name: 'contains', kind: 'equals' }, 500, () => { + this.loadAll(); + }); } loadAll() { this.customerService .query({ + ...this.filter.buildQueryCriteria(), page: this.page, size: this.itemsPerPage, sort: this.sort() @@ -96,6 +102,8 @@ export class CustomerComponent implements OnInit, OnDestroy { protected paginateCustomers(data: ICustomer[], headers: HttpHeaders) { this.links = this.parseLinks.parse(headers.get('link')); this.totalItems = parseInt(headers.get('X-Total-Count'), 10); + this.page = 0; + this.customers = []; for (let i = 0; i < data.length; i++) { this.customers.push(data[i]); } diff --git a/src/main/webapp/app/shared/util/tablefilter.ts b/src/main/webapp/app/shared/util/tablefilter.ts new file mode 100644 index 00000000..0d077c47 --- /dev/null +++ b/src/main/webapp/app/shared/util/tablefilter.ts @@ -0,0 +1,40 @@ +import { Subject, Subscription } from 'rxjs'; +import { debounceTime, distinctUntilChanged } from 'rxjs/operators'; + +/** + * Handles filtering in data tables by converting the user input to query criteria of the JHipster REST API. + * + * It also does not reload during a given debounce period. + */ +export class TableFilter { + criteria: T; + + private criteriaChangedSubject = new Subject(); + private criteriaChangedDebouncer: Subscription; + + constructor(private query: T, private debounceMillis: number, private reload: () => void) { + this.criteria = {} as any; + this.criteriaChangedDebouncer = this.criteriaChangedSubject.pipe(debounceTime(debounceMillis)).subscribe(() => this.reload()); + } + + trigger() { + this.debounce(); + } + + reset() { + this.criteria = {} as any; + this.debounce(); + } + + buildQueryCriteria() { + let queryCriteria: T = {} as any; + Object.keys(this.criteria).forEach(e => { + queryCriteria[e + '.' + this.query[e]] = this.criteria[e]; + }); + return queryCriteria; + } + + private debounce() { + this.criteriaChangedSubject.next(); + } +} diff --git a/src/test/javascript/spec/app/shared/util/tablefilter.spec.ts b/src/test/javascript/spec/app/shared/util/tablefilter.spec.ts new file mode 100644 index 00000000..977159a1 --- /dev/null +++ b/src/test/javascript/spec/app/shared/util/tablefilter.spec.ts @@ -0,0 +1,86 @@ +import { TableFilter } from 'app/shared/util/tablefilter'; + +/* To run these tests in IntelliJ IDEA, you need a run configuration with + Configuration File: + ~/Projekte/Hostsharing/hsadmin-ng/src/test/javascript/jest.conf.js + and a Node Interpreter, e.g. if installed with nvm, this could be: + ~/.nvm/versions/node/v10.15.3/bin/node + */ +describe('TableFilter Tests', () => { + describe('TableFilter', () => { + let filter: TableFilter<{ name: string; number: string }>; + let asynchronously: () => void; + + beforeEach(() => { + filter = new TableFilter({ name: 'contains', number: 'equals' }, 100, () => { + asynchronously(); + }); + }); + + it('trigger() asynchronously calls the reload-handler', done => { + // given + filter.criteria.name = 'Test Filter Value'; + + // when + filter.trigger(); + let triggerStartedAtMillis = Date.now(); + + // then + asynchronously = () => { + expect(Date.now()).toBeGreaterThan(triggerStartedAtMillis); + done(); + }; + }); + + it('if trigger() is called multiple times during debounce, debounce period ands after last trigger()', done => { + // given + filter.criteria.name = 'Test Filter Value'; + + // when + filter.trigger(); + let triggerStartedAtMillis = null; + setTimeout(() => { + filter.trigger(); + triggerStartedAtMillis = Date.now(); + }, 50); + + // then + asynchronously = () => { + expect(triggerStartedAtMillis).not.toBeNull(); + expect(Date.now()).toBeGreaterThan(triggerStartedAtMillis); + done(); + }; + }); + + it('when filter "name" is set to "test value", buildQueryCriteria() returns { "name.contains": "test value" }', () => { + // given + filter.criteria.name = 'test value'; + + // when + let actual = filter.buildQueryCriteria(); + + // then + expect(filter.buildQueryCriteria()).toEqual({ 'name.contains': 'test value' }); + }); + + it('reset() clears criteria and calls reload-handler, considering debounce period', done => { + // given + filter.criteria.name = 'Test Filter Value'; + + // when + filter.trigger(); + let triggerStartedAtMillis = null; + setTimeout(() => { + filter.reset(); + triggerStartedAtMillis = Date.now(); + }, 50); + + // then + asynchronously = () => { + expect(triggerStartedAtMillis).not.toBeNull(); + expect(Date.now()).toBeGreaterThan(triggerStartedAtMillis); + done(); + }; + }); + }); +}); From 7f358cc7fe21c1c428e47985faa02a83daac80a2 Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Thu, 2 May 2019 10:48:32 +0200 Subject: [PATCH 03/31] membership sample data and some minor fixes --- .../changelog/sample-data-Customer.xml | 5 ---- .../changelog/sample-data-Membership.xml | 15 ++++++++--- .../resources/config/liquibase/master.xml | 1 + .../liquibase/sample-data/memberships.csv | 13 +++++----- .../liquibase/sample-data/memberships.xml | 25 +++++++++++++++++++ .../membership/membership.component.html | 2 +- 6 files changed, 45 insertions(+), 16 deletions(-) create mode 100644 src/main/resources/config/liquibase/sample-data/memberships.xml diff --git a/src/main/resources/config/liquibase/changelog/sample-data-Customer.xml b/src/main/resources/config/liquibase/changelog/sample-data-Customer.xml index c89e5ada..b5b09fb8 100644 --- a/src/main/resources/config/liquibase/changelog/sample-data-Customer.xml +++ b/src/main/resources/config/liquibase/changelog/sample-data-Customer.xml @@ -10,11 +10,6 @@ separator=";" quotchar="'" tableName="customer"> - - - - - + + UPDATE membership SET remark = REPLACE(remark, '|', STRINGDECODE('\n')); + + + + DELETE FROM membership; + diff --git a/src/main/resources/config/liquibase/master.xml b/src/main/resources/config/liquibase/master.xml index b545c090..4be32e10 100644 --- a/src/main/resources/config/liquibase/master.xml +++ b/src/main/resources/config/liquibase/master.xml @@ -21,5 +21,6 @@ + diff --git a/src/main/resources/config/liquibase/sample-data/memberships.csv b/src/main/resources/config/liquibase/sample-data/memberships.csv index 0408664f..a5d16311 100644 --- a/src/main/resources/config/liquibase/sample-data/memberships.csv +++ b/src/main/resources/config/liquibase/sample-data/memberships.csv @@ -1,6 +1,7 @@ -id;customer_id;jhi_from;jhi_to -1;1;2001-04-10;2007-12-31 -2;1;2017-01-15;null -3;3;2003-05-15;2019-12-31 -4;4;2017-05-15;null -5;5;2011-08-18;null +id;customer_id;admission_document_date;cancellation_document_date;member_from_date;member_until_date;remark +1;1;2001-04-10;2007-08-09;2001-04-11;2007-12-31;is now client of another member|see XYZ +2;1;2017-01-15;null;2017-01-15;null;nothing to say here +3;3;2003-05-11;2019-11-30;2003-05-15;2019-12-31;business discontinued +4;4;2017-05-15;null;2017-05-15;null;whatever|is|to|say +5;5;2011-08-18;null;2011-08-18;null;foo bar etc. + diff --git a/src/main/resources/config/liquibase/sample-data/memberships.xml b/src/main/resources/config/liquibase/sample-data/memberships.xml new file mode 100644 index 00000000..f078ab38 --- /dev/null +++ b/src/main/resources/config/liquibase/sample-data/memberships.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + UPDATE membership SET remark = replace(remark, '|', '\n') + + + diff --git a/src/main/webapp/app/entities/membership/membership.component.html b/src/main/webapp/app/entities/membership/membership.component.html index 8f141466..d71850b3 100644 --- a/src/main/webapp/app/entities/membership/membership.component.html +++ b/src/main/webapp/app/entities/membership/membership.component.html @@ -27,7 +27,7 @@ - + diff --git a/src/main/webapp/i18n/de/customerKind.json b/src/main/webapp/i18n/de/customerKind.json index f96e75e4..62f07a45 100644 --- a/src/main/webapp/i18n/de/customerKind.json +++ b/src/main/webapp/i18n/de/customerKind.json @@ -2,8 +2,8 @@ "hsadminNgApp": { "CustomerKind": { "null": "", - "NATURAL": "NATURAL", - "LEGAL": "LEGAL" + "NATURAL": "natürliche Person", + "LEGAL": "juristische Person" } } } From dccafcc900ad96a2b907b2b7fcfe5a3d23972ed2 Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Thu, 2 May 2019 22:51:17 +0200 Subject: [PATCH 08/31] added TableFilter to share.component, TableFilter now with date range --- .../entities/customer/customer.component.html | 8 +-- .../entities/customer/customer.component.ts | 15 ++++- .../entities/share/share-update.component.ts | 1 - .../app/entities/share/share.component.html | 38 +++++++++--- .../app/entities/share/share.component.ts | 39 ++++++++++++ .../webapp/app/shared/util/tablefilter.ts | 45 ++++++++++++-- .../spec/app/shared/util/tablefilter.spec.ts | 59 +++++++++++++++---- 7 files changed, 171 insertions(+), 34 deletions(-) diff --git a/src/main/webapp/app/entities/customer/customer.component.html b/src/main/webapp/app/entities/customer/customer.component.html index 1eb35c75..f3183904 100644 --- a/src/main/webapp/app/entities/customer/customer.component.html +++ b/src/main/webapp/app/entities/customer/customer.component.html @@ -23,11 +23,11 @@ - - - + + +
ID Reference Prefix Name Kind ID Reference Prefix Name Kind
+ +
{{membership.id}} {{membership.admissionDocumentDate | date:'mediumDate'}}{{membership.cancellationDocumentDate | date:'mediumDsate'}}{{membership.cancellationDocumentDate | date:'mediumDate'}} {{membership.memberFromDate | date:'mediumDate'}} {{membership.memberUntilDate | date:'mediumDate'}} From 84f1abf0b0176d3fd9ebedb715bff695d5489b27 Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Thu, 2 May 2019 11:17:22 +0200 Subject: [PATCH 04/31] shares sample data and some cleanup --- .../changelog/sample-data-Customer.xml | 27 ---------------- .../changelog/sample-data-Membership.xml | 26 ---------------- .../resources/config/liquibase/master.xml | 1 + .../liquibase/sample-data/customers.xml | 8 ++++- .../liquibase/sample-data/memberships.xml | 8 ++++- .../config/liquibase/sample-data/shares.csv | 13 ++++++++ .../config/liquibase/sample-data/shares.xml | 31 +++++++++++++++++++ 7 files changed, 59 insertions(+), 55 deletions(-) delete mode 100644 src/main/resources/config/liquibase/changelog/sample-data-Customer.xml delete mode 100644 src/main/resources/config/liquibase/changelog/sample-data-Membership.xml create mode 100644 src/main/resources/config/liquibase/sample-data/shares.csv create mode 100644 src/main/resources/config/liquibase/sample-data/shares.xml diff --git a/src/main/resources/config/liquibase/changelog/sample-data-Customer.xml b/src/main/resources/config/liquibase/changelog/sample-data-Customer.xml deleted file mode 100644 index b5b09fb8..00000000 --- a/src/main/resources/config/liquibase/changelog/sample-data-Customer.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - UPDATE customer SET contractual_address = REPLACE(contractual_address, '|', STRINGDECODE('\n')); - - - - DELETE FROM customer; - - - - diff --git a/src/main/resources/config/liquibase/changelog/sample-data-Membership.xml b/src/main/resources/config/liquibase/changelog/sample-data-Membership.xml deleted file mode 100644 index 7ed7e3f6..00000000 --- a/src/main/resources/config/liquibase/changelog/sample-data-Membership.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - UPDATE membership SET remark = REPLACE(remark, '|', STRINGDECODE('\n')); - - - - DELETE FROM membership; - - - - diff --git a/src/main/resources/config/liquibase/master.xml b/src/main/resources/config/liquibase/master.xml index 4be32e10..ba329b2a 100644 --- a/src/main/resources/config/liquibase/master.xml +++ b/src/main/resources/config/liquibase/master.xml @@ -22,5 +22,6 @@ + diff --git a/src/main/resources/config/liquibase/sample-data/customers.xml b/src/main/resources/config/liquibase/sample-data/customers.xml index 730e9471..5823ef58 100644 --- a/src/main/resources/config/liquibase/sample-data/customers.xml +++ b/src/main/resources/config/liquibase/sample-data/customers.xml @@ -19,7 +19,13 @@ - UPDATE customer SET contractual_address = replace(contractual_address, '|', '\n') + + UPDATE customer SET contractual_address = replace(contractual_address, '|', '\n') + + + + DELETE FROM customer; + diff --git a/src/main/resources/config/liquibase/sample-data/memberships.xml b/src/main/resources/config/liquibase/sample-data/memberships.xml index f078ab38..89a4d6f0 100644 --- a/src/main/resources/config/liquibase/sample-data/memberships.xml +++ b/src/main/resources/config/liquibase/sample-data/memberships.xml @@ -19,7 +19,13 @@ - UPDATE membership SET remark = replace(remark, '|', '\n') + + UPDATE membership SET remark = replace(remark, '|', '\n') + + + + DELETE FROM membership; + diff --git a/src/main/resources/config/liquibase/sample-data/shares.csv b/src/main/resources/config/liquibase/sample-data/shares.csv new file mode 100644 index 00000000..b3cbe4e4 --- /dev/null +++ b/src/main/resources/config/liquibase/sample-data/shares.csv @@ -0,0 +1,13 @@ +id;membership_id;document_date;value_date;action;quantity;remark +1;1;2001-04-10;2001-04-11;SUBSCRIPTION;16;some|multiline|remark +2;1;2007-08-09;2007-12-31;CANCELLATION;16;another remark +3;2;2017-01-15;2017-01-17;SUBSCRIPTION;8;became a member again +4;2;2017-01-15;2017-01-17;SUBSCRIPTION;1;just writing something +5;3;2003-05-11;2003-05-18;SUBSCRIPTION;4;some comment +6;3;2003-05-15;2003-05-30;CANCELLATION;4;cancelled membership +7;4;2017-05-15;2017-05-17;SUBSCRIPTION;16; +8;5;2011-08-18;2011-09-01;SUBSCRIPTION;10; +9;5;2012-12-15;2013-01-01;SUBSCRIPTION;20;signed more shares +10;5;2017-11-22;2018-01-01;CANCELLATION;25;cancelled most of their shares + + diff --git a/src/main/resources/config/liquibase/sample-data/shares.xml b/src/main/resources/config/liquibase/sample-data/shares.xml new file mode 100644 index 00000000..307a9fe7 --- /dev/null +++ b/src/main/resources/config/liquibase/sample-data/shares.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + UPDATE share SET remark = replace(remark, '|', '\n') + + + + DELETE FROM share; + + + + From 13100a9010ad09af923ef9f7d898e04616dd394b Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Thu, 2 May 2019 11:25:13 +0200 Subject: [PATCH 05/31] assets sample data --- .../resources/config/liquibase/master.xml | 1 + .../config/liquibase/sample-data/assets.csv | 13 ++++++++ .../config/liquibase/sample-data/assets.xml | 31 +++++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 src/main/resources/config/liquibase/sample-data/assets.csv create mode 100644 src/main/resources/config/liquibase/sample-data/assets.xml diff --git a/src/main/resources/config/liquibase/master.xml b/src/main/resources/config/liquibase/master.xml index ba329b2a..e4d99de6 100644 --- a/src/main/resources/config/liquibase/master.xml +++ b/src/main/resources/config/liquibase/master.xml @@ -23,5 +23,6 @@ + diff --git a/src/main/resources/config/liquibase/sample-data/assets.csv b/src/main/resources/config/liquibase/sample-data/assets.csv new file mode 100644 index 00000000..8ac596fb --- /dev/null +++ b/src/main/resources/config/liquibase/sample-data/assets.csv @@ -0,0 +1,13 @@ +id;membership_id;document_date;value_date;action;amount;remark +1;1;2001-05-10;2001-05-11;PAYMENT;1024;some|multiline|remark +2;1;2007-09-09;2008-07-10;PAYBACK;1024;another remark +3;2;2017-02-15;2017-02-15;PAYMENT;512;became a member again +4;2;2017-02-15;2017-02-15;PAYMENT;64;just writing something +5;3;2003-06-11;2003-06-11;PAYMENT;256;some comment +6;3;2003-06-15;2004-07-03;PAYBACK;256;cancelled membership +7;4;2017-06-15;2017-05-17;PAYMENT;1024; +8;5;2011-09-18;2011-09-01;PAYMENT;640; +9;5;2013-01-15;2013-01-01;PAYMENT;1280;signed more shares +10;5;2017-12-22;2018-07-01;PAYBACK;1600;cancelled most of their shares + + diff --git a/src/main/resources/config/liquibase/sample-data/assets.xml b/src/main/resources/config/liquibase/sample-data/assets.xml new file mode 100644 index 00000000..101764e8 --- /dev/null +++ b/src/main/resources/config/liquibase/sample-data/assets.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + UPDATE asset SET remark = replace(remark, '|', '\n') + + + + DELETE FROM asset; + + + + From 2dd3deb17bace4ff966337ae315f345b6d1c8f92 Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Thu, 2 May 2019 11:28:40 +0200 Subject: [PATCH 06/31] fixing tslint issues --- src/main/webapp/app/shared/util/tablefilter.ts | 2 +- src/test/javascript/spec/app/shared/util/tablefilter.spec.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/webapp/app/shared/util/tablefilter.ts b/src/main/webapp/app/shared/util/tablefilter.ts index 0d077c47..f26dba4b 100644 --- a/src/main/webapp/app/shared/util/tablefilter.ts +++ b/src/main/webapp/app/shared/util/tablefilter.ts @@ -27,7 +27,7 @@ export class TableFilter { } buildQueryCriteria() { - let queryCriteria: T = {} as any; + const queryCriteria: T = {} as any; Object.keys(this.criteria).forEach(e => { queryCriteria[e + '.' + this.query[e]] = this.criteria[e]; }); diff --git a/src/test/javascript/spec/app/shared/util/tablefilter.spec.ts b/src/test/javascript/spec/app/shared/util/tablefilter.spec.ts index 977159a1..ee5e9f02 100644 --- a/src/test/javascript/spec/app/shared/util/tablefilter.spec.ts +++ b/src/test/javascript/spec/app/shared/util/tablefilter.spec.ts @@ -23,7 +23,7 @@ describe('TableFilter Tests', () => { // when filter.trigger(); - let triggerStartedAtMillis = Date.now(); + const triggerStartedAtMillis = Date.now(); // then asynchronously = () => { @@ -57,7 +57,7 @@ describe('TableFilter Tests', () => { filter.criteria.name = 'test value'; // when - let actual = filter.buildQueryCriteria(); + const actual = filter.buildQueryCriteria(); // then expect(filter.buildQueryCriteria()).toEqual({ 'name.contains': 'test value' }); From 8ae7547775ce0cfef2ddc5f32a786a621386d410 Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Thu, 2 May 2019 11:52:41 +0200 Subject: [PATCH 07/31] customer table with translated customerKind --- src/main/webapp/app/entities/customer/customer.component.html | 4 ++-- src/main/webapp/i18n/de/customerKind.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/webapp/app/entities/customer/customer.component.html b/src/main/webapp/app/entities/customer/customer.component.html index 5d77faba..1eb35c75 100644 --- a/src/main/webapp/app/entities/customer/customer.component.html +++ b/src/main/webapp/app/entities/customer/customer.component.html @@ -29,8 +29,8 @@
- diff --git a/src/main/webapp/app/entities/customer/customer.component.ts b/src/main/webapp/app/entities/customer/customer.component.ts index c3e4a5e0..7b66eb1d 100644 --- a/src/main/webapp/app/entities/customer/customer.component.ts +++ b/src/main/webapp/app/entities/customer/customer.component.ts @@ -41,9 +41,18 @@ export class CustomerComponent implements OnInit, OnDestroy { }; this.predicate = 'id'; this.reverse = true; - this.filter = new TableFilter({ reference: 'equals', prefix: 'contains', name: 'contains', kind: 'equals' }, 500, () => { - this.loadAll(); - }); + this.filter = new TableFilter( + { + reference: 'reference.equals', + prefix: 'prefix.contains', + name: 'name.contains', + kind: 'kind.equals' + }, + 500, + () => { + this.loadAll(); + } + ); } loadAll() { diff --git a/src/main/webapp/app/entities/share/share-update.component.ts b/src/main/webapp/app/entities/share/share-update.component.ts index e7301309..b031a238 100644 --- a/src/main/webapp/app/entities/share/share-update.component.ts +++ b/src/main/webapp/app/entities/share/share-update.component.ts @@ -3,7 +3,6 @@ import { ActivatedRoute } from '@angular/router'; import { HttpResponse, HttpErrorResponse } from '@angular/common/http'; import { Observable } from 'rxjs'; import { filter, map } from 'rxjs/operators'; -import * as moment from 'moment'; import { JhiAlertService } from 'ng-jhipster'; import { IShare } from 'app/shared/model/share.model'; import { ShareService } from './share.service'; diff --git a/src/main/webapp/app/entities/share/share.component.html b/src/main/webapp/app/entities/share/share.component.html index 87d58b25..32883f8c 100644 --- a/src/main/webapp/app/entities/share/share.component.html +++ b/src/main/webapp/app/entities/share/share.component.html @@ -14,22 +14,42 @@ - - - - - - - + + + + + + + + + + + + + + + + - + - + - @@ -39,7 +38,6 @@ -
ID Document Date Value Date Action Quantity Membership ID Document Date Value Date Action Quantity Membership
+ + + +
{{share.id}}{{share.id}} {{share.documentDate | date:'mediumDate'}} {{share.valueDate | date:'mediumDate'}} {{share.action}}{{share.quantity}}{{share.quantity}}
{{share.membershipDisplayLabel}} diff --git a/src/main/webapp/app/entities/share/share.component.ts b/src/main/webapp/app/entities/share/share.component.ts index d636295f..32c7caaa 100644 --- a/src/main/webapp/app/entities/share/share.component.ts +++ b/src/main/webapp/app/entities/share/share.component.ts @@ -9,6 +9,9 @@ import { AccountService } from 'app/core'; import { ITEMS_PER_PAGE } from 'app/shared'; import { ShareService } from './share.service'; +import { TableFilter, queryYearAsDateRange, queryEquals } from 'app/shared/util/tablefilter'; +import { IMembership } from 'app/shared/model/membership.model'; +import { MembershipService } from 'app/entities/membership'; @Component({ selector: 'jhi-share', @@ -24,9 +27,18 @@ export class ShareComponent implements OnInit, OnDestroy { predicate: any; reverse: any; totalItems: number; + memberships: IMembership[]; + filter: TableFilter<{ + documentDate?: string; + valueDate?: string; + action?: string; + quantity?: string; + membershipId?: string; + }>; constructor( protected shareService: ShareService, + protected membershipService: MembershipService, protected jhiAlertService: JhiAlertService, protected eventManager: JhiEventManager, protected parseLinks: JhiParseLinks, @@ -40,11 +52,25 @@ export class ShareComponent implements OnInit, OnDestroy { }; this.predicate = 'id'; this.reverse = true; + this.filter = new TableFilter( + { + documentDate: queryYearAsDateRange, + valueDate: queryYearAsDateRange, + action: queryEquals, + quantity: queryEquals, + membershipId: queryEquals + }, + 500, + () => { + this.loadAll(); + } + ); } loadAll() { this.shareService .query({ + ...this.filter.buildQueryCriteria(), page: this.page, size: this.itemsPerPage, sort: this.sort() @@ -71,6 +97,13 @@ export class ShareComponent implements OnInit, OnDestroy { this.accountService.identity().then(account => { this.currentAccount = account; }); + this.membershipService + .query() + .pipe( + filter((mayBeOk: HttpResponse) => mayBeOk.ok), + map((response: HttpResponse) => response.body) + ) + .subscribe((res: IMembership[]) => (this.memberships = res), (res: HttpErrorResponse) => this.onError(res.message)); this.registerChangeInShares(); } @@ -94,9 +127,15 @@ export class ShareComponent implements OnInit, OnDestroy { return result; } + trackMembershipById(index: number, item: IMembership) { + return item.id; + } + protected paginateShares(data: IShare[], headers: HttpHeaders) { this.links = this.parseLinks.parse(headers.get('link')); this.totalItems = parseInt(headers.get('X-Total-Count'), 10); + this.page = 0; + this.shares = []; for (let i = 0; i < data.length; i++) { this.shares.push(data[i]); } diff --git a/src/main/webapp/app/shared/util/tablefilter.ts b/src/main/webapp/app/shared/util/tablefilter.ts index f26dba4b..19157c9e 100644 --- a/src/main/webapp/app/shared/util/tablefilter.ts +++ b/src/main/webapp/app/shared/util/tablefilter.ts @@ -1,6 +1,14 @@ import { Subject, Subscription } from 'rxjs'; import { debounceTime, distinctUntilChanged } from 'rxjs/operators'; +export interface QueryDeclarations { + [key: string]: string; +} +export type DynamicQueryDefinition = (name: string, value: string) => QueryDefinitions; +export interface QueryDefinitions { + [key: string]: string | DynamicQueryDefinition; +} + /** * Handles filtering in data tables by converting the user input to query criteria of the JHipster REST API. * @@ -12,12 +20,12 @@ export class TableFilter { private criteriaChangedSubject = new Subject(); private criteriaChangedDebouncer: Subscription; - constructor(private query: T, private debounceMillis: number, private reload: () => void) { + constructor(private query: QueryDefinitions, private debounceMillis: number, private reload: () => void) { this.criteria = {} as any; this.criteriaChangedDebouncer = this.criteriaChangedSubject.pipe(debounceTime(debounceMillis)).subscribe(() => this.reload()); } - trigger() { + trigger($event) { this.debounce(); } @@ -26,10 +34,17 @@ export class TableFilter { this.debounce(); } - buildQueryCriteria() { - const queryCriteria: T = {} as any; - Object.keys(this.criteria).forEach(e => { - queryCriteria[e + '.' + this.query[e]] = this.criteria[e]; + buildQueryCriteria(): QueryDeclarations { + let queryCriteria: any = {} as any; + Object.keys(this.criteria).forEach(name => { + const value = this.criteria[name]; + const queryDef = this.query[name]; + if (typeof queryDef !== 'function') { + queryCriteria[queryDef] = value; + } else { + const additionalQueryCriteria = queryDef(name, value); + queryCriteria = { ...queryCriteria, ...additionalQueryCriteria }; + } }); return queryCriteria; } @@ -38,3 +53,21 @@ export class TableFilter { this.criteriaChangedSubject.next(); } } + +export function queryYearAsDateRange(name: string, value: string) { + if (value.length === 'YYYY'.length) { + const queryCriteria: any = {} as any; + queryCriteria[name + '.greaterOrEqualThan'] = value + '-01-01'; + queryCriteria[name + '.lessOrEqualThan'] = value + '-12-31'; + return queryCriteria; + } + return null; +} + +export function queryEquals(name: string, value: string) { + return { [name + '.equals']: value }; +} + +export function queryContains(name: string, value: string) { + return { [name + '.contains']: value }; +} diff --git a/src/test/javascript/spec/app/shared/util/tablefilter.spec.ts b/src/test/javascript/spec/app/shared/util/tablefilter.spec.ts index ee5e9f02..da7b08c2 100644 --- a/src/test/javascript/spec/app/shared/util/tablefilter.spec.ts +++ b/src/test/javascript/spec/app/shared/util/tablefilter.spec.ts @@ -1,4 +1,4 @@ -import { TableFilter } from 'app/shared/util/tablefilter'; +import { queryContains, queryEquals, queryYearAsDateRange, TableFilter } from 'app/shared/util/tablefilter'; /* To run these tests in IntelliJ IDEA, you need a run configuration with Configuration File: @@ -8,13 +8,23 @@ import { TableFilter } from 'app/shared/util/tablefilter'; */ describe('TableFilter Tests', () => { describe('TableFilter', () => { - let filter: TableFilter<{ name: string; number: string }>; + const TEST_DEBOUNCE_MILLIS = 100; + + let filter: TableFilter<{ name?: string; number?: string; date?: string }>; let asynchronously: () => void; beforeEach(() => { - filter = new TableFilter({ name: 'contains', number: 'equals' }, 100, () => { - asynchronously(); - }); + filter = new TableFilter( + { + name: queryContains, + number: queryEquals, + date: queryYearAsDateRange + }, + TEST_DEBOUNCE_MILLIS, + () => { + asynchronously(); + } + ); }); it('trigger() asynchronously calls the reload-handler', done => { @@ -22,7 +32,7 @@ describe('TableFilter Tests', () => { filter.criteria.name = 'Test Filter Value'; // when - filter.trigger(); + filter.trigger({ target: { valid: true } }); const triggerStartedAtMillis = Date.now(); // then @@ -37,10 +47,10 @@ describe('TableFilter Tests', () => { filter.criteria.name = 'Test Filter Value'; // when - filter.trigger(); + filter.trigger({ target: { valid: true } }); let triggerStartedAtMillis = null; setTimeout(() => { - filter.trigger(); + filter.trigger({ target: { valid: true } }); triggerStartedAtMillis = Date.now(); }, 50); @@ -52,7 +62,7 @@ describe('TableFilter Tests', () => { }; }); - it('when filter "name" is set to "test value", buildQueryCriteria() returns { "name.contains": "test value" }', () => { + it('when filter "name" is set, buildQueryCriteria() returns a name.contains query', () => { // given filter.criteria.name = 'test value'; @@ -63,17 +73,44 @@ describe('TableFilter Tests', () => { expect(filter.buildQueryCriteria()).toEqual({ 'name.contains': 'test value' }); }); + it('when filter "number" is set, buildQueryCriteria() returns a number.equals query', () => { + // given + filter.criteria.number = '-42'; + + // when + const actual = filter.buildQueryCriteria(); + + // then + expect(filter.buildQueryCriteria()).toEqual({ 'number.equals': '-42' }); + }); + + it('when filter "date" is set to "2019", buildQueryCriteria() returns a date range query', () => { + // given + filter.criteria.date = '2019'; + + // when + const actual = filter.buildQueryCriteria(); + + // then + expect(filter.buildQueryCriteria()).toEqual({ 'date.greaterOrEqualThan': '2019-01-01', 'date.lessOrEqualThan': '2019-12-31' }); + }); + + it('queryYearAsDateRange() returns null if year is not 4-digit', () => { + expect(queryYearAsDateRange('date', '201')).toBeNull(); + expect(queryYearAsDateRange('date', '20191')).toBeNull(); + }); + it('reset() clears criteria and calls reload-handler, considering debounce period', done => { // given filter.criteria.name = 'Test Filter Value'; // when - filter.trigger(); + filter.trigger({ target: { valid: true } }); let triggerStartedAtMillis = null; setTimeout(() => { filter.reset(); triggerStartedAtMillis = Date.now(); - }, 50); + }, TEST_DEBOUNCE_MILLIS / 2); // then asynchronously = () => { From 1bb712276c47a279930129cf2a32045fc888b925 Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Tue, 9 Apr 2019 11:33:34 +0200 Subject: [PATCH 09/31] properly display line-breaks in customer address fields + STRINGDECODE \n --- .../entities/customer/customer-detail.component.html | 4 ++-- .../entities/customer/customer-update.component.html | 11 ++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/main/webapp/app/entities/customer/customer-detail.component.html b/src/main/webapp/app/entities/customer/customer-detail.component.html index 3a74ce9e..c8b4fb84 100644 --- a/src/main/webapp/app/entities/customer/customer-detail.component.html +++ b/src/main/webapp/app/entities/customer/customer-detail.component.html @@ -51,7 +51,7 @@
Contractual Address
- {{customer.contractualAddress}} +
Billing Salutation
@@ -59,7 +59,7 @@
Billing Address
- {{customer.billingAddress}} +
Remark
diff --git a/src/main/webapp/app/entities/customer/customer-update.component.html b/src/main/webapp/app/entities/customer/customer-update.component.html index 0a498111..0a234117 100644 --- a/src/main/webapp/app/entities/customer/customer-update.component.html +++ b/src/main/webapp/app/entities/customer/customer-update.component.html @@ -159,9 +159,10 @@
- - + +
@@ -186,8 +187,8 @@
- +
From 5415806621b6692618ea3af96596b2d7ed484d46 Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Thu, 2 May 2019 23:36:08 +0200 Subject: [PATCH 10/31] use STRINGDECODE \n in UPDATE-Statements for linebreaks in sample-data --- src/main/resources/config/liquibase/sample-data/assets.xml | 2 +- src/main/resources/config/liquibase/sample-data/customers.xml | 2 +- src/main/resources/config/liquibase/sample-data/memberships.xml | 2 +- src/main/resources/config/liquibase/sample-data/shares.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/resources/config/liquibase/sample-data/assets.xml b/src/main/resources/config/liquibase/sample-data/assets.xml index 101764e8..10d5828f 100644 --- a/src/main/resources/config/liquibase/sample-data/assets.xml +++ b/src/main/resources/config/liquibase/sample-data/assets.xml @@ -20,7 +20,7 @@ - UPDATE asset SET remark = replace(remark, '|', '\n') + UPDATE asset SET remark = replace(remark, '|', STRINGDECODE('\n')) diff --git a/src/main/resources/config/liquibase/sample-data/customers.xml b/src/main/resources/config/liquibase/sample-data/customers.xml index 5823ef58..eb145b0d 100644 --- a/src/main/resources/config/liquibase/sample-data/customers.xml +++ b/src/main/resources/config/liquibase/sample-data/customers.xml @@ -20,7 +20,7 @@ - UPDATE customer SET contractual_address = replace(contractual_address, '|', '\n') + UPDATE customer SET contractual_address = replace(contractual_address, '|', STRINGDECODE('\n')) diff --git a/src/main/resources/config/liquibase/sample-data/memberships.xml b/src/main/resources/config/liquibase/sample-data/memberships.xml index 89a4d6f0..97498a8f 100644 --- a/src/main/resources/config/liquibase/sample-data/memberships.xml +++ b/src/main/resources/config/liquibase/sample-data/memberships.xml @@ -20,7 +20,7 @@ - UPDATE membership SET remark = replace(remark, '|', '\n') + UPDATE membership SET remark = replace(remark, '|', STRINGDECODE('\n')) diff --git a/src/main/resources/config/liquibase/sample-data/shares.xml b/src/main/resources/config/liquibase/sample-data/shares.xml index 307a9fe7..f8fa136f 100644 --- a/src/main/resources/config/liquibase/sample-data/shares.xml +++ b/src/main/resources/config/liquibase/sample-data/shares.xml @@ -20,7 +20,7 @@ - UPDATE share SET remark = replace(remark, '|', '\n') + UPDATE share SET remark = replace(remark, '|', STRINGDECODE('\n')) From 30b4d1f95cfabc0af589cc02d9a49d0641b094b7 Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Thu, 2 May 2019 23:39:50 +0200 Subject: [PATCH 11/31] #126 [intUI/Date-Format] Membership --- .../entities/membership/membership-detail.component.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/webapp/app/entities/membership/membership-detail.component.html b/src/main/webapp/app/entities/membership/membership-detail.component.html index 77601e66..47768033 100644 --- a/src/main/webapp/app/entities/membership/membership-detail.component.html +++ b/src/main/webapp/app/entities/membership/membership-detail.component.html @@ -7,19 +7,19 @@
Admission Document Date
- {{membership.admissionDocumentDate}} + {{membership.admissionDocumentDate | date:'mediumDate'}}
Cancellation Document Date
- {{membership.cancellationDocumentDate}} + {{membership.cancellationDocumentDate | date:'mediumDate'}}
Member From Date
- {{membership.memberFromDate}} + {{membership.memberFromDate | date:'mediumDate'}}
Member Until Date
- {{membership.memberUntilDate}} + {{membership.memberUntilDate | date:'mediumDate'}}
Remark
From d758e3a979ca8dbbde04aac23b7b87f371fa60ec Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Thu, 2 May 2019 23:45:07 +0200 Subject: [PATCH 12/31] #127/#128 [intUI/Date-Format] Asset+Share --- .../webapp/app/entities/asset/asset-detail.component.html | 4 ++-- .../webapp/app/entities/share/share-detail.component.html | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/webapp/app/entities/asset/asset-detail.component.html b/src/main/webapp/app/entities/asset/asset-detail.component.html index d092b737..0011c633 100644 --- a/src/main/webapp/app/entities/asset/asset-detail.component.html +++ b/src/main/webapp/app/entities/asset/asset-detail.component.html @@ -7,11 +7,11 @@
Document Date
- {{asset.documentDate}} + {{asset.documentDate | date:'mediumDate'}}
Value Date
- {{asset.valueDate}} + {{asset.valueDate | date:'mediumDate'}}
Action
diff --git a/src/main/webapp/app/entities/share/share-detail.component.html b/src/main/webapp/app/entities/share/share-detail.component.html index bb1dfd9f..cbf8899b 100644 --- a/src/main/webapp/app/entities/share/share-detail.component.html +++ b/src/main/webapp/app/entities/share/share-detail.component.html @@ -7,11 +7,11 @@
Document Date
- {{share.documentDate}} + {{share.documentDate | date:'mediumDate'}}
Value Date
- {{share.valueDate}} + {{share.valueDate | date:'mediumDate'}}
Action
From 64a91c82ae4b348d843e3757dcd4710506dd10da Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Fri, 3 May 2019 00:01:40 +0200 Subject: [PATCH 13/31] makes the actual data easier to read in details views --- src/main/webapp/content/css/global.css | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/webapp/content/css/global.css b/src/main/webapp/content/css/global.css index f00b0323..9c162c66 100644 --- a/src/main/webapp/content/css/global.css +++ b/src/main/webapp/content/css/global.css @@ -225,3 +225,14 @@ ui bootstrap tweaks } /* jhipster-needle-css-add-main JHipster will add new css style */ + +/* ========================================================================== +ui tweaks by Hostsharing +========================================================================== */ +.jh-entity-details > dt { + color: lightslategray; +} + +.jh-entity-details > dd { + font-size: 140%; +} From 8c367ab5666b39f357b82ca5c19f3fc12a9b9b90 Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Fri, 3 May 2019 00:03:51 +0200 Subject: [PATCH 14/31] #129 [intUI/Date-Format] SepaMandate --- .../sepa-mandate/sepa-mandate-detail.component.html | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/webapp/app/entities/sepa-mandate/sepa-mandate-detail.component.html b/src/main/webapp/app/entities/sepa-mandate/sepa-mandate-detail.component.html index 31330485..6c10041c 100644 --- a/src/main/webapp/app/entities/sepa-mandate/sepa-mandate-detail.component.html +++ b/src/main/webapp/app/entities/sepa-mandate/sepa-mandate-detail.component.html @@ -19,24 +19,23 @@
Granting Document Date
- {{sepaMandate.grantingDocumentDate}} + {{sepaMandate.grantingDocumentDate | date:'mediumDate'}}
Revokation Document Date
- {{sepaMandate.revokationDocumentDate}} + {{sepaMandate.revokationDocumentDate | date:'mediumDate'}}
Valid From Date
- {{sepaMandate.validFromDate}} + {{sepaMandate.validFromDate | date:'mediumDate'}}
Valid Until Date
- {{sepaMandate.validUntilDate}} + {{sepaMandate.validUntilDate | date:'mediumDate'}}
Last Used Date
- {{sepaMandate.lastUsedDate}} -
+ {{sepaMandate.lastUsedDate | date:'mediumDate'}}
Remark
From 0b3f4d4a03708ca599c6b705ece83a7986668217 Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Fri, 3 May 2019 00:12:41 +0200 Subject: [PATCH 15/31] textarea input and multiline output for Customer.remark (was missing) --- .../app/entities/customer/customer-detail.component.html | 2 +- .../app/entities/customer/customer-update.component.html | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/webapp/app/entities/customer/customer-detail.component.html b/src/main/webapp/app/entities/customer/customer-detail.component.html index c8b4fb84..5e479fbb 100644 --- a/src/main/webapp/app/entities/customer/customer-detail.component.html +++ b/src/main/webapp/app/entities/customer/customer-detail.component.html @@ -63,7 +63,7 @@
Remark
- {{customer.remark}} +
diff --git a/src/main/webapp/app/entities/customer/customer-update.component.html b/src/main/webapp/app/entities/customer/customer-update.component.html index 0a234117..c59b92ac 100644 --- a/src/main/webapp/app/entities/customer/customer-update.component.html +++ b/src/main/webapp/app/entities/customer/customer-update.component.html @@ -198,8 +198,8 @@
- +
From 68169307931c68dd02121a45ce0c6198dc53377e Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Fri, 3 May 2019 00:17:43 +0200 Subject: [PATCH 16/31] #118 [intUI/textareas] multiline Remark in SepaMandate --- .../entities/sepa-mandate/sepa-mandate-detail.component.html | 2 +- .../entities/sepa-mandate/sepa-mandate-update.component.html | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/webapp/app/entities/sepa-mandate/sepa-mandate-detail.component.html b/src/main/webapp/app/entities/sepa-mandate/sepa-mandate-detail.component.html index 6c10041c..b12e9d33 100644 --- a/src/main/webapp/app/entities/sepa-mandate/sepa-mandate-detail.component.html +++ b/src/main/webapp/app/entities/sepa-mandate/sepa-mandate-detail.component.html @@ -39,7 +39,7 @@
Remark
- {{sepaMandate.remark}} +
Customer
diff --git a/src/main/webapp/app/entities/sepa-mandate/sepa-mandate-update.component.html b/src/main/webapp/app/entities/sepa-mandate/sepa-mandate-update.component.html index 10a4d11e..50826fd8 100644 --- a/src/main/webapp/app/entities/sepa-mandate/sepa-mandate-update.component.html +++ b/src/main/webapp/app/entities/sepa-mandate/sepa-mandate-update.component.html @@ -110,8 +110,8 @@
- +
From da60a3020f6a0846e40cea1c540fa142257f5ec7 Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Fri, 3 May 2019 00:22:00 +0200 Subject: [PATCH 17/31] remove Remark from table view of SepaMandate --- .../app/entities/sepa-mandate/sepa-mandate.component.html | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/webapp/app/entities/sepa-mandate/sepa-mandate.component.html b/src/main/webapp/app/entities/sepa-mandate/sepa-mandate.component.html index a6c693d3..cfa2c8b6 100644 --- a/src/main/webapp/app/entities/sepa-mandate/sepa-mandate.component.html +++ b/src/main/webapp/app/entities/sepa-mandate/sepa-mandate.component.html @@ -23,7 +23,6 @@
Valid From Date Valid Until Date Last Used Date Remark Customer
{{sepaMandate.validFromDate | date:'mediumDate'}} {{sepaMandate.validUntilDate | date:'mediumDate'}} {{sepaMandate.lastUsedDate | date:'mediumDate'}}{{sepaMandate.remark}}
{{sepaMandate.customerDisplayLabel}} From 5f536ad0430f1cdbdd7968f37a44c4e457bf57d5 Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Fri, 3 May 2019 00:32:58 +0200 Subject: [PATCH 18/31] #115/#116/#117 [intUI/textareas] Remark in Membership/Asset/Share --- .../webapp/app/entities/asset/asset-detail.component.html | 2 +- .../webapp/app/entities/asset/asset-update.component.html | 4 ++-- .../app/entities/membership/membership-detail.component.html | 2 +- .../app/entities/membership/membership-update.component.html | 4 ++-- .../webapp/app/entities/share/share-detail.component.html | 2 +- .../webapp/app/entities/share/share-update.component.html | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/webapp/app/entities/asset/asset-detail.component.html b/src/main/webapp/app/entities/asset/asset-detail.component.html index 0011c633..f3dd73ed 100644 --- a/src/main/webapp/app/entities/asset/asset-detail.component.html +++ b/src/main/webapp/app/entities/asset/asset-detail.component.html @@ -23,7 +23,7 @@
Remark
- {{asset.remark}} +
Membership
diff --git a/src/main/webapp/app/entities/asset/asset-update.component.html b/src/main/webapp/app/entities/asset/asset-update.component.html index 951db0b4..d9d36906 100644 --- a/src/main/webapp/app/entities/asset/asset-update.component.html +++ b/src/main/webapp/app/entities/asset/asset-update.component.html @@ -75,8 +75,8 @@
- +
diff --git a/src/main/webapp/app/entities/membership/membership-detail.component.html b/src/main/webapp/app/entities/membership/membership-detail.component.html index 47768033..dae64d50 100644 --- a/src/main/webapp/app/entities/membership/membership-detail.component.html +++ b/src/main/webapp/app/entities/membership/membership-detail.component.html @@ -23,7 +23,7 @@
Remark
- {{membership.remark}} +
Customer
diff --git a/src/main/webapp/app/entities/membership/membership-update.component.html b/src/main/webapp/app/entities/membership/membership-update.component.html index 8a04c9e2..758ce53a 100644 --- a/src/main/webapp/app/entities/membership/membership-update.component.html +++ b/src/main/webapp/app/entities/membership/membership-update.component.html @@ -63,8 +63,8 @@
- +
diff --git a/src/main/webapp/app/entities/share/share-detail.component.html b/src/main/webapp/app/entities/share/share-detail.component.html index cbf8899b..5dd34103 100644 --- a/src/main/webapp/app/entities/share/share-detail.component.html +++ b/src/main/webapp/app/entities/share/share-detail.component.html @@ -23,7 +23,7 @@
Remark
- {{share.remark}} +
Membership
diff --git a/src/main/webapp/app/entities/share/share-update.component.html b/src/main/webapp/app/entities/share/share-update.component.html index faf87e8a..78a04f63 100644 --- a/src/main/webapp/app/entities/share/share-update.component.html +++ b/src/main/webapp/app/entities/share/share-update.component.html @@ -71,8 +71,8 @@
- +
From 447fbb773d5539bc6fa77c4caa316aac3f599e0d Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Fri, 3 May 2019 09:28:24 +0200 Subject: [PATCH 19/31] #122 [intUI/Filter] for Asset and alignment with implementation in Share --- .../app/entities/asset/asset.component.html | 40 ++++++++++++++++--- .../app/entities/asset/asset.component.ts | 37 ++++++++++++++++- .../app/entities/share/share.component.html | 6 ++- .../app/entities/share/share.component.ts | 8 +--- 4 files changed, 77 insertions(+), 14 deletions(-) diff --git a/src/main/webapp/app/entities/asset/asset.component.html b/src/main/webapp/app/entities/asset/asset.component.html index 8472107d..057db7d6 100644 --- a/src/main/webapp/app/entities/asset/asset.component.html +++ b/src/main/webapp/app/entities/asset/asset.component.html @@ -14,14 +14,42 @@ - - - - - - + + + + + + + + + + + + + + + + + + + diff --git a/src/main/webapp/app/entities/asset/asset.component.ts b/src/main/webapp/app/entities/asset/asset.component.ts index 4a5c8445..93adb998 100644 --- a/src/main/webapp/app/entities/asset/asset.component.ts +++ b/src/main/webapp/app/entities/asset/asset.component.ts @@ -9,6 +9,9 @@ import { AccountService } from 'app/core'; import { ITEMS_PER_PAGE } from 'app/shared'; import { AssetService } from './asset.service'; +import { IMembership } from 'app/shared/model/membership.model'; +import { MembershipService } from 'app/entities/membership'; +import { queryEquals, queryYearAsDateRange, TableFilter } from 'app/shared/util/tablefilter'; @Component({ selector: 'jhi-asset', @@ -24,9 +27,18 @@ export class AssetComponent implements OnInit, OnDestroy { predicate: any; reverse: any; totalItems: number; + memberships: IMembership[]; + filter: TableFilter<{ + documentDate?: string; + valueDate?: string; + action?: string; + amount?: string; + membershipId?: string; + }>; constructor( protected assetService: AssetService, + protected membershipService: MembershipService, protected jhiAlertService: JhiAlertService, protected eventManager: JhiEventManager, protected parseLinks: JhiParseLinks, @@ -40,11 +52,25 @@ export class AssetComponent implements OnInit, OnDestroy { }; this.predicate = 'id'; this.reverse = true; + this.filter = new TableFilter( + { + documentDate: queryYearAsDateRange, + valueDate: queryYearAsDateRange, + action: queryEquals, + amount: queryEquals, + membershipId: queryEquals + }, + 500, + () => { + this.loadAll(); + } + ); } loadAll() { this.assetService .query({ + ...this.filter.buildQueryCriteria(), page: this.page, size: this.itemsPerPage, sort: this.sort() @@ -71,6 +97,13 @@ export class AssetComponent implements OnInit, OnDestroy { this.accountService.identity().then(account => { this.currentAccount = account; }); + this.membershipService + .query() + .pipe( + filter((mayBeOk: HttpResponse) => mayBeOk.ok), + map((response: HttpResponse) => response.body) + ) + .subscribe((res: IMembership[]) => (this.memberships = res), (res: HttpErrorResponse) => this.onError(res.message)); this.registerChangeInAssets(); } @@ -78,7 +111,7 @@ export class AssetComponent implements OnInit, OnDestroy { this.eventManager.destroy(this.eventSubscriber); } - trackId(index: number, item: IAsset) { + trackId(index: number, item: { id: number }) { return item.id; } @@ -97,6 +130,8 @@ export class AssetComponent implements OnInit, OnDestroy { protected paginateAssets(data: IAsset[], headers: HttpHeaders) { this.links = this.parseLinks.parse(headers.get('link')); this.totalItems = parseInt(headers.get('X-Total-Count'), 10); + this.page = 0; + this.assets = []; for (let i = 0; i < data.length; i++) { this.assets.push(data[i]); } diff --git a/src/main/webapp/app/entities/share/share.component.html b/src/main/webapp/app/entities/share/share.component.html index 32883f8c..d9f33549 100644 --- a/src/main/webapp/app/entities/share/share.component.html +++ b/src/main/webapp/app/entities/share/share.component.html @@ -22,6 +22,8 @@ + + @@ -37,11 +39,13 @@ + + diff --git a/src/main/webapp/app/entities/share/share.component.ts b/src/main/webapp/app/entities/share/share.component.ts index 32c7caaa..0cc45003 100644 --- a/src/main/webapp/app/entities/share/share.component.ts +++ b/src/main/webapp/app/entities/share/share.component.ts @@ -9,9 +9,9 @@ import { AccountService } from 'app/core'; import { ITEMS_PER_PAGE } from 'app/shared'; import { ShareService } from './share.service'; -import { TableFilter, queryYearAsDateRange, queryEquals } from 'app/shared/util/tablefilter'; import { IMembership } from 'app/shared/model/membership.model'; import { MembershipService } from 'app/entities/membership'; +import { TableFilter, queryYearAsDateRange, queryEquals } from 'app/shared/util/tablefilter'; @Component({ selector: 'jhi-share', @@ -111,7 +111,7 @@ export class ShareComponent implements OnInit, OnDestroy { this.eventManager.destroy(this.eventSubscriber); } - trackId(index: number, item: IShare) { + trackId(index: number, item: { id: number }) { return item.id; } @@ -127,10 +127,6 @@ export class ShareComponent implements OnInit, OnDestroy { return result; } - trackMembershipById(index: number, item: IMembership) { - return item.id; - } - protected paginateShares(data: IShare[], headers: HttpHeaders) { this.links = this.parseLinks.parse(headers.get('link')); this.totalItems = parseInt(headers.get('X-Total-Count'), 10); From 1a8fb9276effb5c921dbd6e96332cd1a3d51baed Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Fri, 3 May 2019 12:20:54 +0200 Subject: [PATCH 20/31] #120 [intUI/Filter] for Membership --- .../membership/membership.component.html | 30 ++++++++++++--- .../membership/membership.component.ts | 37 ++++++++++++++++++- 2 files changed, 60 insertions(+), 7 deletions(-) diff --git a/src/main/webapp/app/entities/membership/membership.component.html b/src/main/webapp/app/entities/membership/membership.component.html index d71850b3..d8141a08 100644 --- a/src/main/webapp/app/entities/membership/membership.component.html +++ b/src/main/webapp/app/entities/membership/membership.component.html @@ -14,14 +14,32 @@
ID Document Date Value Date Action Amount Membership ID Document Date Value Date Action Amount Membership
+ + + +
Membership
- - - - - - + + + + + + + + + + + + + + + + + + + diff --git a/src/main/webapp/app/entities/membership/membership.component.ts b/src/main/webapp/app/entities/membership/membership.component.ts index 387df20d..6f015b30 100644 --- a/src/main/webapp/app/entities/membership/membership.component.ts +++ b/src/main/webapp/app/entities/membership/membership.component.ts @@ -9,6 +9,9 @@ import { AccountService } from 'app/core'; import { ITEMS_PER_PAGE } from 'app/shared'; import { MembershipService } from './membership.service'; +import { ICustomer } from 'app/shared/model/customer.model'; +import { CustomerService } from 'app/entities/customer'; +import { TableFilter, queryYearAsDateRange, queryEquals } from 'app/shared/util/tablefilter'; @Component({ selector: 'jhi-membership', @@ -24,9 +27,18 @@ export class MembershipComponent implements OnInit, OnDestroy { predicate: any; reverse: any; totalItems: number; + customers: ICustomer[]; + filter: TableFilter<{ + admissionDocumentDate?: string; + cancellationDocumentDate?: string; + memberFromDate?: string; + memberUntilDate?: string; + customerId?: string; + }>; constructor( protected membershipService: MembershipService, + protected customerService: CustomerService, protected jhiAlertService: JhiAlertService, protected eventManager: JhiEventManager, protected parseLinks: JhiParseLinks, @@ -40,11 +52,25 @@ export class MembershipComponent implements OnInit, OnDestroy { }; this.predicate = 'id'; this.reverse = true; + this.filter = new TableFilter( + { + admissionDocumentDate: queryYearAsDateRange, + cancellationDocumentDate: queryYearAsDateRange, + memberFromDate: queryYearAsDateRange, + memberUntilDate: queryYearAsDateRange, + customerId: queryEquals + }, + 500, + () => { + this.loadAll(); + } + ); } loadAll() { this.membershipService .query({ + ...this.filter.buildQueryCriteria(), page: this.page, size: this.itemsPerPage, sort: this.sort() @@ -72,13 +98,20 @@ export class MembershipComponent implements OnInit, OnDestroy { this.currentAccount = account; }); this.registerChangeInMemberships(); + this.customerService + .query() + .pipe( + filter((mayBeOk: HttpResponse) => mayBeOk.ok), + map((response: HttpResponse) => response.body) + ) + .subscribe((res: IMembership[]) => (this.customers = res), (res: HttpErrorResponse) => this.onError(res.message)); } ngOnDestroy() { this.eventManager.destroy(this.eventSubscriber); } - trackId(index: number, item: IMembership) { + trackId(index: number, item: { id: number }) { return item.id; } @@ -97,6 +130,8 @@ export class MembershipComponent implements OnInit, OnDestroy { protected paginateMemberships(data: IMembership[], headers: HttpHeaders) { this.links = this.parseLinks.parse(headers.get('link')); this.totalItems = parseInt(headers.get('X-Total-Count'), 10); + this.page = 0; + this.memberships = []; for (let i = 0; i < data.length; i++) { this.memberships.push(data[i]); } From ab8850514405d2e0eec6eaca0e3658c7162d4720 Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Fri, 3 May 2019 12:22:10 +0200 Subject: [PATCH 21/31] #135 [intUI/Filter] filtering non-/empty values possible with '--'/'++' --- .../webapp/app/shared/util/tablefilter.ts | 16 +++++++++----- .../spec/app/shared/util/tablefilter.spec.ts | 22 +++++++++++++++++++ 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/src/main/webapp/app/shared/util/tablefilter.ts b/src/main/webapp/app/shared/util/tablefilter.ts index 19157c9e..f6ac701f 100644 --- a/src/main/webapp/app/shared/util/tablefilter.ts +++ b/src/main/webapp/app/shared/util/tablefilter.ts @@ -38,12 +38,18 @@ export class TableFilter { let queryCriteria: any = {} as any; Object.keys(this.criteria).forEach(name => { const value = this.criteria[name]; - const queryDef = this.query[name]; - if (typeof queryDef !== 'function') { - queryCriteria[queryDef] = value; + if (value === '--') { + queryCriteria[name + '.specified'] = false; + } else if (value === '++') { + queryCriteria[name + '.specified'] = true; } else { - const additionalQueryCriteria = queryDef(name, value); - queryCriteria = { ...queryCriteria, ...additionalQueryCriteria }; + const queryDef = this.query[name]; + if (typeof queryDef !== 'function') { + queryCriteria[queryDef] = value; + } else { + const additionalQueryCriteria = queryDef(name, value); + queryCriteria = { ...queryCriteria, ...additionalQueryCriteria }; + } } }); return queryCriteria; diff --git a/src/test/javascript/spec/app/shared/util/tablefilter.spec.ts b/src/test/javascript/spec/app/shared/util/tablefilter.spec.ts index da7b08c2..8f523776 100644 --- a/src/test/javascript/spec/app/shared/util/tablefilter.spec.ts +++ b/src/test/javascript/spec/app/shared/util/tablefilter.spec.ts @@ -73,6 +73,28 @@ describe('TableFilter Tests', () => { expect(filter.buildQueryCriteria()).toEqual({ 'name.contains': 'test value' }); }); + it('when filter "name" is set to "--", buildQueryCriteria() returns a name.specified=false query', () => { + // given + filter.criteria.name = '--'; + + // when + const actual = filter.buildQueryCriteria(); + + // then + expect(filter.buildQueryCriteria()).toEqual({ 'name.specified': false }); + }); + + it('when filter "name" is set to "++", buildQueryCriteria() returns a name.specified=true query', () => { + // given + filter.criteria.name = '++'; + + // when + const actual = filter.buildQueryCriteria(); + + // then + expect(filter.buildQueryCriteria()).toEqual({ 'name.specified': true }); + }); + it('when filter "number" is set, buildQueryCriteria() returns a number.equals query', () => { // given filter.criteria.number = '-42'; From 0a9f2584f110d19e07a598c97bd913a2bafb3065 Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Fri, 3 May 2019 14:41:41 +0200 Subject: [PATCH 23/31] #124 [intUI/Filter] for UserRoleAssignment --- .../user-role-assignment.component.html | 40 ++++++++++++++++--- .../user-role-assignment.component.ts | 34 +++++++++++++++- 2 files changed, 67 insertions(+), 7 deletions(-) diff --git a/src/main/webapp/app/entities/user-role-assignment/user-role-assignment.component.html b/src/main/webapp/app/entities/user-role-assignment/user-role-assignment.component.html index 345fa10d..a08c8a10 100644 --- a/src/main/webapp/app/entities/user-role-assignment/user-role-assignment.component.html +++ b/src/main/webapp/app/entities/user-role-assignment/user-role-assignment.component.html @@ -14,13 +14,41 @@
ID Admission Document Date Cancellation Document Date Member From Date Member Until Date Customer ID Admission Document Date Cancellation Document Date Member From Date Member Until Date Customer
+ +
- - - - - - + + + + + + + + + + + + + + + + + + diff --git a/src/main/webapp/app/entities/user-role-assignment/user-role-assignment.component.ts b/src/main/webapp/app/entities/user-role-assignment/user-role-assignment.component.ts index 822109d8..9aedd523 100644 --- a/src/main/webapp/app/entities/user-role-assignment/user-role-assignment.component.ts +++ b/src/main/webapp/app/entities/user-role-assignment/user-role-assignment.component.ts @@ -9,6 +9,9 @@ import { AccountService } from 'app/core'; import { ITEMS_PER_PAGE } from 'app/shared'; import { UserRoleAssignmentService } from './user-role-assignment.service'; +import { IUser } from 'app/core/user/user.model'; +import { UserService } from 'app/core/user/user.service'; +import { TableFilter, queryEquals, queryContains } from 'app/shared/util/tablefilter'; @Component({ selector: 'jhi-user-role-assignment', @@ -24,9 +27,17 @@ export class UserRoleAssignmentComponent implements OnInit, OnDestroy { predicate: any; reverse: any; totalItems: number; + users: IUser[]; + filter: TableFilter<{ + entityTypeId?: string; + entityObjectId?: string; + assignedRole?: string; + userId?: string; + }>; constructor( protected userRoleAssignmentService: UserRoleAssignmentService, + protected userService: UserService, protected jhiAlertService: JhiAlertService, protected eventManager: JhiEventManager, protected parseLinks: JhiParseLinks, @@ -40,11 +51,24 @@ export class UserRoleAssignmentComponent implements OnInit, OnDestroy { }; this.predicate = 'id'; this.reverse = true; + this.filter = new TableFilter( + { + entityTypeId: queryContains, + entityObjectId: queryEquals, + assignedRole: queryEquals, + userId: queryEquals + }, + 500, + () => { + this.loadAll(); + } + ); } loadAll() { this.userRoleAssignmentService .query({ + ...this.filter.buildQueryCriteria(), page: this.page, size: this.itemsPerPage, sort: this.sort() @@ -71,6 +95,13 @@ export class UserRoleAssignmentComponent implements OnInit, OnDestroy { this.accountService.identity().then(account => { this.currentAccount = account; }); + this.userService + .query() + .pipe( + filter((mayBeOk: HttpResponse) => mayBeOk.ok), + map((response: HttpResponse) => response.body) + ) + .subscribe((res: IUser[]) => (this.users = res), (res: HttpErrorResponse) => this.onError(res.message)); this.registerChangeInUserRoleAssignments(); } @@ -78,7 +109,7 @@ export class UserRoleAssignmentComponent implements OnInit, OnDestroy { this.eventManager.destroy(this.eventSubscriber); } - trackId(index: number, item: IUserRoleAssignment) { + trackId(index: number, item: { id: number }) { return item.id; } @@ -97,6 +128,7 @@ export class UserRoleAssignmentComponent implements OnInit, OnDestroy { protected paginateUserRoleAssignments(data: IUserRoleAssignment[], headers: HttpHeaders) { this.links = this.parseLinks.parse(headers.get('link')); this.totalItems = parseInt(headers.get('X-Total-Count'), 10); + this.userRoleAssignments = []; for (let i = 0; i < data.length; i++) { this.userRoleAssignments.push(data[i]); } From 20b9d2f1059688c663a0f1987f7906ccb9aec9d1 Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Fri, 3 May 2019 20:21:07 +0200 Subject: [PATCH 24/31] #131 sample-data for sepamandate --- .../resources/config/liquibase/master.xml | 1 + .../liquibase/sample-data/sepamandates.csv | 6 ++++ .../liquibase/sample-data/sepamandates.xml | 31 +++++++++++++++++++ 3 files changed, 38 insertions(+) create mode 100644 src/main/resources/config/liquibase/sample-data/sepamandates.csv create mode 100644 src/main/resources/config/liquibase/sample-data/sepamandates.xml diff --git a/src/main/resources/config/liquibase/master.xml b/src/main/resources/config/liquibase/master.xml index e4d99de6..36848208 100644 --- a/src/main/resources/config/liquibase/master.xml +++ b/src/main/resources/config/liquibase/master.xml @@ -24,5 +24,6 @@ + diff --git a/src/main/resources/config/liquibase/sample-data/sepamandates.csv b/src/main/resources/config/liquibase/sample-data/sepamandates.csv new file mode 100644 index 00000000..2698cc95 --- /dev/null +++ b/src/main/resources/config/liquibase/sample-data/sepamandates.csv @@ -0,0 +1,6 @@ +id;customer_id;reference;iban;bic;granting_document_date;revokation_document_date;valid_from_date;valid_until_date;last_used_date;remark +1;1;DKXIDEHAC01;DE94500105172859877827;REF02039402;2018-01-15;null;2018-01-16;null;2019-04-09;a remark|over two lines +2;2;JKUIDEBIS00;DE56500105172321139153;REF2834823W;2017-06-03;2019-01-15;2017-06-04;2019-01-31;2019-01-10;for the old bank account +3;2;JUZTDEVER03;DE56500105172321139153;REF2834823W;2019-01-15;null;2019-02-01;null;2019-04-09;for the new bank account +4;3;CKIZDESiX98;DE24500105175933769123;REF23984928;2016-09-13;2018-11-20;2016-09-13;2018-12-31;2018-12-09;membership cancelled +5;5;ZUIJDEVOR12;DE92500105174781793571;REF23882384;2016-12-03;null;2016-12-03;null;2019-04-09;null diff --git a/src/main/resources/config/liquibase/sample-data/sepamandates.xml b/src/main/resources/config/liquibase/sample-data/sepamandates.xml new file mode 100644 index 00000000..1e75c9ea --- /dev/null +++ b/src/main/resources/config/liquibase/sample-data/sepamandates.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + UPDATE sepa_mandate SET remark = replace(remark, '|', STRINGDECODE('\n')) + + + + DELETE FROM sepa_mandate; + + + + From b7aac92807b466f63f13085325327ddb2339b5d1 Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Fri, 3 May 2019 20:22:17 +0200 Subject: [PATCH 25/31] match membership sample-date with sepa-mandate sample-data --- src/main/resources/config/liquibase/sample-data/memberships.csv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/config/liquibase/sample-data/memberships.csv b/src/main/resources/config/liquibase/sample-data/memberships.csv index a5d16311..14e43200 100644 --- a/src/main/resources/config/liquibase/sample-data/memberships.csv +++ b/src/main/resources/config/liquibase/sample-data/memberships.csv @@ -1,7 +1,7 @@ id;customer_id;admission_document_date;cancellation_document_date;member_from_date;member_until_date;remark 1;1;2001-04-10;2007-08-09;2001-04-11;2007-12-31;is now client of another member|see XYZ 2;1;2017-01-15;null;2017-01-15;null;nothing to say here -3;3;2003-05-11;2019-11-30;2003-05-15;2019-12-31;business discontinued +3;3;2003-05-11;2018-11-30;2003-05-15;2018-12-31;business discontinued 4;4;2017-05-15;null;2017-05-15;null;whatever|is|to|say 5;5;2011-08-18;null;2011-08-18;null;foo bar etc. From cd94cb118da011eefc368570afd35d7431d73dd0 Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Fri, 3 May 2019 21:02:17 +0200 Subject: [PATCH 26/31] add placeholder="YYYY|--|++" to date filter inputs --- .../app/entities/asset/asset.component.html | 4 +- .../membership/membership.component.html | 8 ++-- .../sepa-mandate/sepa-mandate.component.html | 44 +++++++++++++----- .../sepa-mandate/sepa-mandate.component.ts | 46 ++++++++++++++++++- .../app/entities/share/share.component.html | 4 +- 5 files changed, 86 insertions(+), 20 deletions(-) diff --git a/src/main/webapp/app/entities/asset/asset.component.html b/src/main/webapp/app/entities/asset/asset.component.html index 057db7d6..cd5499d9 100644 --- a/src/main/webapp/app/entities/asset/asset.component.html +++ b/src/main/webapp/app/entities/asset/asset.component.html @@ -26,8 +26,8 @@ - - + + - - - - + + + +
ID Entity Type Id Entity Object Id Assigned Role User ID Entity Type Id Entity Object Id Assigned Role User
+ + + +
- - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/webapp/app/entities/sepa-mandate/sepa-mandate.component.ts b/src/main/webapp/app/entities/sepa-mandate/sepa-mandate.component.ts index d7ef209a..1ca9e056 100644 --- a/src/main/webapp/app/entities/sepa-mandate/sepa-mandate.component.ts +++ b/src/main/webapp/app/entities/sepa-mandate/sepa-mandate.component.ts @@ -9,6 +9,10 @@ import { AccountService } from 'app/core'; import { ITEMS_PER_PAGE } from 'app/shared'; import { SepaMandateService } from './sepa-mandate.service'; +import { ICustomer } from 'app/shared/model/customer.model'; +import { CustomerService } from 'app/entities/customer'; +import { TableFilter, queryYearAsDateRange, queryEquals, queryContains } from 'app/shared/util/tablefilter'; +import { IMembership } from 'app/shared/model/membership.model'; @Component({ selector: 'jhi-sepa-mandate', @@ -24,9 +28,22 @@ export class SepaMandateComponent implements OnInit, OnDestroy { predicate: any; reverse: any; totalItems: number; + customers: ICustomer[]; + filter: TableFilter<{ + reference?: string; + iban?: string; + bic?: string; + grantingDocumentDate?: string; + revokationDocumentDate?: string; + validFromDate?: string; + validUntilDate?: string; + lastUsedDate?: string; + customerId?: string; + }>; constructor( protected sepaMandateService: SepaMandateService, + protected customerService: CustomerService, protected jhiAlertService: JhiAlertService, protected eventManager: JhiEventManager, protected parseLinks: JhiParseLinks, @@ -40,11 +57,29 @@ export class SepaMandateComponent implements OnInit, OnDestroy { }; this.predicate = 'id'; this.reverse = true; + this.filter = new TableFilter( + { + reference: queryContains, + iban: queryContains, + bic: queryContains, + grantingDocumentDate: queryYearAsDateRange, + revokationDocumentDate: queryYearAsDateRange, + validFromDate: queryYearAsDateRange, + validUntilDate: queryYearAsDateRange, + lastUsedDate: queryYearAsDateRange, + customerId: queryEquals + }, + 500, + () => { + this.loadAll(); + } + ); } loadAll() { this.sepaMandateService .query({ + ...this.filter.buildQueryCriteria(), page: this.page, size: this.itemsPerPage, sort: this.sort() @@ -72,13 +107,20 @@ export class SepaMandateComponent implements OnInit, OnDestroy { this.currentAccount = account; }); this.registerChangeInSepaMandates(); + this.customerService + .query() + .pipe( + filter((mayBeOk: HttpResponse) => mayBeOk.ok), + map((response: HttpResponse) => response.body) + ) + .subscribe((res: IMembership[]) => (this.customers = res), (res: HttpErrorResponse) => this.onError(res.message)); } ngOnDestroy() { this.eventManager.destroy(this.eventSubscriber); } - trackId(index: number, item: ISepaMandate) { + trackId(index: number, item: { id: number }) { return item.id; } @@ -97,6 +139,8 @@ export class SepaMandateComponent implements OnInit, OnDestroy { protected paginateSepaMandates(data: ISepaMandate[], headers: HttpHeaders) { this.links = this.parseLinks.parse(headers.get('link')); this.totalItems = parseInt(headers.get('X-Total-Count'), 10); + this.page = 0; + this.sepaMandates = []; for (let i = 0; i < data.length; i++) { this.sepaMandates.push(data[i]); } diff --git a/src/main/webapp/app/entities/share/share.component.html b/src/main/webapp/app/entities/share/share.component.html index d9f33549..5cecf8a9 100644 --- a/src/main/webapp/app/entities/share/share.component.html +++ b/src/main/webapp/app/entities/share/share.component.html @@ -26,8 +26,8 @@ - - + + - + diff --git a/src/main/webapp/app/entities/membership/membership.component.html b/src/main/webapp/app/entities/membership/membership.component.html index ad24bc15..920fcc61 100644 --- a/src/main/webapp/app/entities/membership/membership.component.html +++ b/src/main/webapp/app/entities/membership/membership.component.html @@ -19,7 +19,7 @@ - + diff --git a/src/main/webapp/app/entities/sepa-mandate/sepa-mandate.component.html b/src/main/webapp/app/entities/sepa-mandate/sepa-mandate.component.html index c7f24e74..cc9c010f 100644 --- a/src/main/webapp/app/entities/sepa-mandate/sepa-mandate.component.html +++ b/src/main/webapp/app/entities/sepa-mandate/sepa-mandate.component.html @@ -23,7 +23,7 @@ - + diff --git a/src/main/webapp/app/entities/share/share.component.html b/src/main/webapp/app/entities/share/share.component.html index 5cecf8a9..7ac7b10b 100644 --- a/src/main/webapp/app/entities/share/share.component.html +++ b/src/main/webapp/app/entities/share/share.component.html @@ -19,7 +19,7 @@ - + From d672d5b0cd60faf9854756243715bbd2a7dc4faa Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Fri, 3 May 2019 22:36:57 +0200 Subject: [PATCH 28/31] more sample-data for assets --- .../config/liquibase/sample-data/assets.csv | 65 ++++++++++++++++--- 1 file changed, 55 insertions(+), 10 deletions(-) diff --git a/src/main/resources/config/liquibase/sample-data/assets.csv b/src/main/resources/config/liquibase/sample-data/assets.csv index 8ac596fb..ac9d9efd 100644 --- a/src/main/resources/config/liquibase/sample-data/assets.csv +++ b/src/main/resources/config/liquibase/sample-data/assets.csv @@ -1,13 +1,58 @@ id;membership_id;document_date;value_date;action;amount;remark -1;1;2001-05-10;2001-05-11;PAYMENT;1024;some|multiline|remark -2;1;2007-09-09;2008-07-10;PAYBACK;1024;another remark -3;2;2017-02-15;2017-02-15;PAYMENT;512;became a member again -4;2;2017-02-15;2017-02-15;PAYMENT;64;just writing something -5;3;2003-06-11;2003-06-11;PAYMENT;256;some comment -6;3;2003-06-15;2004-07-03;PAYBACK;256;cancelled membership -7;4;2017-06-15;2017-05-17;PAYMENT;1024; -8;5;2011-09-18;2011-09-01;PAYMENT;640; -9;5;2013-01-15;2013-01-01;PAYMENT;1280;signed more shares -10;5;2017-12-22;2018-07-01;PAYBACK;1600;cancelled most of their shares +210001;1;2001-05-10;2001-05-11;PAYMENT;64;some|multiline|1. instalment|just to produce some more rows for tests :-) +210002;1;2001-05-10;2001-05-12;PAYMENT;64;some|multiline|2. instalment +210003;1;2001-05-10;2001-05-13;PAYMENT;64;some|multiline|3. instalment +210004;1;2001-05-10;2001-05-14;PAYMENT;64;some|multiline|4. instalment +210005;1;2001-05-10;2001-05-15;PAYMENT;64;some|multiline|5. instalment +210006;1;2001-05-10;2001-05-16;PAYMENT;64;some|multiline|6. instalment +210007;1;2001-05-10;2001-05-17;PAYMENT;64;some|multiline|7. instalment +210008;1;2001-05-10;2001-05-18;PAYMENT;64;some|multiline|8. instalment +210009;1;2001-05-10;2001-05-19;PAYMENT;64;some|multiline|9. instalment +210010;1;2001-05-10;2001-05-20;PAYMENT;64;some|multiline|10. instalment +210011;1;2001-05-10;2001-05-21;PAYMENT;64;some|multiline|11. instalment +210012;1;2001-05-10;2001-05-22;PAYMENT;64;some|multiline|12. instalment +210013;1;2001-05-10;2001-05-23;PAYMENT;64;some|multiline|13. instalment +210014;1;2001-05-10;2001-05-24;PAYMENT;64;some|multiline|14. instalment +210015;1;2001-05-10;2001-05-25;PAYMENT;64;some|multiline|15. instalment +210016;1;2001-05-10;2001-05-26;PAYMENT;64;some|multiline|16. instalment +210017;1;2007-09-09;2008-07-10;PAYBACK;512;1. instalment +210018;1;2007-09-09;2009-07-10;PAYBACK;512;2. instalment +210019;2;2017-02-15;2017-02-15;PAYMENT;512;became a member again +210020;2;2017-02-15;2017-02-15;PAYMENT;64;just writing something +210021;3;2003-06-11;2003-06-11;PAYMENT;256;some comment +210022;3;2003-06-15;2004-07-03;PAYBACK;256;cancelled membership +210023;4;2017-06-15;2017-05-17;PAYMENT;1024; +210024;5;2011-09-18;2011-09-01;PAYMENT;640; +210101;5;2013-01-15;2013-01-01;PAYMENT;64;signed more shares|1. installment +210102;5;2013-01-15;2013-01-02;PAYMENT;64;signed more shares|2. installment +210103;5;2013-01-15;2013-01-03;PAYMENT;64;signed more shares|3. installment +210104;5;2013-01-15;2013-01-04;PAYMENT;64;signed more shares|4. installment +210105;5;2013-01-15;2013-01-05;PAYMENT;64;signed more shares|5. installment +210106;5;2013-01-15;2013-01-06;PAYMENT;64;signed more shares|6. installment +210107;5;2013-01-15;2013-01-07;PAYMENT;64;signed more shares|7. installment +210108;5;2013-01-15;2013-01-08;PAYMENT;64;signed more shares|8. installment +210109;5;2013-01-15;2013-01-09;PAYMENT;64;signed more shares|9. installment +210110;5;2013-01-15;2013-01-10;PAYMENT;64;signed more shares|10. installment +210111;5;2013-01-15;2013-01-11;PAYMENT;64;signed more shares|11. installment +210112;5;2013-01-15;2013-01-12;PAYMENT;64;signed more shares|12. installment +210123;5;2013-01-15;2013-01-13;PAYMENT;64;signed more shares|13. installment +210124;5;2013-01-15;2013-01-14;PAYMENT;64;signed more shares|14. installment +210125;5;2013-01-15;2013-01-15;PAYMENT;64;signed more shares|15. installment +210126;5;2013-01-15;2013-01-16;PAYMENT;64;signed more shares|16. installment +210127;5;2013-01-15;2013-01-17;PAYMENT;64;signed more shares|17. installment +210128;5;2013-01-15;2013-01-18;PAYMENT;64;signed more shares|18. installment +210129;5;2013-01-15;2013-01-19;PAYMENT;64;signed more shares|19. installment +210130;5;2013-01-15;2013-01-20;PAYMENT;64;signed more shares|20. installment +210230;5;2017-12-22;2018-07-01;PAYBACK;160;cancelled most of their shares|1. installment|just to produce more rows for tests :-) +210231;5;2017-12-22;2018-07-02;PAYBACK;160;cancelled most of their shares|2. installment|just to produce more rows for tests :-) +210232;5;2017-12-22;2018-08-03;PAYBACK;160;cancelled most of their shares|3. installment|just to produce more rows for tests :-) +210233;5;2017-12-22;2018-09-04;PAYBACK;160;cancelled most of their shares|4. installment|just to produce more rows for tests :-) +210234;5;2017-12-22;2018-10-05;PAYBACK;160;cancelled most of their shares|5. installment|just to produce more rows for tests :-) +210235;5;2017-12-22;2018-11-06;PAYBACK;160;cancelled most of their shares|6. installment|just to produce more rows for tests :-) +210236;5;2017-12-22;2018-12-07;PAYBACK;160;cancelled most of their shares|7. installment|just to produce more rows for tests :-) +210237;5;2017-12-22;2019-01-08;PAYBACK;160;cancelled most of their shares|8. installment|just to produce more rows for tests :-) +210238;5;2017-12-22;2019-02-09;PAYBACK;160;cancelled most of their shares|9. installment|just to produce more rows for tests :-) +210239;5;2017-12-22;2019-03-10;PAYBACK;160;cancelled most of their shares|10. installment|just to produce more rows for tests :-) + From fbb356c8e906901ab35030d88361a90e822db300 Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Fri, 3 May 2019 23:17:52 +0200 Subject: [PATCH 29/31] fixing problems with infinite scroll due to hidden scrollbar and filtering --- src/main/webapp/app/entities/asset/asset.component.ts | 4 +--- src/main/webapp/app/entities/customer/customer.component.ts | 4 +--- .../webapp/app/entities/membership/membership.component.ts | 3 +-- .../app/entities/sepa-mandate/sepa-mandate.component.ts | 4 +--- src/main/webapp/app/entities/share/share.component.ts | 4 +--- src/main/webapp/app/shared/constants/pagination.constants.ts | 4 +++- 6 files changed, 8 insertions(+), 15 deletions(-) diff --git a/src/main/webapp/app/entities/asset/asset.component.ts b/src/main/webapp/app/entities/asset/asset.component.ts index 93adb998..19220504 100644 --- a/src/main/webapp/app/entities/asset/asset.component.ts +++ b/src/main/webapp/app/entities/asset/asset.component.ts @@ -62,7 +62,7 @@ export class AssetComponent implements OnInit, OnDestroy { }, 500, () => { - this.loadAll(); + this.reset(); } ); } @@ -130,8 +130,6 @@ export class AssetComponent implements OnInit, OnDestroy { protected paginateAssets(data: IAsset[], headers: HttpHeaders) { this.links = this.parseLinks.parse(headers.get('link')); this.totalItems = parseInt(headers.get('X-Total-Count'), 10); - this.page = 0; - this.assets = []; for (let i = 0; i < data.length; i++) { this.assets.push(data[i]); } diff --git a/src/main/webapp/app/entities/customer/customer.component.ts b/src/main/webapp/app/entities/customer/customer.component.ts index 7b66eb1d..94aa2e18 100644 --- a/src/main/webapp/app/entities/customer/customer.component.ts +++ b/src/main/webapp/app/entities/customer/customer.component.ts @@ -50,7 +50,7 @@ export class CustomerComponent implements OnInit, OnDestroy { }, 500, () => { - this.loadAll(); + this.reset(); } ); } @@ -111,8 +111,6 @@ export class CustomerComponent implements OnInit, OnDestroy { protected paginateCustomers(data: ICustomer[], headers: HttpHeaders) { this.links = this.parseLinks.parse(headers.get('link')); this.totalItems = parseInt(headers.get('X-Total-Count'), 10); - this.page = 0; - this.customers = []; for (let i = 0; i < data.length; i++) { this.customers.push(data[i]); } diff --git a/src/main/webapp/app/entities/membership/membership.component.ts b/src/main/webapp/app/entities/membership/membership.component.ts index 6f015b30..5ca7c86a 100644 --- a/src/main/webapp/app/entities/membership/membership.component.ts +++ b/src/main/webapp/app/entities/membership/membership.component.ts @@ -62,7 +62,7 @@ export class MembershipComponent implements OnInit, OnDestroy { }, 500, () => { - this.loadAll(); + this.reset(); } ); } @@ -130,7 +130,6 @@ export class MembershipComponent implements OnInit, OnDestroy { protected paginateMemberships(data: IMembership[], headers: HttpHeaders) { this.links = this.parseLinks.parse(headers.get('link')); this.totalItems = parseInt(headers.get('X-Total-Count'), 10); - this.page = 0; this.memberships = []; for (let i = 0; i < data.length; i++) { this.memberships.push(data[i]); diff --git a/src/main/webapp/app/entities/sepa-mandate/sepa-mandate.component.ts b/src/main/webapp/app/entities/sepa-mandate/sepa-mandate.component.ts index 1ca9e056..d78686dd 100644 --- a/src/main/webapp/app/entities/sepa-mandate/sepa-mandate.component.ts +++ b/src/main/webapp/app/entities/sepa-mandate/sepa-mandate.component.ts @@ -71,7 +71,7 @@ export class SepaMandateComponent implements OnInit, OnDestroy { }, 500, () => { - this.loadAll(); + this.reset(); } ); } @@ -139,8 +139,6 @@ export class SepaMandateComponent implements OnInit, OnDestroy { protected paginateSepaMandates(data: ISepaMandate[], headers: HttpHeaders) { this.links = this.parseLinks.parse(headers.get('link')); this.totalItems = parseInt(headers.get('X-Total-Count'), 10); - this.page = 0; - this.sepaMandates = []; for (let i = 0; i < data.length; i++) { this.sepaMandates.push(data[i]); } diff --git a/src/main/webapp/app/entities/share/share.component.ts b/src/main/webapp/app/entities/share/share.component.ts index 0cc45003..831b30c6 100644 --- a/src/main/webapp/app/entities/share/share.component.ts +++ b/src/main/webapp/app/entities/share/share.component.ts @@ -62,7 +62,7 @@ export class ShareComponent implements OnInit, OnDestroy { }, 500, () => { - this.loadAll(); + this.reset(); } ); } @@ -130,8 +130,6 @@ export class ShareComponent implements OnInit, OnDestroy { protected paginateShares(data: IShare[], headers: HttpHeaders) { this.links = this.parseLinks.parse(headers.get('link')); this.totalItems = parseInt(headers.get('X-Total-Count'), 10); - this.page = 0; - this.shares = []; for (let i = 0; i < data.length; i++) { this.shares.push(data[i]); } diff --git a/src/main/webapp/app/shared/constants/pagination.constants.ts b/src/main/webapp/app/shared/constants/pagination.constants.ts index a148d457..1d1b27bb 100644 --- a/src/main/webapp/app/shared/constants/pagination.constants.ts +++ b/src/main/webapp/app/shared/constants/pagination.constants.ts @@ -1 +1,3 @@ -export const ITEMS_PER_PAGE = 20; +// For infinite scroll, it should be more than fits into a window height. +// Otherwise, the scrollbar might not be there at all, and further pages can't be reached. +export const ITEMS_PER_PAGE = 100; From 5e001c59f9019779e524e80210f0e1033d51b553 Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Fri, 3 May 2019 23:19:12 +0200 Subject: [PATCH 30/31] Revert "#124 [intUI/Filter] for UserRoleAssignment" I am reverting because I need to fix a bug in this commit and it's a tagged HOWTO commit. --- .../user-role-assignment.component.html | 40 +++---------------- .../user-role-assignment.component.ts | 34 +--------------- 2 files changed, 7 insertions(+), 67 deletions(-) diff --git a/src/main/webapp/app/entities/user-role-assignment/user-role-assignment.component.html b/src/main/webapp/app/entities/user-role-assignment/user-role-assignment.component.html index a08c8a10..345fa10d 100644 --- a/src/main/webapp/app/entities/user-role-assignment/user-role-assignment.component.html +++ b/src/main/webapp/app/entities/user-role-assignment/user-role-assignment.component.html @@ -14,41 +14,13 @@
ID Reference Iban Bic Granting Document Date Revokation Document Date Valid From Date Valid Until Date Last Used Date Customer ID Reference Iban Bic Granting Document Date Revokation Document Date Valid From Date Valid Until Date Last Used Date Customer
+ +
Value Date Action Amount Membership Membership
Cancellation Document Date Member From Date Member Until Date Customer Customer
Valid From Date Valid Until Date Last Used Date Customer Customer
Value Date Action Quantity Membership Membership
- - - - - - + + + + + + - - - - - - - - - - - - diff --git a/src/main/webapp/app/entities/user-role-assignment/user-role-assignment.component.ts b/src/main/webapp/app/entities/user-role-assignment/user-role-assignment.component.ts index 9aedd523..822109d8 100644 --- a/src/main/webapp/app/entities/user-role-assignment/user-role-assignment.component.ts +++ b/src/main/webapp/app/entities/user-role-assignment/user-role-assignment.component.ts @@ -9,9 +9,6 @@ import { AccountService } from 'app/core'; import { ITEMS_PER_PAGE } from 'app/shared'; import { UserRoleAssignmentService } from './user-role-assignment.service'; -import { IUser } from 'app/core/user/user.model'; -import { UserService } from 'app/core/user/user.service'; -import { TableFilter, queryEquals, queryContains } from 'app/shared/util/tablefilter'; @Component({ selector: 'jhi-user-role-assignment', @@ -27,17 +24,9 @@ export class UserRoleAssignmentComponent implements OnInit, OnDestroy { predicate: any; reverse: any; totalItems: number; - users: IUser[]; - filter: TableFilter<{ - entityTypeId?: string; - entityObjectId?: string; - assignedRole?: string; - userId?: string; - }>; constructor( protected userRoleAssignmentService: UserRoleAssignmentService, - protected userService: UserService, protected jhiAlertService: JhiAlertService, protected eventManager: JhiEventManager, protected parseLinks: JhiParseLinks, @@ -51,24 +40,11 @@ export class UserRoleAssignmentComponent implements OnInit, OnDestroy { }; this.predicate = 'id'; this.reverse = true; - this.filter = new TableFilter( - { - entityTypeId: queryContains, - entityObjectId: queryEquals, - assignedRole: queryEquals, - userId: queryEquals - }, - 500, - () => { - this.loadAll(); - } - ); } loadAll() { this.userRoleAssignmentService .query({ - ...this.filter.buildQueryCriteria(), page: this.page, size: this.itemsPerPage, sort: this.sort() @@ -95,13 +71,6 @@ export class UserRoleAssignmentComponent implements OnInit, OnDestroy { this.accountService.identity().then(account => { this.currentAccount = account; }); - this.userService - .query() - .pipe( - filter((mayBeOk: HttpResponse) => mayBeOk.ok), - map((response: HttpResponse) => response.body) - ) - .subscribe((res: IUser[]) => (this.users = res), (res: HttpErrorResponse) => this.onError(res.message)); this.registerChangeInUserRoleAssignments(); } @@ -109,7 +78,7 @@ export class UserRoleAssignmentComponent implements OnInit, OnDestroy { this.eventManager.destroy(this.eventSubscriber); } - trackId(index: number, item: { id: number }) { + trackId(index: number, item: IUserRoleAssignment) { return item.id; } @@ -128,7 +97,6 @@ export class UserRoleAssignmentComponent implements OnInit, OnDestroy { protected paginateUserRoleAssignments(data: IUserRoleAssignment[], headers: HttpHeaders) { this.links = this.parseLinks.parse(headers.get('link')); this.totalItems = parseInt(headers.get('X-Total-Count'), 10); - this.userRoleAssignments = []; for (let i = 0; i < data.length; i++) { this.userRoleAssignments.push(data[i]); } From 22e751195250f35bd4ef0cf84b6d0c3d2efad659 Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Fri, 3 May 2019 14:41:41 +0200 Subject: [PATCH 31/31] #124 [intUI/Filter] for UserRoleAssignment --- .../user-role-assignment.component.html | 40 ++++++++++++++++--- .../user-role-assignment.component.ts | 33 ++++++++++++++- 2 files changed, 66 insertions(+), 7 deletions(-) diff --git a/src/main/webapp/app/entities/user-role-assignment/user-role-assignment.component.html b/src/main/webapp/app/entities/user-role-assignment/user-role-assignment.component.html index 345fa10d..a08c8a10 100644 --- a/src/main/webapp/app/entities/user-role-assignment/user-role-assignment.component.html +++ b/src/main/webapp/app/entities/user-role-assignment/user-role-assignment.component.html @@ -14,13 +14,41 @@
ID Entity Type Id Entity Object Id Assigned Role User ID Entity Type Id Entity Object Id Assigned Role User
- - - -
- - - - - - + + + + + + + + + + + + + + + + + + diff --git a/src/main/webapp/app/entities/user-role-assignment/user-role-assignment.component.ts b/src/main/webapp/app/entities/user-role-assignment/user-role-assignment.component.ts index 822109d8..38fde13c 100644 --- a/src/main/webapp/app/entities/user-role-assignment/user-role-assignment.component.ts +++ b/src/main/webapp/app/entities/user-role-assignment/user-role-assignment.component.ts @@ -9,6 +9,9 @@ import { AccountService } from 'app/core'; import { ITEMS_PER_PAGE } from 'app/shared'; import { UserRoleAssignmentService } from './user-role-assignment.service'; +import { IUser } from 'app/core/user/user.model'; +import { UserService } from 'app/core/user/user.service'; +import { TableFilter, queryEquals, queryContains } from 'app/shared/util/tablefilter'; @Component({ selector: 'jhi-user-role-assignment', @@ -24,9 +27,17 @@ export class UserRoleAssignmentComponent implements OnInit, OnDestroy { predicate: any; reverse: any; totalItems: number; + users: IUser[]; + filter: TableFilter<{ + entityTypeId?: string; + entityObjectId?: string; + assignedRole?: string; + userId?: string; + }>; constructor( protected userRoleAssignmentService: UserRoleAssignmentService, + protected userService: UserService, protected jhiAlertService: JhiAlertService, protected eventManager: JhiEventManager, protected parseLinks: JhiParseLinks, @@ -40,11 +51,24 @@ export class UserRoleAssignmentComponent implements OnInit, OnDestroy { }; this.predicate = 'id'; this.reverse = true; + this.filter = new TableFilter( + { + entityTypeId: queryContains, + entityObjectId: queryEquals, + assignedRole: queryEquals, + userId: queryEquals + }, + 500, + () => { + this.reset(); + } + ); } loadAll() { this.userRoleAssignmentService .query({ + ...this.filter.buildQueryCriteria(), page: this.page, size: this.itemsPerPage, sort: this.sort() @@ -71,6 +95,13 @@ export class UserRoleAssignmentComponent implements OnInit, OnDestroy { this.accountService.identity().then(account => { this.currentAccount = account; }); + this.userService + .query() + .pipe( + filter((mayBeOk: HttpResponse) => mayBeOk.ok), + map((response: HttpResponse) => response.body) + ) + .subscribe((res: IUser[]) => (this.users = res), (res: HttpErrorResponse) => this.onError(res.message)); this.registerChangeInUserRoleAssignments(); } @@ -78,7 +109,7 @@ export class UserRoleAssignmentComponent implements OnInit, OnDestroy { this.eventManager.destroy(this.eventSubscriber); } - trackId(index: number, item: IUserRoleAssignment) { + trackId(index: number, item: { id: number }) { return item.id; }
ID Entity Type Id Entity Object Id Assigned Role User ID Entity Type Id Entity Object Id Assigned Role User
+ + + +