From d1aab8b66addb40e1c1de2f897b72ea85920c84e Mon Sep 17 00:00:00 2001
From: lsf0 <3418432614@qq.com>
Date: Fri, 5 Jan 2018 18:05:19 +0800
Subject: [PATCH 1/2] pom.xml update dependencies
---
quickstart/pom.xml | 50 +++++++++-------------------------------------
1 file changed, 9 insertions(+), 41 deletions(-)
diff --git a/quickstart/pom.xml b/quickstart/pom.xml
index dce712e..9c3f458 100644
--- a/quickstart/pom.xml
+++ b/quickstart/pom.xml
@@ -13,7 +13,7 @@
org.springframework.boot
spring-boot-starter-parent
- 1.5.4.RELEASE
+ 1.5.9.RELEASE
@@ -22,12 +22,7 @@
resources, i.e. build is platform dependent! -->
UTF-8
-
- 1.8
- 1.8
-
- 5.0.2.Final
- 4.0.4.RELEASE
+ 1.8
@@ -39,7 +34,7 @@
com.h2database
h2
- 1.4.187
+ ${h2.version}
org.h2.Driver
jdbc:h2:${project.build.directory}/db/angulardb;MVCC=TRUE;FILE_LOCK=NO
@@ -55,7 +50,7 @@
- Hopper-SR11
-
${jdbc.groupId}
${jdbc.artifactId}
- ${jdbc.version}
org.hibernate
hibernate-java8
- 5.0.2.Final
+ ${hibernate.version}
@@ -138,14 +129,6 @@
org.springframework.boot
spring-boot-starter-web
-
- com.fasterxml.jackson.core
- jackson-annotations
-
-
- com.fasterxml.jackson.core
- jackson-databind
-
com.fasterxml.jackson.datatype
jackson-datatype-jsr310
@@ -191,16 +174,11 @@
spring-boot-starter-test
test
-
- junit
- junit
- 4.12
- test
-
+
org.mockito
mockito-all
- 1.9.5
+ 1.10.19
test
@@ -264,7 +242,7 @@
org.apache.maven.plugins
maven-resources-plugin
- 2.7
+ 3.0.2
@*@
@@ -282,7 +260,7 @@
org.codehaus.mojo
build-helper-maven-plugin
- 1.9.1
+ 3.0.0
Adding generated java folder to build
@@ -314,16 +292,6 @@
-
-
- maven-compiler-plugin
- 3.1
-
- ${maven.compiler.source}
- ${maven.compiler.target}
-
-
From dcd9f98a60369f4812224ed3b156e377a93b5324 Mon Sep 17 00:00:00 2001
From: lsf0 <3418432614@qq.com>
Date: Fri, 5 Jan 2018 18:23:14 +0800
Subject: [PATCH 2/2] a little change
---
.../entities/entity-list.component.ts.e.vm | 2 +-
.../src/app/entities/entity.service.ts.e.vm | 21 +++++--------
.../web/src/app/service/auth.service.ts.p.vm | 13 ++++++--
quickstart/README.md | 31 +++++++++----------
4 files changed, 34 insertions(+), 33 deletions(-)
diff --git a/pack-angular/celerio/pack-angular/web/src/app/entities/entity-list.component.ts.e.vm b/pack-angular/celerio/pack-angular/web/src/app/entities/entity-list.component.ts.e.vm
index fecdf4b..04d2c9a 100644
--- a/pack-angular/celerio/pack-angular/web/src/app/entities/entity-list.component.ts.e.vm
+++ b/pack-angular/celerio/pack-angular/web/src/app/entities/entity-list.component.ts.e.vm
@@ -1,5 +1,5 @@
$output.file("web/src/app/entities/${entity.model.var}/${entity.model.var}-list.component.ts")##
-import { Component, Input, Output, OnChanges, EventEmitter, SimpleChanges, Inject } from '@angular/core';
+import { Component, Input, Output, OnChanges, EventEmitter, SimpleChanges} from '@angular/core';
import { Router } from '@angular/router';
import { DataTable, LazyLoadEvent } from 'primeng/primeng';
import { PageResponse } from "../../support/paging";
diff --git a/pack-angular/celerio/pack-angular/web/src/app/entities/entity.service.ts.e.vm b/pack-angular/celerio/pack-angular/web/src/app/entities/entity.service.ts.e.vm
index cfdb3b3..1d841a8 100644
--- a/pack-angular/celerio/pack-angular/web/src/app/entities/entity.service.ts.e.vm
+++ b/pack-angular/celerio/pack-angular/web/src/app/entities/entity.service.ts.e.vm
@@ -1,6 +1,6 @@
$output.file("web/src/app/entities/${entity.model.var}/${entity.model.var}.service.ts")##
import { Injectable } from '@angular/core';
-import { HttpClientModule, HttpClient, HttpResponse, HttpHeaders, HttpErrorResponse } from '@angular/common/http';
+import { HttpClient, HttpResponse, HttpErrorResponse } from '@angular/common/http';
import { LazyLoadEvent } from 'primeng/primeng';
import { MessageService } from '../../service/message.service';
import { PageResponse, PageRequestByExample } from '../../support/paging';
@@ -12,8 +12,6 @@ import 'rxjs/add/observable/throw';
@Injectable()
export class ${entity.service.type} {
- private options = { headers: new HttpHeaders({ 'Content-Type': 'application/json' }) };
-
constructor(private http: HttpClient, private messageService : MessageService) {}
/**
@@ -31,9 +29,9 @@ export class ${entity.service.type} {
* Update the passed ${entity.model.var}.
*/
update($entity.model.var : $entity.model.type) : Observable<$entity.model.type> {
- let body = JSON.stringify($entity.model.var);
+ let body = $entity.model.var;
- return this.http.put('/api/$entity.model.vars/', body, this.options)
+ return this.http.put('/api/$entity.model.vars/', body)
.pipe(
map(response => new ${entity.model.type}(response)),
catchError(this.handleError)
@@ -46,14 +44,11 @@ export class ${entity.service.type} {
*/
getPage($entity.model.var : $entity.model.type, event : LazyLoadEvent) : Observable> {
let req = new PageRequestByExample($entity.model.var, event);
- let body = JSON.stringify(req);
+ let body = req;
- return this.http.post('/api/$entity.model.vars/page', body, this.options)
+ return this.http.post>('/api/$entity.model.vars/page', body)
.pipe(
- map(response => {
- let pr : any = response;
- return new PageResponse<$entity.model.type>(pr.totalPages, pr.totalElements, ${entity.model.type}.toArray(pr.content));
- }),
+ map(pr => new PageResponse<$entity.model.type>(pr.totalPages, pr.totalElements, ${entity.model.type}.toArray(pr.content))),
catchError(this.handleError)
);
}
@@ -63,8 +58,8 @@ export class ${entity.service.type} {
* Used by ${entity.model.type}CompleteComponent.
*/
complete(query : string) : Observable<${entity.model.type}[]> {
- let body = JSON.stringify({'query': query, 'maxResults': 10});
- return this.http.post('/api/$entity.model.vars/complete', body, this.options)
+ let body = {'query': query, 'maxResults': 10};
+ return this.http.post('/api/$entity.model.vars/complete', body)
.pipe(
map(response => ${entity.model.type}.toArray(response)),
catchError(this.handleError)
diff --git a/pack-angular/celerio/pack-angular/web/src/app/service/auth.service.ts.p.vm b/pack-angular/celerio/pack-angular/web/src/app/service/auth.service.ts.p.vm
index 8b36efd..ad37c63 100644
--- a/pack-angular/celerio/pack-angular/web/src/app/service/auth.service.ts.p.vm
+++ b/pack-angular/celerio/pack-angular/web/src/app/service/auth.service.ts.p.vm
@@ -1,7 +1,7 @@
$output.file("web/src/app/service/auth.service.ts")##
import { Injectable } from '@angular/core'
-import { HttpClientModule, HttpHeaders, HttpClient, HttpErrorResponse } from '@angular/common/http';
+import { HttpParams, HttpClient, HttpErrorResponse } from '@angular/common/http';
import { Observable } from 'rxjs/Rx';
import { catchError, map } from 'rxjs/operators';
import 'rxjs/add/observable/throw';
@@ -20,9 +20,16 @@ export class AuthService {
login(j_username : string, j_password : string) : Observable {
console.log("login for " + j_username);
- let body = 'j_username=' + j_username + '&j_password=' + j_password + '&submit=Login';
+ const params = {
+ j_username: j_username,
+ j_password: j_password,
+ submit: 'Login'
+ };
+
+ let body = new HttpParams({fromObject: params});
+
- return this.http.post('/api/login', body, { headers: new HttpHeaders({ 'Content-Type': 'application/x-www-form-urlencoded' }), observe: 'response' })
+ return this.http.post('/api/login', body, { observe: 'response' })
.pipe(
map(res => res.status == 200),
catchError(this.handleError)
diff --git a/quickstart/README.md b/quickstart/README.md
index 65d8f4f..4dba7b5 100644
--- a/quickstart/README.md
+++ b/quickstart/README.md
@@ -2,10 +2,10 @@
**Prerequisites:**
* [Java Development Kit 8](http://www.oracle.com/technetwork/java/javase/downloads/index.html)
-* [Maven 3.3.3](https://maven.apache.org/download.cgi)
-* [Angular cli 1.6.3 ](https://github.com/angular/angular-cli#installation) - 1.6.3 is really required to work with Angular 5.0
-* [Npm 3.x.x](https://nodejs.org/en/)
-* [NodeJS 6.10](https://nodejs.org/en/)
+* [Maven 3.5.x](https://maven.apache.org/download.cgi)
+* [Angular cli 1.6.3 ](https://github.com/angular/angular-cli#installation) - 1.0.0 is really required to work with Angular 4.0
+* [Npm 5.x.x](https://nodejs.org/en/)
+* [NodeJS 8.x](https://nodejs.org/en/)
### Run these commands to generate and run an Angular 5.0 web app:
@@ -31,10 +31,9 @@ Make sure you wait until spring boot starts and listen on port 8080
**Then from a second console run:**
cd celerio-angular-quickstart/quickstart/web
- npm install --save @angular/material @angular/cdk
- npm install --save @angular/animations
- npm install --save primeng@5.0.2
- npm install --save font-awesome
+ npm i @angular/material @angular/cdk
+ npm i primeng
+ npm i font-awesome
ng serve --proxy-config proxy.conf.json
Then open [http://localhost:4200/](http://localhost:4200/)
@@ -91,10 +90,10 @@ The backend listens on port 8080.
The 4 command below install some additional dependencies required by the code generated by Celerio.
- npm install --save @angular/material @angular/cdk
- npm install --save @angular/animations
- npm install --save primeng@5.0.2
- npm install --save font-awesome
+ npm i @angular/material @angular/cdk
+ npm i primeng
+ npm i font-awesome
+
Starts a node server on port 4200 using angular cli. The node server proxies the calls to /api and /img to the
spring boot backend that runs in the first console.
@@ -174,10 +173,10 @@ Here are the command lines (hope it is self explanatory):
rm web/src/app/app.module.ts web/src/app/app.component.* web/src/styles.css
mvn -Pdb,metadata,gen generate-sources
cd web
- npm install --save @angular/material @angular/cdk
- npm install --save @angular/animations
- npm install --save primeng@5.0.2
- npm install --save font-awesome
+ npm i @angular/material @angular/cdk
+ npm i primeng
+ npm i font-awesome
+
ng build --prod
cp dist/* ../src/main/resources/static
cd ..