Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Améliorer le temps de chargement des données #46

Closed
2 tasks done
joelclems opened this issue Sep 14, 2020 · 9 comments
Closed
2 tasks done

Améliorer le temps de chargement des données #46

joelclems opened this issue Sep 14, 2020 · 9 comments
Labels
enhancement New feature or request

Comments

@joelclems
Copy link
Collaborator

joelclems commented Sep 14, 2020

Le temps de chargement peut être long pour un nombre relativement réduit de données.
Voir quelle sont les possibilités d'amélioration:

  • : travail sur le chargement des géométries
    • : récupérer la géométrie au format json directement depuis le sql ou depuis la requête sqlachemy
@joelclems joelclems added the enhancement New feature or request label Sep 14, 2020
@jbdesbas
Copy link
Contributor

jbdesbas commented Oct 12, 2020

Pour une vingtaine de sites, le geojson met près de 3 secondes à être généré par le serveur. Je n'ai pas de requêtes de plus de 1 sec loguée, donc c'est bien côté python que ça bouchonne.
J'ai environ 2000 sites ponctuels à intégrer, mais à partir de 100 je commence à avoir des timeout.

Edit : je constate tout de même que sur le serveur de demo, le délai pour généré le geojson des 17 sites STOM n'est que de 120ms. Peut-être un truc a voir de mon côté

@joelclems
Copy link
Collaborator Author

ça reste un des gros points noirs du module, je pense qu'il y a quelque chose à jouer dans la serialisation ou dans le module utils_flask_sqla_geo
je regarde ça demain en détail
c'est des points ou des polygones?

@jbdesbas
Copy link
Contributor

jbdesbas commented Oct 14, 2020

Salut,
Il s'agit bien de points. Après quelques tests, ca semble bien être la sérialisation qui coince. Je suis toujours intrigué par la différence entre mon serveur et le serveur de demo. Le matériel n'est peut-être pas le même, mais ça fait une sacrée différence.

Si ca peut t'aider, voici ce que j'ai relevé de mon côté :
sérialisation d'un site : 0,08 sec (temps entre le début et la fin de fonction serialize() )
Dont environ 50% (0.04 sec) du temps sur la récupération des valeurs d'attributs. (pas encore de notion de géometrie il me semble)

for field_name in self.properties_names():
val = getattr(self._model, field_name)
if isinstance(val, (datetime.date, uuid.UUID)):
val = str(val)
properties[field_name] = val

En remplaçant val = getattr(self._model, field_name) par val = self._model.__dict__.get(field_name) je gagne 50% sur cette boucle (qui passe donc a 0.02sec), mais ca reste trop long pour être utilisable (et c'est peut-être pas sans conséquence, cf : https://stackoverflow.com/questions/9790991/why-is-getattr-so-much-slower-than-self-dict-get )

joelclems added a commit that referenced this issue Oct 15, 2020
@joelclems
Copy link
Collaborator Author

En mettant le nez dans les requêtes, j'ai pu décéler pas mal de problèmes

  • le fait de passer une partie le config en base dans t_module_complements et de verifier la date de modification de cette table engendrait une requete à chaque appel de la config du module en backend

    • c'est résolu verifiant la config seulement une fois par api, au début de l'appel
  • il restait pas mal de sous-requetes, cela à pu être résolu en:

    • mettant au maximum de lazy='joined' (pour les realtions comme observers, datasets, medias, ...) (sauf pour les relation enfants comme sites visites observations, ...
    • les colonnes hybride générait aussi des sous requetes (last_visit, nb_visits, nb_observation)

last_visit = column_property(
select([func.min(TBaseVisits.visit_date_min)]).\
where(TBaseVisits.id_base_site==id_base_site)
)
nb_visits = column_property(
select([func.count(TBaseVisits.id_base_site)]).\
where(TBaseVisits.id_base_site==id_base_site)
)

  • Les column_property sont accessible avec as_dict de la classe serializable, les propriétés hybrides non.

  • avec column_property on peut directement récupérer la geométrie au format geojson depuis la base ce qui pourrait accélérer les requetes

geom_geojson = column_property(
select([func.st_asgeojson(TBaseSites.geom)]).\
where(TBaseSites.id_base_site==id_base_site).\
correlate_except(TBaseSites)
)

@jbdesbas est ce que ces modifications te permettent de faire les requetes sur ton serveur?

je n'ai pas changé getattr en self._model.__dict__.get parce que j'ai des relationships dans la liste (medias observers datasets, ...) mais normalement cette partie du code ne génère plus de sous-requetes

de mon coté ça me fait des reponse de 1Mo pour 2000 sites, il y a peut être des pistes pour gagner au niveau de la taille des données

@camillemonchicourt
Copy link
Member

Super bravo pour ces optimisations !

@jbdesbas
Copy link
Contributor

Salut @joelclems
Ca fait une sacré différence avec le dernier commit 17910b3 : pour les 20 sites, la requête abouti en 300ms 🚀 (contre 2~3 sec 🐢 avant), bien joué !
(Pour appliquer le commit, j'ai dû rajouter une colonne id_sites_group dans la base)

La taille des réponses peuvent être considérablement réduites (80~90%) en ajoutant une compression des fichiers json dans apache (cf PnX-SI/GeoNature#560 (comment) )

Je test avec les 2000 sites et je te fais un retour.

Petite curiosité, la route permettant de charger la liste des sites est appelé 2 fois par le frontend :
image

@joelclems
Copy link
Collaborator Author

joelclems commented Oct 15, 2020

C'est qu'on appelle le module en tant qu'objet pour les detail et les listes
et on l'appelle pour les sites pour la carte (si par exemple on arrive directement sur une page d'un site d'une visite etc..)
il y a clairement des amélioration à faire de ce côté là

@joelclems
Copy link
Collaborator Author

il y a aussi une modification du front à prendre en compte dans le dernier commit

@jbdesbas
Copy link
Contributor

800 ms pour les 2000 sites 👌
Merci encore pour ton travail et ta réactivité !

andriacap pushed a commit to andriacap/gn_module_monitoring that referenced this issue May 15, 2023
* fix(api): remove monitoring_g_definitions

Since it prevents the module to load...

* feat(api): add join relationships

For sites and sites_groups

* fix(config): put back id_sites_group

* refactor(api): move function to prevent circular

Imports!

* fix(api): load sites groups from module_id

* chore: remove useless code
amandine-sahl pushed a commit that referenced this issue Oct 6, 2023
* fix(api): remove monitoring_g_definitions

Since it prevents the module to load...

* feat(api): add join relationships

For sites and sites_groups

* fix(config): put back id_sites_group

* refactor(api): move function to prevent circular

Imports!

* fix(api): load sites groups from module_id

* chore: remove useless code
amandine-sahl pushed a commit that referenced this issue Oct 10, 2023
* fix(api): remove monitoring_g_definitions

Since it prevents the module to load...

* feat(api): add join relationships

For sites and sites_groups

* fix(config): put back id_sites_group

* refactor(api): move function to prevent circular

Imports!

* fix(api): load sites groups from module_id

* chore: remove useless code
amandine-sahl pushed a commit that referenced this issue Dec 7, 2023
* fix(api): remove monitoring_g_definitions

Since it prevents the module to load...

* feat(api): add join relationships

For sites and sites_groups

* fix(config): put back id_sites_group

* refactor(api): move function to prevent circular

Imports!

* fix(api): load sites groups from module_id

* chore: remove useless code
amandine-sahl pushed a commit that referenced this issue Dec 8, 2023
* fix(api): remove monitoring_g_definitions

Since it prevents the module to load...

* feat(api): add join relationships

For sites and sites_groups

* fix(config): put back id_sites_group

* refactor(api): move function to prevent circular

Imports!

* fix(api): load sites groups from module_id

* chore: remove useless code
amandine-sahl pushed a commit that referenced this issue Dec 8, 2023
* fix(api): remove monitoring_g_definitions

Since it prevents the module to load...

* feat(api): add join relationships

For sites and sites_groups

* fix(config): put back id_sites_group

* refactor(api): move function to prevent circular

Imports!

* fix(api): load sites groups from module_id

* chore: remove useless code
amandine-sahl pushed a commit that referenced this issue Jul 29, 2024
* fix(api): remove monitoring_g_definitions

Since it prevents the module to load...

* feat(api): add join relationships

For sites and sites_groups

* fix(config): put back id_sites_group

* refactor(api): move function to prevent circular

Imports!

* fix(api): load sites groups from module_id

* chore: remove useless code
amandine-sahl pushed a commit that referenced this issue Oct 4, 2024
…; BACK : création routes spécifiques + implémentation CRUVED; FRONT: gestionnaire de site

feat: [6.2] Page d'accueil module monitoring layout et config title et description #2 (#15)

* feat: [6.2] Page d'accueil modul monitoring layout et config title et description #2

* chore(config): applied black & removed imports

Feat/monitoring sites (#16)

* feat(api): wip began add site routes + tests

With site categories
Also add tests

* feat(api): add more routes

* test(api): add tests and fixtures

* style(api): applied black

* feat(db): add migration to remove id_module

Column in t_sites_groups

* refactor(api): move utils for routes from sites

* feat(api): wip: add sites groups route

* test(api): wip: begin adding fixture site_groups

* fix: remove id_module in all models

* chore: rename route for better consistency

* tests: moved site_groups in tests and add tests

* chore(api): applied black

* refactor(api): add filter params function

And refact routes to use it

Feat/site type categories and module categorie (#18)

* feat(api): add association table with alembic

Add model in backend and alembic migration

Reviewed-by: andriac
[Refs ticket]: #3

* test: WIP add test to see new relationship

Adding test to see if categories are showing up when we call module

Reviewed-by: andriacap
[Refs ticket]: #3

* feat: add type site - categorie relation

WIP - add selectfield to get type site in admin module

Reviewed-by: andriac
[Refs ticket]: #3

* feat(api): Flask admin and routes categories

Clean code for change label list and form selectfield for
the BibCategorieView in Flask Admin

Add utils routes to get all subtable relationship in order to
get back the label type site

Review-by: andriac
[Refs ticket]: #3

* refactor: remove paginate_nested

For depth in as_dict()

* test: fix tests due to as_dict depth

* style: applied black and isort

* chore: remove unused import

Co-authored-by: Andria Capai <andria_capai@natural-solutions.eu>

Feat/edit categories module (#19)

* tests: make tests and fixtures work for modules

By changing the way a monitoring module is created in the fixture
Add two tests to check the relationship

* feat(api): add categories in edit module

* style: applied black

test: refactor fixtures to load them automatically (#20)

Need to set the current working directory of pytest the directory
where the gn_monitoring_module repo is (so with the frontend etc.)

test: move test_route in parent dir (#17)

clean: Merge la PR move test_route
Co-authored-by: Andria Capai <andria_capai@natural-solutions.eu>

Feat/create marshmallow schemas and remove id_module (#21)

* feat(api): remove id_module from sites_complements

Co-authored-by: andriacap <andriacap@users.noreply.github.com>

* feat(api): create schema for sites_groups

* test: add sites_group to site fixture

* test: wip add test for sites_groups schemas

* chore(api): remove depth parameter from paginate

* test: updated to work with sites_group schema

* feat: categorie site with marshmallow

Test and marshmallow create/refactor to
adapt for bibcategorie site paginate

WIP : Adapt load_only site_type in test to "assert"
same object when initiate BibCategorieSite

[Refs ticket]: #3

* feat(api): route /sites/categories/id with schema

Changing the route to return a dump Marshmallow schema
BibCategorieSitesSchema

Reviewed-by: andriac
[Refs ticket]: #3

* test(api): routes get categoires label

Change the "as_dict" by schema.dump in order
to use the Marshmallow schema created

Reviewed-by: andriac
[Refs ticket]: #3

* feat(api): Sites: cols to geoserializable + schema

* style(api): applied black

* test(api): add test for Site Schema

* style(api): applied black to test_site

* refactor(api): instantiate schema once

Instead of for each all() iteration

* chore(api): remove useless comments

* chore(api): remove useless comments and imports

Co-authored-by: andriacap <andriacap@users.noreply.github.com>
Co-authored-by: Andria Capai <andria_capai@natural-solutions.eu>

refactor(api): remove id_type in admin (#22)

To replace it with a bib nomenclature type: TYPE_SITE

style(config): rename attribut label of categories (#23)

Fix/paginate utils (#24)

* fix(api): add int conversion for limit/offset

* test(api): add test for get_limit_offset

* fix(api): max_per_page => per_page & test

* test(api): update test with changes on schema

Since marshmallow schemas, the json returned by pagination has
changed for items and not sites

Feat/improve filter (#25)

* feat(api): add Query Class to sites, grps & cats

* feat(api): add sort and fix _get_model

Via _get_entity

* test(api): test sort query

* feat(api): add api sort/sort_dir params

To be able to sort through REST Api

* fix(api): check if integer to avoid using ilike

In filter_by_params

* test(api): add test to check filter integer

fix(config): changed categories into items (#29)

* Merged feat/package-module-alembic

commit 70b01395d5031487a4e74e9cbe60a87ceabe2a70
Author: Maxime Vergez <maxime_vergez@natural-solutions.eu>
Date:   Tue Dec 6 15:22:56 2022 +0100

    style: apply black

commit 2badedf9976435319cc577ec3e4b861e1a4ec3c1
Author: Maxime Vergez <maxime_vergez@natural-solutions.eu>
Date:   Tue Dec 6 15:11:41 2022 +0100

    chore(db): removed unused import

commit 57d9b523d620cc55580002a53f2883cdf692ba5f
Author: Maxime Vergez <maxime_vergez@natural-solutions.eu>
Date:   Tue Dec 6 14:47:48 2022 +0100

    feat(db): improved & finished downgrade func

commit 211780f4467f27f0e188623b03c46c25823c34bc
Author: Maxime Vergez <maxime_vergez@natural-solutions.eu>
Date:   Tue Dec 6 09:32:12 2022 +0100

    feat(db): wip: add upgrade and began downgrade

    Downgrade migration need a little bit more work due to the use of
    sql alchemy and not plain text sql

commit 0b5a3b883fe8f08e0f8d34198ab3c44b39728159
Author: Maxime Vergez <maxime_vergez@natural-solutions.eu>
Date:   Mon Dec 5 11:40:32 2022 +0100

    feat: packaged module

* Feat/edit categories module (#19)

* tests: make tests and fixtures work for modules

By changing the way a monitoring module is created in the fixture
Add two tests to check the relationship

* feat(api): add categories in edit module

* style: applied black

* fix(config): changed categories into items

Following the change with marshmallow schemas

Fix/db migrations (#31)

* feat(db): upgrade down_revision following rebase

Since rebase with develop: changed the down_revision number

* fix(db): fix bind params enabling downgrade

Beforehand the downgrade was not possible...

* refactor(db): removed cor_site_type_category

* refactor(db): changed category into type in cor

* refactor(db): create cor_type_site

* fix(db): renamed column

* refactor(api): update models to fit migrations

* fix(db):change bib_categorie_site to bib_type_site

Adding :
cor_site_module
cor_site_type
revision alembic to create function and trigger in order to add
bib_type_site but only with nomenclature 'TYPE_SITE'
upgrade and downgrade works

[Refs ticket]: #3
Reviewed-by: andriac

* fix(api): updated models from migrations

* fix(api): wip: fix admin following migrations

* fix(api): update routes and tests

To match migration changes

* feat: flask admin bib_type_site

Change bib_categories to bib_type_site into flask admin
Adding filtering in list label_fr of type_site to secure the unique
constraint

Reviewed-by: andriac
[Refs ticket]: #3

* fix(api): updated schema to match models

* fix(api): module edition

* style(api): uniformize type_site

* style(api): change relationship name for type_site

* feat(api): validator admin

* fix(api): make unique BibTypeSite in admin

* test(api): fix test when existing nomenclatures

In database

Co-authored-by: Andria Capai <andria_capai@natural-solutions.eu>

perf(api): improved loading of modules (#30)

* Merged feat/package-module-alembic

commit 70b01395d5031487a4e74e9cbe60a87ceabe2a70
Author: Maxime Vergez <maxime_vergez@natural-solutions.eu>
Date:   Tue Dec 6 15:22:56 2022 +0100

    style: apply black

commit 2badedf9976435319cc577ec3e4b861e1a4ec3c1
Author: Maxime Vergez <maxime_vergez@natural-solutions.eu>
Date:   Tue Dec 6 15:11:41 2022 +0100

    chore(db): removed unused import

commit 57d9b523d620cc55580002a53f2883cdf692ba5f
Author: Maxime Vergez <maxime_vergez@natural-solutions.eu>
Date:   Tue Dec 6 14:47:48 2022 +0100

    feat(db): improved & finished downgrade func

commit 211780f4467f27f0e188623b03c46c25823c34bc
Author: Maxime Vergez <maxime_vergez@natural-solutions.eu>
Date:   Tue Dec 6 09:32:12 2022 +0100

    feat(db): wip: add upgrade and began downgrade

    Downgrade migration need a little bit more work due to the use of
    sql alchemy and not plain text sql

commit 0b5a3b883fe8f08e0f8d34198ab3c44b39728159
Author: Maxime Vergez <maxime_vergez@natural-solutions.eu>
Date:   Mon Dec 5 11:40:32 2022 +0100

    feat: packaged module

* perf(api): improved loading of modules

When there are loads of datasets, the relationship takes a lot of
time to load, and is useless for the route that uses it.

* fix: due to wrong rebase

Fix: newline on data_utils.py
Fix: relationships are not joined anymore since there is no need of
them
Chore: update comment

Fix/pagination (#28)

* fix(api): page - 1 that returned the wrong page

* test(api): add test for paginate

style(api): restore data_utils spaces (#33)

Fix/db migrations checkconstrainton bib_type_site.id_nomenclature (#34)

* fix(db): change trigger to constraint (migrations)

Delete the trigger and create check constraint on id_nomenclature column

Reviewed-by: andriacap
[Refs ticket]: #3

* fix(db) : apply black on migration file

Apply black
[Refs_ticket]: #3

fix(api): invert filter condition with Unicode (#35)

So that it will fallback to == most of the time and ilike when
just Unicode

fix(db): add NOT VALID in constraint for bib_type_site (#36)

Cannot use alembic to do this because need sqlalchemy >= 1.4.32

Fix/review checkpoint1 (#37)

* refactor(api): change offset to page

* refactor(api): rename id_nomenclature

* fix(admin): add compare field to Unique

Since now, BibTypeSite and TNomenclature do not share the same
column anymore (id_nomenclature_type_site vs id_nomenclature)

Add comments on new table

improve downgrade migration

Black

Fix/db migrations (#31)

* feat(db): upgrade down_revision following rebase

Since rebase with develop: changed the down_revision number

* fix(db): fix bind params enabling downgrade

Beforehand the downgrade was not possible...

* refactor(db): removed cor_site_type_category

* refactor(db): changed category into type in cor

* refactor(db): create cor_type_site

* fix(db): renamed column

* refactor(api): update models to fit migrations

* fix(db):change bib_categorie_site to bib_type_site

Adding :
cor_site_module
cor_site_type
revision alembic to create function and trigger in order to add
bib_type_site but only with nomenclature 'TYPE_SITE'
upgrade and downgrade works

[Refs ticket]: #3
Reviewed-by: andriac

* fix(api): updated models from migrations

* fix(api): wip: fix admin following migrations

* fix(api): update routes and tests

To match migration changes

* feat: flask admin bib_type_site

Change bib_categories to bib_type_site into flask admin
Adding filtering in list label_fr of type_site to secure the unique
constraint

Reviewed-by: andriac
[Refs ticket]: #3

* fix(api): updated schema to match models

* fix(api): module edition

* style(api): uniformize type_site

* style(api): change relationship name for type_site

* feat(api): validator admin

* fix(api): make unique BibTypeSite in admin

* test(api): fix test when existing nomenclatures

In database

Co-authored-by: Andria Capai <andria_capai@natural-solutions.eu>

Feat/get all sites (#26)

* test(api): test all_geometries route

* feat(api): geojson instead of geobuf for sites

* feat(api): add all_sites_group_geometry route

To return the geometries of all sites groups

* test(api): refactor fixture

To add a new one: site_group_with_sites since not all sites_groups
have sites

* test(api): test get_sites_groups route

* feat(api): add possibility to filter

On id_base_site, base_site_name and id_sites_group

* test(api): add fixture to get group without site

Feat/crud/gp sites components (#38)

* feat(front): wip sites_groups component and svc

* WIP feat(front): DataTable sites_groups

- Table with specific data value (OK)
- Table with sort column (OK)
- Datatable , select row event and change
color (wip).

Reviewed-by: andriac
[Refs ticket]: #4

* feat(front): Datatable format and selected row

- Get and display data from group_site database (OK)
- Selecting row and get id of row table (OK)

Improve :
- improve assign colname table outside the component (maybe into the
  class folder ?)

Todo/next:
- Filtering table
- Add action column to table
- refactor code by creating component for the ngx-datable in order to
  reuse component for other data

Reviewed-by: andriac
[Refs ticket]: #4

* feat(front): Filtering table (OK)

Function filtering is working on each column
Button filtering hide/display filter inputs (OK)

TODO:
- check for "help" icon and description for each column if description
  present
- Check if multiple rows and pages if it's working

Reviewed-by: andriac
[Refs ticket]: #4

* feat(front): wip server pagination & filtering

* feat(front): add sorting capability and fixes

Fix: keep filters (sort and filters) on when changing pages
Feat: remove useless id column
Feat: add sorting

* fix(db): change trigger to constraint (migrations)

Delete the trigger and create check constraint on id_nomenclature column

Reviewed-by: andriacap
[Refs ticket]: #3

* refactor: Custom type Geojson and group properties

Create custom type geojson and build properties into marshmallow schema
according to this type of Geojson

[Refs ticket]: #3

* refactor: site component with site-service

add function to site.services.ts

[Refs ticket]: #4

* refactor: create datatable component and service

Separate of concern for all about table (service and component)
and all about sites (service and component)

reviewed_by: andriacap
[Refs ticket]: #3

* fix: change offset to page

change offset name to page
for paginated

Reviewed-by: andriacap
[Refs ticket]: #4

* merge: merge interface and type

merge site_group.service.ts
delete site.service.ts
add interfaces
re arrange code from branch front-site-interface

Reviewed-by: andriacap
[Refs ticket]: #4

* feat: details properties sites groups

Create properties components to display properties of sites_groups
Adding route with id according to the site group selected

Reviewed-by: andriacap
[Refs ticket]: #4

* feat: display groups sites's child

Display group site child into table and uder properties
Use routing and id params to display property of groups site

Create service site
Add logic to check routing and child route to display reactive component
properties and table

Reviewed-by: andriacap
[Refs ticket]: #4

* refactor(front): rename interfaces, remove classes

Better types

* feat(front): get all geometries

For sites and sites_groups

* feat(front): WIP: geojson service to create layers

And features groups since geojson component accumulated layers
without cleaning them...

* feat(front): implemented select capability

Need to refact a lot!

* feat(api): add route to get one site_group by id

* fix(front): too much /

* feat(front): add get sites_group from id

* fix(front): add possibility to provide Geometry

To setMapData

* refactor(front): sites and sites_groups component

To extend a base component to gather the same methods at one place
To use route children and router-outlet properly
To add some rxjs operators
To move some common interfaces/functions

* fix(front): fix filters by adding baseFilters

* feat: edit sitegroups

Create edit-service
Create observable to update object to edit according to form component
Adapt function service of monitoring object to sites and sitesgroups

WIP:
- adapt remaining function of monitoring object inside
form-component-g
- create an object which inherit of patch/post/delete method with
- think about object with ObjectType of sites_group , sites, observation
  ? , visit ?
- reload properties or update data of properties table after update data

Reviewed-by:andriacap
[Refs_ticket]: #4

* feat: edit sitegroups

Improving route 'patch'
Adding reload properties when sitegroups is updated
Refactoring EditService for more readability

Reviewed-by: andriacap
[Ref_ticket]: #4

* feat: improve edit

Add method to define objectType according to service used (site or
gpsite)

Rewied-by: andriacap
[Refs_ticket]: #4

* feat: improve rendering front "edit" and "add"

Adding global object service to set object type and
variable "add" or "edit" button

Reviewed-by: andriacap

[Refs_ticket]: #4

* feat: improving patch method object

Adding service to share request patch,get in order to to re-use the
service in form component according to the type pass inside the
formcomponent
Adding decorator errorhandler for blueprint routes

Reviewed-by:andriacap
[Refs_ticket]: #4

* feat: create site group method with form

Route create with form component
Using location pacakage to choose between edit form or init sitegroup
(see to improve that)

Rewiewed-by: andriacap
[Refs ticket]: #4

* feat: delete site_group component

Add route back
Add site_group from front form component

Reviewed-by:andriac
[Refs_ticket]: #4

* chore(api): removed unused code

* style(config): apply formatter

* chore(front): removed unused code & console.log

* feat(front): removed display map button

As it was ugly

* refactor(front): remove Object for keys

As there is an Angular pipe to get keys and values
Also removed console.log
Removed unused code

* style(front): reformat routes

* refactor(front): add create component

To isolate functionnalities

* chore(front): remove unused services

* chore(front): removed usused code

* chore(api): remove string package

And fix if that cannot be reached

* chore(api): removed unused comment

* chore(front): removed console.log and comments

* chore(api): removed unused code and log

---------

Co-authored-by: Andria Capai <andria_capai@natural-solutions.eu>

fix: remove no existing function and component visit (#39)

Hotfix because no compilable  with no existing component
and no existing function

Reviewed-by: andriacap

Feat/dynamic form/site (#42)

* refactor: object.service with observable obj

Change the objectType string to objectType obj
in order to subscribe to multilple properties link to this object

Reviewed-by: andriacap
[Refs_ticket]: #40

* feat: adapt service to get config json

Get fieldsName and fieldsLabel for display properties
(properties component)

Add logic to setItem in LocalStorage to keepLast Value of observable on reload page

TODO:
- [ ]  see if Localstorage is really necessary with the configService used inside api-geom.service )
- [ ] adapt monitoring-form-g.component with the new service

Reviewed-by: andriacap
[Refs ticket]: #4

* feat: column datatable from config json

Add logic into sitegroups service in order to use config json to diplay
column datatable (called "display_list")

Review-by: andriac
[Refs ticket]: #4

* feat: adjust backend to load config json

Adjust backend code to use existing code in order to load config from
file json and by starting with "sites_group"

Fix Media load and upload for site_group

TODO:
- [ ] check if config should be find from file or backend
- [ ] Optimize logic backend (use generic model with class method ?)

Reviewed-by: andriacap
[Refs ticket]: #4

* feat: add button multiselect with filter on backend

filter with params backend (new route -> see if it's possible to change
that)

Add button multiselect above form type site

TODO:
- improve Input / condition of use case of btn multiselect

Reviewed-by: andriac

* feat: btn multiselect option

-Add @Input fn , placeholder, title, paramsToFilt
-Remove empty option
-prevent adding from keyboard input or not including in list
-Store config json into object

Reviewed-by: @andriac
[Refs-ticket]: #4

* refactor: change form-service and object-service

refactor form-service
add observable into object-service (WIP: futur use for refresh page ?)

Rieviewed-by: andriac

[Refs_ticket]: #40

* refactor: test refresh page and comportment obs

refresh page seems to works with localstorage of different obj in
object_service

Reviewed-by: andriac

* feat: dynamic form

- Add:
- pass config json to form.component-g.ts
- add config json to this.obj and refresh form into form.component-g.ts
- add css for form component to deal when long form selected

-fix :
- refresh page form component (this._configService.init is necessary
  ...)
- comportment different between add or edit into form component and
  form service

Reviewed-by: andriac
[Refs_ticket]: #4

* feat: dynamic form - Correction PR

Remove unused console.log
Rxjs : use concatMap to avoid subscribe inside subscribe
Apply: prettier and sort prettier for import ts file

Reviewed-by: @andriac
[Refs_PR]: #42

* feat: dynamic create site

- Add change current-object when click "Add <object>" from datatable
  component
- api-geom.service: change the way to init the api-geom
- WIP:  two subscribes in one .. (the subscription is call only once ..)
- WIP : get config json from backend

Reviewed-by: andriac

* feat: add relationship id into sendData form site

Add type_site and id_site_group to the form site

Reviewed-by: andriac
[Refs_ticket]: #5 et #6

* feat(back): add custom config when post site

Change backend files in order to choose specific config when site is
created.

Reviewed-by: andriac
[Refs_ticket]: #5 , #6

* fix: problem of type object when loading form

Add endPoint and objectType to the observable using by the formservice
in order to use _apiGeomService with good context (endPoint)

[Refs_ticket]: #5 et #6

* fix: todo comments about refactoring code

Add todo comment in order to don't forget what
is to improve inside the code

* chore(front): add comment and remove console.log

* chore(api): put back old formatting

* chore(api): remove useless comment

* refactor(api): move and rename create_update fct

* fix: put back inventor/digitiser & fix typo

* chore: remove useless files

Since columns are now loaded from json, they are not needed
anymore in separate typescript files

* chore: remove definition from sites_group.json

* fix: column problem on sites

* chore: remove useless comment

* refactor(front): remove comment and use rxjs

* chore(front): remove useless file

Since class BtnMultiSelectChipClass is not used anymore

* chore(front): remove useless comments/imports

* style(front): applied prettier

* chore(front): remove useless code

* refactor(front): regroup types into an interface

* style(front): applied prettier

* refactor(front): inherit config-json from config

---------

Co-authored-by: Andria Capai <andria_capai@natural-solutions.eu>

Feat/prepare edit site component & some visits (#43)

* refactor: object.service with observable obj

Change the objectType string to objectType obj
in order to subscribe to multilple properties link to this object

Reviewed-by: andriacap
[Refs_ticket]: #40

* feat: adapt service to get config json

Get fieldsName and fieldsLabel for display properties
(properties component)

Add logic to setItem in LocalStorage to keepLast Value of observable on reload page

TODO:
- [ ]  see if Localstorage is really necessary with the configService used inside api-geom.service )
- [ ] adapt monitoring-form-g.component with the new service

Reviewed-by: andriacap
[Refs ticket]: #4

* feat: column datatable from config json

Add logic into sitegroups service in order to use config json to diplay
column datatable (called "display_list")

Review-by: andriac
[Refs ticket]: #4

* feat: adjust backend to load config json

Adjust backend code to use existing code in order to load config from
file json and by starting with "sites_group"

Fix Media load and upload for site_group

TODO:
- [ ] check if config should be find from file or backend
- [ ] Optimize logic backend (use generic model with class method ?)

Reviewed-by: andriacap
[Refs ticket]: #4

* feat: add button multiselect with filter on backend

filter with params backend (new route -> see if it's possible to change
that)

Add button multiselect above form type site

TODO:
- improve Input / condition of use case of btn multiselect

Reviewed-by: andriac

* feat: btn multiselect option

-Add @Input fn , placeholder, title, paramsToFilt
-Remove empty option
-prevent adding from keyboard input or not including in list
-Store config json into object

Reviewed-by: @andriac
[Refs-ticket]: #4

* refactor: change form-service and object-service

refactor form-service
add observable into object-service (WIP: futur use for refresh page ?)

Rieviewed-by: andriac

[Refs_ticket]: #40

* refactor: test refresh page and comportment obs

refresh page seems to works with localstorage of different obj in
object_service

Reviewed-by: andriac

* feat: dynamic form

- Add:
- pass config json to form.component-g.ts
- add config json to this.obj and refresh form into form.component-g.ts
- add css for form component to deal when long form selected

-fix :
- refresh page form component (this._configService.init is necessary
  ...)
- comportment different between add or edit into form component and
  form service

Reviewed-by: andriac
[Refs_ticket]: #4

* feat: dynamic form - Correction PR

Remove unused console.log
Rxjs : use concatMap to avoid subscribe inside subscribe
Apply: prettier and sort prettier for import ts file

Reviewed-by: @andriac
[Refs_PR]: #42

* feat: dynamic create site

- Add change current-object when click "Add <object>" from datatable
  component
- api-geom.service: change the way to init the api-geom
- WIP:  two subscribes in one .. (the subscription is call only once ..)
- WIP : get config json from backend

Reviewed-by: andriac

* feat: add relationship id into sendData form site

Add type_site and id_site_group to the form site

Reviewed-by: andriac
[Refs_ticket]: #5 et #6

* feat(back): add custom config when post site

Change backend files in order to choose specific config when site is
created.

Reviewed-by: andriac
[Refs_ticket]: #5 , #6

* fix: problem of type object when loading form

Add endPoint and objectType to the observable using by the formservice
in order to use _apiGeomService with good context (endPoint)

[Refs_ticket]: #5 et #6

* fix: tooltip and label inside datatable-component

Add a childLabel inside interface objObs.ts
in order to use this tooltip inside datatable-component

* feat: get back work visitcomponent

get back work from feat/visit to use visitcomponent
but adapted to current branch

[Refs_ticket]: #5 , #6

* fix: forgot 3 modifications needed from feat/site

Add conftest visit
Add test_get_visits
Add get_site_by_id

* fix: passing data between components and property

- Action button "consult..." is working for group_site and site
- Action with button "cancel" , "come back history routing" send to the
  right component
- Label and tooltip are according to the parent and child object loaded
  in the corresponding component

- Action "Add site" directly from datatable-g.component (WIP: need to
  remove send to sites_group/:id/create

[Refs_ticket]: #40 , #4 , #5 and #6

* fix: error of url relative when using form

Fix problem of id_module has ["id_module"] in
create_or_update_object_api function
Fix path "sites/:id" to "site/:id"
Add urlRelative when editing component

* fix: problem route navigation

Remove unused "urlRelative" create in last commit
Fix the action "add children" in datatable to redirect to the good
component
Change the way to redirect when cancel and delete on form component
based on last url

[Refs_ticket]: #40

* refactor: object.service with observable obj

Change the objectType string to objectType obj
in order to subscribe to multilple properties link to this object

Reviewed-by: andriacap
[Refs_ticket]: #40

* feat: adapt service to get config json

Get fieldsName and fieldsLabel for display properties
(properties component)

Add logic to setItem in LocalStorage to keepLast Value of observable on reload page

TODO:
- [ ]  see if Localstorage is really necessary with the configService used inside api-geom.service )
- [ ] adapt monitoring-form-g.component with the new service

Reviewed-by: andriacap
[Refs ticket]: #4

* feat: column datatable from config json

Add logic into sitegroups service in order to use config json to diplay
column datatable (called "display_list")

Review-by: andriac
[Refs ticket]: #4

* feat: adjust backend to load config json

Adjust backend code to use existing code in order to load config from
file json and by starting with "sites_group"

Fix Media load and upload for site_group

TODO:
- [ ] check if config should be find from file or backend
- [ ] Optimize logic backend (use generic model with class method ?)

Reviewed-by: andriacap
[Refs ticket]: #4

* feat: add button multiselect with filter on backend

filter with params backend (new route -> see if it's possible to change
that)

Add button multiselect above form type site

TODO:
- improve Input / condition of use case of btn multiselect

Reviewed-by: andriac

* feat: btn multiselect option

-Add @Input fn , placeholder, title, paramsToFilt
-Remove empty option
-prevent adding from keyboard input or not including in list
-Store config json into object

Reviewed-by: @andriac
[Refs-ticket]: #4

* refactor: change form-service and object-service

refactor form-service
add observable into object-service (WIP: futur use for refresh page ?)

Rieviewed-by: andriac

[Refs_ticket]: #40

* refactor: test refresh page and comportment obs

refresh page seems to works with localstorage of different obj in
object_service

Reviewed-by: andriac

* feat: dynamic form

- Add:
- pass config json to form.component-g.ts
- add config json to this.obj and refresh form into form.component-g.ts
- add css for form component to deal when long form selected

-fix :
- refresh page form component (this._configService.init is necessary
  ...)
- comportment different between add or edit into form component and
  form service

Reviewed-by: andriac
[Refs_ticket]: #4

* feat: dynamic form - Correction PR

Remove unused console.log
Rxjs : use concatMap to avoid subscribe inside subscribe
Apply: prettier and sort prettier for import ts file

Reviewed-by: @andriac
[Refs_PR]: #42

* feat: dynamic create site

- Add change current-object when click "Add <object>" from datatable
  component
- api-geom.service: change the way to init the api-geom
- WIP:  two subscribes in one .. (the subscription is call only once ..)
- WIP : get config json from backend

Reviewed-by: andriac

* feat: add relationship id into sendData form site

Add type_site and id_site_group to the form site

Reviewed-by: andriac
[Refs_ticket]: #5 et #6

* feat(back): add custom config when post site

Change backend files in order to choose specific config when site is
created.

Reviewed-by: andriac
[Refs_ticket]: #5 , #6

* fix: tooltip and label inside datatable-component

Add a childLabel inside interface objObs.ts
in order to use this tooltip inside datatable-component

* feat: get back work visitcomponent

get back work from feat/visit to use visitcomponent
but adapted to current branch

[Refs_ticket]: #5 , #6

* fix: forgot 3 modifications needed from feat/site

Add conftest visit
Add test_get_visits
Add get_site_by_id

* fix: passing data between components and property

- Action button "consult..." is working for group_site and site
- Action with button "cancel" , "come back history routing" send to the
  right component
- Label and tooltip are according to the parent and child object loaded
  in the corresponding component

- Action "Add site" directly from datatable-g.component (WIP: need to
  remove send to sites_group/:id/create

[Refs_ticket]: #40 , #4 , #5 and #6

* fix: error of url relative when using form

Fix problem of id_module has ["id_module"] in
create_or_update_object_api function
Fix path "sites/:id" to "site/:id"
Add urlRelative when editing component

* fix: fix things broken by rebase

* chore: remove useless file

* chore(front): remove file/comment/console.log

---------

Co-authored-by: Andria Capai <andria_capai@natural-solutions.eu>

Refactor to prepare for visits (#44)

* Fix/db migrations (#31)

* feat(db): upgrade down_revision following rebase

Since rebase with develop: changed the down_revision number

* fix(db): fix bind params enabling downgrade

Beforehand the downgrade was not possible...

* refactor(db): removed cor_site_type_category

* refactor(db): changed category into type in cor

* refactor(db): create cor_type_site

* fix(db): renamed column

* refactor(api): update models to fit migrations

* fix(db):change bib_categorie_site to bib_type_site

Adding :
cor_site_module
cor_site_type
revision alembic to create function and trigger in order to add
bib_type_site but only with nomenclature 'TYPE_SITE'
upgrade and downgrade works

[Refs ticket]: #3
Reviewed-by: andriac

* fix(api): updated models from migrations

* fix(api): wip: fix admin following migrations

* fix(api): update routes and tests

To match migration changes

* feat: flask admin bib_type_site

Change bib_categories to bib_type_site into flask admin
Adding filtering in list label_fr of type_site to secure the unique
constraint

Reviewed-by: andriac
[Refs ticket]: #3

* fix(api): updated schema to match models

* fix(api): module edition

* style(api): uniformize type_site

* style(api): change relationship name for type_site

* feat(api): validator admin

* fix(api): make unique BibTypeSite in admin

* test(api): fix test when existing nomenclatures

In database

Co-authored-by: Andria Capai <andria_capai@natural-solutions.eu>

* refactor: object.service with observable obj

Change the objectType string to objectType obj
in order to subscribe to multilple properties link to this object

Reviewed-by: andriacap
[Refs_ticket]: #40

* feat: adapt service to get config json

Get fieldsName and fieldsLabel for display properties
(properties component)

Add logic to setItem in LocalStorage to keepLast Value of observable on reload page

TODO:
- [ ]  see if Localstorage is really necessary with the configService used inside api-geom.service )
- [ ] adapt monitoring-form-g.component with the new service

Reviewed-by: andriacap
[Refs ticket]: #4

* refactor(front): svc: better use of types

* feat(front): add Visits component and service

* feat(back): add get site by id route & test

* feat(api): add visits routes and schema

* fix(api): join modules to have the modulecode

For the frontend to be able to redirect to the correct route

* feat(api): add sites/id/module route

To retrieve all the modules compatibles with this site
This lead to add a relationship. Set to noload so that it is not
loaded by other not "raiseloaded" queries

* test(api): add test to test the /sites/id/module

Route.
Also changed some fixture to be able to write these tests

* fix(front): remove double def of IGeomService

* refactor(front): remove Resp interface

Since it is not usefull anymore

* fix(api): exclude sites relationship

* fix(config): change KeyValue

Since id changed

* feat(front): make datatable accepts other add btn

To be able to customize the "add object" button

* feat(front): add btn select protocole for visit

Add new component: select-btn
Add call to route to get modules from a base site id
Call the new component in the visit component
Add interfaces
Add type in config service

* feat(front): parameter for label and placeholder

For the btn component.
Style menu and form-field to make them larger

* refactor(front): api service with generic types

* fix(front): div removed following rebase

* refactor(front): add service as input for formComp

So that formComp is more type generic

* fix(config): remove "s" from sites_group

* refactor(front): put initConfig in ApiService

* fix(front): remove "s" from visit

* fix(front): put back condition on css class

To make ng-content conditionnal

* fix: following rebase

Fix imports, double declarations...

* fix(api): redirect to url

* refactor(front): rename select-btn to option-list

* fix: remove contrib

---------

Co-authored-by: Andria Capai <andria_capai@natural-solutions.eu>

feat(front): add seeObjLabel (#45)

Displayed in datatable as a link to the obj

Feat/get sites sites group models (#46)

* fix(api): remove monitoring_g_definitions

Since it prevents the module to load...

* feat(api): add join relationships

For sites and sites_groups

* fix(config): put back id_sites_group

* refactor(api): move function to prevent circular

Imports!

* fix(api): load sites groups from module_id

* chore: remove useless code

test: routes for type site and post site (#57)

* test: routes for type site and post site

Reviewed-by: andriac

* test: apply black and change query string

- Keep site beauce it's specific one cannot re use existing
- Fix mnemonique "None" with existing label_default

Reviewed-by:andriac

style(front): no data support & line return (#58)

When no data is available: show a message
When the displayed option is too long: line break

fix: make breadcrumb work from sites and modules (#61)

feat: delete site (#62)

* feat: delete site

Add code from backend to delete site (frontend is already implemented)

Reviewed-by: andriac
[Refs_ticket]: #5 , #6

* test: add test for delete item site

Reviewed-by: andriac
[Refs_ticket]: #5 , #6

Feat/edit site (#56)

* feat: edit site (init value btn-select)

- Change button select to accept incoming intial values
- Change visit component to add btn-select and form-g inside html

- WIP: update form component when initial values is up to date

Reviewed-by: andriac
[Refs_ticket] :  #5 , #6

* feat: get information when edit site

- Get all fields from specific site.json into editform
- Fix problem redirection if edit object site

- WIP : check how to update specific fields from object
- WIP : check how to manage listOption types site when reload or when
  come back into component after first init

Reviewed-by: andriac
[Refs_ticket]: #5 , #6

* fix: forgot add apiService property binding

Reviewed-by:andriac

* feat: update site with good properties

Change types_site object to array of ids
Remove extra key "dataComplement" to assign config

Reviewed-by:andriac
[Refs_ticket]: #5 , #6

* feat: prevent form appear if no type-site

- Hide form if btn-list type-site not selected
- Add custom error message mat-error if not selected (directive + custom
  message)

WIP: error message is showing up only if not selected after touched .
Maybe need to use asyncValidator ?

Reviewed-by: andriac
[Refs_tickets]: #5 , #6 , #54

* feat: change order to emit event bEdit

- Change order between change formService.changeData and bEditChange
- Preprocess for types_site seems to be useless (see todo)

Reviewed-by: andriac
[Refs_ticket]: : #5 , #6 , #54

* feat: solve request changes

- Apply prettier
- Change object key [''] by type properties
- Remove unused preprocess_data lines

[Refs_ticket] : closes #54

style: formatter json in flask admin (#63)

- Create jsonformatter inside utils.py
- Add formatter to column "config"

Reviewed-by: andriac
[Refs_ticket] : #59

feat(front): try to make breadcrumb work

In the site entry part

feat(front): make breadcrumn logic inside component

- Get all information from loading component to build breadcrumb
  information
- Fix call twice siteService (delete the one with snake_case)
- Use logic from observable and snapshot url to satisfy all case to
  access to route (by component, directly by url etc)

Reviewed-by: andriacap

feat(wip): merge chainInput and display-data-info

Need dev to the two other branches
Try to add logic into map-list-component

Check if it is the best way to manage map

Reviewed-by: andriac

feat: remove unused function

Subscription to initConfig useless

Reviewed-by: andricap

fix: put outside updateBreadCrumb in sitegp comp

Merge work from branch breadcrumb branhc and resolve problem with other
feature like problem initialization of sites groups (resolver)

Reviewed-by: andriacap

feat: remove onInit to mapListComponent

Back component as it was

Reviewed-by: andriacap

feat(wip): manage geometry type into form

Put back alert to create geometry if geometry_type precise in
config (json)

Reviewed-by: andricap

feat(wip) change way to manage map obj component

Create into formService an observable and subscribe into
mapListComponent to load and connect the form with geometry info

Reviewed-by: andriacap

fix: rename obj Form and fix pb load confi obj

- Change the name of form Object for homogeneity
- Fix problem to load config of siteService in sitesComponents

Reviewed-by: andriacap

fix: remove unused edit site component

Reviewed-by: andriacap

fix: loading config object site

Alternative to the "resolver"  in order to load config and necessary items to
display site properties and data table

Reviewed-by: andriacap

fix: existing little problem

- description when delete object
- change selectedObject on component site
- remove duplicate "bEdit"
- add "ngIf=!bEdit" on site component (to prevent display datatable on
  edition)
- fix upper case letter in variable

Reviewed-by: andriacap

fix: problem to load specific site

- change the way to load config on visit-component (=site/:id)
- fix problem on mergeMap that doesn't complete (wrong observable
  called)

Reviewed-by: andriacap

feat(wip) : manage map

- keep trying to send geometry to "objForm" object (FormGroup)

Reviewed-by: andriacap

fix: error on form with obj properties/config

Reviewed-by: andriacap

fix(css): height of form zone scrollable

fix: problem when delete site child

Fix request DELETE in backend for site and change the way to
get_sites_group_by_id by using the custom query get_or_404

Reviewed-by: andriacap

fix: problem adding site child by data-table comp

When trying to add siteGroup's site child data no pass between the form
component and the component of sites-groups .
Creation of resolver to load information of siteGroup selected in order
to updateBreadCrumb but also to specify the siteGroup Parent.

Reviewed-by: andriac

fix: problem redirection on delete site action

Create new method in form component to redirect to the good url
according the fact we delete site.

Reviewed-by: andriac

fix: untracked gitlab-ci.yml

fix: load specific properties obj

Specific properties were not loaded , add check specific schema to load
if specific properties exist

Reviewed-by: andriac

feat: page not found specific to monitoring

Add page not found in order to manage into monitoring module

Reviewed-by: andriac

feat: not found working for request status 404

Reviewed-by:andriac

fix: change format scc to css not-found comp

feat: display types_site label in table and prop

Display types_site label into data-table component and
properties-component

Reviewed-by: andriac

feat(api): return label of nomenclature type site

style(config): types site attribut label

feat(wip): display specific properties

- change setControl to setValue
- add html inside site.json (local)
- (wip) addSpecific config to second tab for properties component

feat: ignore html field when submit form

- destructuration object to ignore html to submit form
- ignore html field to specific config in order to match with submit
  form

Reviewed-by: andricap

feat(wip): display specific properties

Display only field not "undefined" to get properties component readable

feat: display specific properties

Display all value from specific config even if it's null

Reviewed-by: andriacap

fix: remove call api for types_site

Useless call api in visit-component (already get by another request)
Remove '/' from start of request to avoid double '//'

Reviewed-by: andriacap

feat(back): json formatter on edit column

Add class JSON to format json in edit column

[Refs_ticket]: Closes #75
Reviewed-by: andriacap

feat(back): edition site work for module enter

Change the "types_site" properties by id_nomenclature (before label_fr)
just before post/patch data in "preprocess_data"

WIP: see if it's possible to add different "types_site" ?
Currently the way is to change type_site only when you enter by site

Reviewed-by: andriacap

refact: remove useless call service in btn-select

the service to add Extra formController to formGroup was call too many
time for nothing.

Reviewed-by: andriacap

fix: error on tab spec properties

When "selectedObj.data" is empty we do not display tab and table (adding
this part of code to remove the error)

Reviewed-by: andriacap

feat(front): architecture form with dynamic field

Change the way to place the component "btn-select" into the
form-component-g.
Also add another dynamic form generator in order to update separetely
all specific fields and static fields

Reviewed-by: andriacap

feat: update form from btn-select

Change the way to update the form , only dynamic fields are updated
ExhaustMap is used in order to wait complete config subscribe then
launch other subscribe

Reviewed-by: andriacap

feat: create form according to btn-select comp

Change the way to update form with btn-select component when we want to
create a site

Reviewed-by: andriacap

fix: remove unused property binding FormGroup

The new way to build form doesn't need anymor propertybinding FormGroup

Reviewed-by: andriacap

feat: redirection on delete prevent to reload obj

Before even the delete action reload the entire object whereas now we
just want to redirect to parent page in case of deleted object.

Reviewed-by: andriacap

feat: using service to update and create dyn form

Use observable and service in order to update and create specific fiedls
(dynamic Form)

Reviewed-by: andriacap

feat(front): displaying dynamic and static form

Separate static field and dynamic fieds (specific to type site)
in order to manage easily fields and controls.

Reviewed-by: andriacap

fix: check obj initialized for FormGroup

Add more check before initialize form component

Reviewed-by: andriacap

fix: error on build

Fix errors about html, library , and argument in service cause of : new
angular version and rebased branch

Reviewed-by: andriacap

fix: change down revision and error id_nomenclatur

Because of rebase needed to change down revision of
"declare_available_permission"

Fix problem id_nomenclature to id_nomenclature_type_site

Reviewed-by: andriacap

fix: icon edition geometry problem

Change html ObjForm in monitoring-map-list.ts component

Reviewed-by: andriacap

test: move conftest.py to root project

Need to move this file because crashing the pytest collect

fix: error constructor failed for this service

Missing argument in constructor

Reviewed-by: andriacap

feat(db): alembic revision (ATTENTION)

Add CRUVED into monitoring admin module
TODO: to see when we will talk about permission

Reviewed-by: andriacap

fix: error default argument in route

Before using GN 2.13.0b , it worked , now I need to remove default
argument in blueprint route : site_groups/config and site/config

Reviewed-by: andriacap

fix(front): angular-material matchiplist

**Themes**: angular-material

Adapt btn-select component in order to make it again working .
MatChipList and MatChip  change to MatChipGrid and MatChipRow

Reviewed-by: andricap

fix: material angulr tab (group site and site)

Refactoring du code pour pouvoir :
- Afficher les groupes de site ET les sites
- Adapter les tabs au style de la librairie Material-Angular

Modifications des composants impactés : resolver , data-table(service et
composant) , geom(interface), objObs(interface), breadcrumb (statique
pour le moment)

WIP/TODO:
- Re adapter les composants visit et site pour qu'ils soient compatibles
  avcec la nouvelle structure de data-table-g
- Composant "properties" à changer pour avoir le style "mterial-angular"

FIX:
- Pouvoir voir un site directement depuis la visualistion du premier
  tableau de sites (PB à résoudre avant : voir comment faire pour
voir un site orphelin = sans groupe de site --> nouvelle route à créer )
- Voir les objets : rowStatus et objectStatus du composant data-table

Reviewed-by: andriacap

fix: angular material adapt for properties comp

Changement des "tabs" et du bouton "Editer pour les adapter à la
librairie angular-material utilisé dans GN

Reviewed-by: andriacap

fix: problem action button to add obj

Après avoir adapté le style angular material et la possiblité d'avoir
l'entrée par soit Site ou Groupe de site , l'ajout de l'objet du Tab
Actif a été impacté .
Pb résolu pour les groupes de site mais l'ajout d'un site depuis la page
"acceuil" des liste de site pose un problème de fond (à voir/ discuter)

Reviewed-by: andriacap

fix: adapt visit, site component to datatable

Changement des composants "monitoring-sites" et "monitoring-visits"
pour les adapter à la nouvelle manière de gérer les données dans le
composant "data-table" (dû au changements avec material-angular et
la double entrée site/groupe de site)

Correction de quelques bugs (exemple si un site n'a aucune visite, ça
renvoyait une erreur)

On ignore le "html" dans l'affichage des propriétés spécifiques

Reviewed-by: andriacap

fix: correction display btn to add protocol

Correction au niveau de l'insertion du composant "bouton" pour l'ajout
de visite qui nécessite la demande d'un protocole:
- Adaptation à material-angular
- Changement pour l'affichage conditionnel de ce bouton

Correction de l'UX (style des mat-chip-row , pour la sélection des types
de sites)

Reviewed-by: andriacap

fix: error when loading page with specific field

Ajout d'un check de condition pour executer l'initilisation des
propriétés spécifiques (type de site) liées aux sites

Reviewed-by: andriacap

fix: error localstorage cyclic object

L'utilisation du localstorage pour le moment n'est pas utilisable
(probleme d'objet cyclique JSON.stringify)

Reviewed-by: andriacap

Feat/show map according to tab (#79)

* feat: conditional display site or sitegroup

Ajout d'un Event Binding pour pouvoir charger les bonnes géométries en
fonction du "tab" actif
Soit pour afficher toutes les géométries de groupes de site , ou
afficher toutes les géomtries de site

Reviewed-by: andriacap

* fix: error sho details site from map

Changement de la variable baseUrl pour obtenir la bonne route pour
visualiser le site sélectionné sur la carte

Reviewed-by: andriacap

lint(back): apply black

Reviewed-by: andriacap

lint(front): apply prettier

Reviewed-by: andriacap

feat: prevent user to delete site and gp site (#81)

Prevent user to delete site and gp site when enter through protocol

Reviewed-by: andriacap

Feat/enter tab site features (#80)

* feat: enter through site site_gp

-  Ajout des routes si on entre par site (tab)
-  Adaptation du breadcrumb si on entre par tab : site
-  Ajout de champ de formulaire 'id_site_group' pour pouvoir associer un
   site à un groupe de site
- Correction des redirections des boutons associé au tab "site" (edition
  , ajout)

Reviewed-by: andriacap

* feat: types site (entrance by protocol)

- Création de site à patir de l'entrée par protocole avec champ
  dynamique
- Création de route pour avoir uniquement les types de site associé au
  protocole sélectionné

- TODO : A l'édition d'un site (entrée par protocole) pouvoir charger
  les champs spécifiques lié à ce site

Reviewed-by: andriacap

* feat(WIP): edit site (entrance protocol)

Reviewed-by: andriacap

* fix: route according to tab selected

Quand on entre par site , la route lié aux sites ou groupes de site sur
la map ne s'actualisait pas .

Reviewed-by: andriacap

* fix: multiple reload observable subscription

Ajout d'un "subject" pour "unsubscribe" les observables du formulaire
(entrée par site)

Reviewed-by: andriacap

* feat: edit with pre load properties and dyn form

Ajout de dev pour finaliser la possibilité de charger les data
complement liés aux types de site (et donc à des fichiers de configs
présent sur la table bib_types_site )

Reviewed-by: andriacap

* fix: filter on colum "Type(s) de site"

Reviewed-by: andriacap

* style: apply black

Reviewed-by: andriacap

* fix: error on empty tab groupe site

Problème lorsqu'un des deux tabs était vide , alors le composant tableau
ne se mettait pas à jour par rapport au tab sélectionné .

Reviewed-by: andriacap

* fix: link to edit and create object from table

Reviewed-by: andriacap

* feat: prevent delete sitegp and site from protocol

On empeche la suppression de site de groupe et de site via l'entrée par
protocole

Reviewed-by: andriacap

* fix: do not load typessite by siteid if edit

Modification de la condition du chargement des types de site en fonction
de l'édition ou la création de site dans le composant form

Reviewed-by: andriacap

* fix: allow add site group if exist in config

Laisser la possibilité d'ajouter des groupes de site si dans l'arbre de
config du module (site_group est configuré)

Reviewed-by: andriacap

* feat: add visit from table

Possibilité d'ajouter une visite depuis le composant data-table-g
Passage d'évenement du composant option-btn-list aux composant
'grand-parent'
Affichage conditionnel au click du bouton "+' dans le composant
data-table

Reviewed-by: andriacap

* feat(front): add variable RouteBase to object

Entrée par site:
Ajout d'une variable 'RouteBse' pour que ce soit plus verbeux pour la
redirection des routes en fonction du nombre de tab sur la page
(Résoud la problématique d'une stratégie de non "reloading" au
changement de route pour ne pas avoir à tout recharger lorsqu'on change
de tabs sites_group/site )

Reviewed-by: andriacap

feat: edit and create geom

- Suppression des layers dans les ngOndestroy des composants
- json.loads des geometry pour avoir l'objet geometry prêt pour les map et
les parentFormControl du composant map
- Ajout d'une layer de site pour le composant "visit" (layer du site
  parent aux visites)
- Chane strategie d'écoute du formService FormMap

Reviewed-by: andriacap

fix: error displaying types site

Error when editing the second time a site (fields types site were not
displayed)

Reviewed-by: andriacap

style : improve ux/ui for form component

Amélioration et uniformisation de l'ux entre les composant formulaires
(entrée par site et par protocoles)

Ajout d'une alerte en cas de suppression d'un type de site sur les
champs saisies

Ajout des titres à chaque page pour l'édition , la création ou le détail
d'un site / groupe de site

Reviewed-by: andriacap

feat: observers displaying and editing form

Observers is now editable in form with the component pnx-observers

Observers is displayed as "nom_complet" in components "properties" and
"data-table"

Review-by: andriacap

Feat/edit delete through table (#86)

* feat(wip): edit obj from data-table

Allo edition directly from data-table component
(entrance by site)

Delete from data table (wip)

Reviewed-by: andriacap

* feat(wip): delete site groups from table

Use eventemitter and subscription (see if it could be better)

Reviewed-by: andriacap

* feat: delete object from table comp

- Delete site groupe and site from table (reload route params in order
  to reload resolver)

Reviewed-by: andriacap

Feat/filter columns relationship (#87)

* feat(wip) : filter on relationship

Filter and sort on "observers" by "nom_complet" --> OK
Filter on "last_visit" --> WIP

Reviewed-by: andriacap

* feat: sort and filter on id_inventor and date

Filter on data table component (enter through site) need to manage
relationship column.

Change DateTime to Char and filter on "nom_complet" for observers

Reviewed-by: andriacap

style: apply black and prettier

Reviewed-by: andriacap

feat: use code list observers for observers site (#88)

Using config gn_config and add CODE_OBSERVERS_LIST to monitoring config
to get list of observers (enter through site)

Reviewed-by: andriacap

style(front): apply prettier

Feat/conditional edit and delete entrance protocol (#89)

* feat: conditional delete site

- Delete icon is not showing if visit > 0

Reviewed-by: andriacap

* feat: edit table object (from protocol)

Edit icon in data-table component.
Allow user to directly edit from a datatable component

Reviewed-by: andriacap

* feat: delete visit from protocol and site

Change relationship for module on t_visit_complements model (fix error dependency rules blank)
Change visit-component in order to allow delete when enter through site
Add hide-spinner class to improve UX for delete modal (enter through
site)

Reviewed-by: andriacap

fix: specific form and properties types site (#90)

IMPORTANT : need dev from GeoNature (see demo test VM)

Fix problem loading specific config (types site) entrance through
protocol

Fix problem loading specific fields in creation form site

Reviewed-by: andriacap

feat: add variable config in json (#91)

Rendre la possibilité d'extraire les variables de configs depuis le
front et de les remplacer par les valeurs de la config.

FIX: bug de redirection à la création d'un site à partir de l'onglet
"sites"

Reviewed-by: andriacap

feat: optional observers_txt field (#92)

Add multiselect to false for field observers in site.json (only one
id_inventor in DB)

Add conditional `required` and `hidden` to `observers` field for
`visit.json`

Reviewed-by: andriacap

Feat/observers txt last (#93)

* feat: add observers_txt to visit.json

Add field observers_txt to visit in order to allow config in submodule

Reviewed-by: andriacap

* style : lint json

Feat/permission (#94)

* feat: permission guard and on route back

- Creation d'un Guard pour empêcher l'accès aux routes
-Création d'un service Permission pour permettre d'obtenir les
permissions liés aux objets (GNM_SITES etc) du module Monitorings et
ainsi "bloquer" l'action sur les composants
- Ajout des "check_cruved_scope" coté backend pour empêcher l'éxécution
  d'action CRUD directement depuis les routes API

WIP: continuer à implémenter coté frontend l'affichage conditionnel en
fonction des permissions de l'utilisateurs (affichage ou non des tabs
sites, groupes de site, grisage et désactivation des icones liées aux
actions CRUD, désactivation conditionnelle des boutons liés aux actions
CRUD

Reviewed-by: andriacap

* feat: add ux (permission) icon and button

- UX permission to not display sites or sites_groups if not allowed
- UX permission to disable button/icon and add tooltip to warn the user
  that he doesn't get rights to do the action

WIP: add UX to button delete in Form component

Reviewed-by: andriacap

* feat: add scope_filter to monitorings obj permiss

Set true in revision alembic to allow admin to choose 'mon organisme' ,
'mes données'

Reviewed-by: andriacap

* feat: add variable config in json

Rendre la possibilité d'extraire les variables de configs depuis le
front et de les remplacer par les valeurs de la config.

FIX: bug de redirection à la création d'un site à partir de l'onglet
"sites"

Reviewed-by: andriacap

* feat: permission with paginate

Create paginate_scope in order to send object with permission for each
object

Create function model and function query to filter on object and check
scope (based on TDataset model)

Integration of permission in data-table

Reviewed-by: andriacap

* feat: add filter readable query to geom site

Add filter_by_readable for site geom

Reviewed-by: andriacap

* feat(back): add object_code to BibTypeSites

Specify object_code to BibTypeSite in order to make work permission on
this object

Reviewed-by: andriacap

* feat(back): permission on different object

Add permission for:

- GET sites_group geom
- GET sites_group
- GET submodules list when we want to create visit through site entrance

Create PermissonModel to use function created in GN Core

Create function with parameter list object, module_code(opt), object_code
(opt) in order to return CRUVED for each object of list object (need to
test to see if works with any object : Modules --> ok, sites,
sites_group, visits,observations to check

Reviewed-by: andriacap

* feat: change the way to get cruved_object

fix problem from frontend to GET cruved_object with object of boolean
(no more object of integer)

Reviewed-by: andriacap

* feat: add permission logic (entrance site)

WIP : try to make working VisitQuery readable for organism

Reviewed-by: andriacap

* feat: query visit filtering scope

Fix problem function filter_by_scope by using Models

Reviewed-by: andriacap

* style(backend): apply black

Reviewed-by: andriacap

* feat(back): add observation query and fix

Fix: has/any on filter_by_scope function

Add: observation query and id_digitiser to model

Reviewed-by: andriacap

* feat(back): R,U,D for specific object scope

Prevent user to R,U,D for specific object according to his scope

Reviewed-by: andriacap

* fix: error on route

default id not needed

Reviewed-by: andriacap

* feat: permission entrance through protocol

Front
- Remove unused 'userCruved' (front)
- Set permission for object and child with 'cruved' object get from
  backend (disable btn and icon everywhere cruved is checked)

Back:
- add boolean cruved object for each objectType inside serializer
- add ObservtionQuery to model TMOnitoringOBservation and hybrid_property and has_instance_permission method
- FIX:
   * name "visite" to "visit"
   * change get_id by get_id_name for GenericModel
   * problem inside get_object_with_permission_boolean

WIP:
- Entrance protocol :
  * filter_by_readable "GET" on list object
  * Prevent access to edit page
- Entrance site:
  * UX according to permission on button "Supprimer" into Form Component

Reviewed-by: andriacap

* feat: filter on only readable object

Entrance through protocol : filter_by_scope (Readable object)

Reviewed-by: andriacap

* feat: prevent user to edit object if not allowed

Add boolean canUpdate in form component in case object is readable but
not editable and user change param edit=true in ulr directly

Reviewed-by: andriacap

* fix: add module_code in get_readable_list_object

Reviewed-by: andriacap

* feat: add check permission to route (entrance site)

BACK:
- Add to all route  decorator permission and check
  has_intance_permission (entrance site)
- Add 'cruved' to all object return for get_by_id (site and sites_group)
FIX (BACK):
- error when no child (check len childs_model)
- method get_object_with_permission_boolean condition for module need to
  change the call method

FRONT:
- change canUpdate, canDelete for form and property component in order
  to check if specific object has permission
FIX:
- initForm need to wait for 'config' loaded for this.obj
- same thing for form.service

Reviewed-by: andriacap

* feat: add guard for other frontend route

Add guard for specific route
Check canRead with canCreate

Reviewed-by: andriacap

fix: redirection , permission form, reloading (#95)

- Fix reloading component on delete from databa-table
- Fix set cruved condition (not module_code 'generic')
- Add condition read object above create for canActivate Guard
- Remove some TODO notes

Reviewed-by: andriacap

Feat/change model migration (#96)

* feat: change db structure

Add id_digitiser for t_sites_groups

Drop constraint NOT NULL on t_observations.cd_nom (check if keep or not)

Reviewed-by: andriacap

* feat(back): add revision to add observer_txt

Add observers_txt in database via alembic revision.

Use alembic function to aler column

Reviewed-by: andriacap

* feat: add id_digitiser to t_observations

Create alembic revision and add on model

Reviewed-by: andriacap

Reorder migration and add data migration

fix: redirection and permission grp_site

Precise object_code for paginate_scope with grp_site
Change route redirection when create object
Delete get item with marshmallow in delete request

Reviewed-by: andriacap

fix: paginate not found

Need to rename key object send by setPage and onSortEvent

Reviewed-by: andriacap

style: apply lint front and back

Reviewed-by: andriacap

fix: change id on delete route

Problem with id_g --> change to specific id for site and site_group

Reviewed-by: andriacap

hotfix: problem refreshing page with guard

Remove guard and canActivate on route (entrance through site)

In addtition of problem of refreshing route with canActivate parmas
render blank page , this guard is not necessary because of other warning
and security on all action (CRUD)

Reviewed-by: andriacap
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants