From 817e44253fe7fa207d7d67a2fb3d36db6935b6dc 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 | 9 ++- .../components/modules/modules.component.css | 26 ++++---- .../components/modules/modules.component.html | 59 ++++++++++++++----- .../components/modules/modules.component.ts | 29 +++++++-- frontend/app/services/config.service.ts | 6 ++ monitorings_config.toml.example | 4 ++ 6 files changed, 98 insertions(+), 35 deletions(-) diff --git a/backend/gn_module_monitoring/conf_schema_toml.py b/backend/gn_module_monitoring/conf_schema_toml.py index 3c27b1173..68963a0f8 100644 --- a/backend/gn_module_monitoring/conf_schema_toml.py +++ b/backend/gn_module_monitoring/conf_schema_toml.py @@ -4,7 +4,7 @@ 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 # Permissions associés à chaque objet monitoring @@ -22,7 +22,14 @@ class GnModuleSchemaConf(Schema): PERMISSION_LEVEL = fields.Dict( keys=fields.Str(), values=fields.Str(), load_default=PERMISSION_LEVEL_DEFAULT ) + DESCRIPTION_MODULE = fields.String(missing="Vous trouverez ici la liste des modules") + TITLE_MODULE = fields.String(missing="Module de suivi") + PERMISSION_LEVEL = fields.Dict( + keys=fields.Str(), values=fields.Str(), load_default=PERMISSION_LEVEL_DEFAULT + ) + 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]) diff --git a/frontend/app/components/modules/modules.component.css b/frontend/app/components/modules/modules.component.css index 5ce13655f..5036d2eb9 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,17 +53,15 @@ 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; } diff --git a/frontend/app/components/modules/modules.component.html b/frontend/app/components/modules/modules.component.html index 207e94f5e..3519e09b6 100644 --- a/frontend/app/components/modules/modules.component.html +++ b/frontend/app/components/modules/modules.component.html @@ -1,18 +1,27 @@ -
- -

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 f75d28bb6..a0d411dbe 100644 --- a/frontend/app/components/modules/modules.component.ts +++ b/frontend/app/components/modules/modules.component.ts @@ -3,9 +3,10 @@ import { Component, OnInit } from '@angular/core'; import { mergeMap } from 'rxjs/operators'; /** services */ -import { DataMonitoringObjectService } from '../../services/data-monitoring-object.service'; -import { ConfigService } from '../../services/config.service'; -import { get } from 'https'; +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; @@ -47,6 +55,19 @@ export class ModulesComponent implements OnInit { this._configService.appConfig.MEDIA_URL }/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 874e86f48..c85ef94fd 100644 --- a/frontend/app/services/config.service.ts +++ b/frontend/app/services/config.service.ts @@ -65,6 +65,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; diff --git a/monitorings_config.toml.example b/monitorings_config.toml.example index f04d33639..e77362652 100644 --- a/monitorings_config.toml.example +++ b/monitorings_config.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