4 Commits
Author SHA1 Message Date
Florian THIERRY ab84b0c2e6 Update dependencies.
Build and Deploy Java Gradle Application / build-and-deploy (push) Successful in 1m28s
2026-04-23 09:18:35 +02:00
florian f33b55b1c8 Fix left side menu. (#13)
Build and Deploy Java Gradle Application / build-and-deploy (push) Successful in 1m16s
2026-02-03 16:14:43 +01:00
florianandFlorian THIERRY e2fd4fb29a fixing-ci-angular-21 (#12)
Build and Deploy Java Gradle Application / build-and-deploy (push) Successful in 1m18s
Co-authored-by: Florian THIERRY <florian.thierry@actian.com>
Reviewed-on: florian/codiki-hexagonal#12
2026-02-03 15:59:33 +01:00
florian 0cce8b2982 Fixing Angular 21 by migrating all values by signals. (#11)
Build and Deploy Java Gradle Application / build-and-deploy (push) Failing after 53s
2026-02-03 15:07:55 +01:00
8 changed files with 2791 additions and 3619 deletions
@@ -1,7 +1,7 @@
application: application:
pictures: pictures:
path: /home/florian/Developpement/codiki-hexagonal/backend/pictures-folder/ path: /Users/fthierry/Documents/Developpement/codiki-hexagonal/backend/pictures-folder
temp-path : /home/florian/Developpement/codiki-hexagonal/backend/pictures-folder/temp/ temp-path: /Users/fthierry/Documents/Developpement/codiki-hexagonal/backend/pictures-folder/temp
logging: logging:
level: level:
+4 -4
View File
@@ -16,9 +16,9 @@
<maven.compiler.source>21</maven.compiler.source> <maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target> <maven.compiler.target>21</maven.compiler.target>
<jakarta.servlet-api.version>6.1.0</jakarta.servlet-api.version> <jakarta.servlet-api.version>6.1.0</jakarta.servlet-api.version>
<java-jwt.version>4.5.0</java-jwt.version> <java-jwt.version>4.5.1</java-jwt.version>
<postgresql.version>42.7.8</postgresql.version> <postgresql.version>42.7.10</postgresql.version>
<tika-core.version>3.2.3</tika-core.version> <tika-core.version>3.3.0</tika-core.version>
<commons-lang3.version>3.20.0</commons-lang3.version> <commons-lang3.version>3.20.0</commons-lang3.version>
</properties> </properties>
@@ -35,7 +35,7 @@
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId> <artifactId>spring-boot-dependencies</artifactId>
<version>4.0.1</version> <version>4.0.5</version>
<type>pom</type> <type>pom</type>
<scope>import</scope> <scope>import</scope>
</dependency> </dependency>
+2724 -3541
View File
File diff suppressed because it is too large Load Diff
+19 -19
View File
@@ -17,26 +17,26 @@
}, },
"private": true, "private": true,
"dependencies": { "dependencies": {
"@angular/animations": "^21.1.2", "@angular/animations": "21.2.10",
"@angular/cdk": "^21.1.2", "@angular/cdk": "21.2.8",
"@angular/common": "^21.1.2", "@angular/common": "21.2.10",
"@angular/compiler": "^21.1.2", "@angular/compiler": "21.2.10",
"@angular/core": "^21.1.2", "@angular/core": "21.2.10",
"@angular/forms": "^21.1.2", "@angular/forms": "21.2.10",
"@angular/material": "^21.1.2", "@angular/material": "21.2.8",
"@angular/platform-browser": "^21.1.2", "@angular/platform-browser": "21.2.10",
"@angular/platform-browser-dynamic": "^21.1.2", "@angular/platform-browser-dynamic": "21.2.10",
"@angular/router": "^21.1.2", "@angular/router": "21.2.10",
"rxjs": "~7.8.2", "rxjs": "7.8.2",
"tslib": "^2.8.1" "tslib": "2.8.1"
}, },
"devDependencies": { "devDependencies": {
"@angular/build": "^21.1.2", "@angular/build": "21.2.8",
"@angular/cli": "^21.1.2", "@angular/cli": "21.2.8",
"@angular/compiler-cli": "^21.1.2", "@angular/compiler-cli": "21.2.10",
"@angular/localize": "^21.1.2", "@angular/localize": "21.2.10",
"@types/jasmine": "~5.1.15", "@types/jasmine": "6.0.0",
"jasmine-core": "~5.13.0", "jasmine-core": "6.2.0",
"typescript": "~5.9.3" "typescript": "5.9.3"
} }
} }
@@ -1,6 +1,6 @@
@for (category of categories$ | async; track category) { @for (category of categories(); track category.id) {
<div class="category {{category.isOpenned ? 'openned' : ''}}"> <div class="category {{category.isOpenned ? 'openned' : ''}}">
<div id="category-{{category.id}}" class="category-header" (click)="setOpenned(category)"> <div id="category-{{category.id}}" class="category-header" (click)="setOpened(category)">
{{ category.name }} {{ category.name }}
<mat-icon>chevron_right</mat-icon> <mat-icon>chevron_right</mat-icon>
</div> </div>
@@ -1,8 +1,7 @@
import {CommonModule} from "@angular/common"; import {CommonModule} from "@angular/common";
import {Component, EventEmitter, inject, OnInit, Output} from "@angular/core"; import {Component, inject, OnInit, output, Signal} from "@angular/core";
import {MatIconModule} from "@angular/material/icon"; import {MatIconModule} from "@angular/material/icon";
import {DisplayableCategory, SideMenuService} from "../side-menu.service"; import {DisplayableCategory, SideMenuService} from "../side-menu.service";
import {Observable} from "rxjs";
import {RouterModule} from "@angular/router"; import {RouterModule} from "@angular/router";
@Component({ @Component({
@@ -16,45 +15,44 @@ import {RouterModule} from "@angular/router";
styleUrl: './categories-menu.component.scss' styleUrl: './categories-menu.component.scss'
}) })
export class CategoriesMenuComponent implements OnInit { export class CategoriesMenuComponent implements OnInit {
private sideMenuService = inject(SideMenuService); readonly #sideMenuService = inject(SideMenuService);
@Output() categoryClicked = output<void>();
categoryClicked = new EventEmitter<void>();
ngOnInit(): void { ngOnInit(): void {
this.sideMenuService.loadCategories(); this.#sideMenuService.loadCategories();
} }
get categories$(): Observable<DisplayableCategory[]> { get categories(): Signal<DisplayableCategory[]> {
return this.sideMenuService.categories$; return this.#sideMenuService.categories;
} }
setOpenned(category: DisplayableCategory): void { setOpened(category: DisplayableCategory): void {
if (category.isOpenned) { if (category.isOpenned) {
const categoryDiv = document.getElementById(`category-${category.id}`); const categoryDiv = document.getElementById(`category-${category.id}`);
if (categoryDiv) { if (categoryDiv) {
this.closeAccordion(categoryDiv); this.#closeAccordion(categoryDiv);
} }
} else { } else {
const categoriesDivs = document.getElementsByClassName('category-header'); const categoriesDivs = document.getElementsByClassName('category-header');
Array.from(categoriesDivs) Array.from(categoriesDivs)
.map(category => category as HTMLElement) .map(category => category as HTMLElement)
.forEach(categoryDiv => this.closeAccordion(categoryDiv)); .forEach(categoryDiv => this.#closeAccordion(categoryDiv));
const categoryDiv = document.getElementById(`category-${category.id}`); const categoryDiv = document.getElementById(`category-${category.id}`);
if (categoryDiv) { if (categoryDiv) {
this.openAccordion(categoryDiv); this.#openAccordion(categoryDiv);
} }
} }
this.sideMenuService.setOpenned(category); this.#sideMenuService.setOpened(category);
} }
private closeAccordion(categoryDiv: HTMLElement): void { #closeAccordion(categoryDiv: HTMLElement): void {
const divContent = categoryDiv?.nextElementSibling as HTMLElement; const divContent = categoryDiv?.nextElementSibling as HTMLElement;
divContent.style.maxHeight = '0'; divContent.style.maxHeight = '0';
} }
private openAccordion(categoryDiv: HTMLElement): void { #openAccordion(categoryDiv: HTMLElement): void {
const divContent = categoryDiv?.nextElementSibling as HTMLElement; const divContent = categoryDiv?.nextElementSibling as HTMLElement;
divContent.style.maxHeight = `${divContent.scrollHeight}px`; divContent.style.maxHeight = `${divContent.scrollHeight}px`;
} }
@@ -14,6 +14,6 @@
</button> </button>
</h1> </h1>
<h2 i18n>Categories</h2> <h2 i18n>Categories</h2>
<app-categories-menu (categoryClicked)="close()"></app-categories-menu> <app-categories-menu (categoryClicked)="close()"/>
</div> </div>
<div class="overlay {{ isOpened() ? 'displayed' : ''}}" (click)="close()"></div> <div class="overlay {{ isOpened() ? 'displayed' : ''}}" (click)="close()"></div>
@@ -1,6 +1,5 @@
import {inject, Injectable} from '@angular/core'; import {inject, Injectable, Signal, signal} from '@angular/core';
import {MatSnackBar} from '@angular/material/snack-bar'; import {MatSnackBar} from '@angular/material/snack-bar';
import {BehaviorSubject, Observable} from 'rxjs';
import {CategoryRestService} from '../../core/rest-services/category/category.rest-service'; import {CategoryRestService} from '../../core/rest-services/category/category.rest-service';
import {Category} from '../../core/rest-services/category/model/category'; import {Category} from '../../core/rest-services/category/model/category';
@@ -20,68 +19,60 @@ export interface DisplayableSubCategory {
providedIn: 'root' providedIn: 'root'
}) })
export class SideMenuService { export class SideMenuService {
private categoryRestService = inject(CategoryRestService); readonly #categoryRestService = inject(CategoryRestService);
private snackBar = inject(MatSnackBar); readonly #snackBar = inject(MatSnackBar);
private categoriesSubject = new BehaviorSubject<DisplayableCategory[]>([]); #categories = signal<DisplayableCategory[]>([]);
private isLoadingSubject = new BehaviorSubject<boolean>(false); #isLoading = signal(false);
private isLoadedSubject = new BehaviorSubject<boolean>(false); isLoaded = signal(false);
private mapToDisplayableCategory(category: Category): DisplayableCategory { #mapToDisplayableCategory(category: Category): DisplayableCategory {
return { return {
id: category.id, id: category.id,
name: category.name, name: category.name,
subCategories: category.subCategories.map(subCategory => this.mapToDisplayableSubCategory(subCategory)), subCategories: category.subCategories.map(subCategory => this.#mapToDisplayableSubCategory(subCategory)),
isOpenned: false isOpenned: false
}; };
} }
private mapToDisplayableSubCategory(subCategory: Category): DisplayableSubCategory { #mapToDisplayableSubCategory(subCategory: Category): DisplayableSubCategory {
return { return {
id: subCategory.id, id: subCategory.id,
name: subCategory.name name: subCategory.name
} }
} }
private get categories(): DisplayableCategory[] { get categories(): Signal<DisplayableCategory[]> {
return this.categoriesSubject.value; return this.#categories.asReadonly();
} }
private save(categories: DisplayableCategory[]): void { get isLoading(): Signal<boolean> {
this.categoriesSubject.next(categories); return this.#isLoading.asReadonly();
}
get categories$(): Observable<DisplayableCategory[]> {
return this.categoriesSubject.asObservable();
}
get isLoading$(): Observable<boolean> {
return this.isLoadingSubject.asObservable();
} }
loadCategories(): void { loadCategories(): void {
this.isLoadingSubject.next(true); this.#isLoading.set(true);
this.isLoadedSubject.next(false); this.isLoaded.set(false);
this.categoryRestService.getCategories() this.#categoryRestService.getCategories()
.then(categories => { .then(categories => {
const displayableCategories = categories const displayableCategories = categories
.filter(category => category.subCategories?.length) .filter(category => category.subCategories?.length)
.map(category => this.mapToDisplayableCategory(category)); .map(category => this.#mapToDisplayableCategory(category));
this.categoriesSubject.next(displayableCategories); this.#categories.set(displayableCategories);
}) })
.catch(error => { .catch(error => {
const errorMessage = $localize`An error occured while loading categories.`; const errorMessage = $localize`An error occured while loading categories.`;
console.error(errorMessage, error); console.error(errorMessage, error);
this.snackBar.open(errorMessage, $localize`Close`, {duration: 5000}); this.#snackBar.open(errorMessage, $localize`Close`, {duration: 5000});
}) })
.finally(() => { .finally(() => {
this.isLoadingSubject.next(false); this.#isLoading.set(false);
this.isLoadedSubject.next(true); this.isLoaded.set(true);
}); });
} }
setOpenned(category: DisplayableCategory): void { setOpened(category: DisplayableCategory): void {
const categories = this.categories; const categories = this.#categories();
const matchingCategory = categories.find(categoryTemp => categoryTemp.id === category.id); const matchingCategory = categories.find(categoryTemp => categoryTemp.id === category.id);
if (matchingCategory) { if (matchingCategory) {
const actualOpennedCategory = categories.find(category => category.isOpenned); const actualOpennedCategory = categories.find(category => category.isOpenned);
@@ -91,7 +82,7 @@ export class SideMenuService {
categories.forEach(categoryTemp => categoryTemp.isOpenned = false); categories.forEach(categoryTemp => categoryTemp.isOpenned = false);
matchingCategory.isOpenned = true; matchingCategory.isOpenned = true;
} }
this.save(categories); this.#categories.set(categories);
} }
} }
} }