From 92e0e10284a65444a4268411b05d894d26f2dca4 Mon Sep 17 00:00:00 2001 From: Pierre Vasseur Date: Thu, 24 Oct 2024 15:15:24 +0200 Subject: [PATCH] fix crash --- .vscode/settings.json | 3 +-- Dockerfile | 6 ++---- README.md | 4 ++-- sonar-project.properties | 2 +- .../visualization/tree/home-container.jsx | 20 +++++++++++-------- src/packages/utils/buildExtract.ts | 3 --- 6 files changed, 18 insertions(+), 20 deletions(-) delete mode 100644 src/packages/utils/buildExtract.ts diff --git a/.vscode/settings.json b/.vscode/settings.json index dea0bb7e3..1255fb56e 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -13,6 +13,5 @@ "statusBar.background": "#42b883", "statusBarItem.hoverBackground": "#359268", "statusBar.foreground": "#15202b" - }, - "peacock.color": "#42b883" + } } diff --git a/Dockerfile b/Dockerfile index f72da6f9b..9aa177f96 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,12 @@ ### BUILD STEP ### -FROM node:latest as builder +FROM node:latest AS builder WORKDIR /bauhaus COPY ./ ./ -RUN npm install --force - -RUN npm run build +RUN npm install --force && npm run build ### EXECUTION STEP ### diff --git a/README.md b/README.md index b3ec4aee4..d66a52e0d 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Web application for the management of concepts, classifications and other statis [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=InseeFr_Bauhaus&metric=coverage)](https://sonarcloud.io/dashboard?id=InseeFr_Bauhaus) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) -The documentation can be found in the [docs](https://github.com/InseeFr/Bauhaus/tree/main/documentation/src/content/docs) folder and [browsed online](https://inseefr.github.io/Bauhaus). +The documentation can be found in the [documentation folder](https://github.com/InseeFr/Bauhaus/tree/main/documentation/src/content/docs) and [browsed online](https://inseefr.github.io/Bauhaus). ## How to start @@ -28,7 +28,7 @@ You can run all tests suites with this command. You need to run at least once `n npm run test:coverage ``` -The following command will activate the `watch` mode, and you will be able to select a subset of tests you want to run. +The following command will activate the **watch** mode, and you will be able to select a subset of tests you want to run. ```shell npm run test --watchAll diff --git a/sonar-project.properties b/sonar-project.properties index 650dbf80e..387e35388 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -4,7 +4,7 @@ sonar.host.url=https://sonarcloud.io # Project name & version sonar.projectName=Bauhaus -sonar.projectVersion=3.1.2 +sonar.projectVersion=4.1.1 # Path to sources sonar.sources=src diff --git a/src/packages/modules-classifications/visualization/tree/home-container.jsx b/src/packages/modules-classifications/visualization/tree/home-container.jsx index a45d726fc..42a45b94e 100644 --- a/src/packages/modules-classifications/visualization/tree/home-container.jsx +++ b/src/packages/modules-classifications/visualization/tree/home-container.jsx @@ -7,9 +7,7 @@ import { getGeneral } from '../../../redux/classifications/classification/genera import { getTreeFromFlatData } from 'react-sortable-tree'; import { useSecondLang } from '../../../utils/hooks/second-lang'; import { useClassificationsItem } from '../../../utils/hooks/classifications'; -import { buildExtract } from '../../../utils/buildExtract'; - -const extractId = buildExtract('id'); +import { useParams } from 'react-router-dom'; const ClassificationTreeContainer = ({ id, @@ -52,7 +50,7 @@ const ClassificationTreeContainer = ({ }; const mapStateToProps = (state, ownProps) => { - const id = extractId(ownProps); + const id = ownProps.params.id; const general = getGeneral(state.classificationGeneral, id); return { id, @@ -64,7 +62,13 @@ const mapDispatchToProps = { loadClassificationGeneral, }; -export const Component = connect( - mapStateToProps, - mapDispatchToProps, -)(ClassificationTreeContainer); +const withParams = (Component) => { + return (props) => { + const params = useParams(); + return ; + }; +}; + +export const Component = withParams( + connect(mapStateToProps, mapDispatchToProps)(ClassificationTreeContainer), +); diff --git a/src/packages/utils/buildExtract.ts b/src/packages/utils/buildExtract.ts deleted file mode 100644 index 717630982..000000000 --- a/src/packages/utils/buildExtract.ts +++ /dev/null @@ -1,3 +0,0 @@ -export const buildExtract = (paramName: string) => { - return (props) => props.match.params[paramName]; -};