Merge branch 'develop' of ssh://ognproject.evlt.uma.es:21987/opengnsys/oggui into develop
commit
d430091d54
|
@ -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 && !errorRepositories && repositoryStatuses[repository.uuid]">
|
<div *ngIf="!loading && !errorRepositories[repository.uuid] && 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 && errorRepositories" class="error-card">
|
<mat-card *ngIf="!loading && errorRepositories[repository.uuid]" class="error-card">
|
||||||
<mat-card-content>
|
<mat-card-content>
|
||||||
<p>{{ 'errorLoadingData' | translate }}</p>
|
<p>{{ 'errorLoadingData' | translate }}</p>
|
||||||
</mat-card-content>
|
</mat-card-content>
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { ConfigService } from '@services/config.service';
|
import { ConfigService } from '@services/config.service';
|
||||||
import { ToastrService } from 'ngx-toastr';
|
|
||||||
import { MatTabChangeEvent } from '@angular/material/tabs';
|
import { MatTabChangeEvent } from '@angular/material/tabs';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -14,7 +13,7 @@ export class GlobalStatusComponent implements OnInit {
|
||||||
loading: boolean = false;
|
loading: boolean = false;
|
||||||
errorOgBoot: boolean = false;
|
errorOgBoot: boolean = false;
|
||||||
errorDhcp: boolean = false;
|
errorDhcp: boolean = false;
|
||||||
errorRepositories: boolean = false;
|
errorRepositories: { [key: string]: boolean } = {};
|
||||||
installedOgLives: any[] = [];
|
installedOgLives: any[] = [];
|
||||||
subnets: any[] = [];
|
subnets: any[] = [];
|
||||||
showLabels: boolean = true;
|
showLabels: boolean = true;
|
||||||
|
@ -41,8 +40,7 @@ export class GlobalStatusComponent implements OnInit {
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private configService: ConfigService,
|
private configService: ConfigService,
|
||||||
private http: HttpClient,
|
private http: HttpClient
|
||||||
private toastService: ToastrService
|
|
||||||
) {
|
) {
|
||||||
this.baseUrl = this.configService.apiUrl;
|
this.baseUrl = this.configService.apiUrl;
|
||||||
this.ogBootApiUrl = `${this.baseUrl}/og-boot/status`;
|
this.ogBootApiUrl = `${this.baseUrl}/og-boot/status`;
|
||||||
|
@ -104,10 +102,12 @@ export class GlobalStatusComponent implements OnInit {
|
||||||
|
|
||||||
loadRepositories(): void {
|
loadRepositories(): void {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
this.errorRepositories = false;
|
this.errorRepositories = {};
|
||||||
const timeoutId = setTimeout(() => {
|
const timeoutId = setTimeout(() => {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
this.errorRepositories = true;
|
this.repositories.forEach(repository => {
|
||||||
|
this.errorRepositories[repository.uuid] = true;
|
||||||
|
});
|
||||||
}, 5000);
|
}, 5000);
|
||||||
this.http.get<any>(`${this.repositoriesUrl}?page=1&itemsPerPage=10`).subscribe(
|
this.http.get<any>(`${this.repositoriesUrl}?page=1&itemsPerPage=10`).subscribe(
|
||||||
data => {
|
data => {
|
||||||
|
@ -120,13 +120,20 @@ export class GlobalStatusComponent implements OnInit {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
clearTimeout(timeoutId);
|
clearTimeout(timeoutId);
|
||||||
}
|
}
|
||||||
|
if (errorOccurred) {
|
||||||
|
this.errorRepositories[repository.uuid] = true;
|
||||||
|
} else {
|
||||||
|
this.errorRepositories[repository.uuid] = false;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
console.error('Error fetching repositories', error);
|
console.error('Error fetching repositories', error);
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
this.errorRepositories = true;
|
this.repositories.forEach(repository => {
|
||||||
|
this.errorRepositories[repository.uuid] = true;
|
||||||
|
});
|
||||||
clearTimeout(timeoutId);
|
clearTimeout(timeoutId);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue