Login et agencement de la main page #51
| @ -5,6 +5,12 @@ on: | |||||||
|   push: |   push: | ||||||
|     branches: |     branches: | ||||||
|       - master  |       - master  | ||||||
|  |   workflow_run: | ||||||
|  |     workflows: | ||||||
|  |       - Build and test backend  | ||||||
|  |       - Build and test frontend  | ||||||
|  |     types: | ||||||
|  |       - completed | ||||||
|   workflow_dispatch: |   workflow_dispatch: | ||||||
|  |  | ||||||
| jobs: | jobs: | ||||||
| @ -47,5 +53,5 @@ jobs: | |||||||
|         scp -o "StrictHostKeyChecking=no" -o "LogLevel=ERROR" -i key -r * ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:api/ |         scp -o "StrictHostKeyChecking=no" -o "LogLevel=ERROR" -i key -r * ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:api/ | ||||||
|     - name: restarting the backend  |     - name: restarting the backend  | ||||||
|       run: | |       run: | | ||||||
|         ssh -o "StrictHostKeyChecking=no" -o "LogLevel=ERROR" -i key ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "cd api/backend && docker build -t clyde/backend . && docker run --rm -d -p 4000:8080 clyde/backend && docker image prune -f" |         ssh -o "StrictHostKeyChecking=no" -o "LogLevel=ERROR" -i key ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "cd api/backend && docker build -t clyde/backend . && docker rm clyde_backend_prod -f || true && docker run --rm -d --name clyde_backend_prod -p 4000:8080 clyde/backend && docker image prune -f" | ||||||
|     - run: echo "The backend has been deployed. running at https://clyde.herisson.ovh/api" |     - run: echo "The backend has been deployed. running at https://clyde.herisson.ovh/api" | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| FROM eclipse-temurin:21-jdk-alpine | FROM eclipse-temurin:21-jdk-alpine | ||||||
| VOLUME /tmp | VOLUME /tmp | ||||||
|  | ENV SPRING_PROFILES_ACTIVE=prod | ||||||
| COPY build/libs/backend-0.0.1-SNAPSHOT.jar /app.jar | COPY build/libs/backend-0.0.1-SNAPSHOT.jar /app.jar | ||||||
| ENTRYPOINT ["java", "-jar", "/app.jar"] | ENTRYPOINT ["java", "-jar", "/app.jar"] | ||||||
|  | |||||||
| @ -19,7 +19,7 @@ dependencies { | |||||||
| 	implementation("org.springframework.boot:spring-boot-starter-jdbc") | 	implementation("org.springframework.boot:spring-boot-starter-jdbc") | ||||||
| 	implementation("org.springframework.boot:spring-boot-starter-mail") | 	implementation("org.springframework.boot:spring-boot-starter-mail") | ||||||
| 	implementation("org.springframework.boot:spring-boot-starter-web") | 	implementation("org.springframework.boot:spring-boot-starter-web") | ||||||
| 	implementation("org.springframework.session:spring-session-jdbc") | 	// implementation("org.springframework.session:spring-session-jdbc") | ||||||
| 	developmentOnly("org.springframework.boot:spring-boot-devtools") | 	developmentOnly("org.springframework.boot:spring-boot-devtools") | ||||||
| 	developmentOnly("org.springframework.boot:spring-boot-docker-compose") | 	developmentOnly("org.springframework.boot:spring-boot-docker-compose") | ||||||
| 	runtimeOnly("org.postgresql:postgresql") | 	runtimeOnly("org.postgresql:postgresql") | ||||||
|  | |||||||
| @ -1,16 +1,18 @@ | |||||||
| package ovh.herisson.Clyde.EndPoints; | package ovh.herisson.Clyde.EndPoints; | ||||||
|  |  | ||||||
| import org.springframework.web.bind.annotation.GetMapping; | import org.springframework.web.bind.annotation.GetMapping; | ||||||
|  | import org.springframework.web.bind.annotation.CrossOrigin; | ||||||
| import org.springframework.web.bind.annotation.RestController; | import org.springframework.web.bind.annotation.RestController; | ||||||
|  |  | ||||||
| import ovh.herisson.Clyde.Ping; | import ovh.herisson.Clyde.Ping; | ||||||
|  |  | ||||||
| @RestController | @RestController | ||||||
|  | @CrossOrigin(origins = "http://localhost:5173") | ||||||
| public class PingController { | public class PingController { | ||||||
|  |  | ||||||
| 	@GetMapping("/ping") | 	@GetMapping("/ping") | ||||||
| 	public Ping ping(){ | 	public Ping ping(){ | ||||||
| 		return new Ping(1, "test"); | 		return new Ping(1, "pong"); | ||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
| } | } | ||||||
|  | |||||||
| @ -4,12 +4,16 @@ import javax.sql.DataSource; | |||||||
|  |  | ||||||
| import org.springframework.context.annotation.Bean; | import org.springframework.context.annotation.Bean; | ||||||
| import org.springframework.context.annotation.Configuration; | import org.springframework.context.annotation.Configuration; | ||||||
|  | import org.springframework.context.annotation.Profile; | ||||||
| import org.springframework.jdbc.datasource.DriverManagerDataSource; | import org.springframework.jdbc.datasource.DriverManagerDataSource; | ||||||
|  | import org.springframework.web.servlet.config.annotation.CorsRegistry; | ||||||
|  | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; | ||||||
|  |  | ||||||
| @Configuration | @Configuration | ||||||
| public class JdbcConfig { | public class JdbcConfig { | ||||||
|  |  | ||||||
| 	@Bean | 	@Bean | ||||||
|  | 	@Profile("!prod") | ||||||
| 	public DataSource psqlSource(){ | 	public DataSource psqlSource(){ | ||||||
| 		DriverManagerDataSource source = new DriverManagerDataSource(); | 		DriverManagerDataSource source = new DriverManagerDataSource(); | ||||||
| 		source.setDriverClassName("org.postgresql.Driver"); | 		source.setDriverClassName("org.postgresql.Driver"); | ||||||
| @ -20,4 +24,26 @@ public class JdbcConfig { | |||||||
| 		return source; | 		return source; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	@Bean | ||||||
|  | 	@Profile("prod") | ||||||
|  | 	public DataSource psqlSourceProd(){ | ||||||
|  | 		DriverManagerDataSource source = new DriverManagerDataSource(); | ||||||
|  | 		source.setDriverClassName("org.postgresql.Driver"); | ||||||
|  | 		source.setUrl("jdbc:postgresql://localhost:5432/clyde"); | ||||||
|  | 		source.setUsername("clyde"); | ||||||
|  |  | ||||||
|  | 		return source; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  |  | ||||||
|  | 	@Bean | ||||||
|  | 	public WebMvcConfigurer corsConfigurer() { | ||||||
|  | 		return new WebMvcConfigurer() { | ||||||
|  | 			@Override | ||||||
|  | 			public void addCorsMappings(CorsRegistry registry) { | ||||||
|  | 				registry.addMapping("/greeting-javaconfig").allowedOrigins("*"); | ||||||
|  | 			} | ||||||
|  | 		}; | ||||||
|  | 	} | ||||||
|  |  | ||||||
| } | } | ||||||
|  | |||||||
							
								
								
									
										24
									
								
								frontend/package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										24
									
								
								frontend/package-lock.json
									
									
									
										generated
									
									
									
								
							| @ -8,7 +8,8 @@ | |||||||
|       "name": "clyde", |       "name": "clyde", | ||||||
|       "version": "0.0.0", |       "version": "0.0.0", | ||||||
|       "dependencies": { |       "dependencies": { | ||||||
|         "vue": "^3.4.15" |         "vue": "^3.4.15", | ||||||
|  |         "vue3-toastify": "^0.2.1" | ||||||
|       }, |       }, | ||||||
|       "devDependencies": { |       "devDependencies": { | ||||||
|         "@vitejs/plugin-vue": "^5.0.3", |         "@vitejs/plugin-vue": "^5.0.3", | ||||||
| @ -2396,6 +2397,27 @@ | |||||||
|       "integrity": "sha512-0vOfAtI67UjeO1G6UiX5Kd76CqaQ67wrRZiOe7UAb9Jm6GzlUr/fC7CV90XfwapJRjpCMaZFhv1V0ajWRmE9Dg==", |       "integrity": "sha512-0vOfAtI67UjeO1G6UiX5Kd76CqaQ67wrRZiOe7UAb9Jm6GzlUr/fC7CV90XfwapJRjpCMaZFhv1V0ajWRmE9Dg==", | ||||||
|       "dev": true |       "dev": true | ||||||
|     }, |     }, | ||||||
|  |     "node_modules/vue3-toastify": { | ||||||
|  |       "version": "0.2.1", | ||||||
|  |       "resolved": "https://registry.npmjs.org/vue3-toastify/-/vue3-toastify-0.2.1.tgz", | ||||||
|  |       "integrity": "sha512-u4i5LCu1q5qs4L4Kbjb4u8NipCS8ox1fCHQ6XFS62676xnA6Q/AJRpZEkAurTMp723LeH6eQX6k9+24bKf1T4Q==", | ||||||
|  |       "workspaces": [ | ||||||
|  |         "docs", | ||||||
|  |         "playground" | ||||||
|  |       ], | ||||||
|  |       "engines": { | ||||||
|  |         "node": ">=16", | ||||||
|  |         "npm": ">=7" | ||||||
|  |       }, | ||||||
|  |       "peerDependencies": { | ||||||
|  |         "vue": ">=3.2.0" | ||||||
|  |       }, | ||||||
|  |       "peerDependenciesMeta": { | ||||||
|  |         "vue": { | ||||||
|  |           "optional": true | ||||||
|  |         } | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|     "node_modules/w3c-xmlserializer": { |     "node_modules/w3c-xmlserializer": { | ||||||
|       "version": "5.0.0", |       "version": "5.0.0", | ||||||
|       "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-5.0.0.tgz", |       "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-5.0.0.tgz", | ||||||
|  | |||||||
| @ -10,7 +10,8 @@ | |||||||
|     "test:unit": "vitest" |     "test:unit": "vitest" | ||||||
|   }, |   }, | ||||||
|   "dependencies": { |   "dependencies": { | ||||||
|     "vue": "^3.4.15" |     "vue": "^3.4.15", | ||||||
|  |     "vue3-toastify": "^0.2.1" | ||||||
|   }, |   }, | ||||||
|   "devDependencies": { |   "devDependencies": { | ||||||
|     "@vitejs/plugin-vue": "^5.0.3", |     "@vitejs/plugin-vue": "^5.0.3", | ||||||
|  | |||||||
| @ -1,5 +1,15 @@ | |||||||
| <script setup> | <script setup> | ||||||
| 	import 'https://kit.fontawesome.com/fb3bbd0a95.js' | 	import 'https://kit.fontawesome.com/fb3bbd0a95.js' | ||||||
|  | 	import { toast } from 'vue3-toastify'; | ||||||
|  | 	import { ref } from 'vue' | ||||||
|  |  | ||||||
|  | 	const test = ref(); | ||||||
|  |  | ||||||
|  | 	async function draw(e) { | ||||||
|  | 		test.value = (await fetch("http://localhost:8080/ping")); | ||||||
|  | 		test.value = await test.value.json(); | ||||||
|  | 		toast(test.value['txt']); | ||||||
|  | 	} | ||||||
| </script> | </script> | ||||||
|  |  | ||||||
| <template> | <template> | ||||||
| @ -17,7 +27,7 @@ | |||||||
|     <ul class="horizontal" style="box-shadow: 0px 3px 3px rgb(0, 0, 0);"> |     <ul class="horizontal" style="box-shadow: 0px 3px 3px rgb(0, 0, 0);"> | ||||||
|         <li title="Home"> |         <li title="Home"> | ||||||
|             <a href="#home"> |             <a href="#home"> | ||||||
|                 <img  src="./assets/Clyde.png" style="width: 40px; height: auto; margin-top:4px"> |                 <img @click="draw" src="./assets/Clyde.png" style="width: 40px; height: auto; margin-top:4px"> | ||||||
|             </a> |             </a> | ||||||
|         </li> |         </li> | ||||||
|         <li title="Home"> |         <li title="Home"> | ||||||
|  | |||||||
| @ -1,5 +1,7 @@ | |||||||
| import './assets/main.css' | import './assets/main.css' | ||||||
|  |  | ||||||
|  | import 'vue3-toastify/dist/index.css'; | ||||||
|  |  | ||||||
| import { createApp } from 'vue' | import { createApp } from 'vue' | ||||||
| import App from './App.vue' | import App from './App.vue' | ||||||
|  |  | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user