From 7dcaede860f2a65b04b0b905bf85d5819c2cf6d2 Mon Sep 17 00:00:00 2001 From: Jacobe2169 Date: Wed, 11 Oct 2023 10:15:18 +0200 Subject: [PATCH 1/2] first comment appearance of app.config.ts + delete command associated with it --- .github/workflows/cypress.yml | 6 ++-- backend/geonature/core/command/main.py | 38 +++++++++++++------------- backend/geonature/utils/command.py | 30 ++++++++++---------- install/05_install_frontend.sh | 2 +- 4 files changed, 38 insertions(+), 38 deletions(-) diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index 94ce100e14..41bbee9a79 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -101,9 +101,9 @@ jobs: ./install/05_install_frontend.sh --ci env: GEONATURE_CONFIG_FILE: "${{ github.workspace }}/config/test_config.toml" - - name: Show generated frontend config - run: | - cat ./frontend/src/conf/app.config.ts + # - name: Show generated frontend config + # run: | + # cat ./frontend/src/conf/app.config.ts - name: Install core modules run: | geonature install-gn-module contrib/occtax OCCTAX --build=false diff --git a/backend/geonature/core/command/main.py b/backend/geonature/core/command/main.py index dffd7ad452..c8886d1bbc 100644 --- a/backend/geonature/core/command/main.py +++ b/backend/geonature/core/command/main.py @@ -61,25 +61,25 @@ def dev_back(ctx, host, port): ctx.invoke(run_command, host=host, port=port) -@main.command() -@click.option( - "--input", - "input_file", - type=click.File("r"), -) -@click.option( - "--output", - "output_file", - type=click.File("w"), -) -def generate_frontend_config(input_file, output_file): - """ - Génération des fichiers de configurations pour javascript - """ - create_frontend_config(input_file, output_file) - click.echo( - "Configuration générée. Pensez à rebuilder le frontend pour la production.", err=True - ) +# @main.command() +# @click.option( +# "--input", +# "input_file", +# type=click.File("r"), +# ) +# @click.option( +# "--output", +# "output_file", +# type=click.File("w"), +# ) +# def generate_frontend_config(input_file, output_file): +# """ +# Génération des fichiers de configurations pour javascript +# """ +# create_frontend_config(input_file, output_file) +# click.echo( +# "Configuration générée. Pensez à rebuilder le frontend pour la production.", err=True +# ) @main.command() diff --git a/backend/geonature/utils/command.py b/backend/geonature/utils/command.py index 98b3a15df4..3be2c8e1ae 100644 --- a/backend/geonature/utils/command.py +++ b/backend/geonature/utils/command.py @@ -19,23 +19,23 @@ from geonature.utils.module import get_dist_from_code, get_module_config -def create_frontend_config(input_file=None, output_file=None): - if input_file is None: - input_file = (FRONTEND_DIR / "src/conf/app.config.ts.sample").open("r") - else: - input_file = nullcontext(input_file) - with input_file as f: - template = Template(f.read()) +# def create_frontend_config(input_file=None, output_file=None): +# if input_file is None: +# input_file = (FRONTEND_DIR / "src/conf/app.config.ts.sample").open("r") +# else: +# input_file = nullcontext(input_file) +# with input_file as f: +# template = Template(f.read()) - parameters = json.dumps(config_frontend, indent=True) - app_config_template = template.render(parameters=parameters) +# parameters = json.dumps(config_frontend, indent=True) +# app_config_template = template.render(parameters=parameters) - if output_file is None: - output_file = (FRONTEND_DIR / "src/conf/app.config.ts").open("w") - else: - output_file = nullcontext(output_file) - with output_file as f: - f.write(app_config_template) +# if output_file is None: +# output_file = (FRONTEND_DIR / "src/conf/app.config.ts").open("w") +# else: +# output_file = nullcontext(output_file) +# with output_file as f: +# f.write(app_config_template) def create_frontend_module_config(module_code, output_file=None): diff --git a/install/05_install_frontend.sh b/install/05_install_frontend.sh index 7dced1a0c0..6cfaae4c8d 100755 --- a/install/05_install_frontend.sh +++ b/install/05_install_frontend.sh @@ -71,7 +71,7 @@ cat src/assets/config.json echo "Création de la configuration du frontend depuis 'config/geonature_config.toml'..." # Generate the app.config.ts -geonature generate-frontend-config +# geonature generate-frontend-config echo "Désactivation du venv..." deactivate From 418e1d97591f61aeecf955c779be346e204d3729 Mon Sep 17 00:00:00 2001 From: Jacobe2169 Date: Wed, 11 Oct 2023 10:28:52 +0200 Subject: [PATCH 2/2] delate related script instruction, module import, documentation --- .github/workflows/cypress.yml | 4 ---- backend/geonature/core/command/main.py | 23 ----------------------- backend/geonature/utils/command.py | 19 ------------------- docs/development.rst | 9 --------- frontend/src/conf/app.config.ts.sample | 1 - install/05_install_frontend.sh | 4 ---- install/install_all/install_all.sh | 2 +- 7 files changed, 1 insertion(+), 61 deletions(-) delete mode 100644 frontend/src/conf/app.config.ts.sample diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index 41bbee9a79..a0e1d9ca8a 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -97,13 +97,9 @@ jobs: - name: generate frontend config run: | cp ./config/settings.ini.sample ./config/settings.ini - geonature generate_frontend_config ./install/05_install_frontend.sh --ci env: GEONATURE_CONFIG_FILE: "${{ github.workspace }}/config/test_config.toml" - # - name: Show generated frontend config - # run: | - # cat ./frontend/src/conf/app.config.ts - name: Install core modules run: | geonature install-gn-module contrib/occtax OCCTAX --build=false diff --git a/backend/geonature/core/command/main.py b/backend/geonature/core/command/main.py index c8886d1bbc..4b63ba18dc 100644 --- a/backend/geonature/core/command/main.py +++ b/backend/geonature/core/command/main.py @@ -16,7 +16,6 @@ from geonature.utils.config import config from geonature.utils.config_schema import GnGeneralSchemaConf, GnPySchemaConf from geonature.utils.command import ( - create_frontend_config, create_frontend_module_config, build_frontend, ) @@ -61,27 +60,6 @@ def dev_back(ctx, host, port): ctx.invoke(run_command, host=host, port=port) -# @main.command() -# @click.option( -# "--input", -# "input_file", -# type=click.File("r"), -# ) -# @click.option( -# "--output", -# "output_file", -# type=click.File("w"), -# ) -# def generate_frontend_config(input_file, output_file): -# """ -# Génération des fichiers de configurations pour javascript -# """ -# create_frontend_config(input_file, output_file) -# click.echo( -# "Configuration générée. Pensez à rebuilder le frontend pour la production.", err=True -# ) - - @main.command() @click.argument("module_code") @click.option( @@ -113,7 +91,6 @@ def update_configuration(modules, build): """ click.echo("Génération de la configuration du frontend :") click.echo(" GeoNature … ", nl=False) - create_frontend_config() click.secho("OK", fg="green") if modules: for dist in iter_modules_dist(): diff --git a/backend/geonature/utils/command.py b/backend/geonature/utils/command.py index 3be2c8e1ae..351a1d4984 100644 --- a/backend/geonature/utils/command.py +++ b/backend/geonature/utils/command.py @@ -19,25 +19,6 @@ from geonature.utils.module import get_dist_from_code, get_module_config -# def create_frontend_config(input_file=None, output_file=None): -# if input_file is None: -# input_file = (FRONTEND_DIR / "src/conf/app.config.ts.sample").open("r") -# else: -# input_file = nullcontext(input_file) -# with input_file as f: -# template = Template(f.read()) - -# parameters = json.dumps(config_frontend, indent=True) -# app_config_template = template.render(parameters=parameters) - -# if output_file is None: -# output_file = (FRONTEND_DIR / "src/conf/app.config.ts").open("w") -# else: -# output_file = nullcontext(output_file) -# with output_file as f: -# f.write(app_config_template) - - def create_frontend_module_config(module_code, output_file=None): """ Create the frontend config diff --git a/docs/development.rst b/docs/development.rst index 27cb145809..77c5d41c5f 100644 --- a/docs/development.rst +++ b/docs/development.rst @@ -252,15 +252,6 @@ Debugger avec un navigateur L'extension `Angular DevTools `_ permettra de debugger l'application dans la console du navigateur. Pour utiliser l'extension vous devez l'installer et passer obligatoirement en mode ``development``. -Ouvrez le fichier ``frontend/src/conf/app.config.ts`` et modifiez la valeur ``PROD_MOD`` pour avoir : - -.. code-block:: javascript - :linenos: - - "PROD_MOD": false - -Si le mode production (PROD_MOD) est à true, alors vous n'êtes pas en mode production lors du lancement de la commande ``npm run start``. - .. _dev-backend: Développement Backend diff --git a/frontend/src/conf/app.config.ts.sample b/frontend/src/conf/app.config.ts.sample deleted file mode 100644 index d59ca456f8..0000000000 --- a/frontend/src/conf/app.config.ts.sample +++ /dev/null @@ -1 +0,0 @@ -export const AppConfig = {{parameters}}; diff --git a/install/05_install_frontend.sh b/install/05_install_frontend.sh index 6cfaae4c8d..711240cdbe 100755 --- a/install/05_install_frontend.sh +++ b/install/05_install_frontend.sh @@ -69,10 +69,6 @@ echo $api_end_point sed -i 's|"API_ENDPOINT": .*$|"API_ENDPOINT" : "'${api_end_point}'"|' src/assets/config.json cat src/assets/config.json -echo "Création de la configuration du frontend depuis 'config/geonature_config.toml'..." -# Generate the app.config.ts -# geonature generate-frontend-config - echo "Désactivation du venv..." deactivate diff --git a/install/install_all/install_all.sh b/install/install_all/install_all.sh index 4b54c25a09..c3d3ddd021 100755 --- a/install/install_all/install_all.sh +++ b/install/install_all/install_all.sh @@ -31,7 +31,7 @@ my_domain=$(echo $my_url | sed -r 's|^.*\/\/(.*)$|\1|') my_domain=$(echo $my_domain | sed s'/.$//') export DOMAIN_NAME="$my_domain" -# Check OS and versions +# Check OS and versions if [ "$OS_NAME" != "debian" ] then echo -e "\e[91m\e[1mLe script d'installation n'est prévu que pour la distribution Debian\e[0m" >&2