Skip to content

Commit

Permalink
feat: use code list observers for observers site (#88)
Browse files Browse the repository at this point in the history
Using config gn_config and add CODE_OBSERVERS_LIST to monitoring config
to get list of observers (enter through site)

Reviewed-by: andriacap
  • Loading branch information
andriacap committed Aug 23, 2023
1 parent 6ce5bc7 commit 672d184
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
5 changes: 3 additions & 2 deletions backend/gn_module_monitoring/conf_schema_toml.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@


class GnModuleSchemaConf(Schema):
DESCRIPTION_MODULE = fields.String(missing="Vous trouverez ici la liste des modules")
TITLE_MODULE = fields.String(missing="Module de suivi")
DESCRIPTION_MODULE = fields.String(default="Vous trouverez ici la liste des modules")
TITLE_MODULE = fields.String(default="Module de suivi")
CODE_OBSERVERS_LIST = fields.String(default="obsocctax")


# AREA_TYPE = fields.List(fields.String(), missing=["COM", "M1", "M5", "M10"])
Expand Down
9 changes: 6 additions & 3 deletions frontend/app/services/config.service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { ModuleService } from '@geonature/services/module.service';
import { ModuleConfig } from '../module.config';
import { of } from 'rxjs';
import { mergeMap } from 'rxjs/operators';
import { ConfigService as GnConfigService } from '@geonature/services/config.service';
Expand Down Expand Up @@ -67,10 +66,14 @@ export class ConfigService {
}

descriptionModule() {
return ModuleConfig.DESCRIPTION_MODULE;
return this.appConfig.MONITORINGS.DESCRIPTION_MODULE;
}
titleModule() {
return ModuleConfig.TITLE_MODULE;
return this.appConfig.MONITORINGS.TITLE_MODULE;
}

codeListObservers() {
return this.appConfig.MONITORINGS.CODE_OBSERVERS_LIST;
}
/** Frontend Module Monitoring Url */
frontendModuleMonitoringUrl() {
Expand Down
3 changes: 2 additions & 1 deletion frontend/app/services/monitoring-object.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,10 @@ export class MonitoringObjectService {
break;
}
case 'observers': {
const codeListObservers = this._configService.codeListObservers();
x == null
? (x = [])
: (x = this._dataUtilsService.getUsersByCodeList(elem.code_list).pipe(
: (x = this._dataUtilsService.getUsersByCodeList(codeListObservers).pipe(
mergeMap((users) => {
let currentUser;
if (Array.isArray(users)) {
Expand Down
5 changes: 4 additions & 1 deletion monitorings_config.toml.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@

#Possibilité de rajouter une description au module de suivi
#DESCRIPTION_MODULE = "ceci est une description"
#TITLE_MODULE = "Module de suivi"
#TITLE_MODULE = "Module de suivi"

# code of the observator list -- utilisateurs.t_listes
#CODE_OBSERVERS_LIST = "obsocctax"

0 comments on commit 672d184

Please sign in to comment.