refs #2942. OU - Clientes by node toggle
testing/ogGui-multibranch/pipeline/head There was a failure building this commit Details

pull/67/head
Manuel Aranda Rosales 2026-04-13 12:15:18 +02:00
parent 2012e87fb9
commit dc9bfa46c3
5 changed files with 43 additions and 4 deletions

View File

@ -437,6 +437,13 @@ mat-tree mat-tree-node.disabled:hover {
box-sizing: border-box;
}
.direct-clients-toggle {
display: flex;
align-items: center;
padding: 4px 2px;
font-size: 13px;
}
::ng-deep .filters-container .mat-form-field-wrapper {
padding-bottom: 4px !important;
margin: 0 !important;

View File

@ -104,6 +104,16 @@
</button>
</mat-form-field>
<div class="direct-clients-toggle">
<mat-slide-toggle
[(ngModel)]="showOnlyDirectClients"
(change)="onDirectClientsToggleChange()"
matTooltip="{{ 'directClientsToggleTooltip' | translate }}"
matTooltipShowDelay="1000">
{{ 'directClientsToggle' | translate }}
</mat-slide-toggle>
</div>
<!-- Funcionalidad actualmente deshabilitada-->
<!-- <mat-form-field appearance="outline">
<mat-select (selectionChange)="loadSelectedFilter($event.value)" placeholder="Cargar filtro" disabled>

View File

@ -81,6 +81,7 @@ export class GroupsComponent implements OnInit, OnDestroy {
filters: { [key: string]: string } = {};
private clientFilterSubject = new Subject<string>();
loading = false;
showOnlyDirectClients: boolean = false;
// Nuevas propiedades para funcionalidades mejoradas
selectedClient: any = null;
@ -431,11 +432,21 @@ export class GroupsComponent implements OnInit, OnDestroy {
this.isLoadingClients = true;
this.http.get<any>(`${this.baseUrl}/clients?organizationalUnit.id=${node.id}&page=${this.page + 1}&itemsPerPage=${this.itemsPerPage}`, { params: backendParams }).subscribe({
next: (response: any) => {
this.selectedClients.data = response['hydra:member'];
if (this.selectedNode) {
this.selectedNode.clients = response['hydra:member'];
let members = response['hydra:member'];
let total = response['hydra:totalItems'];
if (this.showOnlyDirectClients && node['@id']) {
members = members.filter((client: any) =>
client.organizationalUnit?.['@id'] === node['@id']
);
total = members.length;
}
this.length = response['hydra:totalItems'];
this.selectedClients.data = members;
if (this.selectedNode) {
this.selectedNode.clients = members;
}
this.length = total;
this.arrayClients = this.selectedClients.data;
this.hasClients = this.selectedClients.data.length > 0;
this.isLoadingClients = false;
@ -458,6 +469,13 @@ export class GroupsComponent implements OnInit, OnDestroy {
});
}
onDirectClientsToggleChange(): void {
this.page = 0;
if (this.selectedNode) {
this.fetchClientsForNode(this.selectedNode);
}
}
onPageChange(event: PageEvent): void {
this.page = event.pageIndex;
this.itemsPerPage = event.pageSize;

View File

@ -576,6 +576,8 @@
"vistatarjeta": "Card View",
"ejecutarComandos": "Execute Commands",
"searchState": "Search state",
"directClientsToggle": "Current node only",
"directClientsToggleTooltip": "Show only equipment directly assigned to the selected node (no descendants)",
"executeCommands": {
"powerOn": "Power On",
"powerOff": "Shut Down",

View File

@ -577,6 +577,8 @@
"vistatarjeta": "Vista Tarjeta",
"ejecutarComandos": "Ejecutar Comandos",
"searchState": "Buscar por estado",
"directClientsToggle": "Solo nodo actual",
"directClientsToggleTooltip": "Mostrar solo los equipos directamente asignados al nodo seleccionado (sin descendientes)",
"executeCommands": {
"powerOn": "Encender",
"powerOff": "Apagar",