From 8f8f1fdf843216cbe3565a2f758a228547997139 Mon Sep 17 00:00:00 2001 From: Vincent BENOIT Date: Tue, 25 Oct 2022 15:38:25 +0200 Subject: [PATCH] =?UTF-8?q?mise=20=C3=A0=20jour=20de=20la=20page=20d'infor?= =?UTF-8?q?mations?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/app.module.ts | 2 + .../home/workspace/infos/infos.component.html | 40 ++++++++++++++++++- .../home/workspace/infos/infos.component.ts | 16 +++++++- src/app/models/info.model.ts | 16 ++++++++ src/app/services/backend/backend.service.ts | 12 ++++++ 5 files changed, 84 insertions(+), 2 deletions(-) create mode 100644 src/app/models/info.model.ts diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 9c7bd06..6c11af7 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -29,6 +29,7 @@ import { MatProgressBarModule } from '@angular/material/progress-bar'; import { MatSlideToggleModule } from '@angular/material/slide-toggle'; import { MatGridListModule } from '@angular/material/grid-list'; import { MatTabsModule } from '@angular/material/tabs'; +import { MatSliderModule } from '@angular/material/slider'; import { ToastrModule } from 'ngx-toastr'; import { CodeInputModule } from 'angular-code-input'; @@ -89,6 +90,7 @@ import { LogsComponent } from './components/home/workspace/logs/logs.component'; MatSlideToggleModule, MatGridListModule, MatTabsModule, + MatSliderModule, FlexLayoutModule, RouterModule, FontAwesomeModule, diff --git a/src/app/components/home/workspace/infos/infos.component.html b/src/app/components/home/workspace/infos/infos.component.html index e30391c..fe6db65 100644 --- a/src/app/components/home/workspace/infos/infos.component.html +++ b/src/app/components/home/workspace/infos/infos.component.html @@ -5,5 +5,43 @@
+ fxLayoutAlign="space-around start"> + +

Module GSM

+
+ Fabricant: + {{infos.manufacturer.identification}} +
+
+ Modèle: + {{infos.manufacturer.model}} +
+
+ Révision matérielle: + {{infos.manufacturer.hardware_rev}} +
+
+ Numéro de série: + {{infos.manufacturer.serial_number}} +
+

Contrôle

+
+ Opérateur: + {{infos.operator}} +
+
+ Provider: + {{infos.provider}} +
+
+ Signal: + + ({{infos.signal_qos}}) +
+
+ carte SIM: +
check_circle
+
cancel
+
+
diff --git a/src/app/components/home/workspace/infos/infos.component.ts b/src/app/components/home/workspace/infos/infos.component.ts index 86a4d0c..3b56004 100644 --- a/src/app/components/home/workspace/infos/infos.component.ts +++ b/src/app/components/home/workspace/infos/infos.component.ts @@ -1,7 +1,7 @@ import { Component, OnInit } from '@angular/core'; import { Router } from '@angular/router'; import { BackendService } from '../../../../services/backend/backend.service'; -import { Log } from '../../../../models/log.model'; +import { Info } from '../../../../models/info.model'; import { ToastrService } from 'ngx-toastr'; @Component({ @@ -10,6 +10,7 @@ import { ToastrService } from 'ngx-toastr'; styleUrls: ['./infos.component.css'] }) export class InfosComponent implements OnInit { + infos:Info; isProcessing:boolean = true; constructor( private bs:BackendService, @@ -17,6 +18,19 @@ export class InfosComponent implements OnInit { private toast:ToastrService ) { } ngOnInit(): void { + this.bs.retreiveInfos().subscribe( + (data:Info) => { + this.infos = data; + console.log(this.infos); + this.isProcessing = false; + }, err => { + if(err.status == 401) { + this.router.navigateByUrl("/login"); + } else { + this.toast.error(err.error.description); + } + } + ); } } diff --git a/src/app/models/info.model.ts b/src/app/models/info.model.ts new file mode 100644 index 0000000..6d5b3aa --- /dev/null +++ b/src/app/models/info.model.ts @@ -0,0 +1,16 @@ +export interface Manufacturer { + identification:string; + model:string; + hardware_rev:string; + serial_number:string; +} + +export interface Info { + manufacturer:Manufacturer; + operator:string; + provider:string; + signal_dbm:string; + signal_qos:string; + sim_inserted:boolean; + call_ready:boolean; +} diff --git a/src/app/services/backend/backend.service.ts b/src/app/services/backend/backend.service.ts index 5be809e..6c346b2 100644 --- a/src/app/services/backend/backend.service.ts +++ b/src/app/services/backend/backend.service.ts @@ -6,6 +6,7 @@ import { Utilisateur } from '../../models/utilisateur.model'; import { Parameters } from '../../models/parameters.model'; import { Scheduler } from '../../models/scheduler.model'; import { Log } from '../../models/log.model'; +import { Info } from '../../models/info.model'; @Injectable({ providedIn: 'root' @@ -138,4 +139,15 @@ export class BackendService { }; return this.http.get(host+"/api/configurateur/app_logs", options); } + + retreiveInfos():Observable { + let host=environment.host; + const options = { + headers: new HttpHeaders({ + 'Content-Type' : 'application/json', + }), + withCredentials: true + }; + return this.http.get(host+"/api/configurateur/infos", options); + } }