Skip to content

Commit

Permalink
refactor: migrate to vite + new VTL editor (#776)
Browse files Browse the repository at this point in the history
* build: init migration to vite

- update react to 18
- migrate to vite

* replace .js with .jsx in src/auth

* Switch to oidc-sap library

* .js 2 .jsx + replace absolute paths with relative paths

* Migrate to vite & fix import issues

* set .env file to VITE_

* replace getToken with oidc.getTokens().accessToken

* remove sonar bugs

* remove medium severity code smells

* update relative paths in spec.js files

* Switch to oidc-sap library

* .js 2 .jsx + replace absolute paths with relative paths

* Remove fake server and fix oidc

* Better oidcProvider work with oidc / none

* lower vitest errors

* fix: finalize rebasing on suggesters

* build: init migration to vite

- update react to 18
- migrate to vite

* replace .js with .jsx in src/auth

* Switch to oidc-sap library

* .js 2 .jsx + replace absolute paths with relative paths

* Migrate to vite & fix import issues

* set .env file to VITE_

* replace getToken with oidc.getTokens().accessToken

* remove sonar bugs

* remove medium severity code smells

* update relative paths in spec.js files

* Switch to oidc-sap library

* .js 2 .jsx + replace absolute paths with relative paths

* Remove fake server and fix oidc

* Better oidcProvider work with oidc / none

* lower vitest errors

* fix: finalize rebasing on suggesters

* rename remaining .js files into .jsx

* move token calculation to container

* restore token in components with oidc

* manage oidc provider in tests

* update node-version for tests

* add vitest imports

* update setupTests.ts address from relative to absolute

* add a replacement for dirname in vite.config

* try help test to find setupTests.ts

* restore failing tests to the branch

* remove nested filter

* fix init component weight

* split component-new-edit

* roundabout : add component

* feat : form to state and back

* save and back

* validate roundabout form

* remove duplicate code

* fix sonar issues

* simplify Pogues model for roundabout

* remove partial and complete + restore redirections call

* show tab redirections depending on redicretionNeeeded

* bump version

* add scope for collected variables depending on roundabout

* fix roundabout model

* fix: eslint config

* remove nested filter

* fix init component weight

* split component-new-edit

* roundabout : add component

* feat : form to state and back

* save and back

* validate roundabout form

* remove duplicate code

* fix sonar issues

* simplify Pogues model for roundabout

* remove partial and complete + restore redirections call

* show tab redirections depending on redicretionNeeeded

* bump version

* add scope for collected variables depending on roundabout

* fix roundabout model

* fix: bring back rich editor for xpath

* feat: add new vtl editor

* fix: add global to vite config

* deps: upgrade redux-form

* fix: revert md-vtl parser

* style : remove margin on vtl editor

* fix: response format table

* fix: don't display vtl error when field is empty

* fix declaration mode in roundabout

* fix: vtl-editor style

* fix: font & icons import

* fix: reducer with authType

* fix: forwardRef error

* fix: dnd type import

* fix: eslint errors

* deps: add test dependencies

* fix: add authType reducer

* fix: remove duplicate snapshot file

* fix : add token to visualizeDropdown props

* test: fix visualizeDropdown tests

* fix : add token to StatisticalContextCriteria props

* test: fix StatisticalContextCriteria tests

* fix : get token in SearchCodesLists

* test: fix SearchCodesLists tests

* fix: add token to InputFilterWithCriteria props

* test : fix InputFilterWithCriteria tests

* test : fix ResponseFormatSimple tests

* test: fix QuestionnaireNav tests

* test : skip not working tests

* test: skip not working test

* fix: vite config for test

* fix: after merge from main

* fix : visualizeDropdown test & import

* test: add script for test with coverage

* ci : fix test with coverage

* ci : fix path for build -> dist

* fix: coverage config

* fix: imports

* remove env

* fix: initialize auth

* fix: missing stamp on questionnaires list

* fix: VTL editor tools (syntax colorization...)

* fix: auth for deleting questionnaire

---------

Co-authored-by: Laurent Caouissin <[email protected]>
Co-authored-by: Bulot François <[email protected]>
Co-authored-by: Bulot François <[email protected]>
Co-authored-by: BulotF <[email protected]>
  • Loading branch information
5 people authored Jul 16, 2024
1 parent ef45656 commit a67f119
Show file tree
Hide file tree
Showing 522 changed files with 7,091 additions and 12,959 deletions.
20 changes: 11 additions & 9 deletions .env
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
REACT_APP_API_URL=http://localhost:5000
REACT_APP_ACTIVE_NAMESPACES='Components,Actions,Stores,Utils,Models'
VITE_API_URL=http://localhost:5000
VITE_ACTIVE_NAMESPACES='Components,Actions,Stores,Utils,Models'
VITE_PUBLIC_ENEMY_URL=

# AUTH
# NONE or OIDC
REACT_APP_AUTH_TYPE=NONE
REACT_APP_OIDC_AUTHORITY=
REACT_APP_OIDC_CLIENT_ID=

VITE_AUTH_TYPE=NONE
VITE_OIDC_AUTHORITY=
VITE_OIDC_CLIENT_ID=
# OPTIONAL
REACT_APP_DEFAULT_USER_ID=
REACT_APP_DEFAULT_USER_NAME=
REACT_APP_DEFAULT_USER_STAMP=

REACT_APP_LOG_LEVEL=DEBUG
VITE_DEFAULT_USER_ID=
VITE_DEFAULT_USER_NAME=
VITE_DEFAULT_USER_STAMP=

VITE_LOG_LEVEL=DEBUG
23 changes: 13 additions & 10 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,16 @@ plugins:
settings:
ecmascript: 2020

parser: babel-eslint

parserOptions:
ecmaVersion: 2020
sourceType: module
ecmaFeatures:
jsx: true

env:
browser: true
jest: true

rules:
indent: 0
Expand All @@ -35,25 +39,24 @@ rules:
react/prefer-stateless-function: 0
react/no-children-prop: 0
react/forbid-prop-types: 0
react/react-in-jsx-scope: 0
react/no-unescaped-entities: 0
prettier/prettier:
[
'error',
{
'trailingComma': 'all',
'singleQuote': true,
'endOfLine': 'auto',
'react/forbid-prop-types': 0,
},
]
- 'error'
- trailingComma: 'all'
singleQuote: true
endOfLine: 'auto'
react/forbid-prop-types: 0
import/prefer-default-export: 0
react/jsx-props-no-spreading: 0
import/order: 0
camelcase: 0
no-plusplus: 0
no-useless-escape: warn
no-restricted-globals: 0
import/named: 0
no-use-before-define: 0
prefer-destructuring: off
react/destructuring-assignment: 0
no-shadow: 0
no-else-return: 0
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
node-version: '20'
- run: yarn
- run: yarn build
- uses: actions/upload-artifact@v3
with:
name: pogues
path: build
path: dist

check_if_version_upgraded:
needs: build
Expand Down Expand Up @@ -62,7 +62,7 @@ jobs:
- uses: actions/download-artifact@v3
with:
name: pogues
path: build
path: dist
- uses: docker/build-push-action@v4
with:
platforms: linux/amd64,linux/arm64
Expand All @@ -87,7 +87,7 @@ jobs:
- uses: actions/download-artifact@v3
with:
name: pogues
path: build
path: dist
- name: Zip bundle
run: cd build && zip -r ../pogues.zip ./* && cd ..
- uses: softprops/action-gh-release@v1
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 15
node-version: 20
- run: yarn
# Run tests & build sonar reports
- run: yarn test
- run: yarn test:coverage
# Build lib
- run: yarn build
- name: Upload deploy artifact
Expand All @@ -30,7 +30,7 @@ jobs:
uses: actions/upload-artifact@v2
with:
name: build
path: build/
path: dist/

sonarcloud:
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
build/
dist/
node_modules/
npm-debug.log
yarn-error.log
Expand Down
2 changes: 1 addition & 1 deletion docs/en/developper-guide/remote-apis/configuration.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Configuration

The visualization and persistence services share the base URL of the API, provided by the `getBaseURI` method. When working on a development server, this URL must be defined in the [.env](https://github.com/InseeFr/Pogues/blob/main/.env) file in the `REACT_APP_API_URL` variable. For deployment on an apache server, the `POGUES_API_BASE_HOST` variable must be overridden in the [configuration.json](https://github.com/InseeFr/Pogues/blob/main/public/configuration.json) file located in the `public` folder.
The visualization and persistence services share the base URL of the API, provided by the `getBaseURI` method. When working on a development server, this URL must be defined in the [.env](https://github.com/InseeFr/Pogues/blob/main/.env) file in the `VITE_API_URL` variable. For deployment on an apache server, the `POGUES_API_BASE_HOST` variable must be overridden in the [configuration.json](https://github.com/InseeFr/Pogues/blob/main/public/configuration.json) file located in the `public` folder.
2 changes: 1 addition & 1 deletion docs/fr/guide-developpeur/remote-apis/configuration.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Configuration

Les services de visualisation et de persistance partage l'URL de base de l'API, fournie par la méthode `getBaseURI`. Lorsque que l'on travaille sur un serveur de développement, cette URL doit être définie dans le fichier [.env](https://github.com/InseeFr/Pogues/blob/main/.env) dans la variable `REACT_APP_API_URL`. Pour un déploiement sur un serveur apache, il faut surcharger la variable `POGUES_API_BASE_HOST` dans le fichier [configuration.json](https://github.com/InseeFr/Pogues/blob/main/public/configuration.json) se trouvant dans le dossier `public`.
Les services de visualisation et de persistance partage l'URL de base de l'API, fournie par la méthode `getBaseURI`. Lorsque que l'on travaille sur un serveur de développement, cette URL doit être définie dans le fichier [.env](https://github.com/InseeFr/Pogues/blob/main/.env) dans la variable `VITE_API_URL`. Pour un déploiement sur un serveur apache, il faut surcharger la variable `POGUES_API_BASE_HOST` dans le fichier [configuration.json](https://github.com/InseeFr/Pogues/blob/main/public/configuration.json) se trouvant dans le dossier `public`.
14 changes: 0 additions & 14 deletions fake-server/.eslintrc

This file was deleted.

Loading

0 comments on commit a67f119

Please sign in to comment.