Merge branch 'master' of ssh://dev.hostsharing.net:29418/hsadmin/hsadmin-ng
This commit is contained in:
commit
31aafd3b86
@ -14,7 +14,6 @@ entity Contact {
|
||||
email String required maxlength(80)
|
||||
}
|
||||
|
||||
|
||||
enum CustomerContactRole {
|
||||
CONTRACTUAL,
|
||||
TECHNICAL,
|
||||
|
@ -1,4 +1,5 @@
|
||||
#H2 Server Properties
|
||||
#Wed Apr 03 13:36:25 CEST 2019
|
||||
0=JHipster H2 (Memory)|org.h2.Driver|jdbc\:h2\:mem\:hsadminng|hsadminNg
|
||||
webAllowOthers=true
|
||||
webPort=8082
|
||||
|
@ -57,7 +57,7 @@ spring:
|
||||
hibernate.cache.use_query_cache: false
|
||||
hibernate.generate_statistics: true
|
||||
liquibase:
|
||||
contexts: dev
|
||||
contexts: dev,sample-data
|
||||
mail:
|
||||
host: localhost
|
||||
port: 25
|
||||
|
@ -33,5 +33,17 @@
|
||||
</createTable>
|
||||
|
||||
</changeSet>
|
||||
|
||||
<changeSet id="20190402141612-2" author="mhoennig" context="sample-data">
|
||||
<loadData encoding="UTF-8"
|
||||
file="config/liquibase/sample-data/customers.csv"
|
||||
separator=";"
|
||||
tableName="customer">
|
||||
<column name="id" type="numeric"/>
|
||||
<column name="jhi_number" type="numeric"/>
|
||||
<column name="prefix" type="string"/>
|
||||
</loadData>
|
||||
</changeSet>
|
||||
|
||||
<!-- jhipster-needle-liquibase-add-changeset - JHipster will add changesets here, do not remove-->
|
||||
</databaseChangeLog>
|
||||
|
@ -37,5 +37,18 @@
|
||||
</createTable>
|
||||
|
||||
</changeSet>
|
||||
|
||||
<changeSet id="20190403083736-2" author="mhoennig" context="sample-data">
|
||||
<loadData encoding="UTF-8"
|
||||
file="config/liquibase/sample-data/contacts.csv"
|
||||
separator=";"
|
||||
tableName="contact">
|
||||
<column name="id" type="numeric"/>
|
||||
<column name="first_name" type="string"/>
|
||||
<column name="last_name" type="string"/>
|
||||
<column name="email" type="string"/>
|
||||
</loadData>
|
||||
</changeSet>
|
||||
|
||||
<!-- jhipster-needle-liquibase-add-changeset - JHipster will add changesets here, do not remove-->
|
||||
</databaseChangeLog>
|
||||
|
@ -37,5 +37,18 @@
|
||||
</createTable>
|
||||
|
||||
</changeSet>
|
||||
|
||||
<changeSet id="20190403083737-2" author="mhoennig" context="sample-data">
|
||||
<loadData encoding="UTF-8"
|
||||
file="config/liquibase/sample-data/customer-contacts.csv"
|
||||
separator=";"
|
||||
tableName="customer_contact">
|
||||
<column name="id" type="numeric"/>
|
||||
<column name="customer" type="numeric"/>
|
||||
<column name="role" type="string"/>
|
||||
<column name="contact" type="numeric"/>
|
||||
</loadData>
|
||||
</changeSet>
|
||||
|
||||
<!-- jhipster-needle-liquibase-add-changeset - JHipster will add changesets here, do not remove-->
|
||||
</databaseChangeLog>
|
||||
|
@ -0,0 +1,6 @@
|
||||
id;first_name;last_name;email
|
||||
1;Paule;Müller;paule.mueller@example.com
|
||||
2;Helma;Schmidt;helma.schmidt@example.com
|
||||
3;Vidi;Vitt;vidi.vitt@example.com
|
||||
4;Saskia;Balder;saskia@balder.example.com
|
||||
|
|
@ -0,0 +1,8 @@
|
||||
id;customer_id;jhi_role;contact_id
|
||||
1;1;CONTRACTUAL;1
|
||||
2;1;TECHNICAL;1
|
||||
3;1;FINANCIAL;1
|
||||
4;2;CONTRACTUAL;1
|
||||
5;2;TECHNICAL;2
|
||||
6;2;FINANCIAL;3
|
||||
|
|
@ -0,0 +1,7 @@
|
||||
id;jhi_number;prefix
|
||||
1;10001;aaa
|
||||
2;10002;bbb
|
||||
3;10003;ccc
|
||||
4;10004;ddd
|
||||
5;10098;abc
|
||||
6;10099;bca
|
|
@ -19,6 +19,12 @@
|
||||
<th jhiSortBy="prefix"><span jhiTranslate="hsadminNgApp.customer.prefix">Prefix</span> <fa-icon [icon]="'sort'"></fa-icon></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th><input type="text" class="form-control" [(ngModel)]="filterValue.number" (keyup)="filter($event)"></th>
|
||||
<th><input type="text" class="form-control" [(ngModel)]="filterValue.prefix" (keyup)="filter($event)"></th>
|
||||
<th><button class="btn btn-primary float-left" (click)="resetFilter()">Reset Filter</button></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody infinite-scroll (scrolled)="loadPage(page + 1)" [infiniteScrollDisabled]="page >= links['last']" [infiniteScrollDistance]="0">
|
||||
<tr *ngFor="let customer of customers ;trackBy: trackId">
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { Component, OnInit, OnDestroy } from '@angular/core';
|
||||
import { HttpErrorResponse, HttpHeaders, HttpResponse } from '@angular/common/http';
|
||||
import { Subscription } from 'rxjs';
|
||||
import { filter, map } from 'rxjs/operators';
|
||||
import { Subscription, Subject } from 'rxjs';
|
||||
import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
|
||||
import { JhiEventManager, JhiParseLinks, JhiAlertService } from 'ng-jhipster';
|
||||
|
||||
import { ICustomer } from 'app/shared/model/customer.model';
|
||||
@ -24,6 +24,9 @@ export class CustomerComponent implements OnInit, OnDestroy {
|
||||
predicate: any;
|
||||
reverse: any;
|
||||
totalItems: number;
|
||||
filterValue: any;
|
||||
filterValueChanged = new Subject<string>();
|
||||
subscription: Subscription;
|
||||
|
||||
constructor(
|
||||
protected customerService: CustomerService,
|
||||
@ -40,11 +43,25 @@ export class CustomerComponent implements OnInit, OnDestroy {
|
||||
};
|
||||
this.predicate = 'id';
|
||||
this.reverse = true;
|
||||
this.resetFilter();
|
||||
}
|
||||
|
||||
resetFilter() {
|
||||
this.filterValue = {
|
||||
number: null,
|
||||
prefix: null
|
||||
};
|
||||
this.loadAll();
|
||||
}
|
||||
|
||||
loadAll() {
|
||||
const criteria = {
|
||||
...(this.filterValue.number && { 'number.equals': this.filterValue.number }),
|
||||
...(this.filterValue.prefix && { 'prefix.contains': this.filterValue.prefix })
|
||||
};
|
||||
this.customerService
|
||||
.query({
|
||||
...criteria,
|
||||
page: this.page,
|
||||
size: this.itemsPerPage,
|
||||
sort: this.sort()
|
||||
@ -55,6 +72,10 @@ export class CustomerComponent implements OnInit, OnDestroy {
|
||||
);
|
||||
}
|
||||
|
||||
filter($event) {
|
||||
this.filterValueChanged.next($event.target.value);
|
||||
}
|
||||
|
||||
reset() {
|
||||
this.page = 0;
|
||||
this.customers = [];
|
||||
@ -72,6 +93,15 @@ export class CustomerComponent implements OnInit, OnDestroy {
|
||||
this.currentAccount = account;
|
||||
});
|
||||
this.registerChangeInCustomers();
|
||||
|
||||
this.subscription = this.filterValueChanged
|
||||
.pipe(
|
||||
debounceTime(500),
|
||||
distinctUntilChanged((previous: any, current: any) => previous === current)
|
||||
)
|
||||
.subscribe(() => {
|
||||
this.loadAll();
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
@ -97,6 +127,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]);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user