Skip to content

Commit 0fd27d9

Browse files
authored
Merge pull request #62 from lishifeng0/master
a little change
2 parents ce05e41 + dcd9f98 commit 0fd27d9

File tree

5 files changed

+43
-74
lines changed

5 files changed

+43
-74
lines changed

pack-angular/celerio/pack-angular/web/src/app/entities/entity-list.component.ts.e.vm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
$output.file("web/src/app/entities/${entity.model.var}/${entity.model.var}-list.component.ts")##
2-
import { Component, Input, Output, OnChanges, EventEmitter, SimpleChanges, Inject } from '@angular/core';
2+
import { Component, Input, Output, OnChanges, EventEmitter, SimpleChanges} from '@angular/core';
33
import { Router } from '@angular/router';
44
import { DataTable, LazyLoadEvent } from 'primeng/primeng';
55
import { PageResponse } from "../../support/paging";

pack-angular/celerio/pack-angular/web/src/app/entities/entity.service.ts.e.vm

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
$output.file("web/src/app/entities/${entity.model.var}/${entity.model.var}.service.ts")##
22
import { Injectable } from '@angular/core';
3-
import { HttpClientModule, HttpClient, HttpResponse, HttpHeaders, HttpErrorResponse } from '@angular/common/http';
3+
import { HttpClient, HttpResponse, HttpErrorResponse } from '@angular/common/http';
44
import { LazyLoadEvent } from 'primeng/primeng';
55
import { MessageService } from '../../service/message.service';
66
import { PageResponse, PageRequestByExample } from '../../support/paging';
@@ -12,8 +12,6 @@ import 'rxjs/add/observable/throw';
1212
@Injectable()
1313
export class ${entity.service.type} {
1414

15-
private options = { headers: new HttpHeaders({ 'Content-Type': 'application/json' }) };
16-
1715
constructor(private http: HttpClient, private messageService : MessageService) {}
1816

1917
/**
@@ -31,9 +29,9 @@ export class ${entity.service.type} {
3129
* Update the passed ${entity.model.var}.
3230
*/
3331
update($entity.model.var : $entity.model.type) : Observable<$entity.model.type> {
34-
let body = JSON.stringify($entity.model.var);
32+
let body = $entity.model.var;
3533

36-
return this.http.put('/api/$entity.model.vars/', body, this.options)
34+
return this.http.put('/api/$entity.model.vars/', body)
3735
.pipe(
3836
map(response => new ${entity.model.type}(response)),
3937
catchError(this.handleError)
@@ -46,14 +44,11 @@ export class ${entity.service.type} {
4644
*/
4745
getPage($entity.model.var : $entity.model.type, event : LazyLoadEvent) : Observable<PageResponse<$entity.model.type>> {
4846
let req = new PageRequestByExample($entity.model.var, event);
49-
let body = JSON.stringify(req);
47+
let body = req;
5048

51-
return this.http.post('/api/$entity.model.vars/page', body, this.options)
49+
return this.http.post<PageResponse<any>>('/api/$entity.model.vars/page', body)
5250
.pipe(
53-
map(response => {
54-
let pr : any = response;
55-
return new PageResponse<$entity.model.type>(pr.totalPages, pr.totalElements, ${entity.model.type}.toArray(pr.content));
56-
}),
51+
map(pr => new PageResponse<$entity.model.type>(pr.totalPages, pr.totalElements, ${entity.model.type}.toArray(pr.content))),
5752
catchError(this.handleError)
5853
);
5954
}
@@ -63,8 +58,8 @@ export class ${entity.service.type} {
6358
* Used by ${entity.model.type}CompleteComponent.
6459
*/
6560
complete(query : string) : Observable<${entity.model.type}[]> {
66-
let body = JSON.stringify({'query': query, 'maxResults': 10});
67-
return this.http.post<any[]>('/api/$entity.model.vars/complete', body, this.options)
61+
let body = {'query': query, 'maxResults': 10};
62+
return this.http.post<any[]>('/api/$entity.model.vars/complete', body)
6863
.pipe(
6964
map(response => ${entity.model.type}.toArray(response)),
7065
catchError(this.handleError)

pack-angular/celerio/pack-angular/web/src/app/service/auth.service.ts.p.vm

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
$output.file("web/src/app/service/auth.service.ts")##
22

33
import { Injectable } from '@angular/core'
4-
import { HttpClientModule, HttpHeaders, HttpClient, HttpErrorResponse } from '@angular/common/http';
4+
import { HttpParams, HttpClient, HttpErrorResponse } from '@angular/common/http';
55
import { Observable } from 'rxjs/Rx';
66
import { catchError, map } from 'rxjs/operators';
77
import 'rxjs/add/observable/throw';
@@ -20,9 +20,16 @@ export class AuthService {
2020

2121
login(j_username : string, j_password : string) : Observable<boolean> {
2222
console.log("login for " + j_username);
23-
let body = 'j_username=' + j_username + '&j_password=' + j_password + '&submit=Login';
23+
const params = {
24+
j_username: j_username,
25+
j_password: j_password,
26+
submit: 'Login'
27+
};
28+
29+
let body = new HttpParams({fromObject: params});
30+
2431

25-
return this.http.post('/api/login', body, { headers: new HttpHeaders({ 'Content-Type': 'application/x-www-form-urlencoded' }), observe: 'response' })
32+
return this.http.post('/api/login', body, { observe: 'response' })
2633
.pipe(
2734
map(res => res.status == 200),
2835
catchError(this.handleError)

quickstart/README.md

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
**Prerequisites:**
33

44
* [Java Development Kit 8](http://www.oracle.com/technetwork/java/javase/downloads/index.html)
5-
* [Maven 3.3.3](https://maven.apache.org/download.cgi)
6-
* [Angular cli 1.6.3 ](https://github.com/angular/angular-cli#installation) - 1.6.3 is really required to work with Angular 5.0
7-
* [Npm 3.x.x](https://nodejs.org/en/)
8-
* [NodeJS 6.10](https://nodejs.org/en/)
5+
* [Maven 3.5.x](https://maven.apache.org/download.cgi)
6+
* [Angular cli 1.6.3 ](https://github.com/angular/angular-cli#installation) - 1.0.0 is really required to work with Angular 4.0
7+
* [Npm 5.x.x](https://nodejs.org/en/)
8+
* [NodeJS 8.x](https://nodejs.org/en/)
99

1010

1111
### 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
3131
**Then from a second console run:**
3232

3333
cd celerio-angular-quickstart/quickstart/web
34-
npm install --save @angular/material @angular/cdk
35-
npm install --save @angular/animations
36-
npm install --save primeng@5.0.2
37-
npm install --save font-awesome
34+
npm i @angular/material @angular/cdk
35+
npm i primeng
36+
npm i font-awesome
3837
ng serve --proxy-config proxy.conf.json
3938

4039
Then open [http://localhost:4200/](http://localhost:4200/)
@@ -91,10 +90,10 @@ The backend listens on port 8080.
9190

9291
The 4 command below install some additional dependencies required by the code generated by Celerio.
9392

94-
npm install --save @angular/material @angular/cdk
95-
npm install --save @angular/animations
96-
npm install --save primeng@5.0.2
97-
npm install --save font-awesome
93+
npm i @angular/material @angular/cdk
94+
npm i primeng
95+
npm i font-awesome
96+
9897

9998
Starts a node server on port 4200 using angular cli. The node server proxies the calls to /api and /img to the
10099
spring boot backend that runs in the first console.
@@ -174,10 +173,10 @@ Here are the command lines (hope it is self explanatory):
174173
rm web/src/app/app.module.ts web/src/app/app.component.* web/src/styles.css
175174
mvn -Pdb,metadata,gen generate-sources
176175
cd web
177-
npm install --save @angular/material @angular/cdk
178-
npm install --save @angular/animations
179-
npm install --save primeng@5.0.2
180-
npm install --save font-awesome
176+
npm i @angular/material @angular/cdk
177+
npm i primeng
178+
npm i font-awesome
179+
181180
ng build --prod
182181
cp dist/* ../src/main/resources/static
183182
cd ..

quickstart/pom.xml

Lines changed: 9 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<parent>
1414
<groupId>org.springframework.boot</groupId>
1515
<artifactId>spring-boot-starter-parent</artifactId>
16-
<version>1.5.4.RELEASE</version>
16+
<version>1.5.9.RELEASE</version>
1717
</parent>
1818

1919
<properties>
@@ -22,12 +22,7 @@
2222
resources, i.e. build is platform dependent! -->
2323
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
2424

25-
<!-- maven-compiler-plugin -->
26-
<maven.compiler.target>1.8</maven.compiler.target>
27-
<maven.compiler.source>1.8</maven.compiler.source>
28-
29-
<hibernate.version>5.0.2.Final</hibernate.version>
30-
<spring-security.version>4.0.4.RELEASE</spring-security.version>
25+
<java.version>1.8</java.version>
3126

3227
<!-- ~~~~~~~~ -->
3328
<!-- Database -->
@@ -39,7 +34,7 @@
3934
<!-- H2 DATABASE SETTINGS -->
4035
<jdbc.groupId>com.h2database</jdbc.groupId>
4136
<jdbc.artifactId>h2</jdbc.artifactId>
42-
<jdbc.version>1.4.187</jdbc.version>
37+
<jdbc.version>${h2.version}</jdbc.version>
4338

4439
<jdbc.driver>org.h2.Driver</jdbc.driver>
4540
<jdbc.url>jdbc:h2:${project.build.directory}/db/angulardb;MVCC=TRUE;FILE_LOCK=NO</jdbc.url>
@@ -55,7 +50,7 @@
5550
<!-- MYSQL DATABASE SETTINGS
5651
<jdbc.groupId>mysql</jdbc.groupId>
5752
<jdbc.artifactId>mysql-connector-java</jdbc.artifactId>
58-
<jdbc.version>5.1.40</jdbc.version>
53+
<jdbc.version>${mysql.version}</jdbc.version>
5954
6055
<jdbc.driver>com.mysql.jdbc.Driver</jdbc.driver>
6156
<jdbc.url>jdbc:mysql://127.0.0.1:3306/angulardb</jdbc.url>
@@ -100,21 +95,17 @@
10095
<hibernate.use.second.level.cache>false</hibernate.use.second.level.cache>
10196
<hibernate.use.query.cache>false</hibernate.use.query.cache>
10297

103-
<!-- use latest versions-->
104-
<spring-data-releasetrain.version>Hopper-SR11</spring-data-releasetrain.version>
105-
10698
</properties>
10799

108100
<dependencies>
109101
<dependency>
110102
<groupId>${jdbc.groupId}</groupId>
111103
<artifactId>${jdbc.artifactId}</artifactId>
112-
<version>${jdbc.version}</version>
113104
</dependency>
114105
<dependency>
115106
<groupId>org.hibernate</groupId>
116107
<artifactId>hibernate-java8</artifactId>
117-
<version>5.0.2.Final</version>
108+
<version>${hibernate.version}</version>
118109
</dependency>
119110
<!-- Celerio code completion support in velocity templates -->
120111
<!-- See pack-angular/META-INF/velocity_implicit.vm -->
@@ -138,14 +129,6 @@
138129
<groupId>org.springframework.boot</groupId>
139130
<artifactId>spring-boot-starter-web</artifactId>
140131
</dependency>
141-
<dependency>
142-
<groupId>com.fasterxml.jackson.core</groupId>
143-
<artifactId>jackson-annotations</artifactId>
144-
</dependency>
145-
<dependency>
146-
<groupId>com.fasterxml.jackson.core</groupId>
147-
<artifactId>jackson-databind</artifactId>
148-
</dependency>
149132
<dependency>
150133
<groupId>com.fasterxml.jackson.datatype</groupId>
151134
<artifactId>jackson-datatype-jsr310</artifactId>
@@ -191,16 +174,11 @@
191174
<artifactId>spring-boot-starter-test</artifactId>
192175
<scope>test</scope>
193176
</dependency>
194-
<dependency>
195-
<groupId>junit</groupId>
196-
<artifactId>junit</artifactId>
197-
<version>4.12</version>
198-
<scope>test</scope>
199-
</dependency>
177+
200178
<dependency>
201179
<groupId>org.mockito</groupId>
202180
<artifactId>mockito-all</artifactId>
203-
<version>1.9.5</version>
181+
<version>1.10.19</version>
204182
<scope>test</scope>
205183
</dependency>
206184
<dependency>
@@ -264,7 +242,7 @@
264242
<!-- http://maven.apache.org/plugins/maven-resources-plugin/ -->
265243
<groupId>org.apache.maven.plugins</groupId>
266244
<artifactId>maven-resources-plugin</artifactId>
267-
<version>2.7</version>
245+
<version>3.0.2</version>
268246
<configuration>
269247
<delimiters>
270248
<delimiter>@*@</delimiter>
@@ -282,7 +260,7 @@
282260
<!-- http://mojo.codehaus.org/build-helper-maven-plugin/ -->
283261
<groupId>org.codehaus.mojo</groupId>
284262
<artifactId>build-helper-maven-plugin</artifactId>
285-
<version>1.9.1</version>
263+
<version>3.0.0</version>
286264
<executions>
287265
<execution>
288266
<id>Adding generated java folder to build</id>
@@ -314,16 +292,6 @@
314292
</plugin>
315293

316294

317-
<!-- Compiler plugin enforces Java compatibility and activates
318-
annotation processors -->
319-
<plugin>
320-
<artifactId>maven-compiler-plugin</artifactId>
321-
<version>3.1</version>
322-
<configuration>
323-
<source>${maven.compiler.source}</source>
324-
<target>${maven.compiler.target}</target>
325-
</configuration>
326-
</plugin>
327295
</plugins>
328296
</build>
329297

0 commit comments

Comments
 (0)