From 950940dacb54eef76b8855b56b447e535fd9ae4d Mon Sep 17 00:00:00 2001 From: Camille Monchicourt Date: Fri, 23 Jul 2021 10:12:13 +0200 Subject: [PATCH 1/3] Changelog 2.7.4 --- docs/CHANGELOG.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/CHANGELOG.rst b/docs/CHANGELOG.rst index 89b6a5c0c5..0773c7bd13 100644 --- a/docs/CHANGELOG.rst +++ b/docs/CHANGELOG.rst @@ -7,7 +7,7 @@ CHANGELOG **🐛 Corrections** -* Correction d'un import manquant entrainant un problème de compilation du frontend. +* Correction d'un import manquant entrainant un problème de compilation du frontend (#1424) **⚠️ Notes de version** From d049db870f09ce8c2e6ce3e41801cf255646e33e Mon Sep 17 00:00:00 2001 From: TheoLechemia Date: Tue, 27 Jul 2021 15:47:35 +0200 Subject: [PATCH 2/3] add field parameters on /datasets --- backend/geonature/core/gn_meta/repositories.py | 4 ++-- backend/geonature/core/gn_meta/routes.py | 7 ++++--- .../src/app/GN2CommonModule/form/data-form.service.ts | 6 ++++-- .../GN2CommonModule/form/datasets/datasets.component.ts | 9 ++++----- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/backend/geonature/core/gn_meta/repositories.py b/backend/geonature/core/gn_meta/repositories.py index cd6bb1dd68..635998ff2e 100644 --- a/backend/geonature/core/gn_meta/repositories.py +++ b/backend/geonature/core/gn_meta/repositories.py @@ -180,7 +180,7 @@ def get_metadata_list(info_role, args, exclude_cols): return query -def get_datasets_cruved(info_role, params=dict(), as_model=False, depth=0, lazyloaded=[]): +def get_datasets_cruved(info_role, params=dict(), as_model=False, fields=[], lazyloaded=[]): """ Return the datasets filtered with cruved @@ -238,7 +238,7 @@ def get_datasets_cruved(info_role, params=dict(), as_model=False, depth=0, lazyl data = q.all() if as_model: return data - return [d.as_dict(depth=depth) for d in data] + return [d.as_dict(fields=fields) for d in data] def filtered_ds_query(info_role, args): diff --git a/backend/geonature/core/gn_meta/routes.py b/backend/geonature/core/gn_meta/routes.py index 2a89b30e0f..96434ff372 100644 --- a/backend/geonature/core/gn_meta/routes.py +++ b/backend/geonature/core/gn_meta/routes.py @@ -118,12 +118,13 @@ def get_datasets(info_role): id_user=info_role.id_role, id_organism=info_role.id_organisme ) except Exception as e: - log.error(e) with_mtd_error = True params = request.args.to_dict() - depth = params.get("depth", 0) - datasets = get_datasets_cruved(info_role, params, depth=int(depth)) + fields = params.get("fields", None) + if fields: + fields = fields.split(',') + datasets = get_datasets_cruved(info_role, params, fields=fields) datasets_resp = {"data": datasets} if with_mtd_error: datasets_resp["with_mtd_errors"] = True diff --git a/frontend/src/app/GN2CommonModule/form/data-form.service.ts b/frontend/src/app/GN2CommonModule/form/data-form.service.ts index 66b91c23e8..016586e222 100644 --- a/frontend/src/app/GN2CommonModule/form/data-form.service.ts +++ b/frontend/src/app/GN2CommonModule/form/data-form.service.ts @@ -75,10 +75,12 @@ export class DataFormService { }); } - getDatasets(params?: ParamsDict, orderByName = true, depth = 0) { + getDatasets(params?: ParamsDict, orderByName = true, fields = []) { let queryString: HttpParams = new HttpParams(); queryString = this.addOrderBy(queryString, 'dataset_name'); - queryString = queryString.set('depth', depth.toString()) + fields.forEach(f => { + queryString = queryString.append('fields', f) + }) if (params) { for (const key in params) { diff --git a/frontend/src/app/GN2CommonModule/form/datasets/datasets.component.ts b/frontend/src/app/GN2CommonModule/form/datasets/datasets.component.ts index fabc8d1352..ba339a34e4 100644 --- a/frontend/src/app/GN2CommonModule/form/datasets/datasets.component.ts +++ b/frontend/src/app/GN2CommonModule/form/datasets/datasets.component.ts @@ -70,15 +70,14 @@ export class DatasetsComponent extends GenericFormComponent implements OnInit, O } getDatasets(params?) { - params = {}; - + const filter_param = {}; if (this.displayOnlyActive) { - params['active'] = true; + filter_param['active'] = true; } if (this.moduleCode) { - params['module_code'] = this.moduleCode; + filter_param['module_code'] = this.moduleCode; } - this._dfs.getDatasets((params = params)).subscribe( + this._dfs.getDatasets((params = filter_param)).subscribe( res => { this.datasetStore.filteredDataSets = res.data; this.datasetStore.datasets = res.data; From 24f892509d73fb4f96819919e630cfe745073a5c Mon Sep 17 00:00:00 2001 From: TheoLechemia Date: Wed, 28 Jul 2021 09:51:16 +0200 Subject: [PATCH 3/3] prepa release --- VERSION | 2 +- docs/CHANGELOG.rst | 13 +++++++++++++ install/install_all/install_all.ini | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index a4dd9dba4f..a603bb50a2 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.7.4 +2.7.5 diff --git a/docs/CHANGELOG.rst b/docs/CHANGELOG.rst index 0773c7bd13..8519bdcff8 100644 --- a/docs/CHANGELOG.rst +++ b/docs/CHANGELOG.rst @@ -2,6 +2,19 @@ CHANGELOG ========= +2.7.5 (2021-07-28) +------------------ + +**🐛 Corrections** + +* Compatibilité avec Occtax-mobile. Possibilité d'ajouter la query string "fields" sur la route `meta/datasets` pour contrôler les champs renvoyés par l'API + +**⚠️ Notes de version** + +Si vous mettez à jour GeoNature : + +* Vous pouvez passer directement à cette version mais en suivant les notes des versions intermédiaires + 2.7.4 (2021-07-23) ------------------ diff --git a/install/install_all/install_all.ini b/install/install_all/install_all.ini index 63479018c3..ea181f1551 100644 --- a/install/install_all/install_all.ini +++ b/install/install_all/install_all.ini @@ -28,7 +28,7 @@ usershub_release=2.1.3 ### CONFIGURATION GEONATURE ### # Version de GeoNature -geonature_release=2.7.4 +geonature_release=2.7.5 # Effacer la base de données GeoNature existante lors de la réinstallation drop_geonaturedb=false # Nom de la base de données GeoNature