mise à jour de la page de logs et correction de bugs sur les autres pages
This commit is contained in:
@@ -6,8 +6,8 @@
|
|||||||
|
|
||||||
form {
|
form {
|
||||||
/*margin-left: 100px;*/
|
/*margin-left: 100px;*/
|
||||||
width: 50%;
|
width: 70%;
|
||||||
min-width: 50%;
|
min-width: 70%;
|
||||||
}
|
}
|
||||||
|
|
||||||
mat-label {
|
mat-label {
|
||||||
|
|||||||
@@ -49,9 +49,14 @@ export class AccountComponent implements OnInit {
|
|||||||
this.bs.updatePasswd(data).subscribe(
|
this.bs.updatePasswd(data).subscribe(
|
||||||
data => {
|
data => {
|
||||||
this.toast.success("Mise à jour réussie");
|
this.toast.success("Mise à jour réussie");
|
||||||
}, error => {
|
}, err => {
|
||||||
this.toast.error("Erreur de mise à jour du mot de passe");
|
if(err.status == 401) {
|
||||||
});
|
this.router.navigateByUrl("/login");
|
||||||
|
} else {
|
||||||
|
this.toast.error(err.error.description);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ export class HoursComponent implements OnInit {
|
|||||||
if(err.status == 401) {
|
if(err.status == 401) {
|
||||||
this.router.navigateByUrl("/login");
|
this.router.navigateByUrl("/login");
|
||||||
} else {
|
} else {
|
||||||
this.toast.error("Erreur de récupération des horaires");
|
this.toast.error(err.error.description);
|
||||||
}
|
}
|
||||||
this.isProcessing = false;
|
this.isProcessing = false;
|
||||||
}
|
}
|
||||||
@@ -48,7 +48,7 @@ export class HoursComponent implements OnInit {
|
|||||||
if(err.status == 401) {
|
if(err.status == 401) {
|
||||||
this.router.navigateByUrl("/login");
|
this.router.navigateByUrl("/login");
|
||||||
} else {
|
} else {
|
||||||
this.toast.error("Erreur de mise à jour des horaires");
|
this.toast.error(err.error.description);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
.container {
|
||||||
|
/* display: flex; */
|
||||||
|
/*background-color: #b8b8b8;*/
|
||||||
|
margin-bottom: 100px;
|
||||||
|
overflow-x: hidden;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.process {
|
||||||
|
width: 100%;
|
||||||
|
height: 75%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mat-spinner {
|
||||||
|
margin-top: 3rem;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1 +1,9 @@
|
|||||||
<p>infos works!</p>
|
<div *ngIf="isProcessing" class="process"
|
||||||
|
fxLayout="column"
|
||||||
|
fxLayoutAlign="space-around center">
|
||||||
|
<mat-spinner></mat-spinner>
|
||||||
|
</div>
|
||||||
|
<div *ngIf="!isProcessing" class="container"
|
||||||
|
fxLayout="column"
|
||||||
|
fxLayoutAlign="space-around center">
|
||||||
|
</div>
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
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 { ToastrService } from 'ngx-toastr';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-infos',
|
selector: 'app-infos',
|
||||||
@@ -6,8 +10,11 @@ import { Component, OnInit } from '@angular/core';
|
|||||||
styleUrls: ['./infos.component.css']
|
styleUrls: ['./infos.component.css']
|
||||||
})
|
})
|
||||||
export class InfosComponent implements OnInit {
|
export class InfosComponent implements OnInit {
|
||||||
|
isProcessing:boolean = true;
|
||||||
|
|
||||||
constructor() { }
|
constructor( private bs:BackendService,
|
||||||
|
private router:Router,
|
||||||
|
private toast:ToastrService ) { }
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,11 @@
|
|||||||
|
|
||||||
.process {
|
.process {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 75%;
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mat-spinner {
|
||||||
|
margin-top: 3rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mat-card.scrollable-content {
|
.mat-card.scrollable-content {
|
||||||
@@ -45,3 +49,35 @@ div.ERROR {
|
|||||||
margin-bottom: 0.2rem;
|
margin-bottom: 0.2rem;
|
||||||
background-color: red;
|
background-color: red;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.logHeaderDebug {
|
||||||
|
border-radius:5px;
|
||||||
|
padding: 0.45rem;
|
||||||
|
background-color: lightblue;
|
||||||
|
margin-bottom: 0.8rem;
|
||||||
|
font-size:smaller;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logHeaderInfo {
|
||||||
|
border-radius:5px;
|
||||||
|
padding: 0.45rem;
|
||||||
|
background-color: lightgreen;
|
||||||
|
margin-bottom: 0.8rem;
|
||||||
|
font-size:smaller;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logHeaderWarn {
|
||||||
|
border-radius:5px;
|
||||||
|
padding: 0.45rem;
|
||||||
|
background-color: orange;
|
||||||
|
margin-bottom: 0.8rem;
|
||||||
|
font-size:smaller;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logHeaderErr {
|
||||||
|
border-radius:5px;
|
||||||
|
padding: 0.45rem;
|
||||||
|
background-color: red;
|
||||||
|
margin-bottom: 0.8rem;
|
||||||
|
font-size:smaller;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<mat-tab-group animationDuration="0ms" (selectedTabChange)="onTabChanged($event)">
|
<mat-tab-group animationDuration="0ms" selectedIndex=0 (selectedTabChange)="onTabChanged($event)">
|
||||||
<mat-tab label="Configurateur.log">
|
<mat-tab label="Configurateur.log">
|
||||||
<div *ngIf="isProcessing" class="process"
|
<div *ngIf="isProcessing" class="process"
|
||||||
fxLayout="column"
|
fxLayout="column"
|
||||||
@@ -9,7 +9,13 @@
|
|||||||
fxLayout="column"
|
fxLayout="column"
|
||||||
fxLayoutAlign="space-around center">
|
fxLayoutAlign="space-around center">
|
||||||
<mat-card class="scrollable-content">
|
<mat-card class="scrollable-content">
|
||||||
<mat-card-content #myList>
|
<mat-card-title fxLayout="row" fxLayoutAlign="space-around center">
|
||||||
|
<div class="logHeaderDebug mat-elevation-z2"><b>DEBUG</b></div>
|
||||||
|
<div class="logHeaderInfo mat-elevation-z2"><b>INFO</b></div>
|
||||||
|
<div class="logHeaderWarn mat-elevation-z2"><b>WARNING</b></div>
|
||||||
|
<div class="logHeaderErr mat-elevation-z2"><b>ERROR</b></div>
|
||||||
|
</mat-card-title>
|
||||||
|
<mat-card-content>
|
||||||
<ng-container *ngIf="confLogs">
|
<ng-container *ngIf="confLogs">
|
||||||
<div *ngFor="let log of confLogs; let last = last" class={{log.gravity}}>
|
<div *ngFor="let log of confLogs; let last = last" class={{log.gravity}}>
|
||||||
{{log.datetime}} - {{log.msg}}<br>
|
{{log.datetime}} - {{log.msg}}<br>
|
||||||
@@ -21,6 +27,30 @@
|
|||||||
</div>
|
</div>
|
||||||
</mat-tab>
|
</mat-tab>
|
||||||
<mat-tab label="KineIntercom.log">
|
<mat-tab label="KineIntercom.log">
|
||||||
plop2
|
<div *ngIf="isProcessing" class="process"
|
||||||
|
fxLayout="column"
|
||||||
|
fxLayoutAlign="space-around center">
|
||||||
|
<mat-spinner></mat-spinner>
|
||||||
|
</div>
|
||||||
|
<div *ngIf="!isProcessing" class="container"
|
||||||
|
fxLayout="column"
|
||||||
|
fxLayoutAlign="space-around center">
|
||||||
|
<mat-card class="scrollable-content">
|
||||||
|
<mat-card-title fxLayout="row" fxLayoutAlign="space-around center">
|
||||||
|
<div class="logHeaderDebug mat-elevation-z2"><b>DEBUG</b></div>
|
||||||
|
<div class="logHeaderInfo mat-elevation-z2"><b>INFO</b></div>
|
||||||
|
<div class="logHeaderWarn mat-elevation-z2"><b>WARNING</b></div>
|
||||||
|
<div class="logHeaderErr mat-elevation-z2"><b>ERROR</b></div>
|
||||||
|
</mat-card-title>
|
||||||
|
<mat-card-content>
|
||||||
|
<ng-container *ngIf="appLogs">
|
||||||
|
<div *ngFor="let log of appLogs; let last = last" class={{log.gravity}}>
|
||||||
|
{{log.datetime}} - {{log.msg}}<br>
|
||||||
|
{{last ? scrollToBottom(): ''}}
|
||||||
|
</div>
|
||||||
|
</ng-container>
|
||||||
|
</mat-card-content>
|
||||||
|
</mat-card>
|
||||||
|
</div>
|
||||||
</mat-tab>
|
</mat-tab>
|
||||||
</mat-tab-group>
|
</mat-tab-group>
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ export class LogsComponent implements OnInit {
|
|||||||
isProcessing:boolean = true;
|
isProcessing:boolean = true;
|
||||||
confLogs:Log[];
|
confLogs:Log[];
|
||||||
appLogs:Log[];
|
appLogs:Log[];
|
||||||
//@ViewChild('myList') myList: ElementRef;
|
|
||||||
gravity:string[] = ['DEBUG', 'INFO', 'WARNING', 'ERROR'];
|
gravity:string[] = ['DEBUG', 'INFO', 'WARNING', 'ERROR'];
|
||||||
|
|
||||||
constructor( private bs:BackendService,
|
constructor( private bs:BackendService,
|
||||||
@@ -21,18 +20,29 @@ export class LogsComponent implements OnInit {
|
|||||||
private toast:ToastrService ) { }
|
private toast:ToastrService ) { }
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.isProcessing = false;
|
this.bs.retreiveConfLogs().subscribe(
|
||||||
|
(datas:Log[]) => {
|
||||||
|
this.confLogs = datas;
|
||||||
|
this.isProcessing = false;
|
||||||
|
}, err => {
|
||||||
|
if(err.status == 401) {
|
||||||
|
this.router.navigateByUrl("/login");
|
||||||
|
} else {
|
||||||
|
this.toast.error(err.error.description);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
scrollToBottom(): void {
|
scrollToBottom(): void {
|
||||||
//this.myList.nativeElement.scrollTop = this.myList.nativeElement.scrollHeight;
|
//this.myList.nativeElement.scrollTop = this.myList.nativeElement.scrollHeight;
|
||||||
console.log("plop");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onTabChanged(event:any): void {
|
onTabChanged(event:any): void {
|
||||||
switch(event.tab.textLabel) {
|
switch(event.tab.textLabel) {
|
||||||
case 'Configurateur.log':
|
case 'Configurateur.log':
|
||||||
console.log("configurateur");
|
console.log("configurateur");
|
||||||
|
this.isProcessing = true;
|
||||||
this.bs.retreiveConfLogs().subscribe(
|
this.bs.retreiveConfLogs().subscribe(
|
||||||
(datas:Log[]) => {
|
(datas:Log[]) => {
|
||||||
this.confLogs = datas;
|
this.confLogs = datas;
|
||||||
@@ -41,14 +51,26 @@ export class LogsComponent implements OnInit {
|
|||||||
if(err.status == 401) {
|
if(err.status == 401) {
|
||||||
this.router.navigateByUrl("/login");
|
this.router.navigateByUrl("/login");
|
||||||
} else {
|
} else {
|
||||||
this.toast.error("Erreur de mise à jour des horaires");
|
this.toast.error(err.error.description);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'KineIntercom.log':
|
case 'KineIntercom.log':
|
||||||
console.log("kineintercom");
|
console.log("kineintercom");
|
||||||
|
this.isProcessing = true;
|
||||||
|
this.bs.retreiveAppLogs().subscribe(
|
||||||
|
(datas:Log[]) => {
|
||||||
|
this.appLogs = datas;
|
||||||
|
this.isProcessing = false;
|
||||||
|
}, err => {
|
||||||
|
if(err.status == 401) {
|
||||||
|
this.router.navigateByUrl("/login");
|
||||||
|
} else {
|
||||||
|
this.toast.error(err.error.description);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -54,8 +54,11 @@ export class ParametresComponent implements OnInit {
|
|||||||
this.pinNumber = data.code_pin;
|
this.pinNumber = data.code_pin;
|
||||||
this.isProcessing = false;
|
this.isProcessing = false;
|
||||||
}, err => {
|
}, err => {
|
||||||
this.toast.error("Erreur de récupération des paramètres");
|
if(err.status == 401) {
|
||||||
this.isProcessing = false;
|
this.router.navigateByUrl("/login");
|
||||||
|
} else {
|
||||||
|
this.toast.error(err.error.description);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -100,7 +103,11 @@ export class ParametresComponent implements OnInit {
|
|||||||
data => {
|
data => {
|
||||||
this.toast.success("Mise à jour des paramètres réussie");
|
this.toast.success("Mise à jour des paramètres réussie");
|
||||||
}, err => {
|
}, err => {
|
||||||
this.toast.error("Erreur de mise à jour des paramètres");
|
if(err.status == 401) {
|
||||||
|
this.router.navigateByUrl("/login");
|
||||||
|
} else {
|
||||||
|
this.toast.error(err.error.description);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -126,6 +126,16 @@ export class BackendService {
|
|||||||
withCredentials: true
|
withCredentials: true
|
||||||
};
|
};
|
||||||
return this.http.get<Log[]>(host+"/api/configurateur/conf_logs", options);
|
return this.http.get<Log[]>(host+"/api/configurateur/conf_logs", options);
|
||||||
|
}
|
||||||
|
|
||||||
|
retreiveAppLogs():Observable<Log[]> {
|
||||||
|
let host=environment.host;
|
||||||
|
const options = {
|
||||||
|
headers: new HttpHeaders({
|
||||||
|
'Content-Type' : 'application/json',
|
||||||
|
}),
|
||||||
|
withCredentials: true
|
||||||
|
};
|
||||||
|
return this.http.get<Log[]>(host+"/api/configurateur/app_logs", options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user