From 8fffd3e8c4a6a59629e543c72dc6099e69cbe91d Mon Sep 17 00:00:00 2001 From: Maxime Lalo Date: Tue, 1 Aug 2023 11:54:31 +0200 Subject: [PATCH 01/10] :bug: Fixing add customers --- .../Components/Layouts/Folder/AddClientToFolder/index.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/front/Components/Layouts/Folder/AddClientToFolder/index.tsx b/src/front/Components/Layouts/Folder/AddClientToFolder/index.tsx index 87fd41de..f39bec59 100644 --- a/src/front/Components/Layouts/Folder/AddClientToFolder/index.tsx +++ b/src/front/Components/Layouts/Folder/AddClientToFolder/index.tsx @@ -203,9 +203,7 @@ class AddClientToFolderClass extends BasePage { const allCustomersToLink = this.state.selectedCustomers.concat(this.state.existingCustomers); let customersToLink: Partial[] = allCustomersToLink.map((customer) => { - return { - customer: { uid: customer.value }, - }; + return Customer.hydrate({ uid: customer.value as string }); }) as Partial[]; if (this.state.selectedOption === "new_customer") { From 9dfdaa902d09c0777ee5e58a48e907dd2232033a Mon Sep 17 00:00:00 2001 From: Maxime Lalo Date: Tue, 1 Aug 2023 15:19:38 +0200 Subject: [PATCH 02/10] :sparkles: Fixing select folder --- .../Layouts/SelectFolder/classes.module.scss | 11 -------- .../Components/Layouts/SelectFolder/index.tsx | 25 ++++++++----------- 2 files changed, 11 insertions(+), 25 deletions(-) diff --git a/src/front/Components/Layouts/SelectFolder/classes.module.scss b/src/front/Components/Layouts/SelectFolder/classes.module.scss index 504eff91..6334c67f 100644 --- a/src/front/Components/Layouts/SelectFolder/classes.module.scss +++ b/src/front/Components/Layouts/SelectFolder/classes.module.scss @@ -1,16 +1,5 @@ .root { position: relative; - .background-container { - width: 100%; - height: 100%; - position: absolute; - z-index: -1; - - > img { - width: 100%; - object-fit: cover; - } - } .select-folder-container { max-width: 530px; padding: 80px 72px; diff --git a/src/front/Components/Layouts/SelectFolder/index.tsx b/src/front/Components/Layouts/SelectFolder/index.tsx index 8596700f..64927e92 100644 --- a/src/front/Components/Layouts/SelectFolder/index.tsx +++ b/src/front/Components/Layouts/SelectFolder/index.tsx @@ -1,14 +1,14 @@ -import DefaultTemplate from "@Front/Components/LayoutTemplates/DefaultTemplate"; -import classes from "./classes.module.scss"; -import Typography, { ITypo } from "@Front/Components/DesignSystem/Typography"; -import BlockList, { IBlock } from "@Front/Components/DesignSystem/BlockList"; -import { OfficeFolder } from "le-coffre-resources/dist/Customer"; -import { useCallback, useEffect, useState } from "react"; import Folders from "@Front/Api/LeCoffreApi/SuperAdmin/Folders/Folders"; -import { useRouter } from "next/router"; +import BlockList, { IBlock } from "@Front/Components/DesignSystem/BlockList"; +import Typography, { ITypo } from "@Front/Components/DesignSystem/Typography"; +import DefaultDoubleSidePage from "@Front/Components/LayoutTemplates/DefaultDoubleSidePage"; import Module from "@Front/Config/Module"; -import BackgroundImage from "@Assets/images/background.png"; -import Image from "next/image"; +import { OfficeFolder } from "le-coffre-resources/dist/Customer"; +import { useRouter } from "next/router"; +import { useCallback, useEffect, useState } from "react"; + +import LandingImage from "../Login/landing-connect.jpeg"; +import classes from "./classes.module.scss"; export default function SelectFolder() { const [folders, setFolders] = useState([]); @@ -33,11 +33,8 @@ export default function SelectFolder() { ); return ( - +
-
- background -
Vos dossiers @@ -56,6 +53,6 @@ export default function SelectFolder() {
-
+ ); } From cadaa935cb03b17121a40d71422222ed8d58297b Mon Sep 17 00:00:00 2001 From: Maxime Lalo Date: Tue, 1 Aug 2023 15:35:28 +0200 Subject: [PATCH 03/10] :bug: Fixing client dashboard --- src/front/Components/Layouts/ClientDashboard/index.tsx | 7 ++++--- src/front/Components/Layouts/SelectFolder/index.tsx | 5 +---- src/pages/client-dashboard.tsx | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/front/Components/Layouts/ClientDashboard/index.tsx b/src/front/Components/Layouts/ClientDashboard/index.tsx index 0df97dce..a9527d17 100644 --- a/src/front/Components/Layouts/ClientDashboard/index.tsx +++ b/src/front/Components/Layouts/ClientDashboard/index.tsx @@ -1,3 +1,4 @@ +import Customers from "@Front/Api/LeCoffreApi/SuperAdmin/Customers/Customers"; import Documents, { IGetDocumentsparams } from "@Front/Api/LeCoffreApi/SuperAdmin/Documents/Documents"; import Button, { EButtonVariant } from "@Front/Components/DesignSystem/Button"; import DepositDocument from "@Front/Components/DesignSystem/DepositDocument"; @@ -6,10 +7,10 @@ import Confirm from "@Front/Components/DesignSystem/Modal/Confirm"; import Typography, { ITypo } from "@Front/Components/DesignSystem/Typography"; import Base from "@Front/Components/Layouts/Base"; import DefaultTemplate from "@Front/Components/LayoutTemplates/DefaultTemplate"; -import React from "react"; -import classes from "./classes.module.scss"; -import Customers from "@Front/Api/LeCoffreApi/SuperAdmin/Customers/Customers"; import Customer, { Document } from "le-coffre-resources/dist/Customer"; +import React from "react"; + +import classes from "./classes.module.scss"; type IProps = { targetedCustormer: string; // MOCK diff --git a/src/front/Components/Layouts/SelectFolder/index.tsx b/src/front/Components/Layouts/SelectFolder/index.tsx index 64927e92..441461ef 100644 --- a/src/front/Components/Layouts/SelectFolder/index.tsx +++ b/src/front/Components/Layouts/SelectFolder/index.tsx @@ -2,7 +2,6 @@ import Folders from "@Front/Api/LeCoffreApi/SuperAdmin/Folders/Folders"; import BlockList, { IBlock } from "@Front/Components/DesignSystem/BlockList"; import Typography, { ITypo } from "@Front/Components/DesignSystem/Typography"; import DefaultDoubleSidePage from "@Front/Components/LayoutTemplates/DefaultDoubleSidePage"; -import Module from "@Front/Config/Module"; import { OfficeFolder } from "le-coffre-resources/dist/Customer"; import { useRouter } from "next/router"; import { useCallback, useEffect, useState } from "react"; @@ -25,9 +24,7 @@ export default function SelectFolder() { const handleSelectBlock = useCallback( (block: IBlock) => { - router.push( - Module.getInstance().get().modules.pages.Folder.pages.FolderInformation.props.path.replace("[folderUid]", block.id), - ); + router.push("/client-dashboard"); }, [router], ); diff --git a/src/pages/client-dashboard.tsx b/src/pages/client-dashboard.tsx index 931db6d5..7a37a3f1 100644 --- a/src/pages/client-dashboard.tsx +++ b/src/pages/client-dashboard.tsx @@ -1,5 +1,5 @@ import ClientDashboard from "@Front/Components/Layouts/ClientDashboard"; export default function Route() { - return ; + return ; } From c838461b6d0d1c5f0b9d07873d251074552e74a1 Mon Sep 17 00:00:00 2001 From: Maxime Lalo Date: Tue, 1 Aug 2023 15:38:50 +0200 Subject: [PATCH 04/10] :bug: Fixing client deposit --- src/front/Components/Layouts/ClientDashboard/index.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/front/Components/Layouts/ClientDashboard/index.tsx b/src/front/Components/Layouts/ClientDashboard/index.tsx index a9527d17..f85d2560 100644 --- a/src/front/Components/Layouts/ClientDashboard/index.tsx +++ b/src/front/Components/Layouts/ClientDashboard/index.tsx @@ -7,7 +7,7 @@ import Confirm from "@Front/Components/DesignSystem/Modal/Confirm"; import Typography, { ITypo } from "@Front/Components/DesignSystem/Typography"; import Base from "@Front/Components/Layouts/Base"; import DefaultTemplate from "@Front/Components/LayoutTemplates/DefaultTemplate"; -import Customer, { Document } from "le-coffre-resources/dist/Customer"; +import Customer, { Document, DocumentType } from "le-coffre-resources/dist/Customer"; import React from "react"; import classes from "./classes.module.scss"; @@ -69,7 +69,13 @@ export default class ClientDashboard extends Base { Glissez / Déposez votre document dans la zone prévue à cet effet ou cliquez sur la zone puis sélectionnez le document correspondant. - {/* */} + ({ + document_type: DocumentType.hydrate({ + name: "Document annexe", + }), + })} + /> From 23cb15d2cfec6cb8674602aa03a63f1d965cbf0e Mon Sep 17 00:00:00 2001 From: Maxime Lalo Date: Tue, 1 Aug 2023 15:48:49 +0200 Subject: [PATCH 05/10] :bug: Fixing --- src/front/Components/Layouts/Folder/AskDocuments/index.tsx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/front/Components/Layouts/Folder/AskDocuments/index.tsx b/src/front/Components/Layouts/Folder/AskDocuments/index.tsx index 67c19ab5..ff18c0c4 100644 --- a/src/front/Components/Layouts/Folder/AskDocuments/index.tsx +++ b/src/front/Components/Layouts/Folder/AskDocuments/index.tsx @@ -61,6 +61,7 @@ class AskDocumentsClass extends BasePage { const backUrl = Module.getInstance() .get() .modules.pages.Folder.pages.FolderInformation.props.path.replace("[folderUid]", this.props.folderUid); + return ( {}}>
@@ -133,11 +134,7 @@ class AskDocumentsClass extends BasePage { q: { deed: { include: { - deed_has_document_types: { - include: { - document_type: true, - }, - }, + document_types: true, }, }, office: true, From 624aab70a5b3f2493530a1acb4a439f4f1e8d892 Mon Sep 17 00:00:00 2001 From: pida123 Date: Thu, 3 Aug 2023 12:20:22 +0200 Subject: [PATCH 06/10] refacto all devops --- .circleci/config.yml | 75 +++++++++++++++++++++--- devops/Chart.yaml | 5 +- devops/ppd.values.yaml | 31 ++++++++++ devops/prd.values.yaml | 31 ++++++++++ devops/stg.values.yaml | 38 ++++++++++++ devops/templates/docker-pull-secret.yaml | 1 + devops/templates/lecoffre-front.yaml | 15 +++-- devops/templates/sealed-secret.yaml | 1 + devops/templates/secret-store.yaml | 1 + devops/templates/secrets.yaml | 16 +++++ devops/values.yaml | 32 ++++------ 11 files changed, 207 insertions(+), 39 deletions(-) create mode 100644 devops/ppd.values.yaml create mode 100644 devops/prd.values.yaml create mode 100644 devops/stg.values.yaml create mode 100644 devops/templates/docker-pull-secret.yaml create mode 100644 devops/templates/sealed-secret.yaml create mode 100644 devops/templates/secret-store.yaml create mode 100644 devops/templates/secrets.yaml diff --git a/.circleci/config.yml b/.circleci/config.yml index 8cbb2304..96b23a85 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -15,8 +15,8 @@ jobs: - checkout - add_ssh_keys: fingerprints: - - "39:25:57:64:62:43:1f:98:b1:5e:75:53:87:d8:e7:71" - - run: cp $HOME/.ssh/id_rsa_3925576462431f98b15e755387d8e771 id_rsa + - "4c:8e:00:16:94:44:d9:ad:e9:e9:2c:8b:02:d4:8d:7a" + - run: cp $HOME/.ssh/id_rsa_4c8e00169444d9ade9e92c8b02d48d7a id_rsa - setup_remote_docker: version: 20.10.12 docker_layer_caching: true @@ -30,6 +30,10 @@ jobs: - image: cimg/base:stable environment: TAG: << pipeline.git.tag >> + parameters: + env: + type: string + default: stg steps: - checkout - kubernetes/install-kubeconfig: @@ -39,28 +43,81 @@ jobs: name: Deploy command: > helm upgrade - lecoffre-front devops/ -i -f devops/values.yaml - -n lecoffre + lecoffre-front devops/ -i -f devops/<>.values.yaml + -n lecoffre-<> --create-namespace - --set lecoffreFront.image.repository='rg.fr-par.scw.cloud/lecoffre/front' - --set lecoffreFront.image.tag=$TAG + --set lecoffrefront.image.repository='rg.fr-par.scw.cloud/lecoffre/front' + --set lecoffrefront.image.tag=$TAG workflows: version: 2 - build-and-register: + build-and-register-stg: + when: + and: + - equal: [ staging, << pipeline.git.branch >> ] + - << pipeline.git.tag >> jobs: - build-push-docker-image: filters: tags: only: /^v.*/ branches: - ignore: /.*/ + only: staging - deploy-docker-image: + env: stg requires: - build-push-docker-image context: - - staging + - sc-shared-prd + filters: + tags: + only: /^v.*/ + branches: + ignore: /.*/ + + build-and-register-ppd: + when: + and: + - equal: [ preprod, << pipeline.git.branch >> ] + - << pipeline.git.tag >> + jobs: + - build-push-docker-image: + filters: + tags: + only: /^v.*/ + branches: + only: preprod + - deploy-docker-image: + env: ppd + requires: + - build-push-docker-image + context: + - sc-shared-prd + filters: + tags: + only: /^v.*/ + branches: + ignore: /.*/ + + build-and-register-prd: + when: + and: + - equal: [ main, << pipeline.git.branch >> ] + - << pipeline.git.tag >> + jobs: + - build-push-docker-image: + filters: + tags: + only: /^v.*/ + branches: + only: main + - deploy-docker-image: + env: prd + requires: + - build-push-docker-image + context: + - sc-shared-prd filters: tags: only: /^v.*/ diff --git a/devops/Chart.yaml b/devops/Chart.yaml index b19e514c..208511fb 100644 --- a/devops/Chart.yaml +++ b/devops/Chart.yaml @@ -1,5 +1,5 @@ apiVersion: v2 -name: leCoffre-front +name: leCoffre-back description: A Helm chart for Kubernetes # A chart can be either an 'application' or a 'library' chart. @@ -21,4 +21,5 @@ version: 0.0.1 # incremented each time you make changes to the application. Versions are not expected to # follow Semantic Versioning. They should reflect the version the application is using. # It is recommended to use it with quotes. -appVersion: 0.5.0 +appVersion: 0.5.6 + diff --git a/devops/ppd.values.yaml b/devops/ppd.values.yaml new file mode 100644 index 00000000..8d3b1dd9 --- /dev/null +++ b/devops/ppd.values.yaml @@ -0,0 +1,31 @@ +dockerPullSecret: docker-pull-secret + +scwSecretKey: AgCgjF5QEzxT3GYTS5B6cmQ0e+0/qFWzKaUDSi+Vjc7RoameuvaIJvTXMBkS3he1oy1ulbB34v6vpZI2kxnGNqERA/U5BaYDAyfKSBwMAy4br7HVKhhuwkoF5qoG5JzJXseSmqB1U9vncVIGOZWzJc1Y4/eGlWcvLcLyfw2z/WEpyeNiWJfEhTYpJOB7gv0XnRb2U/JM3jRy1QgEUIk1WR6kgBalF+xaczPQ6uKh+PR2pqkbZa3WaKUrddmzNsgEz4d8PZMWt8IBwR2JOQEHUqCd34p/pJNyLdUgcdDhg02DKwn1oRoAxKTbAio/a7WrMbodjCb3TNWIYGal5mFmItZ7Ok/EBmUf4E85eOkTR+j8ynuuiexld3Q5Kw3o8LsHjgzVL9uP+T2rYaKkjtVt+YQRX1U8l9CrsdUEz0/wEBA0jwCWMfnh1qhD5pM/xwwjsEEAcK4rYV+Q7iAgGZZvZBCQ5aEHzrtn5D95tr1GZCV2hmrW6Seu+LKKLVBS1JmsuEsOuhudYsEK9m2RYVcxbjuS5eokKEjNrGobf2oB8rhBByavfw1JTBixR5JrI8lcYlnCa+oEhxXKJY+4Fx5SAB4YaLCMSo5vw6zsFQ3WKQzlEmCFt+EnapS+a+MGrdlwq07OHTDpvgk/1z39hopoCuhhKckGGfErLXsTYQvDOkFu+EPzgY7m7qDw/d9pSiht5tuSOkAqeOgm7tpNkUufZhaXmP+1aT7i+H5gq1JILGAmXzTI5Wc= + +lecoffreFront: + serviceAccountName: lecoffre-front-sa + command: "npm run api:start" + envSecrets: front-env-ppd + imagePullSecrets: + - name: docker-pull-secret + image: + pullPolicy: Always + repository: "rg.fr-par.scw.cloud/lecoffre/front" + resources: + requests: + cpu: 200m + memory: 1Gi + limits: + memory: 2Gi + ingress: + host: app.stg.lecoffre.smart-chain.fr + tls: + hosts: + - app.stg.lecoffre.smart-chain.fr + secretName: api-tls + annotations: + kubernetes.io/ingress.class: nginx + cert-manager.io/cluster-issuer: letsencrypt-prod + nginx.ingress.kubernetes.io/from-to-www-redirect: "true" + nginx.ingress.kubernetes.io/force-ssl-redirect: "true" + diff --git a/devops/prd.values.yaml b/devops/prd.values.yaml new file mode 100644 index 00000000..046b8a08 --- /dev/null +++ b/devops/prd.values.yaml @@ -0,0 +1,31 @@ +dockerPullSecret: docker-pull-secret + +scwSecretKey: AgBG2y7uQuap+2akNPGFxpCR+l0INO6Wxez5qljtY6t71GFGhJLYN9ZfefflKcFzD2Nv7DQMXXhpnCCaFti+9JMCMDuN324dDgtMMLTot+Pkxk/bAm+L8t3HfRharFdLz/vvzg77bvypi28TEoNYR/AM0e8VMYxBEgEp2TmP5uXcxZOgPzXMrfQoSdNRyzGTJ5tXZwe3PP7XvXyTNsZzHBtoQQM+nul9nL+VFA7CBRaaOpCmKOXjAlt7TyNXo4X5eYBNlxr+NuQw4dh4E/1zqdU/dDCE1+vx88BDbdydBA1qJaTOUSGTFquSK4kb9qAVAexBAIUqRwpfEW6Li945AXtnxLN42gEGPRsA9tSXL2c20k6thuRCqxwEOZljq2E03qtLAkxdP6WFBcb77o4PIEMZ8AmzPASnI+eW5z2mCoP3L+HZQrTLliDjmF4AMtOfZxRi0CCTrsSabOrimJC6v3y3ve0VcSsjA3rd5vvJ3Va4mZK4JAtYwEUx4PCHCGkUxc0w6jRwKB5tL/auZVT4SV/0z/WgW4Kq4AdvxsU6yGOqflt6e3ePIIuvCgjw+1yOYRpUiSGj36oOqNPMA4smxIB7p7Gi3csqt2TrQoW3TaLv/s7gbCcxHWSor+WT71WGg8AVmLm+FzUINmNop+c2RNo3O/Gj7h1uybX/pj+tRLNOuBQCqa+GQkY2bT2NcT9ifnAZB6K+2zAWXl+tdbMlDGV89P2yMYuRMdHGhuOoyuIUPWeA5i0= + +lecoffreFront: + serviceAccountName: lecoffre-front-sa + command: "npm run api:start" + envSecrets: front-env-prd + imagePullSecrets: + - name: docker-pull-secret + image: + pullPolicy: Always + repository: "rg.fr-par.scw.cloud/lecoffre/front" + resources: + requests: + cpu: 200m + memory: 1Gi + limits: + memory: 2Gi + ingress: + host: lecoffre.smart-chain.fr + tls: + hosts: + - lecoffre.smart-chain.fr + secretName: api-tls + annotations: + kubernetes.io/ingress.class: nginx + cert-manager.io/cluster-issuer: letsencrypt-prod + nginx.ingress.kubernetes.io/from-to-www-redirect: "true" + nginx.ingress.kubernetes.io/force-ssl-redirect: "true" + diff --git a/devops/stg.values.yaml b/devops/stg.values.yaml new file mode 100644 index 00000000..cd49e99a --- /dev/null +++ b/devops/stg.values.yaml @@ -0,0 +1,38 @@ +dockerPullSecret: docker-pull-secret + +scwSecretKey: AgChoEnPitXp4Ny/rVMEcevaWKNVpyj2cJYAcq+yFqKwVwnLB+ffDvwqz9XBHu+6d4Nyyjkf37zUAMoaM21lEDWA7x3zfG2/D/j+rvX1qxzZgLD0mjBk7fGElVm332I6JA83oInes8AMMYEDPLElzHnpKRb9KtkIP4NzgOcCeW0ijft3N7Vroez6LEHsBPCA1I9XjKSkGEDvrO0MhWX3iJOlfz+SPMfJAV7rPawOs0ZmohTHrPW8qIvGDn8HCzKyU8zRBoMt+Ogpf5pH4U3JryEFuqD61KAQgablAM8edPIvsgNno9HAEuC2QtRLYA9aUhuKdaKuS58c9P2E80PHWXIlbpFCg6EugQTgNfnYp+3qDUNz8edeCfapYLvF4s9eCMGyMsGnpDR8EDNOyuGy7Y3l7okX8Xqu464gMp9E+hX7bHkcD6a4xfyIgJcWxsku0tm1TH1dpn4M1UXRuyZZif8P08nuE6MTUL67sAR9J1lpn4lVEL4kflk0pP2tZ5ncgPQFafJrRz05krMb0eU5tb2H4gs7ao/LL6idWo8MM9K1yr8lIuT5x2WW5CX+RjA+i50ex114V6vX3PNP5oVyt+DynTUB9QmXzVm3oLfDc3Cae1uqh7X0CFd+xiztJBtg0VtJaD/xUJcuWfY4cV2lERo9fRrykltzlJqiXHO4nowt8OtN0BcViVV8NJhPhYFzyb4ympxpOlTjm3GETuT2TYhUqdgS9nzleEAbOmOHZdIO2COunPE= + +lecoffreFront: + serviceAccountName: lecoffre-front-sa + envSecrets: front-env-stg + command: "npm run api:start" + imagePullSecrets: + - name: docker-pull-secret + image: + pullPolicy: Always + repository: "rg.fr-par.scw.cloud/lecoffre/front" + resources: + requests: + cpu: 200m + memory: 1Gi + limits: + memory: 2Gi + ingress: + host: app.ppd.lecoffre.smart-chain.fr + tls: + hosts: + - app.ppd.lecoffre.smart-chain.fr + secretName: api-tls + annotations: + kubernetes.io/ingress.class: nginx + cert-manager.io/cluster-issuer: letsencrypt-prod + nginx.ingress.kubernetes.io/from-to-www-redirect: "true" + nginx.ingress.kubernetes.io/force-ssl-redirect: "true" + # key is name of the environment variable, scwID is the secret ID in SCW with "id:" in front + env: + - key: env1 + scwID: "id:a131edea-84e0-49d6-b4a8-20ab417220c9" + - key: env2 + scwID: "id:f396cfed-098f-4f75-8e5e-92ba60b46cee" + + diff --git a/devops/templates/docker-pull-secret.yaml b/devops/templates/docker-pull-secret.yaml new file mode 100644 index 00000000..dcb16698 --- /dev/null +++ b/devops/templates/docker-pull-secret.yaml @@ -0,0 +1 @@ +### USE SECRET FROM BACK diff --git a/devops/templates/lecoffre-front.yaml b/devops/templates/lecoffre-front.yaml index 5f375de6..53400248 100644 --- a/devops/templates/lecoffre-front.yaml +++ b/devops/templates/lecoffre-front.yaml @@ -3,7 +3,6 @@ apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: lecoffre-front - namespace: {{ .Values.namespace }} {{if .Values.lecoffreFront.ingress.annotations}} annotations: {{toYaml .Values.lecoffreFront.ingress.annotations | indent 4 }} @@ -18,7 +17,7 @@ spec: paths: - path: / pathType: Prefix - backend: + frontend: service: name: lecoffre-front-svc port: @@ -28,13 +27,12 @@ apiVersion: v1 kind: Service metadata: name: lecoffre-front-svc - namespace: {{ .Values.namespace }} labels: spec: ports: - port: 80 name: http - targetPort: 3000 + targetPort: 3001 selector: app: lecoffre-front --- @@ -42,7 +40,6 @@ apiVersion: apps/v1 kind: Deployment metadata: name: lecoffre-front - namespace: {{ .Values.namespace }} labels: app: lecoffre-front spec: @@ -53,7 +50,6 @@ spec: template: metadata: annotations: -{{toYaml .Values.lecoffreFront.vault.annotations | indent 8 }} labels: app: lecoffre-front spec: @@ -62,10 +58,13 @@ spec: - name: docker-pull-secret containers: - name: lecoffre-front - image: "{{ .Values.lecoffreFront.image.repository }}:v{{ .Chart.AppVersion }}" + image: "{{ .Values.lecoffreFront.image.repository }}:{{ .Values.lecoffreFront.image.tag }}" {{if .Values.lecoffreFront.resources}} resources: {{toYaml .Values.lecoffreFront.resources | indent 10}} {{end}} imagePullPolicy: {{ .Values.lecoffreFront.image.pullPolicy }} - command: [{{ .Values.lecoffreFront.command }}] \ No newline at end of file + command: [{{ .Values.lecoffreFront.command }}] + envFrom: + - secretRef: + name: {{ .Values.lecoffreFront.envSecrets }} \ No newline at end of file diff --git a/devops/templates/sealed-secret.yaml b/devops/templates/sealed-secret.yaml new file mode 100644 index 00000000..4d8a706b --- /dev/null +++ b/devops/templates/sealed-secret.yaml @@ -0,0 +1 @@ +## USE SEALED SECRET FROM BACK \ No newline at end of file diff --git a/devops/templates/secret-store.yaml b/devops/templates/secret-store.yaml new file mode 100644 index 00000000..f7888f78 --- /dev/null +++ b/devops/templates/secret-store.yaml @@ -0,0 +1 @@ +## USE SECRET STORE FROM BACK \ No newline at end of file diff --git a/devops/templates/secrets.yaml b/devops/templates/secrets.yaml new file mode 100644 index 00000000..52f3c820 --- /dev/null +++ b/devops/templates/secrets.yaml @@ -0,0 +1,16 @@ +apiVersion: external-secrets.io/v1beta1 +kind: ExternalSecret +metadata: + name: {{ .Values.lecoffreFront.envSecrets }} +spec: + refreshInterval: 20s + secretStoreRef: + kind: SecretStore + name: secret-store + data: + {{ range $v := .Values.lecoffreFront.env }} + - secretKey: {{ $v.key }} + remoteRef: + key: {{ $v.scwID}} + version: latest_enabled + {{ end }} \ No newline at end of file diff --git a/devops/values.yaml b/devops/values.yaml index c7a9480c..17226cbc 100644 --- a/devops/values.yaml +++ b/devops/values.yaml @@ -1,29 +1,17 @@ -dockerPullSecret: secret/data/lecoffre-front-stg/config/dockerpullsecret +dockerPullSecret: docker-pull-secret -namespace: lecoffre +scwSecretKey: ss lecoffreFront: serviceAccountName: lecoffre-front-sa - command: "'sh', '-c', '. /vault/secrets/envs && npm run start'" - vault: - role : custom_lecoffre-front_injector_rol - server: https://vault-stg.smart-chain.fr - annotations: - vault.hashicorp.com/agent-pre-populate-only: "true" - vault.hashicorp.com/agent-inject: "true" - vault.hashicorp.com/agent-inject-secret-envs: secret/data/lecoffre-front-stg/config/envs - vault.hashicorp.com/role: custom_lecoffre-front_injector_rol - vault.hashicorp.com/agent-inject-template-envs: | - {{ with secret "secret/data/lecoffre-front-stg/config/envs" }} - {{ range $k, $v := .Data.data }} - export {{ $k }}="{{ $v }}" - {{ end }} - {{ end }} + command: "npm run api:start" + envSecrets: env-env imagePullSecrets: - name: docker-pull-secret image: pullPolicy: Always repository: "rg.fr-par.scw.cloud/lecoffre/front" + tag: resources: requests: cpu: 200m @@ -31,14 +19,18 @@ lecoffreFront: limits: memory: 2Gi ingress: - host: app.stg.lecoffre.smart-chain.fr + host: api.stg.lecoffre.smart-chain.fr tls: hosts: - - app.stg.lecoffre.smart-chain.fr - secretName: app-tls + - api.stg.lecoffre.smart-chain.fr + secretName: api-tls annotations: kubernetes.io/ingress.class: nginx cert-manager.io/cluster-issuer: letsencrypt-prod nginx.ingress.kubernetes.io/from-to-www-redirect: "true" nginx.ingress.kubernetes.io/force-ssl-redirect: "true" + + env: + - key: a + scwID: b From 0e2a27dbb7e4f72f8ac0328d549da3e9eaa74193 Mon Sep 17 00:00:00 2001 From: Maxime Lalo Date: Thu, 3 Aug 2023 14:43:25 +0200 Subject: [PATCH 07/10] :sparkles: Fixing admin & super admin checked --- .../CollaboratorInformations/index.tsx | 18 ++++- .../Layouts/Users/UserInformations/index.tsx | 72 +++++++++++++++++-- 2 files changed, 82 insertions(+), 8 deletions(-) diff --git a/src/front/Components/Layouts/Collaborators/CollaboratorInformations/index.tsx b/src/front/Components/Layouts/Collaborators/CollaboratorInformations/index.tsx index ee40ef15..6ec149a5 100644 --- a/src/front/Components/Layouts/Collaborators/CollaboratorInformations/index.tsx +++ b/src/front/Components/Layouts/Collaborators/CollaboratorInformations/index.tsx @@ -33,7 +33,7 @@ export default function CollaboratorInformations(props: IProps) { useEffect(() => { if (!userSelected) return; - setIsAdminChecked(userSelected.role?.name === "admin" && !userSelected.office_role); + setIsAdminChecked(userSelected.role?.name === "admin"); }, [userSelected]); const handleRoleChange = useCallback((option: IOption) => { @@ -81,7 +81,21 @@ export default function CollaboratorInformations(props: IProps) { }), ); } else { - // retirer rôle admin + const defaultRole = await Roles.getInstance().getOne({ + where: { + name: "default", + }, + }); + + if (!defaultRole) return; + await Users.getInstance().put( + userSelected?.uid as string, + User.hydrate({ + uid: userSelected?.uid as string, + office_role: undefined, + role: defaultRole, + }), + ); } setAdminModalOpened(false); } catch (e) { diff --git a/src/front/Components/Layouts/Users/UserInformations/index.tsx b/src/front/Components/Layouts/Users/UserInformations/index.tsx index 6a8c174d..5ade8659 100644 --- a/src/front/Components/Layouts/Users/UserInformations/index.tsx +++ b/src/front/Components/Layouts/Users/UserInformations/index.tsx @@ -12,7 +12,7 @@ import Typography, { ITypo, ITypoColor } from "@Front/Components/DesignSystem/Ty import DefaultUserDashboard from "@Front/Components/LayoutTemplates/DefaultUserDashboard"; import JwtService from "@Front/Services/JwtService/JwtService"; import Toasts from "@Front/Stores/Toasts"; -import User, { Appointment, Vote } from "le-coffre-resources/dist/SuperAdmin"; +import User, { Appointment, OfficeRole, Vote } from "le-coffre-resources/dist/SuperAdmin"; import { EAppointmentStatus, EVote } from "le-coffre-resources/dist/SuperAdmin/Appointment"; import Image from "next/image"; import { useRouter } from "next/router"; @@ -28,6 +28,7 @@ export default function UserInformations(props: IProps) { const [userSelected, setUserSelected] = useState(null); const [availableRoles, setAvailableRoles] = useState([]); + const [roleModalOpened, setRoleModalOpened] = useState(false); const [isSuperAdminModalOpened, setIsSuperAdminModalOpened] = useState(false); const [superAdminModalType, setSuperAdminModalType] = useState<"add" | "remove">("add"); const [adminModalType, setAdminModalType] = useState<"add" | "remove">("add"); @@ -36,8 +37,15 @@ export default function UserInformations(props: IProps) { const [isAdminChecked, setIsAdminChecked] = useState(false); const [isAdminModalOpened, setIsAdminModalOpened] = useState(false); + const [selectedOption, setSelectedOption] = useState(null); + const [currentAppointment, setCurrentAppointment] = useState(null); + const handleRoleChange = useCallback((option: IOption) => { + setSelectedOption(option); + setRoleModalOpened(true); + }, []); + /** When page change, get the user of the page */ const getUser = useCallback(async () => { @@ -83,7 +91,7 @@ export default function UserInformations(props: IProps) { const closeAdminModal = useCallback(() => { setIsAdminModalOpened(false); - setIsAdminChecked(userSelected?.role?.name === "admin" && !userSelected.office_role); + setIsAdminChecked(userSelected?.role?.name === "admin"); }, [userSelected]); const handleAdminChanged = (checked: boolean) => { @@ -111,7 +119,21 @@ export default function UserInformations(props: IProps) { }), ); } else { - // retirer rôle admin + const defaultRole = await Roles.getInstance().getOne({ + where: { + name: "default", + }, + }); + + if (!defaultRole) return; + await Users.getInstance().put( + userSelected?.uid as string, + User.hydrate({ + uid: userSelected?.uid as string, + office_role: undefined, + role: defaultRole, + }), + ); } setIsAdminModalOpened(false); }, [userSelected, adminModalType]); @@ -123,7 +145,7 @@ export default function UserInformations(props: IProps) { const closeSuperAdminModal = useCallback(() => { setIsSuperAdminModalOpened(false); - setIsSuperAdminChecked(userSelected?.role?.name === "super-admin" && !userSelected.office_role); + setIsSuperAdminChecked(userSelected?.role?.name === "super-admin"); }, [userSelected]); const handleSuperAdminChanged = (checked: boolean) => { @@ -156,11 +178,33 @@ export default function UserInformations(props: IProps) { setIsSuperAdminModalOpened(false); }, [userSelected, currentAppointment, superAdminModalType, getUser]); + const closeRoleModal = useCallback(() => { + setRoleModalOpened(false); + setSelectedOption({ + value: userSelected?.office_role ? userSelected?.office_role?.uid : userSelected?.role?.uid, + label: userSelected?.office_role ? userSelected?.office_role?.name : userSelected?.role?.name!, + }); + }, [userSelected?.office_role, userSelected?.role?.name, userSelected?.role?.uid]); + + const changeRole = useCallback(async () => { + await Users.getInstance().put( + userSelected?.uid as string, + User.hydrate({ + uid: userSelected?.uid as string, + office_role: OfficeRole.hydrate({ + uid: selectedOption?.value as string, + }), + }), + ); + setRoleModalOpened(false); + getUser(); + }, [getUser, selectedOption?.value, userSelected?.uid]); + /** Reset switch state when userSelect change */ useEffect(() => { if (!userSelected) return; setIsSuperAdminChecked(userSelected.role?.name === "super-admin"); - setIsAdminChecked(userSelected.role?.name === "admin" && !userSelected.office_role); + setIsAdminChecked(userSelected.role?.name === "admin"); }, [userSelected]); const userHasVoted = useCallback(() => { @@ -223,7 +267,8 @@ export default function UserInformations(props: IProps) { role.label !== "admin")} + onChange={handleRoleChange} selectedOption={{ value: userSelected?.office_role ? userSelected?.office_role?.uid : userSelected?.role?.uid, label: userSelected?.office_role ? userSelected?.office_role?.name : userSelected?.role?.name!, @@ -271,6 +316,21 @@ export default function UserInformations(props: IProps) {
+ +
+ + Attribuer le rôle de {selectedOption?.label} à{" "} + {userSelected?.contact?.first_name} {userSelected?.contact?.last_name} ? + +
+
Date: Thu, 3 Aug 2023 14:54:59 +0200 Subject: [PATCH 08/10] :bug: Fixing lists heights and overflows --- .../DesignSystem/FolderListContainer/classes.module.scss | 6 ++++-- .../DeedTypeListContainer/classes.module.scss | 1 + .../DocumentTypeListContainer/classes.module.scss | 1 + .../OfficeListContainer/classes.module.scss | 4 +++- .../RoleListContainer/classes.module.scss | 4 +++- .../UserListContainer/classes.module.scss | 4 +++- 6 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/front/Components/DesignSystem/FolderListContainer/classes.module.scss b/src/front/Components/DesignSystem/FolderListContainer/classes.module.scss index b11dc6ba..d787f90f 100644 --- a/src/front/Components/DesignSystem/FolderListContainer/classes.module.scss +++ b/src/front/Components/DesignSystem/FolderListContainer/classes.module.scss @@ -15,7 +15,9 @@ } .folderlist-container { - height: 100%; + max-height: calc(100vh - 290px); + height: calc(100vh - 290px); + overflow: auto; border-right: 1px solid var(--grey-medium); } -} \ No newline at end of file +} diff --git a/src/front/Components/LayoutTemplates/DefaultDeedTypeDashboard/DeedTypeListContainer/classes.module.scss b/src/front/Components/LayoutTemplates/DefaultDeedTypeDashboard/DeedTypeListContainer/classes.module.scss index f5b589bb..d787f90f 100644 --- a/src/front/Components/LayoutTemplates/DefaultDeedTypeDashboard/DeedTypeListContainer/classes.module.scss +++ b/src/front/Components/LayoutTemplates/DefaultDeedTypeDashboard/DeedTypeListContainer/classes.module.scss @@ -16,6 +16,7 @@ .folderlist-container { max-height: calc(100vh - 290px); + height: calc(100vh - 290px); overflow: auto; border-right: 1px solid var(--grey-medium); } diff --git a/src/front/Components/LayoutTemplates/DefaultDocumentTypesDashboard/DocumentTypeListContainer/classes.module.scss b/src/front/Components/LayoutTemplates/DefaultDocumentTypesDashboard/DocumentTypeListContainer/classes.module.scss index 15e841c8..b8bae18e 100644 --- a/src/front/Components/LayoutTemplates/DefaultDocumentTypesDashboard/DocumentTypeListContainer/classes.module.scss +++ b/src/front/Components/LayoutTemplates/DefaultDocumentTypesDashboard/DocumentTypeListContainer/classes.module.scss @@ -16,6 +16,7 @@ .folderlist-container { max-height: calc(100vh - 290px); + height: calc(100vh - 290px); overflow: auto; border-right: 1px solid var(--grey-medium); } diff --git a/src/front/Components/LayoutTemplates/DefaultOfficeDashboard/OfficeListContainer/classes.module.scss b/src/front/Components/LayoutTemplates/DefaultOfficeDashboard/OfficeListContainer/classes.module.scss index 300d46f2..a27e911b 100644 --- a/src/front/Components/LayoutTemplates/DefaultOfficeDashboard/OfficeListContainer/classes.module.scss +++ b/src/front/Components/LayoutTemplates/DefaultOfficeDashboard/OfficeListContainer/classes.module.scss @@ -15,7 +15,9 @@ } .folderlist-container { - height: 100%; + max-height: 100vh; + height: 100vh; + overflow: auto; border-right: 1px solid var(--grey-medium); } } diff --git a/src/front/Components/LayoutTemplates/DefaultRoleDashboard/RoleListContainer/classes.module.scss b/src/front/Components/LayoutTemplates/DefaultRoleDashboard/RoleListContainer/classes.module.scss index 300d46f2..a27e911b 100644 --- a/src/front/Components/LayoutTemplates/DefaultRoleDashboard/RoleListContainer/classes.module.scss +++ b/src/front/Components/LayoutTemplates/DefaultRoleDashboard/RoleListContainer/classes.module.scss @@ -15,7 +15,9 @@ } .folderlist-container { - height: 100%; + max-height: 100vh; + height: 100vh; + overflow: auto; border-right: 1px solid var(--grey-medium); } } diff --git a/src/front/Components/LayoutTemplates/DefaultUserDashboard/UserListContainer/classes.module.scss b/src/front/Components/LayoutTemplates/DefaultUserDashboard/UserListContainer/classes.module.scss index 300d46f2..a27e911b 100644 --- a/src/front/Components/LayoutTemplates/DefaultUserDashboard/UserListContainer/classes.module.scss +++ b/src/front/Components/LayoutTemplates/DefaultUserDashboard/UserListContainer/classes.module.scss @@ -15,7 +15,9 @@ } .folderlist-container { - height: 100%; + max-height: 100vh; + height: 100vh; + overflow: auto; border-right: 1px solid var(--grey-medium); } } From 11db34a814e71ce51baa44cae050903b130ec912 Mon Sep 17 00:00:00 2001 From: pida123 Date: Thu, 3 Aug 2023 17:46:55 +0200 Subject: [PATCH 09/10] fix lecoffre-front --- .circleci/config.yml | 39 ++++++---------------------- devops/ppd.values.yaml | 9 ++++--- devops/prd.values.yaml | 9 ++++--- devops/stg.values.yaml | 10 +++---- devops/templates/lecoffre-front.yaml | 12 ++++++--- 5 files changed, 32 insertions(+), 47 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 96b23a85..c446c450 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -21,8 +21,8 @@ jobs: version: 20.10.12 docker_layer_caching: true - run: docker login rg.fr-par.scw.cloud/lecoffre -u nologin -p $SCW_SECRET_KEY - - run: docker build --tag rg.fr-par.scw.cloud/lecoffre/front:$TAG . - - run: docker push rg.fr-par.scw.cloud/lecoffre/front:$TAG + - run: docker build --tag rg.fr-par.scw.cloud/lecoffre/front:${CIRCLE_SHA1:0:7} . + - run: docker push rg.fr-par.scw.cloud/lecoffre/front:${CIRCLE_SHA1:0:7} deploy-docker-image: @@ -46,22 +46,17 @@ jobs: lecoffre-front devops/ -i -f devops/<>.values.yaml -n lecoffre-<> --create-namespace - --set lecoffrefront.image.repository='rg.fr-par.scw.cloud/lecoffre/front' - --set lecoffrefront.image.tag=$TAG + --set lecoffreBack.image.repository='rg.fr-par.scw.cloud/lecoffre/front' + --set lecoffreBack.image.tag=${CIRCLE_SHA1:0:7} + workflows: version: 2 build-and-register-stg: - when: - and: - - equal: [ staging, << pipeline.git.branch >> ] - - << pipeline.git.tag >> jobs: - build-push-docker-image: filters: - tags: - only: /^v.*/ branches: only: staging - deploy-docker-image: @@ -71,21 +66,13 @@ workflows: context: - sc-shared-prd filters: - tags: - only: /^v.*/ branches: - ignore: /.*/ + only: staging build-and-register-ppd: - when: - and: - - equal: [ preprod, << pipeline.git.branch >> ] - - << pipeline.git.tag >> jobs: - build-push-docker-image: filters: - tags: - only: /^v.*/ branches: only: preprod - deploy-docker-image: @@ -95,21 +82,13 @@ workflows: context: - sc-shared-prd filters: - tags: - only: /^v.*/ branches: - ignore: /.*/ + only: preprod build-and-register-prd: - when: - and: - - equal: [ main, << pipeline.git.branch >> ] - - << pipeline.git.tag >> jobs: - build-push-docker-image: filters: - tags: - only: /^v.*/ branches: only: main - deploy-docker-image: @@ -119,8 +98,6 @@ workflows: context: - sc-shared-prd filters: - tags: - only: /^v.*/ branches: - ignore: /.*/ + only: main diff --git a/devops/ppd.values.yaml b/devops/ppd.values.yaml index 8d3b1dd9..19c4025a 100644 --- a/devops/ppd.values.yaml +++ b/devops/ppd.values.yaml @@ -4,7 +4,7 @@ scwSecretKey: AgCgjF5QEzxT3GYTS5B6cmQ0e+0/qFWzKaUDSi+Vjc7RoameuvaIJvTXMBkS3he1oy lecoffreFront: serviceAccountName: lecoffre-front-sa - command: "npm run api:start" + command: "'sh', '-c', 'export $(xargs Date: Thu, 3 Aug 2023 17:47:46 +0200 Subject: [PATCH 10/10] fix front cicd --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c446c450..e004c36c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -46,8 +46,8 @@ jobs: lecoffre-front devops/ -i -f devops/<>.values.yaml -n lecoffre-<> --create-namespace - --set lecoffreBack.image.repository='rg.fr-par.scw.cloud/lecoffre/front' - --set lecoffreBack.image.tag=${CIRCLE_SHA1:0:7} + --set lecoffreFront.image.repository='rg.fr-par.scw.cloud/lecoffre/front' + --set lecoffreFront.image.tag=${CIRCLE_SHA1:0:7}