Skip to content

Commit

Permalink
feat: [6.2] Page d'accueil module monitoring layout et config title e…
Browse files Browse the repository at this point in the history
…t description #2 (#15)

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

* chore(config): applied black & removed imports
  • Loading branch information
andriacap authored and amandine-sahl committed Oct 10, 2023
1 parent 5667556 commit 652fee7
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 35 deletions.
9 changes: 8 additions & 1 deletion backend/gn_module_monitoring/conf_schema_toml.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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])
Expand Down
26 changes: 12 additions & 14 deletions frontend/app/components/modules/modules.component.css
Original file line number Diff line number Diff line change
Expand Up @@ -38,32 +38,30 @@ 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 {
text-align: center;
}


.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;
}

Expand Down
59 changes: 43 additions & 16 deletions frontend/app/components/modules/modules.component.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@

<div class="modules">
<pnx-modal-msg [bDisplayModal]="bLoading">
<h2>Chargement en cours</h2>
<div>
<span class="center spinner-border" role="status" aria-hidden="true"></span>
</div>
</pnx-modal-msg>

<h2>Modules de suivi</h2>
<pnx-modal-msg [bDisplayModal]="bLoading">
<h2>Chargement en cours</h2>
<div>
<span class="center spinner-border" role="status" aria-hidden="true"></span>
</div>
</pnx-modal-msg>

<div class="container py-5">
<div class="row">
<div class="col-4 col-sm-5 col-md-4 col-lg-4 module" *ngFor="let module of modules">
<a [routerLink]="[
<h2 class="title-module mb-4">{{titleModule}}</h2>
<div class="text-center my-auto" style="height: 80vh;" *ngIf="modules.length<1 && !bLoading">Vous n'avez pas encore de
protocole
installé</div>
<div class="row m-2" *ngIf="modules.length>0">
<div class="col-md-4 col-sm-12 des-module"> {{description}}</div>
<!-- <div class="w-100 d-none d-sm-block"></div> -->
<div class="btn-module col-md-8 col-sm-12 text-center">
<button class="btn btn-success mr-2" (click)="onAccessSitesClick(modules)" *ngIf="currentUser">
Accès aux sites
</button>
<div class="container py-5 border rounded m-2">
<h3>Liste des protocoles</h3>
<div class="row row-eq-height" style="overflow-x: auto;">
<div class="col-3 col-sm-5 col-md-3 col-lg-3 module" style="width:250px;" *ngFor="let module of modules">
<a [routerLink]="[
'object',
module.module_code,
'module',
Expand All @@ -29,10 +38,28 @@ <h5 class="card-title" data>{{ module.module_label }}</h5>
<p class="card-text"> {{ module.module_desc }}</p>
</div>
</div>
</a>
</div>
<!-- <div class="d-flex flex-row p-4" style="overflow-x: auto;">
<div class="module" style="min-width:250px; max-width: 250px;" *ngFor="let module of modules">
<a [routerLink]="[
'object',
module.module_code,
'module',
module.id_module
]">
<div class="card module-card h-100">
<img class="card-img-top" src="{{assetsDirectory}}{{ module.module_code.toLowerCase()}}.jpg"
alt="{{ module.module_label }}" title="{{ module.module_label }}">
<div class="card-body">
<h5 class="card-title">{{ module.module_label }}</h5>
<p class="card-text"> {{ module.module_desc }}</p>
</div>
</div>
</a>
</div>
</div> -->
</div>

</div>
</div>
</div>
</div>
29 changes: 25 additions & 4 deletions frontend/app/components/modules/modules.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,23 @@ 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',
templateUrl: './modules.component.html',
styleUrls: ['./modules.component.css'],
})
export class ModulesComponent implements OnInit {


currentUser: User;

description: string;
titleModule: string;
modules: Array<any> = [];

backendUrl: string;
Expand All @@ -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;
Expand All @@ -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)
}

}
6 changes: 6 additions & 0 deletions frontend/app/services/config.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions monitorings_config.toml.example
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit 652fee7

Please sign in to comment.