Compare commits
20 Commits
signals-co
...
gradle-set
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9463ad5935 | ||
|
|
55d6a6328f | ||
| 03dd52de71 | |||
|
|
859273a9c1 | ||
| 653536b0da | |||
|
|
5fca5bde55 | ||
|
|
d36fd17690 | ||
|
|
295f977a21 | ||
|
|
1a00d0cd19 | ||
|
|
2da6a58b20 | ||
|
|
0d2883fe2a | ||
|
|
7f99d11209 | ||
|
|
053ac89e3c | ||
|
|
cfca22bf66 | ||
|
|
7c5cc38cff | ||
|
|
dae0a4b78d | ||
|
|
882ffe7094 | ||
|
|
136771ab60 | ||
| 3865c26397 | |||
|
|
26a217cd50 |
75
.gitea/workflows/build-and-deploy.yml
Normal file
75
.gitea/workflows/build-and-deploy.yml
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
name: Build and Deploy Java Gradle Application
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: 📄 Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: 📄 Checkout configuration
|
||||||
|
env:
|
||||||
|
SSH_PRIVATE_KEY: ${{ secrets.PROD_PROPERTIES_SSH_KEY }}
|
||||||
|
run: |
|
||||||
|
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'
|
||||||
|
|
||||||
|
- name: 📄 Edit configuration
|
||||||
|
run: |
|
||||||
|
sed -i "s/<POSTGRES_PASSWORD>/$(cat ./codiki-properties/passwords/postgresql/codiki_user)/g" ./codiki-properties/application-prod.yml
|
||||||
|
cp ./codiki-properties/application-prod.yml ./backend/codiki-launcher/src/main/resources/application.yml
|
||||||
|
sed -i "s/<POSTGRES_ADMIN_PASSWORD>/$(cat ./codiki-properties/passwords/postgresql/codiki_admin)/g" ./docker-compose.yml
|
||||||
|
|
||||||
|
- name: 🔨 Build backend docker image
|
||||||
|
run: |
|
||||||
|
sudo /usr/bin/docker build -t codiki-backend -f ./Dockerfile-backend . --no-cache
|
||||||
|
|
||||||
|
- name: 📦 Extract backend docker image into archive
|
||||||
|
run: |
|
||||||
|
sudo /usr/bin/docker save codiki-backend:latest -o ./codiki-backend.tar
|
||||||
|
|
||||||
|
- name: 🔨 Build frontend docker image
|
||||||
|
run: |
|
||||||
|
sudo /usr/bin/docker build -t codiki-frontend -f ./Dockerfile-frontend . --no-cache
|
||||||
|
|
||||||
|
- name: 📦 Extract frontend docker image into archive
|
||||||
|
run: |
|
||||||
|
sudo /usr/bin/docker save codiki-frontend:latest -o ./codiki-frontend.tar
|
||||||
|
|
||||||
|
- 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 }}
|
||||||
|
run: |
|
||||||
|
mkdir -p ~/.ssh
|
||||||
|
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
|
||||||
|
chmod 600 ~/.ssh/id_rsa
|
||||||
|
scp -o StrictHostKeyChecking=no -P $REMOTE_PORT ./codiki-backend.tar $REMOTE_USER@$REMOTE_HOST:$REMOTE_PATH
|
||||||
|
scp -o StrictHostKeyChecking=no -P $REMOTE_PORT ./codiki-frontend.tar $REMOTE_USER@$REMOTE_HOST:$REMOTE_PATH
|
||||||
|
scp -o StrictHostKeyChecking=no -P $REMOTE_PORT ./docker-compose.yml $REMOTE_USER@$REMOTE_HOST:$REMOTE_PATH
|
||||||
|
|
||||||
|
- 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 }}
|
||||||
|
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
|
||||||
|
EOC
|
||||||
12
.gitignore
vendored
12
.gitignore
vendored
@@ -83,4 +83,14 @@ testem.log
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
Thumbs.db
|
Thumbs.db
|
||||||
|
|
||||||
**/ci/bin/
|
**/ci/bin/
|
||||||
|
|
||||||
|
|
||||||
|
# Linux start script should use lf
|
||||||
|
/gradlew text eol=lf
|
||||||
|
# These are Windows script files and should use crlf
|
||||||
|
*.bat text eol=crlf
|
||||||
|
# Binary files should be left untouched
|
||||||
|
*.jar binary
|
||||||
|
|
||||||
|
**/.gradle
|
||||||
@@ -1,15 +1,16 @@
|
|||||||
FROM maven:3.9.9-eclipse-temurin-21 AS builder
|
FROM gradle:9.0.0-jdk21 AS builder
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY backend/pom.xml /app/
|
COPY backend/gradlew /app/
|
||||||
|
COPY backend/build.gradle.kts /app/
|
||||||
|
COPY backend/settings.gradle.kts /app/
|
||||||
COPY backend/codiki-application /app/codiki-application
|
COPY backend/codiki-application /app/codiki-application
|
||||||
COPY backend/codiki-domain /app/codiki-domain
|
COPY backend/codiki-domain /app/codiki-domain
|
||||||
COPY backend/codiki-exposition /app/codiki-exposition
|
COPY backend/codiki-exposition /app/codiki-exposition
|
||||||
COPY backend/codiki-infrastructure /app/codiki-infrastructure
|
COPY backend/codiki-infrastructure /app/codiki-infrastructure
|
||||||
COPY backend/codiki-launcher /app/codiki-launcher
|
COPY backend/codiki-launcher /app/codiki-launcher
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
RUN mvn clean install -N
|
RUN gradle build jar
|
||||||
RUN mvn clean package
|
|
||||||
|
|
||||||
FROM eclipse-temurin:21-jre-alpine AS final
|
FROM eclipse-temurin:21-jre-alpine AS final
|
||||||
COPY --from=builder /app/codiki-launcher/target/*.jar /app/codiki.jar
|
COPY --from=builder /app/codiki-launcher/build/libs/codiki-launcher.jar /app/codiki.jar
|
||||||
CMD ["java", "-jar", "/app/codiki.jar"]
|
CMD ["java", "-jar", "/app/codiki.jar"]
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
FROM node:22-alpine AS builder
|
FROM node:24-alpine AS builder
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY frontend /app
|
COPY frontend /app
|
||||||
RUN npm install
|
RUN npm install
|
||||||
RUN npm run build-prod-en
|
RUN npm run build-prod-en
|
||||||
RUN npm run build-prod-fr
|
RUN npm run build-prod-fr
|
||||||
|
|
||||||
FROM nginx:1.27-alpine AS final
|
FROM nginx:1.29-alpine AS final
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=builder /app/dist/codiki/en/browser /usr/share/nginx/html/en/
|
COPY --from=builder /app/dist/codiki/en/browser /usr/share/nginx/html/en/
|
||||||
COPY --from=builder /app/dist/codiki/fr/browser/fr /usr/share/nginx/html/fr/
|
COPY --from=builder /app/dist/codiki/fr/browser/fr /usr/share/nginx/html/fr/
|
||||||
|
|||||||
56
backend/build.gradle.kts
Normal file
56
backend/build.gradle.kts
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
plugins {
|
||||||
|
kotlin("jvm") version "2.2.20"
|
||||||
|
kotlin("plugin.spring") version "2.2.20"
|
||||||
|
id("io.spring.dependency-management") version "1.1.7"
|
||||||
|
}
|
||||||
|
|
||||||
|
group = "org.codiki"
|
||||||
|
version = "0.0.1-SNAPSHOT"
|
||||||
|
|
||||||
|
java {
|
||||||
|
toolchain {
|
||||||
|
languageVersion = JavaLanguageVersion.of(21)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
subprojects {
|
||||||
|
apply(plugin = "java")
|
||||||
|
apply(plugin = "org.jetbrains.kotlin.jvm")
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation(platform("org.springframework.boot:spring-boot-dependencies:3.5.5"))
|
||||||
|
compileOnly("org.projectlombok:lombok:1.18.40")
|
||||||
|
annotationProcessor("org.projectlombok:lombok:1.18.40")
|
||||||
|
testImplementation("org.assertj:assertj-core:3.27.4")
|
||||||
|
testImplementation("org.junit.jupiter:junit-jupiter-api")
|
||||||
|
testImplementation("org.junit.jupiter:junit-jupiter-params")
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType<Test> {
|
||||||
|
useJUnitPlatform()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencyManagement {
|
||||||
|
imports {
|
||||||
|
mavenBom("org.springframework.boot:spring-boot-dependencies:3.5.5")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
kotlin {
|
||||||
|
compilerOptions {
|
||||||
|
freeCompilerArgs.addAll("-Xjsr305=strict")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType<Test> {
|
||||||
|
useJUnitPlatform()
|
||||||
|
}
|
||||||
11
backend/codiki-application/build.gradle.kts
Normal file
11
backend/codiki-application/build.gradle.kts
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
plugins {
|
||||||
|
id("io.spring.dependency-management") version "1.1.7"
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation(project(":codiki-domain"))
|
||||||
|
implementation("org.springframework:spring-context")
|
||||||
|
implementation("org.springframework.boot:spring-boot-starter-security")
|
||||||
|
implementation("com.auth0:java-jwt:4.5.0")
|
||||||
|
implementation("org.apache.commons:commons-lang3") //:3.18.0
|
||||||
|
}
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<parent>
|
|
||||||
<groupId>org.codiki</groupId>
|
|
||||||
<artifactId>codiki-parent</artifactId>
|
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
|
||||||
<relativePath/> <!-- lookup parent from repository -->
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<artifactId>codiki-application</artifactId>
|
|
||||||
|
|
||||||
<name>codiki-application</name>
|
|
||||||
<description>Demo project for Spring Boot</description>
|
|
||||||
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.codiki</groupId>
|
|
||||||
<artifactId>codiki-domain</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework</groupId>
|
|
||||||
<artifactId>spring-context</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-security</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.auth0</groupId>
|
|
||||||
<artifactId>java-jwt</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.commons</groupId>
|
|
||||||
<artifactId>commons-lang3</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.junit.jupiter</groupId>
|
|
||||||
<artifactId>junit-jupiter-api</artifactId>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.junit.jupiter</groupId>
|
|
||||||
<artifactId>junit-jupiter-params</artifactId>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.assertj</groupId>
|
|
||||||
<artifactId>assertj-core</artifactId>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<parent>
|
|
||||||
<groupId>org.codiki</groupId>
|
|
||||||
<artifactId>codiki-parent</artifactId>
|
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
|
||||||
<relativePath/> <!-- lookup parent from repository -->
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<artifactId>codiki-domain</artifactId>
|
|
||||||
|
|
||||||
<name>codiki-domain</name>
|
|
||||||
<description>Demo project for Spring Boot</description>
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<configuration>
|
|
||||||
<source>16</source>
|
|
||||||
<target>16</target>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
</project>
|
|
||||||
11
backend/codiki-exposition/build.gradle.kts
Normal file
11
backend/codiki-exposition/build.gradle.kts
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
plugins {
|
||||||
|
id("io.spring.dependency-management") version "1.1.7"
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation(project(":codiki-application"))
|
||||||
|
implementation(project(":codiki-domain"))
|
||||||
|
implementation("org.springframework.boot:spring-boot-starter-web")
|
||||||
|
implementation("org.springframework.boot:spring-boot-starter-security")
|
||||||
|
implementation("org.apache.tika:tika-core:3.2.3")
|
||||||
|
}
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<parent>
|
|
||||||
<groupId>org.codiki</groupId>
|
|
||||||
<artifactId>codiki-parent</artifactId>
|
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
|
||||||
<relativePath/> <!-- lookup parent from repository -->
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<artifactId>codiki-exposition</artifactId>
|
|
||||||
|
|
||||||
<name>codiki-exposition</name>
|
|
||||||
<description>Demo project for Spring Boot</description>
|
|
||||||
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.codiki</groupId>
|
|
||||||
<artifactId>codiki-application</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.projectlombok</groupId>
|
|
||||||
<artifactId>lombok</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.tika</groupId>
|
|
||||||
<artifactId>tika-core</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<!-- <dependency>-->
|
|
||||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
|
||||||
<!-- <artifactId>spring-boot-starter-data-jpa</artifactId>-->
|
|
||||||
<!-- </dependency>-->
|
|
||||||
<!-- <dependency>-->
|
|
||||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
|
||||||
<!-- <artifactId>spring-boot-starter-security</artifactId>-->
|
|
||||||
<!-- </dependency>-->
|
|
||||||
<!-- <dependency>-->
|
|
||||||
<!-- <groupId>org.postgresql</groupId>-->
|
|
||||||
<!-- <artifactId>postgresql</artifactId>-->
|
|
||||||
<!-- <scope>runtime</scope>-->
|
|
||||||
<!-- </dependency>-->
|
|
||||||
<!-- <dependency>-->
|
|
||||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
|
||||||
<!-- <artifactId>spring-boot-starter-test</artifactId>-->
|
|
||||||
<!-- <scope>test</scope>-->
|
|
||||||
<!-- </dependency>-->
|
|
||||||
<!-- <dependency>-->
|
|
||||||
<!-- <groupId>org.springframework.security</groupId>-->
|
|
||||||
<!-- <artifactId>spring-security-test</artifactId>-->
|
|
||||||
<!-- <scope>test</scope>-->
|
|
||||||
<!-- </dependency>-->
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
|
||||||
13
backend/codiki-infrastructure/build.gradle.kts
Normal file
13
backend/codiki-infrastructure/build.gradle.kts
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
plugins {
|
||||||
|
id("io.spring.dependency-management") version "1.1.7"
|
||||||
|
// kotlin("plugin.jpa") version "2.1.20"
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
// implementation(kotlin("stdlib"))
|
||||||
|
implementation(project(":codiki-application"))
|
||||||
|
implementation(project(":codiki-domain"))
|
||||||
|
implementation("org.springframework:spring-context")
|
||||||
|
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
|
||||||
|
implementation("org.postgresql:postgresql:42.7.5")
|
||||||
|
}
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<parent>
|
|
||||||
<groupId>org.codiki</groupId>
|
|
||||||
<artifactId>codiki-parent</artifactId>
|
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
|
||||||
<relativePath/> <!-- lookup parent from repository -->
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<artifactId>codiki-infrastructure</artifactId>
|
|
||||||
|
|
||||||
<name>codiki-infrastructure</name>
|
|
||||||
<description>Demo project for Spring Boot</description>
|
|
||||||
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.codiki</groupId>
|
|
||||||
<artifactId>codiki-domain</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework</groupId>
|
|
||||||
<artifactId>spring-context</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.projectlombok</groupId>
|
|
||||||
<artifactId>lombok</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.postgresql</groupId>
|
|
||||||
<artifactId>postgresql</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.commons</groupId>
|
|
||||||
<artifactId>commons-lang3</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.junit.jupiter</groupId>
|
|
||||||
<artifactId>junit-jupiter-api</artifactId>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.junit.jupiter</groupId>
|
|
||||||
<artifactId>junit-jupiter-params</artifactId>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.assertj</groupId>
|
|
||||||
<artifactId>assertj-core</artifactId>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
|
||||||
17
backend/codiki-launcher/build.gradle.kts
Normal file
17
backend/codiki-launcher/build.gradle.kts
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
plugins {
|
||||||
|
id("org.springframework.boot") version "3.5.5"
|
||||||
|
id("io.spring.dependency-management") version "1.1.7"
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation(project(":codiki-domain"))
|
||||||
|
implementation(project(":codiki-application"))
|
||||||
|
implementation(project(":codiki-infrastructure"))
|
||||||
|
implementation(project(":codiki-exposition"))
|
||||||
|
implementation("org.springframework.boot:spring-boot-starter-web")
|
||||||
|
implementation("org.springframework.boot:spring-boot-devtools")
|
||||||
|
}
|
||||||
|
|
||||||
|
springBoot {
|
||||||
|
mainClass = "org.codiki.launcher.ApplicationLauncher"
|
||||||
|
}
|
||||||
@@ -1,57 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<parent>
|
|
||||||
<groupId>org.codiki</groupId>
|
|
||||||
<artifactId>codiki-parent</artifactId>
|
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
|
||||||
<relativePath/> <!-- lookup parent from repository -->
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<artifactId>codiki-launcher</artifactId>
|
|
||||||
|
|
||||||
<name>codiki-launcher</name>
|
|
||||||
<description>Demo project for Spring Boot</description>
|
|
||||||
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.codiki</groupId>
|
|
||||||
<artifactId>codiki-exposition</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.codiki</groupId>
|
|
||||||
<artifactId>codiki-application</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.codiki</groupId>
|
|
||||||
<artifactId>codiki-domain</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.codiki</groupId>
|
|
||||||
<artifactId>codiki-infrastructure</artifactId>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<goals>
|
|
||||||
<goal>repackage</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
</project>
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
application:
|
application:
|
||||||
pictures:
|
pictures:
|
||||||
path: /home/florian/Developpement/codiki-hexagonal/backend/pictures-folder/
|
path: /Users/florian/Documents/Developpement/codiki-hexagonal/backend/pictures-folder/
|
||||||
temp-path : /home/florian/Developpement/codiki-hexagonal/backend/pictures-folder/temp/
|
temp-path : /Users/florian/Documents/Developpement/codiki-hexagonal/backend/pictures-folder/temp/
|
||||||
|
|
||||||
logging:
|
logging:
|
||||||
level:
|
level:
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ version: '3.9'
|
|||||||
services:
|
services:
|
||||||
codiki-database:
|
codiki-database:
|
||||||
container_name: "codiki-database"
|
container_name: "codiki-database"
|
||||||
image: "postgres:16"
|
image: "postgres:17"
|
||||||
ports:
|
ports:
|
||||||
- "50001:5432"
|
- "50001:5432"
|
||||||
networks:
|
networks:
|
||||||
|
|||||||
251
backend/gradlew
vendored
Executable file
251
backend/gradlew
vendored
Executable file
@@ -0,0 +1,251 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright © 2015 the original authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# Gradle start up script for POSIX generated by Gradle.
|
||||||
|
#
|
||||||
|
# Important for running:
|
||||||
|
#
|
||||||
|
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||||
|
# noncompliant, but you have some other compliant shell such as ksh or
|
||||||
|
# bash, then to run this script, type that shell name before the whole
|
||||||
|
# command line, like:
|
||||||
|
#
|
||||||
|
# ksh Gradle
|
||||||
|
#
|
||||||
|
# Busybox and similar reduced shells will NOT work, because this script
|
||||||
|
# requires all of these POSIX shell features:
|
||||||
|
# * functions;
|
||||||
|
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||||
|
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||||
|
# * compound commands having a testable exit status, especially «case»;
|
||||||
|
# * various built-in commands including «command», «set», and «ulimit».
|
||||||
|
#
|
||||||
|
# Important for patching:
|
||||||
|
#
|
||||||
|
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||||
|
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||||
|
#
|
||||||
|
# The "traditional" practice of packing multiple parameters into a
|
||||||
|
# space-separated string is a well documented source of bugs and security
|
||||||
|
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||||
|
# options in "$@", and eventually passing that to Java.
|
||||||
|
#
|
||||||
|
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||||
|
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||||
|
# see the in-line comments for details.
|
||||||
|
#
|
||||||
|
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||||
|
# Darwin, MinGW, and NonStop.
|
||||||
|
#
|
||||||
|
# (3) This script is generated from the Groovy template
|
||||||
|
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
|
# within the Gradle project.
|
||||||
|
#
|
||||||
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
app_path=$0
|
||||||
|
|
||||||
|
# Need this for daisy-chained symlinks.
|
||||||
|
while
|
||||||
|
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||||
|
[ -h "$app_path" ]
|
||||||
|
do
|
||||||
|
ls=$( ls -ld "$app_path" )
|
||||||
|
link=${ls#*' -> '}
|
||||||
|
case $link in #(
|
||||||
|
/*) app_path=$link ;; #(
|
||||||
|
*) app_path=$APP_HOME$link ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# This is normally unused
|
||||||
|
# shellcheck disable=SC2034
|
||||||
|
APP_BASE_NAME=${0##*/}
|
||||||
|
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||||
|
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD=maximum
|
||||||
|
|
||||||
|
warn () {
|
||||||
|
echo "$*"
|
||||||
|
} >&2
|
||||||
|
|
||||||
|
die () {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
} >&2
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
nonstop=false
|
||||||
|
case "$( uname )" in #(
|
||||||
|
CYGWIN* ) cygwin=true ;; #(
|
||||||
|
Darwin* ) darwin=true ;; #(
|
||||||
|
MSYS* | MINGW* ) msys=true ;; #(
|
||||||
|
NONSTOP* ) nonstop=true ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
CLASSPATH="\\\"\\\""
|
||||||
|
|
||||||
|
|
||||||
|
# Determine the Java command to use to start the JVM.
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||||
|
else
|
||||||
|
JAVACMD=$JAVA_HOME/bin/java
|
||||||
|
fi
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD=java
|
||||||
|
if ! command -v java >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can.
|
||||||
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
|
case $MAX_FD in #(
|
||||||
|
max*)
|
||||||
|
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||||
|
# shellcheck disable=SC2039,SC3045
|
||||||
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
|
warn "Could not query maximum file descriptor limit"
|
||||||
|
esac
|
||||||
|
case $MAX_FD in #(
|
||||||
|
'' | soft) :;; #(
|
||||||
|
*)
|
||||||
|
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||||
|
# shellcheck disable=SC2039,SC3045
|
||||||
|
ulimit -n "$MAX_FD" ||
|
||||||
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Collect all arguments for the java command, stacking in reverse order:
|
||||||
|
# * args from the command line
|
||||||
|
# * the main class name
|
||||||
|
# * -classpath
|
||||||
|
# * -D...appname settings
|
||||||
|
# * --module-path (only if needed)
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||||
|
|
||||||
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
|
if "$cygwin" || "$msys" ; then
|
||||||
|
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||||
|
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||||
|
|
||||||
|
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||||
|
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
for arg do
|
||||||
|
if
|
||||||
|
case $arg in #(
|
||||||
|
-*) false ;; # don't mess with options #(
|
||||||
|
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||||
|
[ -e "$t" ] ;; #(
|
||||||
|
*) false ;;
|
||||||
|
esac
|
||||||
|
then
|
||||||
|
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||||
|
fi
|
||||||
|
# Roll the args list around exactly as many times as the number of
|
||||||
|
# args, so each arg winds up back in the position where it started, but
|
||||||
|
# possibly modified.
|
||||||
|
#
|
||||||
|
# NB: a `for` loop captures its iteration list before it begins, so
|
||||||
|
# changing the positional parameters here affects neither the number of
|
||||||
|
# iterations, nor the values presented in `arg`.
|
||||||
|
shift # remove old arg
|
||||||
|
set -- "$@" "$arg" # push replacement arg
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
|
# Collect all arguments for the java command:
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||||
|
# and any embedded shellness will be escaped.
|
||||||
|
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||||
|
# treated as '${Hostname}' itself on the command line.
|
||||||
|
|
||||||
|
set -- \
|
||||||
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
-classpath "$CLASSPATH" \
|
||||||
|
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||||
|
"$@"
|
||||||
|
|
||||||
|
# Stop when "xargs" is not available.
|
||||||
|
if ! command -v xargs >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "xargs is not available"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Use "xargs" to parse quoted args.
|
||||||
|
#
|
||||||
|
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||||
|
#
|
||||||
|
# In Bash we could simply go:
|
||||||
|
#
|
||||||
|
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||||
|
# set -- "${ARGS[@]}" "$@"
|
||||||
|
#
|
||||||
|
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||||
|
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||||
|
# character that might be a shell metacharacter, then use eval to reverse
|
||||||
|
# that process (while maintaining the separation between arguments), and wrap
|
||||||
|
# the whole thing up as a single "set" statement.
|
||||||
|
#
|
||||||
|
# This will of course break if any of these variables contains a newline or
|
||||||
|
# an unmatched quote.
|
||||||
|
#
|
||||||
|
|
||||||
|
eval "set -- $(
|
||||||
|
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||||
|
xargs -n1 |
|
||||||
|
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||||
|
tr '\n' ' '
|
||||||
|
)" '"$@"'
|
||||||
|
|
||||||
|
exec "$JAVACMD" "$@"
|
||||||
94
backend/gradlew.bat
vendored
Normal file
94
backend/gradlew.bat
vendored
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
@rem
|
||||||
|
@rem Copyright 2015 the original author or authors.
|
||||||
|
@rem
|
||||||
|
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@rem you may not use this file except in compliance with the License.
|
||||||
|
@rem You may obtain a copy of the License at
|
||||||
|
@rem
|
||||||
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
@rem
|
||||||
|
@rem Unless required by applicable law or agreed to in writing, software
|
||||||
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@rem See the License for the specific language governing permissions and
|
||||||
|
@rem limitations under the License.
|
||||||
|
@rem
|
||||||
|
@rem SPDX-License-Identifier: Apache-2.0
|
||||||
|
@rem
|
||||||
|
|
||||||
|
@if "%DEBUG%"=="" @echo off
|
||||||
|
@rem ##########################################################################
|
||||||
|
@rem
|
||||||
|
@rem Gradle startup script for Windows
|
||||||
|
@rem
|
||||||
|
@rem ##########################################################################
|
||||||
|
|
||||||
|
@rem Set local scope for the variables with windows NT shell
|
||||||
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%"=="" set DIRNAME=.
|
||||||
|
@rem This is normally unused
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
|
|
||||||
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
|
@rem Find java.exe
|
||||||
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
|
set JAVA_EXE=java.exe
|
||||||
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
|
if %ERRORLEVEL% equ 0 goto execute
|
||||||
|
|
||||||
|
echo. 1>&2
|
||||||
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||||
|
echo. 1>&2
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:findJavaFromJavaHome
|
||||||
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
|
echo. 1>&2
|
||||||
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||||
|
echo. 1>&2
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:execute
|
||||||
|
@rem Setup the command line
|
||||||
|
|
||||||
|
set CLASSPATH=
|
||||||
|
|
||||||
|
|
||||||
|
@rem Execute Gradle
|
||||||
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
||||||
|
|
||||||
|
:end
|
||||||
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||||
|
|
||||||
|
:fail
|
||||||
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
|
rem the _cmd.exe /c_ return code!
|
||||||
|
set EXIT_CODE=%ERRORLEVEL%
|
||||||
|
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||||
|
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||||
|
exit /b %EXIT_CODE%
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
||||||
100
backend/pom.xml
100
backend/pom.xml
@@ -1,100 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<groupId>org.codiki</groupId>
|
|
||||||
<artifactId>codiki-parent</artifactId>
|
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
|
||||||
|
|
||||||
<packaging>pom</packaging>
|
|
||||||
|
|
||||||
<name>codiki</name>
|
|
||||||
|
|
||||||
<properties>
|
|
||||||
<java.version>21</java.version>
|
|
||||||
<maven.compiler.source>21</maven.compiler.source>
|
|
||||||
<maven.compiler.target>21</maven.compiler.target>
|
|
||||||
<jakarta.servlet-api.version>6.0.0</jakarta.servlet-api.version>
|
|
||||||
<java-jwt.version>4.4.0</java-jwt.version>
|
|
||||||
<postgresql.version>42.7.0</postgresql.version>
|
|
||||||
<tika-core.version>2.9.0</tika-core.version>
|
|
||||||
<commons-lang3.version>3.14.0</commons-lang3.version>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
<modules>
|
|
||||||
<module>codiki-domain</module>
|
|
||||||
<module>codiki-application</module>
|
|
||||||
<module>codiki-infrastructure</module>
|
|
||||||
<module>codiki-exposition</module>
|
|
||||||
<module>codiki-launcher</module>
|
|
||||||
</modules>
|
|
||||||
|
|
||||||
<dependencyManagement>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-dependencies</artifactId>
|
|
||||||
<version>3.2.0</version>
|
|
||||||
<type>pom</type>
|
|
||||||
<scope>import</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.codiki</groupId>
|
|
||||||
<artifactId>codiki-exposition</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.codiki</groupId>
|
|
||||||
<artifactId>codiki-application</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.codiki</groupId>
|
|
||||||
<artifactId>codiki-domain</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.codiki</groupId>
|
|
||||||
<artifactId>codiki-infrastructure</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>jakarta.servlet</groupId>
|
|
||||||
<artifactId>jakarta.servlet-api</artifactId>
|
|
||||||
<version>${jakarta.servlet-api.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.auth0</groupId>
|
|
||||||
<artifactId>java-jwt</artifactId>
|
|
||||||
<version>${java-jwt.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.postgresql</groupId>
|
|
||||||
<artifactId>postgresql</artifactId>
|
|
||||||
<version>${postgresql.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.tika</groupId>
|
|
||||||
<artifactId>tika-core</artifactId>
|
|
||||||
<version>${tika-core.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.commons</groupId>
|
|
||||||
<artifactId>commons-lang3</artifactId>
|
|
||||||
<version>${commons-lang3.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
|
|
||||||
</dependencies>
|
|
||||||
</dependencyManagement>
|
|
||||||
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
</project>
|
|
||||||
2
backend/settings.gradle.kts
Normal file
2
backend/settings.gradle.kts
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
rootProject.name = "codiki-backend"
|
||||||
|
include("codiki-domain", "codiki-application", "codiki-exposition", "codiki-infrastructure", "codiki-launcher")
|
||||||
@@ -44,7 +44,7 @@ http {
|
|||||||
}
|
}
|
||||||
|
|
||||||
location ~ ^/api {
|
location ~ ^/api {
|
||||||
proxy_pass http://192.168.0.153:50011;
|
proxy_pass http://192.168.1.153:50011;
|
||||||
proxy_set_header Host $host:$server_port;
|
proxy_set_header Host $host:$server_port;
|
||||||
proxy_set_header X-Forwarded-Host $server_name;
|
proxy_set_header X-Forwarded-Host $server_name;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
import { ApplicationConfig, provideExperimentalZonelessChangeDetection } from '@angular/core';
|
import { APP_INITIALIZER, ApplicationConfig } from '@angular/core';
|
||||||
import { provideRouter, withRouterConfig } from '@angular/router';
|
import { provideRouter, withRouterConfig } from '@angular/router';
|
||||||
|
|
||||||
import { HTTP_INTERCEPTORS, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
|
import { HTTP_INTERCEPTORS, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
|
||||||
import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';
|
import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';
|
||||||
import { routes } from './app.routes';
|
import { routes } from './app.routes';
|
||||||
import { JwtInterceptor } from './core/interceptor/jwt.interceptor';
|
import { JwtInterceptor } from './core/interceptor/jwt.interceptor';
|
||||||
|
import { AuthenticationService } from './core/service/authentication.service';
|
||||||
|
|
||||||
export const appConfig: ApplicationConfig = {
|
export const appConfig: ApplicationConfig = {
|
||||||
providers: [
|
providers: [
|
||||||
@@ -16,9 +17,13 @@ export const appConfig: ApplicationConfig = {
|
|||||||
})
|
})
|
||||||
),
|
),
|
||||||
provideAnimationsAsync(),
|
provideAnimationsAsync(),
|
||||||
provideExperimentalZonelessChangeDetection(),
|
|
||||||
provideHttpClient(withInterceptorsFromDi()),
|
provideHttpClient(withInterceptorsFromDi()),
|
||||||
|
|
||||||
{ provide: HTTP_INTERCEPTORS, useClass: JwtInterceptor, multi: true },
|
{ provide: HTTP_INTERCEPTORS, useClass: JwtInterceptor, multi: true },
|
||||||
|
{
|
||||||
|
provide: APP_INITIALIZER,
|
||||||
|
useFactory: (authenticationService: AuthenticationService) => () => authenticationService.startAuthenticationCheckingProcess(),
|
||||||
|
deps: [AuthenticationService],
|
||||||
|
multi: true
|
||||||
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,13 +1,16 @@
|
|||||||
import { Routes } from '@angular/router';
|
import { Routes } from '@angular/router';
|
||||||
|
import { alreadyAuthenticatedGuard } from './core/guard/already-authenticated.guard';
|
||||||
|
|
||||||
export const routes: Routes = [
|
export const routes: Routes = [
|
||||||
{
|
{
|
||||||
path: 'login',
|
path: 'login',
|
||||||
loadComponent: () => import('./pages/login/login.component').then(module => module.LoginComponent)
|
loadComponent: () => import('./pages/login/login.component').then(module => module.LoginComponent),
|
||||||
|
canActivate: [alreadyAuthenticatedGuard]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'signin',
|
path: 'signin',
|
||||||
loadComponent: () => import('./pages/signin/signin.component').then(module => module.SigninComponent)
|
loadComponent: () => import('./pages/signin/signin.component').then(module => module.SigninComponent),
|
||||||
|
canActivate: [alreadyAuthenticatedGuard]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'disconnect',
|
path: 'disconnect',
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
<h1>{{title}}</h1>
|
<h1>{{title}}</h1>
|
||||||
<h2>{{description}}</h2>
|
<h2>{{description}}</h2>
|
||||||
<footer>
|
<footer>
|
||||||
<button type="button" class="secondary" (click)="closeDialog()" i18n>
|
<button type="button" class="cod-button secondary" (click)="closeDialog()" matRipple i18n>
|
||||||
No
|
No
|
||||||
</button>
|
</button>
|
||||||
<button type="button" (click)="closeAndValidate()" i18n>
|
<button type="button" class="cod-button" (click)="closeAndValidate()" matRipple i18n>
|
||||||
Yes
|
Yes
|
||||||
</button>
|
</button>
|
||||||
</footer>
|
</footer>
|
||||||
@@ -8,32 +8,5 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
|
||||||
button {
|
|
||||||
padding: .8em 1.2em;
|
|
||||||
border-radius: 10em;
|
|
||||||
border: none;
|
|
||||||
background-color: #3f51b5;
|
|
||||||
color: white;
|
|
||||||
transition: background-color .2s ease-in-out;
|
|
||||||
cursor: pointer;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
background-color: #5b6ed8;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.secondary {
|
|
||||||
color: #3f51b5;
|
|
||||||
background-color: white;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
background-color: #f2f4ff;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import { Component, inject, Input } from "@angular/core";
|
import { Component, inject, Input } from "@angular/core";
|
||||||
|
import { MatRippleModule } from "@angular/material/core";
|
||||||
import { MAT_DIALOG_DATA, MatDialogRef } from "@angular/material/dialog";
|
import { MAT_DIALOG_DATA, MatDialogRef } from "@angular/material/dialog";
|
||||||
|
|
||||||
export interface ConfirmationDialogData {
|
export interface ConfirmationDialogData {
|
||||||
@@ -11,7 +12,7 @@ export interface ConfirmationDialogData {
|
|||||||
standalone: true,
|
standalone: true,
|
||||||
templateUrl: './confirmation-dialog.component.html',
|
templateUrl: './confirmation-dialog.component.html',
|
||||||
styleUrl: './confirmation-dialog.component.scss',
|
styleUrl: './confirmation-dialog.component.scss',
|
||||||
imports: []
|
imports: [MatRippleModule]
|
||||||
})
|
})
|
||||||
export class ConfirmationDialog {
|
export class ConfirmationDialog {
|
||||||
private readonly dialogRef = inject(MatDialogRef<ConfirmationDialog>);
|
private readonly dialogRef = inject(MatDialogRef<ConfirmationDialog>);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<span class="copy-left">©</span>
|
<span class="copy-left">©</span>
|
||||||
2016 - 2024 All rights reserved
|
2016 - 2024 All rights reserved
|
||||||
-
|
-
|
||||||
2.0-alpha
|
2.1
|
||||||
<a [routerLink]="['./']" matTooltip="Health checking will be available in future..." i18n-matTooltip>
|
<a [routerLink]="['./']" matTooltip="Health checking will be available in future..." i18n-matTooltip>
|
||||||
<mat-icon>favorite</mat-icon>
|
<mat-icon>favorite</mat-icon>
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
<div class="left">
|
<div class="left">
|
||||||
<button type="button" (click)="sideMenu.open()" matTooltip="Click to show side menu" i18n-matTooltip>
|
<button type="button"
|
||||||
|
(click)="sideMenu.open()"
|
||||||
|
class="cod-button icon"
|
||||||
|
matTooltip="Click to show side menu"
|
||||||
|
matRipple
|
||||||
|
i18n-matTooltip>
|
||||||
<mat-icon>menu</mat-icon>
|
<mat-icon>menu</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
<a [routerLink]="['/home']">
|
<a [routerLink]="['/home']">
|
||||||
@@ -14,7 +19,10 @@
|
|||||||
|
|
||||||
<div class="right">
|
<div class="right">
|
||||||
@if (isAuthenticated) {
|
@if (isAuthenticated) {
|
||||||
<button mat-button class="button" [matMenuTriggerFor]="authenticatedUserMenu">
|
<button type="button"
|
||||||
|
class="cod-button icon"
|
||||||
|
[matMenuTriggerFor]="authenticatedUserMenu"
|
||||||
|
matRipple>
|
||||||
<mat-icon>more_vert</mat-icon>
|
<mat-icon>more_vert</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
<mat-menu #authenticatedUserMenu="matMenu">
|
<mat-menu #authenticatedUserMenu="matMenu">
|
||||||
@@ -30,7 +38,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</mat-menu>
|
</mat-menu>
|
||||||
} @else {
|
} @else {
|
||||||
<a [routerLink]="['/login']" class="button" matRipple i18n>Login</a>
|
<a [routerLink]="['/login']" class="cod-button" matRipple i18n>Login</a>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
<app-side-menu #sideMenu></app-side-menu>
|
<app-side-menu #sideMenu></app-side-menu>
|
||||||
@@ -26,25 +26,6 @@ $headerHeight: 3.5em;
|
|||||||
padding: 0 1em;
|
padding: 0 1em;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
|
|
||||||
button {
|
|
||||||
background-color: #3f51b5;
|
|
||||||
color: white;
|
|
||||||
border: none;
|
|
||||||
border-radius: 10em;
|
|
||||||
transition: background-color .2s ease-in-out;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
$buttonSize: 2.5em;
|
|
||||||
width: $buttonSize;
|
|
||||||
height: $buttonSize;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
cursor: pointer;
|
|
||||||
background-color: #5c6bc0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
a {
|
a {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
@@ -120,45 +101,10 @@ $headerHeight: 3.5em;
|
|||||||
top: 0;
|
top: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
|
margin-right: .5em;
|
||||||
a {
|
|
||||||
display: flex;
|
a, button {
|
||||||
justify-content: center;
|
margin: .5em;
|
||||||
align-items: center;
|
|
||||||
min-width: 5em;
|
|
||||||
color: white;
|
|
||||||
margin: 0.5em 0.5em;
|
|
||||||
border-radius: 10em;
|
|
||||||
text-decoration: none;
|
|
||||||
padding: 0 .8em;
|
|
||||||
background-color: #3f51b5;
|
|
||||||
transition: background-color .2s ease-in-out;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
background-color: #5c6bc0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
button {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
min-width: 2.5em;
|
|
||||||
color: white;
|
|
||||||
margin: 0.5em 0.5em;
|
|
||||||
border-radius: 10em;
|
|
||||||
text-decoration: none;
|
|
||||||
padding: 0;
|
|
||||||
background-color: #3f51b5;
|
|
||||||
transition: background-color .2s ease-in-out;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
background-color: #5c6bc0;
|
|
||||||
}
|
|
||||||
|
|
||||||
mat-icon {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,15 @@
|
|||||||
<button type="button" class="close" (click)="closeDialog()">
|
<button type="button"
|
||||||
|
(click)="closeDialog()"
|
||||||
|
class="cod-button icon secondary close"
|
||||||
|
matTooltip="Close"
|
||||||
|
matRipple
|
||||||
|
i18n-matTooltip>
|
||||||
<mat-icon>close</mat-icon>
|
<mat-icon>close</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
<header>
|
<header>
|
||||||
<h1 i18n>Add a code block</h1>
|
<h1 i18n>Add a code block</h1>
|
||||||
</header>
|
</header>
|
||||||
<form [formGroup]="formGroup" (submit)="closeAndValidate()" ngNativeValidate>
|
<form [formGroup]="formGroup" (submit)="closeAndValidate()" class="cod-form" ngNativeValidate>
|
||||||
<div class="form-content">
|
<div class="form-content">
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<mat-label i18n>Programming language</mat-label>
|
<mat-label i18n>Programming language</mat-label>
|
||||||
@@ -21,11 +26,11 @@
|
|||||||
<textarea matInput formControlName="codeBlock"></textarea>
|
<textarea matInput formControlName="codeBlock"></textarea>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
<div class="actions">
|
<div class="actions reversed">
|
||||||
<button type="submit" i18n>
|
<button type="submit" class="cod-button" matRipple i18n>
|
||||||
Validate
|
Validate
|
||||||
</button>
|
</button>
|
||||||
<button type="button" (click)="closeDialog()" class="secondary" i18n>
|
<button type="button" (click)="closeDialog()" class="cod-button secondary" matRipple i18n>
|
||||||
Cancel
|
Cancel
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -6,20 +6,6 @@
|
|||||||
position: relative;
|
position: relative;
|
||||||
max-height: 90vh;
|
max-height: 90vh;
|
||||||
|
|
||||||
.close {
|
|
||||||
position: absolute;
|
|
||||||
top: 1em;
|
|
||||||
right: 1em;
|
|
||||||
width: 2.5em;
|
|
||||||
height: 2.5em;
|
|
||||||
border-radius: 10em;
|
|
||||||
border: none;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
header {
|
header {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -39,40 +25,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.actions {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row-reverse;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
button {
|
|
||||||
padding: .8em 1.2em;
|
|
||||||
border-radius: 10em;
|
|
||||||
border: none;
|
|
||||||
background-color: #3f51b5;
|
|
||||||
color: white;
|
|
||||||
transition: background-color .2s ease-in-out;
|
|
||||||
cursor: pointer;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
background-color: #5b6ed8;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.secondary {
|
|
||||||
color: #3f51b5;
|
|
||||||
background-color: white;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
background-color: #f2f4ff;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,12 @@
|
|||||||
import { Component, inject } from "@angular/core";
|
import { Component, inject } from "@angular/core";
|
||||||
import { FormBuilder, FormControl, ReactiveFormsModule, Validators } from "@angular/forms";
|
import { FormBuilder, FormControl, ReactiveFormsModule, Validators } from "@angular/forms";
|
||||||
|
import { MatRippleModule } from "@angular/material/core";
|
||||||
import { MatDialogRef } from "@angular/material/dialog";
|
import { MatDialogRef } from "@angular/material/dialog";
|
||||||
import { MatFormFieldModule } from "@angular/material/form-field";
|
import { MatFormFieldModule } from "@angular/material/form-field";
|
||||||
import { MatIcon } from "@angular/material/icon";
|
import { MatIcon } from "@angular/material/icon";
|
||||||
import { MatInputModule } from "@angular/material/input";
|
import { MatInputModule } from "@angular/material/input";
|
||||||
import { MatSelectModule } from '@angular/material/select';
|
import { MatSelectModule } from '@angular/material/select';
|
||||||
|
import { MatTooltip } from "@angular/material/tooltip";
|
||||||
|
|
||||||
export interface ProgramingLanguage {
|
export interface ProgramingLanguage {
|
||||||
code: string;
|
code: string;
|
||||||
@@ -91,7 +93,9 @@ export const PROGRAMMING_LANGUAGES: ProgramingLanguage[] = [
|
|||||||
MatFormFieldModule,
|
MatFormFieldModule,
|
||||||
MatIcon,
|
MatIcon,
|
||||||
MatInputModule,
|
MatInputModule,
|
||||||
|
MatRippleModule,
|
||||||
MatSelectModule,
|
MatSelectModule,
|
||||||
|
MatTooltip,
|
||||||
ReactiveFormsModule,
|
ReactiveFormsModule,
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,4 +1,9 @@
|
|||||||
<button type="button" class="close" (click)="closeDialog()">
|
<button type="button"
|
||||||
|
(click)="closeDialog()"
|
||||||
|
class="cod-button icon secondary close"
|
||||||
|
matTooltip="Close"
|
||||||
|
matRipple
|
||||||
|
i18n-matTooltip>
|
||||||
<mat-icon>close</mat-icon>
|
<mat-icon>close</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
<header>
|
<header>
|
||||||
@@ -19,10 +24,18 @@
|
|||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
<footer>
|
<footer>
|
||||||
<button type="button" class="secondary" matRipple (click)="closeDialog()" i18n>
|
<button type="button"
|
||||||
|
(click)="closeDialog()"
|
||||||
|
class="cod-button secondary"
|
||||||
|
matRipple
|
||||||
|
i18n>
|
||||||
Cancel
|
Cancel
|
||||||
</button>
|
</button>
|
||||||
<button type="button" (click)="fileUpload.click()" matRipple i18n>
|
<button type="button"
|
||||||
|
(click)="fileUpload.click()"
|
||||||
|
class="cod-button"
|
||||||
|
matRipple
|
||||||
|
i18n>
|
||||||
<mat-icon>upload_file</mat-icon>
|
<mat-icon>upload_file</mat-icon>
|
||||||
Add new picture
|
Add new picture
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -6,20 +6,6 @@
|
|||||||
position: relative;
|
position: relative;
|
||||||
max-height: 90vh;
|
max-height: 90vh;
|
||||||
|
|
||||||
.close {
|
|
||||||
position: absolute;
|
|
||||||
top: 1em;
|
|
||||||
right: 1em;
|
|
||||||
width: 2.5em;
|
|
||||||
height: 2.5em;
|
|
||||||
border-radius: 10em;
|
|
||||||
border: none;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
header {
|
header {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -11,9 +11,14 @@ import { MatTooltip } from "@angular/material/tooltip";
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'app-picture-selection',
|
selector: 'app-picture-selection',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [MatProgressSpinnerModule, MatIcon, MatRippleModule, MatTooltip],
|
|
||||||
templateUrl: './picture-selection-dialog.component.html',
|
templateUrl: './picture-selection-dialog.component.html',
|
||||||
styleUrl: './picture-selection-dialog.component.scss',
|
styleUrl: './picture-selection-dialog.component.scss',
|
||||||
|
imports: [
|
||||||
|
MatIcon,
|
||||||
|
MatRippleModule,
|
||||||
|
MatProgressSpinnerModule,
|
||||||
|
MatTooltip
|
||||||
|
],
|
||||||
})
|
})
|
||||||
export class PictureSelectionDialog implements OnInit {
|
export class PictureSelectionDialog implements OnInit {
|
||||||
private readonly pictureRestService = inject(PictureRestService);
|
private readonly pictureRestService = inject(PictureRestService);
|
||||||
|
|||||||
@@ -37,25 +37,53 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
<button type="button" matTooltip="Click to insert a title 1 section" (click)="insertTitle(1)" i18n-matTooltip>
|
<button type="button"
|
||||||
|
(click)="insertTitle(1)"
|
||||||
|
matTooltip="Click to insert a title 1 section"
|
||||||
|
matRipple
|
||||||
|
i18n-matTooltip>
|
||||||
H1
|
H1
|
||||||
</button>
|
</button>
|
||||||
<button type="button" matTooltip="Click to insert a title 2 section" (click)="insertTitle(2)" i18n-matTooltip>
|
<button type="button"
|
||||||
|
(click)="insertTitle(2)"
|
||||||
|
matTooltip="Click to insert a title 2 section"
|
||||||
|
matRipple
|
||||||
|
i18n-matTooltip>
|
||||||
H2
|
H2
|
||||||
</button>
|
</button>
|
||||||
<button type="button" matTooltip="Click to insert a title 3 section" (click)="insertTitle(3)" i18n-matTooltip>
|
<button type="button"
|
||||||
|
(click)="insertTitle(3)"
|
||||||
|
matTooltip="Click to insert a title 3 section"
|
||||||
|
matRipple
|
||||||
|
i18n-matTooltip>
|
||||||
H3
|
H3
|
||||||
</button>
|
</button>
|
||||||
<button type="button" matTooltip="Click to insert a picture" (click)="selectAPicture()" i18n-matTooltip>
|
<button type="button"
|
||||||
<mat-icon>image</mat-icon>
|
(click)="insertLink()"
|
||||||
</button>
|
matTooltip="Click to insert a link"
|
||||||
<button type="button" matTooltip="Click to insert a link" (click)="insertLink()" i18n-matTooltip>
|
matRipple
|
||||||
|
i18n-matTooltip>
|
||||||
<mat-icon>link</mat-icon>
|
<mat-icon>link</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
<button type="button" matTooltip="Click to insert a code block" (click)="displayCodeBlockDialog()" i18n-matTooltip>
|
<button type="button"
|
||||||
|
(click)="selectAPicture()"
|
||||||
|
matTooltip="Click to insert a picture"
|
||||||
|
matRipple
|
||||||
|
i18n-matTooltip>
|
||||||
|
<mat-icon>image</mat-icon>
|
||||||
|
</button>
|
||||||
|
<button type="button"
|
||||||
|
(click)="displayCodeBlockDialog()"
|
||||||
|
matTooltip="Click to insert a code block"
|
||||||
|
matRipple
|
||||||
|
i18n-matTooltip>
|
||||||
<mat-icon>code</mat-icon>
|
<mat-icon>code</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
<button type="button" disabled matTooltip="Click to display editor help" i18n-matTooltip>
|
<button type="button"
|
||||||
|
matTooltip="Click to display editor help"
|
||||||
|
disabled
|
||||||
|
matRipple
|
||||||
|
i18n-matTooltip>
|
||||||
<mat-icon>help</mat-icon>
|
<mat-icon>help</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -92,8 +120,12 @@
|
|||||||
</mat-tab>
|
</mat-tab>
|
||||||
</mat-tab-group>
|
</mat-tab-group>
|
||||||
<footer>
|
<footer>
|
||||||
<app-submit-button label="Save" [requestPending]="!!(isSaving$ | async)" i18n-label></app-submit-button>
|
<app-submit-button [requestPending]="!!(isSaving$ | async)" i18n>Save</app-submit-button>
|
||||||
<button type="button" class="secondary" (click)="goPreviousLocation()" i18n>
|
<button type="button"
|
||||||
|
class="cod-button secondary"
|
||||||
|
(click)="goPreviousLocation()"
|
||||||
|
matRipple
|
||||||
|
i18n>
|
||||||
Cancel
|
Cancel
|
||||||
</button>
|
</button>
|
||||||
</footer>
|
</footer>
|
||||||
|
|||||||
@@ -102,6 +102,11 @@
|
|||||||
|
|
||||||
button {
|
button {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
border-radius: 10em;
|
||||||
|
border: none;
|
||||||
|
background-color: #3f51b5;
|
||||||
|
color: white;
|
||||||
|
transition: background-color .2s ease-in-out;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -109,35 +114,16 @@
|
|||||||
height: 3em;
|
height: 3em;
|
||||||
box-shadow: 0 2px 5px 0 rgba(0,0,0,.16),0 2px 10px 0 rgba(0,0,0,.12);
|
box-shadow: 0 2px 5px 0 rgba(0,0,0,.16),0 2px 10px 0 rgba(0,0,0,.12);
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
button, a.button {
|
&:hover {
|
||||||
padding: .8em 1.2em;
|
background-color: #5b6ed8;
|
||||||
border-radius: 10em;
|
cursor: pointer;
|
||||||
border: none;
|
}
|
||||||
background-color: #3f51b5;
|
|
||||||
color: white;
|
&:disabled {
|
||||||
transition: background-color .2s ease-in-out;
|
background-color: #5f6aa6;
|
||||||
|
cursor: not-allowed;
|
||||||
&:hover {
|
}
|
||||||
background-color: #5b6ed8;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:disabled {
|
|
||||||
background-color: #5f6aa6;
|
|
||||||
cursor: not-allowed;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.secondary {
|
|
||||||
color: #3f51b5;
|
|
||||||
background-color: white;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
background-color: #f2f4ff;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { CommonModule, Location } from "@angular/common";
|
import { CommonModule, Location } from "@angular/common";
|
||||||
import { Component, EventEmitter, inject, Input, OnChanges, OnDestroy, Output } from "@angular/core";
|
import { Component, EventEmitter, inject, Input, OnChanges, OnDestroy, Output } from "@angular/core";
|
||||||
import { FormBuilder, FormControl, FormGroup, ReactiveFormsModule, Validators } from "@angular/forms";
|
import { FormGroup, ReactiveFormsModule } from "@angular/forms";
|
||||||
import { MatDialogModule } from "@angular/material/dialog";
|
import { MatDialogModule } from "@angular/material/dialog";
|
||||||
import { MatIconModule } from "@angular/material/icon";
|
import { MatIconModule } from "@angular/material/icon";
|
||||||
import { MatInputModule } from "@angular/material/input";
|
import { MatInputModule } from "@angular/material/input";
|
||||||
@@ -15,6 +15,7 @@ import { CategoryService } from "../../core/service/category.service";
|
|||||||
import { SubmitButtonComponent } from "../submit-button/submit-button.component";
|
import { SubmitButtonComponent } from "../submit-button/submit-button.component";
|
||||||
import { PictureSelectionDialog } from "./picture-selection-dialog/picture-selection-dialog.component";
|
import { PictureSelectionDialog } from "./picture-selection-dialog/picture-selection-dialog.component";
|
||||||
import { PublicationEditionService } from "./publication-edition.service";
|
import { PublicationEditionService } from "./publication-edition.service";
|
||||||
|
import { MatRippleModule } from "@angular/material/core";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-publication-edition',
|
selector: 'app-publication-edition',
|
||||||
@@ -26,6 +27,7 @@ import { PublicationEditionService } from "./publication-edition.service";
|
|||||||
MatDialogModule,
|
MatDialogModule,
|
||||||
MatIconModule,
|
MatIconModule,
|
||||||
MatInputModule,
|
MatInputModule,
|
||||||
|
MatRippleModule,
|
||||||
MatProgressSpinnerModule,
|
MatProgressSpinnerModule,
|
||||||
MatSelectModule,
|
MatSelectModule,
|
||||||
MatTabsModule,
|
MatTabsModule,
|
||||||
@@ -48,18 +50,13 @@ export class PublicationEditionComponent implements OnChanges, OnDestroy {
|
|||||||
|
|
||||||
publicationInEdition!: Publication;
|
publicationInEdition!: Publication;
|
||||||
private readonly categoryService = inject(CategoryService);
|
private readonly categoryService = inject(CategoryService);
|
||||||
private readonly formBuilder = inject(FormBuilder);
|
|
||||||
private readonly location = inject(Location);
|
private readonly location = inject(Location);
|
||||||
private readonly publicationEditionService = inject(PublicationEditionService);
|
private readonly publicationEditionService = inject(PublicationEditionService);
|
||||||
private subscriptions: Subscription[] = [];
|
private subscriptions: Subscription[] = [];
|
||||||
|
|
||||||
publicationEditionForm: FormGroup = this.formBuilder.group({
|
get publicationEditionForm(): FormGroup {
|
||||||
title: new FormControl<string | undefined>('', [Validators.required]),
|
return this.publicationEditionService.publicationEditionForm;
|
||||||
description: new FormControl<string | undefined>('', [Validators.required]),
|
}
|
||||||
text: new FormControl<string | undefined>('', [Validators.required]),
|
|
||||||
illustrationId: new FormControl<string | undefined>('', [Validators.required]),
|
|
||||||
categoryId: new FormControl<string | undefined>('', [Validators.required])
|
|
||||||
});
|
|
||||||
|
|
||||||
get isLoading$(): Observable<boolean> {
|
get isLoading$(): Observable<boolean> {
|
||||||
return this.publicationEditionService.isLoading$;
|
return this.publicationEditionService.isLoading$;
|
||||||
@@ -92,52 +89,14 @@ export class PublicationEditionComponent implements OnChanges, OnDestroy {
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnChanges(): void {
|
ngOnChanges(): void {
|
||||||
this.ngOnDestroy();
|
this.ngOnDestroy();
|
||||||
|
|
||||||
this.publicationInEdition = this.publication;
|
if (!this.publicationInEdition || this.publicationInEdition !== this.publication) {
|
||||||
this.publicationEditionService.init(this.publicationInEdition);
|
this.publicationInEdition = this.publication;
|
||||||
|
this.publicationEditionService.init(this.publicationInEdition);
|
||||||
['title', 'description', 'text'].forEach(fieldName => {
|
}
|
||||||
const fieldSubscription = this.publicationEditionForm.controls[fieldName].valueChanges
|
|
||||||
.pipe(
|
|
||||||
map(value => value?.length ? value as string : '')
|
|
||||||
)
|
|
||||||
.subscribe(fieldValue => {
|
|
||||||
switch (fieldName) {
|
|
||||||
case 'title':
|
|
||||||
this.publicationEditionService.editTitle(fieldValue);
|
|
||||||
break;
|
|
||||||
case 'description':
|
|
||||||
this.publicationEditionService.editDescription(fieldValue);
|
|
||||||
break;
|
|
||||||
case 'text':
|
|
||||||
this.publicationEditionService.editText(fieldValue);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.subscriptions.push(fieldSubscription);
|
|
||||||
});
|
|
||||||
|
|
||||||
const categoryIdChangeSubscription = this.publicationEditionForm.controls['categoryId'].valueChanges
|
|
||||||
.subscribe(newCategoryId => {
|
|
||||||
this.publicationEditionService.editCategoryId(newCategoryId);
|
|
||||||
});
|
|
||||||
this.subscriptions.push(categoryIdChangeSubscription);
|
|
||||||
|
|
||||||
const publicationSubscription = this.publicationEditionService.state$.subscribe(state => {
|
|
||||||
console.log(state.publication.parsedText.substring(0, 15));
|
|
||||||
this.publicationInEdition = state.publication;
|
|
||||||
this.publicationEditionForm.controls['title'].setValue(this.publicationInEdition.title, { emitEvent: false });
|
|
||||||
this.publicationEditionForm.controls['description'].setValue(this.publicationInEdition.description, { emitEvent: false });
|
|
||||||
this.publicationEditionForm.controls['text'].setValue(this.publicationInEdition.text, { emitEvent: false });
|
|
||||||
this.publicationEditionForm.controls['illustrationId'].setValue(this.publicationInEdition.illustrationId, { emitEvent: false });
|
|
||||||
this.publicationEditionForm.controls['categoryId'].setValue(this.publicationInEdition.categoryId, { emitEvent: false });
|
|
||||||
});
|
|
||||||
this.subscriptions.push(publicationSubscription);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
ngOnDestroy(): void {
|
||||||
@@ -164,10 +123,6 @@ export class PublicationEditionComponent implements OnChanges, OnDestroy {
|
|||||||
this.publicationEditionService.displayCodeBlockDialog();
|
this.publicationEditionService.displayCodeBlockDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
save(): void {
|
|
||||||
this.publicationSave.emit(this.publicationInEdition);
|
|
||||||
}
|
|
||||||
|
|
||||||
displayPictureSectionDialog(): void {
|
displayPictureSectionDialog(): void {
|
||||||
this.publicationEditionService.displayPictureSectionDialog();
|
this.publicationEditionService.displayPictureSectionDialog();
|
||||||
}
|
}
|
||||||
@@ -183,6 +138,10 @@ export class PublicationEditionComponent implements OnChanges, OnDestroy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
save(): void {
|
||||||
|
this.publicationSave.emit(this.publicationEditionService.editedPublication);
|
||||||
|
}
|
||||||
|
|
||||||
onTabChange(tabSelectedIndex: number): void {
|
onTabChange(tabSelectedIndex: number): void {
|
||||||
if (tabSelectedIndex === 1) {
|
if (tabSelectedIndex === 1) {
|
||||||
this.publicationEditionService.loadPreview();
|
this.publicationEditionService.loadPreview();
|
||||||
|
|||||||
@@ -3,13 +3,14 @@ import { inject, Injectable, OnDestroy } from "@angular/core";
|
|||||||
import { MatDialog } from "@angular/material/dialog";
|
import { MatDialog } from "@angular/material/dialog";
|
||||||
import { MatSnackBar } from "@angular/material/snack-bar";
|
import { MatSnackBar } from "@angular/material/snack-bar";
|
||||||
import { ActivatedRoute } from "@angular/router";
|
import { ActivatedRoute } from "@angular/router";
|
||||||
import { BehaviorSubject, Observable, Subscription } from "rxjs";
|
import { BehaviorSubject, debounceTime, distinctUntilChanged, Observable, Subscription } from "rxjs";
|
||||||
import { Publication } from "../../core/rest-services/publications/model/publication";
|
import { Publication } from "../../core/rest-services/publications/model/publication";
|
||||||
import { PublicationRestService } from "../../core/rest-services/publications/publication.rest-service";
|
import { PublicationRestService } from "../../core/rest-services/publications/publication.rest-service";
|
||||||
import { copy } from "../../core/utils/ObjectUtils";
|
import { copy } from "../../core/utils/ObjectUtils";
|
||||||
import { CodeBlockDialog } from "./code-block-dialog/code-block-dialog.component";
|
import { CodeBlockDialog } from "./code-block-dialog/code-block-dialog.component";
|
||||||
import { PictureSelectionDialog } from "./picture-selection-dialog/picture-selection-dialog.component";
|
import { PictureSelectionDialog } from "./picture-selection-dialog/picture-selection-dialog.component";
|
||||||
import { PreviewContentRequest } from "../../core/rest-services/publications/model/preview";
|
import { PreviewContentRequest } from "../../core/rest-services/publications/model/preview";
|
||||||
|
import { FormBuilder, FormControl, FormGroup, Validators } from "@angular/forms";
|
||||||
|
|
||||||
declare let Prism: any;
|
declare let Prism: any;
|
||||||
|
|
||||||
@@ -57,10 +58,11 @@ const DEFAULT_STATE: PublicationEditionState = {
|
|||||||
@Injectable()
|
@Injectable()
|
||||||
export class PublicationEditionService implements OnDestroy {
|
export class PublicationEditionService implements OnDestroy {
|
||||||
private readonly activatedRoute = inject(ActivatedRoute);
|
private readonly activatedRoute = inject(ActivatedRoute);
|
||||||
private readonly publicationRestService = inject(PublicationRestService);
|
|
||||||
private readonly location = inject(Location);
|
|
||||||
private readonly snackBar = inject(MatSnackBar);
|
|
||||||
private readonly dialog = inject(MatDialog);
|
private readonly dialog = inject(MatDialog);
|
||||||
|
private readonly formBuilder = inject(FormBuilder);
|
||||||
|
private readonly location = inject(Location);
|
||||||
|
private readonly publicationRestService = inject(PublicationRestService);
|
||||||
|
private readonly snackBar = inject(MatSnackBar);
|
||||||
|
|
||||||
private isLoadingSubject = new BehaviorSubject<boolean>(false);
|
private isLoadingSubject = new BehaviorSubject<boolean>(false);
|
||||||
private stateSubject = new BehaviorSubject<PublicationEditionState>(copy(DEFAULT_STATE));
|
private stateSubject = new BehaviorSubject<PublicationEditionState>(copy(DEFAULT_STATE));
|
||||||
@@ -68,6 +70,14 @@ export class PublicationEditionService implements OnDestroy {
|
|||||||
private isSavingSubject = new BehaviorSubject<boolean>(false);
|
private isSavingSubject = new BehaviorSubject<boolean>(false);
|
||||||
private isPreviewingSubject = new BehaviorSubject<boolean>(false);
|
private isPreviewingSubject = new BehaviorSubject<boolean>(false);
|
||||||
|
|
||||||
|
publicationEditionForm: FormGroup = this.formBuilder.group({
|
||||||
|
title: new FormControl<string | undefined>('', [Validators.required]),
|
||||||
|
description: new FormControl<string | undefined>('', [Validators.required]),
|
||||||
|
text: new FormControl<string | undefined>('', [Validators.required]),
|
||||||
|
illustrationId: new FormControl<string | undefined>('', [Validators.required]),
|
||||||
|
categoryId: new FormControl<string | undefined>('', [Validators.required])
|
||||||
|
});
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
ngOnDestroy(): void {
|
||||||
this.subscriptions.forEach(subscription => subscription.unsubscribe());
|
this.subscriptions.forEach(subscription => subscription.unsubscribe());
|
||||||
}
|
}
|
||||||
@@ -80,6 +90,17 @@ export class PublicationEditionService implements OnDestroy {
|
|||||||
this.stateSubject.next(state);
|
this.stateSubject.next(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private _updateForm(): void {
|
||||||
|
const state = this._state;
|
||||||
|
const publication = state.publication;
|
||||||
|
|
||||||
|
this.publicationEditionForm.controls['title'].setValue(publication.title);
|
||||||
|
this.publicationEditionForm.controls['description'].setValue(publication.description);
|
||||||
|
this.publicationEditionForm.controls['text'].setValue(publication.text);
|
||||||
|
this.publicationEditionForm.controls['illustrationId'].setValue(publication.illustrationId);
|
||||||
|
this.publicationEditionForm.controls['categoryId'].setValue(publication.categoryId);
|
||||||
|
}
|
||||||
|
|
||||||
get isLoading$(): Observable<boolean> {
|
get isLoading$(): Observable<boolean> {
|
||||||
return this.isLoadingSubject.asObservable();
|
return this.isLoadingSubject.asObservable();
|
||||||
}
|
}
|
||||||
@@ -96,6 +117,10 @@ export class PublicationEditionService implements OnDestroy {
|
|||||||
return this.stateSubject.asObservable();
|
return this.stateSubject.asObservable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get editedPublication(): Publication {
|
||||||
|
return this._state.publication;
|
||||||
|
}
|
||||||
|
|
||||||
loadPublication(): void {
|
loadPublication(): void {
|
||||||
this.isLoadingSubject.next(true);
|
this.isLoadingSubject.next(true);
|
||||||
|
|
||||||
@@ -106,52 +131,47 @@ export class PublicationEditionService implements OnDestroy {
|
|||||||
this.location.back();
|
this.location.back();
|
||||||
} else {
|
} else {
|
||||||
this.publicationRestService.getById(publicationId)
|
this.publicationRestService.getById(publicationId)
|
||||||
.then(publication => {
|
.then(publication => {
|
||||||
const state = this._state;
|
const state = this._state;
|
||||||
state.publication = publication;
|
state.publication = publication;
|
||||||
this.stateSubject.next(state);
|
this.stateSubject.next(state);
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
const errorMessage = $localize`A technical error occurred while loading publication data.`;
|
const errorMessage = $localize`A technical error occurred while loading publication data.`;
|
||||||
this.snackBar.open(errorMessage, $localize`Close`, {duration: 5000});
|
this.snackBar.open(errorMessage, $localize`Close`, {duration: 5000});
|
||||||
console.error(errorMessage, error)
|
console.error(errorMessage, error)
|
||||||
})
|
})
|
||||||
.finally(() => this.isLoadingSubject.next(false));
|
.finally(() => this.isLoadingSubject.next(false));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
init(publication: Publication): void {
|
init(publication: Publication): void {
|
||||||
const state = this._state;
|
const state = this._state;
|
||||||
state.publication = publication;
|
state.publication = publication;
|
||||||
this.stateSubject.next(state);
|
this.stateSubject.next(state);
|
||||||
|
this._updateForm();
|
||||||
|
|
||||||
|
const formValueChangesSubscription = this.publicationEditionForm.valueChanges
|
||||||
|
.pipe(
|
||||||
|
debounceTime(200),
|
||||||
|
distinctUntilChanged()
|
||||||
|
)
|
||||||
|
.subscribe(formValue => {
|
||||||
|
const state = this._state;
|
||||||
|
const publication = state.publication;
|
||||||
|
|
||||||
|
publication.title = formValue.title;
|
||||||
|
publication.description = formValue.description;
|
||||||
|
publication.categoryId = formValue.categoryId;
|
||||||
|
publication.text = formValue.text;
|
||||||
|
|
||||||
|
this._save(state);
|
||||||
|
})
|
||||||
|
this.subscriptions.push(formValueChangesSubscription);
|
||||||
}
|
}
|
||||||
|
|
||||||
editTitle(title: string): void {
|
private editIllustrationId(pictureId: string): void {
|
||||||
const state = this._state;
|
|
||||||
state.publication.title = title;
|
|
||||||
this._save(state);
|
|
||||||
}
|
|
||||||
|
|
||||||
editDescription(description: string): void {
|
|
||||||
const state = this._state;
|
|
||||||
state.publication.description = description;
|
|
||||||
this._save(state);
|
|
||||||
}
|
|
||||||
|
|
||||||
editCategoryId(categoryId: string): void {
|
|
||||||
const state = this._state;
|
|
||||||
state.publication.categoryId = categoryId;
|
|
||||||
this._save(state);
|
|
||||||
}
|
|
||||||
|
|
||||||
editText(text: string): void {
|
|
||||||
const state = this._state;
|
|
||||||
state.publication.text = text;
|
|
||||||
this._save(state);
|
|
||||||
}
|
|
||||||
|
|
||||||
editIllustrationId(pictureId: string): void {
|
|
||||||
const state = this._state;
|
const state = this._state;
|
||||||
state.publication.illustrationId = pictureId
|
state.publication.illustrationId = pictureId
|
||||||
this._save(state);
|
this._save(state);
|
||||||
@@ -204,6 +224,7 @@ export class PublicationEditionService implements OnDestroy {
|
|||||||
publication.text = textWithTags;
|
publication.text = textWithTags;
|
||||||
|
|
||||||
this._save(state);
|
this._save(state);
|
||||||
|
this._updateForm();
|
||||||
} else {
|
} else {
|
||||||
console.error(`Bad value for parameter of function 'insertTitle': '${titleNumber}'.`);
|
console.error(`Bad value for parameter of function 'insertTitle': '${titleNumber}'.`);
|
||||||
}
|
}
|
||||||
@@ -233,6 +254,7 @@ export class PublicationEditionService implements OnDestroy {
|
|||||||
publication.text = textWithTags;
|
publication.text = textWithTags;
|
||||||
|
|
||||||
this._save(state);
|
this._save(state);
|
||||||
|
this._updateForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
insertLink(): void {
|
insertLink(): void {
|
||||||
@@ -248,9 +270,10 @@ export class PublicationEditionService implements OnDestroy {
|
|||||||
publication.text = textWithTags;
|
publication.text = textWithTags;
|
||||||
|
|
||||||
this._save(state);
|
this._save(state);
|
||||||
|
this._updateForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
insertCodeBlock(programmingLanguage: string, codeBlock: string): void {
|
private insertCodeBlock(programmingLanguage: string, codeBlock: string): void {
|
||||||
const state = this._state;
|
const state = this._state;
|
||||||
|
|
||||||
const publication = state.publication;
|
const publication = state.publication;
|
||||||
@@ -263,6 +286,7 @@ export class PublicationEditionService implements OnDestroy {
|
|||||||
publication.text = textWithTags;
|
publication.text = textWithTags;
|
||||||
|
|
||||||
this._save(state);
|
this._save(state);
|
||||||
|
this._updateForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
loadPreview(): void {
|
loadPreview(): void {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<form [formGroup]="formGroup">
|
<form [formGroup]="formGroup">
|
||||||
<input name="search-query" placeholder="Search something..." formControlName="criteria" i18n-placeholder/>
|
<input name="search-query" placeholder="Search something..." formControlName="criteria" i18n-placeholder/>
|
||||||
<button type="submit" (click)="searchPublications()">
|
<button type="submit" (click)="searchPublications()" matRipple>
|
||||||
<mat-icon>search</mat-icon>
|
<mat-icon>search</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
@@ -24,9 +24,10 @@
|
|||||||
border-radius: $borderRadiusValue;
|
border-radius: $borderRadiusValue;
|
||||||
background-color: white;
|
background-color: white;
|
||||||
border: none;
|
border: none;
|
||||||
top: .4em;
|
top: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
color: #aaaaaa;
|
color: #aaaaaa;
|
||||||
|
padding: .3em;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background-color: #eee;
|
background-color: #eee;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { HttpParams } from "@angular/common/http";
|
|
||||||
import { Component, inject } from "@angular/core";
|
import { Component, inject } from "@angular/core";
|
||||||
import { FormBuilder, FormControl, ReactiveFormsModule, Validators } from "@angular/forms";
|
import { FormBuilder, FormControl, ReactiveFormsModule, Validators } from "@angular/forms";
|
||||||
|
import { MatRippleModule } from "@angular/material/core";
|
||||||
import { MatIconModule } from "@angular/material/icon";
|
import { MatIconModule } from "@angular/material/icon";
|
||||||
import { Router } from "@angular/router";
|
import { Router } from "@angular/router";
|
||||||
|
|
||||||
@@ -11,8 +11,9 @@ import { Router } from "@angular/router";
|
|||||||
styleUrl: './publications-search-bar.component.scss',
|
styleUrl: './publications-search-bar.component.scss',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [
|
imports: [
|
||||||
ReactiveFormsModule,
|
MatIconModule,
|
||||||
MatIconModule
|
MatRippleModule,
|
||||||
|
ReactiveFormsModule
|
||||||
],
|
],
|
||||||
providers: []
|
providers: []
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
@for(category of categories(); track category) {
|
@for(category of categories$ | async; track category) {
|
||||||
<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)="setOpenned(category)">
|
||||||
{{category.name}}
|
{{category.name}}
|
||||||
<mat-icon>chevron_right</mat-icon>
|
<mat-icon>chevron_right</mat-icon>
|
||||||
</div>
|
</div>
|
||||||
<div class="sub-category-container {{category.isOpenned ? 'displayed' : ''}}">
|
<div class="sub-category-container {{category.isOpenned ? 'displayed' : ''}}">
|
||||||
@for(subCategory of category.subCategories; track subCategory) {
|
@for(subCategory of category.subCategories; track subCategory) {
|
||||||
<a [routerLink]="['/publications']" [queryParams]="{'category-id': subCategory.id}" (click)="categoryClicked.emit()" class="sub-category">
|
<a [routerLink]="['/publications']"
|
||||||
|
[queryParams]="{'category-id': subCategory.id}"
|
||||||
|
(click)="categoryClicked.emit()"
|
||||||
|
class="sub-category">
|
||||||
{{subCategory.name}}
|
{{subCategory.name}}
|
||||||
</a>
|
</a>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,33 +1,32 @@
|
|||||||
import { CommonModule } from "@angular/common";
|
import { CommonModule } from "@angular/common";
|
||||||
import { Component, EventEmitter, inject, OnDestroy, OnInit, Output, signal } from "@angular/core";
|
import { Component, EventEmitter, inject, OnInit, Output } 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, Subscription } from "rxjs";
|
import { Observable } from "rxjs";
|
||||||
import { RouterModule } from "@angular/router";
|
import { RouterModule } from "@angular/router";
|
||||||
import { Category } from "../../../core/rest-services/category/model/category";
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-categories-menu',
|
selector: 'app-categories-menu',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [CommonModule, RouterModule, MatIconModule],
|
|
||||||
templateUrl: './categories-menu.component.html',
|
templateUrl: './categories-menu.component.html',
|
||||||
|
imports: [
|
||||||
|
CommonModule,
|
||||||
|
RouterModule,
|
||||||
|
MatIconModule
|
||||||
|
],
|
||||||
styleUrl: './categories-menu.component.scss'
|
styleUrl: './categories-menu.component.scss'
|
||||||
})
|
})
|
||||||
export class CategoriesMenuComponent implements OnInit, OnDestroy {
|
export class CategoriesMenuComponent implements OnInit {
|
||||||
|
private sideMenuService = inject(SideMenuService);
|
||||||
@Output()
|
@Output()
|
||||||
categoryClicked = new EventEmitter<void>();
|
categoryClicked = new EventEmitter<void>();
|
||||||
private sideMenuService = inject(SideMenuService);
|
|
||||||
private categoriesSubscription?: Subscription;
|
|
||||||
categories = signal<DisplayableCategory[]>([]);
|
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.categoriesSubscription = this.sideMenuService.categories$
|
|
||||||
.subscribe(categories => this.categories.set(categories));
|
|
||||||
this.sideMenuService.loadCategories();
|
this.sideMenuService.loadCategories();
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
get categories$(): Observable<DisplayableCategory[]> {
|
||||||
this.categoriesSubscription?.unsubscribe();
|
return this.sideMenuService.categories$;
|
||||||
}
|
}
|
||||||
|
|
||||||
setOpenned(category: DisplayableCategory): void {
|
setOpenned(category: DisplayableCategory): void {
|
||||||
|
|||||||
@@ -1,14 +1,19 @@
|
|||||||
<div class="menu {{ isOpenned() ? 'displayed' : '' }}">
|
<div class="menu {{ isOpenned ? 'displayed' : '' }}">
|
||||||
<h1>
|
<h1>
|
||||||
<a [routerLink]="['/home']">
|
<a [routerLink]="['/home']">
|
||||||
<img src="assets/images/codiki.png" alt="logo"/>
|
<img src="assets/images/codiki.png" alt="logo"/>
|
||||||
Codiki
|
Codiki
|
||||||
</a>
|
</a>
|
||||||
<button type="button" (click)="close()" matTooltip="Close the menu" i18n-matTooltip>
|
<button type="button"
|
||||||
|
(click)="close()"
|
||||||
|
class="cod-button icon"
|
||||||
|
matTooltip="Close the menu"
|
||||||
|
matRipple
|
||||||
|
i18n-matTooltip>
|
||||||
<mat-icon>close</mat-icon>
|
<mat-icon>close</mat-icon>
|
||||||
</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()"></app-categories-menu>
|
||||||
</div>
|
</div>
|
||||||
<div class="overlay {{ isOpenned() ? 'displayed' : ''}}" (click)="close()"></div>
|
<div class="overlay {{ isOpenned ? 'displayed' : ''}}" (click)="close()"></div>
|
||||||
|
|||||||
@@ -41,24 +41,6 @@
|
|||||||
height: $imageSize;
|
height: $imageSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
button {
|
|
||||||
border-radius: 10em;
|
|
||||||
border: none;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
width: 2.5em;
|
|
||||||
height: 2.5em;
|
|
||||||
color: white;
|
|
||||||
background-color: #3f51b5;
|
|
||||||
transition: background-color .2s ease-in-out;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
cursor: pointer;
|
|
||||||
background-color: #5c6bc0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
h2 {
|
h2 {
|
||||||
|
|||||||
@@ -1,24 +1,31 @@
|
|||||||
import { Component, signal } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { MatIconModule } from '@angular/material/icon';
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||||
import { RouterModule } from '@angular/router';
|
import { RouterModule } from '@angular/router';
|
||||||
import { CategoriesMenuComponent } from './categories-menu/categories-menu.component';
|
import { CategoriesMenuComponent } from './categories-menu/categories-menu.component';
|
||||||
|
import { MatRippleModule } from '@angular/material/core';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-side-menu',
|
selector: 'app-side-menu',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [CategoriesMenuComponent, MatIconModule, MatTooltipModule, RouterModule],
|
|
||||||
templateUrl: './side-menu.component.html',
|
templateUrl: './side-menu.component.html',
|
||||||
styleUrl: './side-menu.component.scss'
|
styleUrl: './side-menu.component.scss',
|
||||||
|
imports: [
|
||||||
|
CategoriesMenuComponent,
|
||||||
|
MatIconModule,
|
||||||
|
MatRippleModule,
|
||||||
|
MatTooltipModule,
|
||||||
|
RouterModule
|
||||||
|
]
|
||||||
})
|
})
|
||||||
export class SideMenuComponent {
|
export class SideMenuComponent {
|
||||||
isOpenned = signal(false);
|
isOpenned: boolean = false;
|
||||||
|
|
||||||
open(): void {
|
open(): void {
|
||||||
this.isOpenned.set(true);
|
this.isOpenned = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
close(): void {
|
close(): void {
|
||||||
this.isOpenned.set(false);
|
this.isOpenned = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
<button type="submit" [class]="color" [disabled]="disabled || requestPending" (click)="click.emit()">
|
<button type="submit"
|
||||||
|
class="cod-button {{color}}"
|
||||||
|
[disabled]="disabled || requestPending"
|
||||||
|
(click)="click.emit()"
|
||||||
|
matRipple>
|
||||||
@if (requestPending) {
|
@if (requestPending) {
|
||||||
<mat-spinner class="spinner {{color}}" [diameter]="25"></mat-spinner>
|
<mat-spinner class="spinner {{color}}" [diameter]="25"></mat-spinner>
|
||||||
}
|
}
|
||||||
<span>
|
<span>
|
||||||
{{ label }}
|
<ng-content/>
|
||||||
</span>
|
</span>
|
||||||
</button>
|
</button>
|
||||||
@@ -1,14 +1,18 @@
|
|||||||
import { CommonModule } from "@angular/common";
|
import { CommonModule } from "@angular/common";
|
||||||
import { Component, EventEmitter, Input, Output } from "@angular/core";
|
import { Component, EventEmitter, Input, Output } from "@angular/core";
|
||||||
|
import { MatRippleModule } from "@angular/material/core";
|
||||||
import { MatProgressSpinnerModule } from "@angular/material/progress-spinner";
|
import { MatProgressSpinnerModule } from "@angular/material/progress-spinner";
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-submit-button',
|
selector: 'app-submit-button',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [MatProgressSpinnerModule, CommonModule],
|
|
||||||
templateUrl: 'submit-button.component.html',
|
templateUrl: 'submit-button.component.html',
|
||||||
styleUrl: 'submit-button.component.scss'
|
styleUrl: 'submit-button.component.scss',
|
||||||
|
imports: [
|
||||||
|
CommonModule,
|
||||||
|
MatRippleModule,
|
||||||
|
MatProgressSpinnerModule
|
||||||
|
]
|
||||||
})
|
})
|
||||||
export class SubmitButtonComponent {
|
export class SubmitButtonComponent {
|
||||||
@Input() requestPending: boolean = false;
|
@Input() requestPending: boolean = false;
|
||||||
|
|||||||
18
frontend/src/app/core/guard/already-authenticated.guard.ts
Normal file
18
frontend/src/app/core/guard/already-authenticated.guard.ts
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
import { inject } from "@angular/core";
|
||||||
|
import { CanActivateFn, Router } from "@angular/router";
|
||||||
|
import { AuthenticationService } from "../service/authentication.service";
|
||||||
|
import { MatSnackBar } from "@angular/material/snack-bar";
|
||||||
|
|
||||||
|
export const alreadyAuthenticatedGuard: CanActivateFn = () => {
|
||||||
|
const authenticationService = inject(AuthenticationService);
|
||||||
|
const router = inject(Router);
|
||||||
|
const snackBar = inject(MatSnackBar);
|
||||||
|
|
||||||
|
if (authenticationService.isAuthenticated()) {
|
||||||
|
router.navigate(['/home']);
|
||||||
|
snackBar.open($localize`You can't access to this page because you are already authenticated.`, $localize`Close`, { duration: 5000 });
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,11 +3,13 @@ import { CanActivateFn, Router } from "@angular/router";
|
|||||||
import { AuthenticationService } from "../service/authentication.service";
|
import { AuthenticationService } from "../service/authentication.service";
|
||||||
import { MatSnackBar } from "@angular/material/snack-bar";
|
import { MatSnackBar } from "@angular/material/snack-bar";
|
||||||
|
|
||||||
export const authenticationGuard: CanActivateFn = () => {
|
export const authenticationGuard: CanActivateFn = async () => {
|
||||||
const authenticationService = inject(AuthenticationService);
|
const authenticationService = inject(AuthenticationService);
|
||||||
const router = inject(Router);
|
const router = inject(Router);
|
||||||
const snackBar = inject(MatSnackBar);
|
const snackBar = inject(MatSnackBar);
|
||||||
|
|
||||||
|
await authenticationService.checkIsAuthenticated();
|
||||||
|
|
||||||
if (authenticationService.isAuthenticated()) {
|
if (authenticationService.isAuthenticated()) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -41,23 +41,12 @@ export class JwtInterceptor implements HttpInterceptor {
|
|||||||
this.isRefreshingToken = true;
|
this.isRefreshingToken = true;
|
||||||
this.refreshTokenSubject.next(undefined);
|
this.refreshTokenSubject.next(undefined);
|
||||||
|
|
||||||
const refreshToken = this.authenticationService.getRefreshToken();
|
this.authenticationService.refreshToken()
|
||||||
if (refreshToken) {
|
.then(refreshTokenResponse => {
|
||||||
const refreshTokenRequest: RefreshTokenRequest = {
|
this.refreshTokenSubject.next(refreshTokenResponse.accessToken);
|
||||||
refreshTokenValue: refreshToken
|
})
|
||||||
};
|
.catch(() => this.handleNoRefreshToken(initialError))
|
||||||
this.userRestService.refreshToken(refreshTokenRequest)
|
.finally(() => this.isRefreshingToken = false);
|
||||||
.then(refreshTokenResponse => {
|
|
||||||
this.authenticationService.authenticate(refreshTokenResponse.accessToken, refreshTokenResponse.refreshToken);
|
|
||||||
this.refreshTokenSubject.next(refreshTokenResponse.accessToken);
|
|
||||||
})
|
|
||||||
.catch(() => {
|
|
||||||
return this.handleNoRefreshToken(initialError);
|
|
||||||
})
|
|
||||||
.finally(() => this.isRefreshingToken = false);
|
|
||||||
} else {
|
|
||||||
return this.handleNoRefreshToken(initialError);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.refreshTokenSubject.pipe(
|
return this.refreshTokenSubject.pipe(
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
import { inject, Injectable } from "@angular/core";
|
import { inject, Injectable } from "@angular/core";
|
||||||
|
import { BehaviorSubject, interval } from "rxjs";
|
||||||
import { User } from "../model/User";
|
import { User } from "../model/User";
|
||||||
import { UserRestService } from "../rest-services/user/user.rest-service";
|
import { UserRestService } from "../rest-services/user/user.rest-service";
|
||||||
import { RefreshTokenRequest } from "../rest-services/user/model/refresh-token.model";
|
import { RefreshTokenRequest } from "../rest-services/user/model/refresh-token.model";
|
||||||
|
import { LoginResponse } from "../rest-services/user/model/login.model";
|
||||||
|
|
||||||
const JWT_PARAM = 'jwt';
|
const JWT_PARAM = 'jwt';
|
||||||
const REFRESH_TOKEN_PARAM = 'refresh-token';
|
const REFRESH_TOKEN_PARAM = 'refresh-token';
|
||||||
@@ -18,18 +20,30 @@ interface UserDetails {
|
|||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class AuthenticationService {
|
export class AuthenticationService {
|
||||||
|
private readonly AUTHENTICATION_CHECKING_PERIOD = 5 * 60 * 1000;
|
||||||
|
private isAuthenticatedSubject = new BehaviorSubject<boolean>(false);
|
||||||
|
private readonly userRestService = inject(UserRestService);
|
||||||
|
|
||||||
|
startAuthenticationCheckingProcess(): void {
|
||||||
|
this.checkIsAuthenticated();
|
||||||
|
interval(this.AUTHENTICATION_CHECKING_PERIOD)
|
||||||
|
.subscribe(() => this.checkIsAuthenticated());
|
||||||
|
}
|
||||||
|
|
||||||
authenticate(token: string, refreshToken: string): void {
|
authenticate(token: string, refreshToken: string): void {
|
||||||
localStorage.setItem(JWT_PARAM, token);
|
localStorage.setItem(JWT_PARAM, token);
|
||||||
localStorage.setItem(REFRESH_TOKEN_PARAM, refreshToken);
|
localStorage.setItem(REFRESH_TOKEN_PARAM, refreshToken);
|
||||||
|
this.isAuthenticatedSubject.next(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
unauthenticate(): void {
|
unauthenticate(): void {
|
||||||
localStorage.removeItem(JWT_PARAM);
|
localStorage.removeItem(JWT_PARAM);
|
||||||
|
localStorage.removeItem(REFRESH_TOKEN_PARAM);
|
||||||
|
this.isAuthenticatedSubject.next(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
isAuthenticated(): boolean {
|
isAuthenticated(): boolean {
|
||||||
return !!localStorage.getItem(JWT_PARAM);
|
return this.isAuthenticatedSubject.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
getAuthenticatedUser(): User | undefined {
|
getAuthenticatedUser(): User | undefined {
|
||||||
@@ -45,7 +59,7 @@ export class AuthenticationService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
isTokenExpired(): boolean {
|
isTokenExpired(): boolean {
|
||||||
let result = false;
|
let result = true;
|
||||||
|
|
||||||
const userDetails = this.extractUserDetails();
|
const userDetails = this.extractUserDetails();
|
||||||
|
|
||||||
@@ -59,8 +73,43 @@ export class AuthenticationService {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
refreshToken(): Promise<LoginResponse> {
|
||||||
|
const refreshToken = this.getRefreshToken();
|
||||||
|
if (refreshToken) {
|
||||||
|
const refreshTokenRequest: RefreshTokenRequest = {
|
||||||
|
refreshTokenValue: refreshToken
|
||||||
|
};
|
||||||
|
return this.userRestService.refreshToken(refreshTokenRequest)
|
||||||
|
.then(refreshTokenResponse => {
|
||||||
|
this.authenticate(refreshTokenResponse.accessToken, refreshTokenResponse.refreshToken);
|
||||||
|
return refreshTokenResponse;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return Promise.reject('No any refresh token found.');
|
||||||
|
}
|
||||||
|
|
||||||
|
checkIsAuthenticated(): Promise<void> {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const isTokenExpired = this.isTokenExpired();
|
||||||
|
if (isTokenExpired) {
|
||||||
|
if (this.getRefreshToken()) {
|
||||||
|
this.refreshToken()
|
||||||
|
.then(() => resolve())
|
||||||
|
.catch(() => reject());
|
||||||
|
} else {
|
||||||
|
this.isAuthenticatedSubject.next(false);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.isAuthenticatedSubject.next(true);
|
||||||
|
}
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private extractUserFromLocalStorage(): User | undefined {
|
private extractUserFromLocalStorage(): User | undefined {
|
||||||
let result: User | undefined = undefined;
|
let result: User | undefined;
|
||||||
|
|
||||||
const userDetails = this.extractUserDetails();
|
const userDetails = this.extractUserDetails();
|
||||||
if (userDetails) {
|
if (userDetails) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<h1 i18n>Last publications</h1>
|
<h1 i18n>Last publications</h1>
|
||||||
@if (isLoading()) {
|
@if ((isLoading$ | async) === true) {
|
||||||
<h2 i18n>Publications loading...</h2>
|
<h2 i18n>Publications loading...</h2>
|
||||||
<mat-spinner></mat-spinner>
|
<mat-spinner></mat-spinner>
|
||||||
} @else {
|
} @else {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Component, OnDestroy, OnInit, inject, signal } from '@angular/core';
|
import { Component, OnInit, inject } from '@angular/core';
|
||||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||||
import { Observable, Subscription } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { PublicationListComponent } from '../../components/publication-list/publication-list.component';
|
import { PublicationListComponent } from '../../components/publication-list/publication-list.component';
|
||||||
import { Publication } from '../../core/rest-services/publications/model/publication';
|
import { Publication } from '../../core/rest-services/publications/model/publication';
|
||||||
import { HomeService } from './home.service';
|
import { HomeService } from './home.service';
|
||||||
@@ -18,27 +18,18 @@ import { CommonModule } from '@angular/common';
|
|||||||
styleUrl: './home.component.scss',
|
styleUrl: './home.component.scss',
|
||||||
providers: [HomeService]
|
providers: [HomeService]
|
||||||
})
|
})
|
||||||
export class HomeComponent implements OnInit, OnDestroy {
|
export class HomeComponent implements OnInit {
|
||||||
private homeService = inject(HomeService);
|
private homeService = inject(HomeService);
|
||||||
private isLoadingSubscription?: Subscription;
|
|
||||||
private publicationsSubscription?: Subscription;
|
get isLoading$(): Observable<boolean> {
|
||||||
isLoading = signal(false);
|
return this.homeService.isLoading$;
|
||||||
publicationsIsEmpty = signal(true);
|
}
|
||||||
|
|
||||||
get publications$(): Observable<Publication[]> {
|
get publications$(): Observable<Publication[]> {
|
||||||
return this.homeService.publications$;
|
return this.homeService.publications$;
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.isLoadingSubscription = this.homeService.isLoading$
|
|
||||||
.subscribe(isLoading => this.isLoading.set(isLoading));
|
|
||||||
this.publicationsSubscription = this.homeService.publications$
|
|
||||||
.subscribe(publications => this.publicationsIsEmpty.set(publications.length > 0));
|
|
||||||
this.homeService.startLatestPublicationsRetrieving();
|
this.homeService.startLatestPublicationsRetrieving();
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
|
||||||
this.isLoadingSubscription?.unsubscribe();
|
|
||||||
this.publicationsSubscription?.unsubscribe();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<form [formGroup]="loginForm" (submit)="performLogin()" ngNativeValidate>
|
<form [formGroup]="loginForm" (submit)="performLogin()" class="cod-form card" ngNativeValidate>
|
||||||
<h1 i18n>Login</h1>
|
<h1 i18n>Login</h1>
|
||||||
<div>
|
<div class="form-field">
|
||||||
<mat-icon>mail</mat-icon>
|
<mat-icon>mail</mat-icon>
|
||||||
<label for="email" i18n>
|
<label for="email" i18n>
|
||||||
Email address
|
Email address
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
</label>
|
</label>
|
||||||
<input type="email" id="email" formControlName="email" autocomplete="email" required />
|
<input type="email" id="email" formControlName="email" autocomplete="email" required />
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div class="form-field">
|
||||||
<mat-icon>lock</mat-icon>
|
<mat-icon>lock</mat-icon>
|
||||||
<label for="password" i18n>
|
<label for="password" i18n>
|
||||||
Password
|
Password
|
||||||
@@ -16,8 +16,8 @@
|
|||||||
</label>
|
</label>
|
||||||
<input type="password" id="password" formControlName="password" required />
|
<input type="password" id="password" formControlName="password" required />
|
||||||
</div>
|
</div>
|
||||||
<div class="actions">
|
<div class="actions reversed">
|
||||||
<button type="submit" i18n>Send</button>
|
<app-submit-button [requestPending]="false" [disabled]="false" i18n>Send</app-submit-button>
|
||||||
<a [routerLink]="['/signin']" i18n>Create an account</a>
|
<a [routerLink]="['/signin']" class="cod-button secondary" matRipple i18n>Create an account</a>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
@@ -4,79 +4,4 @@
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
|
|
||||||
form {
|
|
||||||
width: 80%;
|
|
||||||
max-width: 20em;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: center;
|
|
||||||
gap: 1em;
|
|
||||||
box-shadow: 0 2px 5px 0 rgba(0,0,0,.16),0 2px 10px 0 rgba(0,0,0,.12);
|
|
||||||
border-radius: .5em;
|
|
||||||
padding: 1em 1.5em;
|
|
||||||
background-color: #ffffff;
|
|
||||||
|
|
||||||
h1 {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
div {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
position: relative;
|
|
||||||
gap: .1em;
|
|
||||||
|
|
||||||
mat-icon {
|
|
||||||
position: absolute;
|
|
||||||
top: 1.3em;
|
|
||||||
left: .5em;
|
|
||||||
color: #777;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.actions {
|
|
||||||
flex-direction: row-reverse;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
a {
|
|
||||||
color: #3f51b5;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
button, a.button {
|
|
||||||
padding: .8em 1.2em;
|
|
||||||
border-radius: 10em;
|
|
||||||
border: none;
|
|
||||||
background-color: #3f51b5;
|
|
||||||
color: white;
|
|
||||||
transition: background-color .2s ease-in-out;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
background-color: #5b6ed8;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
label {
|
|
||||||
flex: 1;
|
|
||||||
font-style: italic;
|
|
||||||
padding-left: 1em;
|
|
||||||
color: #777;
|
|
||||||
|
|
||||||
.required {
|
|
||||||
color: red;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
input {
|
|
||||||
flex: 1;
|
|
||||||
background-color: #eeeeee;
|
|
||||||
border: none;
|
|
||||||
border-radius: 10em;
|
|
||||||
padding: 1em 1em 1em 3em;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -5,13 +5,21 @@ import { Subscription, debounceTime, map } from 'rxjs';
|
|||||||
import { LoginService } from './login.service';
|
import { LoginService } from './login.service';
|
||||||
import { MatIconModule } from '@angular/material/icon';
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
import { RouterModule } from '@angular/router';
|
import { RouterModule } from '@angular/router';
|
||||||
|
import { SubmitButtonComponent } from "../../components/submit-button/submit-button.component";
|
||||||
|
import { MatRippleModule } from '@angular/material/core';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-login',
|
selector: 'app-login',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
templateUrl: './login.component.html',
|
templateUrl: './login.component.html',
|
||||||
styleUrl: './login.component.scss',
|
styleUrl: './login.component.scss',
|
||||||
imports: [ReactiveFormsModule, MatIconModule, RouterModule],
|
imports: [
|
||||||
|
MatIconModule,
|
||||||
|
MatRippleModule,
|
||||||
|
ReactiveFormsModule,
|
||||||
|
RouterModule,
|
||||||
|
SubmitButtonComponent
|
||||||
|
],
|
||||||
providers: [LoginService, MatSnackBarModule]
|
providers: [LoginService, MatSnackBarModule]
|
||||||
})
|
})
|
||||||
export class LoginComponent implements OnInit, OnDestroy {
|
export class LoginComponent implements OnInit, OnDestroy {
|
||||||
|
|||||||
@@ -60,18 +60,24 @@ export class LoginService {
|
|||||||
performLogin(): void {
|
performLogin(): void {
|
||||||
const state = this.state;
|
const state = this.state;
|
||||||
|
|
||||||
// Check state is valid
|
if (this.isStateValid(state)) {
|
||||||
|
this.userRestService
|
||||||
|
.login(state.request)
|
||||||
|
.then((response) => {
|
||||||
|
this.authenticationService.authenticate(response.accessToken, response.refreshToken);
|
||||||
|
this.snackBar.open($localize`Authentication succeeded!`, $localize`Close`, { duration: 5000 });
|
||||||
|
this.router.navigate(['/home']);
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error(error);
|
||||||
|
this.snackBar.open($localize`Authentication failed.`, $localize`Close`, { duration: 5000 });
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.snackBar.open($localize`Please, fill the inputs before send.`, $localize`Close`, { duration: 5000 });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.userRestService
|
isStateValid(state: LoginState): boolean {
|
||||||
.login(state.request)
|
return !!state.request.email?.trim().length && !!state.request.password?.length;
|
||||||
.then((response) => {
|
|
||||||
this.authenticationService.authenticate(response.accessToken, response.refreshToken);
|
|
||||||
this.snackBar.open($localize`Authentication succeeded!`, $localize`Close`, { duration: 5000 });
|
|
||||||
this.router.navigate(['/home']);
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
console.error(error);
|
|
||||||
this.snackBar.open($localize`Authentication failed.`, $localize`Close`, { duration: 5000 });
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,15 +4,16 @@
|
|||||||
class="new-publication"
|
class="new-publication"
|
||||||
matTooltip="Add a new publication"
|
matTooltip="Add a new publication"
|
||||||
matTooltipPosition="left"
|
matTooltipPosition="left"
|
||||||
|
matRipple
|
||||||
i18n-matTooltip>
|
i18n-matTooltip>
|
||||||
+
|
+
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
@if (isLoading()) {
|
@if ((isLoading$ | async) === true) {
|
||||||
<h2 i18n>Publication loading...</h2>
|
<h2 i18n>Publication loading...</h2>
|
||||||
<mat-spinner></mat-spinner>
|
<mat-spinner></mat-spinner>
|
||||||
} @else {
|
} @else {
|
||||||
@if (isLoaded()) {
|
@if ((isLoaded$ | async) === true) {
|
||||||
<app-publication-list [publications$]="publications$"></app-publication-list>
|
<app-publication-list [publications$]="publications$"></app-publication-list>
|
||||||
} @else {
|
} @else {
|
||||||
<h2 i18n>There is no any publication...</h2>
|
<h2 i18n>There is no any publication...</h2>
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
import { Component, inject, OnDestroy, OnInit, signal } from "@angular/core";
|
import { Component, inject, OnInit } from "@angular/core";
|
||||||
import { MatProgressSpinnerModule } from "@angular/material/progress-spinner";
|
import { MatProgressSpinnerModule } from "@angular/material/progress-spinner";
|
||||||
import { MyPublicationsService } from "./my-publications.service";
|
import { MyPublicationsService } from "./my-publications.service";
|
||||||
import { Observable, Subscription } from "rxjs";
|
import { Observable } from "rxjs";
|
||||||
import { PublicationListComponent } from "../../components/publication-list/publication-list.component";
|
import { PublicationListComponent } from "../../components/publication-list/publication-list.component";
|
||||||
import { Publication } from "../../core/rest-services/publications/model/publication";
|
import { Publication } from "../../core/rest-services/publications/model/publication";
|
||||||
import { CommonModule } from "@angular/common";
|
import { CommonModule } from "@angular/common";
|
||||||
import { RouterModule } from "@angular/router";
|
import { RouterModule } from "@angular/router";
|
||||||
import { MatTooltipModule } from "@angular/material/tooltip";
|
import { MatTooltipModule } from "@angular/material/tooltip";
|
||||||
|
import { MatRippleModule } from "@angular/material/core";
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-my-component',
|
selector: 'app-my-component',
|
||||||
@@ -16,34 +18,29 @@ import { MatTooltipModule } from "@angular/material/tooltip";
|
|||||||
imports: [
|
imports: [
|
||||||
CommonModule,
|
CommonModule,
|
||||||
MatProgressSpinnerModule,
|
MatProgressSpinnerModule,
|
||||||
PublicationListComponent,
|
MatRippleModule,
|
||||||
MatTooltipModule,
|
MatTooltipModule,
|
||||||
|
PublicationListComponent,
|
||||||
RouterModule
|
RouterModule
|
||||||
],
|
],
|
||||||
providers: [MyPublicationsService]
|
providers: [MyPublicationsService]
|
||||||
})
|
})
|
||||||
export class MyPublicationsComponent implements OnInit, OnDestroy {
|
export class MyPublicationsComponent implements OnInit {
|
||||||
private readonly myPublicationsService = inject(MyPublicationsService);
|
private readonly myPublicationsService = inject(MyPublicationsService);
|
||||||
private isLoadingSubscription?: Subscription;
|
|
||||||
private isLoadedSubscription?: Subscription;
|
|
||||||
|
|
||||||
isLoading = signal(false);
|
|
||||||
isLoaded = signal(false);
|
|
||||||
|
|
||||||
get publications$(): Observable<Publication[]> {
|
get publications$(): Observable<Publication[]> {
|
||||||
return this.myPublicationsService.publications$;
|
return this.myPublicationsService.publications$;
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
get isLoading$(): Observable<boolean> {
|
||||||
this.isLoadingSubscription = this.myPublicationsService.isLoading$
|
return this.myPublicationsService.isLoading$;
|
||||||
.subscribe(isLoading => this.isLoading.set(isLoading));
|
|
||||||
this.isLoadedSubscription = this.myPublicationsService.isLoaded$
|
|
||||||
.subscribe(isLoaded => this.isLoaded.set(isLoaded));
|
|
||||||
this.myPublicationsService.loadAuthenticatedUserPublications();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
get isLoaded$(): Observable<boolean> {
|
||||||
this.isLoadingSubscription?.unsubscribe();
|
return this.myPublicationsService.isLoaded$;
|
||||||
this.isLoadedSubscription?.unsubscribe();
|
}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.myPublicationsService.loadAuthenticatedUserPublications();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,7 @@
|
|||||||
@if (publicationIsNotNull()) {
|
<app-publication-edition
|
||||||
<app-publication-edition
|
title="Creation of a new publication"
|
||||||
title="Creation of a new publication"
|
[publication]="publication"
|
||||||
[publication]="publication()!!"
|
[isSaving$]="isSaving$"
|
||||||
[isSaving$]="isSaving$"
|
(publicationSave)="onPublicationSave($event)"
|
||||||
(publicationSave)="onPublicationSave($event)"
|
i18n-title>
|
||||||
i18n-title>
|
</app-publication-edition>
|
||||||
</app-publication-edition>
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Component, computed, inject, OnInit, signal } from "@angular/core";
|
import { Component, inject, OnInit } from "@angular/core";
|
||||||
import { PublicationEditionComponent } from "../../components/publication-edition/publication-edition.component";
|
import { PublicationEditionComponent } from "../../components/publication-edition/publication-edition.component";
|
||||||
import { PublicationRestService } from "../../core/rest-services/publications/publication.rest-service";
|
import { PublicationRestService } from "../../core/rest-services/publications/publication.rest-service";
|
||||||
import { ActivatedRoute, Router } from "@angular/router";
|
import { ActivatedRoute, Router } from "@angular/router";
|
||||||
@@ -26,8 +26,7 @@ export class PublicationCreationComponent implements OnInit {
|
|||||||
private readonly snackBar = inject(MatSnackBar);
|
private readonly snackBar = inject(MatSnackBar);
|
||||||
private isSavingSubject = new BehaviorSubject<boolean>(false);
|
private isSavingSubject = new BehaviorSubject<boolean>(false);
|
||||||
private subscriptions: Subscription[] = [];
|
private subscriptions: Subscription[] = [];
|
||||||
publication = signal<Publication | undefined>(undefined);
|
publication!: Publication;
|
||||||
publicationIsNotNull = computed(() => !!this.publication());
|
|
||||||
|
|
||||||
get isSaving$(): Observable<boolean> {
|
get isSaving$(): Observable<boolean> {
|
||||||
return this.isSavingSubject.asObservable();
|
return this.isSavingSubject.asObservable();
|
||||||
@@ -41,7 +40,7 @@ export class PublicationCreationComponent implements OnInit {
|
|||||||
name: authenticatedUser.pseudo,
|
name: authenticatedUser.pseudo,
|
||||||
image: authenticatedUser.photoId ?? ''
|
image: authenticatedUser.photoId ?? ''
|
||||||
};
|
};
|
||||||
const newPublication: Publication = {
|
this.publication = {
|
||||||
id: '',
|
id: '',
|
||||||
key: '',
|
key: '',
|
||||||
title: '',
|
title: '',
|
||||||
@@ -53,7 +52,6 @@ export class PublicationCreationComponent implements OnInit {
|
|||||||
categoryId: '',
|
categoryId: '',
|
||||||
author
|
author
|
||||||
};
|
};
|
||||||
this.publication.set(newPublication);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
@if (isLoading()) {
|
@if ((isLoading$ | async) == true) {
|
||||||
<h2 i18n>Loading publication to edit...</h2>
|
<h2 i18n>Loading publication to edit...</h2>
|
||||||
<mat-spinner></mat-spinner>
|
<mat-spinner></mat-spinner>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { CommonModule, Location } from '@angular/common';
|
import { CommonModule, Location } from '@angular/common';
|
||||||
import { Component, inject, OnDestroy, OnInit, signal } from '@angular/core';
|
import { Component, inject, OnDestroy, OnInit } from '@angular/core';
|
||||||
import { ReactiveFormsModule } from '@angular/forms';
|
import { ReactiveFormsModule } from '@angular/forms';
|
||||||
import { MatDialogModule } from '@angular/material/dialog';
|
import { MatDialogModule } from '@angular/material/dialog';
|
||||||
import { MatIconModule } from '@angular/material/icon';
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
@@ -41,17 +41,21 @@ export class PublicationUpdateComponent implements OnInit, OnDestroy {
|
|||||||
private readonly location = inject(Location);
|
private readonly location = inject(Location);
|
||||||
private readonly router = inject(Router);
|
private readonly router = inject(Router);
|
||||||
private readonly snackBar = inject(MatSnackBar);
|
private readonly snackBar = inject(MatSnackBar);
|
||||||
|
private isLoadingSubject = new BehaviorSubject<boolean>(false);
|
||||||
private isSavingSubject = new BehaviorSubject<boolean>(false);
|
private isSavingSubject = new BehaviorSubject<boolean>(false);
|
||||||
private subscriptions: Subscription[] = [];
|
private subscriptions: Subscription[] = [];
|
||||||
isLoading = signal(false);
|
|
||||||
publication: Publication | undefined;
|
publication: Publication | undefined;
|
||||||
|
|
||||||
|
get isLoading$(): Observable<boolean> {
|
||||||
|
return this.isLoadingSubject.asObservable();
|
||||||
|
}
|
||||||
|
|
||||||
get isSaving$(): Observable<boolean> {
|
get isSaving$(): Observable<boolean> {
|
||||||
return this.isSavingSubject.asObservable();
|
return this.isSavingSubject.asObservable();
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.isLoading.set(true);
|
this.isLoadingSubject.next(true);
|
||||||
this.activatedRoute.paramMap.subscribe(params => {
|
this.activatedRoute.paramMap.subscribe(params => {
|
||||||
const publicationId = params.get('publicationId');
|
const publicationId = params.get('publicationId');
|
||||||
if (publicationId == undefined) {
|
if (publicationId == undefined) {
|
||||||
@@ -67,7 +71,7 @@ export class PublicationUpdateComponent implements OnInit, OnDestroy {
|
|||||||
this.snackBar.open(errorMessage, $localize`Close`, { duration: 5000 });
|
this.snackBar.open(errorMessage, $localize`Close`, { duration: 5000 });
|
||||||
console.error(errorMessage, error)
|
console.error(errorMessage, error)
|
||||||
})
|
})
|
||||||
.finally(() => this.isLoading.set(false));
|
.finally(() => this.isLoadingSubject.next(false));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,42 +1,40 @@
|
|||||||
@if (isLoading()) {
|
@if (isLoading) {
|
||||||
<h2 i18n>Publication content loading...</h2>
|
<h2 i18n>Publication content loading...</h2>
|
||||||
<mat-spinner></mat-spinner>
|
<mat-spinner></mat-spinner>
|
||||||
} @else {
|
} @else {
|
||||||
@if (isPublicationUndefined()) {
|
@if (publication) {
|
||||||
<div class="loading-failed">
|
|
||||||
<h1 i18n>Publication failed to load...</h1>
|
|
||||||
</div>
|
|
||||||
} @else {
|
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<img src="/api/pictures/{{ publication()?.illustrationId }}" />
|
<img src="/api/pictures/{{ publication.illustrationId }}" />
|
||||||
<header>
|
<header>
|
||||||
<h1>{{ publication()?.title }}</h1>
|
<h1>{{ publication.title }}</h1>
|
||||||
<h2>{{ publication()?.description }}</h2>
|
<h2>{{ publication.description }}</h2>
|
||||||
@if (isAuthorAndUserEquals()) {
|
@if (isAuthorAndUserEquals) {
|
||||||
<a [routerLink]="['edit']"
|
<a [routerLink]="['edit']"
|
||||||
class="button action"
|
class="button action"
|
||||||
matTooltip="Click to edit the publication"
|
matTooltip="Click to edit the publication"
|
||||||
|
matRipple
|
||||||
i18n-matTooltip>
|
i18n-matTooltip>
|
||||||
<mat-icon>edit</mat-icon>
|
<mat-icon>edit</mat-icon>
|
||||||
</a>
|
</a>
|
||||||
}
|
}
|
||||||
</header>
|
</header>
|
||||||
<main [innerHTML]="publication()?.parsedText"></main>
|
<main [innerHTML]="publication.parsedText"></main>
|
||||||
<footer>
|
<footer>
|
||||||
<div class="metadata">
|
<div class="metadata">
|
||||||
<img src="/api/pictures/{{ publication()?.author?.image }}" [matTooltip]="publication()?.author?.name" />
|
<img src="/api/pictures/{{ publication.author.image }}" [matTooltip]="publication.author.name" />
|
||||||
<div class="posting-data">
|
<div class="posting-data">
|
||||||
<span i18n>Publication posted by {{ publication()?.author?.name }}</span>
|
<span i18n>Publication posted by {{ publication.author.name }}</span>
|
||||||
<span class="publication-date">
|
<span class="publication-date">
|
||||||
({{ publication()?.creationDate | date: 'short' }})
|
({{ publication.creationDate | date: 'short' }})
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@if (isAuthorAndUserEquals()) {
|
@if (isAuthorAndUserEquals) {
|
||||||
<button type="button"
|
<button type="button"
|
||||||
(click)="deletePublication()"
|
(click)="deletePublication()"
|
||||||
matTooltip="Click to delete the publication"
|
matTooltip="Click to delete the publication"
|
||||||
matTooltipPosition="left"
|
matTooltipPosition="left"
|
||||||
|
matRipple
|
||||||
i18n-matTooltip>
|
i18n-matTooltip>
|
||||||
<mat-icon>delete</mat-icon>
|
<mat-icon>delete</mat-icon>
|
||||||
Delete
|
Delete
|
||||||
@@ -44,5 +42,9 @@
|
|||||||
}
|
}
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
|
} @else {
|
||||||
|
<div class="loading-failed">
|
||||||
|
<h1 i18n>Publication failed to load...</h1>
|
||||||
|
</div>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,8 +2,7 @@ $cardBorderRadius: .5em;
|
|||||||
|
|
||||||
:host {
|
:host {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
justify-content: center;
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
.card {
|
.card {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -1,25 +1,33 @@
|
|||||||
import { Component, OnDestroy, OnInit, computed, inject, signal } from '@angular/core';
|
|
||||||
import { PublicationRestService } from '../../core/rest-services/publications/publication.rest-service';
|
|
||||||
import { ActivatedRoute, Router, RouterModule } from '@angular/router';
|
|
||||||
import { Subscription } from 'rxjs';
|
|
||||||
import { Publication } from '../../core/rest-services/publications/model/publication';
|
|
||||||
import { MatSnackBar } from '@angular/material/snack-bar';
|
|
||||||
import { CommonModule, Location } from '@angular/common';
|
import { CommonModule, Location } from '@angular/common';
|
||||||
import { MatProgressSpinner } from '@angular/material/progress-spinner';
|
import { Component, OnDestroy, OnInit, inject } from '@angular/core';
|
||||||
import { MatTooltip, MatTooltipModule } from '@angular/material/tooltip';
|
import { MatRippleModule } from '@angular/material/core';
|
||||||
import { MatIcon } from '@angular/material/icon';
|
|
||||||
import { AuthenticationService } from '../../core/service/authentication.service';
|
|
||||||
import { MatDialog } from '@angular/material/dialog';
|
import { MatDialog } from '@angular/material/dialog';
|
||||||
|
import { MatIcon } from '@angular/material/icon';
|
||||||
|
import { MatProgressSpinner } from '@angular/material/progress-spinner';
|
||||||
|
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||||
|
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||||
|
import { ActivatedRoute, RouterModule } from '@angular/router';
|
||||||
|
import { Subscription } from 'rxjs';
|
||||||
import { ConfirmationDialog } from '../../components/confirmation-dialog/confirmation-dialog.component';
|
import { ConfirmationDialog } from '../../components/confirmation-dialog/confirmation-dialog.component';
|
||||||
|
import { Publication } from '../../core/rest-services/publications/model/publication';
|
||||||
|
import { PublicationRestService } from '../../core/rest-services/publications/publication.rest-service';
|
||||||
|
import { AuthenticationService } from '../../core/service/authentication.service';
|
||||||
|
|
||||||
declare let Prism: any;
|
declare let Prism: any;
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-publication',
|
selector: 'app-publication',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [CommonModule, MatProgressSpinner, MatTooltip, RouterModule, MatIcon, MatTooltipModule],
|
|
||||||
templateUrl: './publication.component.html',
|
templateUrl: './publication.component.html',
|
||||||
styleUrl: './publication.component.scss'
|
styleUrl: './publication.component.scss',
|
||||||
|
imports: [
|
||||||
|
CommonModule,
|
||||||
|
MatIcon,
|
||||||
|
MatRippleModule,
|
||||||
|
MatProgressSpinner,
|
||||||
|
MatTooltipModule,
|
||||||
|
RouterModule
|
||||||
|
]
|
||||||
})
|
})
|
||||||
export class PublicationComponent implements OnInit, OnDestroy {
|
export class PublicationComponent implements OnInit, OnDestroy {
|
||||||
private readonly activatedRoute = inject(ActivatedRoute);
|
private readonly activatedRoute = inject(ActivatedRoute);
|
||||||
@@ -30,10 +38,9 @@ export class PublicationComponent implements OnInit, OnDestroy {
|
|||||||
private readonly snackBar = inject(MatSnackBar);
|
private readonly snackBar = inject(MatSnackBar);
|
||||||
private paramMapSubscription?: Subscription;
|
private paramMapSubscription?: Subscription;
|
||||||
private afterDialogCloseSubscription?: Subscription;
|
private afterDialogCloseSubscription?: Subscription;
|
||||||
isLoading = signal(false);
|
isLoading: boolean = false;
|
||||||
isAuthorAndUserEquals = computed(() => this.authenticationService.getAuthenticatedUser()?.id === this.publication()?.author.id);
|
isAuthorAndUserEquals: boolean = false;
|
||||||
publication = signal<Publication | undefined>(undefined);
|
publication?: Publication;
|
||||||
isPublicationUndefined = computed(() => !this.publication())
|
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.paramMapSubscription = this.activatedRoute
|
this.paramMapSubscription = this.activatedRoute
|
||||||
@@ -42,11 +49,12 @@ export class PublicationComponent implements OnInit, OnDestroy {
|
|||||||
const publicationId = params.get('publicationId');
|
const publicationId = params.get('publicationId');
|
||||||
|
|
||||||
if (publicationId) {
|
if (publicationId) {
|
||||||
this.isLoading.set(true);
|
this.isLoading = true;
|
||||||
|
|
||||||
this.publicationRestService.getById(publicationId)
|
this.publicationRestService.getById(publicationId)
|
||||||
.then(publication => {
|
.then(publication => {
|
||||||
this.publication.set(publication);
|
this.publication = publication;
|
||||||
|
this.isAuthorAndUserEquals = this.authenticationService.getAuthenticatedUser()?.id === this.publication.author.id;
|
||||||
setTimeout(() => Prism.highlightAll(), 100);
|
setTimeout(() => Prism.highlightAll(), 100);
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
@@ -55,7 +63,7 @@ export class PublicationComponent implements OnInit, OnDestroy {
|
|||||||
console.error(errorMessage, error);
|
console.error(errorMessage, error);
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
this.isLoading.set(false);
|
this.isLoading = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -79,8 +87,8 @@ export class PublicationComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
this.afterDialogCloseSubscription = dialogRef.afterClosed()
|
this.afterDialogCloseSubscription = dialogRef.afterClosed()
|
||||||
.subscribe(response => {
|
.subscribe(response => {
|
||||||
if (response && !this.isPublicationUndefined()) {
|
if (response && this.publication?.id) {
|
||||||
this.publicationRestService.delete(this.publication()?.id!!);
|
this.publicationRestService.delete(this.publication.id);
|
||||||
this.snackBar.open($localize`Publication deleted`, $localize`Close`, { duration: 5000 });
|
this.snackBar.open($localize`Publication deleted`, $localize`Close`, { duration: 5000 });
|
||||||
this.location.back();
|
this.location.back();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<form [formGroup]="signinForm" (submit)="performSignin()" ngNativeValidate>
|
<form [formGroup]="signinForm" (submit)="performSignin()" class="cod-form card" ngNativeValidate>
|
||||||
<h1 i18n>Signin</h1>
|
<h1 i18n>Signin</h1>
|
||||||
<div>
|
<div class="form-field">
|
||||||
<mat-icon>person</mat-icon>
|
<mat-icon>person</mat-icon>
|
||||||
<label for="pseudo" i18n>
|
<label for="pseudo" i18n>
|
||||||
Pseudo
|
Pseudo
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
</label>
|
</label>
|
||||||
<input type="text" id="pseudo" formControlName="pseudo" autocomplete="pseudo" required />
|
<input type="text" id="pseudo" formControlName="pseudo" autocomplete="pseudo" required />
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div class="form-field">
|
||||||
<mat-icon>mail</mat-icon>
|
<mat-icon>mail</mat-icon>
|
||||||
<label for="email" i18n>
|
<label for="email" i18n>
|
||||||
Email address
|
Email address
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
</label>
|
</label>
|
||||||
<input type="email" id="email" formControlName="email" autocomplete="email" required />
|
<input type="email" id="email" formControlName="email" autocomplete="email" required />
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div class="form-field">
|
||||||
<mat-icon>lock</mat-icon>
|
<mat-icon>lock</mat-icon>
|
||||||
<label for="password" i18n>
|
<label for="password" i18n>
|
||||||
Password
|
Password
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
</label>
|
</label>
|
||||||
<input type="password" id="password" formControlName="password" required />
|
<input type="password" id="password" formControlName="password" required />
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div class="form-field">
|
||||||
<mat-icon>lock</mat-icon>
|
<mat-icon>lock</mat-icon>
|
||||||
<label for="confirm-password" i18n>
|
<label for="confirm-password" i18n>
|
||||||
Confirm password
|
Confirm password
|
||||||
@@ -32,8 +32,8 @@
|
|||||||
</label>
|
</label>
|
||||||
<input type="password" id="confirm-password" formControlName="confirmPassword" required />
|
<input type="password" id="confirm-password" formControlName="confirmPassword" required />
|
||||||
</div>
|
</div>
|
||||||
<div class="actions">
|
<div class="actions reversed">
|
||||||
<button type="submit" i18n>Send</button>
|
<app-submit-button [requestPending]="false" [disabled]="false" i18n>Send</app-submit-button>
|
||||||
<a [routerLink]="['/login']" i18n>I already have an account</a>
|
<a [routerLink]="['/login']" class="cod-button secondary" matRipple i18n>I already have an account</a>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
@@ -4,79 +4,4 @@
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
|
|
||||||
form {
|
|
||||||
width: 80%;
|
|
||||||
max-width: 20em;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: center;
|
|
||||||
gap: 1em;
|
|
||||||
box-shadow: 0 2px 5px 0 rgba(0,0,0,.16),0 2px 10px 0 rgba(0,0,0,.12);
|
|
||||||
border-radius: .5em;
|
|
||||||
padding: 1em 1.5em;
|
|
||||||
background-color: #ffffff;
|
|
||||||
|
|
||||||
h1 {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
div {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
position: relative;
|
|
||||||
gap: .1em;
|
|
||||||
|
|
||||||
mat-icon {
|
|
||||||
position: absolute;
|
|
||||||
top: 1.3em;
|
|
||||||
left: .5em;
|
|
||||||
color: #777;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.actions {
|
|
||||||
flex-direction: row-reverse;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
button {
|
|
||||||
padding: .8em 1.2em;
|
|
||||||
border-radius: 10em;
|
|
||||||
border: none;
|
|
||||||
background-color: #3f51b5;
|
|
||||||
color: white;
|
|
||||||
transition: background-color .2s ease-in-out;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
background-color: #5b6ed8;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
a {
|
|
||||||
color: #3f51b5;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
label {
|
|
||||||
flex: 1;
|
|
||||||
font-style: italic;
|
|
||||||
padding-left: 1em;
|
|
||||||
color: #777;
|
|
||||||
|
|
||||||
.required {
|
|
||||||
color: red;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
input {
|
|
||||||
flex: 1;
|
|
||||||
background-color: #eeeeee;
|
|
||||||
border: none;
|
|
||||||
border-radius: 10em;
|
|
||||||
padding: 1em 1em 1em 3em;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -6,13 +6,21 @@ import { Subscription, debounceTime, distinctUntilChanged, map } from 'rxjs';
|
|||||||
import { SigninService } from './signin.service';
|
import { SigninService } from './signin.service';
|
||||||
import { LoginService } from '../login/login.service';
|
import { LoginService } from '../login/login.service';
|
||||||
import { FormError } from '../../core/model/FormError';
|
import { FormError } from '../../core/model/FormError';
|
||||||
|
import { SubmitButtonComponent } from "../../components/submit-button/submit-button.component";
|
||||||
|
import { MatRippleModule } from '@angular/material/core';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-signin',
|
selector: 'app-signin',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [ReactiveFormsModule, MatIconModule, RouterModule],
|
|
||||||
templateUrl: './signin.component.html',
|
templateUrl: './signin.component.html',
|
||||||
styleUrl: './signin.component.scss',
|
styleUrl: './signin.component.scss',
|
||||||
|
imports: [
|
||||||
|
MatIconModule,
|
||||||
|
MatRippleModule,
|
||||||
|
ReactiveFormsModule,
|
||||||
|
RouterModule,
|
||||||
|
SubmitButtonComponent
|
||||||
|
],
|
||||||
providers: [SigninService, LoginService]
|
providers: [SigninService, LoginService]
|
||||||
})
|
})
|
||||||
export class SigninComponent implements OnInit, OnDestroy {
|
export class SigninComponent implements OnInit, OnDestroy {
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
43
frontend/src/design_system/button.scss
Normal file
43
frontend/src/design_system/button.scss
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
button.cod-button, a.cod-button {
|
||||||
|
padding: .8em 1.2em;
|
||||||
|
border-radius: 10em;
|
||||||
|
border: none;
|
||||||
|
background-color: #3f51b5;
|
||||||
|
color: white;
|
||||||
|
transition: background-color .2s ease-in-out;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: #5b6ed8;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.secondary {
|
||||||
|
color: #3f51b5;
|
||||||
|
background-color: white;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: #f2f4ff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.icon {
|
||||||
|
$buttonSize: 2.5em;
|
||||||
|
width: $buttonSize;
|
||||||
|
height: $buttonSize;
|
||||||
|
padding: 0;
|
||||||
|
|
||||||
|
&.close {
|
||||||
|
position: absolute;
|
||||||
|
top: 1em;
|
||||||
|
right: 1em;
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
a.cod-button {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
64
frontend/src/design_system/form.scss
Normal file
64
frontend/src/design_system/form.scss
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
form.cod-form {
|
||||||
|
&.card {
|
||||||
|
width: 80%;
|
||||||
|
max-width: 20em;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 1em;
|
||||||
|
box-shadow: 0 2px 5px 0 rgba(0,0,0,.16),0 2px 10px 0 rgba(0,0,0,.12);
|
||||||
|
border-radius: .5em;
|
||||||
|
padding: 1em 1.5em;
|
||||||
|
background-color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
div {
|
||||||
|
&.actions {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
&.reversed {
|
||||||
|
flex-direction: row-reverse;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.form-field {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
position: relative;
|
||||||
|
gap: .1em;
|
||||||
|
|
||||||
|
mat-icon {
|
||||||
|
position: absolute;
|
||||||
|
top: 1.3em;
|
||||||
|
left: .5em;
|
||||||
|
color: #777;
|
||||||
|
}
|
||||||
|
|
||||||
|
label {
|
||||||
|
flex: 1;
|
||||||
|
font-style: italic;
|
||||||
|
padding-left: 1em;
|
||||||
|
color: #777;
|
||||||
|
|
||||||
|
.required {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
input {
|
||||||
|
flex: 1;
|
||||||
|
background-color: #eeeeee;
|
||||||
|
border: none;
|
||||||
|
border-radius: 10em;
|
||||||
|
padding: 1em 1em 1em 3em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
2
frontend/src/design_system/index.scss
Normal file
2
frontend/src/design_system/index.scss
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
@use './button.scss';
|
||||||
|
@use './form.scss';
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
@@ -3,7 +3,7 @@
|
|||||||
"translations": {
|
"translations": {
|
||||||
"3603720768157919481": "Non",
|
"3603720768157919481": "Non",
|
||||||
"4861926948802653243": "Oui",
|
"4861926948802653243": "Oui",
|
||||||
"5277292207846698726": "{$START_TAG_SPAN}©{$CLOSE_TAG_SPAN} 2016 - 2024 Tous droits réservés - 2.0-alpha {$START_LINK}{$START_TAG_MAT_ICON}favorite{$CLOSE_TAG_MAT_ICON}{$CLOSE_LINK}",
|
"6130235414952256120": "{$START_TAG_SPAN}©{$CLOSE_TAG_SPAN} 2016 - 2024 Tous droits réservés - 2.1 {$START_LINK}{$START_TAG_MAT_ICON}favorite{$CLOSE_TAG_MAT_ICON}{$CLOSE_LINK}",
|
||||||
"9214089025589249203": "Les indicateurs de vie du site seront disponibles ultérieurement...",
|
"9214089025589249203": "Les indicateurs de vie du site seront disponibles ultérieurement...",
|
||||||
"1711651175531679766": "La documentation sera disponible ultérieurement...",
|
"1711651175531679766": "La documentation sera disponible ultérieurement...",
|
||||||
"6299155290121808295": "Développements realisés par",
|
"6299155290121808295": "Développements realisés par",
|
||||||
@@ -11,6 +11,7 @@
|
|||||||
"3394094310583807145": "{$START_TAG_MAT_ICON}description{$CLOSE_TAG_MAT_ICON} Mes publications",
|
"3394094310583807145": "{$START_TAG_MAT_ICON}description{$CLOSE_TAG_MAT_ICON} Mes publications",
|
||||||
"5690703874094076840": "{$START_TAG_MAT_ICON}logout{$CLOSE_TAG_MAT_ICON} Déconnexion",
|
"5690703874094076840": "{$START_TAG_MAT_ICON}logout{$CLOSE_TAG_MAT_ICON} Déconnexion",
|
||||||
"2454050363478003966": "Connexion",
|
"2454050363478003966": "Connexion",
|
||||||
|
"7819314041543176992": "Fermer",
|
||||||
"6379828571327118783": "Ajouter un bloc de code",
|
"6379828571327118783": "Ajouter un bloc de code",
|
||||||
"933522671092765466": "Langage de programmation",
|
"933522671092765466": "Langage de programmation",
|
||||||
"5953425146193292178": "Bloc de code",
|
"5953425146193292178": "Bloc de code",
|
||||||
@@ -22,7 +23,6 @@
|
|||||||
"4491342806775118195": "Il n'y a aucune image.",
|
"4491342806775118195": "Il n'y a aucune image.",
|
||||||
"5036131155743433968": "{$START_TAG_MAT_ICON}upload_file{$CLOSE_TAG_MAT_ICON} Ajouter une nouvelle image",
|
"5036131155743433968": "{$START_TAG_MAT_ICON}upload_file{$CLOSE_TAG_MAT_ICON} Ajouter une nouvelle image",
|
||||||
"6852365376059142995": "Une erreur est survenue lors du chargements de vos images.",
|
"6852365376059142995": "Une erreur est survenue lors du chargements de vos images.",
|
||||||
"7819314041543176992": "Fermer",
|
|
||||||
"6198966268398913224": "Une erreur technique est survenue lors de l'ajout de votre image.",
|
"6198966268398913224": "Une erreur technique est survenue lors de l'ajout de votre image.",
|
||||||
"3603937053948195893": "Édition",
|
"3603937053948195893": "Édition",
|
||||||
"5701618810648052610": "Titre",
|
"5701618810648052610": "Titre",
|
||||||
@@ -32,8 +32,8 @@
|
|||||||
"382530603854484923": "Cliquez pour ajouter une section titre de niveau 1",
|
"382530603854484923": "Cliquez pour ajouter une section titre de niveau 1",
|
||||||
"7918008528690631661": "Cliquez pour ajouter une section titre de niveau 2",
|
"7918008528690631661": "Cliquez pour ajouter une section titre de niveau 2",
|
||||||
"200884310255063303": "Cliquez pour ajouter une section titre de niveau 3",
|
"200884310255063303": "Cliquez pour ajouter une section titre de niveau 3",
|
||||||
"327371240590280003": "Cliquez pour ajouter une image",
|
|
||||||
"2615926469669796978": "Cliquez pour ajouter un lien",
|
"2615926469669796978": "Cliquez pour ajouter un lien",
|
||||||
|
"327371240590280003": "Cliquez pour ajouter une image",
|
||||||
"4689637499823680515": "Cliquez pour ajouter un bloc de code",
|
"4689637499823680515": "Cliquez pour ajouter un bloc de code",
|
||||||
"1065684538660053227": "Cliquez pour afficher l'aide",
|
"1065684538660053227": "Cliquez pour afficher l'aide",
|
||||||
"6205355627445317276": "Contenu",
|
"6205355627445317276": "Contenu",
|
||||||
@@ -46,6 +46,7 @@
|
|||||||
"9122763438636464100": "Fermer le menu",
|
"9122763438636464100": "Fermer le menu",
|
||||||
"1902100407096396858": "Catégories",
|
"1902100407096396858": "Catégories",
|
||||||
"6940115735259407353": "Une erreur est survenue lors du chargement des catégories.",
|
"6940115735259407353": "Une erreur est survenue lors du chargement des catégories.",
|
||||||
|
"3516191632292372377": "Vous ne pouvez pas accéder à cette page car vous êtes déjà connecté.",
|
||||||
"3450287383703155559": "Vous n'êtes pas connecté. Veuillez vous connecter avant de réessayer.",
|
"3450287383703155559": "Vous n'êtes pas connecté. Veuillez vous connecter avant de réessayer.",
|
||||||
"5455465794443528807": "You n'êtes pas connecté. Veuillez vous connecter avant de réessayer votre opération.",
|
"5455465794443528807": "You n'êtes pas connecté. Veuillez vous connecter avant de réessayer votre opération.",
|
||||||
"4011987306265136481": "Déconnexion...",
|
"4011987306265136481": "Déconnexion...",
|
||||||
@@ -59,6 +60,7 @@
|
|||||||
"2308975396733519902": "Créer un compte",
|
"2308975396733519902": "Créer un compte",
|
||||||
"1037765878727976611": "Connexion réussie",
|
"1037765878727976611": "Connexion réussie",
|
||||||
"6034686865111167926": "Une erreur est survenue lors de la connexion.",
|
"6034686865111167926": "Une erreur est survenue lors de la connexion.",
|
||||||
|
"5304730975301536612": "Veuillez renseigner tous les champs avant de valider.",
|
||||||
"1041423751558601074": "Vos publications",
|
"1041423751558601074": "Vos publications",
|
||||||
"5463894166935799864": "Rédiger une nouvelle publication",
|
"5463894166935799864": "Rédiger une nouvelle publication",
|
||||||
"1519054954638405159": "Chargement de la liste de vos publications...",
|
"1519054954638405159": "Chargement de la liste de vos publications...",
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"locale": "en-UK",
|
"locale": "en",
|
||||||
"translations": {
|
"translations": {
|
||||||
"3603720768157919481": " No ",
|
"3603720768157919481": " No ",
|
||||||
"4861926948802653243": " Yes ",
|
"4861926948802653243": " Yes ",
|
||||||
"5277292207846698726": "{$START_TAG_SPAN}©{$CLOSE_TAG_SPAN} 2016 - 2024 All rights reserved - 2.0-alpha {$START_LINK}{$START_TAG_MAT_ICON}favorite{$CLOSE_TAG_MAT_ICON}{$CLOSE_LINK}",
|
"6130235414952256120": "{$START_TAG_SPAN}©{$CLOSE_TAG_SPAN} 2016 - 2024 All rights reserved - 2.1 {$START_LINK}{$START_TAG_MAT_ICON}favorite{$CLOSE_TAG_MAT_ICON}{$CLOSE_LINK}",
|
||||||
"9214089025589249203": "Health checking will be available in future...",
|
"9214089025589249203": "Health checking will be available in future...",
|
||||||
"1711651175531679766": "Documentation will be available in future...",
|
"1711651175531679766": "Documentation will be available in future...",
|
||||||
"6299155290121808295": "Development realised by",
|
"6299155290121808295": "Development realised by",
|
||||||
@@ -11,6 +11,7 @@
|
|||||||
"3394094310583807145": "{$START_TAG_MAT_ICON}description{$CLOSE_TAG_MAT_ICON} My publications ",
|
"3394094310583807145": "{$START_TAG_MAT_ICON}description{$CLOSE_TAG_MAT_ICON} My publications ",
|
||||||
"5690703874094076840": "{$START_TAG_MAT_ICON}logout{$CLOSE_TAG_MAT_ICON} Disconnect ",
|
"5690703874094076840": "{$START_TAG_MAT_ICON}logout{$CLOSE_TAG_MAT_ICON} Disconnect ",
|
||||||
"2454050363478003966": "Login",
|
"2454050363478003966": "Login",
|
||||||
|
"7819314041543176992": "Close",
|
||||||
"6379828571327118783": "Add a code block",
|
"6379828571327118783": "Add a code block",
|
||||||
"933522671092765466": "Programming language",
|
"933522671092765466": "Programming language",
|
||||||
"5953425146193292178": "Code block",
|
"5953425146193292178": "Code block",
|
||||||
@@ -22,7 +23,6 @@
|
|||||||
"4491342806775118195": "There is no any picture.",
|
"4491342806775118195": "There is no any picture.",
|
||||||
"5036131155743433968": "{$START_TAG_MAT_ICON}upload_file{$CLOSE_TAG_MAT_ICON} Add new picture ",
|
"5036131155743433968": "{$START_TAG_MAT_ICON}upload_file{$CLOSE_TAG_MAT_ICON} Add new picture ",
|
||||||
"6852365376059142995": "An error occured while loading pictures.",
|
"6852365376059142995": "An error occured while loading pictures.",
|
||||||
"7819314041543176992": "Close",
|
|
||||||
"6198966268398913224": "A technical error occured while uploading your picture.",
|
"6198966268398913224": "A technical error occured while uploading your picture.",
|
||||||
"3603937053948195893": "Edition",
|
"3603937053948195893": "Edition",
|
||||||
"5701618810648052610": "Title",
|
"5701618810648052610": "Title",
|
||||||
@@ -32,8 +32,8 @@
|
|||||||
"382530603854484923": "Click to insert a title 1 section",
|
"382530603854484923": "Click to insert a title 1 section",
|
||||||
"7918008528690631661": "Click to insert a title 2 section",
|
"7918008528690631661": "Click to insert a title 2 section",
|
||||||
"200884310255063303": "Click to insert a title 3 section",
|
"200884310255063303": "Click to insert a title 3 section",
|
||||||
"327371240590280003": "Click to insert a picture",
|
|
||||||
"2615926469669796978": "Click to insert a link",
|
"2615926469669796978": "Click to insert a link",
|
||||||
|
"327371240590280003": "Click to insert a picture",
|
||||||
"4689637499823680515": "Click to insert a code block",
|
"4689637499823680515": "Click to insert a code block",
|
||||||
"1065684538660053227": "Click to display editor help",
|
"1065684538660053227": "Click to display editor help",
|
||||||
"6205355627445317276": "Content",
|
"6205355627445317276": "Content",
|
||||||
@@ -46,6 +46,7 @@
|
|||||||
"9122763438636464100": "Close the menu",
|
"9122763438636464100": "Close the menu",
|
||||||
"1902100407096396858": "Categories",
|
"1902100407096396858": "Categories",
|
||||||
"6940115735259407353": "An error occured while loading categories.",
|
"6940115735259407353": "An error occured while loading categories.",
|
||||||
|
"3516191632292372377": "You can't access to this page because you are already authenticated.",
|
||||||
"3450287383703155559": "You are unauthenticated. Please, log-in first.",
|
"3450287383703155559": "You are unauthenticated. Please, log-in first.",
|
||||||
"5455465794443528807": "You are unauthenticated. Please, re-authenticate before retrying your action.",
|
"5455465794443528807": "You are unauthenticated. Please, re-authenticate before retrying your action.",
|
||||||
"4011987306265136481": "Disconnection...",
|
"4011987306265136481": "Disconnection...",
|
||||||
@@ -59,6 +60,7 @@
|
|||||||
"2308975396733519902": "Create an account",
|
"2308975396733519902": "Create an account",
|
||||||
"1037765878727976611": "Authentication succeeded!",
|
"1037765878727976611": "Authentication succeeded!",
|
||||||
"6034686865111167926": "Authentication failed.",
|
"6034686865111167926": "Authentication failed.",
|
||||||
|
"5304730975301536612": "Please, fill the inputs before send.",
|
||||||
"1041423751558601074": "Your publications",
|
"1041423751558601074": "Your publications",
|
||||||
"5463894166935799864": "Add a new publication",
|
"5463894166935799864": "Add a new publication",
|
||||||
"1519054954638405159": "Publication loading...",
|
"1519054954638405159": "Publication loading...",
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
/* You can add global styles to this file, and also import other style files */
|
/* You can add global styles to this file, and also import other style files */
|
||||||
|
@use './design_system/index.scss';
|
||||||
|
|
||||||
html, body { height: 100%; }
|
html, body { height: 100%; }
|
||||||
body {
|
body {
|
||||||
|
|||||||
Reference in New Issue
Block a user