From 86694d4509d1cb0c31a399ea76c60d3df88e8346 Mon Sep 17 00:00:00 2001 From: andriacap <111564663+andriacap@users.noreply.github.com> Date: Mon, 12 Dec 2022 11:25:24 +0100 Subject: [PATCH] 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 --- .../gn_module_monitoring/conf_schema_toml.py | 7 +- config/conf_gn_module.toml.example | 4 + .../components/modules/modules.component.css | 28 +++---- .../components/modules/modules.component.html | 81 ++++++++++++------- .../components/modules/modules.component.ts | 23 +++++- frontend/app/services/config.service.ts | 6 ++ 6 files changed, 104 insertions(+), 45 deletions(-) diff --git a/backend/gn_module_monitoring/conf_schema_toml.py b/backend/gn_module_monitoring/conf_schema_toml.py index e89328a69..0d9b3039a 100644 --- a/backend/gn_module_monitoring/conf_schema_toml.py +++ b/backend/gn_module_monitoring/conf_schema_toml.py @@ -4,11 +4,14 @@ Fichier à ne pas modifier. Paramètres surcouchables dans config/config_gn_module.tml """ -from marshmallow import Schema, fields, validates_schema, ValidationError +from marshmallow import Schema, fields class GnModuleSchemaConf(Schema): - pass + DESCRIPTION_MODULE = fields.String(missing="Vous trouverez ici la liste des modules") + TITLE_MODULE = fields.String(missing="Module de suivi") + + # AREA_TYPE = fields.List(fields.String(), missing=["COM", "M1", "M5", "M10"]) # BORNE_OBS = fields.List(fields.Integer(), missing=[1, 20, 40, 60, 80, 100, 120]) # BORNE_TAXON = fields.List(fields.Integer(), missing=[1, 5, 10, 15]) diff --git a/config/conf_gn_module.toml.example b/config/conf_gn_module.toml.example index f04d33639..e77362652 100644 --- a/config/conf_gn_module.toml.example +++ b/config/conf_gn_module.toml.example @@ -1 +1,5 @@ # Fichier listant les paramètres du module et leurs valeurs par défaut + +#Possibilité de rajouter une description au module de suivi +#DESCRIPTION_MODULE = "ceci est une description" +#TITLE_MODULE = "Module de suivi" \ No newline at end of file diff --git a/frontend/app/components/modules/modules.component.css b/frontend/app/components/modules/modules.component.css index 658574e78..19ee16247 100644 --- a/frontend/app/components/modules/modules.component.css +++ b/frontend/app/components/modules/modules.component.css @@ -38,14 +38,14 @@ h2 { } a { - text-decoration:none; - color:initial; + text-decoration: none; + color: initial; } .flex-item:hover { - opacity: 1; - box-shadow: 0px 0px 10px black; - transition: opacity 0.2s, box-shadow 0.2s; + opacity: 1; + box-shadow: 0px 0px 10px black; + transition: opacity 0.2s, box-shadow 0.2s; } .module h2 { @@ -53,16 +53,14 @@ a { } -.module-card:hover -{ - border: 1px solid #303030; - padding: 5px; - color:gray; - transition: 1s ease; +.module-card:hover { + border: 1px solid #303030; + padding: 5px; + color: gray; + transition: 1s ease; } -.module-card -{ - background-color:#71717129; +.module-card { + background-color: #71717129; transition: 1s ease; -} +} \ No newline at end of file diff --git a/frontend/app/components/modules/modules.component.html b/frontend/app/components/modules/modules.component.html index 821736b9c..611c18166 100644 --- a/frontend/app/components/modules/modules.component.html +++ b/frontend/app/components/modules/modules.component.html @@ -1,38 +1,65 @@ -
- -

Chargement en cours

-
- -
-
- -

Modules de suivi

+ +

Chargement en cours

+
+ +
+
-
-
- \ No newline at end of file diff --git a/frontend/app/components/modules/modules.component.ts b/frontend/app/components/modules/modules.component.ts index 979d2402c..9a45f8f00 100644 --- a/frontend/app/components/modules/modules.component.ts +++ b/frontend/app/components/modules/modules.component.ts @@ -6,6 +6,7 @@ import { mergeMap } from "rxjs/operators"; import { DataMonitoringObjectService } from "../../services/data-monitoring-object.service"; import { ConfigService } from "../../services/config.service"; import { get } from "https"; +import { AuthService, User } from "@geonature/components/auth/auth.service"; @Component({ selector: "pnx-monitoring-modules", @@ -13,6 +14,12 @@ import { get } from "https"; styleUrls: ["./modules.component.css"], }) export class ModulesComponent implements OnInit { + + + currentUser: User; + + description: string; + titleModule: string; modules: Array = []; backendUrl: string; @@ -24,9 +31,10 @@ export class ModulesComponent implements OnInit { bLoading = false; constructor( + private _auth: AuthService, private _dataMonitoringObjectService: DataMonitoringObjectService, private _configService: ConfigService - ) {} + ) { } ngOnInit() { this.bLoading = true; @@ -50,6 +58,19 @@ export class ModulesComponent implements OnInit { this._configService.backendUrl() + "/static/external_assets/monitorings/"; this.bLoading = false; + this.description = this._configService.descriptionModule(); + this.titleModule = this._configService.titleModule(); }); + + this.currentUser = this._auth.getCurrentUser(); + + this.currentUser["cruved"] = {}; + this.currentUser["cruved_objects"] = {}; + } + + onAccessSitesClick(modules) { + console.log("accès aux sites avec droits ") + console.log(modules) } + } diff --git a/frontend/app/services/config.service.ts b/frontend/app/services/config.service.ts index cb163ad8c..d37243b66 100644 --- a/frontend/app/services/config.service.ts +++ b/frontend/app/services/config.service.ts @@ -66,6 +66,12 @@ export class ConfigService { return `${api_url}${this._moduleService.currentModule.module_path}`; } + descriptionModule() { + return ModuleConfig.DESCRIPTION_MODULE; + } + titleModule() { + return ModuleConfig.TITLE_MODULE; + } /** Frontend Module Monitoring Url */ frontendModuleMonitoringUrl() { return this._moduleService.currentModule.module_path;