Skip to content

Commit 6601da0

Browse files
author
Alain BOUDARD
committed
fix: update Angular 10
BREAK: montée version principale
1 parent df53d21 commit 6601da0

19 files changed

+3507
-4718
lines changed

pom.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,19 @@
5858
<artifactId>spring-boot-configuration-processor</artifactId>
5959
<optional>true</optional>
6060
</dependency>
61+
<!-- API, java.xml.bind module -->
62+
<dependency>
63+
<groupId>jakarta.xml.bind</groupId>
64+
<artifactId>jakarta.xml.bind-api</artifactId>
65+
<version>2.3.2</version>
66+
</dependency>
67+
68+
<!-- Runtime, com.sun.xml.bind module -->
69+
<dependency>
70+
<groupId>org.glassfish.jaxb</groupId>
71+
<artifactId>jaxb-runtime</artifactId>
72+
<version>2.3.2</version>
73+
</dependency>
6174
</dependencies>
6275

6376
<build>
File renamed without changes.

src/angular/package-lock.json

Lines changed: 3370 additions & 4665 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/angular/package.json

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -16,55 +16,55 @@
1616
},
1717
"private": true,
1818
"dependencies": {
19-
"@angular/animations": "^9.1.13",
20-
"@angular/common": "^9.1.13",
21-
"@angular/compiler": "^9.1.13",
22-
"@angular/core": "^9.1.13",
23-
"@angular/forms": "^9.1.13",
24-
"@angular/localize": "^9.1.13",
25-
"@angular/platform-browser": "^9.1.13",
26-
"@angular/platform-browser-dynamic": "^9.1.13",
27-
"@angular/router": "^9.1.13",
28-
"@fortawesome/angular-fontawesome": "^0.6.1",
29-
"@fortawesome/fontawesome-svg-core": "^1.2.27",
30-
"@fortawesome/free-solid-svg-icons": "^5.12.1",
31-
"@ng-bootstrap/ng-bootstrap": "^6.2.0",
32-
"@ngrx/data": "^9.2.1",
33-
"@ngrx/effects": "^9.2.1",
34-
"@ngrx/entity": "^9.2.1",
35-
"@ngrx/store": "^9.2.1",
36-
"@ngrx/store-devtools": "^9.2.1",
19+
"@angular/animations": "^10.2.5",
20+
"@angular/common": "^10.2.5",
21+
"@angular/compiler": "^10.2.5",
22+
"@angular/core": "^10.2.5",
23+
"@angular/forms": "^10.2.5",
24+
"@angular/localize": "^10.2.5",
25+
"@angular/platform-browser": "^10.2.5",
26+
"@angular/platform-browser-dynamic": "^10.2.5",
27+
"@angular/router": "^10.2.5",
28+
"@fortawesome/angular-fontawesome": "^0.7.0",
29+
"@fortawesome/fontawesome-svg-core": "^6.1.0",
30+
"@fortawesome/free-solid-svg-icons": "^6.1.0",
31+
"@ng-bootstrap/ng-bootstrap": "^8.0.4",
32+
"@ngrx/data": "^10.1.2",
33+
"@ngrx/effects": "^10.1.2",
34+
"@ngrx/entity": "^10.1.2",
35+
"@ngrx/store": "^10.1.2",
36+
"@ngrx/store-devtools": "^10.1.2",
3737
"bootstrap": "^4.5.0",
3838
"core-js": "^2.6.11",
39-
"ngx-spinner": "^9.0.2",
40-
"ngx-toastr": "^12.1.0",
39+
"ngx-spinner": "^10.0.1",
40+
"ngx-toastr": "^13.2.1",
4141
"rxjs": "^6.5.4",
4242
"rxjs-compat": "^6.5.4",
43-
"tslib": "^1.10.0",
43+
"tslib": "^2.0.0",
4444
"zone.js": "~0.10.2"
4545
},
4646
"devDependencies": {
47-
"@angular-devkit/build-angular": "~0.901.15",
48-
"@angular/cli": "~9.1.15",
49-
"@angular/compiler-cli": "^9.1.13",
50-
"@angular/language-service": "^9.1.13",
47+
"@angular-devkit/build-angular": "~0.1002.4",
48+
"@angular/cli": "~10.2.4",
49+
"@angular/compiler-cli": "^10.2.5",
50+
"@angular/language-service": "^10.2.5",
5151
"@ngrx/schematics": "^9.2.1",
5252
"@types/jasmine": "^2.8.7",
5353
"@types/jasminewd2": "~2.0.3",
5454
"@types/node": "^12.11.1",
5555
"codelyzer": "^5.1.2",
56-
"jasmine-core": "~2.8.0",
57-
"jasmine-spec-reporter": "~4.2.1",
56+
"jasmine-core": "~3.5.0",
57+
"jasmine-spec-reporter": "~5.0.0",
5858
"json-server": "^0.15.1",
59-
"karma": "~2.0.2",
60-
"karma-chrome-launcher": "~2.2.0",
61-
"karma-coverage-istanbul-reporter": "^1.4.2",
62-
"karma-jasmine": "^1.1.2",
63-
"karma-jasmine-html-reporter": "^0.2.2",
64-
"protractor": "^5.3.2",
59+
"karma": "~5.0.0",
60+
"karma-chrome-launcher": "~3.1.0",
61+
"karma-coverage-istanbul-reporter": "~3.0.2",
62+
"karma-jasmine": "~4.0.0",
63+
"karma-jasmine-html-reporter": "^1.5.0",
64+
"protractor": "~7.0.0",
6565
"ts-node": "~4.1.0",
66-
"tslint": "~5.9.1",
67-
"worker-loader": "^1.1.1",
68-
"typescript": "^3.8.3"
66+
"tslint": "~6.1.0",
67+
"typescript": "^4.0.8",
68+
"worker-loader": "^1.1.1"
6969
}
7070
}

src/angular/src/app/dto/fileup.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export interface Fileup {
2+
nameFile: string;
3+
urlFile: string;
4+
}

src/angular/src/app/files/files.component.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ <h6 class="mb-0 text-white lh-100">Admin</h6>
88
</div>
99
</div>
1010

11-
<app-upload></app-upload>
11+
<div class="row">
12+
<div class="col"><app-list></app-list></div>
13+
<div class="col"><app-upload></app-upload></div>
14+
</div>
15+
1216

1317
</main>

src/angular/src/app/files/files.module.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ import { FilesComponent } from './files.component';
66
import { UploadComponent } from './upload/upload.component';
77
import { ReactiveFormsModule } from '@angular/forms';
88
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
9+
import { ListComponent } from './list/list.component';
910

1011

1112
@NgModule({
12-
declarations: [FilesComponent, UploadComponent],
13+
declarations: [FilesComponent, UploadComponent, ListComponent],
1314
imports: [
1415
CommonModule,
1516
ReactiveFormsModule,
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<ul class="list-group">
2+
<li *ngFor="let file of files$ | async" class="list-group-item d-flex justify-content-between align-items-center">
3+
{{file.nameFile}}
4+
<span class="badge badge-primary badge-pill">14</span>
5+
</li>
6+
</ul>

src/angular/src/app/files/list/list.component.scss

Whitespace-only changes.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { ComponentFixture, TestBed } from '@angular/core/testing';
2+
3+
import { ListComponent } from './list.component';
4+
5+
describe('ListComponent', () => {
6+
let component: ListComponent;
7+
let fixture: ComponentFixture<ListComponent>;
8+
9+
beforeEach(async () => {
10+
await TestBed.configureTestingModule({
11+
declarations: [ ListComponent ]
12+
})
13+
.compileComponents();
14+
});
15+
16+
beforeEach(() => {
17+
fixture = TestBed.createComponent(ListComponent);
18+
component = fixture.componentInstance;
19+
fixture.detectChanges();
20+
});
21+
22+
it('should create', () => {
23+
expect(component).toBeTruthy();
24+
});
25+
});
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import {Component, OnInit} from '@angular/core';
2+
import {FilesService} from "../../services/files.service";
3+
import {Observable} from "rxjs";
4+
import {Fileup} from "../../dto/fileup";
5+
6+
@Component({
7+
selector: 'app-list',
8+
templateUrl: './list.component.html',
9+
styleUrls: ['./list.component.scss']
10+
})
11+
export class ListComponent implements OnInit {
12+
13+
files$: Observable<Fileup[]>;
14+
15+
constructor(
16+
private filesService: FilesService
17+
) { }
18+
19+
ngOnInit(): void {
20+
this.files$ = this.filesService.getFiles();
21+
}
22+
23+
}

src/angular/src/app/files/upload/upload.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ export class UploadComponent implements OnInit {
3030

3131
submitFile() {
3232
this.filesService.postFile(this.fileToUpload).subscribe((flag: any) => {
33-
console.log(flag);
33+
this.toastrservice.info(flag, 'Opération OK');
34+
this.uploadForm.reset();
3435
}, (error) => {
3536
this.toastrservice.error(error.error, 'Error with file upload');
3637
});
Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,27 @@
11
import { Injectable } from '@angular/core';
22
import {HttpClient } from '@angular/common/http';
33
import { Observable } from 'rxjs';
4+
import {Fileup} from "../dto/fileup";
45

56
@Injectable({
67
providedIn: 'root'
78
})
89
export class FilesService {
10+
11+
endpoint = '/upload/';
12+
913
constructor(private httpClient: HttpClient) {}
1014

1115
postFile(fileToUpload: File): Observable<any> {
12-
const endpoint = '/upload/';
16+
1317
const formData: FormData = new FormData();
1418
formData.append('fileUpload', fileToUpload, fileToUpload.name);
1519

16-
return this.httpClient.post(endpoint, formData, { responseType: 'text' });
20+
return this.httpClient.post(this.endpoint, formData, { responseType: 'text' });
1721
}
22+
23+
getFiles(): Observable<Fileup[]> {
24+
return this.httpClient.get<Fileup[]>(this.endpoint);
25+
}
26+
1827
}

src/angular/src/app/services/utils.service.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import { Injectable } from '@angular/core';
22
import { FaIconLibrary } from '@fortawesome/angular-fontawesome';
33
import {
4-
faCheck, faBurn, faCommentAlt, faEdit, faTrash,
5-
faCheckSquare, faSquare, faUpload, faCalendar
4+
faCheck, faTrash, faSquare, faUpload, faCalendar, faFire, faPencil, faCommentDots, faSquareCheck
65
} from '@fortawesome/free-solid-svg-icons';
76

87
@Injectable({
@@ -13,7 +12,7 @@ export class UtilsService {
1312

1413
initIcons(): void {
1514
this.library.addIcons(
16-
faCheck, faBurn, faCommentAlt, faEdit, faTrash, faCheckSquare, faSquare, faUpload, faCalendar
15+
faCheck, faFire, faCommentDots, faPencil, faTrash, faSquareCheck, faSquare, faUpload, faCalendar
1716
);
1817
}
1918
}

src/angular/src/app/todo/todo.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ <h5>Add a Todo : </h5>
66
<form (submit)="addTodo($event)">
77
<div class="form-group">
88
<label for="title">Todo title</label>
9-
<app-fa-input [icon]="'burn'" class="form-control" (value)="onNewValue($event)">
9+
<app-fa-input [icon]="'fire'" class="form-control" (value)="onNewValue($event)">
1010
<input appInputRef type="text" placeholder="Enter todo title" id="title" name="title" [(ngModel)]="todo.title" required aria-describedby="titleHelp">
1111
</app-fa-input>
1212
<small id="titleHelp" class="form-text text-muted">This is the sound of C.</small>
1313
</div>
1414
<div class="form-group">
1515
<label for="title">Todo description</label>
16-
<app-fa-input [icon]="'comment-alt'" class="form-control" (value)="onNewValue($event)">
16+
<app-fa-input [icon]="'comment-dots'" class="form-control" (value)="onNewValue($event)">
1717
<input appInputRef type="text" placeholder="Enter todo description" id="description" name="description" [(ngModel)]="todo.description"
1818
required aria-describedby="descriptionHelp">
1919
</app-fa-input>

src/angular/src/app/todo/todos/todos.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@
3636

3737
<div class="btn-group" role="group" aria-label="Actions">
3838
<button type="button" class="btn btn-outline-secondary" (click)="editTodo(todo.id)">
39-
<fa-icon icon="edit"></fa-icon>
39+
<fa-icon icon="pencil"></fa-icon>
4040
</button>
4141
<button type="button" class="btn btn-outline-secondary" (click)="deleteTodo(todo.id)">
4242
<fa-icon class="text-danger" icon="trash"></fa-icon>
4343
</button>
4444
<button type="button" class="btn btn-outline-secondary" (click)="updateTodo(todo)">
45-
<fa-icon *ngIf="todo.active" class="text-info" icon="check-square"></fa-icon>
45+
<fa-icon *ngIf="todo.active" class="text-info" icon="square-check"></fa-icon>
4646
<fa-icon *ngIf="!todo.active" class="text-secondary" icon="square"></fa-icon>
4747
</button>
4848
</div>

src/angular/src/app/todo/todos/todos.component.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ export class TodosComponent implements OnInit {
3232
}
3333

3434
updateTodo(todo: Todo) {
35-
todo.active = !todo.active;
36-
this.todosService.update(todo);
35+
// can't mutate the object directly
36+
// todo.active = !todo.active;
37+
this.todosService.update({...todo, active: !todo.active});
3738
}
3839

3940
ngOnInit() {

src/angular/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"compileOnSave": false,
33
"compilerOptions": {
44
"downlevelIteration": true,
5-
"module": "esnext",
5+
"module": "es2020",
66
"outDir": "./dist/out-tsc",
77
"sourceMap": true,
88
"declaration": false,

src/angular/tslint.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@
4848
"no-trailing-whitespace": true,
4949
"no-unnecessary-initializer": true,
5050
"no-unused-expression": true,
51-
"no-unused-variable": true,
52-
"no-use-before-declare": true,
5351
"no-var-keyword": true,
5452
"object-literal-sort-keys": false,
5553
"one-line": [

0 commit comments

Comments
 (0)