Merge branch 'develop' of ssh://ognproject.evlt.uma.es:21987/opengnsys/oggui into develop
commit
8fdee4fc9b
|
@ -7,7 +7,7 @@
|
||||||
</div>
|
</div>
|
||||||
<mat-tab-group (selectedTabChange)="onTabChange($event)">
|
<mat-tab-group (selectedTabChange)="onTabChange($event)">
|
||||||
<mat-tab label="OgBoot">
|
<mat-tab label="OgBoot">
|
||||||
<div *ngIf="!loading && !error" class="content-container">
|
<div *ngIf="!loading && !errorOgBoot" class="content-container">
|
||||||
<app-status-tab
|
<app-status-tab
|
||||||
[loading]="loading"
|
[loading]="loading"
|
||||||
[diskUsage]="ogBootDiskUsage"
|
[diskUsage]="ogBootDiskUsage"
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
[isRepository]="false">
|
[isRepository]="false">
|
||||||
</app-status-tab>
|
</app-status-tab>
|
||||||
</div>
|
</div>
|
||||||
<mat-card *ngIf="!loading && error" class="error-card">
|
<mat-card *ngIf="!loading && errorOgBoot" class="error-card">
|
||||||
<mat-card-content>
|
<mat-card-content>
|
||||||
<p>{{ 'errorLoadingData' | translate }}</p>
|
<p>{{ 'errorLoadingData' | translate }}</p>
|
||||||
</mat-card-content>
|
</mat-card-content>
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
</mat-tab>
|
</mat-tab>
|
||||||
|
|
||||||
<mat-tab label="Dhcp">
|
<mat-tab label="Dhcp">
|
||||||
<div *ngIf="!loading && !error" class="content-container">
|
<div *ngIf="!loading && !errorDhcp" class="content-container">
|
||||||
<app-status-tab
|
<app-status-tab
|
||||||
[loading]="loading"
|
[loading]="loading"
|
||||||
[diskUsage]="dhcpDiskUsage"
|
[diskUsage]="dhcpDiskUsage"
|
||||||
|
@ -45,7 +45,7 @@
|
||||||
[isRepository]="false">
|
[isRepository]="false">
|
||||||
</app-status-tab>
|
</app-status-tab>
|
||||||
</div>
|
</div>
|
||||||
<mat-card *ngIf="!loading && error" class="error-card">
|
<mat-card *ngIf="!loading && errorDhcp" class="error-card">
|
||||||
<mat-card-content>
|
<mat-card-content>
|
||||||
<p>{{ 'errorLoadingData' | translate }}</p>
|
<p>{{ 'errorLoadingData' | translate }}</p>
|
||||||
</mat-card-content>
|
</mat-card-content>
|
||||||
|
@ -55,7 +55,7 @@
|
||||||
<mat-tab label="Repositorios">
|
<mat-tab label="Repositorios">
|
||||||
<mat-tab-group>
|
<mat-tab-group>
|
||||||
<mat-tab *ngFor="let repository of repositories" [label]="repository.name">
|
<mat-tab *ngFor="let repository of repositories" [label]="repository.name">
|
||||||
<div *ngIf="!loading && !error && repositoryStatuses[repository.uuid]">
|
<div *ngIf="!loading && !errorRepositories && repositoryStatuses[repository.uuid]">
|
||||||
<app-status-tab
|
<app-status-tab
|
||||||
[loading]="loading"
|
[loading]="loading"
|
||||||
[diskUsage]="repositoryStatuses[repository.uuid].disk"
|
[diskUsage]="repositoryStatuses[repository.uuid].disk"
|
||||||
|
@ -79,7 +79,7 @@
|
||||||
[isRepository]="true">
|
[isRepository]="true">
|
||||||
</app-status-tab>
|
</app-status-tab>
|
||||||
</div>
|
</div>
|
||||||
<mat-card *ngIf="!loading && error" class="error-card">
|
<mat-card *ngIf="!loading && errorRepositories" class="error-card">
|
||||||
<mat-card-content>
|
<mat-card-content>
|
||||||
<p>{{ 'errorLoadingData' | translate }}</p>
|
<p>{{ 'errorLoadingData' | translate }}</p>
|
||||||
</mat-card-content>
|
</mat-card-content>
|
||||||
|
|
|
@ -12,7 +12,9 @@ import { MatTabChangeEvent } from '@angular/material/tabs';
|
||||||
export class GlobalStatusComponent implements OnInit {
|
export class GlobalStatusComponent implements OnInit {
|
||||||
baseUrl: string;
|
baseUrl: string;
|
||||||
loading: boolean = false;
|
loading: boolean = false;
|
||||||
error: boolean = false;
|
errorOgBoot: boolean = false;
|
||||||
|
errorDhcp: boolean = false;
|
||||||
|
errorRepositories: boolean = false;
|
||||||
installedOgLives: any[] = [];
|
installedOgLives: any[] = [];
|
||||||
subnets: any[] = [];
|
subnets: any[] = [];
|
||||||
showLabels: boolean = true;
|
showLabels: boolean = true;
|
||||||
|
@ -52,13 +54,14 @@ export class GlobalStatusComponent implements OnInit {
|
||||||
this.loadOgBootStatus();
|
this.loadOgBootStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
loadStatus(apiUrl: string, diskUsage: any, servicesStatus: any, diskUsageChartData: any[], installedOgLives: any[], isDhcp: boolean): void {
|
[key: string]: any;
|
||||||
|
|
||||||
|
loadStatus(apiUrl: string, diskUsage: any, servicesStatus: any, diskUsageChartData: any[], installedOgLives: any[], isDhcp: boolean, errorState: string): void {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
this.error = false;
|
this[errorState] = false;
|
||||||
const timeoutId = setTimeout(() => {
|
const timeoutId = setTimeout(() => {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
this.error = true;
|
this[errorState] = true;
|
||||||
this.toastService.error('Error al sincronizar: Tiempo de espera excedido');
|
|
||||||
}, 3500);
|
}, 3500);
|
||||||
this.http.get<any>(apiUrl).subscribe({
|
this.http.get<any>(apiUrl).subscribe({
|
||||||
next: data => {
|
next: data => {
|
||||||
|
@ -91,10 +94,9 @@ export class GlobalStatusComponent implements OnInit {
|
||||||
clearTimeout(timeoutId);
|
clearTimeout(timeoutId);
|
||||||
},
|
},
|
||||||
error: error => {
|
error: error => {
|
||||||
this.toastService.error('Error al sincronizar');
|
|
||||||
console.log(error);
|
console.log(error);
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
this.error = true;
|
this[errorState] = true;
|
||||||
clearTimeout(timeoutId);
|
clearTimeout(timeoutId);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -102,18 +104,17 @@ export class GlobalStatusComponent implements OnInit {
|
||||||
|
|
||||||
loadRepositories(): void {
|
loadRepositories(): void {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
this.error = false;
|
this.errorRepositories = false;
|
||||||
const timeoutId = setTimeout(() => {
|
const timeoutId = setTimeout(() => {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
this.error = true;
|
this.errorRepositories = true;
|
||||||
this.toastService.error('Error al sincronizar: Tiempo de espera excedido');
|
}, 5000);
|
||||||
}, 3500);
|
|
||||||
this.http.get<any>(`${this.repositoriesUrl}?page=1&itemsPerPage=10`).subscribe(
|
this.http.get<any>(`${this.repositoriesUrl}?page=1&itemsPerPage=10`).subscribe(
|
||||||
data => {
|
data => {
|
||||||
this.repositories = data['hydra:member'];
|
this.repositories = data['hydra:member'];
|
||||||
let remainingRepositories = this.repositories.length;
|
let remainingRepositories = this.repositories.length;
|
||||||
this.repositories.forEach(repository => {
|
this.repositories.forEach(repository => {
|
||||||
this.loadRepositoryStatus(repository.uuid, () => {
|
this.loadRepositoryStatus(repository.uuid, (errorOccurred: boolean) => {
|
||||||
remainingRepositories--;
|
remainingRepositories--;
|
||||||
if (remainingRepositories === 0) {
|
if (remainingRepositories === 0) {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
|
@ -125,17 +126,16 @@ export class GlobalStatusComponent implements OnInit {
|
||||||
error => {
|
error => {
|
||||||
console.error('Error fetching repositories', error);
|
console.error('Error fetching repositories', error);
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
this.error = true;
|
this.errorRepositories = true;
|
||||||
clearTimeout(timeoutId);
|
clearTimeout(timeoutId);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
loadRepositoryStatus(repositoryUuid: string, callback: () => void): void {
|
loadRepositoryStatus(repositoryUuid: string, callback: (errorOccurred: boolean) => void): void {
|
||||||
const timeoutId = setTimeout(() => {
|
const timeoutId = setTimeout(() => {
|
||||||
this.toastService.error(`Error al sincronizar repositorio. Tiempo de espera excedido`);
|
callback(true);
|
||||||
callback();
|
}, 5000);
|
||||||
}, 3500);
|
|
||||||
this.http.get<any>(`${this.baseUrl}/image-repositories/server/${repositoryUuid}/status`).subscribe(
|
this.http.get<any>(`${this.baseUrl}/image-repositories/server/${repositoryUuid}/status`).subscribe(
|
||||||
data => {
|
data => {
|
||||||
const output = data.output;
|
const output = data.output;
|
||||||
|
@ -153,24 +153,24 @@ export class GlobalStatusComponent implements OnInit {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
clearTimeout(timeoutId);
|
clearTimeout(timeoutId);
|
||||||
callback();
|
callback(false);
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
console.error(`Error fetching status for repository ${repositoryUuid}`, error);
|
console.error(`Error fetching status for repository ${repositoryUuid}`, error);
|
||||||
clearTimeout(timeoutId);
|
clearTimeout(timeoutId);
|
||||||
callback();
|
callback(true);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
loadOgBootStatus(): void {
|
loadOgBootStatus(): void {
|
||||||
this.isDhcp = false;
|
this.isDhcp = false;
|
||||||
this.loadStatus(this.ogBootApiUrl, this.ogBootDiskUsage, this.ogBootServicesStatus, this.ogBootDiskUsageChartData, this.installedOgLives, this.isDhcp);
|
this.loadStatus(this.ogBootApiUrl, this.ogBootDiskUsage, this.ogBootServicesStatus, this.ogBootDiskUsageChartData, this.installedOgLives, this.isDhcp, 'errorOgBoot');
|
||||||
}
|
}
|
||||||
|
|
||||||
loadDhcpStatus(): void {
|
loadDhcpStatus(): void {
|
||||||
this.isDhcp = true;
|
this.isDhcp = true;
|
||||||
this.loadStatus(this.dhcpApiUrl, this.dhcpDiskUsage, this.dhcpServicesStatus, this.dhcpDiskUsageChartData, this.installedOgLives, this.isDhcp);
|
this.loadStatus(this.dhcpApiUrl, this.dhcpDiskUsage, this.dhcpServicesStatus, this.dhcpDiskUsageChartData, this.installedOgLives, this.isDhcp, 'errorDhcp');
|
||||||
}
|
}
|
||||||
|
|
||||||
onTabChange(event: MatTabChangeEvent): void {
|
onTabChange(event: MatTabChangeEvent): void {
|
||||||
|
|
Loading…
Reference in New Issue