Compare commits
8
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
44537ddeff | ||
|
|
22af16c9af | ||
|
|
613d95a2e7 | ||
|
|
6fadc81c39 | ||
|
|
824707d7ff | ||
|
|
ab84b0c2e6 | ||
|
|
f33b55b1c8 | ||
|
|
e2fd4fb29a |
@@ -4,7 +4,7 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
- main-debipogi
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -19,7 +19,7 @@ jobs:
|
||||
mkdir -p ~/.ssh
|
||||
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
|
||||
chmod 600 ~/.ssh/id_rsa
|
||||
git clone -b hexagonal-reforged ssh://gitea@gitea.takiguchi.ovh:12960/Codiki/codiki-properties.git --config core.sshCommand='ssh -o StrictHostKeyChecking=no'
|
||||
git clone --branch debipogi ssh://gitea@gitea.takiguchi.ovh:12960/Codiki/codiki-properties.git --config core.sshCommand='ssh -o StrictHostKeyChecking=no'
|
||||
|
||||
- name: 📄 Edit configuration
|
||||
run: |
|
||||
@@ -45,11 +45,11 @@ jobs:
|
||||
|
||||
- name: 📤 Transfer artifacts to remote server
|
||||
env:
|
||||
SSH_PRIVATE_KEY: ${{ secrets.PROD_SSH_PRIVATE_KEY }}
|
||||
REMOTE_USER: ${{ secrets.PROD_REMOTE_USER }}
|
||||
REMOTE_HOST: ${{ secrets.PROD_REMOTE_HOST }}
|
||||
REMOTE_PORT: ${{ secrets.PROD_REMOTE_PORT }}
|
||||
REMOTE_PATH: ${{ secrets.PROD_REMOTE_PATH }}
|
||||
SSH_PRIVATE_KEY: ${{ secrets.D_PROD_SSH_PRIVATE_KEY }}
|
||||
REMOTE_USER: ${{ secrets.D_PROD_REMOTE_USER }}
|
||||
REMOTE_HOST: ${{ secrets.D_PROD_REMOTE_HOST }}
|
||||
REMOTE_PORT: ${{ secrets.D_PROD_REMOTE_PORT }}
|
||||
REMOTE_PATH: ${{ secrets.D_PROD_REMOTE_PATH }}
|
||||
run: |
|
||||
mkdir -p ~/.ssh
|
||||
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
|
||||
@@ -61,15 +61,15 @@ jobs:
|
||||
- name: 🚀 Launch application onto remote server
|
||||
env:
|
||||
SSH_PRIVATE_KEY: ${{ secrets.PROD_SSH_PRIVATE_KEY }}
|
||||
REMOTE_USER: ${{ secrets.PROD_REMOTE_USER }}
|
||||
REMOTE_HOST: ${{ secrets.PROD_REMOTE_HOST }}
|
||||
REMOTE_PORT: ${{ secrets.PROD_REMOTE_PORT }}
|
||||
REMOTE_PATH: ${{ secrets.PROD_REMOTE_PATH }}
|
||||
REMOTE_USER: ${{ secrets.D_PROD_REMOTE_USER }}
|
||||
REMOTE_HOST: ${{ secrets.D_PROD_REMOTE_HOST }}
|
||||
REMOTE_PORT: ${{ secrets.D_PROD_REMOTE_PORT }}
|
||||
REMOTE_PATH: ${{ secrets.D_PROD_REMOTE_PATH }}
|
||||
run: |
|
||||
ssh -o StrictHostKeyChecking=no $REMOTE_HOST -l $REMOTE_USER -p $REMOTE_PORT << EOC
|
||||
cd $REMOTE_PATH
|
||||
sudo /usr/bin/docker load < $REMOTE_PATH/codiki-backend.tar
|
||||
sudo /usr/bin/docker load < $REMOTE_PATH/codiki-frontend.tar
|
||||
sudo /usr/bin/docker compose down
|
||||
sudo /usr/bin/docker compose up --detach
|
||||
sudo /usr/bin/docker compose --file /home/codiki/docker-compose.yml down
|
||||
sudo /usr/bin/docker compose --file /home/codiki/docker-compose.yml up --detach
|
||||
EOC
|
||||
@@ -1,7 +1,7 @@
|
||||
application:
|
||||
pictures:
|
||||
path: /home/florian/Developpement/codiki-hexagonal/backend/pictures-folder/
|
||||
temp-path : /home/florian/Developpement/codiki-hexagonal/backend/pictures-folder/temp/
|
||||
path: /Users/fthierry/Documents/Developpement/codiki-hexagonal/backend/pictures-folder
|
||||
temp-path: /Users/fthierry/Documents/Developpement/codiki-hexagonal/backend/pictures-folder/temp
|
||||
|
||||
logging:
|
||||
level:
|
||||
|
||||
+4
-4
@@ -16,9 +16,9 @@
|
||||
<maven.compiler.source>21</maven.compiler.source>
|
||||
<maven.compiler.target>21</maven.compiler.target>
|
||||
<jakarta.servlet-api.version>6.1.0</jakarta.servlet-api.version>
|
||||
<java-jwt.version>4.5.0</java-jwt.version>
|
||||
<postgresql.version>42.7.8</postgresql.version>
|
||||
<tika-core.version>3.2.3</tika-core.version>
|
||||
<java-jwt.version>4.5.1</java-jwt.version>
|
||||
<postgresql.version>42.7.10</postgresql.version>
|
||||
<tika-core.version>3.3.0</tika-core.version>
|
||||
<commons-lang3.version>3.20.0</commons-lang3.version>
|
||||
</properties>
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-dependencies</artifactId>
|
||||
<version>4.0.1</version>
|
||||
<version>4.0.5</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
|
||||
+2
-2
@@ -12,7 +12,7 @@ services:
|
||||
POSTGRES_PASSWORD: <POSTGRES_PASSWORD>
|
||||
PGDATA: /var/lib/postgresql/data/pgdata
|
||||
volumes:
|
||||
- "./docker/postgresql/pgdata:/var/lib/postgresql/data/pgdata"
|
||||
- "/home/codiki/database:/var/lib/postgresql/data/pgdata"
|
||||
restart: always
|
||||
|
||||
codiki-backend:
|
||||
@@ -23,7 +23,7 @@ services:
|
||||
ports:
|
||||
- "50011:8080"
|
||||
volumes:
|
||||
- "/opt/codiki/pictures:/opt/codiki/pictures"
|
||||
- "/home/codiki/pictures:/opt/codiki/pictures"
|
||||
networks:
|
||||
- "codiki-network"
|
||||
restart: always
|
||||
|
||||
@@ -44,7 +44,7 @@ http {
|
||||
}
|
||||
|
||||
location ~ ^/api {
|
||||
proxy_pass http://192.168.1.153:50011;
|
||||
proxy_pass http://192.168.1.154:50011;
|
||||
proxy_set_header Host $host:$server_port;
|
||||
proxy_set_header X-Forwarded-Host $server_name;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
|
||||
Generated
+2724
-3541
File diff suppressed because it is too large
Load Diff
+19
-19
@@ -17,26 +17,26 @@
|
||||
},
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@angular/animations": "^21.1.2",
|
||||
"@angular/cdk": "^21.1.2",
|
||||
"@angular/common": "^21.1.2",
|
||||
"@angular/compiler": "^21.1.2",
|
||||
"@angular/core": "^21.1.2",
|
||||
"@angular/forms": "^21.1.2",
|
||||
"@angular/material": "^21.1.2",
|
||||
"@angular/platform-browser": "^21.1.2",
|
||||
"@angular/platform-browser-dynamic": "^21.1.2",
|
||||
"@angular/router": "^21.1.2",
|
||||
"rxjs": "~7.8.2",
|
||||
"tslib": "^2.8.1"
|
||||
"@angular/animations": "21.2.10",
|
||||
"@angular/cdk": "21.2.8",
|
||||
"@angular/common": "21.2.10",
|
||||
"@angular/compiler": "21.2.10",
|
||||
"@angular/core": "21.2.10",
|
||||
"@angular/forms": "21.2.10",
|
||||
"@angular/material": "21.2.8",
|
||||
"@angular/platform-browser": "21.2.10",
|
||||
"@angular/platform-browser-dynamic": "21.2.10",
|
||||
"@angular/router": "21.2.10",
|
||||
"rxjs": "7.8.2",
|
||||
"tslib": "2.8.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular/build": "^21.1.2",
|
||||
"@angular/cli": "^21.1.2",
|
||||
"@angular/compiler-cli": "^21.1.2",
|
||||
"@angular/localize": "^21.1.2",
|
||||
"@types/jasmine": "~5.1.15",
|
||||
"jasmine-core": "~5.13.0",
|
||||
"typescript": "~5.9.3"
|
||||
"@angular/build": "21.2.8",
|
||||
"@angular/cli": "21.2.8",
|
||||
"@angular/compiler-cli": "21.2.10",
|
||||
"@angular/localize": "21.2.10",
|
||||
"@types/jasmine": "6.0.0",
|
||||
"jasmine-core": "6.2.0",
|
||||
"typescript": "5.9.3"
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -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 id="category-{{category.id}}" class="category-header" (click)="setOpenned(category)">
|
||||
<div id="category-{{category.id}}" class="category-header" (click)="setOpened(category)">
|
||||
{{ category.name }}
|
||||
<mat-icon>chevron_right</mat-icon>
|
||||
</div>
|
||||
|
||||
+13
-15
@@ -1,8 +1,7 @@
|
||||
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 {DisplayableCategory, SideMenuService} from "../side-menu.service";
|
||||
import {Observable} from "rxjs";
|
||||
import {RouterModule} from "@angular/router";
|
||||
|
||||
@Component({
|
||||
@@ -16,45 +15,44 @@ import {RouterModule} from "@angular/router";
|
||||
styleUrl: './categories-menu.component.scss'
|
||||
})
|
||||
export class CategoriesMenuComponent implements OnInit {
|
||||
private sideMenuService = inject(SideMenuService);
|
||||
@Output()
|
||||
categoryClicked = new EventEmitter<void>();
|
||||
readonly #sideMenuService = inject(SideMenuService);
|
||||
categoryClicked = output<void>();
|
||||
|
||||
ngOnInit(): void {
|
||||
this.sideMenuService.loadCategories();
|
||||
this.#sideMenuService.loadCategories();
|
||||
}
|
||||
|
||||
get categories$(): Observable<DisplayableCategory[]> {
|
||||
return this.sideMenuService.categories$;
|
||||
get categories(): Signal<DisplayableCategory[]> {
|
||||
return this.#sideMenuService.categories;
|
||||
}
|
||||
|
||||
setOpenned(category: DisplayableCategory): void {
|
||||
setOpened(category: DisplayableCategory): void {
|
||||
if (category.isOpenned) {
|
||||
const categoryDiv = document.getElementById(`category-${category.id}`);
|
||||
if (categoryDiv) {
|
||||
this.closeAccordion(categoryDiv);
|
||||
this.#closeAccordion(categoryDiv);
|
||||
}
|
||||
} else {
|
||||
const categoriesDivs = document.getElementsByClassName('category-header');
|
||||
Array.from(categoriesDivs)
|
||||
.map(category => category as HTMLElement)
|
||||
.forEach(categoryDiv => this.closeAccordion(categoryDiv));
|
||||
.forEach(categoryDiv => this.#closeAccordion(categoryDiv));
|
||||
|
||||
const categoryDiv = document.getElementById(`category-${category.id}`);
|
||||
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;
|
||||
divContent.style.maxHeight = '0';
|
||||
}
|
||||
|
||||
private openAccordion(categoryDiv: HTMLElement): void {
|
||||
#openAccordion(categoryDiv: HTMLElement): void {
|
||||
const divContent = categoryDiv?.nextElementSibling as HTMLElement;
|
||||
divContent.style.maxHeight = `${divContent.scrollHeight}px`;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,6 @@
|
||||
</button>
|
||||
</h1>
|
||||
<h2 i18n>Categories</h2>
|
||||
<app-categories-menu (categoryClicked)="close()"></app-categories-menu>
|
||||
<app-categories-menu (categoryClicked)="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 {BehaviorSubject, Observable} from 'rxjs';
|
||||
import {CategoryRestService} from '../../core/rest-services/category/category.rest-service';
|
||||
import {Category} from '../../core/rest-services/category/model/category';
|
||||
|
||||
@@ -20,68 +19,60 @@ export interface DisplayableSubCategory {
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class SideMenuService {
|
||||
private categoryRestService = inject(CategoryRestService);
|
||||
private snackBar = inject(MatSnackBar);
|
||||
private categoriesSubject = new BehaviorSubject<DisplayableCategory[]>([]);
|
||||
private isLoadingSubject = new BehaviorSubject<boolean>(false);
|
||||
private isLoadedSubject = new BehaviorSubject<boolean>(false);
|
||||
readonly #categoryRestService = inject(CategoryRestService);
|
||||
readonly #snackBar = inject(MatSnackBar);
|
||||
#categories = signal<DisplayableCategory[]>([]);
|
||||
#isLoading = signal(false);
|
||||
isLoaded = signal(false);
|
||||
|
||||
private mapToDisplayableCategory(category: Category): DisplayableCategory {
|
||||
#mapToDisplayableCategory(category: Category): DisplayableCategory {
|
||||
return {
|
||||
id: category.id,
|
||||
name: category.name,
|
||||
subCategories: category.subCategories.map(subCategory => this.mapToDisplayableSubCategory(subCategory)),
|
||||
subCategories: category.subCategories.map(subCategory => this.#mapToDisplayableSubCategory(subCategory)),
|
||||
isOpenned: false
|
||||
};
|
||||
}
|
||||
|
||||
private mapToDisplayableSubCategory(subCategory: Category): DisplayableSubCategory {
|
||||
#mapToDisplayableSubCategory(subCategory: Category): DisplayableSubCategory {
|
||||
return {
|
||||
id: subCategory.id,
|
||||
name: subCategory.name
|
||||
}
|
||||
}
|
||||
|
||||
private get categories(): DisplayableCategory[] {
|
||||
return this.categoriesSubject.value;
|
||||
get categories(): Signal<DisplayableCategory[]> {
|
||||
return this.#categories.asReadonly();
|
||||
}
|
||||
|
||||
private save(categories: DisplayableCategory[]): void {
|
||||
this.categoriesSubject.next(categories);
|
||||
}
|
||||
|
||||
get categories$(): Observable<DisplayableCategory[]> {
|
||||
return this.categoriesSubject.asObservable();
|
||||
}
|
||||
|
||||
get isLoading$(): Observable<boolean> {
|
||||
return this.isLoadingSubject.asObservable();
|
||||
get isLoading(): Signal<boolean> {
|
||||
return this.#isLoading.asReadonly();
|
||||
}
|
||||
|
||||
loadCategories(): void {
|
||||
this.isLoadingSubject.next(true);
|
||||
this.isLoadedSubject.next(false);
|
||||
this.#isLoading.set(true);
|
||||
this.isLoaded.set(false);
|
||||
|
||||
this.categoryRestService.getCategories()
|
||||
this.#categoryRestService.getCategories()
|
||||
.then(categories => {
|
||||
const displayableCategories = categories
|
||||
.filter(category => category.subCategories?.length)
|
||||
.map(category => this.mapToDisplayableCategory(category));
|
||||
this.categoriesSubject.next(displayableCategories);
|
||||
.map(category => this.#mapToDisplayableCategory(category));
|
||||
this.#categories.set(displayableCategories);
|
||||
})
|
||||
.catch(error => {
|
||||
const errorMessage = $localize`An error occured while loading categories.`;
|
||||
console.error(errorMessage, error);
|
||||
this.snackBar.open(errorMessage, $localize`Close`, {duration: 5000});
|
||||
this.#snackBar.open(errorMessage, $localize`Close`, {duration: 5000});
|
||||
})
|
||||
.finally(() => {
|
||||
this.isLoadingSubject.next(false);
|
||||
this.isLoadedSubject.next(true);
|
||||
this.#isLoading.set(false);
|
||||
this.isLoaded.set(true);
|
||||
});
|
||||
}
|
||||
|
||||
setOpenned(category: DisplayableCategory): void {
|
||||
const categories = this.categories;
|
||||
setOpened(category: DisplayableCategory): void {
|
||||
const categories = this.#categories();
|
||||
const matchingCategory = categories.find(categoryTemp => categoryTemp.id === category.id);
|
||||
if (matchingCategory) {
|
||||
const actualOpennedCategory = categories.find(category => category.isOpenned);
|
||||
@@ -91,7 +82,7 @@ export class SideMenuService {
|
||||
categories.forEach(categoryTemp => categoryTemp.isOpenned = false);
|
||||
matchingCategory.isOpenned = true;
|
||||
}
|
||||
this.save(categories);
|
||||
this.#categories.set(categories);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user