From e7ebcc0d3a319f2f75cafcedbef9c43d84e57a21 Mon Sep 17 00:00:00 2001 From: Pierre Tellier Date: Sun, 9 Feb 2025 12:36:43 +0100 Subject: [PATCH 01/13] feat: created eslint config --- front/MyINPulse-front/.gitignore | 2 +- front/MyINPulse-front/eslint.config.js | 29 ++++++++++++++++++++++++++ front/MyINPulse-front/package.json | 6 ++++++ front/MyINPulse-front/src/App.vue | 10 ++++----- 4 files changed, 41 insertions(+), 6 deletions(-) create mode 100644 front/MyINPulse-front/eslint.config.js diff --git a/front/MyINPulse-front/.gitignore b/front/MyINPulse-front/.gitignore index 310fe19..1181133 100644 --- a/front/MyINPulse-front/.gitignore +++ b/front/MyINPulse-front/.gitignore @@ -36,4 +36,4 @@ playwright-report/ # Custom .installed -package-lock.json \ No newline at end of file +./package-lock.json \ No newline at end of file diff --git a/front/MyINPulse-front/eslint.config.js b/front/MyINPulse-front/eslint.config.js new file mode 100644 index 0000000..ae7a539 --- /dev/null +++ b/front/MyINPulse-front/eslint.config.js @@ -0,0 +1,29 @@ +import eslint from '@eslint/js'; +import eslintConfigPrettier from 'eslint-config-prettier'; +import eslintPluginVue from 'eslint-plugin-vue'; +import globals from 'globals'; +import typescriptEslint from 'typescript-eslint'; + +export default typescriptEslint.config( + { ignores: ['*.d.ts', '**/coverage', '**/dist'] }, + { + extends: [ + eslint.configs.recommended, + ...typescriptEslint.configs.recommended, + ...eslintPluginVue.configs['flat/recommended'], + ], + files: ['**/*.{ts,vue}'], + languageOptions: { + ecmaVersion: 'latest', + sourceType: 'module', + globals: globals.browser, + parserOptions: { + parser: typescriptEslint.parser, + }, + }, + rules: { + // your rules + }, + }, + eslintConfigPrettier +); \ No newline at end of file diff --git a/front/MyINPulse-front/package.json b/front/MyINPulse-front/package.json index 0f7da90..6eb12d7 100644 --- a/front/MyINPulse-front/package.json +++ b/front/MyINPulse-front/package.json @@ -26,8 +26,14 @@ "@types/node": "^22.10.7", "@vitejs/plugin-vue": "^5.2.1", "@vue/tsconfig": "^0.7.0", + "eslint": "^9.20.0", + "eslint-config-prettier": "^10.0.1", + "eslint-plugin-vue": "^9.32.0", + "globals": "^15.14.0", + "jiti": "^2.4.2", "npm-run-all2": "^7.0.2", "typescript": "~5.7.3", + "typescript-eslint": "^8.23.0", "vite": "^6.0.11", "vite-plugin-vue-devtools": "^7.7.0", "vue-tsc": "^2.2.0" diff --git a/front/MyINPulse-front/src/App.vue b/front/MyINPulse-front/src/App.vue index 8b3eee1..fd3e06e 100644 --- a/front/MyINPulse-front/src/App.vue +++ b/front/MyINPulse-front/src/App.vue @@ -10,15 +10,12 @@ import ErrorWrapper from "@/views/errorWrapper.vue"; - - \ No newline at end of file + + + \ No newline at end of file From a4939737fe7ed8c8e76f33d5eb872234d4278bda Mon Sep 17 00:00:00 2001 From: Pierre Tellier Date: Sun, 9 Feb 2025 13:57:17 +0100 Subject: [PATCH 02/13] feat: trying to setup linter --- .gitea/workflows/linter.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .gitea/workflows/linter.yaml diff --git a/.gitea/workflows/linter.yaml b/.gitea/workflows/linter.yaml new file mode 100644 index 0000000..18430eb --- /dev/null +++ b/.gitea/workflows/linter.yaml @@ -0,0 +1,11 @@ +name: CI +on: push +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install modules + run: yarn + - name: Run ESLint + run: eslint \ No newline at end of file From c5fc5b600e2164e799ec3f6619e002f7ed501161 Mon Sep 17 00:00:00 2001 From: Pierre Tellier Date: Sun, 9 Feb 2025 14:00:49 +0100 Subject: [PATCH 03/13] fix: linter action --- .gitea/workflows/linter.yaml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.gitea/workflows/linter.yaml b/.gitea/workflows/linter.yaml index 18430eb..0045782 100644 --- a/.gitea/workflows/linter.yaml +++ b/.gitea/workflows/linter.yaml @@ -4,8 +4,12 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Install modules - run: yarn - - name: Run ESLint - run: eslint \ No newline at end of file + - name: Checkout code + uses: actions/checkout@v3 + + - name: Install ESLint + run: | + npm install eslint + + - name: Run ESLint + run: npx eslint . From afa4d34ec863ddfcdf786995bdd82497a5d2873b Mon Sep 17 00:00:00 2001 From: Pierre Tellier Date: Sun, 9 Feb 2025 14:02:34 +0100 Subject: [PATCH 04/13] fix: linter action --- .gitea/workflows/linter.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/linter.yaml b/.gitea/workflows/linter.yaml index 0045782..e0c4683 100644 --- a/.gitea/workflows/linter.yaml +++ b/.gitea/workflows/linter.yaml @@ -12,4 +12,5 @@ jobs: npm install eslint - name: Run ESLint - run: npx eslint . + working-directory: ./front/MyINPulse-front + run: npx eslint From 8af40bfe50c26e8383d5c6711dd9c00c63c55d03 Mon Sep 17 00:00:00 2001 From: Pierre Tellier Date: Sun, 9 Feb 2025 14:04:12 +0100 Subject: [PATCH 05/13] fix: linter action: installed required modules --- .gitea/workflows/linter.yaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/linter.yaml b/.gitea/workflows/linter.yaml index e0c4683..80cfbfe 100644 --- a/.gitea/workflows/linter.yaml +++ b/.gitea/workflows/linter.yaml @@ -8,9 +8,8 @@ jobs: uses: actions/checkout@v3 - name: Install ESLint - run: | - npm install eslint - + run: npm install eslint eslint-config-prettier eslint-plugin-vue globals typescript-eslint + - name: Run ESLint working-directory: ./front/MyINPulse-front run: npx eslint From 1dff7573ffc64424295d7eb5fbf5ab540d8e08ea Mon Sep 17 00:00:00 2001 From: Pierre Tellier Date: Sun, 9 Feb 2025 15:28:09 +0100 Subject: [PATCH 06/13] feat: now compliant with eslint --- front/MyINPulse-front/src/App.vue | 13 +++++------ .../{Header.vue => HeaderComponent.vue} | 2 +- ...{Project-comp.vue => ProjectComponent.vue} | 9 ++++++-- .../src/components/errorModal.vue | 22 ++++++++++++++----- front/MyINPulse-front/src/main.ts | 9 ++++---- .../MyINPulse-front/src/plugins/authStore.ts | 14 ------------ front/MyINPulse-front/src/router/router.ts | 2 +- front/MyINPulse-front/src/services/api.ts | 17 ++++++-------- .../MyINPulse-front/src/services/keycloak.ts | 3 ++- .../src/services/popupDisplayer.ts | 22 +++++++++++++++---- front/MyINPulse-front/src/stores/authStore.ts | 13 ++++++----- .../src/views/errorWrapper.vue | 2 +- .../src/views/{test.vue => testComponent.vue} | 9 -------- 13 files changed, 72 insertions(+), 65 deletions(-) rename front/MyINPulse-front/src/components/{Header.vue => HeaderComponent.vue} (93%) rename front/MyINPulse-front/src/components/{Project-comp.vue => ProjectComponent.vue} (56%) delete mode 100644 front/MyINPulse-front/src/plugins/authStore.ts rename front/MyINPulse-front/src/views/{test.vue => testComponent.vue} (86%) diff --git a/front/MyINPulse-front/src/App.vue b/front/MyINPulse-front/src/App.vue index fd3e06e..52055c6 100644 --- a/front/MyINPulse-front/src/App.vue +++ b/front/MyINPulse-front/src/App.vue @@ -1,13 +1,14 @@ - \ No newline at end of file + }, +}; + diff --git a/front/MyINPulse-front/src/components/errorModal.vue b/front/MyINPulse-front/src/components/errorModal.vue index 64b9ed8..10185eb 100644 --- a/front/MyINPulse-front/src/components/errorModal.vue +++ b/front/MyINPulse-front/src/components/errorModal.vue @@ -1,29 +1,43 @@ \ No newline at end of file +} + diff --git a/front/MyINPulse-front/src/main.ts b/front/MyINPulse-front/src/main.ts index af3fa73..0eb983d 100644 --- a/front/MyINPulse-front/src/main.ts +++ b/front/MyINPulse-front/src/main.ts @@ -1,17 +1,16 @@ -import { createApp } from 'vue' -import App from './App.vue' -import router from './router/router.ts' -import {createPinia} from "pinia"; -import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'; -import keycloakService from './services/keycloak'; -import {type AuthStore, useAuthStore} from "@/stores/authStore.ts"; - +import { createApp } from "vue"; +import App from "./App.vue"; +import router from "./router/router.ts"; +import { createPinia } from "pinia"; +import piniaPluginPersistedstate from "pinia-plugin-persistedstate"; +import keycloakService from "./services/keycloak"; +import { type AuthStore, useAuthStore } from "@/stores/authStore.ts"; let store: AuthStore; keycloakService.CallInit(() => { try { - const app = createApp(App) + const app = createApp(App); // Setup pinia store, allowing user to keep logged in status after refresh const pinia = createPinia(); @@ -19,19 +18,14 @@ keycloakService.CallInit(() => { app.use(pinia); store = useAuthStore(); keycloakService.CallInitStore(store); - app.use(router) + app.use(router); - app.mount('#app'); + app.mount("#app"); } catch (e) { - console.error("Error while initiating Keycloak.") - console.error(e) - createApp(App).mount('#app'); + console.error("Error while initiating Keycloak."); + console.error(e); + createApp(App).mount("#app"); } +}); -}) - - - - - -export {store}; \ No newline at end of file +export { store }; diff --git a/front/MyINPulse-front/src/router/router.ts b/front/MyINPulse-front/src/router/router.ts index 1e8a246..f2eb27d 100644 --- a/front/MyINPulse-front/src/router/router.ts +++ b/front/MyINPulse-front/src/router/router.ts @@ -1,17 +1,17 @@ -import { createRouter, createWebHistory } from 'vue-router' +import { createRouter, createWebHistory } from "vue-router"; const router = createRouter({ - history: createWebHistory(import.meta.env.BASE_URL), - routes: [ - { - path: '/test', - name: 'test', - // route level code-splitting - // this generates a separate chunk (About.[hash].js) for this route - // which is lazy-loaded when the route is visited. - component: () => import('../views/testComponent.vue'), - }, - ], -}) + history: createWebHistory(import.meta.env.BASE_URL), + routes: [ + { + path: "/test", + name: "test", + // route level code-splitting + // this generates a separate chunk (About.[hash].js) for this route + // which is lazy-loaded when the route is visited. + component: () => import("../views/testComponent.vue"), + }, + ], +}); -export default router +export default router; diff --git a/front/MyINPulse-front/src/services/api.ts b/front/MyINPulse-front/src/services/api.ts index 8a68ad2..091455c 100644 --- a/front/MyINPulse-front/src/services/api.ts +++ b/front/MyINPulse-front/src/services/api.ts @@ -1,31 +1,36 @@ -import axios, {type AxiosError, type AxiosResponse} from "axios"; -import {store} from "@/main.ts"; -import {addNewMessage, color} from "@/services/popupDisplayer.ts"; +import axios, { type AxiosError, type AxiosResponse } from "axios"; +import { store } from "@/main.ts"; +import { addNewMessage, color } from "@/services/popupDisplayer.ts"; const axiosInstance = axios.create({ baseURL: import.meta.env.VITE_BACKEND_URL, headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", }, }); axiosInstance.interceptors.response.use( - response => response, // Directly return successful responses. - async error => { + (response) => response, // Directly return successful responses. + async (error) => { const originalRequest = error.config; - if (error.response.status === 401 && !originalRequest._retry && store.authenticated) { + if ( + error.response.status === 401 && + !originalRequest._retry && + store.authenticated + ) { originalRequest._retry = true; // Mark the request as retried to avoid infinite loops. try { await store.refreshUserToken(); // Update the authorization header with the new access token. - axiosInstance.defaults.headers.common['Authorization'] = `Bearer ${store.user.token}`; + axiosInstance.defaults.headers.common["Authorization"] = + `Bearer ${store.user.token}`; return axiosInstance(originalRequest); // Retry the original request with the new access token. } catch (refreshError) { // Handle refresh token errors by clearing stored tokens and redirecting to the login page. - console.error('Token refresh failed:', refreshError); - localStorage.removeItem('accessToken'); - localStorage.removeItem('refreshToken'); - window.location.href = '/login'; + console.error("Token refresh failed:", refreshError); + localStorage.removeItem("accessToken"); + localStorage.removeItem("refreshToken"); + window.location.href = "/login"; return Promise.reject(refreshError); } } @@ -34,20 +39,29 @@ axiosInstance.interceptors.response.use( ); // TODO: spawn a error modal -function defaultApiErrorHandler(err: AxiosError){ +function defaultApiErrorHandler(err: AxiosError) { addNewMessage(err.message, color.Red); } -function defaultApiSuccessHandler(response: AxiosResponse){ - addNewMessage(response.data, color.Green) -} -function callApi(endpoint: string, onSuccessHandler?: (response: AxiosResponse) => void, onErrorHandler?: (error: AxiosError) => void): void { - axiosInstance.get(endpoint).then( - onSuccessHandler == null ? defaultApiSuccessHandler : onSuccessHandler - ).catch( - onErrorHandler == null ? defaultApiErrorHandler: onErrorHandler - ) +function defaultApiSuccessHandler(response: AxiosResponse) { + addNewMessage(response.data, color.Green); } +function callApi( + endpoint: string, + onSuccessHandler?: (response: AxiosResponse) => void, + onErrorHandler?: (error: AxiosError) => void +): void { + axiosInstance + .get(endpoint) + .then( + onSuccessHandler == null + ? defaultApiSuccessHandler + : onSuccessHandler + ) + .catch( + onErrorHandler == null ? defaultApiErrorHandler : onErrorHandler + ); +} -export {callApi} \ No newline at end of file +export { callApi }; diff --git a/front/MyINPulse-front/src/services/keycloak.ts b/front/MyINPulse-front/src/services/keycloak.ts index 9a8cb09..f3f3880 100644 --- a/front/MyINPulse-front/src/services/keycloak.ts +++ b/front/MyINPulse-front/src/services/keycloak.ts @@ -1,34 +1,31 @@ -import Keycloak from 'keycloak-js'; -import type {AuthStore} from "@/stores/authStore.ts"; +import Keycloak from "keycloak-js"; +import type { AuthStore } from "@/stores/authStore.ts"; const options = { url: import.meta.env.VITE_KEYCLOAK_URL, clientId: import.meta.env.VITE_KEYCLOAK_CLIENT_ID, - realm: import.meta.env.VITE_KEYCLOAK_REALM -} - + realm: import.meta.env.VITE_KEYCLOAK_REALM, +}; const keycloak = new Keycloak(options); let authenticated: boolean | undefined; let store = null; -async function login(){ +async function login() { try { - await keycloak.login() // https://www.keycloak.org/securing-apps/javascript-adapter#:~:text=when%20initialization%20completes.-,login(options),-Redirects%20to%20login + await keycloak.login(); // https://www.keycloak.org/securing-apps/javascript-adapter#:~:text=when%20initialization%20completes.-,login(options),-Redirects%20to%20login return keycloak; } catch (error) { - console.log(error) + console.log(error); } } -async function signup(){ +async function signup() { try { - await keycloak.login( - {action: "register"} - ) // https://www.keycloak.org/securing-apps/javascript-adapter#:~:text=when%20initialization%20completes.-,login(options),-Redirects%20to%20login + await keycloak.login({ action: "register" }); // https://www.keycloak.org/securing-apps/javascript-adapter#:~:text=when%20initialization%20completes.-,login(options),-Redirects%20to%20login return keycloak; } catch (error) { - console.log(error) + console.log(error); } } @@ -43,13 +40,13 @@ async function init(onInitCallback: () => void) { onLoad: "check-sso", silentCheckSsoRedirectUri: `${location.origin}/silent-check-sso.htm`, responseMode: "query", - }) - onInitCallback() + }); + onInitCallback(); } catch (error) { - console.error("Keycloak init failed") - console.error(error) + console.error("Keycloak init failed"); + console.error(error); } -}; +} /** * Initializes store with Keycloak user data @@ -57,17 +54,19 @@ async function init(onInitCallback: () => void) { */ async function initStore(storeInstance: AuthStore) { try { - store = storeInstance - console.log(keycloak) - await store.initOauth(keycloak) + store = storeInstance; + console.log(keycloak); + await store.initOauth(keycloak); // Show alert if user is not authenticated - if (!authenticated) { console.warn("not authenticated") } + if (!authenticated) { + console.warn("not authenticated"); + } } catch (error) { - console.error("Keycloak init failed") - console.error(error) + console.error("Keycloak init failed"); + console.error(error); } -}; +} /** * Logout user @@ -84,7 +83,7 @@ async function refreshToken() { await keycloak.updateToken(480); return keycloak; } catch (error) { - console.error('Failed to refresh token'); + console.error("Failed to refresh token"); console.error(error); } } @@ -98,4 +97,4 @@ const KeycloakService = { callSignup: signup, }; -export default KeycloakService; \ No newline at end of file +export default KeycloakService; diff --git a/front/MyINPulse-front/src/services/popupDisplayer.ts b/front/MyINPulse-front/src/services/popupDisplayer.ts index b5fddda..9f535d8 100644 --- a/front/MyINPulse-front/src/services/popupDisplayer.ts +++ b/front/MyINPulse-front/src/services/popupDisplayer.ts @@ -1,6 +1,11 @@ -import {ref} from "vue"; -import {type Ref} from "vue"; -enum color {Red, Yellow, Blue, Green} +import { ref, type Ref } from "vue"; + +enum color { + Red, + Yellow, + Blue, + Green, +} type ErrorMessageContent = { message: string; @@ -11,23 +16,28 @@ type ErrorMessageContent = { let id: number = 0; const getId = () => { - id = id+1; + id = id + 1; return id; -} +}; -function addNewMessage(errorMessage: string, type?: color, timeout?: number){ - if (timeout == null){ +function addNewMessage(errorMessage: string, type?: color, timeout?: number) { + if (timeout == null) { timeout = 5000; } - if (type == null){ + if (type == null) { type = color.Red; } - const data: ErrorMessageContent = {message: errorMessage, timeout: timeout, color: type, id: getId()}; - errorList.value.push(data) - setTimeout(() => errorList.value.slice(0, 1), timeout) + const data: ErrorMessageContent = { + message: errorMessage, + timeout: timeout, + color: type, + id: getId(), + }; + errorList.value.push(data); + setTimeout(() => errorList.value.slice(0, 1), timeout); } -const errorList: Ref= ref([]) +const errorList: Ref = ref([]); -export {addNewMessage, errorList, color, type ErrorMessageContent} \ No newline at end of file +export { addNewMessage, errorList, color, type ErrorMessageContent }; diff --git a/front/MyINPulse-front/src/stores/authStore.ts b/front/MyINPulse-front/src/stores/authStore.ts index e8304b1..06187ca 100644 --- a/front/MyINPulse-front/src/stores/authStore.ts +++ b/front/MyINPulse-front/src/stores/authStore.ts @@ -1,5 +1,5 @@ import { defineStore } from "pinia"; -import keycloakService from '@/services/keycloak'; +import keycloakService from "@/services/keycloak"; import type Keycloak from "keycloak-js"; const useAuthStore = defineStore("storeAuth", { @@ -11,44 +11,51 @@ const useAuthStore = defineStore("storeAuth", { refreshToken: "", username: "", }, - } + }; }, persist: true, getters: {}, actions: { // Initialize Keycloak OAuth async initOauth(keycloak: Keycloak, clearData = true) { - if(clearData) { await this.clearUserData(); } + if (clearData) { + await this.clearUserData(); + } this.authenticated = !!keycloak.authenticated; // the !! removes undefined - if (this.authenticated && keycloak.token && keycloak.idTokenParsed && keycloak.refreshToken){ + if ( + this.authenticated && + keycloak.token && + keycloak.idTokenParsed && + keycloak.refreshToken + ) { this.user.username = keycloak.idTokenParsed.given_name; this.user.token = keycloak.token; this.user.refreshToken = keycloak.refreshToken; } }, - async login(){ + async login() { try { const keycloak = await keycloakService.callLogin(); - if (keycloak) - await this.initOauth(keycloak); + if (keycloak) await this.initOauth(keycloak); } catch (error) { - console.log(error) + console.log(error); } }, async signup() { try { const keycloak = await keycloakService.callSignup(); - if (keycloak) - await this.initOauth(keycloak); + if (keycloak) await this.initOauth(keycloak); } catch (error) { - console.log(error) + console.log(error); } }, // Logout user async logout() { try { - await keycloakService.CallLogout(import.meta.env.VITE_APP_URL + "/test"); + await keycloakService.CallLogout( + import.meta.env.VITE_APP_URL + "/test" + ); await this.clearUserData(); } catch (error) { console.error(error); @@ -58,8 +65,7 @@ const useAuthStore = defineStore("storeAuth", { async refreshUserToken() { try { const keycloak = await keycloakService.CallTokenRefresh(); - if (keycloak) - await this.initOauth(keycloak, false); + if (keycloak) await this.initOauth(keycloak, false); } catch (error) { console.error(error); } @@ -69,13 +75,13 @@ const useAuthStore = defineStore("storeAuth", { this.authenticated = false; this.user = { token: "", - refreshToken: "", - username: "", + refreshToken: "", + username: "", }; - } - } + }, + }, }); -type AuthStore = ReturnType +type AuthStore = ReturnType; -export {useAuthStore, type AuthStore} \ No newline at end of file +export { useAuthStore, type AuthStore }; diff --git a/front/MyINPulse-front/src/views/errorWrapper.vue b/front/MyINPulse-front/src/views/errorWrapper.vue index 6c7a6ea..807dffe 100644 --- a/front/MyINPulse-front/src/views/errorWrapper.vue +++ b/front/MyINPulse-front/src/views/errorWrapper.vue @@ -1,22 +1,25 @@ \ No newline at end of file + diff --git a/front/MyINPulse-front/src/views/testComponent.vue b/front/MyINPulse-front/src/views/testComponent.vue index a5324b8..0e7dff6 100644 --- a/front/MyINPulse-front/src/views/testComponent.vue +++ b/front/MyINPulse-front/src/views/testComponent.vue @@ -1,66 +1,81 @@ - \ No newline at end of file +} + From 83cbeb7a2e87a69d60c5762568642f0767a1454d Mon Sep 17 00:00:00 2001 From: Pierre Tellier Date: Sun, 9 Feb 2025 16:07:40 +0100 Subject: [PATCH 10/13] feat: single workflow that check prettier, linter and build --- .gitea/workflows/front.yaml | 24 ++++++++++++++++++++++++ .gitea/workflows/linter.yaml | 15 --------------- .gitea/workflows/prettier.yaml | 15 --------------- 3 files changed, 24 insertions(+), 30 deletions(-) create mode 100644 .gitea/workflows/front.yaml delete mode 100644 .gitea/workflows/linter.yaml delete mode 100644 .gitea/workflows/prettier.yaml diff --git a/.gitea/workflows/front.yaml b/.gitea/workflows/front.yaml new file mode 100644 index 0000000..2a7b551 --- /dev/null +++ b/.gitea/workflows/front.yaml @@ -0,0 +1,24 @@ +name: CI +on: push +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Install everything + working-directory: ./front/MyINPulse-front + run: npm i + + - name: Run ESLint + working-directory: ./front/MyINPulse-front + run: npx eslint + + - name: Run prettier + working-directory: ./front/MyINPulse-front + run: npx prettier src --check + + - name: check build + working-directory: ./front/MyINPulse-front + run: npm run build \ No newline at end of file diff --git a/.gitea/workflows/linter.yaml b/.gitea/workflows/linter.yaml deleted file mode 100644 index 80cfbfe..0000000 --- a/.gitea/workflows/linter.yaml +++ /dev/null @@ -1,15 +0,0 @@ -name: CI -on: push -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Install ESLint - run: npm install eslint eslint-config-prettier eslint-plugin-vue globals typescript-eslint - - - name: Run ESLint - working-directory: ./front/MyINPulse-front - run: npx eslint diff --git a/.gitea/workflows/prettier.yaml b/.gitea/workflows/prettier.yaml deleted file mode 100644 index ef447a9..0000000 --- a/.gitea/workflows/prettier.yaml +++ /dev/null @@ -1,15 +0,0 @@ -name: CI -on: push -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Install ESLint - run: npm install prettier - - - name: Run ESLint - working-directory: ./front/MyINPulse-front - run: npx prettier src --check From 2465545b6b68a0c63389618662cd23167a7fb978 Mon Sep 17 00:00:00 2001 From: Pierre Tellier Date: Sun, 9 Feb 2025 16:11:54 +0100 Subject: [PATCH 11/13] fix: removed temp modal --- .gitea/workflows/front.yaml | 2 +- front/MyINPulse-front/src/views/testComponent.vue | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitea/workflows/front.yaml b/.gitea/workflows/front.yaml index 2a7b551..6ad24d2 100644 --- a/.gitea/workflows/front.yaml +++ b/.gitea/workflows/front.yaml @@ -19,6 +19,6 @@ jobs: working-directory: ./front/MyINPulse-front run: npx prettier src --check - - name: check build + - name: Build frontend working-directory: ./front/MyINPulse-front run: npm run build \ No newline at end of file diff --git a/front/MyINPulse-front/src/views/testComponent.vue b/front/MyINPulse-front/src/views/testComponent.vue index 0e7dff6..7ae5170 100644 --- a/front/MyINPulse-front/src/views/testComponent.vue +++ b/front/MyINPulse-front/src/views/testComponent.vue @@ -58,7 +58,6 @@ import TempModal from "@/components/temp-modal.vue"; - + \ No newline at end of file diff --git a/front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue b/front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue new file mode 100644 index 0000000..8b08628 --- /dev/null +++ b/front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue @@ -0,0 +1,120 @@ + + + + + + + diff --git a/front/MyINPulse-front/src/components/canvas/LeanCanvas.vue b/front/MyINPulse-front/src/components/canvas/LeanCanvas.vue new file mode 100644 index 0000000..a687982 --- /dev/null +++ b/front/MyINPulse-front/src/components/canvas/LeanCanvas.vue @@ -0,0 +1,56 @@ + + + + + diff --git a/front/MyINPulse-front/src/components/canvas/style-project.css b/front/MyINPulse-front/src/components/canvas/style-project.css new file mode 100644 index 0000000..e505a15 --- /dev/null +++ b/front/MyINPulse-front/src/components/canvas/style-project.css @@ -0,0 +1,156 @@ +body { + font-family: Arial, sans-serif; + margin: 0; + padding: 10px; + } + + .row { + display: flex; + } + + .cell { + flex: 1; + border: 1px solid #ddd; + padding: 10px; + text-align: center; + background-color: #f1f1f1; + } + + .produit { + background-color: #f9e4e4; + } + + .marche { + background-color: #e4f1f9; + } + + .valeur { + background-color: #f9f4e4; + } + + h3 { + margin: 0; + font-size: 18px; + color: #333; + } + + p { + margin: 5px 0 0; + font-size: 14px; + } + + + body { + font-family: Arial, sans-serif; + margin: 0; + padding: 0; + background-color: #f9f9f9; + } + + h1 img { + height: 80px; + margin: 40px; + text-align: center; + } + + .row { + display: flex; + margin-bottom: 10px; + } + + #ade { + max-width: 1200px; + margin: 20px auto; + padding: 20px; + text-align: center; + background-color: #e8f5e9; + border: 2px solid #4caf50; + border-radius: 10px; + } + + #ade h3 { + color: #2e7d32; + } + + #ade p { + margin: 10px 0; + font-size: 16px; + color: #333; + } + header { + display: flex; + justify-content: space-between; + align-items: center; + padding: 10px 20px; + background-color: #fff; + border-bottom: 2px solid #ddd; + } + + header img { + height: 60px; + } + + header .contact-menu { + position: relative; + } + + .contact-button, .return { + padding: 10px 15px; + border: none; + border-radius: 4px; + background-color: #2196f3; + color: #fff; + cursor: pointer; + } + + .contact-button:hover, .return:hover { + background-color: #1976d2; + } + + /* Dropdown styling */ + .contact-dropdown { + position: absolute; + right: 0; + top: 50px; + display: none; + flex-direction: column; + gap: 10px; + padding: 15px; + background-color: #fff; + border: 1px solid #ddd; + border-radius: 8px; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); + z-index: 10; + } + + .contact-dropdown button { + padding: 8px 12px; + border: none; + border-radius: 4px; + background-color: #4caf50; + color: #fff; + cursor: pointer; + } + + .contact-dropdown button:hover { + background-color: #388e3c; + } + + .return { + background-color: #f44336; + } + + .return:hover { + background-color: #d32f2f; + } + + .header-buttons { + display: flex; + align-items: center; + gap: 15px; + } + + + a{ + color: white; + } \ No newline at end of file diff --git a/front/MyINPulse-front/src/plugins/authStore.ts b/front/MyINPulse-front/src/plugins/authStore.ts new file mode 100644 index 0000000..1a5c06e --- /dev/null +++ b/front/MyINPulse-front/src/plugins/authStore.ts @@ -0,0 +1,14 @@ +// file: src/plugins/authStore.js + +import { useAuthStore } from "@/stores/authStore.ts"; +import keycloakService from '@/services/keycloak'; +// Setup auth store as a plugin so it can be accessed globally in our FE +const authStorePlugin = { + install(app: any, option: any) { + const store = useAuthStore(option.pinia); + app.config.globalProperties.$store = store; + keycloakService.CallInitStore(store); + } +} + +export default authStorePlugin; \ No newline at end of file