Merge branch 'develop' of ssh://ognproject.evlt.uma.es:21987/opengnsys/oggui into develop
commit
b5510ffa13
|
@ -18,7 +18,8 @@
|
|||
[colorScheme]="colorScheme"
|
||||
[isDoughnut]="isDoughnut"
|
||||
[showLabels]="showLabels"
|
||||
[isDhcp]="isDhcp">
|
||||
[isDhcp]="isDhcp"
|
||||
[isRepository]="false">
|
||||
</app-status-tab>
|
||||
</div>
|
||||
</mat-tab>
|
||||
|
@ -35,7 +36,8 @@
|
|||
[colorScheme]="colorScheme"
|
||||
[isDoughnut]="isDoughnut"
|
||||
[showLabels]="showLabels"
|
||||
[isDhcp]="isDhcp">
|
||||
[isDhcp]="isDhcp"
|
||||
[isRepository]="false">
|
||||
</app-status-tab>
|
||||
</div>
|
||||
</mat-tab>
|
||||
|
@ -62,7 +64,9 @@
|
|||
[view]="view"
|
||||
[colorScheme]="colorScheme"
|
||||
[isDoughnut]="isDoughnut"
|
||||
[showLabels]="showLabels">
|
||||
[showLabels]="showLabels"
|
||||
[isDhcp]="false"
|
||||
[isRepository]="true">
|
||||
</app-status-tab>
|
||||
</div>
|
||||
</mat-tab>
|
||||
|
|
|
@ -34,6 +34,7 @@ export class GlobalStatusComponent implements OnInit {
|
|||
dhcpServicesStatus: any = {};
|
||||
dhcpDiskUsageChartData: any[] = [];
|
||||
isDhcp: boolean = false;
|
||||
isRepository: boolean = false;
|
||||
|
||||
constructor(
|
||||
private configService: ConfigService,
|
||||
|
@ -101,7 +102,7 @@ export class GlobalStatusComponent implements OnInit {
|
|||
data => {
|
||||
this.repositories = data['hydra:member'];
|
||||
this.repositories.forEach(repository => {
|
||||
this.loadRepositoryStatus(repository.id);
|
||||
this.loadRepositoryStatus(repository.uuid);
|
||||
});
|
||||
this.loading = false;
|
||||
},
|
||||
|
@ -112,11 +113,12 @@ export class GlobalStatusComponent implements OnInit {
|
|||
);
|
||||
}
|
||||
|
||||
loadRepositoryStatus(repositoryId: string): void {
|
||||
this.http.get<any>(`${this.baseUrl}/image-repositories/server/${repositoryId}/status`).subscribe(
|
||||
loadRepositoryStatus(repositoryUuid: string): void {
|
||||
this.isRepository = true;
|
||||
this.http.get<any>(`${this.baseUrl}/image-repositories/server/${repositoryUuid}/status`).subscribe(
|
||||
data => {
|
||||
const output = data.output;
|
||||
this.repositoryStatuses[repositoryId] = {
|
||||
this.repositoryStatuses[repositoryUuid] = {
|
||||
...output,
|
||||
disk: {
|
||||
...output.disk,
|
||||
|
@ -131,7 +133,7 @@ export class GlobalStatusComponent implements OnInit {
|
|||
};
|
||||
},
|
||||
error => {
|
||||
console.error(`Error fetching status for repository ${repositoryId}`, error);
|
||||
console.error(`Error fetching status for repository ${repositoryUuid}`, error);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
</div>
|
||||
|
||||
<!-- RAM Usage Section -->
|
||||
<div class="ram-usage-container">
|
||||
<div class="ram-usage-container" *ngIf="isRepository">
|
||||
<h3 class="ram-title">Uso de RAM</h3>
|
||||
<div class="ram-usage">
|
||||
<ngx-charts-pie-chart [view]="view" [scheme]="colorScheme" [results]="ramUsageChartData" [doughnut]="isDoughnut"
|
||||
|
@ -36,7 +36,7 @@
|
|||
</div>
|
||||
|
||||
<!-- CPU Usage Section -->
|
||||
<div class="cpu-usage-container">
|
||||
<div class="cpu-usage-container" *ngIf="isRepository">
|
||||
<h3 class="cpu-title">Uso de CPU</h3>
|
||||
<div class="cpu-usage">
|
||||
<p>Usado: <strong>{{ cpuUsage.used_percentage }}</strong></p>
|
||||
|
@ -55,6 +55,18 @@
|
|||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- Processes Status Section -->
|
||||
<div class="processes-status" *ngIf="isRepository">
|
||||
<h3 class="process-title">Procesos</h3>
|
||||
<ul class="process-list">
|
||||
<li *ngFor="let process of getProcesses()">
|
||||
<span class="status-led"
|
||||
[ngClass]="{ 'active': process.status === 'running', 'inactive': process.status !== 'running' }"></span>
|
||||
{{ process.name }}: {{ process.status }}
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- Installed OgLives / Subnets Section -->
|
||||
<div>
|
||||
<h3>{{ isDhcp ? ('subnets' | translate) : ('InstalledOglivesTitle' | translate)}}</h3>
|
||||
|
|
|
@ -23,6 +23,7 @@ export class StatusTabComponent {
|
|||
@Input() ramUsage: any = {};
|
||||
@Input() cpuUsage: any = {};
|
||||
@Input() ramUsageChartData: any[] = [];
|
||||
@Input() isRepository: boolean = false;
|
||||
|
||||
getServices(): { name: string, status: string }[] {
|
||||
if (!this.servicesStatus) {
|
||||
|
@ -35,6 +36,16 @@ export class StatusTabComponent {
|
|||
return services;
|
||||
}
|
||||
|
||||
getProcesses(): { name: string, status: string }[] {
|
||||
if (!this.processesStatus) {
|
||||
return [];
|
||||
}
|
||||
return Object.keys(this.processesStatus).map(key => ({
|
||||
name: key,
|
||||
status: this.processesStatus[key]
|
||||
}));
|
||||
}
|
||||
|
||||
formatBytes(bytes: number): string {
|
||||
if (bytes >= 1e9) {
|
||||
return (bytes / 1e9).toFixed(2) + ' GB';
|
||||
|
|
Loading…
Reference in New Issue