From e9a00119aaed1db5b7d9fe66e3f02537a50cedc5 Mon Sep 17 00:00:00 2001 From: Lucas Lara Date: Fri, 11 Apr 2025 13:20:53 +0200 Subject: [PATCH 1/7] Fix incorrect path for loading config.json in ConfigService --- ogWebconsole/src/app/services/config.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ogWebconsole/src/app/services/config.service.ts b/ogWebconsole/src/app/services/config.service.ts index e6c0e1b..6f17cd9 100644 --- a/ogWebconsole/src/app/services/config.service.ts +++ b/ogWebconsole/src/app/services/config.service.ts @@ -12,7 +12,7 @@ export class ConfigService { constructor(private http: HttpClient) {} loadConfig() { - return this.http.get('/assets/config.json').pipe( + return this.http.get('assets/config.json').pipe( catchError((error) => { console.error('Error loading config.json', error); return of({}); From 436267cfb9a7d9806a8788028d9d41fe3af6f866 Mon Sep 17 00:00:00 2001 From: Lucas Lara Date: Tue, 15 Apr 2025 15:17:03 +0200 Subject: [PATCH 2/7] refs #1883 Move 'Execute commands' to tree node actions --- .../execute-command/execute-command.component.html | 11 ++++++++--- .../execute-command/execute-command.component.ts | 2 +- .../src/app/components/groups/groups.component.html | 11 ++++++++--- .../src/app/components/groups/groups.component.ts | 6 ++++-- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/ogWebconsole/src/app/components/commands/main-commands/execute-command/execute-command.component.html b/ogWebconsole/src/app/components/commands/main-commands/execute-command/execute-command.component.html index d68c2bd..0d66031 100644 --- a/ogWebconsole/src/app/components/commands/main-commands/execute-command/execute-command.component.html +++ b/ogWebconsole/src/app/components/commands/main-commands/execute-command/execute-command.component.html @@ -8,12 +8,17 @@ [matMenuTriggerFor]="commandMenu"> {{ buttonText }} + + - + \ No newline at end of file diff --git a/ogWebconsole/src/app/components/commands/main-commands/execute-command/execute-command.component.ts b/ogWebconsole/src/app/components/commands/main-commands/execute-command/execute-command.component.ts index 4c5aff9..90af7b0 100644 --- a/ogWebconsole/src/app/components/commands/main-commands/execute-command/execute-command.component.ts +++ b/ogWebconsole/src/app/components/commands/main-commands/execute-command/execute-command.component.ts @@ -11,7 +11,7 @@ import { ConfigService } from '@services/config.service'; }) export class ExecuteCommandComponent implements OnInit { @Input() clientData: any[] = []; - @Input() buttonType: 'icon' | 'text' = 'icon'; + @Input() buttonType: 'icon' | 'text' | 'menu-item' = 'icon'; @Input() buttonText: string = 'Ejecutar Comandos'; @Input() icon: string = 'terminal'; @Input() disabled: boolean = false; diff --git a/ogWebconsole/src/app/components/groups/groups.component.html b/ogWebconsole/src/app/components/groups/groups.component.html index a54f2d3..7510c73 100644 --- a/ogWebconsole/src/app/components/groups/groups.component.html +++ b/ogWebconsole/src/app/components/groups/groups.component.html @@ -198,6 +198,9 @@ delete {{ 'delete' | translate }} + + @@ -245,7 +248,8 @@
+ [checked]="selection.isSelected(client)" + [disabled]="client.status === 'busy' || client.status === 'off' || client.status === 'disconnected'"> Client Icon @@ -314,7 +318,8 @@ + [checked]="selection.isSelected(row)" + [disabled]="row.status === 'busy' || row.status === 'off' || row.status === 'disconnected'"> @@ -424,4 +429,4 @@
-
+ \ No newline at end of file diff --git a/ogWebconsole/src/app/components/groups/groups.component.ts b/ogWebconsole/src/app/components/groups/groups.component.ts index 088cc9f..a4b9c43 100644 --- a/ogWebconsole/src/app/components/groups/groups.component.ts +++ b/ogWebconsole/src/app/components/groups/groups.component.ts @@ -369,13 +369,15 @@ export class GroupsComponent implements OnInit, OnDestroy { onNodeClick(event: MouseEvent, node: TreeNode): void { event.stopPropagation(); this.selectedNode = node; - this.fetchClientsForNode(node); + const selectedClientsBeforeEdit = this.selection.selected.map(client => client.uuid); + this.fetchClientsForNode(node, selectedClientsBeforeEdit); } onMenuClick(event: Event, node: any): void { event.stopPropagation(); this.selectedNode = node; - this.fetchClientsForNode(node); + const selectedClientsBeforeEdit = this.selection.selected.map(client => client.uuid); + this.fetchClientsForNode(node, selectedClientsBeforeEdit); } From 6205f3ad2f013bfe99bf8301b18ace05af530582 Mon Sep 17 00:00:00 2001 From: Manuel Aranda Date: Tue, 15 Apr 2025 18:37:36 +0200 Subject: [PATCH 3/7] refs #1919. Fixed bug when removed partition --- .../partition-assistant/partition-assistant.component.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ogWebconsole/src/app/components/groups/components/client-main-view/partition-assistant/partition-assistant.component.ts b/ogWebconsole/src/app/components/groups/components/client-main-view/partition-assistant/partition-assistant.component.ts index a6416f8..14273fb 100644 --- a/ogWebconsole/src/app/components/groups/components/client-main-view/partition-assistant/partition-assistant.component.ts +++ b/ogWebconsole/src/app/components/groups/components/client-main-view/partition-assistant/partition-assistant.component.ts @@ -288,7 +288,9 @@ export class PartitionAssistantComponent { this.loading = true; - const totalPartitionSize = this.selectedDisk.partitions.reduce((sum: any, partition: { size: any; }) => sum + partition.size, 0); + const totalPartitionSize = this.selectedDisk.partitions + .filter((partition: any) => !partition.removed) + .reduce((sum: any, partition: any) => sum + partition.size, 0); if (totalPartitionSize > this.selectedDisk.totalDiskSize) { this.toastService.error('El tamaño total de las particiones en el disco seleccionado excede el tamaño total del disco.'); From cbe15bba4d8a027f0dbf503b5aa82716a5ecb496 Mon Sep 17 00:00:00 2001 From: Manuel Aranda Date: Wed, 16 Apr 2025 10:50:27 +0200 Subject: [PATCH 4/7] refs #1907. Updated global status sync endpoints --- .../global-status/global-status.component.ts | 54 ++++++++++++++++++- .../app/components/groups/groups.component.ts | 2 +- .../pxe-images/pxe-images.component.html | 2 - .../ogboot/pxe-images/pxe-images.component.ts | 12 ----- .../components/ogboot/pxe/pxe.component.html | 4 +- .../components/ogboot/pxe/pxe.component.ts | 16 +----- .../ogdhcp/og-dhcp-subnets.component.ts | 28 ++-------- 7 files changed, 62 insertions(+), 56 deletions(-) diff --git a/ogWebconsole/src/app/components/global-status/global-status.component.ts b/ogWebconsole/src/app/components/global-status/global-status.component.ts index 0b0206c..8115ba7 100644 --- a/ogWebconsole/src/app/components/global-status/global-status.component.ts +++ b/ogWebconsole/src/app/components/global-status/global-status.component.ts @@ -2,6 +2,7 @@ import { HttpClient } from '@angular/common/http'; import { Component, OnInit } from '@angular/core'; import { ConfigService } from '@services/config.service'; import { MatTabChangeEvent } from '@angular/material/tabs'; +import {ToastrService} from "ngx-toastr"; @Component({ selector: 'app-global-status', @@ -40,6 +41,7 @@ export class GlobalStatusComponent implements OnInit { constructor( private configService: ConfigService, + private toastService: ToastrService, private http: HttpClient ) { this.baseUrl = this.configService.apiUrl; @@ -50,6 +52,56 @@ export class GlobalStatusComponent implements OnInit { ngOnInit(): void { this.loadOgBootStatus(); + this.syncSubnets() + this.syncTemplates() + this.syncOgLives() + } + + syncSubnets() { + const timeoutId = setTimeout(() => { + this.toastService.error('Error al sincronizar las subredes: tiempo de espera agotado'); + }, 3500); + + this.http.post(`${this.baseUrl}/subnets/sync`, {}).subscribe({ + next: (response) => { + clearTimeout(timeoutId); + this.toastService.success('Sincronización con componente DHCP exitosa'); + }, + error: (error) => { + clearTimeout(timeoutId); + this.toastService.error('Error al sincronizar las subredes DHCP'); + } + }); + } + + syncTemplates() { + const timeoutId = setTimeout(() => { + this.toastService.error('Error al sincronizar las plantillas Pxe: tiempo de espera agotado'); + }, 3500); + + this.http.post(`${this.baseUrl}/pxe-templates/sync`, {}) + .subscribe(response => { + clearTimeout(timeoutId); + this.toastService.success('Sincronización de las plantillas Pxe completada'); + }, error => { + clearTimeout(timeoutId); + this.toastService.error('Error al sincronizar las plantillas Pxe'); + }); + } + + syncOgLives(): void { + const timeoutId = setTimeout(() => { + this.toastService.error('Error al sincronizar las imagenes ogLive : tiempo de espera agotado'); + }, 3500); + + this.http.post(`${this.baseUrl}/og-lives/sync`, {}) + .subscribe(response => { + clearTimeout(timeoutId); + this.toastService.success('Sincronización con los ogLives completada'); + }, error => { + clearTimeout(timeoutId); + this.toastService.error('Error al sincronizar imágenes ogLive'); + }); } [key: string]: any; @@ -193,4 +245,4 @@ export class GlobalStatusComponent implements OnInit { } } } -} \ No newline at end of file +} diff --git a/ogWebconsole/src/app/components/groups/groups.component.ts b/ogWebconsole/src/app/components/groups/groups.component.ts index a4b9c43..20e52bf 100644 --- a/ogWebconsole/src/app/components/groups/groups.component.ts +++ b/ogWebconsole/src/app/components/groups/groups.component.ts @@ -421,7 +421,7 @@ export class GroupsComponent implements OnInit, OnDestroy { width: '900px', }); dialogRef.afterClosed().subscribe((newUnit) => { - if (newUnit?.uuid) { + if (newUnit) { this.refreshData(newUnit.uuid); } }); diff --git a/ogWebconsole/src/app/components/ogboot/pxe-images/pxe-images.component.html b/ogWebconsole/src/app/components/ogboot/pxe-images/pxe-images.component.html index 72cce0c..bf13061 100644 --- a/ogWebconsole/src/app/components/ogboot/pxe-images/pxe-images.component.html +++ b/ogWebconsole/src/app/components/ogboot/pxe-images/pxe-images.component.html @@ -1,5 +1,3 @@ - -
- - + + + + + + + @@ -429,4 +442,4 @@ - \ No newline at end of file + diff --git a/ogWebconsole/src/app/components/groups/groups.component.ts b/ogWebconsole/src/app/components/groups/groups.component.ts index 20e52bf..894fff1 100644 --- a/ogWebconsole/src/app/components/groups/groups.component.ts +++ b/ogWebconsole/src/app/components/groups/groups.component.ts @@ -87,7 +87,7 @@ export class GroupsComponent implements OnInit, OnDestroy { { value: 'mac', name: 'Mac' }, ]; - displayedColumns: string[] = ['select', 'status', 'ip', 'name', 'oglive', 'subnet', 'pxeTemplate', 'actions']; + displayedColumns: string[] = ['select', 'status', 'ip', 'firmwareType', 'name', 'oglive', 'subnet', 'pxeTemplate', 'actions']; private _sort!: MatSort; diff --git a/ogWebconsole/src/app/components/groups/shared/clients/manage-client/manage-client.component.ts b/ogWebconsole/src/app/components/groups/shared/clients/manage-client/manage-client.component.ts index 3f6a793..163fbcb 100644 --- a/ogWebconsole/src/app/components/groups/shared/clients/manage-client/manage-client.component.ts +++ b/ogWebconsole/src/app/components/groups/shared/clients/manage-client/manage-client.component.ts @@ -105,6 +105,7 @@ export class ManageClientComponent implements OnInit { this.parentUnitsWithPaths = this.parentUnits.map(unit => ({ id: unit['@id'], name: unit.name, + netiface: unit.networkSettings?.netiface, path: this.dataService.getOrganizationalUnitPath(unit, this.parentUnits), repository: unit.networkSettings?.repository?.['@id'], hardwareProfile: unit.networkSettings?.hardwareProfile?.['@id'], @@ -226,7 +227,8 @@ export class ManageClientComponent implements OnInit { repository: selectedUnit.repository || null, hardwareProfile: selectedUnit.hardwareProfile || null, ogLive: selectedUnit.ogLive || null, - menu: selectedUnit.menu || null + menu: selectedUnit.menu || null, + netiface: selectedUnit.netiface || null, }); } } diff --git a/ogWebconsole/src/app/components/ogdhcp/og-dhcp-subnets.component.spec.ts b/ogWebconsole/src/app/components/ogdhcp/og-dhcp-subnets.component.spec.ts index e39ef39..a97e5bc 100644 --- a/ogWebconsole/src/app/components/ogdhcp/og-dhcp-subnets.component.spec.ts +++ b/ogWebconsole/src/app/components/ogdhcp/og-dhcp-subnets.component.spec.ts @@ -72,10 +72,4 @@ describe('OgDhcpSubnetsComponent', () => { expect(component).toBeTruthy(); }); - it('should call syncSubnets and handle success', () => { - component.syncSubnets(); - expect(mockHttpClient.post).toHaveBeenCalledWith(`${component.baseUrl}/subnets/sync`, {}); - expect(mockToastrService.success).toHaveBeenCalledWith('Sincronización con componente DHCP exitosa'); - }); - }); diff --git a/ogWebconsole/src/locale/en.json b/ogWebconsole/src/locale/en.json index e4cdc65..6bc649a 100644 --- a/ogWebconsole/src/locale/en.json +++ b/ogWebconsole/src/locale/en.json @@ -21,6 +21,7 @@ "labelOrganizationalUnit": "Organizational Unit", "buttonCancel": "Cancel", "buttonAdd": "Add", + "firmwareType": "Firmware", "addRule": "Add rule", "rulesHeader": "Rules", "statusUnavailable": "Unavailable", diff --git a/ogWebconsole/src/locale/es.json b/ogWebconsole/src/locale/es.json index 61d4a44..fb6d793 100644 --- a/ogWebconsole/src/locale/es.json +++ b/ogWebconsole/src/locale/es.json @@ -21,6 +21,7 @@ "labelOrganizationalUnit": "Unidad organizativa", "buttonCancel": "Cancelar", "buttonAdd": "Añadir", + "firmwareType": "Firmware", "back": "Atrás", "addClientDialogTitle": "Añadir Cliente", "dialogTitleEditUser": "Editar usuario", From ce1a06d51bd40580df7399bd57ef28d0cdcdbe33 Mon Sep 17 00:00:00 2001 From: Manuel Aranda Date: Wed, 16 Apr 2025 11:23:11 +0200 Subject: [PATCH 7/7] Added changelog --- CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e572ec..db16a14 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,14 @@ # Changelog +## [0.11.1] - 2025-4-16 +### Improved +- Nuevos campos en la tabla de clientes. Tipo de firmware y mac. + +## Fixed +- Se ha corregido error al crear OUs, que no refrescaba la web. +- Se ha corregido error en el formulario de creacion de imagenes. Si se seleccionaba una imagen para un versionado, no dejaba deseleccionar. +- Se ha corregido un bug en el particionador que impedia ejecutar, cuando eliminabamos una particion. + +--- ## [0.11.0] - 2025-4-11 ### Added - Se ha diseñado el nuevo formulario para poder ejecutar script. Sistema mejorado con variables etiquetadas.
{{ column.header }} diff --git a/ogWebconsole/src/app/components/ogboot/pxe/pxe.component.ts b/ogWebconsole/src/app/components/ogboot/pxe/pxe.component.ts index a07895f..55cb6ad 100644 --- a/ogWebconsole/src/app/components/ogboot/pxe/pxe.component.ts +++ b/ogWebconsole/src/app/components/ogboot/pxe/pxe.component.ts @@ -1,5 +1,5 @@ import { HttpClient } from '@angular/common/http'; -import { Component } from '@angular/core'; +import {Component, OnInit} from '@angular/core'; import { CreatePxeTemplateComponent } from './create-pxeTemplate/create-pxe-template.component'; import { MatDialog } from '@angular/material/dialog'; import { MatTableDataSource } from '@angular/material/table'; @@ -19,7 +19,7 @@ import { ConfigService } from '@services/config.service'; templateUrl: './pxe.component.html', styleUrls: ['./pxe.component.css'] }) -export class PxeComponent { +export class PxeComponent implements OnInit{ baseUrl: string; private apiUrl: string; pxeTemplates: any[] = []; @@ -76,7 +76,6 @@ export class PxeComponent { this.loading = true; this.search(); this.loadAlert() - this.syncTemplates() this.loading = false; } @@ -147,17 +146,6 @@ export class PxeComponent { const dialogRef = this.dialog.open(ShowTemplateContentComponent, { data: { data }, width: '700px' }); } - syncTemplates() { - this.http.post(`${this.apiUrl}/sync`, {}) - .subscribe(response => { - this.toastService.success('Sincronización completada'); - this.search() - }, error => { - console.error('Error al sincronizar', error); - this.toastService.error('Error al sincronizar'); - }); - } - applyFilter() { this.http.get(`${this.apiUrl}?page=${this.page}&itemsPerPage=${this.itemsPerPage}`).subscribe({ next: (response) => { diff --git a/ogWebconsole/src/app/components/ogdhcp/og-dhcp-subnets.component.ts b/ogWebconsole/src/app/components/ogdhcp/og-dhcp-subnets.component.ts index cd14ce3..8d59124 100644 --- a/ogWebconsole/src/app/components/ogdhcp/og-dhcp-subnets.component.ts +++ b/ogWebconsole/src/app/components/ogdhcp/og-dhcp-subnets.component.ts @@ -69,19 +69,21 @@ export class OgDhcpSubnetsComponent implements OnInit { } ngOnInit() { - this.loading = true; this.loadAlert() - this.syncSubnets() + this.loadSubnets() } loadSubnets() { + this.loading = true; this.http.get(`${this.baseUrl}/subnets?page=${this.page + 1}&itemsPerPage=${this.itemsPerPage}`).subscribe({ next: (response) => { this.dataSource.data = response['hydra:member']; this.length = response['hydra:totalItems']; + this.loading = false; }, error: error => { this.toastService.error(error.error['hydra:description']); + this.loading = false; } }); @@ -90,28 +92,6 @@ export class OgDhcpSubnetsComponent implements OnInit { } } - syncSubnets() { - this.loading = true; - const timeoutId = setTimeout(() => { - this.loading = false; - this.toastService.error('Error al sincronizar: tiempo de espera agotado'); - }, 3500); - - this.http.post(`${this.apiUrl}/sync`, {}).subscribe({ - next: (response) => { - clearTimeout(timeoutId); - this.toastService.success('Sincronización con componente DHCP exitosa'); - this.loadSubnets(); - this.loading = false; - }, - error: (error) => { - clearTimeout(timeoutId); - this.loading = false; - this.toastService.error('Error al sincronizar'); - } - }); - } - toggleAction(subnet: any, action: string): void { switch (action) { case 'get': From c7919cf412e5ed6ea978d544075e751e53dabd37 Mon Sep 17 00:00:00 2001 From: Manuel Aranda Date: Wed, 16 Apr 2025 10:52:02 +0200 Subject: [PATCH 5/7] refs #1921. Crreate image version bug in selector --- .../client-main-view/create-image/create-image.component.html | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ogWebconsole/src/app/components/groups/components/client-main-view/create-image/create-image.component.html b/ogWebconsole/src/app/components/groups/components/client-main-view/create-image/create-image.component.html index 2b2936b..3369556 100644 --- a/ogWebconsole/src/app/components/groups/components/client-main-view/create-image/create-image.component.html +++ b/ogWebconsole/src/app/components/groups/components/client-main-view/create-image/create-image.component.html @@ -24,6 +24,10 @@ {{ image?.name }} + Seleccione la imagen para sobreescribir si se requiere. From a0d833726ddd616567d9731a15134b4e6f73dc28 Mon Sep 17 00:00:00 2001 From: Manuel Aranda Date: Wed, 16 Apr 2025 11:17:11 +0200 Subject: [PATCH 6/7] refs #1922. Show new fields in clients table --- .../app/components/groups/groups.component.html | 17 +++++++++++++++-- .../app/components/groups/groups.component.ts | 2 +- .../manage-client/manage-client.component.ts | 4 +++- .../ogdhcp/og-dhcp-subnets.component.spec.ts | 6 ------ ogWebconsole/src/locale/en.json | 1 + ogWebconsole/src/locale/es.json | 1 + 6 files changed, 21 insertions(+), 10 deletions(-) diff --git a/ogWebconsole/src/app/components/groups/groups.component.html b/ogWebconsole/src/app/components/groups/groups.component.html index 7510c73..c780882 100644 --- a/ogWebconsole/src/app/components/groups/groups.component.html +++ b/ogWebconsole/src/app/components/groups/groups.component.html @@ -348,9 +348,22 @@ IP - {{ client.ip }} +
+ {{ client.ip }} + {{ client.mac }} +
{{ 'firmwareType' | translate }} + + {{ client.firmwareType ? client.firmwareType : 'N/A' }} + + OG Live {{ client.ogLive?.date | date }}