develop #21

Merged
maranda merged 5 commits from develop into main 2025-04-16 14:36:15 +02:00
5 changed files with 37 additions and 16 deletions

View File

@ -1,4 +1,9 @@
# Changelog # Changelog
## [0.11.2] - 2025-4-16
### Fixed
- Se ha corregido un error en la actualizacion del estado de los pcs en la vista tarjetas.
---
## [0.11.1] - 2025-4-16 ## [0.11.1] - 2025-4-16
### Improved ### Improved
- Nuevos campos en la tabla de clientes. Tipo de firmware y mac. - Nuevos campos en la tabla de clientes. Tipo de firmware y mac.

View File

@ -198,8 +198,8 @@
<mat-icon>delete</mat-icon> <mat-icon>delete</mat-icon>
<span>{{ 'delete' | translate }}</span> <span>{{ 'delete' | translate }}</span>
</button> </button>
<app-execute-command [clientData]="selection.selected" [buttonType]="'menu-item'" <app-execute-command [clientData]="selectedNode?.clients || []" [buttonType]="'menu-item'"
[buttonText]="'Ejecutar comandos'" [icon]="'terminal'" [disabled]="selection.selected.length === 0"> [buttonText]="'Ejecutar comandos'" [icon]="'terminal'" [disabled]="!((selectedNode?.clients ?? []).length > 0)">
</app-execute-command> </app-execute-command>
</mat-menu> </mat-menu>

View File

@ -1,4 +1,4 @@
import { Component, OnInit, OnDestroy, ViewChild, QueryList, ViewChildren } from '@angular/core'; import {Component, OnInit, OnDestroy, ViewChild, QueryList, ViewChildren, ChangeDetectorRef} from '@angular/core';
import { HttpClient, HttpParams } from '@angular/common/http'; import { HttpClient, HttpParams } from '@angular/common/http';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { MatDialog } from '@angular/material/dialog'; import { MatDialog } from '@angular/material/dialog';
@ -110,7 +110,8 @@ export class GroupsComponent implements OnInit, OnDestroy {
private joyrideService: JoyrideService, private joyrideService: JoyrideService,
private breakpointObserver: BreakpointObserver, private breakpointObserver: BreakpointObserver,
private toastr: ToastrService, private toastr: ToastrService,
private configService: ConfigService private configService: ConfigService,
private cd: ChangeDetectorRef,
) { ) {
this.baseUrl = this.configService.apiUrl; this.baseUrl = this.configService.apiUrl;
this.mercureUrl = this.configService.mercureUrl; this.mercureUrl = this.configService.mercureUrl;
@ -175,23 +176,35 @@ export class GroupsComponent implements OnInit, OnDestroy {
}) })
} }
private updateClientStatus(clientUuid: string, newStatus: string): void { private updateClientStatus(clientUuid: string, status: string): void {
const clientIndex = this.selectedClients.data.findIndex(client => client['@id'] === clientUuid); let updated = false;
if (clientIndex !== -1) { const index = this.arrayClients.findIndex(client => client['@id'] === clientUuid);
if (index !== -1) {
const updatedClient = {...this.arrayClients[index], status};
this.arrayClients = [
...this.arrayClients.slice(0, index),
updatedClient,
...this.arrayClients.slice(index + 1)
];
updated = true;
}
const tableIndex = this.selectedClients.data.findIndex(client => client['@id'] === clientUuid);
if (tableIndex !== -1) {
const updatedClients = [...this.selectedClients.data]; const updatedClients = [...this.selectedClients.data];
updatedClients[clientIndex] = { updatedClients[tableIndex] = {
...updatedClients[clientIndex], ...updatedClients[tableIndex],
status: newStatus status: status
}; };
this.selectedClients.data = updatedClients; this.selectedClients.data = updatedClients;
this.arrayClients = updatedClients; }
console.log(`Estado actualizado para el cliente ${clientUuid}: ${newStatus}`); if (updated) {
} else { this.cd.detectChanges();
console.warn(`Cliente con UUID ${clientUuid} no encontrado en la lista.`);
} }
} }
@ -388,6 +401,9 @@ export class GroupsComponent implements OnInit, OnDestroy {
this.http.get<any>(`${this.baseUrl}/clients?organizationalUnit.id=${node.id}&page=${this.page + 1}&itemsPerPage=${this.itemsPerPage}`, { params }).subscribe({ this.http.get<any>(`${this.baseUrl}/clients?organizationalUnit.id=${node.id}&page=${this.page + 1}&itemsPerPage=${this.itemsPerPage}`, { params }).subscribe({
next: (response: any) => { next: (response: any) => {
this.selectedClients.data = response['hydra:member']; this.selectedClients.data = response['hydra:member'];
if (this.selectedNode) {
this.selectedNode.clients = response['hydra:member'];
}
this.length = response['hydra:totalItems']; this.length = response['hydra:totalItems'];
this.arrayClients = this.selectedClients.data; this.arrayClients = this.selectedClients.data;
this.hasClients = this.selectedClients.data.length > 0; this.hasClients = this.selectedClients.data.length > 0;

View File

@ -60,7 +60,7 @@ export class RepositoriesComponent implements OnInit {
cell: (repository: any) => `${this.datePipe.transform(repository.createdAt, 'dd/MM/yyyy hh:mm:ss')}` cell: (repository: any) => `${this.datePipe.transform(repository.createdAt, 'dd/MM/yyyy hh:mm:ss')}`
} }
]; ];
isGitModuleInstalled: boolean = true; isGitModuleInstalled: boolean = false;
displayedColumns: string[] = ['id', 'name', 'ip', 'user', 'images', 'createdAt', 'actions']; displayedColumns: string[] = ['id', 'name', 'ip', 'user', 'images', 'createdAt', 'actions'];
constructor( constructor(

View File

@ -10,7 +10,7 @@
</div> </div>
<div class="images-button-row"> <div class="images-button-row">
<button class="action-button" (click)="openImageInfoDialog()">Ver Información</button> <button class="action-button" (click)="openImageInfoDialog()">Ver Información</button>
<button class="action-button" (click)="syncRepository()">Sincronizar base de datos</button> <button disabled class="action-button" (click)="syncRepository()">Sincronizar base de datos</button>
<button class="action-button" (click)="importImage()"> <button class="action-button" (click)="importImage()">
{{ 'importImageButton' | translate }} {{ 'importImageButton' | translate }}
</button> </button>